@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,18 +1,18 @@
|
|
|
1
1
|
var et = Object.defineProperty;
|
|
2
|
-
var st = (
|
|
3
|
-
var u = (
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { r } from "./index-CfcQ_g3t.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
2
|
+
var st = (r, a, t) => a in r ? et(r, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[a] = t;
|
|
3
|
+
var u = (r, a, t) => st(r, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
+
import D from "bignumber.js";
|
|
5
|
+
import { getMintingFee as U, signNetworkFee as z, getStakeAndBakeFee as at, signStakeAndBake as it, signLbtcDestinationAddr as rt, waitForTransactionReceipt as M, claimLBTC as nt, redeemToken as $, getTokenAllowance as ot, approveToken as ct, depositToken as ht } from "./unstakeLBTC-DtvVbpbU.js";
|
|
6
|
+
import { Token as l, makeWalletClient as W, CHAIN_ID_TO_VIEM_CHAIN_MAP as Z, AddressKind as ut, ChainId as V } from "./token-addresses-D0v5cR1j.js";
|
|
7
|
+
import { getTokenInfo as q, makePublicClient as O, toBaseDenomination as b, getTokenContractInfo as H, fromBaseDenomination as G } from "./tokens-DgC1hfkm.js";
|
|
8
|
+
import { Chain as C, BaseAction as P, EvmOperationStatus as e, validatePrepareParams as S, LombardError as c, parseChainIdentifier as _, StepStatus as i, objectType as x, evmAmountSchema as L, stringType as pt, evmAddressSchema as K, getEvmAssetChains as w, bitcoinAddressSchema as Q, getEvmChainsWithAllAssets as j, WithdrawErrorCode as y, createEvmCoreContext as dt } from "./statusConstants-Zii1786K.js";
|
|
9
|
+
import { getNetworkFeeSignature as mt, storeNetworkFeeSignature as vt } from "./storeNetworkFeeSignature-BODIpq3Y.js";
|
|
10
|
+
import { requiresAutoMintFee as lt } from "./fee-requirements-CCNsxAvJ.js";
|
|
11
|
+
import { DefiProtocol as T, AssetId as v } from "./defi-registry-DxjjBQTV.js";
|
|
12
|
+
import { r as o } from "./index-CfcQ_g3t.js";
|
|
13
|
+
import { toBigInt as J } from "./numbers-CclN2Ohk.js";
|
|
14
|
+
import { VAULTS as R, Vault as f, isVedaVaultChain as X } from "./config-DghboRx0.js";
|
|
15
|
+
import { deposit as Et, cancelWithdraw as _t, queueWithdraw as Ct } from "./withdraw-DgjuaUN3.js";
|
|
16
16
|
class gt {
|
|
17
17
|
constructor(a) {
|
|
18
18
|
this.env = a;
|
|
@@ -34,7 +34,7 @@ class gt {
|
|
|
34
34
|
*/
|
|
35
35
|
async signNetworkFee(a) {
|
|
36
36
|
const t = await z({
|
|
37
|
-
fee: new
|
|
37
|
+
fee: new D(a.fee),
|
|
38
38
|
account: a.account,
|
|
39
39
|
chainId: a.chainId,
|
|
40
40
|
provider: a.provider,
|
|
@@ -61,7 +61,7 @@ class gt {
|
|
|
61
61
|
*/
|
|
62
62
|
async signStakeAndBake(a) {
|
|
63
63
|
const t = await it({
|
|
64
|
-
value: new
|
|
64
|
+
value: new D(a.value),
|
|
65
65
|
account: a.account,
|
|
66
66
|
chainId: a.chainId,
|
|
67
67
|
provider: a.provider,
|
|
@@ -89,8 +89,8 @@ function pe() {
|
|
|
89
89
|
return {
|
|
90
90
|
id: "evm",
|
|
91
91
|
chain: "evm",
|
|
92
|
-
register(
|
|
93
|
-
return new gt(
|
|
92
|
+
register(r) {
|
|
93
|
+
return new gt(r.env);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
@@ -101,35 +101,35 @@ const At = {
|
|
|
101
101
|
asset: v.LBTC,
|
|
102
102
|
sourceChains: [C.ETHEREUM],
|
|
103
103
|
protocols: [T.Veda],
|
|
104
|
-
envs: [
|
|
104
|
+
envs: [o.prod]
|
|
105
105
|
},
|
|
106
106
|
// Veda - Base
|
|
107
107
|
{
|
|
108
108
|
asset: v.LBTC,
|
|
109
109
|
sourceChains: [C.BASE],
|
|
110
110
|
protocols: [T.Veda],
|
|
111
|
-
envs: [
|
|
111
|
+
envs: [o.prod]
|
|
112
112
|
},
|
|
113
113
|
// Veda - BSC
|
|
114
114
|
{
|
|
115
115
|
asset: v.LBTC,
|
|
116
116
|
sourceChains: [C.BSC],
|
|
117
117
|
protocols: [T.Veda],
|
|
118
|
-
envs: [
|
|
118
|
+
envs: [o.prod]
|
|
119
119
|
},
|
|
120
120
|
// Veda - Corn
|
|
121
121
|
{
|
|
122
122
|
asset: v.LBTC,
|
|
123
123
|
sourceChains: [C.CORN],
|
|
124
124
|
protocols: [T.Veda],
|
|
125
|
-
envs: [
|
|
125
|
+
envs: [o.prod]
|
|
126
126
|
},
|
|
127
127
|
// Silo - Avalanche
|
|
128
128
|
{
|
|
129
129
|
asset: v.LBTC,
|
|
130
130
|
sourceChains: [C.AVALANCHE],
|
|
131
131
|
protocols: [T.Silo],
|
|
132
|
-
envs: [
|
|
132
|
+
envs: [o.prod]
|
|
133
133
|
}
|
|
134
134
|
]
|
|
135
135
|
};
|
|
@@ -160,16 +160,16 @@ class It extends P {
|
|
|
160
160
|
return this.assertStatus(e.IDLE, "prepare"), this.act(async () => {
|
|
161
161
|
const s = S(this.prepareSchema, t);
|
|
162
162
|
this._amount = s.amount, this._protocol = t.protocol, this.validateProtocol(t.protocol);
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
163
|
+
const n = await this.ctx.getProvider("evm");
|
|
164
|
+
if (!n)
|
|
165
165
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
166
|
-
const p = (await
|
|
166
|
+
const p = (await n.request({
|
|
167
167
|
method: "eth_accounts"
|
|
168
168
|
}))[0];
|
|
169
169
|
if (!p)
|
|
170
170
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
171
171
|
this._account = p, this._chainId = _(this.params.sourceChain);
|
|
172
|
-
const m =
|
|
172
|
+
const m = R[f.Veda], h = await q(l.LBTC, this._chainId, this.ctx.env);
|
|
173
173
|
if (!h)
|
|
174
174
|
throw c.invalidParameter("token", "Could not get LBTC token info");
|
|
175
175
|
const E = await O({ chainId: this._chainId }).readContract({
|
|
@@ -177,8 +177,8 @@ class It extends P {
|
|
|
177
177
|
abi: h.abi,
|
|
178
178
|
functionName: "allowance",
|
|
179
179
|
args: [p, m.vaultContract.address]
|
|
180
|
-
}),
|
|
181
|
-
this._needsApproval = N.isGreaterThan(
|
|
180
|
+
}), I = new D(s.amount), N = b(I, h.decimals), B = new D(String(E));
|
|
181
|
+
this._needsApproval = N.isGreaterThan(B), this._needsApproval ? (this.emitProgress({
|
|
182
182
|
status: e.NEEDS_APPROVAL,
|
|
183
183
|
steps: { approval: i.PENDING, deploying: i.IDLE }
|
|
184
184
|
}), this.updateStatus(e.NEEDS_APPROVAL)) : (this.emitProgress({
|
|
@@ -194,17 +194,17 @@ class It extends P {
|
|
|
194
194
|
const t = await this.ctx.getProvider("evm");
|
|
195
195
|
if (!t)
|
|
196
196
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
197
|
-
const s =
|
|
198
|
-
if (!
|
|
197
|
+
const s = R[f.Veda], n = await q(l.LBTC, this._chainId, this.ctx.env);
|
|
198
|
+
if (!n)
|
|
199
199
|
throw c.invalidParameter("token", "Could not get LBTC token info");
|
|
200
|
-
const d = new
|
|
200
|
+
const d = new D(this._amount), p = J(b(d, n.decimals)), m = O({ chainId: this._chainId }), h = W({
|
|
201
201
|
provider: t,
|
|
202
202
|
chainId: this._chainId
|
|
203
203
|
}), { request: A } = await m.simulateContract({
|
|
204
204
|
account: this._account,
|
|
205
205
|
chain: Z[this._chainId],
|
|
206
|
-
address:
|
|
207
|
-
abi:
|
|
206
|
+
address: n.address,
|
|
207
|
+
abi: n.abi,
|
|
208
208
|
functionName: "approve",
|
|
209
209
|
args: [s.vaultContract.address, p]
|
|
210
210
|
}), E = await h.writeContract(A);
|
|
@@ -221,12 +221,12 @@ class It extends P {
|
|
|
221
221
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
222
222
|
if (!this._account || !this._chainId)
|
|
223
223
|
throw c.missingParameter("account or chainId");
|
|
224
|
-
const s = this._protocol === "veda" ?
|
|
224
|
+
const s = this._protocol === "veda" ? f.Veda : f.Veda;
|
|
225
225
|
this.emitProgress({
|
|
226
226
|
status: e.READY,
|
|
227
227
|
steps: { approval: i.COMPLETE, deploying: i.PENDING }
|
|
228
228
|
});
|
|
229
|
-
const
|
|
229
|
+
const n = await Et({
|
|
230
230
|
amount: this._amount,
|
|
231
231
|
approve: !1,
|
|
232
232
|
// Approval was handled in approve() step
|
|
@@ -237,10 +237,10 @@ class It extends P {
|
|
|
237
237
|
provider: t,
|
|
238
238
|
env: this.ctx.env
|
|
239
239
|
});
|
|
240
|
-
return this._txHash =
|
|
240
|
+
return this._txHash = n, this.emitProgress({
|
|
241
241
|
status: e.COMPLETED,
|
|
242
242
|
steps: { approval: i.COMPLETE, deploying: i.COMPLETE }
|
|
243
|
-
}), this.emitCompleted(), { txHash:
|
|
243
|
+
}), this.emitCompleted(), { txHash: n };
|
|
244
244
|
}, e.COMPLETED);
|
|
245
245
|
}
|
|
246
246
|
get prepareSchema() {
|
|
@@ -251,7 +251,7 @@ class It extends P {
|
|
|
251
251
|
}
|
|
252
252
|
validateProtocol(t) {
|
|
253
253
|
if (!At.routes.some(
|
|
254
|
-
(
|
|
254
|
+
(n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
|
|
255
255
|
))
|
|
256
256
|
throw c.invalidParameter(
|
|
257
257
|
"protocol",
|
|
@@ -259,46 +259,36 @@ class It extends P {
|
|
|
259
259
|
);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
function ft(
|
|
263
|
-
return new It(
|
|
262
|
+
function ft(r, a) {
|
|
263
|
+
return new It(r, a);
|
|
264
264
|
}
|
|
265
|
-
const Dt = [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
], wt = [
|
|
271
|
-
.../* @__PURE__ */ new Set([
|
|
272
|
-
...I(v.WBTC, [r.testnet, r.stage, r.dev, r.ibc]),
|
|
273
|
-
...I(v.BTCb, [r.testnet, r.stage, r.dev, r.ibc])
|
|
274
|
-
])
|
|
275
|
-
], Pt = I(v.LBTC, [r.prod]), Tt = I(v.LBTC, [
|
|
276
|
-
r.testnet,
|
|
277
|
-
r.stage,
|
|
278
|
-
r.dev,
|
|
279
|
-
r.ibc
|
|
265
|
+
const Dt = w(v.BTCb, [o.prod]), wt = w(v.BTCb, [o.testnet, o.stage, o.dev, o.ibc]), Pt = w(v.LBTC, [o.prod]), Tt = w(v.LBTC, [
|
|
266
|
+
o.testnet,
|
|
267
|
+
o.stage,
|
|
268
|
+
o.dev,
|
|
269
|
+
o.ibc
|
|
280
270
|
]), St = {
|
|
281
271
|
routes: [
|
|
282
|
-
// Production:
|
|
272
|
+
// Production: BTCb → LBTC
|
|
283
273
|
{
|
|
284
|
-
assetsIn: [v.
|
|
274
|
+
assetsIn: [v.BTCb],
|
|
285
275
|
assetOut: v.LBTC,
|
|
286
276
|
sourceChains: Dt,
|
|
287
277
|
destChains: Pt,
|
|
288
|
-
envs: [
|
|
278
|
+
envs: [o.prod]
|
|
289
279
|
},
|
|
290
280
|
// Testnet
|
|
291
281
|
{
|
|
292
|
-
assetsIn: [v.
|
|
282
|
+
assetsIn: [v.BTCb],
|
|
293
283
|
assetOut: v.LBTC,
|
|
294
284
|
sourceChains: wt,
|
|
295
285
|
destChains: Tt,
|
|
296
|
-
envs: [
|
|
286
|
+
envs: [o.testnet, o.stage, o.dev, o.ibc]
|
|
297
287
|
}
|
|
298
288
|
],
|
|
299
289
|
addressSchema: K
|
|
300
290
|
};
|
|
301
|
-
var g = /* @__PURE__ */ ((
|
|
291
|
+
var g = /* @__PURE__ */ ((r) => (r.IDLE = "idle", r.NEEDS_APPROVAL = "needs-approval", r.READY = "ready", r.BRIDGING = "bridging", r.COMPLETED = "completed", r))(g || {});
|
|
302
292
|
class xt extends P {
|
|
303
293
|
constructor(t, s) {
|
|
304
294
|
super(g.IDLE);
|
|
@@ -360,7 +350,7 @@ class xt extends P {
|
|
|
360
350
|
bridging: i.IDLE
|
|
361
351
|
}
|
|
362
352
|
});
|
|
363
|
-
const
|
|
353
|
+
const n = await nt({
|
|
364
354
|
provider: t,
|
|
365
355
|
account: this._recipient,
|
|
366
356
|
data: this._claimData.data,
|
|
@@ -368,14 +358,14 @@ class xt extends P {
|
|
|
368
358
|
chainId: s,
|
|
369
359
|
env: this.ctx.env
|
|
370
360
|
});
|
|
371
|
-
return this._txHash =
|
|
361
|
+
return this._txHash = n, this.emitProgress({
|
|
372
362
|
status: g.COMPLETED,
|
|
373
363
|
steps: {
|
|
374
364
|
approval: i.COMPLETE,
|
|
375
365
|
execution: i.COMPLETE,
|
|
376
366
|
bridging: i.IDLE
|
|
377
367
|
}
|
|
378
|
-
}), this.emitCompleted(), { txHash:
|
|
368
|
+
}), this.emitCompleted(), { txHash: n };
|
|
379
369
|
}, g.COMPLETED);
|
|
380
370
|
}
|
|
381
371
|
get prepareSchema() {
|
|
@@ -385,15 +375,15 @@ class xt extends P {
|
|
|
385
375
|
});
|
|
386
376
|
}
|
|
387
377
|
}
|
|
388
|
-
function Lt(
|
|
389
|
-
return new xt(
|
|
378
|
+
function Lt(r, a) {
|
|
379
|
+
return new xt(r, a);
|
|
390
380
|
}
|
|
391
|
-
const Nt =
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
]),
|
|
381
|
+
const Nt = w(v.BTCb, [o.prod]), Ot = w(v.BTCb, [
|
|
382
|
+
o.testnet,
|
|
383
|
+
o.stage,
|
|
384
|
+
o.dev,
|
|
385
|
+
o.ibc
|
|
386
|
+
]), Rt = {
|
|
397
387
|
routes: [
|
|
398
388
|
// BTC.b → BTC (to Bitcoin Mainnet)
|
|
399
389
|
{
|
|
@@ -401,7 +391,7 @@ const Nt = I(v.BTCb, [r.prod]), Ot = I(v.BTCb, [
|
|
|
401
391
|
assetOut: v.BTC,
|
|
402
392
|
sourceChains: Nt,
|
|
403
393
|
destChain: C.BITCOIN_MAINNET,
|
|
404
|
-
envs: [
|
|
394
|
+
envs: [o.prod]
|
|
405
395
|
},
|
|
406
396
|
// BTC.b → BTC (to Bitcoin Signet - testnet)
|
|
407
397
|
{
|
|
@@ -409,15 +399,15 @@ const Nt = I(v.BTCb, [r.prod]), Ot = I(v.BTCb, [
|
|
|
409
399
|
assetOut: v.BTC,
|
|
410
400
|
sourceChains: Ot,
|
|
411
401
|
destChain: C.BITCOIN_SIGNET,
|
|
412
|
-
envs: [
|
|
402
|
+
envs: [o.testnet, o.stage, o.dev, o.ibc]
|
|
413
403
|
}
|
|
414
404
|
// TODO: Add L-Asset routes when deployed
|
|
415
405
|
// L-ZEC → ZEC, L-SOL → SOL, L-XRP → XRP, L-DOGE → DOGE
|
|
416
406
|
],
|
|
417
407
|
recipientSchema: Q
|
|
418
408
|
};
|
|
419
|
-
async function k(
|
|
420
|
-
if (!lt(
|
|
409
|
+
async function k(r, a, t, s) {
|
|
410
|
+
if (!lt(r))
|
|
421
411
|
return {
|
|
422
412
|
requiresAuth: !1,
|
|
423
413
|
hasValidSignature: !1,
|
|
@@ -425,17 +415,17 @@ async function k(n, a, t, s) {
|
|
|
425
415
|
feeFormatted: null,
|
|
426
416
|
expirationDate: null
|
|
427
417
|
};
|
|
428
|
-
const
|
|
418
|
+
const n = await H(s, r, t), d = await mt({
|
|
429
419
|
address: a,
|
|
430
|
-
chainId:
|
|
420
|
+
chainId: r,
|
|
431
421
|
env: t,
|
|
432
|
-
tokenAddress:
|
|
422
|
+
tokenAddress: n.address
|
|
433
423
|
}), p = d.expirationDate ? new Date(Number(d.expirationDate) * 1e3) < /* @__PURE__ */ new Date() : !1, m = d.hasSignature && !p;
|
|
434
424
|
let h = null, A = null;
|
|
435
425
|
if (!m) {
|
|
436
426
|
const E = await U({
|
|
437
427
|
token: s,
|
|
438
|
-
chainId:
|
|
428
|
+
chainId: r,
|
|
439
429
|
env: t
|
|
440
430
|
});
|
|
441
431
|
h = BigInt(E.times(1e8).toFixed(0)), A = E.toFixed(8);
|
|
@@ -448,12 +438,12 @@ async function k(n, a, t, s) {
|
|
|
448
438
|
expirationDate: d.expirationDate ?? null
|
|
449
439
|
};
|
|
450
440
|
}
|
|
451
|
-
async function F(
|
|
452
|
-
const { chainId: a, account: t, feeInSatoshis: s, provider:
|
|
441
|
+
async function F(r) {
|
|
442
|
+
const { chainId: a, account: t, feeInSatoshis: s, provider: n, env: d, token: p } = r, m = await H(p, a, d), h = await z({
|
|
453
443
|
fee: s,
|
|
454
444
|
account: t,
|
|
455
445
|
chainId: a,
|
|
456
|
-
provider:
|
|
446
|
+
provider: n,
|
|
457
447
|
env: d,
|
|
458
448
|
token: p
|
|
459
449
|
});
|
|
@@ -474,7 +464,7 @@ function Y() {
|
|
|
474
464
|
expirationDate: null
|
|
475
465
|
};
|
|
476
466
|
}
|
|
477
|
-
class
|
|
467
|
+
class Bt extends P {
|
|
478
468
|
constructor(t, s) {
|
|
479
469
|
super(e.IDLE);
|
|
480
470
|
u(this, "_amount");
|
|
@@ -506,13 +496,13 @@ class Rt extends P {
|
|
|
506
496
|
destChain: this.params.destChain
|
|
507
497
|
});
|
|
508
498
|
this._amount = s.amount, this._recipient = s.recipient;
|
|
509
|
-
const
|
|
499
|
+
const n = _(this.params.sourceChain), d = await this.ctx.getProvider("evm");
|
|
510
500
|
if (!d)
|
|
511
501
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
512
502
|
const m = (await d.request({
|
|
513
503
|
method: "eth_accounts"
|
|
514
504
|
}))[0], h = await k(
|
|
515
|
-
|
|
505
|
+
n,
|
|
516
506
|
m,
|
|
517
507
|
this.ctx.env,
|
|
518
508
|
l.BTCb
|
|
@@ -524,17 +514,17 @@ class Rt extends P {
|
|
|
524
514
|
feeFormatted: h.feeFormatted,
|
|
525
515
|
expirationDate: h.expirationDate
|
|
526
516
|
}, h.requiresAuth && !h.hasValidSignature) {
|
|
527
|
-
this.emitProgress({
|
|
517
|
+
this.updateStatus(e.NEEDS_FEE_AUTHORIZATION), this.emitProgress({
|
|
528
518
|
status: e.NEEDS_FEE_AUTHORIZATION,
|
|
529
519
|
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
530
520
|
});
|
|
531
521
|
return;
|
|
532
522
|
}
|
|
533
|
-
this._needsApproval = !1, this.emitProgress({
|
|
523
|
+
this._needsApproval = !1, this.updateStatus(e.READY), this.emitProgress({
|
|
534
524
|
status: e.READY,
|
|
535
525
|
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
536
526
|
});
|
|
537
|
-
}
|
|
527
|
+
});
|
|
538
528
|
}
|
|
539
529
|
/**
|
|
540
530
|
* Authorize the network fee
|
|
@@ -578,19 +568,19 @@ class Rt extends P {
|
|
|
578
568
|
const t = await this.ctx.getProvider("evm");
|
|
579
569
|
if (!t)
|
|
580
570
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
581
|
-
const
|
|
571
|
+
const n = (await t.request({
|
|
582
572
|
method: "eth_accounts"
|
|
583
573
|
}))[0];
|
|
584
|
-
if (!
|
|
574
|
+
if (!n)
|
|
585
575
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
586
576
|
const d = _(this.params.sourceChain);
|
|
587
577
|
this.emitProgress({
|
|
588
578
|
status: e.READY,
|
|
589
579
|
steps: { burning: i.PENDING, releasing: i.IDLE }
|
|
590
580
|
});
|
|
591
|
-
const p = await
|
|
581
|
+
const p = await $({
|
|
592
582
|
provider: t,
|
|
593
|
-
account:
|
|
583
|
+
account: n,
|
|
594
584
|
amount: this._amount,
|
|
595
585
|
btcAddress: this._recipient,
|
|
596
586
|
// Bitcoin address to receive BTC
|
|
@@ -609,19 +599,19 @@ class Rt extends P {
|
|
|
609
599
|
get prepareSchema() {
|
|
610
600
|
return x({
|
|
611
601
|
amount: L,
|
|
612
|
-
recipient:
|
|
602
|
+
recipient: Rt.recipientSchema
|
|
613
603
|
});
|
|
614
604
|
}
|
|
615
605
|
}
|
|
616
|
-
function bt(
|
|
617
|
-
return new
|
|
606
|
+
function bt(r, a) {
|
|
607
|
+
return new Bt(r, a);
|
|
618
608
|
}
|
|
619
609
|
const yt = [
|
|
620
610
|
V.avalanche,
|
|
621
611
|
V.avalancheFuji
|
|
622
612
|
];
|
|
623
|
-
function Mt(
|
|
624
|
-
return yt.includes(
|
|
613
|
+
function Mt(r) {
|
|
614
|
+
return yt.includes(r);
|
|
625
615
|
}
|
|
626
616
|
class Ht extends P {
|
|
627
617
|
constructor(t, s) {
|
|
@@ -652,10 +642,10 @@ class Ht extends P {
|
|
|
652
642
|
return this.assertStatus(e.IDLE, "prepare"), this.act(async () => {
|
|
653
643
|
const s = S(this.prepareSchema, t);
|
|
654
644
|
this._amount = s.amount;
|
|
655
|
-
const
|
|
656
|
-
if (!
|
|
645
|
+
const n = await this.ctx.getProvider("evm");
|
|
646
|
+
if (!n)
|
|
657
647
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
658
|
-
const p = (await
|
|
648
|
+
const p = (await n.request({
|
|
659
649
|
method: "eth_accounts"
|
|
660
650
|
}))[0];
|
|
661
651
|
if (!p)
|
|
@@ -670,14 +660,14 @@ class Ht extends P {
|
|
|
670
660
|
ut.Adapter
|
|
671
661
|
);
|
|
672
662
|
this._spenderAddress = E.address;
|
|
673
|
-
const
|
|
663
|
+
const I = await ot({
|
|
674
664
|
token: l.BTCb,
|
|
675
665
|
owner: p,
|
|
676
666
|
spender: E.address,
|
|
677
667
|
chainId: m,
|
|
678
668
|
env: this.ctx.env
|
|
679
|
-
}), N = new
|
|
680
|
-
if (this._needsApproval =
|
|
669
|
+
}), N = new D(s.amount);
|
|
670
|
+
if (this._needsApproval = I.isLessThan(N), this._needsApproval) {
|
|
681
671
|
this.emitProgress({
|
|
682
672
|
status: e.NEEDS_APPROVAL,
|
|
683
673
|
steps: { approval: i.PENDING, staking: i.IDLE }
|
|
@@ -720,7 +710,7 @@ class Ht extends P {
|
|
|
720
710
|
const t = await this.ctx.getProvider("evm");
|
|
721
711
|
if (!t)
|
|
722
712
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
723
|
-
const s = _(this.params.sourceChain),
|
|
713
|
+
const s = _(this.params.sourceChain), n = await ct({
|
|
724
714
|
account: this._account,
|
|
725
715
|
token: l.BTCb,
|
|
726
716
|
spender: this._spenderAddress,
|
|
@@ -729,7 +719,7 @@ class Ht extends P {
|
|
|
729
719
|
provider: t,
|
|
730
720
|
env: this.ctx.env
|
|
731
721
|
}), d = O({ chainId: s, env: this.ctx.env });
|
|
732
|
-
await M(d,
|
|
722
|
+
await M(d, n, "BTC.b approval"), this._needsApproval = !1, this.emitProgress({
|
|
733
723
|
status: e.READY,
|
|
734
724
|
steps: { approval: i.COMPLETE, staking: i.PENDING }
|
|
735
725
|
});
|
|
@@ -798,49 +788,49 @@ class Ht extends P {
|
|
|
798
788
|
});
|
|
799
789
|
}
|
|
800
790
|
}
|
|
801
|
-
function kt(
|
|
802
|
-
return new Ht(
|
|
791
|
+
function kt(r, a) {
|
|
792
|
+
return new Ht(r, a);
|
|
803
793
|
}
|
|
804
|
-
const Ft =
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
794
|
+
const Ft = w(v.LBTC, [o.prod]), Yt = w(v.LBTC, [
|
|
795
|
+
o.testnet,
|
|
796
|
+
o.stage,
|
|
797
|
+
o.dev,
|
|
798
|
+
o.ibc
|
|
809
799
|
]), Vt = j(
|
|
810
800
|
[v.LBTC, v.BTCb],
|
|
811
|
-
[
|
|
801
|
+
[o.prod]
|
|
812
802
|
), qt = j(
|
|
813
803
|
[v.LBTC, v.BTCb],
|
|
814
|
-
[
|
|
804
|
+
[o.testnet, o.stage, o.dev, o.ibc]
|
|
815
805
|
), Gt = {
|
|
816
806
|
routes: [
|
|
817
807
|
// Production: EVM chains with LBTC → Bitcoin Mainnet
|
|
818
808
|
{
|
|
819
809
|
sourceChains: Ft,
|
|
820
810
|
destChain: C.BITCOIN_MAINNET,
|
|
821
|
-
envs: [
|
|
811
|
+
envs: [o.prod]
|
|
822
812
|
},
|
|
823
813
|
// Testnet: EVM chains with LBTC → Bitcoin Signet
|
|
824
814
|
{
|
|
825
815
|
sourceChains: Yt,
|
|
826
816
|
destChain: C.BITCOIN_SIGNET,
|
|
827
|
-
envs: [
|
|
817
|
+
envs: [o.testnet, o.stage, o.dev, o.ibc]
|
|
828
818
|
}
|
|
829
819
|
],
|
|
830
820
|
recipientSchema: Q
|
|
831
821
|
}, Ut = {
|
|
832
822
|
routes: [
|
|
833
823
|
// Production: Same-chain routes for chains with both LBTC and BTCb
|
|
834
|
-
...Vt.map((
|
|
835
|
-
sourceChains: [
|
|
836
|
-
destChain:
|
|
837
|
-
envs: [
|
|
824
|
+
...Vt.map((r) => ({
|
|
825
|
+
sourceChains: [r],
|
|
826
|
+
destChain: r,
|
|
827
|
+
envs: [o.prod]
|
|
838
828
|
})),
|
|
839
829
|
// Testnet: Same-chain routes
|
|
840
|
-
...qt.map((
|
|
841
|
-
sourceChains: [
|
|
842
|
-
destChain:
|
|
843
|
-
envs: [
|
|
830
|
+
...qt.map((r) => ({
|
|
831
|
+
sourceChains: [r],
|
|
832
|
+
destChain: r,
|
|
833
|
+
envs: [o.testnet, o.stage, o.dev, o.ibc]
|
|
844
834
|
}))
|
|
845
835
|
],
|
|
846
836
|
recipientSchema: K
|
|
@@ -877,7 +867,7 @@ class zt extends P {
|
|
|
877
867
|
destChain: this.params.destChain
|
|
878
868
|
});
|
|
879
869
|
this._amount = s.amount, this._recipient = s.recipient;
|
|
880
|
-
const
|
|
870
|
+
const n = _(this.params.sourceChain);
|
|
881
871
|
if (this.isBtcbOutput) {
|
|
882
872
|
const d = await this.ctx.getProvider("evm");
|
|
883
873
|
if (!d)
|
|
@@ -885,7 +875,7 @@ class zt extends P {
|
|
|
885
875
|
const m = (await d.request({
|
|
886
876
|
method: "eth_accounts"
|
|
887
877
|
}))[0], h = await k(
|
|
888
|
-
|
|
878
|
+
n,
|
|
889
879
|
m,
|
|
890
880
|
this.ctx.env,
|
|
891
881
|
l.BTCb
|
|
@@ -897,18 +887,18 @@ class zt extends P {
|
|
|
897
887
|
feeFormatted: h.feeFormatted,
|
|
898
888
|
expirationDate: h.expirationDate
|
|
899
889
|
}, h.requiresAuth && !h.hasValidSignature) {
|
|
900
|
-
this.emitProgress({
|
|
890
|
+
this.updateStatus(e.NEEDS_FEE_AUTHORIZATION), this.emitProgress({
|
|
901
891
|
status: e.NEEDS_FEE_AUTHORIZATION,
|
|
902
892
|
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
903
893
|
});
|
|
904
894
|
return;
|
|
905
895
|
}
|
|
906
896
|
}
|
|
907
|
-
this.emitProgress({
|
|
897
|
+
this.updateStatus(e.READY), this.emitProgress({
|
|
908
898
|
status: e.READY,
|
|
909
899
|
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
910
900
|
});
|
|
911
|
-
}
|
|
901
|
+
});
|
|
912
902
|
}
|
|
913
903
|
/**
|
|
914
904
|
* Authorize the network fee
|
|
@@ -944,19 +934,19 @@ class zt extends P {
|
|
|
944
934
|
const t = await this.ctx.getProvider("evm");
|
|
945
935
|
if (!t)
|
|
946
936
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
947
|
-
const
|
|
937
|
+
const n = (await t.request({
|
|
948
938
|
method: "eth_accounts"
|
|
949
939
|
}))[0];
|
|
950
|
-
if (!
|
|
940
|
+
if (!n)
|
|
951
941
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
952
942
|
const d = _(this.params.sourceChain), p = this.params.assetOut === v.BTCb;
|
|
953
943
|
this.emitProgress({
|
|
954
944
|
status: e.READY,
|
|
955
945
|
steps: { burning: i.PENDING, releasing: i.IDLE }
|
|
956
946
|
});
|
|
957
|
-
const m = await
|
|
947
|
+
const m = await $({
|
|
958
948
|
provider: t,
|
|
959
|
-
account: p ? this._recipient :
|
|
949
|
+
account: p ? this._recipient : n,
|
|
960
950
|
amount: this._amount,
|
|
961
951
|
btcAddress: p ? void 0 : this._recipient,
|
|
962
952
|
chainId: d,
|
|
@@ -981,8 +971,8 @@ class zt extends P {
|
|
|
981
971
|
});
|
|
982
972
|
}
|
|
983
973
|
}
|
|
984
|
-
function
|
|
985
|
-
return new zt(
|
|
974
|
+
function $t(r, a) {
|
|
975
|
+
return new zt(r, a);
|
|
986
976
|
}
|
|
987
977
|
const tt = {
|
|
988
978
|
routes: [
|
|
@@ -990,11 +980,11 @@ const tt = {
|
|
|
990
980
|
{
|
|
991
981
|
sourceChains: [C.ETHEREUM, C.BASE, C.BSC, C.CORN],
|
|
992
982
|
protocols: [T.Veda],
|
|
993
|
-
envs: [
|
|
983
|
+
envs: [o.prod]
|
|
994
984
|
}
|
|
995
985
|
]
|
|
996
986
|
};
|
|
997
|
-
class
|
|
987
|
+
class Wt extends P {
|
|
998
988
|
constructor(t, s) {
|
|
999
989
|
super(e.IDLE);
|
|
1000
990
|
u(this, "_txHash");
|
|
@@ -1011,12 +1001,12 @@ class $t extends P {
|
|
|
1011
1001
|
const t = await this.ctx.getProvider("evm");
|
|
1012
1002
|
if (!t)
|
|
1013
1003
|
throw c.providerMissing(this.params.chain, "evm");
|
|
1014
|
-
const
|
|
1004
|
+
const n = (await t.request({
|
|
1015
1005
|
method: "eth_accounts"
|
|
1016
1006
|
}))[0];
|
|
1017
|
-
if (!
|
|
1007
|
+
if (!n)
|
|
1018
1008
|
throw c.providerMissing(this.params.chain, "evm");
|
|
1019
|
-
if (this._account =
|
|
1009
|
+
if (this._account = n, this._chainId = _(this.params.chain), !X(this._chainId))
|
|
1020
1010
|
throw new c(
|
|
1021
1011
|
y.PROTOCOL_NOT_SUPPORTED,
|
|
1022
1012
|
`Chain ${this.params.chain} does not support Veda vault withdrawals`,
|
|
@@ -1040,7 +1030,7 @@ class $t extends P {
|
|
|
1040
1030
|
steps: { cancelling: i.PENDING }
|
|
1041
1031
|
});
|
|
1042
1032
|
const s = await _t({
|
|
1043
|
-
vaultKey:
|
|
1033
|
+
vaultKey: f.Veda,
|
|
1044
1034
|
account: this._account,
|
|
1045
1035
|
chainId: this._chainId,
|
|
1046
1036
|
provider: t,
|
|
@@ -1054,7 +1044,7 @@ class $t extends P {
|
|
|
1054
1044
|
}
|
|
1055
1045
|
validateProtocol(t) {
|
|
1056
1046
|
if (!tt.routes.some(
|
|
1057
|
-
(
|
|
1047
|
+
(n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
|
|
1058
1048
|
))
|
|
1059
1049
|
throw c.invalidParameter(
|
|
1060
1050
|
"protocol",
|
|
@@ -1089,39 +1079,39 @@ class Zt extends P {
|
|
|
1089
1079
|
return this.assertStatus(e.IDLE, "prepare"), this.act(async () => {
|
|
1090
1080
|
const s = S(this.prepareSchema, t);
|
|
1091
1081
|
this._amount = s.amount, this._protocol = this.params.protocol, this.validateProtocol(this.params.protocol);
|
|
1092
|
-
const
|
|
1093
|
-
if (!
|
|
1082
|
+
const n = await this.ctx.getProvider("evm");
|
|
1083
|
+
if (!n)
|
|
1094
1084
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
1095
|
-
const p = (await
|
|
1085
|
+
const p = (await n.request({
|
|
1096
1086
|
method: "eth_accounts"
|
|
1097
1087
|
}))[0];
|
|
1098
1088
|
if (!p)
|
|
1099
1089
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
1100
|
-
if (this._account = p, this._chainId = _(this.params.sourceChain), !
|
|
1090
|
+
if (this._account = p, this._chainId = _(this.params.sourceChain), !X(this._chainId))
|
|
1101
1091
|
throw new c(
|
|
1102
1092
|
y.PROTOCOL_NOT_SUPPORTED,
|
|
1103
1093
|
`Chain ${this.params.sourceChain} does not support Veda vault withdrawals`,
|
|
1104
1094
|
{ chain: this.params.sourceChain, protocol: this._protocol }
|
|
1105
1095
|
);
|
|
1106
|
-
const m =
|
|
1096
|
+
const m = R[f.Veda], h = O({ chainId: this._chainId }), A = await h.readContract({
|
|
1107
1097
|
address: m.lensContract.address,
|
|
1108
1098
|
abi: m.lensContract.abi,
|
|
1109
1099
|
functionName: "balanceOf",
|
|
1110
1100
|
args: [p, m.vaultContract.address]
|
|
1111
|
-
}), E = G(String(A), m.decimals),
|
|
1112
|
-
if (
|
|
1101
|
+
}), E = G(String(A), m.decimals), I = new D(s.amount);
|
|
1102
|
+
if (I.isGreaterThan(E))
|
|
1113
1103
|
throw new c(
|
|
1114
1104
|
y.INSUFFICIENT_SHARES,
|
|
1115
|
-
`Insufficient vault shares. Requested: ${
|
|
1116
|
-
{ requested:
|
|
1105
|
+
`Insufficient vault shares. Requested: ${I.toFixed()}, Available: ${E.toFixed()}`,
|
|
1106
|
+
{ requested: I.toFixed(), available: E.toFixed() }
|
|
1117
1107
|
);
|
|
1118
1108
|
const N = await h.readContract({
|
|
1119
1109
|
address: m.vaultContract.address,
|
|
1120
1110
|
abi: m.vaultContract.abi,
|
|
1121
1111
|
functionName: "allowance",
|
|
1122
1112
|
args: [p, m.withdrawQueueContracts[this._chainId].address]
|
|
1123
|
-
}),
|
|
1124
|
-
this._needsApproval =
|
|
1113
|
+
}), B = G(String(N), m.decimals);
|
|
1114
|
+
this._needsApproval = I.isGreaterThan(B), this._needsApproval ? (this.emitProgress({
|
|
1125
1115
|
status: e.NEEDS_APPROVAL,
|
|
1126
1116
|
steps: { approval: i.PENDING, queueing: i.IDLE }
|
|
1127
1117
|
}), this.updateStatus(e.NEEDS_APPROVAL)) : (this.emitProgress({
|
|
@@ -1137,7 +1127,7 @@ class Zt extends P {
|
|
|
1137
1127
|
const t = await this.ctx.getProvider("evm");
|
|
1138
1128
|
if (!t)
|
|
1139
1129
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
1140
|
-
const s =
|
|
1130
|
+
const s = R[f.Veda], n = new D(this._amount), d = J(b(n, s.decimals)), p = O({ chainId: this._chainId }), m = W({
|
|
1141
1131
|
provider: t,
|
|
1142
1132
|
chainId: this._chainId
|
|
1143
1133
|
}), h = this._chainId, { request: A } = await p.simulateContract({
|
|
@@ -1168,7 +1158,7 @@ class Zt extends P {
|
|
|
1168
1158
|
const s = await Ct({
|
|
1169
1159
|
amount: this._amount,
|
|
1170
1160
|
approve: !1,
|
|
1171
|
-
vaultKey:
|
|
1161
|
+
vaultKey: f.Veda,
|
|
1172
1162
|
account: this._account,
|
|
1173
1163
|
chainId: this._chainId,
|
|
1174
1164
|
provider: t,
|
|
@@ -1187,7 +1177,7 @@ class Zt extends P {
|
|
|
1187
1177
|
}
|
|
1188
1178
|
validateProtocol(t) {
|
|
1189
1179
|
if (!tt.routes.some(
|
|
1190
|
-
(
|
|
1180
|
+
(n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
|
|
1191
1181
|
))
|
|
1192
1182
|
throw c.invalidParameter(
|
|
1193
1183
|
"protocol",
|
|
@@ -1195,11 +1185,11 @@ class Zt extends P {
|
|
|
1195
1185
|
);
|
|
1196
1186
|
}
|
|
1197
1187
|
}
|
|
1198
|
-
function Kt(
|
|
1199
|
-
return new Zt(
|
|
1188
|
+
function Kt(r, a) {
|
|
1189
|
+
return new Zt(r, a);
|
|
1200
1190
|
}
|
|
1201
|
-
function Qt(
|
|
1202
|
-
return new
|
|
1191
|
+
function Qt(r, a) {
|
|
1192
|
+
return new Wt(r, a);
|
|
1203
1193
|
}
|
|
1204
1194
|
class jt {
|
|
1205
1195
|
constructor(a) {
|
|
@@ -1242,17 +1232,17 @@ class jt {
|
|
|
1242
1232
|
* ```
|
|
1243
1233
|
*/
|
|
1244
1234
|
unstake(a) {
|
|
1245
|
-
return
|
|
1235
|
+
return $t(this.ctx, a);
|
|
1246
1236
|
}
|
|
1247
1237
|
/**
|
|
1248
|
-
* Deposit
|
|
1238
|
+
* Deposit BTCb to get LBTC
|
|
1249
1239
|
*
|
|
1250
|
-
* Deposits
|
|
1240
|
+
* Deposits BTC.b to receive LBTC via the claim flow.
|
|
1251
1241
|
*
|
|
1252
1242
|
* @example
|
|
1253
1243
|
* ```typescript
|
|
1254
1244
|
* const deposit = evm.deposit({
|
|
1255
|
-
* assetIn: AssetId.
|
|
1245
|
+
* assetIn: AssetId.BTCb,
|
|
1256
1246
|
* assetOut: AssetId.LBTC,
|
|
1257
1247
|
* sourceChain: Chain.ETHEREUM,
|
|
1258
1248
|
* destChain: Chain.ETHEREUM,
|
|
@@ -1339,13 +1329,13 @@ class jt {
|
|
|
1339
1329
|
return bt(this.ctx, a);
|
|
1340
1330
|
}
|
|
1341
1331
|
}
|
|
1342
|
-
function de(
|
|
1343
|
-
return new jt(
|
|
1332
|
+
function de(r) {
|
|
1333
|
+
return new jt(r);
|
|
1344
1334
|
}
|
|
1345
1335
|
export {
|
|
1346
|
-
jt as
|
|
1347
|
-
g as
|
|
1348
|
-
|
|
1349
|
-
|
|
1336
|
+
jt as EvmActions,
|
|
1337
|
+
g as EvmDepositStatus,
|
|
1338
|
+
de as evmActions,
|
|
1339
|
+
pe as evmModule
|
|
1350
1340
|
};
|
|
1351
|
-
//# sourceMappingURL=EvmActions-
|
|
1341
|
+
//# sourceMappingURL=EvmActions-D4vFpbYk.js.map
|