@lombard.finance/sdk 4.3.2 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +6 -6
- package/dist/api-functions/generateDepositBtcAddress/generateDepositBtcAddress.d.ts.map +1 -1
- package/dist/api-functions/getDepositBtcAddress/getDepositBtcAddress.d.ts.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.js +29 -29
- package/dist/bridge.cjs +1 -1
- package/dist/bridge.js +7 -7
- package/dist/btc.cjs +1 -1
- package/dist/btc.js +10 -10
- package/dist/chains/btc/actions/deposit/BtcDeposit.d.ts +7 -4
- package/dist/chains/btc/actions/deposit/BtcDeposit.d.ts.map +1 -1
- package/dist/chains/btc/actions/deposit/config/index.d.ts +16 -8
- package/dist/chains/btc/actions/deposit/config/index.d.ts.map +1 -1
- package/dist/chains/btc/actions/deposit/config/solana.d.ts +20 -0
- package/dist/chains/btc/actions/deposit/config/solana.d.ts.map +1 -0
- package/dist/chains/btc/actions/deposit/config/types.d.ts +4 -3
- package/dist/chains/btc/actions/deposit/config/types.d.ts.map +1 -1
- package/dist/chains/evm/EvmActions.d.ts +4 -4
- package/dist/chains/evm/actions/deposit/config/evm.d.ts +3 -3
- package/dist/chains/evm/actions/deposit/config/evm.d.ts.map +1 -1
- package/dist/chains/evm/actions/deposit/config/types.d.ts +1 -1
- package/dist/chains/evm/actions/deposit/config/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/deposit/factory.d.ts +1 -1
- package/dist/chains/evm/actions/deposit/types.d.ts +1 -1
- package/dist/chains/evm/actions/deposit/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/redeem/EvmRedeem.d.ts.map +1 -1
- package/dist/chains/evm/actions/unstake/EvmUnstake.d.ts.map +1 -1
- package/dist/chains/solana/SolanaActions.d.ts +10 -0
- package/dist/chains/solana/SolanaActions.d.ts.map +1 -1
- package/dist/chains/solana/actions/index.d.ts +1 -0
- package/dist/chains/solana/actions/index.d.ts.map +1 -1
- package/dist/chains/solana/actions/redeem/SolanaRedeem.d.ts +37 -0
- package/dist/chains/solana/actions/redeem/SolanaRedeem.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/config/index.d.ts +8 -0
- package/dist/chains/solana/actions/redeem/config/index.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/config/solana.d.ts +22 -0
- package/dist/chains/solana/actions/redeem/config/solana.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/config/types.d.ts +35 -0
- package/dist/chains/solana/actions/redeem/config/types.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/factory.d.ts +12 -0
- package/dist/chains/solana/actions/redeem/factory.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/index.d.ts +9 -0
- package/dist/chains/solana/actions/redeem/index.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/types.d.ts +52 -0
- package/dist/chains/solana/actions/redeem/types.d.ts.map +1 -0
- package/dist/chains/solana/utils.d.ts +15 -0
- package/dist/chains/solana/utils.d.ts.map +1 -0
- package/dist/chunks/BtcActions-BOVJrdTI.cjs +2 -0
- package/dist/chunks/BtcActions-BOVJrdTI.cjs.map +1 -0
- package/dist/chunks/{BtcActions-k-qs1uO0.js → BtcActions-_a8r3Q7c.js} +457 -414
- package/dist/chunks/BtcActions-_a8r3Q7c.js.map +1 -0
- package/dist/chunks/{EvmActions-B_dF42So.js → EvmActions-D4vFpbYk.js} +163 -173
- package/dist/chunks/EvmActions-D4vFpbYk.js.map +1 -0
- package/dist/chunks/EvmActions-VrDbgMDy.cjs +2 -0
- package/dist/chunks/EvmActions-VrDbgMDy.cjs.map +1 -0
- package/dist/chunks/ReferralsClient-Cmrjo9bN.cjs +2 -0
- package/dist/chunks/ReferralsClient-Cmrjo9bN.cjs.map +1 -0
- package/dist/chunks/{ReferralsClient-DbFWWtVi.js → ReferralsClient-DvEsA3II.js} +160 -160
- package/dist/chunks/ReferralsClient-DvEsA3II.js.map +1 -0
- package/dist/chunks/{api-config-CtcP3TVl.js → api-config-Dm6dR85f.js} +6 -6
- package/dist/chunks/{api-config-CtcP3TVl.js.map → api-config-Dm6dR85f.js.map} +1 -1
- package/dist/chunks/{approveLBTC-CZiZmdcX.cjs → approveLBTC-CUXEC3kw.cjs} +2 -2
- package/dist/chunks/{approveLBTC-CZiZmdcX.cjs.map → approveLBTC-CUXEC3kw.cjs.map} +1 -1
- package/dist/chunks/approveLBTC-Du2El1tW.js +26 -0
- package/dist/chunks/{approveLBTC-B5-ZWqct.js.map → approveLBTC-Du2El1tW.js.map} +1 -1
- package/dist/chunks/{array-Cev6kyLJ.js → array-DYttUPf5.js} +7 -7
- package/dist/chunks/{array-Cev6kyLJ.js.map → array-DYttUPf5.js.map} +1 -1
- package/dist/chunks/{blockchain-identifier-BzMQWh-C.cjs → blockchain-identifier-BTPGxLio.cjs} +2 -2
- package/dist/chunks/{blockchain-identifier-BzMQWh-C.cjs.map → blockchain-identifier-BTPGxLio.cjs.map} +1 -1
- package/dist/chunks/{blockchain-identifier-BmadkNtK.js → blockchain-identifier-CTVaEPpY.js} +24 -24
- package/dist/chunks/{blockchain-identifier-BmadkNtK.js.map → blockchain-identifier-CTVaEPpY.js.map} +1 -1
- package/dist/chunks/{bridge-CTsiodO1.js → bridge-DqGabhIY.js} +13 -13
- package/dist/chunks/{bridge-CTsiodO1.js.map → bridge-DqGabhIY.js.map} +1 -1
- package/dist/chunks/{bridge-BzRlY9pP.cjs → bridge-dWaKrMKm.cjs} +2 -2
- package/dist/chunks/{bridge-BzRlY9pP.cjs.map → bridge-dWaKrMKm.cjs.map} +1 -1
- package/dist/chunks/{config-hFKqUyg3.js → config-DghboRx0.js} +10 -10
- package/dist/chunks/{config-hFKqUyg3.js.map → config-DghboRx0.js.map} +1 -1
- package/dist/chunks/{config-l4ZaZw_g.cjs → config-DmCmanM_.cjs} +2 -2
- package/dist/chunks/{config-l4ZaZw_g.cjs.map → config-DmCmanM_.cjs.map} +1 -1
- package/dist/chunks/constants-D1FnS2Z8.js +6 -0
- package/dist/chunks/constants-D1FnS2Z8.js.map +1 -0
- package/dist/chunks/constants-ueShGH9R.cjs +2 -0
- package/dist/chunks/constants-ueShGH9R.cjs.map +1 -0
- package/dist/chunks/{defi-registry-BIRv_zkp.cjs → defi-registry-DDNavtO1.cjs} +2 -2
- package/dist/chunks/{defi-registry-BIRv_zkp.cjs.map → defi-registry-DDNavtO1.cjs.map} +1 -1
- package/dist/chunks/{defi-registry-wNFN3qyB.js → defi-registry-DxjjBQTV.js} +13 -13
- package/dist/chunks/{defi-registry-wNFN3qyB.js.map → defi-registry-DxjjBQTV.js.map} +1 -1
- package/dist/chunks/{depositStatus-DM7fRmbN.js → depositStatus-05_X7FVs.js} +42 -42
- package/dist/chunks/{depositStatus-DM7fRmbN.js.map → depositStatus-05_X7FVs.js.map} +1 -1
- package/dist/chunks/{depositStatus-C3-EgT2a.cjs → depositStatus-CUjHpXFJ.cjs} +2 -2
- package/dist/chunks/{depositStatus-C3-EgT2a.cjs.map → depositStatus-CUjHpXFJ.cjs.map} +1 -1
- package/dist/chunks/events-5c8IHjEF.cjs +2 -0
- package/dist/chunks/events-5c8IHjEF.cjs.map +1 -0
- package/dist/chunks/{events-DdV_xi-2.js → events-rgJZNpHd.js} +414 -303
- package/dist/chunks/events-rgJZNpHd.js.map +1 -0
- package/dist/chunks/evm-by-btc-address-CZvE15lx.js +39 -0
- package/dist/chunks/{evm-by-btc-address-CwLiENtM.js.map → evm-by-btc-address-CZvE15lx.js.map} +1 -1
- package/dist/chunks/fee-requirements-CCNsxAvJ.js +14 -0
- package/dist/chunks/{fee-requirements-x8-8mpJ7.js.map → fee-requirements-CCNsxAvJ.js.map} +1 -1
- package/dist/chunks/get-exchange-ratio-B-xzYND1.js +20 -0
- package/dist/chunks/{get-exchange-ratio-NtnkG1kZ.js.map → get-exchange-ratio-B-xzYND1.js.map} +1 -1
- package/dist/chunks/{get-exchange-ratio-C-7DadfD.cjs → get-exchange-ratio-BEhD4gLB.cjs} +2 -2
- package/dist/chunks/{get-exchange-ratio-C-7DadfD.cjs.map → get-exchange-ratio-BEhD4gLB.cjs.map} +1 -1
- package/dist/chunks/{get-positions-summary-DkZZYbGP.cjs → get-positions-summary-Dh1QPLYO.cjs} +2 -2
- package/dist/chunks/{get-positions-summary-DkZZYbGP.cjs.map → get-positions-summary-Dh1QPLYO.cjs.map} +1 -1
- package/dist/chunks/{get-positions-summary-B_MmGHLv.js → get-positions-summary-iYshN1RQ.js} +28 -28
- package/dist/chunks/{get-positions-summary-B_MmGHLv.js.map → get-positions-summary-iYshN1RQ.js.map} +1 -1
- package/dist/chunks/{get-vault-tvl-YAXePAW3.js → get-vault-tvl-Ct_Zkg7C.js} +41 -41
- package/dist/chunks/{get-vault-tvl-YAXePAW3.js.map → get-vault-tvl-Ct_Zkg7C.js.map} +1 -1
- package/dist/chunks/{get-vault-tvl-DmTUbOY7.cjs → get-vault-tvl-D_tQIDAs.cjs} +2 -2
- package/dist/chunks/{get-vault-tvl-DmTUbOY7.cjs.map → get-vault-tvl-D_tQIDAs.cjs.map} +1 -1
- package/dist/chunks/{get-vault-withdrawals-CWcYy_sH.cjs → get-vault-withdrawals-8ALlEiAC.cjs} +2 -2
- package/dist/chunks/{get-vault-withdrawals-CWcYy_sH.cjs.map → get-vault-withdrawals-8ALlEiAC.cjs.map} +1 -1
- package/dist/chunks/get-vault-withdrawals-jk7Sv4S4.js +161 -0
- package/dist/chunks/{get-vault-withdrawals-BrpZlt6s.js.map → get-vault-withdrawals-jk7Sv4S4.js.map} +1 -1
- package/dist/chunks/{getSharesByAddress-BEgOf1C0.cjs → getSharesByAddress-D8hehnP1.cjs} +2 -2
- package/dist/chunks/{getSharesByAddress-BEgOf1C0.cjs.map → getSharesByAddress-D8hehnP1.cjs.map} +1 -1
- package/dist/chunks/{getSharesByAddress-BiruCDp6.js → getSharesByAddress-_tBaIBsw.js} +38 -38
- package/dist/chunks/{getSharesByAddress-BiruCDp6.js.map → getSharesByAddress-_tBaIBsw.js.map} +1 -1
- package/dist/chunks/getUserStakeAndBakeSignature-CSEyzgMc.cjs +2 -0
- package/dist/chunks/getUserStakeAndBakeSignature-CSEyzgMc.cjs.map +1 -0
- package/dist/chunks/getUserStakeAndBakeSignature-Su-k10ap.js +125 -0
- package/dist/chunks/getUserStakeAndBakeSignature-Su-k10ap.js.map +1 -0
- package/dist/chunks/lbtc-addresses-D8MYCdsx.js +10 -0
- package/dist/chunks/{lbtc-addresses-BLRmtR3c.js.map → lbtc-addresses-D8MYCdsx.js.map} +1 -1
- package/dist/chunks/{lbtc-addresses-xyTYV7hx.cjs → lbtc-addresses-Kil252DX.cjs} +2 -2
- package/dist/chunks/{lbtc-addresses-xyTYV7hx.cjs.map → lbtc-addresses-Kil252DX.cjs.map} +1 -1
- package/dist/chunks/numbers-CclN2Ohk.js +15 -0
- package/dist/chunks/{numbers-CM-lcmt4.js.map → numbers-CclN2Ohk.js.map} +1 -1
- package/dist/chunks/parameters-C_16L5ft.js +11 -0
- package/dist/chunks/{parameters-CDV-6Hk5.js.map → parameters-C_16L5ft.js.map} +1 -1
- package/dist/chunks/satoshi-CSoJBXc6.js +19 -0
- package/dist/chunks/{satoshi-Ch6y8aYG.js.map → satoshi-CSoJBXc6.js.map} +1 -1
- package/dist/chunks/statusConstants-Cri7yswV.cjs +2 -0
- package/dist/chunks/statusConstants-Cri7yswV.cjs.map +1 -0
- package/dist/chunks/{statusConstants-DFxMrVob.js → statusConstants-Zii1786K.js} +1134 -1113
- package/dist/chunks/statusConstants-Zii1786K.js.map +1 -0
- package/dist/chunks/{storeNetworkFeeSignature-BZGL2Zn_.js → storeNetworkFeeSignature-BODIpq3Y.js} +26 -26
- package/dist/chunks/{storeNetworkFeeSignature-BZGL2Zn_.js.map → storeNetworkFeeSignature-BODIpq3Y.js.map} +1 -1
- package/dist/chunks/{storeNetworkFeeSignature-D7yo6lDV.cjs → storeNetworkFeeSignature-Buk4091C.cjs} +2 -2
- package/dist/chunks/{storeNetworkFeeSignature-D7yo6lDV.cjs.map → storeNetworkFeeSignature-Buk4091C.cjs.map} +1 -1
- package/dist/chunks/time-Sa5gggPG.js +24 -0
- package/dist/chunks/{time-QPeEEEnQ.js.map → time-Sa5gggPG.js.map} +1 -1
- package/dist/chunks/{token-addresses-FKpA3uc4.js → token-addresses-D0v5cR1j.js} +174 -163
- package/dist/chunks/{token-addresses-FKpA3uc4.js.map → token-addresses-D0v5cR1j.js.map} +1 -1
- package/dist/chunks/{token-addresses-DRBecUa7.cjs → token-addresses-nzvTOi24.cjs} +2 -2
- package/dist/chunks/{token-addresses-DRBecUa7.cjs.map → token-addresses-nzvTOi24.cjs.map} +1 -1
- package/dist/chunks/{tokens-D_HeVB5p.cjs → tokens-BkvA0Gp1.cjs} +2 -2
- package/dist/chunks/{tokens-D_HeVB5p.cjs.map → tokens-BkvA0Gp1.cjs.map} +1 -1
- package/dist/chunks/{tokens-C6qZHzph.js → tokens-DgC1hfkm.js} +18 -18
- package/dist/chunks/{tokens-C6qZHzph.js.map → tokens-DgC1hfkm.js.map} +1 -1
- package/dist/chunks/{unstakeLBTC-H0zdYQa6.cjs → unstakeLBTC-CmoCaGX9.cjs} +2 -2
- package/dist/chunks/{unstakeLBTC-H0zdYQa6.cjs.map → unstakeLBTC-CmoCaGX9.cjs.map} +1 -1
- package/dist/chunks/{unstakeLBTC-DAIR9NO_.js → unstakeLBTC-DtvVbpbU.js} +50 -50
- package/dist/chunks/{unstakeLBTC-DAIR9NO_.js.map → unstakeLBTC-DtvVbpbU.js.map} +1 -1
- package/dist/chunks/{withdraw-hHueI2p7.js → withdraw-DgjuaUN3.js} +45 -45
- package/dist/chunks/{withdraw-hHueI2p7.js.map → withdraw-DgjuaUN3.js.map} +1 -1
- package/dist/chunks/{withdraw-C1fMFSwy.cjs → withdraw-i0AueZ_C.cjs} +2 -2
- package/dist/chunks/{withdraw-C1fMFSwy.cjs.map → withdraw-i0AueZ_C.cjs.map} +1 -1
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.d.ts.map +1 -1
- package/dist/contracts.cjs +1 -1
- package/dist/contracts.js +16 -16
- package/dist/core/assets/catalog.d.ts.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +85 -85
- package/dist/debug.js +4 -4
- package/dist/defi.cjs +1 -1
- package/dist/defi.js +10 -10
- package/dist/evm.cjs +1 -1
- package/dist/evm.js +34 -34
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +287 -283
- package/dist/index.js.map +1 -1
- package/dist/metrics.cjs +1 -1
- package/dist/metrics.js +6 -6
- package/dist/stories/arg-types.d.ts +1 -0
- package/dist/stories/arg-types.d.ts.map +1 -1
- package/dist/tokens/token-addresses.d.ts +2 -2
- package/dist/tokens/token-addresses.d.ts.map +1 -1
- package/dist/utils/chain.d.ts +7 -0
- package/dist/utils/chain.d.ts.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +76 -76
- package/dist/vaults.cjs +1 -1
- package/dist/vaults.js +14 -14
- package/package.json +19 -6
- package/dist/chunks/BtcActions-XbVRQEcM.cjs +0 -2
- package/dist/chunks/BtcActions-XbVRQEcM.cjs.map +0 -1
- package/dist/chunks/BtcActions-k-qs1uO0.js.map +0 -1
- package/dist/chunks/EvmActions-BVzQ3fLK.cjs +0 -2
- package/dist/chunks/EvmActions-BVzQ3fLK.cjs.map +0 -1
- package/dist/chunks/EvmActions-B_dF42So.js.map +0 -1
- package/dist/chunks/ReferralsClient-BC-1wT1q.cjs +0 -2
- package/dist/chunks/ReferralsClient-BC-1wT1q.cjs.map +0 -1
- package/dist/chunks/ReferralsClient-DbFWWtVi.js.map +0 -1
- package/dist/chunks/approveLBTC-B5-ZWqct.js +0 -26
- package/dist/chunks/constants-BBK-JNcY.cjs +0 -2
- package/dist/chunks/constants-BBK-JNcY.cjs.map +0 -1
- package/dist/chunks/constants-CuT4axsy.js +0 -5
- package/dist/chunks/constants-CuT4axsy.js.map +0 -1
- package/dist/chunks/events-DdV_xi-2.js.map +0 -1
- package/dist/chunks/events-DqIJRzJo.cjs +0 -2
- package/dist/chunks/events-DqIJRzJo.cjs.map +0 -1
- package/dist/chunks/evm-by-btc-address-CwLiENtM.js +0 -39
- package/dist/chunks/fee-requirements-x8-8mpJ7.js +0 -14
- package/dist/chunks/get-exchange-ratio-NtnkG1kZ.js +0 -20
- package/dist/chunks/get-vault-withdrawals-BrpZlt6s.js +0 -161
- package/dist/chunks/getUserStakeAndBakeSignature-BxRq2cI1.cjs +0 -2
- package/dist/chunks/getUserStakeAndBakeSignature-BxRq2cI1.cjs.map +0 -1
- package/dist/chunks/getUserStakeAndBakeSignature-NGGblnJl.js +0 -120
- package/dist/chunks/getUserStakeAndBakeSignature-NGGblnJl.js.map +0 -1
- package/dist/chunks/lbtc-addresses-BLRmtR3c.js +0 -10
- package/dist/chunks/numbers-CM-lcmt4.js +0 -15
- package/dist/chunks/parameters-CDV-6Hk5.js +0 -11
- package/dist/chunks/satoshi-Ch6y8aYG.js +0 -19
- package/dist/chunks/statusConstants-BLiNBT6s.cjs +0 -2
- package/dist/chunks/statusConstants-BLiNBT6s.cjs.map +0 -1
- package/dist/chunks/statusConstants-DFxMrVob.js.map +0 -1
- package/dist/chunks/time-QPeEEEnQ.js +0 -24
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var D = (e, i, s) =>
|
|
4
|
-
import
|
|
5
|
-
import { o as
|
|
6
|
-
import {
|
|
7
|
-
import { r as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { pad as
|
|
1
|
+
var G = Object.defineProperty;
|
|
2
|
+
var j = (e, i, s) => i in e ? G(e, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[i] = s;
|
|
3
|
+
var D = (e, i, s) => j(e, typeof i != "symbol" ? i + "" : i, s);
|
|
4
|
+
import K from "axios";
|
|
5
|
+
import { StepStatus as o, LombardError as u, ValidationErrorCode as p, BaseAction as Z, Chain as c, objectType as W, referralCodeSchema as J, btcStakeAmountSchema as X, validatePrepareParams as Q, evmAddressSchema as N, getAllAssetChains as E, isEvmChain as tt, CAIP2_SEPARATOR as et, CHAIN_PREFIXES as _, solanaAddressSchema as H, BtcActionStatus as a, getChainType as $, parseChainIdentifier as v, evmChainIdToChain as st, starknetAddressSchema as it, suiAddressSchema as nt, createBtcCoreContext as rt } from "./statusConstants-Zii1786K.js";
|
|
6
|
+
import { Token as S, addChain as at, isValidChain as Y } from "./token-addresses-D0v5cR1j.js";
|
|
7
|
+
import { r as d } from "./index-CfcQ_g3t.js";
|
|
8
|
+
import { getTokenContractInfo as T } from "./tokens-DgC1hfkm.js";
|
|
9
|
+
import { toSatoshi as y } from "./satoshi-CSoJBXc6.js";
|
|
10
|
+
import { AssetId as f, DEFI_REGISTRY as I } from "./defi-registry-DxjjBQTV.js";
|
|
11
|
+
import { SANCTIONED_ADDRESS as ot, getUserStakeAndBakeSignature as ut } from "./getUserStakeAndBakeSignature-Su-k10ap.js";
|
|
12
|
+
import { VEDA_VAULT_STAKE_AND_BAKE_CHAINS as ht } from "./config-DghboRx0.js";
|
|
13
|
+
import { pad as dt } from "viem";
|
|
14
14
|
const ct = "ERR_NETWORK", pt = "This may be due to your Adblocker. Please disable any Adblocker and refresh the page to restore full functionality.";
|
|
15
15
|
function gt(e) {
|
|
16
16
|
const { code: i, message: s } = e;
|
|
@@ -24,10 +24,10 @@ const At = {
|
|
|
24
24
|
async function St(e) {
|
|
25
25
|
const { mempoolApiUrl: i } = ft(e), s = Math.floor(Date.now() / 1e3), t = `${i}/api/v1/mining/blocks/timestamp/${s}`;
|
|
26
26
|
try {
|
|
27
|
-
const { data:
|
|
28
|
-
return
|
|
29
|
-
} catch (
|
|
30
|
-
gt(
|
|
27
|
+
const { data: r } = await K.get(t);
|
|
28
|
+
return r.height;
|
|
29
|
+
} catch (r) {
|
|
30
|
+
gt(r);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
class lt {
|
|
@@ -38,7 +38,7 @@ class lt {
|
|
|
38
38
|
return St(i);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Ee() {
|
|
42
42
|
return {
|
|
43
43
|
id: "btc",
|
|
44
44
|
chain: "btc",
|
|
@@ -47,43 +47,43 @@ function Se() {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
async function
|
|
50
|
+
async function b(e) {
|
|
51
51
|
const {
|
|
52
52
|
fetchDeposit: i,
|
|
53
53
|
network: s,
|
|
54
54
|
btcService: t,
|
|
55
|
-
requiredConfirmations:
|
|
56
|
-
onProgress:
|
|
57
|
-
onComplete:
|
|
55
|
+
requiredConfirmations: r = 6,
|
|
56
|
+
onProgress: n,
|
|
57
|
+
onComplete: h
|
|
58
58
|
} = e, A = await i();
|
|
59
59
|
if (!A)
|
|
60
60
|
return;
|
|
61
|
-
const
|
|
62
|
-
if (typeof
|
|
61
|
+
const g = A.blockHeight;
|
|
62
|
+
if (typeof g != "number")
|
|
63
63
|
return;
|
|
64
|
-
const
|
|
65
|
-
confirmations:
|
|
66
|
-
requiredConfirmations:
|
|
67
|
-
hasEnoughConfirmations:
|
|
68
|
-
isClaimed:
|
|
64
|
+
const L = await t.getCurrentBlockHeight(s), B = Math.max(0, L - g), F = B >= r, P = A.isClaimed ?? !1, x = {
|
|
65
|
+
confirmations: B,
|
|
66
|
+
requiredConfirmations: r,
|
|
67
|
+
hasEnoughConfirmations: F,
|
|
68
|
+
isClaimed: P,
|
|
69
69
|
steps: {
|
|
70
70
|
created: o.COMPLETE,
|
|
71
|
-
verifying:
|
|
72
|
-
issuing:
|
|
71
|
+
verifying: F ? o.COMPLETE : o.PENDING,
|
|
72
|
+
issuing: P ? o.COMPLETE : o.PENDING
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
return
|
|
75
|
+
return n == null || n(x), P && (h == null || h()), x;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function R(e) {
|
|
78
78
|
if (e === ot)
|
|
79
79
|
throw new u(
|
|
80
|
-
|
|
80
|
+
p.INVALID_PARAMETER,
|
|
81
81
|
"Destination address is under sanctions"
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
|
-
class
|
|
85
|
-
constructor(s, t,
|
|
86
|
-
super(
|
|
84
|
+
class O extends Z {
|
|
85
|
+
constructor(s, t, r) {
|
|
86
|
+
super(r);
|
|
87
87
|
// ─────────────────────────────────────────────────────────────────────────
|
|
88
88
|
// Common State
|
|
89
89
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -115,7 +115,7 @@ class P extends j {
|
|
|
115
115
|
}
|
|
116
116
|
/** Bitcoin network mode for monitoring */
|
|
117
117
|
get bitcoinNetwork() {
|
|
118
|
-
return this.params.sourceChain ===
|
|
118
|
+
return this.params.sourceChain === c.BITCOIN_MAINNET ? "mainnet" : "testnet";
|
|
119
119
|
}
|
|
120
120
|
// ─────────────────────────────────────────────────────────────────────────
|
|
121
121
|
// Common Validation
|
|
@@ -125,10 +125,10 @@ class P extends j {
|
|
|
125
125
|
* Uses abstract getAddressSchema() for chain-specific validation
|
|
126
126
|
*/
|
|
127
127
|
get prepareSchema() {
|
|
128
|
-
return
|
|
128
|
+
return W({
|
|
129
129
|
amount: X,
|
|
130
130
|
recipient: this.getAddressSchema(),
|
|
131
|
-
referralCode:
|
|
131
|
+
referralCode: J
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
@@ -136,7 +136,7 @@ class P extends j {
|
|
|
136
136
|
* Subclasses can override if they need custom validation
|
|
137
137
|
*/
|
|
138
138
|
validatePrepareParams(s) {
|
|
139
|
-
return
|
|
139
|
+
return Q(this.prepareSchema, s, {
|
|
140
140
|
destChain: this.params.destChain
|
|
141
141
|
});
|
|
142
142
|
}
|
|
@@ -156,7 +156,7 @@ class P extends j {
|
|
|
156
156
|
ensureDepositAddress() {
|
|
157
157
|
if (!this._depositAddress)
|
|
158
158
|
throw new u(
|
|
159
|
-
|
|
159
|
+
p.INVALID_PARAMETER,
|
|
160
160
|
"Deposit address not generated. Call generateDepositAddress() first."
|
|
161
161
|
);
|
|
162
162
|
return this._depositAddress;
|
|
@@ -171,7 +171,7 @@ class P extends j {
|
|
|
171
171
|
ensureAuthorized() {
|
|
172
172
|
if (!this.isAuthorized())
|
|
173
173
|
throw new u(
|
|
174
|
-
|
|
174
|
+
p.INVALID_PARAMETER,
|
|
175
175
|
this.getAuthRequiredMessage()
|
|
176
176
|
);
|
|
177
177
|
}
|
|
@@ -217,19 +217,19 @@ class P extends j {
|
|
|
217
217
|
async generateDepositAddressImpl(s) {
|
|
218
218
|
const t = this.getStatusConfig();
|
|
219
219
|
return this.assertStatus(t.ready, "generateDepositAddress"), this.ensureAuthorized(), this._depositAddress ? this._depositAddress : this.act(async () => {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
Object.entries(
|
|
224
|
-
|
|
225
|
-
|
|
220
|
+
const r = this.getDepositAddressParams(s), n = await this.ctx.api.generateDepositAddress(r);
|
|
221
|
+
R(n), this._depositAddress = n;
|
|
222
|
+
const h = this.getInitialSteps(), A = Object.fromEntries(
|
|
223
|
+
Object.entries(h).map(([g], L) => [
|
|
224
|
+
g,
|
|
225
|
+
L === 0 ? o.COMPLETE : o.IDLE
|
|
226
226
|
])
|
|
227
227
|
);
|
|
228
228
|
return this.emitProgress({
|
|
229
229
|
status: t.addressReady,
|
|
230
230
|
steps: A,
|
|
231
|
-
metadata: { depositAddress:
|
|
232
|
-
}),
|
|
231
|
+
metadata: { depositAddress: n }
|
|
232
|
+
}), n;
|
|
233
233
|
}, t.addressReady);
|
|
234
234
|
}
|
|
235
235
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -247,8 +247,8 @@ class P extends j {
|
|
|
247
247
|
const s = this.getStatusConfig();
|
|
248
248
|
return this.act(async () => {
|
|
249
249
|
this.assertStatus(s.addressReady, "execute"), this._depositAddress || await this.generateDepositAddressImpl();
|
|
250
|
-
const t = this.ensureDepositAddress(),
|
|
251
|
-
return
|
|
250
|
+
const t = this.ensureDepositAddress(), r = await this.trySendBitcoin(t);
|
|
251
|
+
return r ? { depositAddress: t, txHash: r } : { depositAddress: t };
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -273,26 +273,26 @@ class P extends j {
|
|
|
273
273
|
const s = this._depositAddress, t = this._recipient;
|
|
274
274
|
if (!s || !t)
|
|
275
275
|
throw u.missingParameter("depositAddress or recipient");
|
|
276
|
-
return await
|
|
276
|
+
return await b({
|
|
277
277
|
network: this.bitcoinNetwork,
|
|
278
278
|
btcService: this.ctx.btc,
|
|
279
279
|
fetchDeposit: async () => {
|
|
280
|
-
const
|
|
280
|
+
const h = (await this.ctx.api.getDeposits(t)).find(
|
|
281
281
|
(A) => A.depositAddress === s
|
|
282
282
|
);
|
|
283
|
-
if (
|
|
283
|
+
if (h)
|
|
284
284
|
return {
|
|
285
|
-
blockHeight:
|
|
286
|
-
isClaimed:
|
|
285
|
+
blockHeight: h.blockHeight,
|
|
286
|
+
isClaimed: h.isClaimed
|
|
287
287
|
};
|
|
288
288
|
},
|
|
289
|
-
onProgress: (
|
|
289
|
+
onProgress: (n) => {
|
|
290
290
|
this.emitProgress({
|
|
291
291
|
status: this.status,
|
|
292
|
-
steps:
|
|
293
|
-
confirmations:
|
|
294
|
-
requiredConfirmations:
|
|
295
|
-
metadata: { isClaimed:
|
|
292
|
+
steps: n.steps,
|
|
293
|
+
confirmations: n.confirmations,
|
|
294
|
+
requiredConfirmations: n.requiredConfirmations,
|
|
295
|
+
metadata: { isClaimed: n.isClaimed }
|
|
296
296
|
});
|
|
297
297
|
},
|
|
298
298
|
onComplete: () => {
|
|
@@ -307,12 +307,12 @@ class P extends j {
|
|
|
307
307
|
const t = this._amount;
|
|
308
308
|
if (t)
|
|
309
309
|
try {
|
|
310
|
-
const
|
|
311
|
-
if (!
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
const
|
|
315
|
-
return
|
|
310
|
+
const r = await this.ctx.getProvider("bitcoin");
|
|
311
|
+
if (!r) return;
|
|
312
|
+
const n = r;
|
|
313
|
+
if (n.sendBitcoin) {
|
|
314
|
+
const h = y(t).toNumber();
|
|
315
|
+
return n.sendBitcoin(s, h);
|
|
316
316
|
}
|
|
317
317
|
} catch {
|
|
318
318
|
}
|
|
@@ -338,26 +338,26 @@ async function Ct(e, i) {
|
|
|
338
338
|
const t = s;
|
|
339
339
|
if (t.code === 4902)
|
|
340
340
|
try {
|
|
341
|
-
await
|
|
341
|
+
await at({ provider: e, chainId: i }), await e.request({
|
|
342
342
|
method: "wallet_switchEthereumChain",
|
|
343
343
|
params: [{ chainId: `0x${i.toString(16)}` }]
|
|
344
344
|
});
|
|
345
345
|
return;
|
|
346
|
-
} catch (
|
|
347
|
-
const
|
|
348
|
-
throw
|
|
349
|
-
|
|
346
|
+
} catch (r) {
|
|
347
|
+
const n = r;
|
|
348
|
+
throw n.code === 4001 ? new u(
|
|
349
|
+
p.INVALID_PARAMETER,
|
|
350
350
|
"User rejected adding chain to wallet."
|
|
351
351
|
) : new u(
|
|
352
|
-
|
|
353
|
-
`Failed to add chain ${i} to wallet: ${
|
|
352
|
+
p.INVALID_CHAIN,
|
|
353
|
+
`Failed to add chain ${i} to wallet: ${n.message || "Unknown error"}`
|
|
354
354
|
);
|
|
355
355
|
}
|
|
356
356
|
throw t.code === 4001 ? new u(
|
|
357
|
-
|
|
357
|
+
p.INVALID_PARAMETER,
|
|
358
358
|
"User rejected chain switch request."
|
|
359
359
|
) : new u(
|
|
360
|
-
|
|
360
|
+
p.INVALID_CHAIN,
|
|
361
361
|
`Failed to switch to chain ${i}: ${t.message || "Unknown error"}`
|
|
362
362
|
);
|
|
363
363
|
}
|
|
@@ -371,68 +371,68 @@ async function Et(e) {
|
|
|
371
371
|
async function m(e, i) {
|
|
372
372
|
await Et(e) !== i && await Ct(e, i);
|
|
373
373
|
}
|
|
374
|
-
const It = [
|
|
374
|
+
const It = [c.ETHEREUM, c.SEPOLIA], mt = {
|
|
375
375
|
async getMintingFee(e, i) {
|
|
376
376
|
return e.capabilities.require("evm").getMintingFee(i, S.BTCb);
|
|
377
377
|
},
|
|
378
378
|
async restoreFeeSignature(e, i, s) {
|
|
379
|
-
const t = await
|
|
379
|
+
const t = await T(
|
|
380
380
|
S.BTCb,
|
|
381
381
|
i,
|
|
382
382
|
e.env
|
|
383
|
-
),
|
|
383
|
+
), r = await e.api.getFeeSignature({
|
|
384
384
|
address: s,
|
|
385
385
|
chainId: i,
|
|
386
386
|
tokenAddress: t.address
|
|
387
387
|
});
|
|
388
|
-
return !
|
|
388
|
+
return !r.hasSignature || r.expirationDate && new Date(Number(r.expirationDate) * 1e3) < /* @__PURE__ */ new Date() ? null : {
|
|
389
389
|
hasSignature: !0,
|
|
390
|
-
signature:
|
|
390
|
+
signature: r.signature,
|
|
391
391
|
// May be undefined - that's OK
|
|
392
|
-
typedData:
|
|
392
|
+
typedData: r.typedData
|
|
393
393
|
};
|
|
394
394
|
},
|
|
395
395
|
async authorizeFee(e, { chainId: i, recipient: s, fee: t }) {
|
|
396
|
-
const
|
|
397
|
-
if (!
|
|
396
|
+
const r = e.capabilities.require("evm"), n = await e.getProvider("evm");
|
|
397
|
+
if (!n)
|
|
398
398
|
throw u.providerMissing(String(i), "evm");
|
|
399
|
-
await m(
|
|
400
|
-
const
|
|
399
|
+
await m(n, i);
|
|
400
|
+
const h = y(t).toString(), A = await T(
|
|
401
401
|
S.BTCb,
|
|
402
402
|
i,
|
|
403
403
|
e.env
|
|
404
|
-
),
|
|
405
|
-
fee:
|
|
404
|
+
), g = await r.signNetworkFee({
|
|
405
|
+
fee: h,
|
|
406
406
|
account: s,
|
|
407
407
|
chainId: i,
|
|
408
|
-
provider:
|
|
408
|
+
provider: n,
|
|
409
409
|
token: S.BTCb
|
|
410
410
|
});
|
|
411
411
|
return await e.api.storeFeeSignature({
|
|
412
412
|
address: s,
|
|
413
|
-
signature:
|
|
414
|
-
typedData:
|
|
413
|
+
signature: g.signature,
|
|
414
|
+
typedData: g.typedData,
|
|
415
415
|
tokenAddress: A.address
|
|
416
416
|
}), {
|
|
417
|
-
signature:
|
|
418
|
-
typedData:
|
|
417
|
+
signature: g.signature,
|
|
418
|
+
typedData: g.typedData
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
421
|
}, wt = {
|
|
422
422
|
chainType: "evm",
|
|
423
423
|
routes: [
|
|
424
424
|
{
|
|
425
|
-
sourceChains: [
|
|
426
|
-
envs: [
|
|
425
|
+
sourceChains: [c.BITCOIN_MAINNET],
|
|
426
|
+
envs: [d.prod]
|
|
427
427
|
},
|
|
428
428
|
{
|
|
429
|
-
sourceChains: [
|
|
430
|
-
envs: [
|
|
429
|
+
sourceChains: [c.BITCOIN_SIGNET],
|
|
430
|
+
envs: [d.stage, d.dev, d.testnet, d.ibc]
|
|
431
431
|
}
|
|
432
432
|
],
|
|
433
433
|
// Derived from ASSET_CATALOG - all chains where BTC.b is deployed
|
|
434
|
-
destChains:
|
|
435
|
-
(e) =>
|
|
434
|
+
destChains: E(f.BTCb).filter(
|
|
435
|
+
(e) => tt(e)
|
|
436
436
|
),
|
|
437
437
|
// BTC Deposit only produces BTC.b
|
|
438
438
|
supportedAssetsOut: [f.BTCb],
|
|
@@ -449,66 +449,122 @@ const It = [g.ETHEREUM, g.SEPOLIA], mt = {
|
|
|
449
449
|
* Used for non-fee-auth chains (e.g., Avalanche, Katana)
|
|
450
450
|
*/
|
|
451
451
|
async signDestination(e, i, s) {
|
|
452
|
-
const t = e.capabilities.require("evm"),
|
|
453
|
-
if (!
|
|
452
|
+
const t = e.capabilities.require("evm"), r = await e.getProvider("evm");
|
|
453
|
+
if (!r)
|
|
454
454
|
throw u.providerMissing(String(s), "evm");
|
|
455
|
-
return await m(
|
|
455
|
+
return await m(r, s), {
|
|
456
456
|
signature: (await t.signLbtcDestination({
|
|
457
457
|
address: i,
|
|
458
458
|
chainId: s,
|
|
459
|
-
provider:
|
|
459
|
+
provider: r
|
|
460
460
|
})).signature
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
|
-
},
|
|
463
|
+
}, k = (e) => `${e}${et}`;
|
|
464
464
|
function yt(e) {
|
|
465
|
-
return
|
|
465
|
+
return String(e).startsWith(k(_.EIP155));
|
|
466
|
+
}
|
|
467
|
+
function q(e) {
|
|
468
|
+
return String(e).startsWith(k(_.SOLANA));
|
|
466
469
|
}
|
|
467
470
|
function Tt(e) {
|
|
468
|
-
return
|
|
471
|
+
return String(e).startsWith(k(_.SUI));
|
|
469
472
|
}
|
|
470
|
-
function
|
|
471
|
-
return e
|
|
472
|
-
|
|
473
|
-
|
|
473
|
+
function Nt(e) {
|
|
474
|
+
return String(e).startsWith(k(_.STARKNET));
|
|
475
|
+
}
|
|
476
|
+
function _t(e) {
|
|
477
|
+
const i = {
|
|
478
|
+
[c.SOLANA_MAINNET]: "mainnet-beta",
|
|
479
|
+
[c.SOLANA_DEVNET]: "devnet",
|
|
480
|
+
[c.SOLANA_TESTNET]: "testnet",
|
|
481
|
+
"solana:mainnet-beta": "mainnet-beta",
|
|
482
|
+
"solana:devnet": "devnet",
|
|
483
|
+
"solana:testnet": "testnet"
|
|
484
|
+
}, s = i[e];
|
|
485
|
+
if (!s)
|
|
486
|
+
throw new u(
|
|
487
|
+
p.INVALID_CHAIN,
|
|
488
|
+
`Unknown Solana chain: ${e}. Expected one of: ${Object.keys(i).join(", ")}`
|
|
489
|
+
);
|
|
490
|
+
return s;
|
|
474
491
|
}
|
|
475
|
-
|
|
492
|
+
const vt = {
|
|
493
|
+
chainType: "solana",
|
|
494
|
+
routes: [
|
|
495
|
+
{
|
|
496
|
+
sourceChains: [c.BITCOIN_SIGNET],
|
|
497
|
+
envs: [d.stage, d.dev]
|
|
498
|
+
}
|
|
499
|
+
],
|
|
500
|
+
destChains: E(f.BTCb).filter(
|
|
501
|
+
(e) => q(e)
|
|
502
|
+
),
|
|
503
|
+
supportedAssetsOut: [f.BTCb],
|
|
504
|
+
addressSchema: H,
|
|
505
|
+
getFeeAuthConfig: () => null,
|
|
506
|
+
async signDestination(e, i, s) {
|
|
507
|
+
const t = e.capabilities.require("solana"), r = _t(s), { signature: n } = await t.signLbtcDestination({
|
|
508
|
+
network: r
|
|
509
|
+
});
|
|
510
|
+
return { signature: n };
|
|
511
|
+
}
|
|
512
|
+
}, Rt = {
|
|
513
|
+
evm: wt,
|
|
514
|
+
solana: vt
|
|
515
|
+
};
|
|
516
|
+
function Ot(e) {
|
|
517
|
+
return Rt[e];
|
|
518
|
+
}
|
|
519
|
+
function kt(e, i) {
|
|
520
|
+
return e.destChains.includes(i);
|
|
521
|
+
}
|
|
522
|
+
function Lt(e, i) {
|
|
523
|
+
return e.supportedAssetsOut.includes(i);
|
|
524
|
+
}
|
|
525
|
+
function Pt(e, i, s) {
|
|
526
|
+
return e.routes.some(
|
|
527
|
+
(t) => t.envs.includes(s) && (!i || t.sourceChains.includes(i))
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
class bt extends O {
|
|
476
531
|
constructor(s, t) {
|
|
477
532
|
super(s, t, a.IDLE);
|
|
533
|
+
D(this, "config");
|
|
478
534
|
D(this, "chainId");
|
|
479
535
|
D(this, "authState", { authorized: !1 });
|
|
480
536
|
/** Fee auth config - null if not required for this destination */
|
|
481
537
|
D(this, "feeAuthConfig", null);
|
|
482
|
-
|
|
538
|
+
const r = $(t.destChain), n = Ot(r);
|
|
539
|
+
if (!n)
|
|
483
540
|
throw new u(
|
|
484
|
-
|
|
541
|
+
p.INVALID_CHAIN,
|
|
542
|
+
`Unsupported destination chain type: ${r} (${t.destChain})`
|
|
543
|
+
);
|
|
544
|
+
if (!Lt(n, t.assetOut))
|
|
545
|
+
throw new u(
|
|
546
|
+
p.INVALID_ASSET,
|
|
485
547
|
`Asset ${t.assetOut} is not supported for BTC deposits. BTC Deposit produces BTC.b. For LBTC, use BtcStake instead.`
|
|
486
548
|
);
|
|
487
|
-
if (!
|
|
549
|
+
if (!kt(n, t.destChain))
|
|
488
550
|
throw new u(
|
|
489
|
-
|
|
490
|
-
`Destination chain ${t.destChain} is not supported for BTC deposits
|
|
551
|
+
p.INVALID_CHAIN,
|
|
552
|
+
`Destination chain ${t.destChain} is not supported for ${r} BTC deposits`
|
|
491
553
|
);
|
|
492
|
-
if (!
|
|
554
|
+
if (!Pt(n, t.sourceChain, s.env))
|
|
493
555
|
throw u.routeNotFound({
|
|
494
556
|
assetOut: t.assetOut,
|
|
495
557
|
sourceChain: t.sourceChain,
|
|
496
558
|
destChain: t.destChain,
|
|
497
559
|
env: s.env
|
|
498
560
|
});
|
|
499
|
-
|
|
500
|
-
if (typeof n != "number" || !B(n))
|
|
501
|
-
throw new u(
|
|
502
|
-
c.INVALID_CHAIN,
|
|
503
|
-
`Unsupported EVM chain: ${t.destChain}`
|
|
504
|
-
);
|
|
505
|
-
this.chainId = n;
|
|
561
|
+
this.config = n, this.chainId = v(t.destChain);
|
|
506
562
|
}
|
|
507
563
|
// ─────────────────────────────────────────────────────────────────────────
|
|
508
564
|
// Abstract Method Implementations
|
|
509
565
|
// ─────────────────────────────────────────────────────────────────────────
|
|
510
566
|
getAddressSchema() {
|
|
511
|
-
return
|
|
567
|
+
return this.config.addressSchema;
|
|
512
568
|
}
|
|
513
569
|
getStatusConfig() {
|
|
514
570
|
return {
|
|
@@ -558,7 +614,7 @@ class Nt extends P {
|
|
|
558
614
|
*/
|
|
559
615
|
async generateDepositAddress(s) {
|
|
560
616
|
if (!this.authState.signature) {
|
|
561
|
-
const t = await
|
|
617
|
+
const t = await this.config.signDestination(
|
|
562
618
|
this.ctx,
|
|
563
619
|
this.ensureRecipient(),
|
|
564
620
|
this.chainId
|
|
@@ -582,37 +638,37 @@ class Nt extends P {
|
|
|
582
638
|
async prepare(s) {
|
|
583
639
|
return this.assertStatus(a.IDLE, "prepare"), this.act(async () => {
|
|
584
640
|
const t = this.validatePrepareParams(s);
|
|
585
|
-
if (this._amount = t.amount, this._recipient = t.recipient, this._referralCode = t.referralCode, this.feeAuthConfig =
|
|
641
|
+
if (this._amount = t.amount, this._recipient = t.recipient, this._referralCode = t.referralCode, this.feeAuthConfig = this.config.getFeeAuthConfig(
|
|
586
642
|
this.params.destChain
|
|
587
643
|
), await this.resumeFromExistingDeposit(
|
|
588
644
|
t.recipient
|
|
589
645
|
)) {
|
|
590
646
|
if (this.feeAuthConfig) {
|
|
591
|
-
const
|
|
647
|
+
const n = await this.feeAuthConfig.restoreFeeSignature(
|
|
592
648
|
this.ctx,
|
|
593
649
|
this.chainId,
|
|
594
650
|
t.recipient
|
|
595
651
|
);
|
|
596
|
-
if (!(
|
|
652
|
+
if (!(n != null && n.hasSignature)) {
|
|
597
653
|
this.authState.mintingFee = await this.feeAuthConfig.getMintingFee(
|
|
598
654
|
this.ctx,
|
|
599
655
|
this.chainId
|
|
600
656
|
), this.updateStatus(a.NEEDS_FEE_AUTHORIZATION), this.emitInitialProgress();
|
|
601
657
|
return;
|
|
602
658
|
}
|
|
603
|
-
|
|
659
|
+
n.signature && (this.authState.signature = n.signature, this.authState.typedData = n.typedData), this.authState.authorized = !0;
|
|
604
660
|
}
|
|
605
661
|
this.updateStatus(a.ADDRESS_READY), this.emitInitialProgress();
|
|
606
662
|
return;
|
|
607
663
|
}
|
|
608
664
|
if (this.feeAuthConfig) {
|
|
609
|
-
const
|
|
665
|
+
const n = await this.feeAuthConfig.restoreFeeSignature(
|
|
610
666
|
this.ctx,
|
|
611
667
|
this.chainId,
|
|
612
668
|
t.recipient
|
|
613
669
|
);
|
|
614
|
-
if (
|
|
615
|
-
|
|
670
|
+
if (n != null && n.hasSignature) {
|
|
671
|
+
n.signature && (this.authState.signature = n.signature, this.authState.typedData = n.typedData), this.authState.authorized = !0, this.updateStatus(a.READY), this.emitInitialProgress();
|
|
616
672
|
return;
|
|
617
673
|
}
|
|
618
674
|
this.authState.mintingFee = await this.feeAuthConfig.getMintingFee(
|
|
@@ -631,13 +687,13 @@ class Nt extends P {
|
|
|
631
687
|
), this.status === a.READY) return;
|
|
632
688
|
if (!this.feeAuthConfig)
|
|
633
689
|
throw new u(
|
|
634
|
-
|
|
690
|
+
p.INVALID_PARAMETER,
|
|
635
691
|
"Fee authorization is not required for this destination chain. Use confirmAddress() instead."
|
|
636
692
|
);
|
|
637
693
|
const s = this.ensureRecipient();
|
|
638
694
|
if (!this.authState.mintingFee)
|
|
639
695
|
throw new u(
|
|
640
|
-
|
|
696
|
+
p.INVALID_STATE,
|
|
641
697
|
"Minting fee not available. Call prepare() first."
|
|
642
698
|
);
|
|
643
699
|
return this.act(async () => {
|
|
@@ -656,12 +712,12 @@ class Nt extends P {
|
|
|
656
712
|
), this.status === a.READY) return;
|
|
657
713
|
if (this.feeAuthConfig)
|
|
658
714
|
throw new u(
|
|
659
|
-
|
|
715
|
+
p.INVALID_PARAMETER,
|
|
660
716
|
"This destination chain requires fee authorization. Use authorizeFee() instead."
|
|
661
717
|
);
|
|
662
718
|
const s = this.ensureRecipient();
|
|
663
719
|
return this.act(async () => {
|
|
664
|
-
const t = await
|
|
720
|
+
const t = await this.config.signDestination(
|
|
665
721
|
this.ctx,
|
|
666
722
|
s,
|
|
667
723
|
this.chainId
|
|
@@ -676,48 +732,48 @@ class Nt extends P {
|
|
|
676
732
|
return super.monitorDeposit();
|
|
677
733
|
}
|
|
678
734
|
}
|
|
679
|
-
const
|
|
680
|
-
(e) =>
|
|
681
|
-
),
|
|
735
|
+
const Bt = ht.map(
|
|
736
|
+
(e) => st(e)
|
|
737
|
+
), Ft = {
|
|
682
738
|
chainType: "evm",
|
|
683
739
|
routes: [
|
|
684
740
|
{
|
|
685
|
-
sourceChains: [
|
|
686
|
-
envs: [
|
|
741
|
+
sourceChains: [c.BITCOIN_MAINNET],
|
|
742
|
+
envs: [d.prod]
|
|
687
743
|
},
|
|
688
744
|
{
|
|
689
|
-
sourceChains: [
|
|
690
|
-
envs: [
|
|
745
|
+
sourceChains: [c.BITCOIN_SIGNET],
|
|
746
|
+
envs: [d.stage, d.dev, d.testnet, d.ibc]
|
|
691
747
|
}
|
|
692
748
|
],
|
|
693
749
|
// StakeAndDeploy requires vault support - uses VEDA_VAULT_STAKE_AND_BAKE_CHAINS as source of truth
|
|
694
|
-
destChains:
|
|
750
|
+
destChains: Bt,
|
|
695
751
|
// StakeAndDeploy produces LBTC (then deposits to vault)
|
|
696
752
|
supportedAssetsOut: [f.LBTC],
|
|
697
|
-
supportedProtocols:
|
|
753
|
+
supportedProtocols: Ut(f.LBTC),
|
|
698
754
|
addressSchema: N,
|
|
699
755
|
async getStakeAndBakeFee(e, i, s) {
|
|
700
756
|
return e.capabilities.require("evm").getStakeAndBakeFee(i, s);
|
|
701
757
|
},
|
|
702
|
-
async authorizeStakeAndBake(e, { chainId: i, recipient: s, amount: t, vaultKey:
|
|
703
|
-
const
|
|
758
|
+
async authorizeStakeAndBake(e, { chainId: i, recipient: s, amount: t, vaultKey: r, token: n }) {
|
|
759
|
+
const h = e.capabilities.require("evm"), A = await e.getProvider("evm");
|
|
704
760
|
if (!A)
|
|
705
761
|
throw u.providerMissing(String(i), "evm");
|
|
706
762
|
await m(A, i);
|
|
707
|
-
const
|
|
763
|
+
const g = await h.signStakeAndBake({
|
|
708
764
|
value: t,
|
|
709
765
|
account: s,
|
|
710
766
|
chainId: i,
|
|
711
767
|
provider: A,
|
|
712
|
-
vaultKey:
|
|
713
|
-
token:
|
|
768
|
+
vaultKey: r,
|
|
769
|
+
token: n
|
|
714
770
|
});
|
|
715
771
|
return await e.api.storeStakeAndBakeSignature({
|
|
716
|
-
signature:
|
|
717
|
-
typedData:
|
|
772
|
+
signature: g.signature,
|
|
773
|
+
typedData: g.typedData
|
|
718
774
|
}), {
|
|
719
|
-
signature:
|
|
720
|
-
typedData:
|
|
775
|
+
signature: g.signature,
|
|
776
|
+
typedData: g.typedData
|
|
721
777
|
};
|
|
722
778
|
},
|
|
723
779
|
async restoreStakeAndBakeSignature(e, i, s) {
|
|
@@ -737,23 +793,23 @@ const vt = dt.map(
|
|
|
737
793
|
return null;
|
|
738
794
|
}
|
|
739
795
|
}
|
|
740
|
-
}, l =
|
|
741
|
-
function
|
|
796
|
+
}, l = Ft;
|
|
797
|
+
function xt(e) {
|
|
742
798
|
return l.destChains.includes(e);
|
|
743
799
|
}
|
|
744
|
-
function
|
|
800
|
+
function Mt(e) {
|
|
745
801
|
return l.supportedAssetsOut.includes(e);
|
|
746
802
|
}
|
|
747
|
-
function
|
|
803
|
+
function zt(e, i) {
|
|
748
804
|
return e ? l.routes.some(
|
|
749
805
|
(s) => s.sourceChains.includes(e) && s.envs.includes(i)
|
|
750
806
|
) : !0;
|
|
751
807
|
}
|
|
752
|
-
function
|
|
808
|
+
function V(e) {
|
|
753
809
|
return e in I;
|
|
754
810
|
}
|
|
755
|
-
function
|
|
756
|
-
if (
|
|
811
|
+
function Ht(e) {
|
|
812
|
+
if (!V(e)) {
|
|
757
813
|
const i = Object.keys(I).join(", ");
|
|
758
814
|
throw new Error(
|
|
759
815
|
`Unsupported protocol: ${e}. Supported protocols: ${i}`
|
|
@@ -761,71 +817,71 @@ function kt(e) {
|
|
|
761
817
|
}
|
|
762
818
|
return e;
|
|
763
819
|
}
|
|
764
|
-
function
|
|
820
|
+
function $t(e) {
|
|
765
821
|
return Object.entries(I).filter(([i, s]) => e in s).map(([i]) => i);
|
|
766
822
|
}
|
|
767
|
-
const
|
|
768
|
-
mainnet: [
|
|
769
|
-
testnet: [
|
|
770
|
-
},
|
|
823
|
+
const M = {
|
|
824
|
+
mainnet: [c.AVALANCHE],
|
|
825
|
+
testnet: [c.AVALANCHE_FUJI]
|
|
826
|
+
}, Yt = {
|
|
771
827
|
chainType: "evm",
|
|
772
828
|
routes: [
|
|
773
829
|
{
|
|
774
|
-
sourceChains: [
|
|
775
|
-
envs: [
|
|
830
|
+
sourceChains: [c.BITCOIN_MAINNET],
|
|
831
|
+
envs: [d.prod]
|
|
776
832
|
},
|
|
777
833
|
{
|
|
778
|
-
sourceChains: [
|
|
779
|
-
envs: [
|
|
834
|
+
sourceChains: [c.BITCOIN_SIGNET],
|
|
835
|
+
envs: [d.stage, d.dev, d.testnet, d.ibc]
|
|
780
836
|
}
|
|
781
837
|
],
|
|
782
838
|
// DepositAndDeploy with BTC.b is available on Avalanche
|
|
783
839
|
destChains: [
|
|
784
|
-
...
|
|
785
|
-
...
|
|
840
|
+
...M.mainnet,
|
|
841
|
+
...M.testnet
|
|
786
842
|
],
|
|
787
843
|
// DepositAndDeploy produces BTC.b (then deposits to vault)
|
|
788
844
|
supportedAssetsOut: [f.BTCb],
|
|
789
|
-
supportedProtocols:
|
|
845
|
+
supportedProtocols: $t(f.BTCb),
|
|
790
846
|
addressSchema: N,
|
|
791
847
|
async getDepositAndDeployFee(e, i, s) {
|
|
792
848
|
return e.capabilities.require("evm").getStakeAndBakeFee(i, s);
|
|
793
849
|
},
|
|
794
|
-
async authorizeDepositAndDeploy(e, { chainId: i, recipient: s, amount: t, vaultKey:
|
|
795
|
-
const
|
|
850
|
+
async authorizeDepositAndDeploy(e, { chainId: i, recipient: s, amount: t, vaultKey: r, token: n }) {
|
|
851
|
+
const h = e.capabilities.require("evm"), A = await e.getProvider("evm");
|
|
796
852
|
if (!A)
|
|
797
853
|
throw u.providerMissing(String(i), "evm");
|
|
798
854
|
await m(A, i);
|
|
799
|
-
const
|
|
855
|
+
const g = await h.signStakeAndBake({
|
|
800
856
|
value: t,
|
|
801
857
|
account: s,
|
|
802
858
|
chainId: i,
|
|
803
859
|
provider: A,
|
|
804
|
-
vaultKey:
|
|
805
|
-
token:
|
|
860
|
+
vaultKey: r,
|
|
861
|
+
token: n
|
|
806
862
|
});
|
|
807
863
|
return await e.api.storeStakeAndBakeSignature({
|
|
808
|
-
signature:
|
|
809
|
-
typedData:
|
|
864
|
+
signature: g.signature,
|
|
865
|
+
typedData: g.typedData
|
|
810
866
|
}), {
|
|
811
|
-
signature:
|
|
812
|
-
typedData:
|
|
867
|
+
signature: g.signature,
|
|
868
|
+
typedData: g.typedData,
|
|
813
869
|
// approvalTxHash may not be present in the result for all flows
|
|
814
|
-
approvalTxHash:
|
|
870
|
+
approvalTxHash: g.approvalTxHash
|
|
815
871
|
};
|
|
816
872
|
}
|
|
817
|
-
},
|
|
818
|
-
function
|
|
819
|
-
return
|
|
873
|
+
}, C = Yt;
|
|
874
|
+
function qt(e) {
|
|
875
|
+
return C.destChains.includes(e);
|
|
820
876
|
}
|
|
821
|
-
function
|
|
822
|
-
return
|
|
877
|
+
function Vt(e) {
|
|
878
|
+
return C.supportedAssetsOut.includes(e);
|
|
823
879
|
}
|
|
824
|
-
function
|
|
880
|
+
function U(e) {
|
|
825
881
|
return e in I;
|
|
826
882
|
}
|
|
827
|
-
function
|
|
828
|
-
if (!
|
|
883
|
+
function z(e) {
|
|
884
|
+
if (!U(e)) {
|
|
829
885
|
const i = Object.keys(I).join(", ");
|
|
830
886
|
throw new Error(
|
|
831
887
|
`Unsupported protocol: ${e}. Supported protocols: ${i}`
|
|
@@ -833,55 +889,55 @@ function Y(e) {
|
|
|
833
889
|
}
|
|
834
890
|
return e;
|
|
835
891
|
}
|
|
836
|
-
function
|
|
892
|
+
function Ut(e) {
|
|
837
893
|
return Object.entries(I).filter(([i, s]) => e in s).map(([i]) => i);
|
|
838
894
|
}
|
|
839
|
-
function
|
|
840
|
-
return
|
|
895
|
+
function Gt(e, i) {
|
|
896
|
+
return C.routes.some(
|
|
841
897
|
(s) => s.sourceChains.includes(e) && s.envs.includes(i)
|
|
842
898
|
);
|
|
843
899
|
}
|
|
844
|
-
class
|
|
900
|
+
class jt extends O {
|
|
845
901
|
constructor(s, t) {
|
|
846
902
|
super(s, t, a.IDLE);
|
|
847
903
|
D(this, "chainId");
|
|
848
904
|
D(this, "authState", { authorized: !1 });
|
|
849
|
-
if (!
|
|
905
|
+
if (!Vt(t.assetOut))
|
|
850
906
|
throw new u(
|
|
851
|
-
|
|
907
|
+
p.INVALID_ASSET,
|
|
852
908
|
`Asset ${t.assetOut} is not supported for deposit and deploy. DepositAndDeploy produces BTC.b which is then deployed to a vault like Silo.`
|
|
853
909
|
);
|
|
854
|
-
if (!
|
|
910
|
+
if (!qt(t.destChain))
|
|
855
911
|
throw new u(
|
|
856
|
-
|
|
912
|
+
p.INVALID_CHAIN,
|
|
857
913
|
`Destination chain ${t.destChain} is not supported for deposit and deploy. Supported chains: Avalanche, Avalanche Fuji`
|
|
858
914
|
);
|
|
859
|
-
if (!
|
|
915
|
+
if (!U(t.protocol))
|
|
860
916
|
throw new u(
|
|
861
|
-
|
|
917
|
+
p.INVALID_PARAMETER,
|
|
862
918
|
`Protocol ${t.protocol} is not supported for deposit and deploy. DepositAndDeploy with BTC.b only supports Silo protocol.`
|
|
863
919
|
);
|
|
864
|
-
const
|
|
865
|
-
if (!
|
|
920
|
+
const r = t.sourceChain ?? c.BITCOIN_MAINNET;
|
|
921
|
+
if (!Gt(r, s.env))
|
|
866
922
|
throw u.routeNotFound({
|
|
867
923
|
assetOut: t.assetOut,
|
|
868
|
-
sourceChain:
|
|
924
|
+
sourceChain: r,
|
|
869
925
|
destChain: t.destChain,
|
|
870
926
|
env: s.env
|
|
871
927
|
});
|
|
872
|
-
const
|
|
873
|
-
if (typeof
|
|
928
|
+
const n = v(t.destChain);
|
|
929
|
+
if (typeof n != "number" || !Y(n))
|
|
874
930
|
throw new u(
|
|
875
|
-
|
|
931
|
+
p.INVALID_CHAIN,
|
|
876
932
|
`Unsupported EVM chain: ${t.destChain}`
|
|
877
933
|
);
|
|
878
|
-
this.chainId =
|
|
934
|
+
this.chainId = n;
|
|
879
935
|
}
|
|
880
936
|
// ─────────────────────────────────────────────────────────────────────────
|
|
881
937
|
// Abstract Method Implementations
|
|
882
938
|
// ─────────────────────────────────────────────────────────────────────────
|
|
883
939
|
getAddressSchema() {
|
|
884
|
-
return
|
|
940
|
+
return C.addressSchema;
|
|
885
941
|
}
|
|
886
942
|
getStatusConfig() {
|
|
887
943
|
return {
|
|
@@ -939,10 +995,10 @@ class Ht extends P {
|
|
|
939
995
|
async prepare(s) {
|
|
940
996
|
return this.assertStatus(a.IDLE, "prepare"), this.act(async () => {
|
|
941
997
|
const t = this.validatePrepareParams(s);
|
|
942
|
-
this._amount = t.amount, this._recipient = t.recipient, this._referralCode = t.referralCode, this.authState.fee = await
|
|
998
|
+
this._amount = t.amount, this._recipient = t.recipient, this._referralCode = t.referralCode, this.authState.fee = await C.getDepositAndDeployFee(
|
|
943
999
|
this.ctx,
|
|
944
1000
|
this.chainId,
|
|
945
|
-
|
|
1001
|
+
z(this.params.protocol)
|
|
946
1002
|
), this.updateStatus(a.NEEDS_DEPLOY_AUTHORIZATION), this.emitInitialProgress();
|
|
947
1003
|
}, a.NEEDS_DEPLOY_AUTHORIZATION);
|
|
948
1004
|
}
|
|
@@ -953,23 +1009,23 @@ class Ht extends P {
|
|
|
953
1009
|
), this.status === a.READY) return;
|
|
954
1010
|
const s = this.ensureRecipient(), t = this.ensureAmount();
|
|
955
1011
|
return this.act(async () => {
|
|
956
|
-
const
|
|
1012
|
+
const r = y(t), n = w(this.params.assetOut, S.BTCb), h = await C.authorizeDepositAndDeploy(
|
|
957
1013
|
this.ctx,
|
|
958
1014
|
{
|
|
959
1015
|
chainId: this.chainId,
|
|
960
1016
|
recipient: s,
|
|
961
|
-
amount:
|
|
962
|
-
vaultKey:
|
|
963
|
-
token:
|
|
1017
|
+
amount: r.toString(),
|
|
1018
|
+
vaultKey: z(this.params.protocol),
|
|
1019
|
+
token: n
|
|
964
1020
|
}
|
|
965
1021
|
);
|
|
966
|
-
this.authState.signature =
|
|
1022
|
+
this.authState.signature = h.signature, this.authState.typedData = h.typedData, this.authState.authorized = !0;
|
|
967
1023
|
}, a.READY);
|
|
968
1024
|
}
|
|
969
1025
|
async generateDepositAddress(s) {
|
|
970
1026
|
return this.assertStatus(a.READY, "generateDepositAddress"), this.ensureAuthorized(), this._depositAddress ? this._depositAddress : this.act(async () => {
|
|
971
|
-
const t = this.getDepositAddressParams(s),
|
|
972
|
-
return
|
|
1027
|
+
const t = this.getDepositAddressParams(s), r = await this.ctx.api.generateDepositAddress(t);
|
|
1028
|
+
return R(r), this._depositAddress = r, this.emitProgress({
|
|
973
1029
|
status: a.ADDRESS_READY,
|
|
974
1030
|
steps: {
|
|
975
1031
|
created: o.COMPLETE,
|
|
@@ -977,8 +1033,8 @@ class Ht extends P {
|
|
|
977
1033
|
wrapping: o.IDLE,
|
|
978
1034
|
depositing: o.IDLE
|
|
979
1035
|
},
|
|
980
|
-
metadata: { depositAddress:
|
|
981
|
-
}),
|
|
1036
|
+
metadata: { depositAddress: r }
|
|
1037
|
+
}), r;
|
|
982
1038
|
}, a.ADDRESS_READY);
|
|
983
1039
|
}
|
|
984
1040
|
async execute() {
|
|
@@ -993,31 +1049,31 @@ class Ht extends P {
|
|
|
993
1049
|
const s = this._depositAddress, t = this._recipient;
|
|
994
1050
|
if (!s || !t)
|
|
995
1051
|
throw u.missingParameter("depositAddress or recipient");
|
|
996
|
-
return await
|
|
1052
|
+
return await b({
|
|
997
1053
|
network: this.bitcoinNetwork,
|
|
998
1054
|
btcService: this.ctx.btc,
|
|
999
1055
|
fetchDeposit: async () => {
|
|
1000
|
-
const
|
|
1056
|
+
const h = (await this.ctx.api.getDeposits(t)).find(
|
|
1001
1057
|
(A) => A.depositAddress === s
|
|
1002
1058
|
);
|
|
1003
|
-
if (
|
|
1059
|
+
if (h)
|
|
1004
1060
|
return {
|
|
1005
|
-
blockHeight:
|
|
1006
|
-
isClaimed:
|
|
1061
|
+
blockHeight: h.blockHeight,
|
|
1062
|
+
isClaimed: h.isClaimed
|
|
1007
1063
|
};
|
|
1008
1064
|
},
|
|
1009
|
-
onProgress: (
|
|
1065
|
+
onProgress: (n) => {
|
|
1010
1066
|
this.emitProgress({
|
|
1011
1067
|
status: this.status,
|
|
1012
1068
|
steps: {
|
|
1013
1069
|
created: o.COMPLETE,
|
|
1014
|
-
verifying:
|
|
1015
|
-
wrapping:
|
|
1070
|
+
verifying: n.hasEnoughConfirmations ? o.COMPLETE : o.PENDING,
|
|
1071
|
+
wrapping: n.isClaimed ? o.COMPLETE : o.PENDING,
|
|
1016
1072
|
depositing: o.PENDING
|
|
1017
1073
|
},
|
|
1018
|
-
confirmations:
|
|
1019
|
-
requiredConfirmations:
|
|
1020
|
-
metadata: { isClaimed:
|
|
1074
|
+
confirmations: n.confirmations,
|
|
1075
|
+
requiredConfirmations: n.requiredConfirmations,
|
|
1076
|
+
metadata: { isClaimed: n.isClaimed }
|
|
1021
1077
|
});
|
|
1022
1078
|
},
|
|
1023
1079
|
onComplete: () => {
|
|
@@ -1026,105 +1082,92 @@ class Ht extends P {
|
|
|
1026
1082
|
});
|
|
1027
1083
|
}
|
|
1028
1084
|
}
|
|
1029
|
-
const
|
|
1030
|
-
function Yt(e) {
|
|
1031
|
-
return String(e).startsWith(L(R.EIP155));
|
|
1032
|
-
}
|
|
1033
|
-
function $t(e) {
|
|
1034
|
-
return String(e).startsWith(L(R.SOLANA));
|
|
1035
|
-
}
|
|
1036
|
-
function Vt(e) {
|
|
1037
|
-
return String(e).startsWith(L(R.SUI));
|
|
1038
|
-
}
|
|
1039
|
-
function qt(e) {
|
|
1040
|
-
return String(e).startsWith(L(R.STARKNET));
|
|
1041
|
-
}
|
|
1042
|
-
const Ut = [g.ETHEREUM, g.SEPOLIA], Gt = {
|
|
1085
|
+
const Kt = [c.ETHEREUM, c.SEPOLIA], Zt = {
|
|
1043
1086
|
async getMintingFee(e, i) {
|
|
1044
1087
|
return e.capabilities.require("evm").getMintingFee(i);
|
|
1045
1088
|
},
|
|
1046
1089
|
async restoreFeeSignature(e, i, s) {
|
|
1047
|
-
const t = await
|
|
1090
|
+
const t = await T(
|
|
1048
1091
|
S.LBTC,
|
|
1049
1092
|
i,
|
|
1050
1093
|
e.env
|
|
1051
|
-
),
|
|
1094
|
+
), r = await e.api.getFeeSignature({
|
|
1052
1095
|
address: s,
|
|
1053
1096
|
chainId: i,
|
|
1054
1097
|
tokenAddress: t.address
|
|
1055
1098
|
});
|
|
1056
|
-
return !
|
|
1099
|
+
return !r.hasSignature || r.expirationDate && new Date(Number(r.expirationDate) * 1e3) < /* @__PURE__ */ new Date() ? null : {
|
|
1057
1100
|
hasSignature: !0,
|
|
1058
|
-
signature:
|
|
1101
|
+
signature: r.signature,
|
|
1059
1102
|
// May be undefined - that's OK
|
|
1060
|
-
typedData:
|
|
1103
|
+
typedData: r.typedData
|
|
1061
1104
|
};
|
|
1062
1105
|
},
|
|
1063
1106
|
async authorizeFee(e, { chainId: i, recipient: s, fee: t }) {
|
|
1064
|
-
const
|
|
1065
|
-
if (!
|
|
1107
|
+
const r = e.capabilities.require("evm"), n = await e.getProvider("evm");
|
|
1108
|
+
if (!n)
|
|
1066
1109
|
throw u.providerMissing(String(i), "evm");
|
|
1067
|
-
await m(
|
|
1068
|
-
const
|
|
1110
|
+
await m(n, i);
|
|
1111
|
+
const h = y(t).toString(), A = await T(
|
|
1069
1112
|
S.LBTC,
|
|
1070
1113
|
i,
|
|
1071
1114
|
e.env
|
|
1072
|
-
),
|
|
1073
|
-
fee:
|
|
1115
|
+
), g = await r.signNetworkFee({
|
|
1116
|
+
fee: h,
|
|
1074
1117
|
account: s,
|
|
1075
1118
|
chainId: i,
|
|
1076
|
-
provider:
|
|
1119
|
+
provider: n,
|
|
1077
1120
|
token: S.LBTC
|
|
1078
1121
|
});
|
|
1079
1122
|
return await e.api.storeFeeSignature({
|
|
1080
1123
|
address: s,
|
|
1081
|
-
signature:
|
|
1082
|
-
typedData:
|
|
1124
|
+
signature: g.signature,
|
|
1125
|
+
typedData: g.typedData,
|
|
1083
1126
|
tokenAddress: A.address
|
|
1084
1127
|
}), {
|
|
1085
|
-
signature:
|
|
1086
|
-
typedData:
|
|
1128
|
+
signature: g.signature,
|
|
1129
|
+
typedData: g.typedData
|
|
1087
1130
|
};
|
|
1088
1131
|
}
|
|
1089
|
-
},
|
|
1132
|
+
}, Wt = {
|
|
1090
1133
|
chainType: "evm",
|
|
1091
1134
|
routes: [
|
|
1092
1135
|
{
|
|
1093
|
-
sourceChains: [
|
|
1094
|
-
envs: [
|
|
1136
|
+
sourceChains: [c.BITCOIN_MAINNET],
|
|
1137
|
+
envs: [d.prod]
|
|
1095
1138
|
},
|
|
1096
1139
|
{
|
|
1097
|
-
sourceChains: [
|
|
1098
|
-
envs: [
|
|
1140
|
+
sourceChains: [c.BITCOIN_SIGNET],
|
|
1141
|
+
envs: [d.testnet, d.stage, d.dev, d.ibc]
|
|
1099
1142
|
}
|
|
1100
1143
|
],
|
|
1101
1144
|
// Derived from ASSET_CATALOG - all EVM chains where LBTC is deployed
|
|
1102
1145
|
// Note: This includes all chains across all environments
|
|
1103
1146
|
// The `routes` config above filters by source chain + env
|
|
1104
|
-
destChains:
|
|
1147
|
+
destChains: E(f.LBTC).filter((e) => yt(e)),
|
|
1105
1148
|
// BTC Stake only produces LBTC
|
|
1106
1149
|
supportedAssetsOut: [f.LBTC],
|
|
1107
1150
|
addressSchema: N,
|
|
1108
1151
|
getFeeAuthConfig(e) {
|
|
1109
|
-
return
|
|
1152
|
+
return Kt.includes(e) ? Zt : null;
|
|
1110
1153
|
},
|
|
1111
1154
|
async getSignature(e, i, s) {
|
|
1112
|
-
const t = e.capabilities.require("evm"),
|
|
1113
|
-
if (!
|
|
1155
|
+
const t = e.capabilities.require("evm"), r = await e.getProvider("evm");
|
|
1156
|
+
if (!r)
|
|
1114
1157
|
throw u.providerMissing(String(s), "evm");
|
|
1115
|
-
return await m(
|
|
1158
|
+
return await m(r, s), t.signLbtcDestination({
|
|
1116
1159
|
chainId: s,
|
|
1117
1160
|
address: i,
|
|
1118
|
-
provider:
|
|
1161
|
+
provider: r
|
|
1119
1162
|
});
|
|
1120
1163
|
}
|
|
1121
1164
|
};
|
|
1122
|
-
function
|
|
1165
|
+
function Jt(e) {
|
|
1123
1166
|
const i = {
|
|
1124
1167
|
// CAIP-2 format using genesis hash
|
|
1125
|
-
[
|
|
1126
|
-
[
|
|
1127
|
-
[
|
|
1168
|
+
[c.SOLANA_MAINNET]: "mainnet-beta",
|
|
1169
|
+
[c.SOLANA_DEVNET]: "devnet",
|
|
1170
|
+
[c.SOLANA_TESTNET]: "testnet",
|
|
1128
1171
|
// Legacy format (solana:network-name)
|
|
1129
1172
|
"solana:mainnet-beta": "mainnet-beta",
|
|
1130
1173
|
"solana:devnet": "devnet",
|
|
@@ -1132,53 +1175,53 @@ function jt(e) {
|
|
|
1132
1175
|
}, s = i[e];
|
|
1133
1176
|
if (!s)
|
|
1134
1177
|
throw new u(
|
|
1135
|
-
|
|
1178
|
+
p.INVALID_CHAIN,
|
|
1136
1179
|
`Unknown Solana chain: ${e}. Expected one of: ${Object.keys(i).join(", ")}`
|
|
1137
1180
|
);
|
|
1138
1181
|
return s;
|
|
1139
1182
|
}
|
|
1140
|
-
const
|
|
1183
|
+
const Xt = {
|
|
1141
1184
|
chainType: "solana",
|
|
1142
1185
|
routes: [
|
|
1143
1186
|
{
|
|
1144
|
-
sourceChains: [
|
|
1145
|
-
envs: [
|
|
1187
|
+
sourceChains: [c.BITCOIN_MAINNET],
|
|
1188
|
+
envs: [d.prod]
|
|
1146
1189
|
},
|
|
1147
1190
|
{
|
|
1148
|
-
sourceChains: [
|
|
1149
|
-
envs: [
|
|
1191
|
+
sourceChains: [c.BITCOIN_SIGNET],
|
|
1192
|
+
envs: [d.testnet, d.stage, d.dev, d.ibc]
|
|
1150
1193
|
}
|
|
1151
1194
|
],
|
|
1152
1195
|
// Derived from ASSET_CATALOG - Solana chains where LBTC is deployed
|
|
1153
|
-
destChains:
|
|
1154
|
-
(e) =>
|
|
1196
|
+
destChains: E(f.LBTC).filter(
|
|
1197
|
+
(e) => q(e)
|
|
1155
1198
|
),
|
|
1156
1199
|
// BTC Stake only produces LBTC
|
|
1157
1200
|
supportedAssetsOut: [f.LBTC],
|
|
1158
|
-
addressSchema:
|
|
1201
|
+
addressSchema: H,
|
|
1159
1202
|
// Solana never requires fee authorization
|
|
1160
1203
|
getFeeAuthConfig: () => null,
|
|
1161
1204
|
async getSignature(e, i, s) {
|
|
1162
|
-
const t = e.capabilities.require("solana"),
|
|
1163
|
-
network:
|
|
1205
|
+
const t = e.capabilities.require("solana"), r = Jt(s), { signature: n } = await t.signLbtcDestination({
|
|
1206
|
+
network: r
|
|
1164
1207
|
});
|
|
1165
|
-
return { signature:
|
|
1208
|
+
return { signature: n };
|
|
1166
1209
|
}
|
|
1167
|
-
},
|
|
1210
|
+
}, Qt = {
|
|
1168
1211
|
chainType: "starknet",
|
|
1169
1212
|
routes: [
|
|
1170
1213
|
{
|
|
1171
|
-
sourceChains: [
|
|
1172
|
-
envs: [
|
|
1214
|
+
sourceChains: [c.BITCOIN_MAINNET],
|
|
1215
|
+
envs: [d.prod]
|
|
1173
1216
|
},
|
|
1174
1217
|
{
|
|
1175
|
-
sourceChains: [
|
|
1176
|
-
envs: [
|
|
1218
|
+
sourceChains: [c.BITCOIN_SIGNET],
|
|
1219
|
+
envs: [d.testnet, d.stage, d.dev, d.ibc]
|
|
1177
1220
|
}
|
|
1178
1221
|
],
|
|
1179
1222
|
// Derived from ASSET_CATALOG - Starknet chains where LBTC is deployed
|
|
1180
|
-
destChains:
|
|
1181
|
-
(e) =>
|
|
1223
|
+
destChains: E(f.LBTC).filter(
|
|
1224
|
+
(e) => Nt(e)
|
|
1182
1225
|
),
|
|
1183
1226
|
// BTC Stake only produces LBTC
|
|
1184
1227
|
supportedAssetsOut: [f.LBTC],
|
|
@@ -1186,59 +1229,59 @@ const Zt = {
|
|
|
1186
1229
|
// Starknet never requires fee authorization
|
|
1187
1230
|
getFeeAuthConfig: () => null,
|
|
1188
1231
|
async getSignature(e, i, s) {
|
|
1189
|
-
const t = e.capabilities.require("starknet"), { signature:
|
|
1232
|
+
const t = e.capabilities.require("starknet"), { signature: r, pubKey: n } = await t.signLbtcDestination({
|
|
1190
1233
|
chainId: s
|
|
1191
|
-
}),
|
|
1192
|
-
return { signature:
|
|
1234
|
+
}), h = dt(i, { size: 32 });
|
|
1235
|
+
return { signature: r, pubKey: n, paddedAddress: h };
|
|
1193
1236
|
}
|
|
1194
|
-
},
|
|
1237
|
+
}, te = {
|
|
1195
1238
|
chainType: "sui",
|
|
1196
1239
|
routes: [
|
|
1197
1240
|
{
|
|
1198
|
-
sourceChains: [
|
|
1199
|
-
envs: [
|
|
1241
|
+
sourceChains: [c.BITCOIN_MAINNET],
|
|
1242
|
+
envs: [d.prod]
|
|
1200
1243
|
},
|
|
1201
1244
|
{
|
|
1202
|
-
sourceChains: [
|
|
1203
|
-
envs: [
|
|
1245
|
+
sourceChains: [c.BITCOIN_SIGNET],
|
|
1246
|
+
envs: [d.testnet, d.stage, d.dev, d.ibc]
|
|
1204
1247
|
}
|
|
1205
1248
|
],
|
|
1206
1249
|
// Derived from ASSET_CATALOG - Sui chains where LBTC is deployed
|
|
1207
|
-
destChains:
|
|
1208
|
-
(e) =>
|
|
1250
|
+
destChains: E(f.LBTC).filter(
|
|
1251
|
+
(e) => Tt(e)
|
|
1209
1252
|
),
|
|
1210
1253
|
// BTC Stake only produces LBTC
|
|
1211
1254
|
supportedAssetsOut: [f.LBTC],
|
|
1212
|
-
addressSchema:
|
|
1255
|
+
addressSchema: nt,
|
|
1213
1256
|
// Sui never requires fee authorization
|
|
1214
1257
|
getFeeAuthConfig: () => null,
|
|
1215
1258
|
async getSignature(e, i, s) {
|
|
1216
|
-
const t = e.capabilities.require("sui"), { signature:
|
|
1259
|
+
const t = e.capabilities.require("sui"), { signature: r } = await t.signLbtcDestination({
|
|
1217
1260
|
chainId: s
|
|
1218
1261
|
});
|
|
1219
|
-
return { signature:
|
|
1262
|
+
return { signature: r };
|
|
1220
1263
|
}
|
|
1221
|
-
},
|
|
1222
|
-
evm:
|
|
1223
|
-
solana:
|
|
1224
|
-
sui:
|
|
1225
|
-
starknet:
|
|
1264
|
+
}, ee = {
|
|
1265
|
+
evm: Wt,
|
|
1266
|
+
solana: Xt,
|
|
1267
|
+
sui: te,
|
|
1268
|
+
starknet: Qt
|
|
1226
1269
|
};
|
|
1227
|
-
function
|
|
1228
|
-
return
|
|
1270
|
+
function se(e) {
|
|
1271
|
+
return ee[e];
|
|
1229
1272
|
}
|
|
1230
|
-
function
|
|
1273
|
+
function ie(e, i, s) {
|
|
1231
1274
|
return i ? e.routes.some(
|
|
1232
1275
|
(t) => t.sourceChains.includes(i) && t.envs.includes(s)
|
|
1233
1276
|
) : !0;
|
|
1234
1277
|
}
|
|
1235
|
-
function
|
|
1278
|
+
function ne(e, i) {
|
|
1236
1279
|
return e.destChains.includes(i);
|
|
1237
1280
|
}
|
|
1238
|
-
function
|
|
1281
|
+
function re(e, i) {
|
|
1239
1282
|
return e.supportedAssetsOut.includes(i);
|
|
1240
1283
|
}
|
|
1241
|
-
class
|
|
1284
|
+
class ae extends O {
|
|
1242
1285
|
constructor(s, t) {
|
|
1243
1286
|
super(s, t, a.IDLE);
|
|
1244
1287
|
D(this, "config");
|
|
@@ -1246,30 +1289,30 @@ class ie extends P {
|
|
|
1246
1289
|
D(this, "authState", { authorized: !1 });
|
|
1247
1290
|
/** Fee auth config - null if not required for this destination */
|
|
1248
1291
|
D(this, "feeAuthConfig", null);
|
|
1249
|
-
const
|
|
1250
|
-
if (!
|
|
1292
|
+
const r = $(t.destChain), n = se(r);
|
|
1293
|
+
if (!n)
|
|
1251
1294
|
throw new u(
|
|
1252
|
-
|
|
1253
|
-
`Unsupported destination chain type: ${
|
|
1295
|
+
p.INVALID_CHAIN,
|
|
1296
|
+
`Unsupported destination chain type: ${r} (${t.destChain})`
|
|
1254
1297
|
);
|
|
1255
|
-
if (!
|
|
1298
|
+
if (!re(n, t.assetOut))
|
|
1256
1299
|
throw new u(
|
|
1257
|
-
|
|
1300
|
+
p.INVALID_ASSET,
|
|
1258
1301
|
`Asset ${t.assetOut} is not supported for BTC staking. BTC Stake produces LBTC. For BTC.b, use BtcDeposit instead.`
|
|
1259
1302
|
);
|
|
1260
|
-
if (!
|
|
1303
|
+
if (!ne(n, t.destChain))
|
|
1261
1304
|
throw new u(
|
|
1262
|
-
|
|
1263
|
-
`Destination chain ${t.destChain} is not supported for ${
|
|
1305
|
+
p.INVALID_CHAIN,
|
|
1306
|
+
`Destination chain ${t.destChain} is not supported for ${r}`
|
|
1264
1307
|
);
|
|
1265
|
-
if (!
|
|
1308
|
+
if (!ie(n, t.sourceChain, s.env))
|
|
1266
1309
|
throw u.routeNotFound({
|
|
1267
1310
|
assetOut: t.assetOut,
|
|
1268
1311
|
sourceChain: t.sourceChain,
|
|
1269
1312
|
destChain: t.destChain,
|
|
1270
1313
|
env: s.env
|
|
1271
1314
|
});
|
|
1272
|
-
this.config =
|
|
1315
|
+
this.config = n, this.chainId = v(t.destChain);
|
|
1273
1316
|
}
|
|
1274
1317
|
// ─────────────────────────────────────────────────────────────────────────
|
|
1275
1318
|
// Abstract Method Implementations
|
|
@@ -1298,20 +1341,20 @@ class ie extends P {
|
|
|
1298
1341
|
return this.chainId;
|
|
1299
1342
|
}
|
|
1300
1343
|
getDepositAddressParams(s) {
|
|
1301
|
-
var
|
|
1302
|
-
const t = this.ensureRecipient(),
|
|
1303
|
-
if (!
|
|
1344
|
+
var n;
|
|
1345
|
+
const t = this.ensureRecipient(), r = this.getActiveSignature();
|
|
1346
|
+
if (!r)
|
|
1304
1347
|
throw new u(
|
|
1305
|
-
|
|
1348
|
+
p.INVALID_PARAMETER,
|
|
1306
1349
|
"Missing signature. Complete authorization first."
|
|
1307
1350
|
);
|
|
1308
1351
|
return {
|
|
1309
|
-
address:
|
|
1352
|
+
address: r.paddedAddress ?? t,
|
|
1310
1353
|
chainId: this.chainId,
|
|
1311
|
-
signature:
|
|
1354
|
+
signature: r.signature,
|
|
1312
1355
|
token: this.getExpectedToken(),
|
|
1313
|
-
eip712Data: (
|
|
1314
|
-
pubKey:
|
|
1356
|
+
eip712Data: (n = this.authState.networkFee) == null ? void 0 : n.typedData,
|
|
1357
|
+
pubKey: r.pubKey,
|
|
1315
1358
|
partnerId: this.ctx.partner.getPartnerId(),
|
|
1316
1359
|
referrerCode: this._referralCode,
|
|
1317
1360
|
captchaToken: s
|
|
@@ -1343,36 +1386,36 @@ class ie extends P {
|
|
|
1343
1386
|
t.recipient
|
|
1344
1387
|
)) {
|
|
1345
1388
|
if (this.feeAuthConfig) {
|
|
1346
|
-
const
|
|
1389
|
+
const n = await this.feeAuthConfig.restoreFeeSignature(
|
|
1347
1390
|
this.ctx,
|
|
1348
1391
|
this.chainId,
|
|
1349
1392
|
t.recipient
|
|
1350
1393
|
);
|
|
1351
|
-
if (!(
|
|
1394
|
+
if (!(n != null && n.hasSignature)) {
|
|
1352
1395
|
this.authState.mintingFee = await this.feeAuthConfig.getMintingFee(
|
|
1353
1396
|
this.ctx,
|
|
1354
1397
|
this.chainId
|
|
1355
1398
|
), this.updateStatus(a.NEEDS_FEE_AUTHORIZATION), this.emitInitialProgress();
|
|
1356
1399
|
return;
|
|
1357
1400
|
}
|
|
1358
|
-
|
|
1359
|
-
signature:
|
|
1360
|
-
typedData:
|
|
1401
|
+
n.signature && (this.authState.networkFee = {
|
|
1402
|
+
signature: n.signature,
|
|
1403
|
+
typedData: n.typedData
|
|
1361
1404
|
}), this.authState.authorized = !0;
|
|
1362
1405
|
}
|
|
1363
1406
|
this.updateStatus(a.ADDRESS_READY), this.emitInitialProgress();
|
|
1364
1407
|
return;
|
|
1365
1408
|
}
|
|
1366
1409
|
if (this.feeAuthConfig) {
|
|
1367
|
-
const
|
|
1410
|
+
const n = await this.feeAuthConfig.restoreFeeSignature(
|
|
1368
1411
|
this.ctx,
|
|
1369
1412
|
this.chainId,
|
|
1370
1413
|
t.recipient
|
|
1371
1414
|
);
|
|
1372
|
-
if (
|
|
1373
|
-
|
|
1374
|
-
signature:
|
|
1375
|
-
typedData:
|
|
1415
|
+
if (n != null && n.hasSignature) {
|
|
1416
|
+
n.signature && (this.authState.networkFee = {
|
|
1417
|
+
signature: n.signature,
|
|
1418
|
+
typedData: n.typedData
|
|
1376
1419
|
}), this.authState.authorized = !0, this.updateStatus(a.READY), this.emitInitialProgress();
|
|
1377
1420
|
return;
|
|
1378
1421
|
}
|
|
@@ -1397,14 +1440,14 @@ class ie extends P {
|
|
|
1397
1440
|
const s = this.ensureRecipient(), t = this.feeAuthConfig !== null;
|
|
1398
1441
|
return this.act(async () => {
|
|
1399
1442
|
if (t) {
|
|
1400
|
-
const
|
|
1443
|
+
const r = this.ensureMintingFee(), n = await this.feeAuthConfig.authorizeFee(this.ctx, {
|
|
1401
1444
|
chainId: this.chainId,
|
|
1402
1445
|
recipient: s,
|
|
1403
|
-
fee:
|
|
1446
|
+
fee: r
|
|
1404
1447
|
});
|
|
1405
1448
|
this.authState.networkFee = {
|
|
1406
|
-
signature:
|
|
1407
|
-
typedData:
|
|
1449
|
+
signature: n.signature,
|
|
1450
|
+
typedData: n.typedData
|
|
1408
1451
|
};
|
|
1409
1452
|
} else
|
|
1410
1453
|
this.authState.destinationSignature = await this.config.getSignature(
|
|
@@ -1427,16 +1470,16 @@ class ie extends P {
|
|
|
1427
1470
|
this.authState.destinationSignature = t;
|
|
1428
1471
|
}
|
|
1429
1472
|
return this.act(async () => {
|
|
1430
|
-
const t = this.getDepositAddressParams(s),
|
|
1431
|
-
return
|
|
1473
|
+
const t = this.getDepositAddressParams(s), r = await this.ctx.api.generateDepositAddress(t);
|
|
1474
|
+
return R(r), this._depositAddress = r, this.emitProgress({
|
|
1432
1475
|
status: a.ADDRESS_READY,
|
|
1433
1476
|
steps: {
|
|
1434
1477
|
created: o.COMPLETE,
|
|
1435
1478
|
verifying: o.IDLE,
|
|
1436
1479
|
issuing: o.IDLE
|
|
1437
1480
|
},
|
|
1438
|
-
metadata: { depositAddress:
|
|
1439
|
-
}),
|
|
1481
|
+
metadata: { depositAddress: r }
|
|
1482
|
+
}), r;
|
|
1440
1483
|
}, a.ADDRESS_READY);
|
|
1441
1484
|
}
|
|
1442
1485
|
async execute() {
|
|
@@ -1451,7 +1494,7 @@ class ie extends P {
|
|
|
1451
1494
|
ensureMintingFee() {
|
|
1452
1495
|
if (!this.authState.mintingFee)
|
|
1453
1496
|
throw new u(
|
|
1454
|
-
|
|
1497
|
+
p.INVALID_PARAMETER,
|
|
1455
1498
|
"Minting fee not fetched. Call prepare() first."
|
|
1456
1499
|
);
|
|
1457
1500
|
return this.authState.mintingFee;
|
|
@@ -1464,40 +1507,40 @@ class ie extends P {
|
|
|
1464
1507
|
return (s = this.authState.networkFee) != null && s.signature ? { signature: this.authState.networkFee.signature } : this.authState.destinationSignature;
|
|
1465
1508
|
}
|
|
1466
1509
|
}
|
|
1467
|
-
class
|
|
1510
|
+
class oe extends O {
|
|
1468
1511
|
constructor(s, t) {
|
|
1469
1512
|
super(s, t, a.IDLE);
|
|
1470
1513
|
D(this, "chainId");
|
|
1471
1514
|
D(this, "authState", { authorized: !1 });
|
|
1472
|
-
if (!
|
|
1515
|
+
if (!Mt(t.assetOut))
|
|
1473
1516
|
throw new u(
|
|
1474
|
-
|
|
1517
|
+
p.INVALID_ASSET,
|
|
1475
1518
|
`Asset ${t.assetOut} is not supported for stake and deploy. StakeAndDeploy produces LBTC which is then deployed to a vault.`
|
|
1476
1519
|
);
|
|
1477
|
-
if (!
|
|
1520
|
+
if (!xt(t.destChain))
|
|
1478
1521
|
throw new u(
|
|
1479
|
-
|
|
1522
|
+
p.INVALID_CHAIN,
|
|
1480
1523
|
`Destination chain ${t.destChain} is not supported for stake and deploy`
|
|
1481
1524
|
);
|
|
1482
|
-
if (
|
|
1525
|
+
if (!V(t.protocol))
|
|
1483
1526
|
throw new u(
|
|
1484
|
-
|
|
1527
|
+
p.INVALID_PARAMETER,
|
|
1485
1528
|
`Protocol ${t.protocol} is not supported for stake and deploy`
|
|
1486
1529
|
);
|
|
1487
|
-
if (!
|
|
1530
|
+
if (!zt(t.sourceChain, s.env))
|
|
1488
1531
|
throw u.routeNotFound({
|
|
1489
1532
|
assetOut: t.assetOut,
|
|
1490
1533
|
sourceChain: t.sourceChain,
|
|
1491
1534
|
destChain: t.destChain,
|
|
1492
1535
|
env: s.env
|
|
1493
1536
|
});
|
|
1494
|
-
const
|
|
1495
|
-
if (typeof
|
|
1537
|
+
const r = v(t.destChain);
|
|
1538
|
+
if (typeof r != "number" || !Y(r))
|
|
1496
1539
|
throw new u(
|
|
1497
|
-
|
|
1540
|
+
p.INVALID_CHAIN,
|
|
1498
1541
|
`Unsupported EVM chain: ${t.destChain}`
|
|
1499
1542
|
);
|
|
1500
|
-
this.chainId =
|
|
1543
|
+
this.chainId = r;
|
|
1501
1544
|
}
|
|
1502
1545
|
// ─────────────────────────────────────────────────────────────────────────
|
|
1503
1546
|
// Abstract Method Implementations
|
|
@@ -1568,25 +1611,25 @@ class re extends P {
|
|
|
1568
1611
|
), await this.resumeFromExistingDeposit(
|
|
1569
1612
|
t.recipient
|
|
1570
1613
|
)) {
|
|
1571
|
-
const
|
|
1614
|
+
const h = await l.restoreStakeAndBakeSignature(
|
|
1572
1615
|
this.ctx,
|
|
1573
1616
|
this.chainId,
|
|
1574
1617
|
t.recipient
|
|
1575
1618
|
);
|
|
1576
|
-
if (
|
|
1577
|
-
|
|
1619
|
+
if (h != null && h.hasSignature) {
|
|
1620
|
+
h.signature && (this.authState.signature = h.signature), this.authState.authorized = !0, this.updateStatus(a.ADDRESS_READY), this.emitInitialProgress();
|
|
1578
1621
|
return;
|
|
1579
1622
|
}
|
|
1580
1623
|
this.updateStatus(a.NEEDS_DEPLOY_AUTHORIZATION), this.emitInitialProgress();
|
|
1581
1624
|
return;
|
|
1582
1625
|
}
|
|
1583
|
-
const
|
|
1626
|
+
const n = await l.restoreStakeAndBakeSignature(
|
|
1584
1627
|
this.ctx,
|
|
1585
1628
|
this.chainId,
|
|
1586
1629
|
t.recipient
|
|
1587
1630
|
);
|
|
1588
|
-
if (
|
|
1589
|
-
|
|
1631
|
+
if (n != null && n.hasSignature) {
|
|
1632
|
+
n.signature && (this.authState.signature = n.signature), this.authState.authorized = !0, this.updateStatus(a.READY), this.emitInitialProgress();
|
|
1590
1633
|
return;
|
|
1591
1634
|
}
|
|
1592
1635
|
this.updateStatus(a.NEEDS_DEPLOY_AUTHORIZATION), this.emitInitialProgress();
|
|
@@ -1599,23 +1642,23 @@ class re extends P {
|
|
|
1599
1642
|
), this.status === a.READY) return;
|
|
1600
1643
|
const s = this.ensureRecipient(), t = this.ensureAmount();
|
|
1601
1644
|
return this.act(async () => {
|
|
1602
|
-
const
|
|
1645
|
+
const r = y(t), n = this.params.assetIn ?? f.BTC, h = await l.authorizeStakeAndBake(
|
|
1603
1646
|
this.ctx,
|
|
1604
1647
|
{
|
|
1605
1648
|
chainId: this.chainId,
|
|
1606
1649
|
recipient: s,
|
|
1607
|
-
amount:
|
|
1608
|
-
vaultKey:
|
|
1609
|
-
token:
|
|
1650
|
+
amount: r.toString(),
|
|
1651
|
+
vaultKey: Ht(this.params.protocol),
|
|
1652
|
+
token: n
|
|
1610
1653
|
}
|
|
1611
1654
|
);
|
|
1612
|
-
this.authState.signature =
|
|
1655
|
+
this.authState.signature = h.signature, this.authState.typedData = h.typedData, this.authState.authorized = !0;
|
|
1613
1656
|
}, a.READY);
|
|
1614
1657
|
}
|
|
1615
1658
|
async generateDepositAddress(s) {
|
|
1616
1659
|
return this.assertStatus(a.READY, "generateDepositAddress"), this.ensureAuthorized(), this._depositAddress ? this._depositAddress : this.act(async () => {
|
|
1617
|
-
const t = this.getDepositAddressParams(s),
|
|
1618
|
-
return
|
|
1660
|
+
const t = this.getDepositAddressParams(s), r = await this.ctx.api.generateDepositAddress(t);
|
|
1661
|
+
return R(r), this._depositAddress = r, this.emitProgress({
|
|
1619
1662
|
status: a.ADDRESS_READY,
|
|
1620
1663
|
steps: {
|
|
1621
1664
|
created: o.COMPLETE,
|
|
@@ -1623,8 +1666,8 @@ class re extends P {
|
|
|
1623
1666
|
issuing: o.IDLE,
|
|
1624
1667
|
depositing: o.IDLE
|
|
1625
1668
|
},
|
|
1626
|
-
metadata: { depositAddress:
|
|
1627
|
-
}),
|
|
1669
|
+
metadata: { depositAddress: r }
|
|
1670
|
+
}), r;
|
|
1628
1671
|
}, a.ADDRESS_READY);
|
|
1629
1672
|
}
|
|
1630
1673
|
async execute() {
|
|
@@ -1639,31 +1682,31 @@ class re extends P {
|
|
|
1639
1682
|
const s = this._depositAddress, t = this._recipient;
|
|
1640
1683
|
if (!s || !t)
|
|
1641
1684
|
throw u.missingParameter("depositAddress or recipient");
|
|
1642
|
-
return await
|
|
1685
|
+
return await b({
|
|
1643
1686
|
network: this.bitcoinNetwork,
|
|
1644
1687
|
btcService: this.ctx.btc,
|
|
1645
1688
|
fetchDeposit: async () => {
|
|
1646
|
-
const
|
|
1689
|
+
const h = (await this.ctx.api.getDeposits(t)).find(
|
|
1647
1690
|
(A) => A.depositAddress === s
|
|
1648
1691
|
);
|
|
1649
|
-
if (
|
|
1692
|
+
if (h)
|
|
1650
1693
|
return {
|
|
1651
|
-
blockHeight:
|
|
1652
|
-
isClaimed:
|
|
1694
|
+
blockHeight: h.blockHeight,
|
|
1695
|
+
isClaimed: h.isClaimed
|
|
1653
1696
|
};
|
|
1654
1697
|
},
|
|
1655
|
-
onProgress: (
|
|
1698
|
+
onProgress: (n) => {
|
|
1656
1699
|
this.emitProgress({
|
|
1657
1700
|
status: this.status,
|
|
1658
1701
|
steps: {
|
|
1659
1702
|
created: o.COMPLETE,
|
|
1660
|
-
verifying:
|
|
1661
|
-
issuing:
|
|
1703
|
+
verifying: n.hasEnoughConfirmations ? o.COMPLETE : o.PENDING,
|
|
1704
|
+
issuing: n.isClaimed ? o.COMPLETE : o.PENDING,
|
|
1662
1705
|
depositing: o.PENDING
|
|
1663
1706
|
},
|
|
1664
|
-
confirmations:
|
|
1665
|
-
requiredConfirmations:
|
|
1666
|
-
metadata: { isClaimed:
|
|
1707
|
+
confirmations: n.confirmations,
|
|
1708
|
+
requiredConfirmations: n.requiredConfirmations,
|
|
1709
|
+
metadata: { isClaimed: n.isClaimed }
|
|
1667
1710
|
});
|
|
1668
1711
|
},
|
|
1669
1712
|
onComplete: () => {
|
|
@@ -1672,10 +1715,10 @@ class re extends P {
|
|
|
1672
1715
|
});
|
|
1673
1716
|
}
|
|
1674
1717
|
}
|
|
1675
|
-
class
|
|
1718
|
+
class ue {
|
|
1676
1719
|
constructor(i) {
|
|
1677
1720
|
D(this, "ctx");
|
|
1678
|
-
this.ctx =
|
|
1721
|
+
this.ctx = rt(i);
|
|
1679
1722
|
}
|
|
1680
1723
|
/**
|
|
1681
1724
|
* Stake BTC → LBTC
|
|
@@ -1699,7 +1742,7 @@ class ne {
|
|
|
1699
1742
|
* ```
|
|
1700
1743
|
*/
|
|
1701
1744
|
stake(i) {
|
|
1702
|
-
return new
|
|
1745
|
+
return new ae(this.ctx, i);
|
|
1703
1746
|
}
|
|
1704
1747
|
/**
|
|
1705
1748
|
* Stake and Deploy BTC → LBTC + auto-deploy ("Stake and Bake")
|
|
@@ -1725,7 +1768,7 @@ class ne {
|
|
|
1725
1768
|
* ```
|
|
1726
1769
|
*/
|
|
1727
1770
|
stakeAndDeploy(i) {
|
|
1728
|
-
return new
|
|
1771
|
+
return new oe(this.ctx, i);
|
|
1729
1772
|
}
|
|
1730
1773
|
/**
|
|
1731
1774
|
* Deposit BTC for custody (BTC → BTC.b)
|
|
@@ -1749,7 +1792,7 @@ class ne {
|
|
|
1749
1792
|
* ```
|
|
1750
1793
|
*/
|
|
1751
1794
|
deposit(i) {
|
|
1752
|
-
return new
|
|
1795
|
+
return new bt(this.ctx, i);
|
|
1753
1796
|
}
|
|
1754
1797
|
/**
|
|
1755
1798
|
* Deposit and Deploy BTC → BTC.b + auto-deploy to vault
|
|
@@ -1777,19 +1820,19 @@ class ne {
|
|
|
1777
1820
|
* ```
|
|
1778
1821
|
*/
|
|
1779
1822
|
depositAndDeploy(i) {
|
|
1780
|
-
return new
|
|
1823
|
+
return new jt(this.ctx, i);
|
|
1781
1824
|
}
|
|
1782
1825
|
}
|
|
1783
|
-
function
|
|
1784
|
-
return new
|
|
1826
|
+
function Ie(e) {
|
|
1827
|
+
return new ue(e);
|
|
1785
1828
|
}
|
|
1786
1829
|
export {
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1830
|
+
ue as BtcActions,
|
|
1831
|
+
bt as BtcDeposit,
|
|
1832
|
+
jt as BtcDepositAndDeploy,
|
|
1833
|
+
ae as BtcStake,
|
|
1834
|
+
oe as BtcStakeAndDeploy,
|
|
1835
|
+
Ie as btcActions,
|
|
1836
|
+
Ee as btcModule
|
|
1794
1837
|
};
|
|
1795
|
-
//# sourceMappingURL=BtcActions-
|
|
1838
|
+
//# sourceMappingURL=BtcActions-_a8r3Q7c.js.map
|