@lombard.finance/sdk 4.7.1 → 5.0.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 +91 -2
- package/README.md +22 -21
- 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 +5 -5
- package/dist/bridge.cjs +1 -1
- package/dist/bridge.js +1 -1
- package/dist/btc.cjs +1 -1
- package/dist/btc.js +2 -2
- package/dist/chains/btc/actions/deposit/BtcDeposit.d.ts.map +1 -1
- package/dist/chains/btc/actions/deposit/config/evm.d.ts.map +1 -1
- package/dist/chains/btc/actions/deposit/config/solana.d.ts.map +1 -1
- package/dist/chains/btc/actions/depositAndDeploy/config/index.d.ts.map +1 -1
- package/dist/chains/btc/actions/depositAndDeploy/types.d.ts.map +1 -1
- package/dist/chains/btc/actions/stake/BtcStake.d.ts.map +1 -1
- package/dist/chains/btc/actions/stake/config/evm.d.ts.map +1 -1
- package/dist/chains/btc/actions/stake/config/solana.d.ts.map +1 -1
- package/dist/chains/btc/actions/stakeAndDeploy/config/index.d.ts.map +1 -1
- package/dist/chains/btc/actions/stakeAndDeploy/types.d.ts.map +1 -1
- package/dist/chains/btc/client/getCurrentBlockHeight.d.ts.map +1 -1
- package/dist/chains/evm/actions/deploy/EvmDeploy.d.ts +19 -4
- package/dist/chains/evm/actions/deploy/EvmDeploy.d.ts.map +1 -1
- package/dist/chains/evm/actions/deploy/index.d.ts.map +1 -1
- package/dist/chains/evm/actions/deploy/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/deposit/config/evm.d.ts.map +1 -1
- package/dist/chains/evm/actions/deposit/index.d.ts.map +1 -1
- package/dist/chains/evm/actions/redeem/EvmRedeem.d.ts.map +1 -1
- package/dist/chains/evm/actions/redeem/config/evm.d.ts.map +1 -1
- package/dist/chains/evm/actions/redeem/index.d.ts.map +1 -1
- package/dist/chains/evm/actions/redeem/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/stake/config/index.d.ts.map +1 -1
- package/dist/chains/evm/actions/stake/config/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/stake/index.d.ts.map +1 -1
- package/dist/chains/evm/actions/stake/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/unstake/EvmUnstake.d.ts.map +1 -1
- package/dist/chains/evm/actions/unstake/index.d.ts.map +1 -1
- package/dist/chains/evm/actions/unstake/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/withdraw/EvmCancelWithdraw.d.ts.map +1 -1
- package/dist/chains/evm/actions/withdraw/EvmWithdraw.d.ts +6 -0
- package/dist/chains/evm/actions/withdraw/EvmWithdraw.d.ts.map +1 -1
- package/dist/chains/evm/actions/withdraw/config/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/withdraw/types.d.ts.map +1 -1
- package/dist/chains/solana/SolanaActions.d.ts.map +1 -1
- package/dist/chains/solana/actions/redeem/SolanaRedeem.d.ts.map +1 -1
- package/dist/chains/solana/actions/redeem/types.d.ts.map +1 -1
- package/dist/chains/solana/actions/stake/SolanaStake.d.ts.map +1 -1
- package/dist/chains/solana/actions/stake/types.d.ts.map +1 -1
- package/dist/chains/solana/actions/unstake/SolanaUnstake.d.ts.map +1 -1
- package/dist/chains/solana/actions/unstake/factory.d.ts.map +1 -1
- package/dist/chains/solana/actions/unstake/types.d.ts.map +1 -1
- package/dist/chains/solana/utils.d.ts.map +1 -1
- package/dist/chains/starknet/actions/unstake/config/index.d.ts.map +1 -1
- package/dist/chains/starknet/actions/unstake/factory.d.ts.map +1 -1
- package/dist/chains/starknet/actions/unstake/types.d.ts.map +1 -1
- package/dist/chains/sui/actions/unstake/config/index.d.ts.map +1 -1
- package/dist/chains/sui/actions/unstake/factory.d.ts.map +1 -1
- package/dist/chains/sui/actions/unstake/types.d.ts.map +1 -1
- package/dist/chunks/{BtcActions-BczTnzRn.js → BtcActions-CFGiDxtv.js} +20 -22
- package/dist/chunks/BtcActions-CFGiDxtv.js.map +1 -0
- package/dist/chunks/BtcActions-DJJmmyzi.cjs +2 -0
- package/dist/chunks/BtcActions-DJJmmyzi.cjs.map +1 -0
- package/dist/chunks/EvmActions-CUKBeiUw.js +1508 -0
- package/dist/chunks/EvmActions-CUKBeiUw.js.map +1 -0
- package/dist/chunks/EvmActions-CxipDb7X.cjs +7 -0
- package/dist/chunks/EvmActions-CxipDb7X.cjs.map +1 -0
- package/dist/chunks/{ReferralsClient-W-0-383w.js → ReferralsClient-BRa26dYS.js} +4 -4
- package/dist/chunks/ReferralsClient-BRa26dYS.js.map +1 -0
- package/dist/chunks/{ReferralsClient-D8dHEk_X.cjs → ReferralsClient-o-3AUm7s.cjs} +2 -2
- package/dist/chunks/ReferralsClient-o-3AUm7s.cjs.map +1 -0
- package/dist/chunks/{approveLBTC-BMC4cZEk.cjs → approveLBTC-BBl3KcT2.cjs} +2 -2
- package/dist/chunks/{approveLBTC-BMC4cZEk.cjs.map → approveLBTC-BBl3KcT2.cjs.map} +1 -1
- package/dist/chunks/{approveLBTC-BkdT1N3V.js → approveLBTC-DnCt6ZZF.js} +3 -3
- package/dist/chunks/{approveLBTC-BkdT1N3V.js.map → approveLBTC-DnCt6ZZF.js.map} +1 -1
- package/dist/chunks/{blockchain-identifier-BLPnwbIN.js → blockchain-identifier-BkASqCgZ.js} +2 -2
- package/dist/chunks/blockchain-identifier-BkASqCgZ.js.map +1 -0
- package/dist/chunks/{blockchain-identifier-Bp-LTIdG.cjs → blockchain-identifier-DWfC3Es2.cjs} +2 -2
- package/dist/chunks/blockchain-identifier-DWfC3Es2.cjs.map +1 -0
- package/dist/chunks/{bridge-DbB23m2a.js → bridge-DV4fOcHe.js} +4 -4
- package/dist/chunks/bridge-DV4fOcHe.js.map +1 -0
- package/dist/chunks/{bridge-7Eq_Jmi2.cjs → bridge-DZp5x4Yb.cjs} +2 -2
- package/dist/chunks/bridge-DZp5x4Yb.cjs.map +1 -0
- package/dist/chunks/{config-ow9X5H0c.cjs → config-BfX8lrdO.cjs} +2 -2
- package/dist/chunks/config-BfX8lrdO.cjs.map +1 -0
- package/dist/chunks/{config-C8BfN_9P.js → config-wnjPtnjd.js} +46 -53
- package/dist/chunks/config-wnjPtnjd.js.map +1 -0
- package/dist/chunks/{defi-registry-B8V6dRVB.cjs → defi-registry-CyMKVT3z.cjs} +2 -2
- package/dist/chunks/defi-registry-CyMKVT3z.cjs.map +1 -0
- package/dist/chunks/{defi-registry-CD8EUcNu.js → defi-registry-DULXbu3D.js} +9 -9
- package/dist/chunks/defi-registry-DULXbu3D.js.map +1 -0
- package/dist/chunks/{depositStatus-BJA7tNqc.cjs → depositStatus-B9P1YXEU.cjs} +2 -2
- package/dist/chunks/depositStatus-B9P1YXEU.cjs.map +1 -0
- package/dist/chunks/{depositStatus-HosfExLl.js → depositStatus-Cgd_GDUt.js} +5 -5
- package/dist/chunks/depositStatus-Cgd_GDUt.js.map +1 -0
- package/dist/chunks/events-B9b3YdgM.cjs +2 -0
- package/dist/chunks/events-B9b3YdgM.cjs.map +1 -0
- package/dist/chunks/{events-BlzP_SCT.js → events-DU2wYlt_.js} +189 -191
- package/dist/chunks/events-DU2wYlt_.js.map +1 -0
- package/dist/chunks/{get-exchange-ratio-Bl6pt546.js → get-exchange-ratio-BvPUfcIQ.js} +2 -2
- package/dist/chunks/{get-exchange-ratio-Bl6pt546.js.map → get-exchange-ratio-BvPUfcIQ.js.map} +1 -1
- package/dist/chunks/{get-exchange-ratio-t1PW8I6_.cjs → get-exchange-ratio-DGztGO7i.cjs} +2 -2
- package/dist/chunks/{get-exchange-ratio-t1PW8I6_.cjs.map → get-exchange-ratio-DGztGO7i.cjs.map} +1 -1
- package/dist/chunks/{get-positions-summary-DdZvBmCN.cjs → get-positions-summary-CC7BDtlY.cjs} +2 -2
- package/dist/chunks/get-positions-summary-CC7BDtlY.cjs.map +1 -0
- package/dist/chunks/{get-positions-summary-CaX2BCHp.js → get-positions-summary-DxAgmaMl.js} +2 -2
- package/dist/chunks/get-positions-summary-DxAgmaMl.js.map +1 -0
- package/dist/chunks/get-vault-tvl-B6rSrGi_.js +203 -0
- package/dist/chunks/get-vault-tvl-B6rSrGi_.js.map +1 -0
- package/dist/chunks/get-vault-tvl-dvEPPxvT.cjs +2 -0
- package/dist/chunks/get-vault-tvl-dvEPPxvT.cjs.map +1 -0
- package/dist/chunks/get-vault-withdrawals-Cgx7VsM1.cjs +2 -0
- package/dist/chunks/get-vault-withdrawals-Cgx7VsM1.cjs.map +1 -0
- package/dist/chunks/get-vault-withdrawals-W5CgNbqE.js +154 -0
- package/dist/chunks/get-vault-withdrawals-W5CgNbqE.js.map +1 -0
- package/dist/chunks/{getUserStakeAndBakeSignature-CqlrwA0t.js → getUserStakeAndBakeSignature-BRhWFYyY.js} +4 -4
- package/dist/chunks/getUserStakeAndBakeSignature-BRhWFYyY.js.map +1 -0
- package/dist/chunks/{getUserStakeAndBakeSignature-BmY5j0OM.cjs → getUserStakeAndBakeSignature-VlC_GHmz.cjs} +2 -2
- package/dist/chunks/getUserStakeAndBakeSignature-VlC_GHmz.cjs.map +1 -0
- package/dist/chunks/hex-BiCL4CPh.js +11 -0
- package/dist/chunks/hex-BiCL4CPh.js.map +1 -0
- package/dist/chunks/hex-DeJtv8eu.cjs +2 -0
- package/dist/chunks/hex-DeJtv8eu.cjs.map +1 -0
- package/dist/chunks/{lbtc-addresses-BlyGFWnW.js → lbtc-addresses-ClXt-tuB.js} +2 -2
- package/dist/chunks/{lbtc-addresses-BlyGFWnW.js.map → lbtc-addresses-ClXt-tuB.js.map} +1 -1
- package/dist/chunks/{lbtc-addresses-DjsipX5Q.cjs → lbtc-addresses-D3jG1VUC.cjs} +2 -2
- package/dist/chunks/{lbtc-addresses-DjsipX5Q.cjs.map → lbtc-addresses-D3jG1VUC.cjs.map} +1 -1
- package/dist/chunks/parameters-CcpaKGU2.js +24 -0
- package/dist/chunks/parameters-CcpaKGU2.js.map +1 -0
- package/dist/chunks/parameters-YNWmaAho.cjs +2 -0
- package/dist/chunks/parameters-YNWmaAho.cjs.map +1 -0
- package/dist/chunks/{statusConstants-BJIXJNIC.cjs → statusConstants-B-7VEYgO.cjs} +2 -2
- package/dist/chunks/statusConstants-B-7VEYgO.cjs.map +1 -0
- package/dist/chunks/{statusConstants-BQna5LGH.js → statusConstants-C3JHNUTC.js} +15 -17
- package/dist/chunks/statusConstants-C3JHNUTC.js.map +1 -0
- package/dist/chunks/{storeNetworkFeeSignature-tprCigR1.js → storeNetworkFeeSignature-CY_Z-Wtn.js} +2 -2
- package/dist/chunks/{storeNetworkFeeSignature-tprCigR1.js.map → storeNetworkFeeSignature-CY_Z-Wtn.js.map} +1 -1
- package/dist/chunks/{storeNetworkFeeSignature-CLm8I2pf.cjs → storeNetworkFeeSignature-DJgBfZp7.cjs} +2 -2
- package/dist/chunks/{storeNetworkFeeSignature-CLm8I2pf.cjs.map → storeNetworkFeeSignature-DJgBfZp7.cjs.map} +1 -1
- package/dist/chunks/token-addresses-C7H9E4qz.cjs +2 -0
- package/dist/chunks/token-addresses-C7H9E4qz.cjs.map +1 -0
- package/dist/chunks/{token-addresses-Ddar0FyS.js → token-addresses-DVnRPyu4.js} +16 -14
- package/dist/chunks/token-addresses-DVnRPyu4.js.map +1 -0
- package/dist/chunks/{tokens-HhVpKe3K.js → tokens-Btl3GXbc.js} +3 -3
- package/dist/chunks/tokens-Btl3GXbc.js.map +1 -0
- package/dist/chunks/{tokens-CBsz6l_2.cjs → tokens-DEYY7W7O.cjs} +2 -2
- package/dist/chunks/tokens-DEYY7W7O.cjs.map +1 -0
- package/dist/chunks/unwrapBtceToLbtcv-C4OxoVVU.js +321 -0
- package/dist/chunks/unwrapBtceToLbtcv-C4OxoVVU.js.map +1 -0
- package/dist/chunks/unwrapBtceToLbtcv-Dg-yUGpg.cjs +2 -0
- package/dist/chunks/unwrapBtceToLbtcv-Dg-yUGpg.cjs.map +1 -0
- package/dist/chunks/withdrawEarn-CTtVruit.cjs +7 -0
- package/dist/chunks/withdrawEarn-CTtVruit.cjs.map +1 -0
- package/dist/chunks/{unstakeLBTC-Bg8OsAMV.js → withdrawEarn-QFaMhs0t.js} +965 -612
- package/dist/chunks/withdrawEarn-QFaMhs0t.js.map +1 -0
- package/dist/client/ApiNamespace.d.ts +3 -6
- package/dist/client/ApiNamespace.d.ts.map +1 -1
- package/dist/common/blockchain-identifier.d.ts.map +1 -1
- package/dist/common/chains.d.ts +1 -1
- package/dist/common/chains.d.ts.map +1 -1
- package/dist/common/feature-config.d.ts.map +1 -1
- package/dist/contract-functions/cancelEarnWithdrawal/cancelEarnWithdrawal.d.ts +19 -0
- package/dist/contract-functions/cancelEarnWithdrawal/cancelEarnWithdrawal.d.ts.map +1 -0
- package/dist/contract-functions/cancelEarnWithdrawal/index.d.ts +2 -0
- package/dist/contract-functions/cancelEarnWithdrawal/index.d.ts.map +1 -0
- package/dist/contract-functions/depositEarn/depositEarn.d.ts +36 -0
- package/dist/contract-functions/depositEarn/depositEarn.d.ts.map +1 -0
- package/dist/contract-functions/depositEarn/index.d.ts +2 -0
- package/dist/contract-functions/depositEarn/index.d.ts.map +1 -0
- package/dist/contract-functions/getBasculeDepositStatus/getBasculeDepositStatus.d.ts.map +1 -1
- package/dist/contract-functions/getEarnPosition/getEarnPosition.d.ts +17 -16
- package/dist/contract-functions/getEarnPosition/getEarnPosition.d.ts.map +1 -1
- package/dist/contract-functions/getShareValue/getShareValue.d.ts +5 -15
- package/dist/contract-functions/getShareValue/getShareValue.d.ts.map +1 -1
- package/dist/contract-functions/getSharesByAddress/getSharesByAddress.d.ts +5 -20
- package/dist/contract-functions/getSharesByAddress/getSharesByAddress.d.ts.map +1 -1
- package/dist/contract-functions/index.d.ts +4 -2
- package/dist/contract-functions/index.d.ts.map +1 -1
- package/dist/contract-functions/previewWithdrawEarn/index.d.ts +2 -0
- package/dist/contract-functions/previewWithdrawEarn/index.d.ts.map +1 -0
- package/dist/contract-functions/previewWithdrawEarn/previewWithdrawEarn.d.ts +38 -0
- package/dist/contract-functions/previewWithdrawEarn/previewWithdrawEarn.d.ts.map +1 -0
- package/dist/contract-functions/signStakeAndBake/validation.d.ts.map +1 -1
- package/dist/contract-functions/withdrawEarn/index.d.ts +2 -0
- package/dist/contract-functions/withdrawEarn/index.d.ts.map +1 -0
- package/dist/contract-functions/withdrawEarn/withdrawEarn.d.ts +46 -0
- package/dist/contract-functions/withdrawEarn/withdrawEarn.d.ts.map +1 -0
- package/dist/contract-functions/wrapToBtce/wrapToBtce.d.ts.map +1 -1
- package/dist/contracts.cjs +1 -1
- package/dist/contracts.js +32 -30
- package/dist/core/assets/catalog.d.ts.map +1 -1
- package/dist/core/assets/utils.d.ts.map +1 -1
- package/dist/core/chains/utils.d.ts.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +19 -19
- package/dist/defi/defi-registry.d.ts.map +1 -1
- package/dist/defi/index.d.ts +1 -1
- package/dist/defi/index.d.ts.map +1 -1
- package/dist/defi.cjs +1 -1
- package/dist/defi.js +4 -4
- package/dist/entries/api.d.ts +14 -14
- package/dist/entries/api.d.ts.map +1 -1
- package/dist/entries/contracts.d.ts +4 -2
- package/dist/entries/contracts.d.ts.map +1 -1
- package/dist/entries/defi.d.ts +1 -1
- package/dist/entries/defi.d.ts.map +1 -1
- package/dist/entries/evm.d.ts +7 -7
- package/dist/entries/evm.d.ts.map +1 -1
- package/dist/entries/utils.d.ts +9 -9
- package/dist/entries/utils.d.ts.map +1 -1
- package/dist/entries/vaults.d.ts +1 -1
- package/dist/entries/vaults.d.ts.map +1 -1
- package/dist/evm.cjs +1 -1
- package/dist/evm.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +67 -65
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +171 -174
- package/dist/index.js.map +1 -1
- package/dist/metrics.cjs +1 -1
- package/dist/metrics.js +1 -1
- package/dist/services/EvmService.d.ts.map +1 -1
- package/dist/shared/actions/BaseAction.d.ts.map +1 -1
- package/dist/shared/deposits/depositStatus.d.ts.map +1 -1
- package/dist/shared/validation/index.d.ts.map +1 -1
- package/dist/tokens/tokens.d.ts.map +1 -1
- package/dist/utils/chain.d.ts.map +1 -1
- package/dist/utils/consoleLogger.d.ts.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +16 -16
- package/dist/vaults/index.d.ts +8 -10
- package/dist/vaults/index.d.ts.map +1 -1
- package/dist/vaults/lib/config.d.ts +148 -150
- package/dist/vaults/lib/config.d.ts.map +1 -1
- package/dist/vaults/lib/metrics/get-vault-apy.d.ts +2 -4
- package/dist/vaults/lib/metrics/get-vault-apy.d.ts.map +1 -1
- package/dist/vaults/lib/metrics/get-vault-points.d.ts +2 -5
- package/dist/vaults/lib/metrics/get-vault-points.d.ts.map +1 -1
- package/dist/vaults/lib/metrics/get-vault-tvl.d.ts +5 -8
- package/dist/vaults/lib/metrics/get-vault-tvl.d.ts.map +1 -1
- package/dist/vaults/lib/ops/deposit.d.ts +5 -14
- package/dist/vaults/lib/ops/deposit.d.ts.map +1 -1
- package/dist/vaults/lib/ops/get-vault-deposits.d.ts +9 -13
- package/dist/vaults/lib/ops/get-vault-deposits.d.ts.map +1 -1
- package/dist/vaults/lib/ops/get-vault-minimum-deposit.d.ts +4 -7
- package/dist/vaults/lib/ops/get-vault-minimum-deposit.d.ts.map +1 -1
- package/dist/vaults/lib/ops/get-vault-withdrawals.d.ts +14 -18
- package/dist/vaults/lib/ops/get-vault-withdrawals.d.ts.map +1 -1
- package/dist/vaults/lib/ops/preview-vault-deposit.d.ts +4 -8
- package/dist/vaults/lib/ops/preview-vault-deposit.d.ts.map +1 -1
- package/dist/vaults/lib/ops/withdraw.d.ts +11 -27
- package/dist/vaults/lib/ops/withdraw.d.ts.map +1 -1
- package/dist/vaults.cjs +1 -1
- package/dist/vaults.cjs.map +1 -1
- package/dist/vaults.js +91 -103
- package/dist/vaults.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/BtcActions-BczTnzRn.js.map +0 -1
- package/dist/chunks/BtcActions-PyJhuiZN.cjs +0 -2
- package/dist/chunks/BtcActions-PyJhuiZN.cjs.map +0 -1
- package/dist/chunks/EvmActions-D3RAK9_Z.cjs +0 -2
- package/dist/chunks/EvmActions-D3RAK9_Z.cjs.map +0 -1
- package/dist/chunks/EvmActions-DSKThOAy.js +0 -1341
- package/dist/chunks/EvmActions-DSKThOAy.js.map +0 -1
- package/dist/chunks/ReferralsClient-D8dHEk_X.cjs.map +0 -1
- package/dist/chunks/ReferralsClient-W-0-383w.js.map +0 -1
- package/dist/chunks/blockchain-identifier-BLPnwbIN.js.map +0 -1
- package/dist/chunks/blockchain-identifier-Bp-LTIdG.cjs.map +0 -1
- package/dist/chunks/bridge-7Eq_Jmi2.cjs.map +0 -1
- package/dist/chunks/bridge-DbB23m2a.js.map +0 -1
- package/dist/chunks/config-C8BfN_9P.js.map +0 -1
- package/dist/chunks/config-ow9X5H0c.cjs.map +0 -1
- package/dist/chunks/defi-registry-B8V6dRVB.cjs.map +0 -1
- package/dist/chunks/defi-registry-CD8EUcNu.js.map +0 -1
- package/dist/chunks/depositStatus-BJA7tNqc.cjs.map +0 -1
- package/dist/chunks/depositStatus-HosfExLl.js.map +0 -1
- package/dist/chunks/events-BlzP_SCT.js.map +0 -1
- package/dist/chunks/events-DNehj45M.cjs +0 -2
- package/dist/chunks/events-DNehj45M.cjs.map +0 -1
- package/dist/chunks/get-positions-summary-CaX2BCHp.js.map +0 -1
- package/dist/chunks/get-positions-summary-DdZvBmCN.cjs.map +0 -1
- package/dist/chunks/get-vault-tvl-CihHEkqK.js +0 -226
- package/dist/chunks/get-vault-tvl-CihHEkqK.js.map +0 -1
- package/dist/chunks/get-vault-tvl-DZ-xzehy.cjs +0 -2
- package/dist/chunks/get-vault-tvl-DZ-xzehy.cjs.map +0 -1
- package/dist/chunks/get-vault-withdrawals-DLwFMQEB.cjs +0 -2
- package/dist/chunks/get-vault-withdrawals-DLwFMQEB.cjs.map +0 -1
- package/dist/chunks/get-vault-withdrawals-QJOdxB5Z.js +0 -161
- package/dist/chunks/get-vault-withdrawals-QJOdxB5Z.js.map +0 -1
- package/dist/chunks/getUserStakeAndBakeSignature-BmY5j0OM.cjs.map +0 -1
- package/dist/chunks/getUserStakeAndBakeSignature-CqlrwA0t.js.map +0 -1
- package/dist/chunks/parameters-C_16L5ft.js +0 -11
- package/dist/chunks/parameters-C_16L5ft.js.map +0 -1
- package/dist/chunks/parameters-DK9cYCAH.cjs +0 -2
- package/dist/chunks/parameters-DK9cYCAH.cjs.map +0 -1
- package/dist/chunks/statusConstants-BJIXJNIC.cjs.map +0 -1
- package/dist/chunks/statusConstants-BQna5LGH.js.map +0 -1
- package/dist/chunks/time-I-BeyUkG.cjs +0 -2
- package/dist/chunks/time-I-BeyUkG.cjs.map +0 -1
- package/dist/chunks/time-Sa5gggPG.js +0 -24
- package/dist/chunks/time-Sa5gggPG.js.map +0 -1
- package/dist/chunks/token-addresses-Ddar0FyS.js.map +0 -1
- package/dist/chunks/token-addresses-DvY-Mw7b.cjs +0 -2
- package/dist/chunks/token-addresses-DvY-Mw7b.cjs.map +0 -1
- package/dist/chunks/tokens-CBsz6l_2.cjs.map +0 -1
- package/dist/chunks/tokens-HhVpKe3K.js.map +0 -1
- package/dist/chunks/unstakeLBTC-Bg8OsAMV.js.map +0 -1
- package/dist/chunks/unstakeLBTC-BmHvDxBN.cjs +0 -2
- package/dist/chunks/unstakeLBTC-BmHvDxBN.cjs.map +0 -1
- package/dist/chunks/withdraw-Bkp5-2dG.cjs +0 -12
- package/dist/chunks/withdraw-Bkp5-2dG.cjs.map +0 -1
- package/dist/chunks/withdraw-kf8mYbYH.js +0 -209
- package/dist/chunks/withdraw-kf8mYbYH.js.map +0 -1
- package/dist/chunks/wrapToBtce-By2mh503.js +0 -298
- package/dist/chunks/wrapToBtce-By2mh503.js.map +0 -1
- package/dist/chunks/wrapToBtce-DDeIlv3d.cjs +0 -2
- package/dist/chunks/wrapToBtce-DDeIlv3d.cjs.map +0 -1
- package/dist/contract-functions/getShareValue/index.d.ts +0 -2
- package/dist/contract-functions/getShareValue/index.d.ts.map +0 -1
- package/dist/contract-functions/getSharesByAddress/index.d.ts +0 -2
- package/dist/contract-functions/getSharesByAddress/index.d.ts.map +0 -1
|
@@ -0,0 +1,1508 @@
|
|
|
1
|
+
var dt = Object.defineProperty;
|
|
2
|
+
var pt = (r, a, t) => a in r ? dt(r, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[a] = t;
|
|
3
|
+
var p = (r, a, t) => pt(r, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
+
import D from "bignumber.js";
|
|
5
|
+
import { getMintingFee as at, signNetworkFee as it, getStakeAndBakeFee as mt, signStakeAndBake as lt, signLbtcDestinationAddr as vt, waitForTransactionReceipt as U, depositEarn as Et, claimLBTC as Ct, redeemToken as nt, getTokenAllowance as _t, approveToken as gt, depositToken as At, cancelWithdrawInternal as It, withdrawEarn as ft, queueWithdrawInternal as wt } from "./withdrawEarn-QFaMhs0t.js";
|
|
6
|
+
import { Token as v, makeWalletClient as z, CHAIN_ID_TO_VIEM_CHAIN_MAP as b, AddressKind as Dt, ChainId as et } from "./token-addresses-DVnRPyu4.js";
|
|
7
|
+
import { makePublicClient as x, getTokenInfo as q, toBaseDenomination as y, fromBaseDenomination as B, getErrorMessage as Pt, getTokenContractInfo as W } from "./tokens-Btl3GXbc.js";
|
|
8
|
+
import { Chain as I, BaseAction as S, EvmOperationStatus as s, validatePrepareParams as L, LombardError as h, parseChainIdentifier as A, StepStatus as i, objectType as N, evmAmountSchema as O, stringType as Tt, evmAddressSchema as rt, getEvmAssetChains as P, bitcoinAddressSchema as ot, getEvmChainsWithAllAssets as ct, WithdrawErrorCode as V, createEvmCoreContext as St } from "./statusConstants-C3JHNUTC.js";
|
|
9
|
+
import { getNetworkFeeSignature as xt, storeNetworkFeeSignature as Lt } from "./storeNetworkFeeSignature-CY_Z-Wtn.js";
|
|
10
|
+
import { requiresAutoMintFee as Nt } from "./fee-requirements-CCNsxAvJ.js";
|
|
11
|
+
import { DefiProtocol as T, AssetId as l } from "./defi-registry-DULXbu3D.js";
|
|
12
|
+
import { r as o } from "./index-CfcQ_g3t.js";
|
|
13
|
+
import { erc20Abi as st } from "viem";
|
|
14
|
+
import { toBigInt as Z } from "./numbers-CclN2Ohk.js";
|
|
15
|
+
import { isEarnChain as j, EARN_VAULT as M, isBtceVaultChain as G, BTCE_VAULT as $ } from "./config-wnjPtnjd.js";
|
|
16
|
+
class Ot {
|
|
17
|
+
constructor(a) {
|
|
18
|
+
this.env = a;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get minting fee for a chain
|
|
22
|
+
* @param chainId - The chain ID
|
|
23
|
+
* @param token - Optional token (defaults to LBTC). Use Token.BTCb for BTC.b deposits.
|
|
24
|
+
*/
|
|
25
|
+
async getMintingFee(a, t) {
|
|
26
|
+
return (await at({
|
|
27
|
+
token: t || v.LBTC,
|
|
28
|
+
chainId: a,
|
|
29
|
+
env: this.env
|
|
30
|
+
})).toString();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sign network fee authorization (EIP-712)
|
|
34
|
+
*/
|
|
35
|
+
async signNetworkFee(a) {
|
|
36
|
+
const t = await it({
|
|
37
|
+
fee: new D(a.fee),
|
|
38
|
+
account: a.account,
|
|
39
|
+
chainId: a.chainId,
|
|
40
|
+
provider: a.provider,
|
|
41
|
+
env: this.env,
|
|
42
|
+
// Pass token for signing - defaults to LBTC for backwards compatibility
|
|
43
|
+
token: a.token ?? v.LBTC
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
signature: t.signature,
|
|
47
|
+
typedData: t.typedData
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get stake and bake fee for a vault
|
|
52
|
+
*/
|
|
53
|
+
async getStakeAndBakeFee(a, t) {
|
|
54
|
+
return (await mt({
|
|
55
|
+
chainId: a,
|
|
56
|
+
protocol: t
|
|
57
|
+
})).toString();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sign stake and bake authorization
|
|
61
|
+
*/
|
|
62
|
+
async signStakeAndBake(a) {
|
|
63
|
+
const t = await lt({
|
|
64
|
+
value: new D(a.value),
|
|
65
|
+
account: a.account,
|
|
66
|
+
chainId: a.chainId,
|
|
67
|
+
provider: a.provider,
|
|
68
|
+
env: this.env,
|
|
69
|
+
vaultKey: a.vaultKey,
|
|
70
|
+
token: a.token
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
signature: t.signature,
|
|
74
|
+
typedData: t.typedData
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Sign LBTC destination address (for non-Ethereum EVM chains)
|
|
79
|
+
*/
|
|
80
|
+
async signLbtcDestination(a) {
|
|
81
|
+
return { signature: await vt({
|
|
82
|
+
account: a.address,
|
|
83
|
+
chainId: a.chainId,
|
|
84
|
+
provider: a.provider
|
|
85
|
+
}) };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function Pe() {
|
|
89
|
+
return {
|
|
90
|
+
id: "evm",
|
|
91
|
+
chain: "evm",
|
|
92
|
+
register(r) {
|
|
93
|
+
return new Ot(r.env);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const Bt = {
|
|
98
|
+
routes: [
|
|
99
|
+
// Veda - Ethereum
|
|
100
|
+
{
|
|
101
|
+
asset: l.LBTC,
|
|
102
|
+
sourceChains: [I.ETHEREUM],
|
|
103
|
+
protocols: [T.Veda],
|
|
104
|
+
envs: [o.prod]
|
|
105
|
+
},
|
|
106
|
+
// Veda - Base
|
|
107
|
+
{
|
|
108
|
+
asset: l.LBTC,
|
|
109
|
+
sourceChains: [I.BASE],
|
|
110
|
+
protocols: [T.Veda],
|
|
111
|
+
envs: [o.prod]
|
|
112
|
+
},
|
|
113
|
+
// Veda - BSC
|
|
114
|
+
{
|
|
115
|
+
asset: l.LBTC,
|
|
116
|
+
sourceChains: [I.BSC],
|
|
117
|
+
protocols: [T.Veda],
|
|
118
|
+
envs: [o.prod]
|
|
119
|
+
},
|
|
120
|
+
// Veda - Corn
|
|
121
|
+
{
|
|
122
|
+
asset: l.LBTC,
|
|
123
|
+
sourceChains: [I.CORN],
|
|
124
|
+
protocols: [T.Veda],
|
|
125
|
+
envs: [o.prod]
|
|
126
|
+
},
|
|
127
|
+
// Silo - Avalanche
|
|
128
|
+
{
|
|
129
|
+
asset: l.LBTC,
|
|
130
|
+
sourceChains: [I.AVALANCHE],
|
|
131
|
+
protocols: [T.Silo],
|
|
132
|
+
envs: [o.prod]
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
async function Rt({
|
|
137
|
+
amount: r,
|
|
138
|
+
approve: a = !0,
|
|
139
|
+
token: t = v.LBTC,
|
|
140
|
+
account: e,
|
|
141
|
+
chainId: n,
|
|
142
|
+
provider: m,
|
|
143
|
+
rpcUrl: u,
|
|
144
|
+
env: d
|
|
145
|
+
}) {
|
|
146
|
+
const c = M;
|
|
147
|
+
if (!j(n))
|
|
148
|
+
throw new Error(
|
|
149
|
+
`Unsupported chain id: ${n}. Please switch to one of the supported chains: ${c.chains.join(", ")}`
|
|
150
|
+
);
|
|
151
|
+
const E = x({ chainId: n, rpcUrl: u }), _ = z({ provider: m, chainId: n }), C = await q(t, n, d, u);
|
|
152
|
+
if (!C)
|
|
153
|
+
throw new Error(`Unknown deposit token: ${t}`);
|
|
154
|
+
const g = D(r), w = Z(
|
|
155
|
+
y(g, C.decimals)
|
|
156
|
+
), H = await E.readContract({
|
|
157
|
+
address: C.address,
|
|
158
|
+
abi: C.abi,
|
|
159
|
+
functionName: "allowance",
|
|
160
|
+
args: [e, c.vaultContract.address]
|
|
161
|
+
}), R = B(
|
|
162
|
+
String(H),
|
|
163
|
+
C.decimals
|
|
164
|
+
), k = await E.readContract({
|
|
165
|
+
address: C.address,
|
|
166
|
+
abi: C.abi,
|
|
167
|
+
functionName: "balanceOf",
|
|
168
|
+
args: [e]
|
|
169
|
+
}), X = B(
|
|
170
|
+
String(k),
|
|
171
|
+
C.decimals
|
|
172
|
+
);
|
|
173
|
+
if (g.isGreaterThan(X))
|
|
174
|
+
throw new Error(
|
|
175
|
+
`The deposit amount exceeds the account's balance.
|
|
176
|
+
Deposit amount: ${g.toFixed()}
|
|
177
|
+
Balance: ${X.toFixed()}`
|
|
178
|
+
);
|
|
179
|
+
if (g.isGreaterThan(R)) {
|
|
180
|
+
const tt = `The deposit amount exceeds allowance.
|
|
181
|
+
Deposit amount: ${g.toFixed()}
|
|
182
|
+
Allowance: ${R.toFixed()}`;
|
|
183
|
+
if (!a)
|
|
184
|
+
throw new Error(tt);
|
|
185
|
+
console.info(tt);
|
|
186
|
+
try {
|
|
187
|
+
console.info(`Trying to approve ${w}`);
|
|
188
|
+
const { request: F } = await E.simulateContract({
|
|
189
|
+
account: e,
|
|
190
|
+
chain: b[n],
|
|
191
|
+
address: C.address,
|
|
192
|
+
abi: C.abi,
|
|
193
|
+
functionName: "approve",
|
|
194
|
+
args: [c.vaultContract.address, w]
|
|
195
|
+
}), Y = await _.writeContract(F);
|
|
196
|
+
console.info(`Approve tx hash: ${Y}`), console.info(`Approved ${w} for ${c.vaultContract.address}`);
|
|
197
|
+
} catch (F) {
|
|
198
|
+
const Y = Pt(F);
|
|
199
|
+
throw new Error(
|
|
200
|
+
`Could not approve ${w} for ${c.vaultContract.address}.
|
|
201
|
+
Reason: ${Y}`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const { request: ut } = await E.simulateContract({
|
|
206
|
+
account: e,
|
|
207
|
+
chain: b[n],
|
|
208
|
+
address: c.tellerContracts[n].address,
|
|
209
|
+
abi: c.tellerContracts[n].abi,
|
|
210
|
+
functionName: "deposit",
|
|
211
|
+
args: [C.address, w, 0n]
|
|
212
|
+
});
|
|
213
|
+
return await _.writeContract(ut);
|
|
214
|
+
}
|
|
215
|
+
class bt extends S {
|
|
216
|
+
constructor(t, e) {
|
|
217
|
+
super(s.IDLE);
|
|
218
|
+
p(this, "_amount");
|
|
219
|
+
p(this, "_protocol");
|
|
220
|
+
p(this, "_needsApproval", !1);
|
|
221
|
+
p(this, "_txHash");
|
|
222
|
+
p(this, "_account");
|
|
223
|
+
p(this, "_chainId");
|
|
224
|
+
this.ctx = t, this.params = e;
|
|
225
|
+
}
|
|
226
|
+
get amount() {
|
|
227
|
+
return this._amount;
|
|
228
|
+
}
|
|
229
|
+
get protocol() {
|
|
230
|
+
return this._protocol;
|
|
231
|
+
}
|
|
232
|
+
get needsApproval() {
|
|
233
|
+
return this._needsApproval;
|
|
234
|
+
}
|
|
235
|
+
get txHash() {
|
|
236
|
+
return this._txHash;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Returns true when the deposit should go through the BTCe ERC-4626 wrapper:
|
|
240
|
+
* Veda protocol on a chain that has the BTCe contract deployed.
|
|
241
|
+
*/
|
|
242
|
+
isVedaBtcePath() {
|
|
243
|
+
return this._protocol === T.Veda && this._chainId !== void 0 && G(this._chainId);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Returns the ERC-20 spender address for LBTC approval:
|
|
247
|
+
* - BTCe wrapper address for Veda on BTCe-supported chains
|
|
248
|
+
* - LBTCv BoringVault address for all other cases
|
|
249
|
+
*/
|
|
250
|
+
getSpenderAddress() {
|
|
251
|
+
return this.isVedaBtcePath() ? $.contracts[this._chainId] : M.vaultContract.address;
|
|
252
|
+
}
|
|
253
|
+
async prepare(t) {
|
|
254
|
+
return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
|
|
255
|
+
const e = L(this.prepareSchema, t);
|
|
256
|
+
this._amount = e.amount, this._protocol = t.protocol, this.validateProtocol(t.protocol);
|
|
257
|
+
const n = await this.ctx.getProvider("evm");
|
|
258
|
+
if (!n)
|
|
259
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
260
|
+
const u = (await n.request({
|
|
261
|
+
method: "eth_accounts"
|
|
262
|
+
}))[0];
|
|
263
|
+
if (!u)
|
|
264
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
265
|
+
this._account = u, this._chainId = A(this.params.sourceChain);
|
|
266
|
+
const d = await q(
|
|
267
|
+
v.LBTC,
|
|
268
|
+
this._chainId,
|
|
269
|
+
this.ctx.env
|
|
270
|
+
);
|
|
271
|
+
if (!d)
|
|
272
|
+
throw h.invalidParameter(
|
|
273
|
+
"token",
|
|
274
|
+
"Could not get LBTC token info"
|
|
275
|
+
);
|
|
276
|
+
const c = this.getSpenderAddress(), _ = await x({ chainId: this._chainId }).readContract({
|
|
277
|
+
address: d.address,
|
|
278
|
+
abi: st,
|
|
279
|
+
functionName: "allowance",
|
|
280
|
+
args: [u, c]
|
|
281
|
+
}), C = new D(e.amount), g = y(C, d.decimals), w = new D(String(_));
|
|
282
|
+
this._needsApproval = g.isGreaterThan(w), this._needsApproval ? (this.emitProgress({
|
|
283
|
+
status: s.NEEDS_APPROVAL,
|
|
284
|
+
steps: { approval: i.PENDING, deploying: i.IDLE }
|
|
285
|
+
}), this.updateStatus(s.NEEDS_APPROVAL)) : (this.emitProgress({
|
|
286
|
+
status: s.READY,
|
|
287
|
+
steps: {
|
|
288
|
+
approval: i.COMPLETE,
|
|
289
|
+
deploying: i.PENDING
|
|
290
|
+
}
|
|
291
|
+
}), this.updateStatus(s.READY));
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
async approve() {
|
|
295
|
+
return this.assertStatus(s.NEEDS_APPROVAL, "approve"), this.act(async () => {
|
|
296
|
+
if (!this._account || !this._chainId || !this._amount)
|
|
297
|
+
throw h.missingParameter("account, chainId, or amount");
|
|
298
|
+
const t = await this.ctx.getProvider("evm");
|
|
299
|
+
if (!t)
|
|
300
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
301
|
+
const e = await q(
|
|
302
|
+
v.LBTC,
|
|
303
|
+
this._chainId,
|
|
304
|
+
this.ctx.env
|
|
305
|
+
);
|
|
306
|
+
if (!e)
|
|
307
|
+
throw h.invalidParameter(
|
|
308
|
+
"token",
|
|
309
|
+
"Could not get LBTC token info"
|
|
310
|
+
);
|
|
311
|
+
const n = new D(this._amount), m = Z(
|
|
312
|
+
y(n, e.decimals)
|
|
313
|
+
), u = this.getSpenderAddress(), d = x({ chainId: this._chainId }), c = z({
|
|
314
|
+
provider: t,
|
|
315
|
+
chainId: this._chainId
|
|
316
|
+
}), { request: E } = await d.simulateContract({
|
|
317
|
+
account: this._account,
|
|
318
|
+
chain: b[this._chainId],
|
|
319
|
+
address: e.address,
|
|
320
|
+
abi: st,
|
|
321
|
+
functionName: "approve",
|
|
322
|
+
args: [u, m]
|
|
323
|
+
}), _ = await c.writeContract(E);
|
|
324
|
+
await U(
|
|
325
|
+
d,
|
|
326
|
+
_,
|
|
327
|
+
"LBTC deposit approval"
|
|
328
|
+
), this._needsApproval = !1, this.emitProgress({
|
|
329
|
+
status: s.READY,
|
|
330
|
+
steps: { approval: i.COMPLETE, deploying: i.PENDING }
|
|
331
|
+
});
|
|
332
|
+
}, s.READY);
|
|
333
|
+
}
|
|
334
|
+
async execute() {
|
|
335
|
+
return this.assertStatus(s.READY, "execute"), this.act(async () => {
|
|
336
|
+
const t = await this.ctx.getProvider("evm");
|
|
337
|
+
if (!t)
|
|
338
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
339
|
+
if (!this._account || !this._chainId)
|
|
340
|
+
throw h.missingParameter("account or chainId");
|
|
341
|
+
this.emitProgress({
|
|
342
|
+
status: s.READY,
|
|
343
|
+
steps: { approval: i.COMPLETE, deploying: i.PENDING }
|
|
344
|
+
});
|
|
345
|
+
let e;
|
|
346
|
+
return this.isVedaBtcePath() ? e = await Et({
|
|
347
|
+
token: v.LBTC,
|
|
348
|
+
amount: this._amount,
|
|
349
|
+
receiver: this.params.recipient,
|
|
350
|
+
approve: !1,
|
|
351
|
+
account: this._account,
|
|
352
|
+
chainId: this._chainId,
|
|
353
|
+
provider: t,
|
|
354
|
+
env: this.ctx.env
|
|
355
|
+
}) : e = await Rt({
|
|
356
|
+
amount: this._amount,
|
|
357
|
+
approve: !1,
|
|
358
|
+
token: v.LBTC,
|
|
359
|
+
account: this._account,
|
|
360
|
+
chainId: this._chainId,
|
|
361
|
+
provider: t,
|
|
362
|
+
env: this.ctx.env
|
|
363
|
+
}), this._txHash = e, this.emitProgress({
|
|
364
|
+
status: s.COMPLETED,
|
|
365
|
+
steps: {
|
|
366
|
+
approval: i.COMPLETE,
|
|
367
|
+
deploying: i.COMPLETE
|
|
368
|
+
}
|
|
369
|
+
}), this.emitCompleted(), { txHash: e };
|
|
370
|
+
}, s.COMPLETED);
|
|
371
|
+
}
|
|
372
|
+
get prepareSchema() {
|
|
373
|
+
return N({
|
|
374
|
+
amount: O,
|
|
375
|
+
protocol: Tt().min(1, "Protocol is required")
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
validateProtocol(t) {
|
|
379
|
+
if (!Bt.routes.some(
|
|
380
|
+
(n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
|
|
381
|
+
))
|
|
382
|
+
throw h.invalidParameter(
|
|
383
|
+
"protocol",
|
|
384
|
+
`Protocol ${t} is not supported in ${this.ctx.env} environment`
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function yt(r, a) {
|
|
389
|
+
return new bt(r, a);
|
|
390
|
+
}
|
|
391
|
+
const Mt = P(l.BTCb, [o.prod]), Ht = P(l.BTCb, [
|
|
392
|
+
o.testnet,
|
|
393
|
+
o.stage,
|
|
394
|
+
o.dev,
|
|
395
|
+
o.ibc
|
|
396
|
+
]), kt = P(l.LBTC, [o.prod]), Ft = P(l.LBTC, [
|
|
397
|
+
o.testnet,
|
|
398
|
+
o.stage,
|
|
399
|
+
o.dev,
|
|
400
|
+
o.ibc
|
|
401
|
+
]), Yt = {
|
|
402
|
+
routes: [
|
|
403
|
+
// Production: BTCb → LBTC
|
|
404
|
+
{
|
|
405
|
+
assetsIn: [l.BTCb],
|
|
406
|
+
assetOut: l.LBTC,
|
|
407
|
+
sourceChains: Mt,
|
|
408
|
+
destChains: kt,
|
|
409
|
+
envs: [o.prod]
|
|
410
|
+
},
|
|
411
|
+
// Testnet
|
|
412
|
+
{
|
|
413
|
+
assetsIn: [l.BTCb],
|
|
414
|
+
assetOut: l.LBTC,
|
|
415
|
+
sourceChains: Ht,
|
|
416
|
+
destChains: Ft,
|
|
417
|
+
envs: [o.testnet, o.stage, o.dev, o.ibc]
|
|
418
|
+
}
|
|
419
|
+
],
|
|
420
|
+
addressSchema: rt
|
|
421
|
+
};
|
|
422
|
+
var f = /* @__PURE__ */ ((r) => (r.IDLE = "idle", r.NEEDS_APPROVAL = "needs-approval", r.READY = "ready", r.BRIDGING = "bridging", r.COMPLETED = "completed", r))(f || {});
|
|
423
|
+
class qt extends S {
|
|
424
|
+
constructor(t, e) {
|
|
425
|
+
super(f.IDLE);
|
|
426
|
+
p(this, "_amount");
|
|
427
|
+
p(this, "_recipient");
|
|
428
|
+
p(this, "_needsApproval", !1);
|
|
429
|
+
p(this, "_txHash");
|
|
430
|
+
p(this, "_claimData");
|
|
431
|
+
this.ctx = t, this.params = e;
|
|
432
|
+
}
|
|
433
|
+
get amount() {
|
|
434
|
+
return this._amount;
|
|
435
|
+
}
|
|
436
|
+
get recipient() {
|
|
437
|
+
return this._recipient;
|
|
438
|
+
}
|
|
439
|
+
get needsApproval() {
|
|
440
|
+
return this._needsApproval;
|
|
441
|
+
}
|
|
442
|
+
get txHash() {
|
|
443
|
+
return this._txHash;
|
|
444
|
+
}
|
|
445
|
+
setClaimData(t, e) {
|
|
446
|
+
this._claimData = { data: t, proofSignature: e };
|
|
447
|
+
}
|
|
448
|
+
async prepare(t) {
|
|
449
|
+
return this.assertStatus(f.IDLE, "prepare"), this.act(async () => {
|
|
450
|
+
const e = L(this.prepareSchema, t, {
|
|
451
|
+
destChain: this.params.destChain
|
|
452
|
+
});
|
|
453
|
+
this._amount = e.amount, this._recipient = e.recipient, this._needsApproval = !1, this.emitProgress({
|
|
454
|
+
status: f.READY,
|
|
455
|
+
steps: {
|
|
456
|
+
approval: i.COMPLETE,
|
|
457
|
+
execution: i.IDLE,
|
|
458
|
+
bridging: i.IDLE
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}, f.READY);
|
|
462
|
+
}
|
|
463
|
+
async approve() {
|
|
464
|
+
return this.assertStatus(f.NEEDS_APPROVAL, "approve"), this.act(async () => {
|
|
465
|
+
this._needsApproval = !1;
|
|
466
|
+
}, f.READY);
|
|
467
|
+
}
|
|
468
|
+
async execute() {
|
|
469
|
+
if (this.assertStatus(f.READY, "execute"), !this._claimData)
|
|
470
|
+
throw h.missingParameter("claimData");
|
|
471
|
+
return this.act(async () => {
|
|
472
|
+
const t = await this.ctx.getProvider("evm");
|
|
473
|
+
if (!t)
|
|
474
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
475
|
+
const e = A(this.params.destChain);
|
|
476
|
+
this.emitProgress({
|
|
477
|
+
status: f.READY,
|
|
478
|
+
steps: {
|
|
479
|
+
approval: i.COMPLETE,
|
|
480
|
+
execution: i.PENDING,
|
|
481
|
+
bridging: i.IDLE
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
const n = await Ct({
|
|
485
|
+
provider: t,
|
|
486
|
+
account: this._recipient,
|
|
487
|
+
data: this._claimData.data,
|
|
488
|
+
proofSignature: this._claimData.proofSignature,
|
|
489
|
+
chainId: e,
|
|
490
|
+
env: this.ctx.env
|
|
491
|
+
});
|
|
492
|
+
return this._txHash = n, this.emitProgress({
|
|
493
|
+
status: f.COMPLETED,
|
|
494
|
+
steps: {
|
|
495
|
+
approval: i.COMPLETE,
|
|
496
|
+
execution: i.COMPLETE,
|
|
497
|
+
bridging: i.IDLE
|
|
498
|
+
}
|
|
499
|
+
}), this.emitCompleted(), { txHash: n };
|
|
500
|
+
}, f.COMPLETED);
|
|
501
|
+
}
|
|
502
|
+
get prepareSchema() {
|
|
503
|
+
return N({
|
|
504
|
+
amount: O,
|
|
505
|
+
recipient: Yt.addressSchema
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function Vt(r, a) {
|
|
510
|
+
return new qt(r, a);
|
|
511
|
+
}
|
|
512
|
+
const Gt = P(l.BTCb, [o.prod]), $t = P(l.BTCb, [
|
|
513
|
+
o.testnet,
|
|
514
|
+
o.stage,
|
|
515
|
+
o.dev,
|
|
516
|
+
o.ibc
|
|
517
|
+
]), Ut = {
|
|
518
|
+
routes: [
|
|
519
|
+
// BTC.b → BTC (to Bitcoin Mainnet)
|
|
520
|
+
{
|
|
521
|
+
assetIn: l.BTCb,
|
|
522
|
+
assetOut: l.BTC,
|
|
523
|
+
sourceChains: Gt,
|
|
524
|
+
destChain: I.BITCOIN_MAINNET,
|
|
525
|
+
envs: [o.prod]
|
|
526
|
+
},
|
|
527
|
+
// BTC.b → BTC (to Bitcoin Signet - testnet)
|
|
528
|
+
{
|
|
529
|
+
assetIn: l.BTCb,
|
|
530
|
+
assetOut: l.BTC,
|
|
531
|
+
sourceChains: $t,
|
|
532
|
+
destChain: I.BITCOIN_SIGNET,
|
|
533
|
+
envs: [o.testnet, o.stage, o.dev, o.ibc]
|
|
534
|
+
}
|
|
535
|
+
// TODO: Add L-Asset routes when deployed
|
|
536
|
+
// L-ZEC → ZEC, L-SOL → SOL, L-XRP → XRP, L-DOGE → DOGE
|
|
537
|
+
],
|
|
538
|
+
recipientSchema: ot
|
|
539
|
+
};
|
|
540
|
+
async function K(r, a, t, e) {
|
|
541
|
+
if (!Nt(r))
|
|
542
|
+
return {
|
|
543
|
+
requiresAuth: !1,
|
|
544
|
+
hasValidSignature: !1,
|
|
545
|
+
feeInSatoshis: null,
|
|
546
|
+
feeFormatted: null,
|
|
547
|
+
expirationDate: null
|
|
548
|
+
};
|
|
549
|
+
const n = await W(e, r, t), m = await xt({
|
|
550
|
+
address: a,
|
|
551
|
+
chainId: r,
|
|
552
|
+
env: t,
|
|
553
|
+
tokenAddress: n.address
|
|
554
|
+
}), u = m.expirationDate ? new Date(Number(m.expirationDate) * 1e3) < /* @__PURE__ */ new Date() : !1, d = m.hasSignature && !u;
|
|
555
|
+
let c = null, E = null;
|
|
556
|
+
if (!d) {
|
|
557
|
+
const _ = await at({
|
|
558
|
+
token: e,
|
|
559
|
+
chainId: r,
|
|
560
|
+
env: t
|
|
561
|
+
});
|
|
562
|
+
c = BigInt(_.times(1e8).toFixed(0)), E = _.toFixed(8);
|
|
563
|
+
}
|
|
564
|
+
return {
|
|
565
|
+
requiresAuth: !0,
|
|
566
|
+
hasValidSignature: d,
|
|
567
|
+
feeInSatoshis: c,
|
|
568
|
+
feeFormatted: E,
|
|
569
|
+
expirationDate: m.expirationDate ?? null
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
async function Q(r) {
|
|
573
|
+
const { chainId: a, account: t, feeInSatoshis: e, provider: n, env: m, token: u } = r, d = await W(u, a, m), c = await it({
|
|
574
|
+
fee: e,
|
|
575
|
+
account: t,
|
|
576
|
+
chainId: a,
|
|
577
|
+
provider: n,
|
|
578
|
+
env: m,
|
|
579
|
+
token: u
|
|
580
|
+
});
|
|
581
|
+
return await Lt({
|
|
582
|
+
signature: c.signature,
|
|
583
|
+
typedData: c.typedData,
|
|
584
|
+
address: t,
|
|
585
|
+
env: m,
|
|
586
|
+
tokenAddress: d.address
|
|
587
|
+
}), c;
|
|
588
|
+
}
|
|
589
|
+
function J() {
|
|
590
|
+
return {
|
|
591
|
+
requiresAuth: !1,
|
|
592
|
+
isAuthorized: !1,
|
|
593
|
+
feeInSatoshis: null,
|
|
594
|
+
feeFormatted: null,
|
|
595
|
+
expirationDate: null
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
class zt extends S {
|
|
599
|
+
constructor(t, e) {
|
|
600
|
+
super(s.IDLE);
|
|
601
|
+
p(this, "_amount");
|
|
602
|
+
p(this, "_recipient");
|
|
603
|
+
p(this, "_needsApproval", !1);
|
|
604
|
+
p(this, "_txHash");
|
|
605
|
+
p(this, "_feeAuth", J());
|
|
606
|
+
this.ctx = t, this.params = e;
|
|
607
|
+
}
|
|
608
|
+
get amount() {
|
|
609
|
+
return this._amount;
|
|
610
|
+
}
|
|
611
|
+
get recipient() {
|
|
612
|
+
return this._recipient;
|
|
613
|
+
}
|
|
614
|
+
get needsApproval() {
|
|
615
|
+
return this._needsApproval;
|
|
616
|
+
}
|
|
617
|
+
get txHash() {
|
|
618
|
+
return this._txHash;
|
|
619
|
+
}
|
|
620
|
+
/** Fee authorization state (for UI display) */
|
|
621
|
+
get feeAuth() {
|
|
622
|
+
return this._feeAuth;
|
|
623
|
+
}
|
|
624
|
+
async prepare(t) {
|
|
625
|
+
return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
|
|
626
|
+
const e = L(this.prepareSchema, t, {
|
|
627
|
+
destChain: this.params.destChain
|
|
628
|
+
});
|
|
629
|
+
this._amount = e.amount, this._recipient = e.recipient;
|
|
630
|
+
const n = A(this.params.sourceChain), m = await this.ctx.getProvider("evm");
|
|
631
|
+
if (!m)
|
|
632
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
633
|
+
const d = (await m.request({
|
|
634
|
+
method: "eth_accounts"
|
|
635
|
+
}))[0], c = await K(
|
|
636
|
+
n,
|
|
637
|
+
d,
|
|
638
|
+
this.ctx.env,
|
|
639
|
+
v.BTCb
|
|
640
|
+
);
|
|
641
|
+
if (this._feeAuth = {
|
|
642
|
+
requiresAuth: c.requiresAuth,
|
|
643
|
+
isAuthorized: c.hasValidSignature,
|
|
644
|
+
feeInSatoshis: c.feeInSatoshis,
|
|
645
|
+
feeFormatted: c.feeFormatted,
|
|
646
|
+
expirationDate: c.expirationDate
|
|
647
|
+
}, c.requiresAuth && !c.hasValidSignature) {
|
|
648
|
+
this.updateStatus(s.NEEDS_FEE_AUTHORIZATION), this.emitProgress({
|
|
649
|
+
status: s.NEEDS_FEE_AUTHORIZATION,
|
|
650
|
+
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
651
|
+
});
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
this._needsApproval = !1, this.updateStatus(s.READY), this.emitProgress({
|
|
655
|
+
status: s.READY,
|
|
656
|
+
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
657
|
+
});
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Authorize the network fee
|
|
662
|
+
*
|
|
663
|
+
* Must be called when status is NEEDS_FEE_AUTHORIZATION.
|
|
664
|
+
* Signs the fee authorization and stores it on the server.
|
|
665
|
+
*/
|
|
666
|
+
async authorizeFee() {
|
|
667
|
+
if (this.assertStatus(
|
|
668
|
+
s.NEEDS_FEE_AUTHORIZATION,
|
|
669
|
+
"authorizeFee"
|
|
670
|
+
), !this._feeAuth.feeInSatoshis)
|
|
671
|
+
throw h.missingParameter("feeInSatoshis");
|
|
672
|
+
return this.act(async () => {
|
|
673
|
+
const t = A(this.params.sourceChain), e = await this.ctx.getProvider("evm");
|
|
674
|
+
if (!e)
|
|
675
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
676
|
+
const m = (await e.request({
|
|
677
|
+
method: "eth_accounts"
|
|
678
|
+
}))[0];
|
|
679
|
+
await Q({
|
|
680
|
+
chainId: t,
|
|
681
|
+
account: m,
|
|
682
|
+
feeInSatoshis: this._feeAuth.feeInSatoshis,
|
|
683
|
+
provider: e,
|
|
684
|
+
env: this.ctx.env,
|
|
685
|
+
token: v.BTCb
|
|
686
|
+
}), this._feeAuth.isAuthorized = !0, this.emitProgress({
|
|
687
|
+
status: s.READY,
|
|
688
|
+
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
689
|
+
});
|
|
690
|
+
}, s.READY);
|
|
691
|
+
}
|
|
692
|
+
async approve() {
|
|
693
|
+
return this.assertStatus(s.NEEDS_APPROVAL, "approve"), this.act(async () => {
|
|
694
|
+
this._needsApproval = !1, this.emitProgress({
|
|
695
|
+
status: s.READY,
|
|
696
|
+
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
697
|
+
});
|
|
698
|
+
}, s.READY);
|
|
699
|
+
}
|
|
700
|
+
async execute() {
|
|
701
|
+
return this.assertStatus(s.READY, "execute"), this.act(async () => {
|
|
702
|
+
const t = await this.ctx.getProvider("evm");
|
|
703
|
+
if (!t)
|
|
704
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
705
|
+
const n = (await t.request({
|
|
706
|
+
method: "eth_accounts"
|
|
707
|
+
}))[0];
|
|
708
|
+
if (!n)
|
|
709
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
710
|
+
const m = A(this.params.sourceChain);
|
|
711
|
+
this.emitProgress({
|
|
712
|
+
status: s.READY,
|
|
713
|
+
steps: { burning: i.PENDING, releasing: i.IDLE }
|
|
714
|
+
});
|
|
715
|
+
const u = await nt({
|
|
716
|
+
provider: t,
|
|
717
|
+
account: n,
|
|
718
|
+
amount: this._amount,
|
|
719
|
+
btcAddress: this._recipient,
|
|
720
|
+
// Bitcoin address to receive BTC
|
|
721
|
+
chainId: m,
|
|
722
|
+
env: this.ctx.env,
|
|
723
|
+
tokenIn: v.BTCb,
|
|
724
|
+
tokenOut: void 0
|
|
725
|
+
// Native BTC output
|
|
726
|
+
});
|
|
727
|
+
return this._txHash = u, this.emitProgress({
|
|
728
|
+
status: s.COMPLETED,
|
|
729
|
+
steps: { burning: i.COMPLETE, releasing: i.PENDING }
|
|
730
|
+
}), this.emitCompleted(), { txHash: u };
|
|
731
|
+
}, s.COMPLETED);
|
|
732
|
+
}
|
|
733
|
+
get prepareSchema() {
|
|
734
|
+
return N({
|
|
735
|
+
amount: O,
|
|
736
|
+
recipient: Ut.recipientSchema
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
function Wt(r, a) {
|
|
741
|
+
return new zt(r, a);
|
|
742
|
+
}
|
|
743
|
+
const Zt = [
|
|
744
|
+
et.avalanche,
|
|
745
|
+
et.avalancheFuji
|
|
746
|
+
];
|
|
747
|
+
function jt(r) {
|
|
748
|
+
return Zt.includes(r);
|
|
749
|
+
}
|
|
750
|
+
class Kt extends S {
|
|
751
|
+
constructor(t, e) {
|
|
752
|
+
super(s.IDLE);
|
|
753
|
+
p(this, "_amount");
|
|
754
|
+
p(this, "_txHash");
|
|
755
|
+
p(this, "_feeAuth", J());
|
|
756
|
+
p(this, "_account");
|
|
757
|
+
p(this, "_needsApproval", !1);
|
|
758
|
+
p(this, "_spenderAddress");
|
|
759
|
+
this.ctx = t, this.params = e;
|
|
760
|
+
}
|
|
761
|
+
get amount() {
|
|
762
|
+
return this._amount;
|
|
763
|
+
}
|
|
764
|
+
get txHash() {
|
|
765
|
+
return this._txHash;
|
|
766
|
+
}
|
|
767
|
+
/** Fee authorization state (for UI display) */
|
|
768
|
+
get feeAuth() {
|
|
769
|
+
return this._feeAuth;
|
|
770
|
+
}
|
|
771
|
+
/** Whether approval is needed */
|
|
772
|
+
get needsApproval() {
|
|
773
|
+
return this._needsApproval;
|
|
774
|
+
}
|
|
775
|
+
async prepare(t) {
|
|
776
|
+
return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
|
|
777
|
+
const e = L(this.prepareSchema, t);
|
|
778
|
+
this._amount = e.amount;
|
|
779
|
+
const n = await this.ctx.getProvider("evm");
|
|
780
|
+
if (!n)
|
|
781
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
782
|
+
const u = (await n.request({
|
|
783
|
+
method: "eth_accounts"
|
|
784
|
+
}))[0];
|
|
785
|
+
if (!u)
|
|
786
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
787
|
+
this._account = u;
|
|
788
|
+
const d = A(this.params.sourceChain);
|
|
789
|
+
if (jt(d)) {
|
|
790
|
+
const _ = await W(
|
|
791
|
+
v.BTCb,
|
|
792
|
+
d,
|
|
793
|
+
this.ctx.env,
|
|
794
|
+
Dt.Adapter
|
|
795
|
+
);
|
|
796
|
+
this._spenderAddress = _.address;
|
|
797
|
+
const C = await _t({
|
|
798
|
+
token: v.BTCb,
|
|
799
|
+
owner: u,
|
|
800
|
+
spender: _.address,
|
|
801
|
+
chainId: d,
|
|
802
|
+
env: this.ctx.env
|
|
803
|
+
}), g = new D(e.amount);
|
|
804
|
+
if (this._needsApproval = C.isLessThan(g), this._needsApproval) {
|
|
805
|
+
this.emitProgress({
|
|
806
|
+
status: s.NEEDS_APPROVAL,
|
|
807
|
+
steps: { approval: i.PENDING, staking: i.IDLE }
|
|
808
|
+
}), this.updateStatus(s.NEEDS_APPROVAL);
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
const c = await K(
|
|
813
|
+
d,
|
|
814
|
+
u,
|
|
815
|
+
this.ctx.env,
|
|
816
|
+
v.LBTC
|
|
817
|
+
);
|
|
818
|
+
this._feeAuth = {
|
|
819
|
+
requiresAuth: c.requiresAuth,
|
|
820
|
+
isAuthorized: c.hasValidSignature,
|
|
821
|
+
feeInSatoshis: c.feeInSatoshis,
|
|
822
|
+
feeFormatted: c.feeFormatted,
|
|
823
|
+
expirationDate: c.expirationDate
|
|
824
|
+
}, c.requiresAuth && !c.hasValidSignature ? (this.emitProgress({
|
|
825
|
+
status: s.NEEDS_FEE_AUTHORIZATION,
|
|
826
|
+
steps: { staking: i.IDLE }
|
|
827
|
+
}), this.updateStatus(s.NEEDS_FEE_AUTHORIZATION)) : (this.emitProgress({
|
|
828
|
+
status: s.READY,
|
|
829
|
+
steps: { staking: i.PENDING }
|
|
830
|
+
}), this.updateStatus(s.READY));
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Approve BTC.b spending (Avalanche only)
|
|
835
|
+
*
|
|
836
|
+
* Must be called when status is NEEDS_APPROVAL.
|
|
837
|
+
*/
|
|
838
|
+
async approve() {
|
|
839
|
+
return this.assertStatus(s.NEEDS_APPROVAL, "approve"), this.act(async () => {
|
|
840
|
+
if (!this._account || !this._spenderAddress || !this._amount)
|
|
841
|
+
throw h.missingParameter(
|
|
842
|
+
"account, spenderAddress, or amount"
|
|
843
|
+
);
|
|
844
|
+
const t = await this.ctx.getProvider("evm");
|
|
845
|
+
if (!t)
|
|
846
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
847
|
+
const e = A(this.params.sourceChain), n = await gt({
|
|
848
|
+
account: this._account,
|
|
849
|
+
token: v.BTCb,
|
|
850
|
+
spender: this._spenderAddress,
|
|
851
|
+
amount: this._amount,
|
|
852
|
+
chainId: e,
|
|
853
|
+
provider: t,
|
|
854
|
+
env: this.ctx.env
|
|
855
|
+
}), m = x({ chainId: e, env: this.ctx.env });
|
|
856
|
+
await U(m, n, "BTC.b approval"), this._needsApproval = !1, this.emitProgress({
|
|
857
|
+
status: s.READY,
|
|
858
|
+
steps: { approval: i.COMPLETE, staking: i.PENDING }
|
|
859
|
+
});
|
|
860
|
+
}, s.READY);
|
|
861
|
+
}
|
|
862
|
+
async authorizeFee() {
|
|
863
|
+
return this.assertStatus(
|
|
864
|
+
s.NEEDS_FEE_AUTHORIZATION,
|
|
865
|
+
"authorizeFee"
|
|
866
|
+
), this.act(async () => {
|
|
867
|
+
if (!this._feeAuth.feeInSatoshis)
|
|
868
|
+
throw h.missingParameter("feeInSatoshis");
|
|
869
|
+
const t = await this.ctx.getProvider("evm");
|
|
870
|
+
if (!t)
|
|
871
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
872
|
+
const e = A(this.params.sourceChain);
|
|
873
|
+
await Q({
|
|
874
|
+
chainId: e,
|
|
875
|
+
account: this._account,
|
|
876
|
+
feeInSatoshis: this._feeAuth.feeInSatoshis,
|
|
877
|
+
provider: t,
|
|
878
|
+
env: this.ctx.env,
|
|
879
|
+
token: v.LBTC
|
|
880
|
+
// BTC.b → LBTC uses LBTC token for fee signature
|
|
881
|
+
}), this._feeAuth = {
|
|
882
|
+
...this._feeAuth,
|
|
883
|
+
isAuthorized: !0
|
|
884
|
+
}, this.emitProgress({
|
|
885
|
+
status: s.READY,
|
|
886
|
+
steps: { staking: i.PENDING }
|
|
887
|
+
});
|
|
888
|
+
}, s.READY);
|
|
889
|
+
}
|
|
890
|
+
async execute() {
|
|
891
|
+
return this.assertStatus(s.READY, "execute"), this.act(async () => {
|
|
892
|
+
const t = await this.ctx.getProvider("evm");
|
|
893
|
+
if (!t)
|
|
894
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
895
|
+
const e = A(this.params.sourceChain), m = (await t.request({
|
|
896
|
+
method: "eth_accounts"
|
|
897
|
+
}))[0];
|
|
898
|
+
if (!m)
|
|
899
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
900
|
+
this.emitProgress({
|
|
901
|
+
status: s.READY,
|
|
902
|
+
steps: { staking: i.PENDING }
|
|
903
|
+
});
|
|
904
|
+
const u = await At({
|
|
905
|
+
amount: this._amount,
|
|
906
|
+
tokenIn: v.BTCb,
|
|
907
|
+
tokenOut: v.LBTC,
|
|
908
|
+
account: m,
|
|
909
|
+
chainId: e,
|
|
910
|
+
provider: t,
|
|
911
|
+
env: this.ctx.env
|
|
912
|
+
});
|
|
913
|
+
return this._txHash = u, this.emitProgress({
|
|
914
|
+
status: s.COMPLETED,
|
|
915
|
+
steps: { staking: i.COMPLETE }
|
|
916
|
+
}), this.emitCompleted(), { txHash: u };
|
|
917
|
+
}, s.COMPLETED);
|
|
918
|
+
}
|
|
919
|
+
get prepareSchema() {
|
|
920
|
+
return N({
|
|
921
|
+
amount: O
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
function Qt(r, a) {
|
|
926
|
+
return new Kt(r, a);
|
|
927
|
+
}
|
|
928
|
+
const Jt = P(l.LBTC, [o.prod]), Xt = P(l.LBTC, [
|
|
929
|
+
o.testnet,
|
|
930
|
+
o.stage,
|
|
931
|
+
o.dev,
|
|
932
|
+
o.ibc
|
|
933
|
+
]), te = ct(
|
|
934
|
+
[l.LBTC, l.BTCb],
|
|
935
|
+
[o.prod]
|
|
936
|
+
), ee = ct(
|
|
937
|
+
[l.LBTC, l.BTCb],
|
|
938
|
+
[o.testnet, o.stage, o.dev, o.ibc]
|
|
939
|
+
), se = {
|
|
940
|
+
routes: [
|
|
941
|
+
// Production: EVM chains with LBTC → Bitcoin Mainnet
|
|
942
|
+
{
|
|
943
|
+
sourceChains: Jt,
|
|
944
|
+
destChain: I.BITCOIN_MAINNET,
|
|
945
|
+
envs: [o.prod]
|
|
946
|
+
},
|
|
947
|
+
// Testnet: EVM chains with LBTC → Bitcoin Signet
|
|
948
|
+
{
|
|
949
|
+
sourceChains: Xt,
|
|
950
|
+
destChain: I.BITCOIN_SIGNET,
|
|
951
|
+
envs: [o.testnet, o.stage, o.dev, o.ibc]
|
|
952
|
+
}
|
|
953
|
+
],
|
|
954
|
+
recipientSchema: ot
|
|
955
|
+
}, ae = {
|
|
956
|
+
routes: [
|
|
957
|
+
// Production: Same-chain routes for chains with both LBTC and BTCb
|
|
958
|
+
...te.map((r) => ({
|
|
959
|
+
sourceChains: [r],
|
|
960
|
+
destChain: r,
|
|
961
|
+
envs: [o.prod]
|
|
962
|
+
})),
|
|
963
|
+
// Testnet: Same-chain routes
|
|
964
|
+
...ee.map((r) => ({
|
|
965
|
+
sourceChains: [r],
|
|
966
|
+
destChain: r,
|
|
967
|
+
envs: [o.testnet, o.stage, o.dev, o.ibc]
|
|
968
|
+
}))
|
|
969
|
+
],
|
|
970
|
+
recipientSchema: rt
|
|
971
|
+
};
|
|
972
|
+
class ie extends S {
|
|
973
|
+
constructor(t, e) {
|
|
974
|
+
super(s.IDLE);
|
|
975
|
+
p(this, "_amount");
|
|
976
|
+
p(this, "_recipient");
|
|
977
|
+
p(this, "_txHash");
|
|
978
|
+
p(this, "_feeAuth", J());
|
|
979
|
+
this.ctx = t, this.params = e;
|
|
980
|
+
}
|
|
981
|
+
get amount() {
|
|
982
|
+
return this._amount;
|
|
983
|
+
}
|
|
984
|
+
get recipient() {
|
|
985
|
+
return this._recipient;
|
|
986
|
+
}
|
|
987
|
+
get txHash() {
|
|
988
|
+
return this._txHash;
|
|
989
|
+
}
|
|
990
|
+
/** Fee authorization state (for UI display) */
|
|
991
|
+
get feeAuth() {
|
|
992
|
+
return this._feeAuth;
|
|
993
|
+
}
|
|
994
|
+
/** Whether output is BTC.b (requires fee auth on unsubsidized chains) */
|
|
995
|
+
get isBtcbOutput() {
|
|
996
|
+
return this.params.assetOut === l.BTCb;
|
|
997
|
+
}
|
|
998
|
+
async prepare(t) {
|
|
999
|
+
return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
|
|
1000
|
+
const e = L(this.prepareSchema, t, {
|
|
1001
|
+
destChain: this.params.destChain
|
|
1002
|
+
});
|
|
1003
|
+
this._amount = e.amount, this._recipient = e.recipient;
|
|
1004
|
+
const n = A(this.params.sourceChain);
|
|
1005
|
+
if (this.isBtcbOutput) {
|
|
1006
|
+
const m = await this.ctx.getProvider("evm");
|
|
1007
|
+
if (!m)
|
|
1008
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
1009
|
+
const d = (await m.request({
|
|
1010
|
+
method: "eth_accounts"
|
|
1011
|
+
}))[0], c = await K(
|
|
1012
|
+
n,
|
|
1013
|
+
d,
|
|
1014
|
+
this.ctx.env,
|
|
1015
|
+
v.BTCb
|
|
1016
|
+
);
|
|
1017
|
+
if (this._feeAuth = {
|
|
1018
|
+
requiresAuth: c.requiresAuth,
|
|
1019
|
+
isAuthorized: c.hasValidSignature,
|
|
1020
|
+
feeInSatoshis: c.feeInSatoshis,
|
|
1021
|
+
feeFormatted: c.feeFormatted,
|
|
1022
|
+
expirationDate: c.expirationDate
|
|
1023
|
+
}, c.requiresAuth && !c.hasValidSignature) {
|
|
1024
|
+
this.updateStatus(s.NEEDS_FEE_AUTHORIZATION), this.emitProgress({
|
|
1025
|
+
status: s.NEEDS_FEE_AUTHORIZATION,
|
|
1026
|
+
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
1027
|
+
});
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
this.updateStatus(s.READY), this.emitProgress({
|
|
1032
|
+
status: s.READY,
|
|
1033
|
+
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
1034
|
+
});
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Authorize the network fee
|
|
1039
|
+
*
|
|
1040
|
+
* Must be called when status is NEEDS_FEE_AUTHORIZATION.
|
|
1041
|
+
* Signs the fee authorization and stores it on the server.
|
|
1042
|
+
*/
|
|
1043
|
+
async authorizeFee() {
|
|
1044
|
+
if (this.assertStatus(
|
|
1045
|
+
s.NEEDS_FEE_AUTHORIZATION,
|
|
1046
|
+
"authorizeFee"
|
|
1047
|
+
), !this._feeAuth.feeInSatoshis)
|
|
1048
|
+
throw h.missingParameter("feeInSatoshis");
|
|
1049
|
+
return this.act(async () => {
|
|
1050
|
+
const t = A(this.params.sourceChain), e = await this.ctx.getProvider("evm");
|
|
1051
|
+
if (!e)
|
|
1052
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
1053
|
+
const m = (await e.request({
|
|
1054
|
+
method: "eth_accounts"
|
|
1055
|
+
}))[0];
|
|
1056
|
+
await Q({
|
|
1057
|
+
chainId: t,
|
|
1058
|
+
account: m,
|
|
1059
|
+
feeInSatoshis: this._feeAuth.feeInSatoshis,
|
|
1060
|
+
provider: e,
|
|
1061
|
+
env: this.ctx.env,
|
|
1062
|
+
token: v.BTCb
|
|
1063
|
+
}), this._feeAuth.isAuthorized = !0, this.emitProgress({
|
|
1064
|
+
status: s.READY,
|
|
1065
|
+
steps: { burning: i.IDLE, releasing: i.IDLE }
|
|
1066
|
+
});
|
|
1067
|
+
}, s.READY);
|
|
1068
|
+
}
|
|
1069
|
+
async execute() {
|
|
1070
|
+
return this.assertStatus(s.READY, "execute"), this.act(async () => {
|
|
1071
|
+
const t = await this.ctx.getProvider("evm");
|
|
1072
|
+
if (!t)
|
|
1073
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
1074
|
+
const n = (await t.request({
|
|
1075
|
+
method: "eth_accounts"
|
|
1076
|
+
}))[0];
|
|
1077
|
+
if (!n)
|
|
1078
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
1079
|
+
const m = A(this.params.sourceChain), u = this.params.assetOut === l.BTCb;
|
|
1080
|
+
this.emitProgress({
|
|
1081
|
+
status: s.READY,
|
|
1082
|
+
steps: { burning: i.PENDING, releasing: i.IDLE }
|
|
1083
|
+
});
|
|
1084
|
+
const d = await nt({
|
|
1085
|
+
provider: t,
|
|
1086
|
+
account: u ? this._recipient : n,
|
|
1087
|
+
amount: this._amount,
|
|
1088
|
+
btcAddress: u ? void 0 : this._recipient,
|
|
1089
|
+
chainId: m,
|
|
1090
|
+
env: this.ctx.env,
|
|
1091
|
+
tokenIn: v.LBTC,
|
|
1092
|
+
tokenOut: u ? v.BTCb : void 0
|
|
1093
|
+
});
|
|
1094
|
+
return this._txHash = d, this.emitProgress({
|
|
1095
|
+
status: s.COMPLETED,
|
|
1096
|
+
steps: {
|
|
1097
|
+
burning: i.COMPLETE,
|
|
1098
|
+
releasing: u ? i.COMPLETE : i.PENDING
|
|
1099
|
+
}
|
|
1100
|
+
}), this.emitCompleted(), { txHash: d };
|
|
1101
|
+
}, s.COMPLETED);
|
|
1102
|
+
}
|
|
1103
|
+
get prepareSchema() {
|
|
1104
|
+
const t = this.params.assetOut === l.BTC ? se : ae;
|
|
1105
|
+
return N({
|
|
1106
|
+
amount: O,
|
|
1107
|
+
recipient: t.recipientSchema
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
function ne(r, a) {
|
|
1112
|
+
return new ie(r, a);
|
|
1113
|
+
}
|
|
1114
|
+
const ht = {
|
|
1115
|
+
routes: [
|
|
1116
|
+
// Veda - Ethereum, Base, BSC, Corn
|
|
1117
|
+
{
|
|
1118
|
+
sourceChains: [I.ETHEREUM, I.BASE, I.BSC, I.CORN],
|
|
1119
|
+
protocols: [T.Veda],
|
|
1120
|
+
envs: [o.prod]
|
|
1121
|
+
}
|
|
1122
|
+
]
|
|
1123
|
+
};
|
|
1124
|
+
class re extends S {
|
|
1125
|
+
constructor(t, e) {
|
|
1126
|
+
super(s.IDLE);
|
|
1127
|
+
p(this, "_txHash");
|
|
1128
|
+
p(this, "_account");
|
|
1129
|
+
p(this, "_chainId");
|
|
1130
|
+
this.ctx = t, this.params = e;
|
|
1131
|
+
}
|
|
1132
|
+
get txHash() {
|
|
1133
|
+
return this._txHash;
|
|
1134
|
+
}
|
|
1135
|
+
async prepare() {
|
|
1136
|
+
return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
|
|
1137
|
+
this.validateProtocol(this.params.protocol);
|
|
1138
|
+
const t = await this.ctx.getProvider("evm");
|
|
1139
|
+
if (!t)
|
|
1140
|
+
throw h.providerMissing(this.params.chain, "evm");
|
|
1141
|
+
const n = (await t.request({
|
|
1142
|
+
method: "eth_accounts"
|
|
1143
|
+
}))[0];
|
|
1144
|
+
if (!n)
|
|
1145
|
+
throw h.providerMissing(this.params.chain, "evm");
|
|
1146
|
+
if (this._account = n, this._chainId = A(this.params.chain), !j(this._chainId))
|
|
1147
|
+
throw new h(
|
|
1148
|
+
V.PROTOCOL_NOT_SUPPORTED,
|
|
1149
|
+
`Chain ${this.params.chain} does not support Veda vault withdrawals`,
|
|
1150
|
+
{ chain: this.params.chain, protocol: this.params.protocol }
|
|
1151
|
+
);
|
|
1152
|
+
this.emitProgress({
|
|
1153
|
+
status: s.READY,
|
|
1154
|
+
steps: { cancelling: i.PENDING }
|
|
1155
|
+
}), this.updateStatus(s.READY);
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
async execute() {
|
|
1159
|
+
return this.assertStatus(s.READY, "execute"), this.act(async () => {
|
|
1160
|
+
const t = await this.ctx.getProvider("evm");
|
|
1161
|
+
if (!t)
|
|
1162
|
+
throw h.providerMissing(this.params.chain, "evm");
|
|
1163
|
+
if (!this._account || !this._chainId)
|
|
1164
|
+
throw h.missingParameter("account or chainId");
|
|
1165
|
+
this.emitProgress({
|
|
1166
|
+
status: s.READY,
|
|
1167
|
+
steps: { cancelling: i.PENDING }
|
|
1168
|
+
});
|
|
1169
|
+
const e = await It({
|
|
1170
|
+
account: this._account,
|
|
1171
|
+
chainId: this._chainId,
|
|
1172
|
+
provider: t,
|
|
1173
|
+
env: this.ctx.env
|
|
1174
|
+
});
|
|
1175
|
+
return this._txHash = e, this.emitProgress({
|
|
1176
|
+
status: s.COMPLETED,
|
|
1177
|
+
steps: { cancelling: i.COMPLETE }
|
|
1178
|
+
}), this.emitCompleted(), { txHash: e };
|
|
1179
|
+
}, s.COMPLETED);
|
|
1180
|
+
}
|
|
1181
|
+
validateProtocol(t) {
|
|
1182
|
+
if (!ht.routes.some(
|
|
1183
|
+
(n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
|
|
1184
|
+
))
|
|
1185
|
+
throw h.invalidParameter(
|
|
1186
|
+
"protocol",
|
|
1187
|
+
`Protocol ${t} is not supported for withdrawals in ${this.ctx.env} environment`
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
class oe extends S {
|
|
1192
|
+
constructor(t, e) {
|
|
1193
|
+
super(s.IDLE);
|
|
1194
|
+
p(this, "_amount");
|
|
1195
|
+
p(this, "_protocol");
|
|
1196
|
+
p(this, "_needsApproval", !1);
|
|
1197
|
+
p(this, "_txHash");
|
|
1198
|
+
p(this, "_account");
|
|
1199
|
+
p(this, "_chainId");
|
|
1200
|
+
this.ctx = t, this.params = e;
|
|
1201
|
+
}
|
|
1202
|
+
get amount() {
|
|
1203
|
+
return this._amount;
|
|
1204
|
+
}
|
|
1205
|
+
get protocol() {
|
|
1206
|
+
return this._protocol;
|
|
1207
|
+
}
|
|
1208
|
+
get needsApproval() {
|
|
1209
|
+
return this._needsApproval;
|
|
1210
|
+
}
|
|
1211
|
+
get txHash() {
|
|
1212
|
+
return this._txHash;
|
|
1213
|
+
}
|
|
1214
|
+
async prepare(t) {
|
|
1215
|
+
return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
|
|
1216
|
+
const e = L(this.prepareSchema, t);
|
|
1217
|
+
this._amount = e.amount, this._protocol = this.params.protocol, this.validateProtocol(this.params.protocol);
|
|
1218
|
+
const n = await this.ctx.getProvider("evm");
|
|
1219
|
+
if (!n)
|
|
1220
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
1221
|
+
const u = (await n.request({
|
|
1222
|
+
method: "eth_accounts"
|
|
1223
|
+
}))[0];
|
|
1224
|
+
if (!u)
|
|
1225
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
1226
|
+
if (this._account = u, this._chainId = A(this.params.sourceChain), !j(this._chainId))
|
|
1227
|
+
throw new h(
|
|
1228
|
+
V.PROTOCOL_NOT_SUPPORTED,
|
|
1229
|
+
`Chain ${this.params.sourceChain} does not support Veda vault withdrawals`,
|
|
1230
|
+
{ chain: this.params.sourceChain, protocol: this._protocol }
|
|
1231
|
+
);
|
|
1232
|
+
const d = M, c = x({ chainId: this._chainId }), E = new D(e.amount), _ = await c.readContract({
|
|
1233
|
+
address: d.lensContract.address,
|
|
1234
|
+
abi: d.lensContract.abi,
|
|
1235
|
+
functionName: "balanceOf",
|
|
1236
|
+
args: [u, d.vaultContract.address]
|
|
1237
|
+
}), C = B(
|
|
1238
|
+
String(_),
|
|
1239
|
+
d.decimals
|
|
1240
|
+
);
|
|
1241
|
+
let g = C;
|
|
1242
|
+
if (G(this._chainId)) {
|
|
1243
|
+
const R = await c.readContract({
|
|
1244
|
+
address: $.contracts[this._chainId],
|
|
1245
|
+
abi: $.abi,
|
|
1246
|
+
functionName: "balanceOf",
|
|
1247
|
+
args: [u]
|
|
1248
|
+
}), k = B(
|
|
1249
|
+
String(R),
|
|
1250
|
+
d.decimals
|
|
1251
|
+
);
|
|
1252
|
+
g = C.plus(k);
|
|
1253
|
+
}
|
|
1254
|
+
if (E.isGreaterThan(g))
|
|
1255
|
+
throw new h(
|
|
1256
|
+
V.INSUFFICIENT_SHARES,
|
|
1257
|
+
`Insufficient vault shares. Requested: ${E.toFixed()}, Available: ${g.toFixed()}`,
|
|
1258
|
+
{ requested: E.toFixed(), available: g.toFixed() }
|
|
1259
|
+
);
|
|
1260
|
+
const w = await c.readContract({
|
|
1261
|
+
address: d.vaultContract.address,
|
|
1262
|
+
abi: d.vaultContract.abi,
|
|
1263
|
+
functionName: "allowance",
|
|
1264
|
+
args: [u, d.withdrawQueueContracts[this._chainId].address]
|
|
1265
|
+
}), H = B(
|
|
1266
|
+
String(w),
|
|
1267
|
+
d.decimals
|
|
1268
|
+
);
|
|
1269
|
+
this._needsApproval = E.isGreaterThan(H), this._needsApproval ? (this.emitProgress({
|
|
1270
|
+
status: s.NEEDS_APPROVAL,
|
|
1271
|
+
steps: { approval: i.PENDING, queueing: i.IDLE }
|
|
1272
|
+
}), this.updateStatus(s.NEEDS_APPROVAL)) : (this.emitProgress({
|
|
1273
|
+
status: s.READY,
|
|
1274
|
+
steps: {
|
|
1275
|
+
approval: i.COMPLETE,
|
|
1276
|
+
queueing: i.PENDING
|
|
1277
|
+
}
|
|
1278
|
+
}), this.updateStatus(s.READY));
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
async approve() {
|
|
1282
|
+
return this.assertStatus(s.NEEDS_APPROVAL, "approve"), this.act(async () => {
|
|
1283
|
+
if (!this._account || !this._chainId || !this._amount)
|
|
1284
|
+
throw h.missingParameter("account, chainId, or amount");
|
|
1285
|
+
const t = await this.ctx.getProvider("evm");
|
|
1286
|
+
if (!t)
|
|
1287
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
1288
|
+
const e = M, n = new D(this._amount), m = Z(y(n, e.decimals)), u = x({ chainId: this._chainId }), d = z({
|
|
1289
|
+
provider: t,
|
|
1290
|
+
chainId: this._chainId
|
|
1291
|
+
}), c = this._chainId, { request: E } = await u.simulateContract({
|
|
1292
|
+
account: this._account,
|
|
1293
|
+
chain: b[this._chainId],
|
|
1294
|
+
address: e.vaultContract.address,
|
|
1295
|
+
abi: e.vaultContract.abi,
|
|
1296
|
+
functionName: "approve",
|
|
1297
|
+
args: [e.withdrawQueueContracts[c].address, m]
|
|
1298
|
+
}), _ = await d.writeContract(E);
|
|
1299
|
+
await U(
|
|
1300
|
+
u,
|
|
1301
|
+
_,
|
|
1302
|
+
"vault share approval"
|
|
1303
|
+
), this._needsApproval = !1, this.emitProgress({
|
|
1304
|
+
status: s.READY,
|
|
1305
|
+
steps: { approval: i.COMPLETE, queueing: i.PENDING }
|
|
1306
|
+
});
|
|
1307
|
+
}, s.READY);
|
|
1308
|
+
}
|
|
1309
|
+
async execute() {
|
|
1310
|
+
return this.assertStatus(s.READY, "execute"), this.act(async () => {
|
|
1311
|
+
const t = await this.ctx.getProvider("evm");
|
|
1312
|
+
if (!t)
|
|
1313
|
+
throw h.providerMissing(this.params.sourceChain, "evm");
|
|
1314
|
+
if (!this._account || !this._chainId || !this._amount)
|
|
1315
|
+
throw h.missingParameter("account, chainId, or amount");
|
|
1316
|
+
this.emitProgress({
|
|
1317
|
+
status: s.READY,
|
|
1318
|
+
steps: { approval: i.COMPLETE, queueing: i.PENDING }
|
|
1319
|
+
});
|
|
1320
|
+
let e;
|
|
1321
|
+
return G(this._chainId) ? e = (await ft({
|
|
1322
|
+
amount: this._amount,
|
|
1323
|
+
account: this._account,
|
|
1324
|
+
chainId: this._chainId,
|
|
1325
|
+
provider: t,
|
|
1326
|
+
env: this.ctx.env
|
|
1327
|
+
})).queueTxHash : e = await wt({
|
|
1328
|
+
amount: this._amount,
|
|
1329
|
+
approve: !1,
|
|
1330
|
+
account: this._account,
|
|
1331
|
+
chainId: this._chainId,
|
|
1332
|
+
provider: t,
|
|
1333
|
+
env: this.ctx.env
|
|
1334
|
+
}), this._txHash = e, this.emitProgress({
|
|
1335
|
+
status: s.COMPLETED,
|
|
1336
|
+
steps: { approval: i.COMPLETE, queueing: i.COMPLETE }
|
|
1337
|
+
}), this.emitCompleted(), { txHash: e };
|
|
1338
|
+
}, s.COMPLETED);
|
|
1339
|
+
}
|
|
1340
|
+
get prepareSchema() {
|
|
1341
|
+
return N({
|
|
1342
|
+
amount: O
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
validateProtocol(t) {
|
|
1346
|
+
if (!ht.routes.some(
|
|
1347
|
+
(n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
|
|
1348
|
+
))
|
|
1349
|
+
throw h.invalidParameter(
|
|
1350
|
+
"protocol",
|
|
1351
|
+
`Protocol ${t} is not supported for withdrawals in ${this.ctx.env} environment`
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
function ce(r, a) {
|
|
1356
|
+
return new oe(r, a);
|
|
1357
|
+
}
|
|
1358
|
+
function he(r, a) {
|
|
1359
|
+
return new re(r, a);
|
|
1360
|
+
}
|
|
1361
|
+
class ue {
|
|
1362
|
+
constructor(a) {
|
|
1363
|
+
p(this, "ctx");
|
|
1364
|
+
this.ctx = St(a);
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Stake BTC.b to receive LBTC
|
|
1368
|
+
*
|
|
1369
|
+
* Converts wrapped BTC (BTC.b) to LBTC via the Asset Router.
|
|
1370
|
+
* Currently supported on Avalanche.
|
|
1371
|
+
*
|
|
1372
|
+
* @example
|
|
1373
|
+
* ```typescript
|
|
1374
|
+
* const stake = evm.stake({
|
|
1375
|
+
* assetIn: AssetId.BTCb,
|
|
1376
|
+
* assetOut: AssetId.LBTC,
|
|
1377
|
+
* sourceChain: Chain.AVALANCHE,
|
|
1378
|
+
* destChain: Chain.AVALANCHE,
|
|
1379
|
+
* });
|
|
1380
|
+
* ```
|
|
1381
|
+
*/
|
|
1382
|
+
stake(a) {
|
|
1383
|
+
return Qt(this.ctx, a);
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Unstake LBTC to BTC or BTC.b
|
|
1387
|
+
*
|
|
1388
|
+
* - LBTC → BTC: Cross-chain to Bitcoin mainnet/signet
|
|
1389
|
+
* - LBTC → BTC.b: Same-chain wrapped BTC on EVM
|
|
1390
|
+
*
|
|
1391
|
+
* @example
|
|
1392
|
+
* ```typescript
|
|
1393
|
+
* const unstake = evm.unstake({
|
|
1394
|
+
* assetIn: AssetId.LBTC,
|
|
1395
|
+
* assetOut: AssetId.BTC,
|
|
1396
|
+
* sourceChain: Chain.ETHEREUM,
|
|
1397
|
+
* destChain: Chain.BITCOIN_MAINNET,
|
|
1398
|
+
* });
|
|
1399
|
+
* ```
|
|
1400
|
+
*/
|
|
1401
|
+
unstake(a) {
|
|
1402
|
+
return ne(this.ctx, a);
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* Deposit BTCb to get LBTC
|
|
1406
|
+
*
|
|
1407
|
+
* Deposits BTC.b to receive LBTC via the claim flow.
|
|
1408
|
+
*
|
|
1409
|
+
* @example
|
|
1410
|
+
* ```typescript
|
|
1411
|
+
* const deposit = evm.deposit({
|
|
1412
|
+
* assetIn: AssetId.BTCb,
|
|
1413
|
+
* assetOut: AssetId.LBTC,
|
|
1414
|
+
* sourceChain: Chain.ETHEREUM,
|
|
1415
|
+
* destChain: Chain.ETHEREUM,
|
|
1416
|
+
* });
|
|
1417
|
+
* ```
|
|
1418
|
+
*/
|
|
1419
|
+
deposit(a) {
|
|
1420
|
+
return Vt(this.ctx, a);
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Deploy L-Assets to DeFi protocols
|
|
1424
|
+
*
|
|
1425
|
+
* Currently supports Veda and Silo protocols.
|
|
1426
|
+
*
|
|
1427
|
+
* @example
|
|
1428
|
+
* ```typescript
|
|
1429
|
+
* const deploy = evm.deploy({
|
|
1430
|
+
* asset: AssetId.LBTC,
|
|
1431
|
+
* sourceChain: Chain.ETHEREUM,
|
|
1432
|
+
* protocol: DeployProtocol.Veda,
|
|
1433
|
+
* recipient: '0x...',
|
|
1434
|
+
* });
|
|
1435
|
+
* ```
|
|
1436
|
+
*/
|
|
1437
|
+
deploy(a) {
|
|
1438
|
+
return yt(this.ctx, a);
|
|
1439
|
+
}
|
|
1440
|
+
/**
|
|
1441
|
+
* Withdraw vault shares from DeFi protocols
|
|
1442
|
+
*
|
|
1443
|
+
* Queues a withdrawal request from DeFi protocols (e.g., Veda vault).
|
|
1444
|
+
* After the withdrawal is queued, it will be processed within the
|
|
1445
|
+
* protocol's withdrawal window.
|
|
1446
|
+
*
|
|
1447
|
+
* @example
|
|
1448
|
+
* ```typescript
|
|
1449
|
+
* const withdraw = evm.withdraw({
|
|
1450
|
+
* protocol: DeployProtocol.Veda,
|
|
1451
|
+
* sourceChain: Chain.ETHEREUM,
|
|
1452
|
+
* recipient: '0x...',
|
|
1453
|
+
* });
|
|
1454
|
+
* await withdraw.prepare({ amount: '0.1' });
|
|
1455
|
+
* if (withdraw.needsApproval) await withdraw.approve();
|
|
1456
|
+
* await withdraw.execute();
|
|
1457
|
+
* ```
|
|
1458
|
+
*/
|
|
1459
|
+
withdraw(a) {
|
|
1460
|
+
return ce(this.ctx, a);
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Cancel a pending withdrawal from DeFi protocols
|
|
1464
|
+
*
|
|
1465
|
+
* Cancels a previously queued withdrawal request.
|
|
1466
|
+
*
|
|
1467
|
+
* @example
|
|
1468
|
+
* ```typescript
|
|
1469
|
+
* const cancelWithdraw = evm.cancelWithdraw({
|
|
1470
|
+
* protocol: DeployProtocol.Veda,
|
|
1471
|
+
* chain: Chain.ETHEREUM,
|
|
1472
|
+
* });
|
|
1473
|
+
* await cancelWithdraw.prepare();
|
|
1474
|
+
* await cancelWithdraw.execute();
|
|
1475
|
+
* ```
|
|
1476
|
+
*/
|
|
1477
|
+
cancelWithdraw(a) {
|
|
1478
|
+
return he(this.ctx, a);
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Redeem LBTC to BTC.b (same-chain unwrap)
|
|
1482
|
+
*
|
|
1483
|
+
* Converts LBTC to BTC.b on the same EVM chain.
|
|
1484
|
+
* For cross-chain BTC redemption, use unstake() with destChain set to Bitcoin.
|
|
1485
|
+
*
|
|
1486
|
+
* @example
|
|
1487
|
+
* ```typescript
|
|
1488
|
+
* const redeem = evm.redeem({
|
|
1489
|
+
* assetIn: AssetId.LBTC,
|
|
1490
|
+
* assetOut: AssetId.BTCb,
|
|
1491
|
+
* sourceChain: Chain.AVALANCHE,
|
|
1492
|
+
* });
|
|
1493
|
+
* ```
|
|
1494
|
+
*/
|
|
1495
|
+
redeem(a) {
|
|
1496
|
+
return Wt(this.ctx, a);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
function Te(r) {
|
|
1500
|
+
return new ue(r);
|
|
1501
|
+
}
|
|
1502
|
+
export {
|
|
1503
|
+
ue as EvmActions,
|
|
1504
|
+
f as EvmDepositStatus,
|
|
1505
|
+
Te as evmActions,
|
|
1506
|
+
Pe as evmModule
|
|
1507
|
+
};
|
|
1508
|
+
//# sourceMappingURL=EvmActions-CUKBeiUw.js.map
|