@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,6 +1,7 @@
|
|
|
1
1
|
import { ArgTypes } from 'storybook/internal/types';
|
|
2
2
|
import { Token } from '../tokens/token-addresses';
|
|
3
3
|
export declare const chainSelector: Partial<ArgTypes>;
|
|
4
|
+
export declare const allChainSelector: Partial<ArgTypes>;
|
|
4
5
|
export declare const envSelector: Partial<ArgTypes>;
|
|
5
6
|
export declare const makeTokenSelector: (tokens?: Token[], fieldName?: string) => Partial<ArgTypes>;
|
|
6
7
|
//# sourceMappingURL=arg-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arg-types.d.ts","sourceRoot":"","sources":["../../src/stories/arg-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"arg-types.d.ts","sourceRoot":"","sources":["../../src/stories/arg-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQpD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,QAAQ,CAM3C,CAAC;AASF,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,QAAQ,CAM9C,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,QAAQ,CAMzC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,KAAK,EAAE,EAChB,kBAAmB,KAClB,OAAO,CAAC,QAAQ,CAYjB,CAAC"}
|
|
@@ -45,8 +45,8 @@ export declare const EVM_LBTC_ADDRESSES: TokenAddressesPerEnv<Token.LBTC, ChainI
|
|
|
45
45
|
export declare const TOKEN_ADDRESSES: TokenAddresses<Token, ChainId>;
|
|
46
46
|
export declare const SUI_TOKEN_ADDRESSES: TokenAddresses<Token.LBTC, SuiChain>;
|
|
47
47
|
export declare const getSuiTokenAddress: (chainId: SuiChain, env?: Env) => Address | undefined;
|
|
48
|
-
export declare const SOLANA_TOKEN_ADDRESSES: TokenAddresses<Token.LBTC, SolanaChain>;
|
|
49
|
-
export declare const getSolanaTokenAddress: (chainId: SolanaChain, env?: Env) => string | undefined;
|
|
48
|
+
export declare const SOLANA_TOKEN_ADDRESSES: TokenAddresses<Token.LBTC | Token.BTCb, SolanaChain>;
|
|
49
|
+
export declare const getSolanaTokenAddress: (chainId: SolanaChain, env?: Env, token?: Token.LBTC | Token.BTCb) => string | undefined;
|
|
50
50
|
export declare const getTokenByAddress: (tokenAddress?: string, chainId?: ChainId | SuiChain | SolanaChain | StarknetChainId, env?: Env, addressKind?: AddressKind) => Token | undefined;
|
|
51
51
|
export declare const getTokenAddressForChain: (chainId: ChainId | SuiChain | SolanaChain | StarknetChainId, adapter?: AddressKind, env?: Env) => string | undefined;
|
|
52
52
|
export declare const STARKNET_TOKEN_ADDRESSES: TokenAddresses<Token.LBTC, StarknetChainId>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-addresses.d.ts","sourceRoot":"","sources":["../../src/tokens/token-addresses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAe,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EACL,OAAO,EAQP,WAAW,EAGX,eAAe,EAGf,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,oBAAY,KAAK;IAEf,oCAAoC;IACpC,IAAI,SAAS;IACb;;;OAGG;IACH,IAAI,SAAS;IACb,oDAAoD;IACpD,IAAI,UAAU;IAGd,UAAU,SAAS;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AASD,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC;AAC/C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,CAErD,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAC9B,KAAK,SAAS,KAAK,EACnB,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,IACvE,OAAO,CACT,MAAM,CACJ,GAAG,EACH,OAAO,CACL,MAAM,CACJ,KAAK,EACH,CAAC,KAAK,SAAS,KAAK,CAAC,IAAI,GACrB,KAAK,SACD,OAAO,OAAO,CAAC,SAAS,GACxB,OAAO,OAAO,CAAC,aAAa,GAC9B,oBAAoB,GACpB,OAAO,GACT,KAAK,SAAS,OAAO,GAAG,QAAQ,GAAG,eAAe,GAChD,OAAO,GACP,MAAM,CAAC,GACb,SAAS,CACZ,CACF,CACF,CACF,CAAC;AAEF,MAAM,MAAM,cAAc,CACxB,KAAK,SAAS,KAAK,EACnB,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,IACvE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAyF/D,eAAO,MAAM,kBAAkB,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAsExE,CAAC;AA2BF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,CAK1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAepE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,QAAQ,EACjB,SAAiB,KAChB,OAAO,GAAG,SAEZ,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"token-addresses.d.ts","sourceRoot":"","sources":["../../src/tokens/token-addresses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAe,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EACL,OAAO,EAQP,WAAW,EAGX,eAAe,EAGf,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,oBAAY,KAAK;IAEf,oCAAoC;IACpC,IAAI,SAAS;IACb;;;OAGG;IACH,IAAI,SAAS;IACb,oDAAoD;IACpD,IAAI,UAAU;IAGd,UAAU,SAAS;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AASD,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC;AAC/C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,CAErD,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAC9B,KAAK,SAAS,KAAK,EACnB,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,IACvE,OAAO,CACT,MAAM,CACJ,GAAG,EACH,OAAO,CACL,MAAM,CACJ,KAAK,EACH,CAAC,KAAK,SAAS,KAAK,CAAC,IAAI,GACrB,KAAK,SACD,OAAO,OAAO,CAAC,SAAS,GACxB,OAAO,OAAO,CAAC,aAAa,GAC9B,oBAAoB,GACpB,OAAO,GACT,KAAK,SAAS,OAAO,GAAG,QAAQ,GAAG,eAAe,GAChD,OAAO,GACP,MAAM,CAAC,GACb,SAAS,CACZ,CACF,CACF,CACF,CAAC;AAEF,MAAM,MAAM,cAAc,CACxB,KAAK,SAAS,KAAK,EACnB,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,IACvE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAyF/D,eAAO,MAAM,kBAAkB,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAsExE,CAAC;AA2BF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,CAK1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAepE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,QAAQ,EACjB,SAAiB,KAChB,OAAO,GAAG,SAEZ,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,cAAc,CACjD,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,EACvB,WAAW,CAwBZ,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,WAAW,EACpB,SAAiB,EACjB,QAAO,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAiB,KAC1C,MAAM,GAAG,SAEX,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,eAAe,MAAM,EACrB,UAAU,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,eAAe,EAC5D,SAAiB,EACjB,cAAa,WAA+B,sBA4B7C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,SAAS,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,eAAe,EAC3D,UAAS,WAA+B,EACxC,MAAK,GAAiB,KACrB,MAAM,GAAG,SAiBX,CAAC;AAIF,eAAO,MAAM,wBAAwB,EAAE,cAAc,CACnD,KAAK,CAAC,IAAI,EACV,eAAe,CAwBP,CAAC;AAEX,eAAO,MAAM,+BAA+B,EAAE,cAAc,CAC1D,KAAK,CAAC,IAAI,EACV,eAAe,CAwBP,CAAC;AAEX,eAAO,MAAM,uBAAuB,GAClC,SAAS,eAAe,EACxB,SAAiB,EACjB,UAAS,OAAO,GAAG,aAAuB,KACzC,OAAO,GAAG,SAOZ,CAAC"}
|
package/dist/utils/chain.d.ts
CHANGED
|
@@ -104,4 +104,11 @@ export declare function isStarknetChain(chain: Chain): boolean;
|
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
106
|
export declare function getChainNamespace(chain: Chain): string;
|
|
107
|
+
/**
|
|
108
|
+
* Map a CAIP-2 Solana chain identifier to the network string expected by
|
|
109
|
+
* sdk-solana functions (e.g. 'mainnet-beta', 'devnet', 'testnet').
|
|
110
|
+
*
|
|
111
|
+
* @throws LombardError if the chain ID is not a recognised Solana chain
|
|
112
|
+
*/
|
|
113
|
+
export declare function chainToSolanaNetwork(chainId: string): string;
|
|
107
114
|
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/utils/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAmB,KAAK,EAAiB,MAAM,SAAS,CAAC;AAMhE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAsBpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAErD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAEtD"}
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/utils/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAmB,KAAK,EAAiB,MAAM,SAAS,CAAC;AAMhE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAsBpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAErD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkB5D"}
|
package/dist/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./chunks/index-BKzxeh1Y.cjs"),S=require("./chunks/api-config-DkXqqfCK.cjs"),t=require("./chunks/blockchain-identifier-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./chunks/index-BKzxeh1Y.cjs"),S=require("./chunks/api-config-DkXqqfCK.cjs"),t=require("./chunks/blockchain-identifier-BTPGxLio.cjs"),e=require("./chunks/token-addresses-nzvTOi24.cjs"),a=require("./chunks/fee-requirements-CICSxYYL.cjs"),s=require("./chunks/lbtc-addresses-Kil252DX.cjs"),n=require("./chunks/tokens-BkvA0Gp1.cjs"),o=require("./chunks/satoshi-CZEsHl5X.cjs"),r=require("./chunks/parameters-DK9cYCAH.cjs"),i=require("./chunks/time-I-BeyUkG.cjs");exports.Env=A.r;exports.getApiConfig=S.getApiConfig;exports.BlockchainIdentifier=t.BlockchainIdentifier;exports.getBaseNetworkByEnv=t.getBaseNetworkByEnv;exports.getBscNetworkByEnv=t.getBscNetworkByEnv;exports.getChainIdByName=t.getChainIdByName;exports.getChainNameById=t.getChainNameById;exports.getEthNetworkByEnv=t.getEthNetworkByEnv;exports.getSolanaNetworkByEnv=t.getSolanaNetworkByEnv;exports.getSonicNetworkByEnv=t.getSonicNetworkByEnv;exports.getStarknetNetworkByEnv=t.getStarknetNetworkByEnv;exports.getSuiNetworkByEnv=t.getSuiNetworkByEnv;exports.AddressKind=e.AddressKind;exports.CHAIN_ID_TO_LLAMA_CHAIN_NAME_MAP=e.CHAIN_ID_TO_LLAMA_CHAIN_NAME_MAP;exports.CHAIN_ID_TO_VIEM_CHAIN_MAP=e.CHAIN_ID_TO_VIEM_CHAIN_MAP;exports.ChainId=e.ChainId;exports.EVM_LBTC_ADDRESSES=e.EVM_LBTC_ADDRESSES;exports.RATIO_TOKEN_MAP=e.RATIO_TOKEN_MAP;exports.SOLANA_DEVNET_CHAIN=e.SOLANA_DEVNET_CHAIN;exports.SOLANA_MAINNET_CHAIN=e.SOLANA_MAINNET_CHAIN;exports.SOLANA_TESTNET_CHAIN=e.SOLANA_TESTNET_CHAIN;exports.SOLANA_TOKEN_ADDRESSES=e.SOLANA_TOKEN_ADDRESSES;exports.STARKNET_ASSET_ROUTER_ADDRESSES=e.STARKNET_ASSET_ROUTER_ADDRESSES;exports.STARKNET_MAINNET_CHAIN=e.STARKNET_MAINNET_CHAIN;exports.STARKNET_SEPOLIA_CHAIN=e.STARKNET_SEPOLIA_CHAIN;exports.STARKNET_TOKEN_ADDRESSES=e.STARKNET_TOKEN_ADDRESSES;exports.SUI_DEVNET_CHAIN=e.SUI_DEVNET_CHAIN;exports.SUI_LOCALNET_CHAIN=e.SUI_LOCALNET_CHAIN;exports.SUI_MAINNET_CHAIN=e.SUI_MAINNET_CHAIN;exports.SUI_TESTNET_CHAIN=e.SUI_TESTNET_CHAIN;exports.SUI_TOKEN_ADDRESSES=e.SUI_TOKEN_ADDRESSES;exports.TOKEN_ADDRESSES=e.TOKEN_ADDRESSES;exports.Token=e.Token;exports.addChain=e.addChain;exports.allChains=e.allChains;exports.bob=e.bob;exports.bobSepolia=e.bobSepolia;exports.getChain=e.getChain;exports.getLlamaChainName=e.getLlamaChainName;exports.getSolanaTokenAddress=e.getSolanaTokenAddress;exports.getStarknetTokenAddress=e.getStarknetTokenAddress;exports.getSuiTokenAddress=e.getSuiTokenAddress;exports.getTokenAddressForChain=e.getTokenAddressForChain;exports.getTokenByAddress=e.getTokenByAddress;exports.isEthereumChain=e.isEthereumChain;exports.isKatanaChain=e.isKatanaChain;exports.isMegaethChain=e.isMegaethChain;exports.isMonadChain=e.isMonadChain;exports.isSolanaChain=e.isSolanaChain;exports.isStableChain=e.isStableChain;exports.isStarknetChainId=e.isStarknetChainId;exports.isSuiChain=e.isSuiChain;exports.isValidChain=e.isValidChain;exports.katana=e.katana;exports.megaeth=e.megaeth;exports.monad=e.monad;exports.stable=e.stable;exports.tac=e.tac;exports.AUTO_MINT_FEE_CHAINS=a.AUTO_MINT_FEE_CHAINS;exports.requiresAutoMintFee=a.requiresAutoMintFee;exports.getLbtcContractAddresses=s.getLbtcContractAddresses;exports.RPC_URL=n.RPC_URL;exports.TokenContractAddressNotFoundError=n.TokenContractAddressNotFoundError;exports.UnsupportedTokenFlow=n.UnsupportedTokenFlow;exports.fromBaseDenomination=n.fromBaseDenomination;exports.getErrorMessage=n.getErrorMessage;exports.getRpcUrlConfig=n.getRpcUrlConfig;exports.getTokenContractInfo=n.getTokenContractInfo;exports.isUpgradedAbi=n.isUpgradedAbi;exports.retrieveTokenProperties=n.retrieveTokenProperties;exports.rpcUrlConfig=n.rpcUrlConfig;exports.toBaseDenomination=n.toBaseDenomination;exports.BTC_DECIMALS=o.BTC_DECIMALS;exports.SATOSHI_SCALE=o.SATOSHI_SCALE;exports.fromSatoshi=o.fromSatoshi;exports.toSatoshi=o.toSatoshi;exports.toSatoshiBigInt=o.toSatoshiBigInt;exports.isProviderFlow=r.isProviderFlow;exports.isSignerFlow=r.isSignerFlow;exports.DAY=i.DAY;exports.HOUR=i.HOUR;exports.MINUTE=i.MINUTE;exports.SECOND=i.SECOND;exports.ensureHex=i.ensureHex;exports.isHex=i.isHex;exports.now=i.now;exports.toUnix=i.toUnix;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.js
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { r as t } from "./chunks/index-CfcQ_g3t.js";
|
|
2
|
+
import { getApiConfig as r } from "./chunks/api-config-Dm6dR85f.js";
|
|
3
|
+
import { BlockchainIdentifier as A, getBaseNetworkByEnv as i, getBscNetworkByEnv as S, getChainIdByName as E, getChainNameById as N, getEthNetworkByEnv as _, getSolanaNetworkByEnv as s, getSonicNetworkByEnv as T, getStarknetNetworkByEnv as C, getSuiNetworkByEnv as I } from "./chunks/blockchain-identifier-CTVaEPpY.js";
|
|
4
|
+
import { AddressKind as g, CHAIN_ID_TO_LLAMA_CHAIN_NAME_MAP as h, CHAIN_ID_TO_VIEM_CHAIN_MAP as k, ChainId as m, EVM_LBTC_ADDRESSES as D, RATIO_TOKEN_MAP as O, SOLANA_DEVNET_CHAIN as p, SOLANA_MAINNET_CHAIN as B, SOLANA_TESTNET_CHAIN as H, SOLANA_TOKEN_ADDRESSES as f, STARKNET_ASSET_ROUTER_ADDRESSES as M, STARKNET_MAINNET_CHAIN as R, STARKNET_SEPOLIA_CHAIN as l, STARKNET_TOKEN_ADDRESSES as L, SUI_DEVNET_CHAIN as U, SUI_LOCALNET_CHAIN as x, SUI_MAINNET_CHAIN as c, SUI_TESTNET_CHAIN as w, SUI_TOKEN_ADDRESSES as K, TOKEN_ADDRESSES as v, Token as y, addChain as u, allChains as b, bob as F, bobSepolia as P, getChain as V, getLlamaChainName as q, getSolanaTokenAddress as Y, getStarknetTokenAddress as j, getSuiTokenAddress as z, getTokenAddressForChain as G, getTokenByAddress as J, isEthereumChain as Q, isKatanaChain as W, isMegaethChain as X, isMonadChain as Z, isSolanaChain as $, isStableChain as ee, isStarknetChainId as oe, isSuiChain as te, isValidChain as ne, katana as re, megaeth as ae, monad as Ae, stable as ie, tac as Se } from "./chunks/token-addresses-D0v5cR1j.js";
|
|
5
|
+
import { AUTO_MINT_FEE_CHAINS as Ne, requiresAutoMintFee as _e } from "./chunks/fee-requirements-CCNsxAvJ.js";
|
|
6
|
+
import { getLbtcContractAddresses as Te } from "./chunks/lbtc-addresses-D8MYCdsx.js";
|
|
7
|
+
import { RPC_URL as Ie, TokenContractAddressNotFoundError as de, UnsupportedTokenFlow as ge, fromBaseDenomination as he, getErrorMessage as ke, getRpcUrlConfig as me, getTokenContractInfo as De, isUpgradedAbi as Oe, retrieveTokenProperties as pe, rpcUrlConfig as Be, toBaseDenomination as He } from "./chunks/tokens-DgC1hfkm.js";
|
|
8
|
+
import { BTC_DECIMALS as Me, SATOSHI_SCALE as Re, fromSatoshi as le, toSatoshi as Le, toSatoshiBigInt as Ue } from "./chunks/satoshi-CSoJBXc6.js";
|
|
9
|
+
import { isProviderFlow as ce, isSignerFlow as we } from "./chunks/parameters-C_16L5ft.js";
|
|
10
|
+
import { DAY as ve, HOUR as ye, MINUTE as ue, SECOND as be, ensureHex as Fe, isHex as Pe, now as Ve, toUnix as qe } from "./chunks/time-Sa5gggPG.js";
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
Ne as AUTO_MINT_FEE_CHAINS,
|
|
13
|
+
g as AddressKind,
|
|
14
|
+
Me as BTC_DECIMALS,
|
|
15
|
+
A as BlockchainIdentifier,
|
|
16
16
|
h as CHAIN_ID_TO_LLAMA_CHAIN_NAME_MAP,
|
|
17
17
|
k as CHAIN_ID_TO_VIEM_CHAIN_MAP,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
m as ChainId,
|
|
19
|
+
ve as DAY,
|
|
20
|
+
D as EVM_LBTC_ADDRESSES,
|
|
21
|
+
t as Env,
|
|
22
|
+
ye as HOUR,
|
|
23
|
+
ue as MINUTE,
|
|
24
|
+
O as RATIO_TOKEN_MAP,
|
|
25
|
+
Ie as RPC_URL,
|
|
26
|
+
Re as SATOSHI_SCALE,
|
|
27
|
+
be as SECOND,
|
|
28
|
+
p as SOLANA_DEVNET_CHAIN,
|
|
29
|
+
B as SOLANA_MAINNET_CHAIN,
|
|
30
|
+
H as SOLANA_TESTNET_CHAIN,
|
|
31
|
+
f as SOLANA_TOKEN_ADDRESSES,
|
|
32
32
|
M as STARKNET_ASSET_ROUTER_ADDRESSES,
|
|
33
33
|
R as STARKNET_MAINNET_CHAIN,
|
|
34
34
|
l as STARKNET_SEPOLIA_CHAIN,
|
|
35
35
|
L as STARKNET_TOKEN_ADDRESSES,
|
|
36
36
|
U as SUI_DEVNET_CHAIN,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
x as SUI_LOCALNET_CHAIN,
|
|
38
|
+
c as SUI_MAINNET_CHAIN,
|
|
39
39
|
w as SUI_TESTNET_CHAIN,
|
|
40
40
|
K as SUI_TOKEN_ADDRESSES,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
v as TOKEN_ADDRESSES,
|
|
42
|
+
y as Token,
|
|
43
|
+
de as TokenContractAddressNotFoundError,
|
|
44
|
+
ge as UnsupportedTokenFlow,
|
|
45
|
+
u as addChain,
|
|
46
|
+
b as allChains,
|
|
47
47
|
F as bob,
|
|
48
48
|
P as bobSepolia,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
Fe as ensureHex,
|
|
50
|
+
he as fromBaseDenomination,
|
|
51
|
+
le as fromSatoshi,
|
|
52
|
+
r as getApiConfig,
|
|
53
53
|
i as getBaseNetworkByEnv,
|
|
54
|
-
|
|
54
|
+
S as getBscNetworkByEnv,
|
|
55
55
|
V as getChain,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
E as getChainIdByName,
|
|
57
|
+
N as getChainNameById,
|
|
58
|
+
ke as getErrorMessage,
|
|
59
|
+
_ as getEthNetworkByEnv,
|
|
60
|
+
Te as getLbtcContractAddresses,
|
|
61
61
|
q as getLlamaChainName,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
me as getRpcUrlConfig,
|
|
63
|
+
s as getSolanaNetworkByEnv,
|
|
64
|
+
Y as getSolanaTokenAddress,
|
|
65
65
|
T as getSonicNetworkByEnv,
|
|
66
66
|
C as getStarknetNetworkByEnv,
|
|
67
|
-
|
|
67
|
+
j as getStarknetTokenAddress,
|
|
68
68
|
I as getSuiNetworkByEnv,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
z as getSuiTokenAddress,
|
|
70
|
+
G as getTokenAddressForChain,
|
|
71
|
+
J as getTokenByAddress,
|
|
72
|
+
De as getTokenContractInfo,
|
|
73
|
+
Q as isEthereumChain,
|
|
74
|
+
Pe as isHex,
|
|
75
75
|
W as isKatanaChain,
|
|
76
76
|
X as isMegaethChain,
|
|
77
77
|
Z as isMonadChain,
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
ce as isProviderFlow,
|
|
79
|
+
we as isSignerFlow,
|
|
80
80
|
$ as isSolanaChain,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
ee as isStableChain,
|
|
82
|
+
oe as isStarknetChainId,
|
|
83
|
+
te as isSuiChain,
|
|
84
|
+
Oe as isUpgradedAbi,
|
|
85
|
+
ne as isValidChain,
|
|
86
|
+
re as katana,
|
|
87
|
+
ae as megaeth,
|
|
88
|
+
Ae as monad,
|
|
89
|
+
Ve as now,
|
|
90
|
+
_e as requiresAutoMintFee,
|
|
91
|
+
pe as retrieveTokenProperties,
|
|
92
|
+
Be as rpcUrlConfig,
|
|
93
|
+
ie as stable,
|
|
94
|
+
Se as tac,
|
|
95
|
+
He as toBaseDenomination,
|
|
96
|
+
Le as toSatoshi,
|
|
97
|
+
Ue as toSatoshiBigInt,
|
|
98
|
+
qe as toUnix
|
|
99
99
|
};
|
|
100
100
|
//# sourceMappingURL=utils.js.map
|
package/dist/vaults.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./chunks/config-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./chunks/config-DmCmanM_.cjs"),e=require("./chunks/withdraw-i0AueZ_C.cjs"),t=require("./chunks/get-vault-tvl-D_tQIDAs.cjs"),a=require("./chunks/get-vault-withdrawals-8ALlEiAC.cjs");exports.Vault=l.Vault;exports.cancelWithdraw=e.cancelWithdraw;exports.deposit=e.deposit;exports.queueWithdraw=e.queueWithdraw;exports.getVaultApy=t.getVaultApy;exports.getVaultDeposits=t.getVaultDeposits;exports.getVaultDepositsAllChains=t.getVaultDepositsAllChains;exports.getVaultPoints=t.getVaultPoints;exports.getVaultTVL=t.getVaultTVL;exports.getVaultWithdrawals=a.getVaultWithdrawals;exports.getVaultWithdrawalsAllChains=a.getVaultWithdrawalsAllChains;
|
|
2
2
|
//# sourceMappingURL=vaults.cjs.map
|
package/dist/vaults.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Vault as e } from "./chunks/config-DghboRx0.js";
|
|
2
|
+
import { cancelWithdraw as o, deposit as r, queueWithdraw as i } from "./chunks/withdraw-DgjuaUN3.js";
|
|
3
|
+
import { getVaultApy as u, getVaultDeposits as V, getVaultDepositsAllChains as p, getVaultPoints as g, getVaultTVL as h } from "./chunks/get-vault-tvl-Ct_Zkg7C.js";
|
|
4
|
+
import { getVaultWithdrawals as f, getVaultWithdrawalsAllChains as m } from "./chunks/get-vault-withdrawals-jk7Sv4S4.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
e as Vault,
|
|
7
|
+
o as cancelWithdraw,
|
|
8
|
+
r as deposit,
|
|
9
9
|
u as getVaultApy,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
V as getVaultDeposits,
|
|
11
|
+
p as getVaultDepositsAllChains,
|
|
12
|
+
g as getVaultPoints,
|
|
13
|
+
h as getVaultTVL,
|
|
14
|
+
f as getVaultWithdrawals,
|
|
15
|
+
m as getVaultWithdrawalsAllChains,
|
|
16
|
+
i as queueWithdraw
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=vaults.js.map
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lombard.finance/sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
|
+
"description": "TypeScript SDK for the Lombard protocol - stake BTC, mint LBTC, and interact with DeFi",
|
|
4
5
|
"dependencies": {
|
|
5
|
-
"@lombard.finance/sdk-common": "3.
|
|
6
|
+
"@lombard.finance/sdk-common": "3.5.0",
|
|
6
7
|
"isows": "^1.0.7"
|
|
7
8
|
},
|
|
8
9
|
"devDependencies": {
|
|
@@ -105,7 +106,17 @@
|
|
|
105
106
|
},
|
|
106
107
|
"files": [
|
|
107
108
|
"dist",
|
|
108
|
-
"CHANGELOG.md"
|
|
109
|
+
"CHANGELOG.md",
|
|
110
|
+
"LICENSE"
|
|
111
|
+
],
|
|
112
|
+
"keywords": [
|
|
113
|
+
"lombard",
|
|
114
|
+
"sdk",
|
|
115
|
+
"bitcoin",
|
|
116
|
+
"lbtc",
|
|
117
|
+
"staking",
|
|
118
|
+
"defi",
|
|
119
|
+
"btc"
|
|
109
120
|
],
|
|
110
121
|
"license": "MIT",
|
|
111
122
|
"peerDependencies": {
|
|
@@ -124,13 +135,15 @@
|
|
|
124
135
|
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
125
136
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings=0",
|
|
126
137
|
"storybook": "storybook dev -p 6006",
|
|
127
|
-
"test": "
|
|
138
|
+
"test": "yarn test:unit && yarn test:integration:mocked",
|
|
128
139
|
"test:watch": "vitest",
|
|
129
140
|
"test:ui": "vitest --ui",
|
|
130
141
|
"test:coverage": "vitest run --coverage",
|
|
131
142
|
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
132
|
-
"test:integration": "
|
|
133
|
-
"test:
|
|
143
|
+
"test:integration": "yarn test:integration:mocked",
|
|
144
|
+
"test:integration:mocked": "vitest run --config vitest.integration.config.ts",
|
|
145
|
+
"test:integration:online": "ENABLE_ONLINE_INTEGRATION=true ENABLE_CONTRACT_CHECKS=true vitest run --config vitest.integration.online.config.ts",
|
|
146
|
+
"test:all": "yarn test:unit && yarn test:integration:mocked && yarn test:integration:online",
|
|
134
147
|
"test:generate-wallets": "ts-node scripts/generate-test-wallets.ts",
|
|
135
148
|
"test:check-balances": "ts-node scripts/prefund-test-wallets.ts",
|
|
136
149
|
"types": "tsc --noEmit",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var z=Object.defineProperty;var H=(s,r,i)=>r in s?z(s,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[r]=i;var A=(s,r,i)=>H(s,typeof r!="symbol"?r+"":r,i);const Y=require("axios"),p=require("./token-addresses-DRBecUa7.cjs"),t=require("./statusConstants-BLiNBT6s.cjs"),u=require("./index-BKzxeh1Y.cjs"),f=require("./tokens-D_HeVB5p.cjs"),l=require("./satoshi-CZEsHl5X.cjs"),h=require("./defi-registry-BIRv_zkp.cjs"),b=require("./getUserStakeAndBakeSignature-BxRq2cI1.cjs"),q=require("./config-l4ZaZw_g.cjs"),$=require("viem"),U="ERR_NETWORK",G="This may be due to your Adblocker. Please disable any Adblocker and refresh the page to restore full functionality.";function K(s){const{code:r,message:i}=s;throw r===U?new Error(G):new Error(i)}const j={mempoolApiUrl:"https://mempool.space/signet"},Z={mempoolApiUrl:"https://mempool.space"},W=s=>s==="mainnet"?Z:j;async function X(s){const{mempoolApiUrl:r}=W(s),i=Math.floor(Date.now()/1e3),e=`${r}/api/v1/mining/blocks/timestamp/${i}`;try{const{data:n}=await Y.get(e);return n.height}catch(n){K(n)}}class J{async getCurrentBlockHeight(r){return X(r)}}function Q(){return{id:"btc",chain:"btc",register(){return new J}}}async function _(s){const{fetchDeposit:r,network:i,btcService:e,requiredConfirmations:n=6,onProgress:a,onComplete:o}=s,c=await r();if(!c)return;const d=c.blockHeight;if(typeof d!="number")return;const T=await e.getCurrentBlockHeight(i),B=Math.max(0,T-d),N=B>=n,y=c.isClaimed??!1,v={confirmations:B,requiredConfirmations:n,hasEnoughConfirmations:N,isClaimed:y,steps:{created:t.StepStatus.COMPLETE,verifying:N?t.StepStatus.COMPLETE:t.StepStatus.PENDING,issuing:y?t.StepStatus.COMPLETE:t.StepStatus.PENDING}};return a==null||a(v),y&&(o==null||o()),v}function I(s){if(s===b.SANCTIONED_ADDRESS)throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"Destination address is under sanctions")}class m extends t.BaseAction{constructor(i,e,n){super(n);A(this,"_amount");A(this,"_recipient");A(this,"_depositAddress");A(this,"_referralCode");A(this,"_chainId");this.ctx=i,this.params=e}get amount(){return this._amount}get recipient(){return this._recipient}get depositAddress(){return this._depositAddress}get referralCode(){return this._referralCode}get bitcoinNetwork(){return this.params.sourceChain===t.Chain.BITCOIN_MAINNET?"mainnet":"testnet"}get prepareSchema(){return t.objectType({amount:t.btcStakeAmountSchema,recipient:this.getAddressSchema(),referralCode:t.referralCodeSchema})}validatePrepareParams(i){return t.validatePrepareParams(this.prepareSchema,i,{destChain:this.params.destChain})}ensureRecipient(){if(!this._recipient)throw t.LombardError.missingParameter("recipient");return this._recipient}ensureAmount(){if(!this._amount)throw t.LombardError.missingParameter("amount");return this._amount}ensureDepositAddress(){if(!this._depositAddress)throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"Deposit address not generated. Call generateDepositAddress() first.");return this._depositAddress}getAuthRequiredMessage(){return"Authorization required. Complete the authorization step first."}ensureAuthorized(){if(!this.isAuthorized())throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,this.getAuthRequiredMessage())}async resumeFromExistingDeposit(i){try{const e=await this.ctx.api.getDepositAddress({address:i,chainId:this.getChainId(),token:this.getExpectedToken(),partnerId:this.ctx.partner.getPartnerId()});return e?(this._depositAddress=e,!0):!1}catch{return!1}}async generateDepositAddressImpl(i){const e=this.getStatusConfig();return this.assertStatus(e.ready,"generateDepositAddress"),this.ensureAuthorized(),this._depositAddress?this._depositAddress:this.act(async()=>{const n=this.getDepositAddressParams(i),a=await this.ctx.api.generateDepositAddress(n);I(a),this._depositAddress=a;const o=this.getInitialSteps(),c=Object.fromEntries(Object.entries(o).map(([d],T)=>[d,T===0?t.StepStatus.COMPLETE:t.StepStatus.IDLE]));return this.emitProgress({status:e.addressReady,steps:c,metadata:{depositAddress:a}}),a},e.addressReady)}async executeImpl(){const i=this.getStatusConfig();return this.act(async()=>{this.assertStatus(i.addressReady,"execute"),this._depositAddress||await this.generateDepositAddressImpl();const e=this.ensureDepositAddress(),n=await this.trySendBitcoin(e);return n?{depositAddress:e,txHash:n}:{depositAddress:e}})}emitInitialProgress(){this.emitProgress({status:this.status,steps:this.getInitialSteps()})}async monitorDeposit(){const i=this._depositAddress,e=this._recipient;if(!i||!e)throw t.LombardError.missingParameter("depositAddress or recipient");return await _({network:this.bitcoinNetwork,btcService:this.ctx.btc,fetchDeposit:async()=>{const o=(await this.ctx.api.getDeposits(e)).find(c=>c.depositAddress===i);if(o)return{blockHeight:o.blockHeight,isClaimed:o.isClaimed}},onProgress:a=>{this.emitProgress({status:this.status,steps:a.steps,confirmations:a.confirmations,requiredConfirmations:a.requiredConfirmations,metadata:{isClaimed:a.isClaimed}})},onComplete:()=>{this.emitCompleted()}})}async trySendBitcoin(i){const e=this._amount;if(e)try{const n=await this.ctx.getProvider("bitcoin");if(!n)return;const a=n;if(a.sendBitcoin){const o=l.toSatoshi(e).toNumber();return a.sendBitcoin(i,o)}}catch{}}}function D(s,r=p.Token.LBTC){switch(s){case h.AssetId.LBTC:return p.Token.LBTC;case h.AssetId.BTCb:return p.Token.BTCb;default:return r}}async function tt(s,r){try{await s.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${r.toString(16)}`}]})}catch(i){const e=i;if(e.code===4902)try{await p.addChain({provider:s,chainId:r}),await s.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${r.toString(16)}`}]});return}catch(n){const a=n;throw a.code===4001?new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"User rejected adding chain to wallet."):new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Failed to add chain ${r} to wallet: ${a.message||"Unknown error"}`)}throw e.code===4001?new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"User rejected chain switch request."):new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Failed to switch to chain ${r}: ${e.message||"Unknown error"}`)}}async function et(s){const r=await s.request({method:"eth_chainId"});return parseInt(r,16)}async function E(s,r){await et(s)!==r&&await tt(s,r)}const st=[t.Chain.ETHEREUM,t.Chain.SEPOLIA],it={async getMintingFee(s,r){return s.capabilities.require("evm").getMintingFee(r,p.Token.BTCb)},async restoreFeeSignature(s,r,i){const e=await f.getTokenContractInfo(p.Token.BTCb,r,s.env),n=await s.api.getFeeSignature({address:i,chainId:r,tokenAddress:e.address});return!n.hasSignature||n.expirationDate&&new Date(Number(n.expirationDate)*1e3)<new Date?null:{hasSignature:!0,signature:n.signature,typedData:n.typedData}},async authorizeFee(s,{chainId:r,recipient:i,fee:e}){const n=s.capabilities.require("evm"),a=await s.getProvider("evm");if(!a)throw t.LombardError.providerMissing(String(r),"evm");await E(a,r);const o=l.toSatoshi(e).toString(),c=await f.getTokenContractInfo(p.Token.BTCb,r,s.env),d=await n.signNetworkFee({fee:o,account:i,chainId:r,provider:a,token:p.Token.BTCb});return await s.api.storeFeeSignature({address:i,signature:d.signature,typedData:d.typedData,tokenAddress:c.address}),{signature:d.signature,typedData:d.typedData}}},rt={chainType:"evm",routes:[{sourceChains:[t.Chain.BITCOIN_MAINNET],envs:[u.r.prod]},{sourceChains:[t.Chain.BITCOIN_SIGNET],envs:[u.r.stage,u.r.dev,u.r.testnet,u.r.ibc]}],destChains:t.getAllAssetChains(h.AssetId.BTCb).filter(s=>t.isEvmChain(s)),supportedAssetsOut:[h.AssetId.BTCb],addressSchema:t.evmAddressSchema,getFeeAuthConfig(s){return st.includes(s)?it:null},async signDestination(s,r,i){const e=s.capabilities.require("evm"),n=await s.getProvider("evm");if(!n)throw t.LombardError.providerMissing(String(i),"evm");return await E(n,i),{signature:(await e.signLbtcDestination({address:r,chainId:i,provider:n})).signature}}},g=rt;function at(s){return g.destChains.includes(s)}function nt(s){return g.supportedAssetsOut.includes(s)}function ot(s,r){return s?g.routes.some(i=>i.sourceChains.includes(s)&&i.envs.includes(r)):!0}class k extends m{constructor(i,e){super(i,e,t.BtcActionStatus.IDLE);A(this,"chainId");A(this,"authState",{authorized:!1});A(this,"feeAuthConfig",null);if(!nt(e.assetOut))throw new t.LombardError(t.ValidationErrorCode.INVALID_ASSET,`Asset ${e.assetOut} is not supported for BTC deposits. BTC Deposit produces BTC.b. For LBTC, use BtcStake instead.`);if(!at(e.destChain))throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Destination chain ${e.destChain} is not supported for BTC deposits. BTC.b is currently available on Avalanche and Katana.`);if(!ot(e.sourceChain,i.env))throw t.LombardError.routeNotFound({assetOut:e.assetOut,sourceChain:e.sourceChain,destChain:e.destChain,env:i.env});const n=t.parseChainIdentifier(e.destChain);if(typeof n!="number"||!p.isValidChain(n))throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Unsupported EVM chain: ${e.destChain}`);this.chainId=n}getAddressSchema(){return g.addressSchema}getStatusConfig(){return{idle:t.BtcActionStatus.IDLE,ready:t.BtcActionStatus.READY,addressReady:t.BtcActionStatus.ADDRESS_READY}}getInitialSteps(){return{created:t.StepStatus.IDLE,verifying:t.StepStatus.IDLE,issuing:t.StepStatus.IDLE}}isAuthorized(){return this.authState.authorized}getChainId(){return this.chainId}get mintingFee(){return this.authState.mintingFee}getDepositAddressParams(i){return{address:this.ensureRecipient(),chainId:this.chainId,signature:this.authState.signature,token:this.getExpectedToken(),eip712Data:this.authState.typedData,partnerId:this.ctx.partner.getPartnerId(),referrerCode:this._referralCode,captchaToken:i}}async generateDepositAddress(i){if(!this.authState.signature){const e=await g.signDestination(this.ctx,this.ensureRecipient(),this.chainId);this.authState.signature=e.signature,this.authState.typedData=e.typedData}return this.generateDepositAddressImpl(i)}getExpectedToken(){return D(this.params.assetOut,p.Token.BTCb)}getAuthRequiredMessage(){return this.feeAuthConfig?"Fee authorization required. Call authorizeFee() first.":"Address confirmation required. Call confirmAddress() first."}async prepare(i){return this.assertStatus(t.BtcActionStatus.IDLE,"prepare"),this.act(async()=>{const e=this.validatePrepareParams(i);if(this._amount=e.amount,this._recipient=e.recipient,this._referralCode=e.referralCode,this.feeAuthConfig=g.getFeeAuthConfig(this.params.destChain),await this.resumeFromExistingDeposit(e.recipient)){if(this.feeAuthConfig){const a=await this.feeAuthConfig.restoreFeeSignature(this.ctx,this.chainId,e.recipient);if(!(a!=null&&a.hasSignature)){this.authState.mintingFee=await this.feeAuthConfig.getMintingFee(this.ctx,this.chainId),this.updateStatus(t.BtcActionStatus.NEEDS_FEE_AUTHORIZATION),this.emitInitialProgress();return}a.signature&&(this.authState.signature=a.signature,this.authState.typedData=a.typedData),this.authState.authorized=!0}this.updateStatus(t.BtcActionStatus.ADDRESS_READY),this.emitInitialProgress();return}if(this.feeAuthConfig){const a=await this.feeAuthConfig.restoreFeeSignature(this.ctx,this.chainId,e.recipient);if(a!=null&&a.hasSignature){a.signature&&(this.authState.signature=a.signature,this.authState.typedData=a.typedData),this.authState.authorized=!0,this.updateStatus(t.BtcActionStatus.READY),this.emitInitialProgress();return}this.authState.mintingFee=await this.feeAuthConfig.getMintingFee(this.ctx,this.chainId),this.updateStatus(t.BtcActionStatus.NEEDS_FEE_AUTHORIZATION)}else this.updateStatus(t.BtcActionStatus.NEEDS_ADDRESS_CONFIRMATION);this.emitInitialProgress()})}async authorizeFee(){if(this.assertStatus([t.BtcActionStatus.NEEDS_FEE_AUTHORIZATION,t.BtcActionStatus.READY],"authorizeFee"),this.status===t.BtcActionStatus.READY)return;if(!this.feeAuthConfig)throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"Fee authorization is not required for this destination chain. Use confirmAddress() instead.");const i=this.ensureRecipient();if(!this.authState.mintingFee)throw new t.LombardError(t.ValidationErrorCode.INVALID_STATE,"Minting fee not available. Call prepare() first.");return this.act(async()=>{const e=await this.feeAuthConfig.authorizeFee(this.ctx,{chainId:this.chainId,recipient:i,fee:this.authState.mintingFee});this.authState.signature=e.signature,this.authState.typedData=e.typedData,this.authState.authorized=!0},t.BtcActionStatus.READY)}async confirmAddress(){if(this.assertStatus([t.BtcActionStatus.NEEDS_ADDRESS_CONFIRMATION,t.BtcActionStatus.READY],"confirmAddress"),this.status===t.BtcActionStatus.READY)return;if(this.feeAuthConfig)throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"This destination chain requires fee authorization. Use authorizeFee() instead.");const i=this.ensureRecipient();return this.act(async()=>{const e=await g.signDestination(this.ctx,i,this.chainId);this.authState.signature=e.signature,this.authState.typedData=e.typedData,this.authState.authorized=!0},t.BtcActionStatus.READY)}async execute(){return this.executeImpl()}async monitorDeposit(){return super.monitorDeposit()}}const ut=q.VEDA_VAULT_STAKE_AND_BAKE_CHAINS.map(s=>t.evmChainIdToChain(s)),dt={chainType:"evm",routes:[{sourceChains:[t.Chain.BITCOIN_MAINNET],envs:[u.r.prod]},{sourceChains:[t.Chain.BITCOIN_SIGNET],envs:[u.r.stage,u.r.dev,u.r.testnet,u.r.ibc]}],destChains:ut,supportedAssetsOut:[h.AssetId.LBTC],supportedProtocols:Dt(h.AssetId.LBTC),addressSchema:t.evmAddressSchema,async getStakeAndBakeFee(s,r,i){return s.capabilities.require("evm").getStakeAndBakeFee(r,i)},async authorizeStakeAndBake(s,{chainId:r,recipient:i,amount:e,vaultKey:n,token:a}){const o=s.capabilities.require("evm"),c=await s.getProvider("evm");if(!c)throw t.LombardError.providerMissing(String(r),"evm");await E(c,r);const d=await o.signStakeAndBake({value:e,account:i,chainId:r,provider:c,vaultKey:n,token:a});return await s.api.storeStakeAndBakeSignature({signature:d.signature,typedData:d.typedData}),{signature:d.signature,typedData:d.typedData}},async restoreStakeAndBakeSignature(s,r,i){try{const e=await b.getUserStakeAndBakeSignature({userDestinationAddress:i,chainId:r,env:s.env});return!(e.signature||e.expirationDate)||e.expirationDate&&Number(e.expirationDate)*1e3<Date.now()?null:{hasSignature:!0,signature:e.signature,depositAmount:e.depositAmount,expirationDate:e.expirationDate}}catch{return null}}},S=dt;function ct(s){return S.destChains.includes(s)}function ht(s){return S.supportedAssetsOut.includes(s)}function pt(s,r){return s?S.routes.some(i=>i.sourceChains.includes(s)&&i.envs.includes(r)):!0}function O(s){return s in h.DEFI_REGISTRY}function At(s){if(!O(s)){const r=Object.keys(h.DEFI_REGISTRY).join(", ");throw new Error(`Unsupported protocol: ${s}. Supported protocols: ${r}`)}return s}function St(s){return Object.entries(h.DEFI_REGISTRY).filter(([r,i])=>s in i).map(([r])=>r)}const L={mainnet:[t.Chain.AVALANCHE],testnet:[t.Chain.AVALANCHE_FUJI]},gt={chainType:"evm",routes:[{sourceChains:[t.Chain.BITCOIN_MAINNET],envs:[u.r.prod]},{sourceChains:[t.Chain.BITCOIN_SIGNET],envs:[u.r.stage,u.r.dev,u.r.testnet,u.r.ibc]}],destChains:[...L.mainnet,...L.testnet],supportedAssetsOut:[h.AssetId.BTCb],supportedProtocols:St(h.AssetId.BTCb),addressSchema:t.evmAddressSchema,async getDepositAndDeployFee(s,r,i){return s.capabilities.require("evm").getStakeAndBakeFee(r,i)},async authorizeDepositAndDeploy(s,{chainId:r,recipient:i,amount:e,vaultKey:n,token:a}){const o=s.capabilities.require("evm"),c=await s.getProvider("evm");if(!c)throw t.LombardError.providerMissing(String(r),"evm");await E(c,r);const d=await o.signStakeAndBake({value:e,account:i,chainId:r,provider:c,vaultKey:n,token:a});return await s.api.storeStakeAndBakeSignature({signature:d.signature,typedData:d.typedData}),{signature:d.signature,typedData:d.typedData,approvalTxHash:d.approvalTxHash}}},C=gt;function Ct(s){return C.destChains.includes(s)}function Et(s){return C.supportedAssetsOut.includes(s)}function P(s){return s in h.DEFI_REGISTRY}function R(s){if(!P(s)){const r=Object.keys(h.DEFI_REGISTRY).join(", ");throw new Error(`Unsupported protocol: ${s}. Supported protocols: ${r}`)}return s}function Dt(s){return Object.entries(h.DEFI_REGISTRY).filter(([r,i])=>s in i).map(([r])=>r)}function lt(s,r){return C.routes.some(i=>i.sourceChains.includes(s)&&i.envs.includes(r))}class F extends m{constructor(i,e){super(i,e,t.BtcActionStatus.IDLE);A(this,"chainId");A(this,"authState",{authorized:!1});if(!Et(e.assetOut))throw new t.LombardError(t.ValidationErrorCode.INVALID_ASSET,`Asset ${e.assetOut} is not supported for deposit and deploy. DepositAndDeploy produces BTC.b which is then deployed to a vault like Silo.`);if(!Ct(e.destChain))throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Destination chain ${e.destChain} is not supported for deposit and deploy. Supported chains: Avalanche, Avalanche Fuji`);if(!P(e.protocol))throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,`Protocol ${e.protocol} is not supported for deposit and deploy. DepositAndDeploy with BTC.b only supports Silo protocol.`);const n=e.sourceChain??t.Chain.BITCOIN_MAINNET;if(!lt(n,i.env))throw t.LombardError.routeNotFound({assetOut:e.assetOut,sourceChain:n,destChain:e.destChain,env:i.env});const a=t.parseChainIdentifier(e.destChain);if(typeof a!="number"||!p.isValidChain(a))throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Unsupported EVM chain: ${e.destChain}`);this.chainId=a}getAddressSchema(){return C.addressSchema}getStatusConfig(){return{idle:t.BtcActionStatus.IDLE,ready:t.BtcActionStatus.READY,addressReady:t.BtcActionStatus.ADDRESS_READY}}getInitialSteps(){return{created:t.StepStatus.IDLE,verifying:t.StepStatus.IDLE,wrapping:t.StepStatus.IDLE,depositing:t.StepStatus.IDLE}}isAuthorized(){return this.authState.authorized}getChainId(){return this.chainId}getDepositAddressParams(i){return{address:this.ensureRecipient(),chainId:this.chainId,signature:this.authState.signature,token:this.getExpectedToken(),signatureData:this.authState.typedData,partnerId:this.ctx.partner.getPartnerId(),referrerCode:this._referralCode,captchaToken:i}}getExpectedToken(){return D(this.params.assetOut,p.Token.BTCb)}getAuthRequiredMessage(){return"Deposit authorization required. Call authorizeDeposit() first."}get fee(){return this.authState.fee}async prepare(i){return this.assertStatus(t.BtcActionStatus.IDLE,"prepare"),this.act(async()=>{const e=this.validatePrepareParams(i);this._amount=e.amount,this._recipient=e.recipient,this._referralCode=e.referralCode,this.authState.fee=await C.getDepositAndDeployFee(this.ctx,this.chainId,R(this.params.protocol)),this.updateStatus(t.BtcActionStatus.NEEDS_DEPLOY_AUTHORIZATION),this.emitInitialProgress()},t.BtcActionStatus.NEEDS_DEPLOY_AUTHORIZATION)}async authorizeDeposit(){if(this.assertStatus([t.BtcActionStatus.NEEDS_DEPLOY_AUTHORIZATION,t.BtcActionStatus.READY],"authorizeDeposit"),this.status===t.BtcActionStatus.READY)return;const i=this.ensureRecipient(),e=this.ensureAmount();return this.act(async()=>{const n=l.toSatoshi(e),a=D(this.params.assetOut,p.Token.BTCb),o=await C.authorizeDepositAndDeploy(this.ctx,{chainId:this.chainId,recipient:i,amount:n.toString(),vaultKey:R(this.params.protocol),token:a});this.authState.signature=o.signature,this.authState.typedData=o.typedData,this.authState.authorized=!0},t.BtcActionStatus.READY)}async generateDepositAddress(i){return this.assertStatus(t.BtcActionStatus.READY,"generateDepositAddress"),this.ensureAuthorized(),this._depositAddress?this._depositAddress:this.act(async()=>{const e=this.getDepositAddressParams(i),n=await this.ctx.api.generateDepositAddress(e);return I(n),this._depositAddress=n,this.emitProgress({status:t.BtcActionStatus.ADDRESS_READY,steps:{created:t.StepStatus.COMPLETE,verifying:t.StepStatus.IDLE,wrapping:t.StepStatus.IDLE,depositing:t.StepStatus.IDLE},metadata:{depositAddress:n}}),n},t.BtcActionStatus.ADDRESS_READY)}async execute(){return this.act(async()=>{this.assertStatus(t.BtcActionStatus.ADDRESS_READY,"execute"),this._depositAddress||await this.generateDepositAddress();const i=this.ensureDepositAddress(),e=await this.trySendBitcoin(i);return e?{depositAddress:i,txHash:e}:{depositAddress:i}})}async monitorDeposit(){const i=this._depositAddress,e=this._recipient;if(!i||!e)throw t.LombardError.missingParameter("depositAddress or recipient");return await _({network:this.bitcoinNetwork,btcService:this.ctx.btc,fetchDeposit:async()=>{const o=(await this.ctx.api.getDeposits(e)).find(c=>c.depositAddress===i);if(o)return{blockHeight:o.blockHeight,isClaimed:o.isClaimed}},onProgress:a=>{this.emitProgress({status:this.status,steps:{created:t.StepStatus.COMPLETE,verifying:a.hasEnoughConfirmations?t.StepStatus.COMPLETE:t.StepStatus.PENDING,wrapping:a.isClaimed?t.StepStatus.COMPLETE:t.StepStatus.PENDING,depositing:t.StepStatus.PENDING},confirmations:a.confirmations,requiredConfirmations:a.requiredConfirmations,metadata:{isClaimed:a.isClaimed}})},onComplete:()=>{this.emitCompleted()}})}}const w=s=>`${s}${t.CAIP2_SEPARATOR}`;function ft(s){return String(s).startsWith(w(t.CHAIN_PREFIXES.EIP155))}function It(s){return String(s).startsWith(w(t.CHAIN_PREFIXES.SOLANA))}function mt(s){return String(s).startsWith(w(t.CHAIN_PREFIXES.SUI))}function wt(s){return String(s).startsWith(w(t.CHAIN_PREFIXES.STARKNET))}const Tt=[t.Chain.ETHEREUM,t.Chain.SEPOLIA],yt={async getMintingFee(s,r){return s.capabilities.require("evm").getMintingFee(r)},async restoreFeeSignature(s,r,i){const e=await f.getTokenContractInfo(p.Token.LBTC,r,s.env),n=await s.api.getFeeSignature({address:i,chainId:r,tokenAddress:e.address});return!n.hasSignature||n.expirationDate&&new Date(Number(n.expirationDate)*1e3)<new Date?null:{hasSignature:!0,signature:n.signature,typedData:n.typedData}},async authorizeFee(s,{chainId:r,recipient:i,fee:e}){const n=s.capabilities.require("evm"),a=await s.getProvider("evm");if(!a)throw t.LombardError.providerMissing(String(r),"evm");await E(a,r);const o=l.toSatoshi(e).toString(),c=await f.getTokenContractInfo(p.Token.LBTC,r,s.env),d=await n.signNetworkFee({fee:o,account:i,chainId:r,provider:a,token:p.Token.LBTC});return await s.api.storeFeeSignature({address:i,signature:d.signature,typedData:d.typedData,tokenAddress:c.address}),{signature:d.signature,typedData:d.typedData}}},_t={chainType:"evm",routes:[{sourceChains:[t.Chain.BITCOIN_MAINNET],envs:[u.r.prod]},{sourceChains:[t.Chain.BITCOIN_SIGNET],envs:[u.r.testnet,u.r.stage,u.r.dev,u.r.ibc]}],destChains:t.getAllAssetChains(h.AssetId.LBTC).filter(s=>ft(s)),supportedAssetsOut:[h.AssetId.LBTC],addressSchema:t.evmAddressSchema,getFeeAuthConfig(s){return Tt.includes(s)?yt:null},async getSignature(s,r,i){const e=s.capabilities.require("evm"),n=await s.getProvider("evm");if(!n)throw t.LombardError.providerMissing(String(i),"evm");return await E(n,i),e.signLbtcDestination({chainId:i,address:r,provider:n})}};function Bt(s){const r={[t.Chain.SOLANA_MAINNET]:"mainnet-beta",[t.Chain.SOLANA_DEVNET]:"devnet",[t.Chain.SOLANA_TESTNET]:"testnet","solana:mainnet-beta":"mainnet-beta","solana:devnet":"devnet","solana:testnet":"testnet"},i=r[s];if(!i)throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Unknown Solana chain: ${s}. Expected one of: ${Object.keys(r).join(", ")}`);return i}const Nt={chainType:"solana",routes:[{sourceChains:[t.Chain.BITCOIN_MAINNET],envs:[u.r.prod]},{sourceChains:[t.Chain.BITCOIN_SIGNET],envs:[u.r.testnet,u.r.stage,u.r.dev,u.r.ibc]}],destChains:t.getAllAssetChains(h.AssetId.LBTC).filter(s=>It(s)),supportedAssetsOut:[h.AssetId.LBTC],addressSchema:t.solanaAddressSchema,getFeeAuthConfig:()=>null,async getSignature(s,r,i){const e=s.capabilities.require("solana"),n=Bt(i),{signature:a}=await e.signLbtcDestination({network:n});return{signature:a}}},vt={chainType:"starknet",routes:[{sourceChains:[t.Chain.BITCOIN_MAINNET],envs:[u.r.prod]},{sourceChains:[t.Chain.BITCOIN_SIGNET],envs:[u.r.testnet,u.r.stage,u.r.dev,u.r.ibc]}],destChains:t.getAllAssetChains(h.AssetId.LBTC).filter(s=>wt(s)),supportedAssetsOut:[h.AssetId.LBTC],addressSchema:t.starknetAddressSchema,getFeeAuthConfig:()=>null,async getSignature(s,r,i){const e=s.capabilities.require("starknet"),{signature:n,pubKey:a}=await e.signLbtcDestination({chainId:i}),o=$.pad(r,{size:32});return{signature:n,pubKey:a,paddedAddress:o}}},Lt={chainType:"sui",routes:[{sourceChains:[t.Chain.BITCOIN_MAINNET],envs:[u.r.prod]},{sourceChains:[t.Chain.BITCOIN_SIGNET],envs:[u.r.testnet,u.r.stage,u.r.dev,u.r.ibc]}],destChains:t.getAllAssetChains(h.AssetId.LBTC).filter(s=>mt(s)),supportedAssetsOut:[h.AssetId.LBTC],addressSchema:t.suiAddressSchema,getFeeAuthConfig:()=>null,async getSignature(s,r,i){const e=s.capabilities.require("sui"),{signature:n}=await e.signLbtcDestination({chainId:i});return{signature:n}}},Rt={evm:_t,solana:Nt,sui:Lt,starknet:vt};function bt(s){return Rt[s]}function kt(s,r,i){return r?s.routes.some(e=>e.sourceChains.includes(r)&&e.envs.includes(i)):!0}function Ot(s,r){return s.destChains.includes(r)}function Pt(s,r){return s.supportedAssetsOut.includes(r)}class x extends m{constructor(i,e){super(i,e,t.BtcActionStatus.IDLE);A(this,"config");A(this,"chainId");A(this,"authState",{authorized:!1});A(this,"feeAuthConfig",null);const n=t.getChainType(e.destChain),a=bt(n);if(!a)throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Unsupported destination chain type: ${n} (${e.destChain})`);if(!Pt(a,e.assetOut))throw new t.LombardError(t.ValidationErrorCode.INVALID_ASSET,`Asset ${e.assetOut} is not supported for BTC staking. BTC Stake produces LBTC. For BTC.b, use BtcDeposit instead.`);if(!Ot(a,e.destChain))throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Destination chain ${e.destChain} is not supported for ${n}`);if(!kt(a,e.sourceChain,i.env))throw t.LombardError.routeNotFound({assetOut:e.assetOut,sourceChain:e.sourceChain,destChain:e.destChain,env:i.env});this.config=a,this.chainId=t.parseChainIdentifier(e.destChain)}getAddressSchema(){return this.config.addressSchema}getStatusConfig(){return{idle:t.BtcActionStatus.IDLE,ready:t.BtcActionStatus.READY,addressReady:t.BtcActionStatus.ADDRESS_READY}}getInitialSteps(){return{created:t.StepStatus.IDLE,verifying:t.StepStatus.IDLE,issuing:t.StepStatus.IDLE}}isAuthorized(){return this.authState.authorized}getChainId(){return this.chainId}getDepositAddressParams(i){var a;const e=this.ensureRecipient(),n=this.getActiveSignature();if(!n)throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"Missing signature. Complete authorization first.");return{address:n.paddedAddress??e,chainId:this.chainId,signature:n.signature,token:this.getExpectedToken(),eip712Data:(a=this.authState.networkFee)==null?void 0:a.typedData,pubKey:n.pubKey,partnerId:this.ctx.partner.getPartnerId(),referrerCode:this._referralCode,captchaToken:i}}getExpectedToken(){return D(this.params.assetOut,p.Token.LBTC)}getAuthRequiredMessage(){return"Authorization required. Call authorize() first."}get mintingFee(){return this.authState.mintingFee}async prepare(i){return this.assertStatus(t.BtcActionStatus.IDLE,"prepare"),this.act(async()=>{const e=this.validatePrepareParams(i);if(this._amount=e.amount,this._recipient=e.recipient,this._referralCode=e.referralCode,this.feeAuthConfig=this.config.getFeeAuthConfig(this.params.destChain),await this.resumeFromExistingDeposit(e.recipient)){if(this.feeAuthConfig){const a=await this.feeAuthConfig.restoreFeeSignature(this.ctx,this.chainId,e.recipient);if(!(a!=null&&a.hasSignature)){this.authState.mintingFee=await this.feeAuthConfig.getMintingFee(this.ctx,this.chainId),this.updateStatus(t.BtcActionStatus.NEEDS_FEE_AUTHORIZATION),this.emitInitialProgress();return}a.signature&&(this.authState.networkFee={signature:a.signature,typedData:a.typedData}),this.authState.authorized=!0}this.updateStatus(t.BtcActionStatus.ADDRESS_READY),this.emitInitialProgress();return}if(this.feeAuthConfig){const a=await this.feeAuthConfig.restoreFeeSignature(this.ctx,this.chainId,e.recipient);if(a!=null&&a.hasSignature){a.signature&&(this.authState.networkFee={signature:a.signature,typedData:a.typedData}),this.authState.authorized=!0,this.updateStatus(t.BtcActionStatus.READY),this.emitInitialProgress();return}this.authState.mintingFee=await this.feeAuthConfig.getMintingFee(this.ctx,this.chainId),this.updateStatus(t.BtcActionStatus.NEEDS_FEE_AUTHORIZATION)}else this.updateStatus(t.BtcActionStatus.NEEDS_ADDRESS_CONFIRMATION);this.emitInitialProgress()})}async authorize(){if(this.assertStatus([t.BtcActionStatus.NEEDS_FEE_AUTHORIZATION,t.BtcActionStatus.NEEDS_ADDRESS_CONFIRMATION,t.BtcActionStatus.READY],"authorize"),this.status===t.BtcActionStatus.READY)return;const i=this.ensureRecipient(),e=this.feeAuthConfig!==null;return this.act(async()=>{if(e){const n=this.ensureMintingFee(),a=await this.feeAuthConfig.authorizeFee(this.ctx,{chainId:this.chainId,recipient:i,fee:n});this.authState.networkFee={signature:a.signature,typedData:a.typedData}}else this.authState.destinationSignature=await this.config.getSignature(this.ctx,i,this.chainId);this.authState.authorized=!0},t.BtcActionStatus.READY)}async generateDepositAddress(i){if(this.assertStatus(t.BtcActionStatus.READY,"generateDepositAddress"),this.ensureAuthorized(),this._depositAddress)return this._depositAddress;if(!this.getActiveSignature()){const e=await this.config.getSignature(this.ctx,this.ensureRecipient(),this.chainId);this.authState.destinationSignature=e}return this.act(async()=>{const e=this.getDepositAddressParams(i),n=await this.ctx.api.generateDepositAddress(e);return I(n),this._depositAddress=n,this.emitProgress({status:t.BtcActionStatus.ADDRESS_READY,steps:{created:t.StepStatus.COMPLETE,verifying:t.StepStatus.IDLE,issuing:t.StepStatus.IDLE},metadata:{depositAddress:n}}),n},t.BtcActionStatus.ADDRESS_READY)}async execute(){return this.executeImpl()}async monitorDeposit(){return super.monitorDeposit()}ensureMintingFee(){if(!this.authState.mintingFee)throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"Minting fee not fetched. Call prepare() first.");return this.authState.mintingFee}getActiveSignature(){var i;return(i=this.authState.networkFee)!=null&&i.signature?{signature:this.authState.networkFee.signature}:this.authState.destinationSignature}}class M extends m{constructor(i,e){super(i,e,t.BtcActionStatus.IDLE);A(this,"chainId");A(this,"authState",{authorized:!1});if(!ht(e.assetOut))throw new t.LombardError(t.ValidationErrorCode.INVALID_ASSET,`Asset ${e.assetOut} is not supported for stake and deploy. StakeAndDeploy produces LBTC which is then deployed to a vault.`);if(!ct(e.destChain))throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Destination chain ${e.destChain} is not supported for stake and deploy`);if(!O(e.protocol))throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,`Protocol ${e.protocol} is not supported for stake and deploy`);if(!pt(e.sourceChain,i.env))throw t.LombardError.routeNotFound({assetOut:e.assetOut,sourceChain:e.sourceChain,destChain:e.destChain,env:i.env});const n=t.parseChainIdentifier(e.destChain);if(typeof n!="number"||!p.isValidChain(n))throw new t.LombardError(t.ValidationErrorCode.INVALID_CHAIN,`Unsupported EVM chain: ${e.destChain}`);this.chainId=n}getAddressSchema(){return S.addressSchema}getStatusConfig(){return{idle:t.BtcActionStatus.IDLE,ready:t.BtcActionStatus.READY,addressReady:t.BtcActionStatus.ADDRESS_READY}}getInitialSteps(){return{created:t.StepStatus.IDLE,verifying:t.StepStatus.IDLE,issuing:t.StepStatus.IDLE,depositing:t.StepStatus.IDLE}}isAuthorized(){return this.authState.authorized}getChainId(){return this.chainId}getDepositAddressParams(i){return{address:this.ensureRecipient(),chainId:this.chainId,signature:this.authState.signature,token:this.getExpectedToken(),signatureData:this.authState.typedData,partnerId:this.ctx.partner.getPartnerId(),referrerCode:this._referralCode,captchaToken:i}}getExpectedToken(){return D(this.params.assetOut,p.Token.LBTC)}getAuthRequiredMessage(){return"Deposit authorization required. Call authorizeDeposit() first."}get fee(){return this.authState.fee}async prepare(i){return this.assertStatus(t.BtcActionStatus.IDLE,"prepare"),this.act(async()=>{const e=this.validatePrepareParams(i);if(this._amount=e.amount,this._recipient=e.recipient,this._referralCode=e.referralCode,this.authState.fee=await S.getStakeAndBakeFee(this.ctx,this.chainId,this.params.protocol),await this.resumeFromExistingDeposit(e.recipient)){const o=await S.restoreStakeAndBakeSignature(this.ctx,this.chainId,e.recipient);if(o!=null&&o.hasSignature){o.signature&&(this.authState.signature=o.signature),this.authState.authorized=!0,this.updateStatus(t.BtcActionStatus.ADDRESS_READY),this.emitInitialProgress();return}this.updateStatus(t.BtcActionStatus.NEEDS_DEPLOY_AUTHORIZATION),this.emitInitialProgress();return}const a=await S.restoreStakeAndBakeSignature(this.ctx,this.chainId,e.recipient);if(a!=null&&a.hasSignature){a.signature&&(this.authState.signature=a.signature),this.authState.authorized=!0,this.updateStatus(t.BtcActionStatus.READY),this.emitInitialProgress();return}this.updateStatus(t.BtcActionStatus.NEEDS_DEPLOY_AUTHORIZATION),this.emitInitialProgress()})}async authorizeDeposit(){if(this.assertStatus([t.BtcActionStatus.NEEDS_DEPLOY_AUTHORIZATION,t.BtcActionStatus.READY],"authorizeDeposit"),this.status===t.BtcActionStatus.READY)return;const i=this.ensureRecipient(),e=this.ensureAmount();return this.act(async()=>{const n=l.toSatoshi(e),a=this.params.assetIn??h.AssetId.BTC,o=await S.authorizeStakeAndBake(this.ctx,{chainId:this.chainId,recipient:i,amount:n.toString(),vaultKey:At(this.params.protocol),token:a});this.authState.signature=o.signature,this.authState.typedData=o.typedData,this.authState.authorized=!0},t.BtcActionStatus.READY)}async generateDepositAddress(i){return this.assertStatus(t.BtcActionStatus.READY,"generateDepositAddress"),this.ensureAuthorized(),this._depositAddress?this._depositAddress:this.act(async()=>{const e=this.getDepositAddressParams(i),n=await this.ctx.api.generateDepositAddress(e);return I(n),this._depositAddress=n,this.emitProgress({status:t.BtcActionStatus.ADDRESS_READY,steps:{created:t.StepStatus.COMPLETE,verifying:t.StepStatus.IDLE,issuing:t.StepStatus.IDLE,depositing:t.StepStatus.IDLE},metadata:{depositAddress:n}}),n},t.BtcActionStatus.ADDRESS_READY)}async execute(){return this.act(async()=>{this.assertStatus(t.BtcActionStatus.ADDRESS_READY,"execute"),this._depositAddress||await this.generateDepositAddress();const i=this.ensureDepositAddress(),e=await this.trySendBitcoin(i);return e?{depositAddress:i,txHash:e}:{depositAddress:i}})}async monitorDeposit(){const i=this._depositAddress,e=this._recipient;if(!i||!e)throw t.LombardError.missingParameter("depositAddress or recipient");return await _({network:this.bitcoinNetwork,btcService:this.ctx.btc,fetchDeposit:async()=>{const o=(await this.ctx.api.getDeposits(e)).find(c=>c.depositAddress===i);if(o)return{blockHeight:o.blockHeight,isClaimed:o.isClaimed}},onProgress:a=>{this.emitProgress({status:this.status,steps:{created:t.StepStatus.COMPLETE,verifying:a.hasEnoughConfirmations?t.StepStatus.COMPLETE:t.StepStatus.PENDING,issuing:a.isClaimed?t.StepStatus.COMPLETE:t.StepStatus.PENDING,depositing:t.StepStatus.PENDING},confirmations:a.confirmations,requiredConfirmations:a.requiredConfirmations,metadata:{isClaimed:a.isClaimed}})},onComplete:()=>{this.emitCompleted()}})}}class V{constructor(r){A(this,"ctx");this.ctx=t.createBtcCoreContext(r)}stake(r){return new x(this.ctx,r)}stakeAndDeploy(r){return new M(this.ctx,r)}deposit(r){return new k(this.ctx,r)}depositAndDeploy(r){return new F(this.ctx,r)}}function Ft(s){return new V(s)}exports.BtcActions=V;exports.BtcDeposit=k;exports.BtcDepositAndDeploy=F;exports.BtcStake=x;exports.BtcStakeAndDeploy=M;exports.btcActions=Ft;exports.btcModule=Q;
|
|
2
|
-
//# sourceMappingURL=BtcActions-XbVRQEcM.cjs.map
|