@lombard.finance/sdk 4.6.0 → 4.7.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 +23 -0
- package/README.md +8 -4
- package/dist/api-functions/getDepositsByAddress/getDepositsByAddress.d.ts +4 -0
- package/dist/api-functions/getDepositsByAddress/getDepositsByAddress.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/config/solana.d.ts.map +1 -1
- package/dist/chains/solana/SolanaActions.d.ts +24 -6
- 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 +5 -9
- package/dist/chains/solana/actions/redeem/SolanaRedeem.d.ts.map +1 -1
- package/dist/chains/solana/actions/redeem/config/solana.d.ts +1 -10
- package/dist/chains/solana/actions/redeem/config/solana.d.ts.map +1 -1
- package/dist/chains/solana/actions/redeem/config/types.d.ts +0 -14
- package/dist/chains/solana/actions/redeem/config/types.d.ts.map +1 -1
- package/dist/chains/solana/actions/redeem/factory.d.ts +0 -3
- package/dist/chains/solana/actions/redeem/factory.d.ts.map +1 -1
- package/dist/chains/solana/actions/redeem/types.d.ts +5 -17
- package/dist/chains/solana/actions/redeem/types.d.ts.map +1 -1
- package/dist/chains/solana/actions/stake/SolanaStake.d.ts +33 -0
- package/dist/chains/solana/actions/stake/SolanaStake.d.ts.map +1 -0
- package/dist/chains/solana/actions/stake/config/index.d.ts +8 -0
- package/dist/chains/solana/actions/stake/config/index.d.ts.map +1 -0
- package/dist/chains/solana/actions/stake/config/solana.d.ts +13 -0
- package/dist/chains/solana/actions/stake/config/solana.d.ts.map +1 -0
- package/dist/chains/solana/actions/stake/config/types.d.ts +20 -0
- package/dist/chains/solana/actions/stake/config/types.d.ts.map +1 -0
- package/dist/chains/solana/actions/stake/factory.d.ts +9 -0
- package/dist/chains/solana/actions/stake/factory.d.ts.map +1 -0
- package/dist/chains/solana/actions/stake/index.d.ts +9 -0
- package/dist/chains/solana/actions/stake/index.d.ts.map +1 -0
- package/dist/chains/solana/actions/stake/types.d.ts +39 -0
- package/dist/chains/solana/actions/stake/types.d.ts.map +1 -0
- package/dist/chains/solana/actions/unstake/SolanaUnstake.d.ts +7 -4
- package/dist/chains/solana/actions/unstake/SolanaUnstake.d.ts.map +1 -1
- package/dist/chains/solana/actions/unstake/config/btc.d.ts +13 -7
- package/dist/chains/solana/actions/unstake/config/btc.d.ts.map +1 -1
- package/dist/chains/solana/actions/unstake/config/index.d.ts +1 -1
- package/dist/chains/solana/actions/unstake/config/index.d.ts.map +1 -1
- package/dist/chains/solana/actions/unstake/config/types.d.ts +6 -2
- package/dist/chains/solana/actions/unstake/config/types.d.ts.map +1 -1
- package/dist/chains/solana/actions/unstake/types.d.ts +4 -4
- package/dist/chains/solana/actions/unstake/types.d.ts.map +1 -1
- package/dist/chains/solana/utils.d.ts +2 -0
- package/dist/chains/solana/utils.d.ts.map +1 -1
- package/dist/chains/starknet/actions/unstake/StarknetUnstake.d.ts +2 -2
- package/dist/chains/starknet/actions/unstake/StarknetUnstake.d.ts.map +1 -1
- package/dist/chains/starknet/actions/unstake/types.d.ts +4 -4
- package/dist/chains/starknet/actions/unstake/types.d.ts.map +1 -1
- package/dist/chains/sui/actions/unstake/SuiUnstake.d.ts +2 -2
- package/dist/chains/sui/actions/unstake/SuiUnstake.d.ts.map +1 -1
- package/dist/chains/sui/actions/unstake/types.d.ts +4 -4
- package/dist/chains/sui/actions/unstake/types.d.ts.map +1 -1
- package/dist/chunks/BtcActions-CWFHlbUP.cjs +2 -0
- package/dist/chunks/BtcActions-CWFHlbUP.cjs.map +1 -0
- package/dist/chunks/{BtcActions-CI5XotUx.js → BtcActions-jvzGFmpz.js} +12 -8
- package/dist/chunks/BtcActions-jvzGFmpz.js.map +1 -0
- package/dist/chunks/{EvmActions-D_sFfTAK.cjs → EvmActions-BTKQAXTE.cjs} +2 -2
- package/dist/chunks/{EvmActions-D_sFfTAK.cjs.map → EvmActions-BTKQAXTE.cjs.map} +1 -1
- package/dist/chunks/{EvmActions-C7EKF3jb.js → EvmActions-hb-FhsLJ.js} +9 -9
- package/dist/chunks/{EvmActions-C7EKF3jb.js.map → EvmActions-hb-FhsLJ.js.map} +1 -1
- package/dist/chunks/ReferralsClient-D8dHEk_X.cjs +2 -0
- package/dist/chunks/ReferralsClient-D8dHEk_X.cjs.map +1 -0
- package/dist/chunks/{ReferralsClient-AxhLoWRT.js → ReferralsClient-W-0-383w.js} +58 -58
- package/dist/chunks/ReferralsClient-W-0-383w.js.map +1 -0
- package/dist/chunks/{approveLBTC-CUXEC3kw.cjs → approveLBTC-BMC4cZEk.cjs} +2 -2
- package/dist/chunks/{approveLBTC-CUXEC3kw.cjs.map → approveLBTC-BMC4cZEk.cjs.map} +1 -1
- package/dist/chunks/{approveLBTC-Du2El1tW.js → approveLBTC-BkdT1N3V.js} +3 -3
- package/dist/chunks/{approveLBTC-Du2El1tW.js.map → approveLBTC-BkdT1N3V.js.map} +1 -1
- package/dist/chunks/{blockchain-identifier-CTVaEPpY.js → blockchain-identifier-BLPnwbIN.js} +2 -2
- package/dist/chunks/{blockchain-identifier-CTVaEPpY.js.map → blockchain-identifier-BLPnwbIN.js.map} +1 -1
- package/dist/chunks/{blockchain-identifier-BTPGxLio.cjs → blockchain-identifier-Bp-LTIdG.cjs} +2 -2
- package/dist/chunks/{blockchain-identifier-BTPGxLio.cjs.map → blockchain-identifier-Bp-LTIdG.cjs.map} +1 -1
- package/dist/chunks/{bridge-dWaKrMKm.cjs → bridge-7Eq_Jmi2.cjs} +2 -2
- package/dist/chunks/{bridge-dWaKrMKm.cjs.map → bridge-7Eq_Jmi2.cjs.map} +1 -1
- package/dist/chunks/{bridge-DqGabhIY.js → bridge-DbB23m2a.js} +4 -4
- package/dist/chunks/{bridge-DqGabhIY.js.map → bridge-DbB23m2a.js.map} +1 -1
- package/dist/chunks/{config-JT3GvwPB.js → config-C8BfN_9P.js} +2 -2
- package/dist/chunks/{config-JT3GvwPB.js.map → config-C8BfN_9P.js.map} +1 -1
- package/dist/chunks/{config-CSo0k7gN.cjs → config-ow9X5H0c.cjs} +2 -2
- package/dist/chunks/{config-CSo0k7gN.cjs.map → config-ow9X5H0c.cjs.map} +1 -1
- package/dist/chunks/{defi-registry-hHpGoh1m.cjs → defi-registry-B8V6dRVB.cjs} +2 -2
- package/dist/chunks/{defi-registry-hHpGoh1m.cjs.map → defi-registry-B8V6dRVB.cjs.map} +1 -1
- package/dist/chunks/{defi-registry-ig-wro_O.js → defi-registry-CD8EUcNu.js} +3 -3
- package/dist/chunks/{defi-registry-ig-wro_O.js.map → defi-registry-CD8EUcNu.js.map} +1 -1
- package/dist/chunks/depositStatus-BJA7tNqc.cjs +2 -0
- package/dist/chunks/{depositStatus-D5t8HN_A.cjs.map → depositStatus-BJA7tNqc.cjs.map} +1 -1
- package/dist/chunks/{depositStatus-BrrE4n4B.js → depositStatus-HosfExLl.js} +38 -37
- package/dist/chunks/{depositStatus-BrrE4n4B.js.map → depositStatus-HosfExLl.js.map} +1 -1
- package/dist/chunks/events-BTPDrUUu.cjs +2 -0
- package/dist/chunks/events-BTPDrUUu.cjs.map +1 -0
- package/dist/chunks/events-DAiXVdGv.js +1274 -0
- package/dist/chunks/events-DAiXVdGv.js.map +1 -0
- package/dist/chunks/{get-exchange-ratio-B-xzYND1.js → get-exchange-ratio-Bl6pt546.js} +2 -2
- package/dist/chunks/{get-exchange-ratio-B-xzYND1.js.map → get-exchange-ratio-Bl6pt546.js.map} +1 -1
- package/dist/chunks/{get-exchange-ratio-BEhD4gLB.cjs → get-exchange-ratio-t1PW8I6_.cjs} +2 -2
- package/dist/chunks/{get-exchange-ratio-BEhD4gLB.cjs.map → get-exchange-ratio-t1PW8I6_.cjs.map} +1 -1
- package/dist/chunks/{get-positions-summary-iYshN1RQ.js → get-positions-summary-CaX2BCHp.js} +2 -2
- package/dist/chunks/{get-positions-summary-iYshN1RQ.js.map → get-positions-summary-CaX2BCHp.js.map} +1 -1
- package/dist/chunks/{get-positions-summary-Dh1QPLYO.cjs → get-positions-summary-DdZvBmCN.cjs} +2 -2
- package/dist/chunks/{get-positions-summary-Dh1QPLYO.cjs.map → get-positions-summary-DdZvBmCN.cjs.map} +1 -1
- package/dist/chunks/{get-vault-tvl-C3Yr4MI4.js → get-vault-tvl-CihHEkqK.js} +4 -4
- package/dist/chunks/{get-vault-tvl-C3Yr4MI4.js.map → get-vault-tvl-CihHEkqK.js.map} +1 -1
- package/dist/chunks/{get-vault-tvl-CRbxkHmr.cjs → get-vault-tvl-DZ-xzehy.cjs} +2 -2
- package/dist/chunks/{get-vault-tvl-CRbxkHmr.cjs.map → get-vault-tvl-DZ-xzehy.cjs.map} +1 -1
- package/dist/chunks/{get-vault-withdrawals-QqvpZnxA.cjs → get-vault-withdrawals-DLwFMQEB.cjs} +2 -2
- package/dist/chunks/{get-vault-withdrawals-QqvpZnxA.cjs.map → get-vault-withdrawals-DLwFMQEB.cjs.map} +1 -1
- package/dist/chunks/{get-vault-withdrawals-CQwNiILS.js → get-vault-withdrawals-QJOdxB5Z.js} +3 -3
- package/dist/chunks/{get-vault-withdrawals-CQwNiILS.js.map → get-vault-withdrawals-QJOdxB5Z.js.map} +1 -1
- package/dist/chunks/{getUserStakeAndBakeSignature-CSEyzgMc.cjs → getUserStakeAndBakeSignature-BmY5j0OM.cjs} +2 -2
- package/dist/chunks/{getUserStakeAndBakeSignature-CSEyzgMc.cjs.map → getUserStakeAndBakeSignature-BmY5j0OM.cjs.map} +1 -1
- package/dist/chunks/{getUserStakeAndBakeSignature-Su-k10ap.js → getUserStakeAndBakeSignature-CqlrwA0t.js} +4 -4
- package/dist/chunks/{getUserStakeAndBakeSignature-Su-k10ap.js.map → getUserStakeAndBakeSignature-CqlrwA0t.js.map} +1 -1
- package/dist/chunks/{lbtc-addresses-D8MYCdsx.js → lbtc-addresses-BlyGFWnW.js} +2 -2
- package/dist/chunks/{lbtc-addresses-D8MYCdsx.js.map → lbtc-addresses-BlyGFWnW.js.map} +1 -1
- package/dist/chunks/{lbtc-addresses-Kil252DX.cjs → lbtc-addresses-DjsipX5Q.cjs} +2 -2
- package/dist/chunks/{lbtc-addresses-Kil252DX.cjs.map → lbtc-addresses-DjsipX5Q.cjs.map} +1 -1
- package/dist/chunks/statusConstants-BTQAvx1I.cjs +2 -0
- package/dist/chunks/statusConstants-BTQAvx1I.cjs.map +1 -0
- package/dist/chunks/{statusConstants-BU4PglPs.js → statusConstants-D9eSk91U.js} +53 -43
- package/dist/chunks/statusConstants-D9eSk91U.js.map +1 -0
- package/dist/chunks/{storeNetworkFeeSignature-Buk4091C.cjs → storeNetworkFeeSignature-CLm8I2pf.cjs} +2 -2
- package/dist/chunks/{storeNetworkFeeSignature-Buk4091C.cjs.map → storeNetworkFeeSignature-CLm8I2pf.cjs.map} +1 -1
- package/dist/chunks/{storeNetworkFeeSignature-BODIpq3Y.js → storeNetworkFeeSignature-tprCigR1.js} +2 -2
- package/dist/chunks/{storeNetworkFeeSignature-BODIpq3Y.js.map → storeNetworkFeeSignature-tprCigR1.js.map} +1 -1
- package/dist/chunks/{token-addresses-D0v5cR1j.js → token-addresses-Ddar0FyS.js} +130 -124
- package/dist/chunks/token-addresses-Ddar0FyS.js.map +1 -0
- package/dist/chunks/{token-addresses-nzvTOi24.cjs → token-addresses-DvY-Mw7b.cjs} +2 -2
- package/dist/chunks/token-addresses-DvY-Mw7b.cjs.map +1 -0
- package/dist/chunks/{tokens-BkvA0Gp1.cjs → tokens-CBsz6l_2.cjs} +2 -2
- package/dist/chunks/{tokens-BkvA0Gp1.cjs.map → tokens-CBsz6l_2.cjs.map} +1 -1
- package/dist/chunks/{tokens-DgC1hfkm.js → tokens-HhVpKe3K.js} +2 -2
- package/dist/chunks/{tokens-DgC1hfkm.js.map → tokens-HhVpKe3K.js.map} +1 -1
- package/dist/chunks/{unstakeLBTC-BrVLnaac.js → unstakeLBTC-Bg8OsAMV.js} +5 -5
- package/dist/chunks/{unstakeLBTC-BrVLnaac.js.map → unstakeLBTC-Bg8OsAMV.js.map} +1 -1
- package/dist/chunks/{unstakeLBTC-3bwLj1qT.cjs → unstakeLBTC-BmHvDxBN.cjs} +2 -2
- package/dist/chunks/{unstakeLBTC-3bwLj1qT.cjs.map → unstakeLBTC-BmHvDxBN.cjs.map} +1 -1
- package/dist/chunks/{withdraw-BKEovicU.cjs → withdraw-Bkp5-2dG.cjs} +2 -2
- package/dist/chunks/{withdraw-BKEovicU.cjs.map → withdraw-Bkp5-2dG.cjs.map} +1 -1
- package/dist/chunks/{withdraw-rndehhDn.js → withdraw-kf8mYbYH.js} +4 -4
- package/dist/chunks/{withdraw-rndehhDn.js.map → withdraw-kf8mYbYH.js.map} +1 -1
- package/dist/chunks/{wrapToBtce-CML1FYEZ.js → wrapToBtce-By2mh503.js} +5 -5
- package/dist/chunks/{wrapToBtce-CML1FYEZ.js.map → wrapToBtce-By2mh503.js.map} +1 -1
- package/dist/chunks/{wrapToBtce-BVu8ALEo.cjs → wrapToBtce-DDeIlv3d.cjs} +2 -2
- package/dist/chunks/{wrapToBtce-BVu8ALEo.cjs.map → wrapToBtce-DDeIlv3d.cjs.map} +1 -1
- package/dist/contracts.cjs +1 -1
- package/dist/contracts.js +3 -3
- package/dist/core/assets/catalog.d.ts.map +1 -1
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +32 -32
- package/dist/defi.cjs +1 -1
- package/dist/defi.js +2 -2
- package/dist/entries/core.d.ts +1 -1
- package/dist/entries/core.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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -36
- package/dist/metrics.cjs +1 -1
- package/dist/metrics.js +1 -1
- package/dist/shared/constants/statusConstants.d.ts +7 -3
- package/dist/shared/constants/statusConstants.d.ts.map +1 -1
- package/dist/shared/deposits/depositStatus.d.ts.map +1 -1
- package/dist/tokens/token-addresses.d.ts.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +4 -4
- package/dist/vaults.cjs +1 -1
- package/dist/vaults.js +7 -7
- package/package.json +2 -2
- package/dist/chains/solana/actions/unstake/config/solana.d.ts +0 -21
- package/dist/chains/solana/actions/unstake/config/solana.d.ts.map +0 -1
- package/dist/chunks/BtcActions-Bic_HKkw.cjs +0 -2
- package/dist/chunks/BtcActions-Bic_HKkw.cjs.map +0 -1
- package/dist/chunks/BtcActions-CI5XotUx.js.map +0 -1
- package/dist/chunks/ReferralsClient-AxhLoWRT.js.map +0 -1
- package/dist/chunks/ReferralsClient-bZo9Jpg6.cjs +0 -2
- package/dist/chunks/ReferralsClient-bZo9Jpg6.cjs.map +0 -1
- package/dist/chunks/depositStatus-D5t8HN_A.cjs +0 -2
- package/dist/chunks/events-BfRsYM_-.cjs +0 -2
- package/dist/chunks/events-BfRsYM_-.cjs.map +0 -1
- package/dist/chunks/events-LMs7IA1e.js +0 -1108
- package/dist/chunks/events-LMs7IA1e.js.map +0 -1
- package/dist/chunks/statusConstants-BU4PglPs.js.map +0 -1
- package/dist/chunks/statusConstants-CCKi5qUm.cjs +0 -2
- package/dist/chunks/statusConstants-CCKi5qUm.cjs.map +0 -1
- package/dist/chunks/token-addresses-D0v5cR1j.js.map +0 -1
- package/dist/chunks/token-addresses-nzvTOi24.cjs.map +0 -1
|
@@ -0,0 +1,1274 @@
|
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var q = (s, t, e) => t in s ? $(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var a = (s, t, e) => q(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import "axios";
|
|
5
|
+
import { SDK_RUNTIME as z, SDK_VERSION as W, LombardError as d, bitcoinAddressSchema as I, Chain as h, BaseAction as C, NonEvmOperationStatus as i, validatePrepareParams as f, StepStatus as o, objectType as E, amountSchema as A, solanaAddressSchema as w, CapabilityRegistry as S, PartnerConfiguration as _, getProviderGetter as D, ASSET_CATALOG as b, getAssetAddress as X, getAssetDecimals as Z, getAssetMetadata as J, usesAssetRouter as Q, getAssetRouter as tt, getBridgeAdapter as et, getPublicMarketMaker as st, getAssetByAddress as nt, isAssetDeployed as rt, getAssetChains as it, getAssetEnvironments as at, getSupportedAssets as ot, ProviderErrorCode as ct } from "./statusConstants-D9eSk91U.js";
|
|
6
|
+
import { generateDepositBtcAddress as ut } from "./getUserStakeAndBakeSignature-CqlrwA0t.js";
|
|
7
|
+
import { getDepositsByAddress as y, getUnstakesByAddress as ht, getPointsByAddress as dt, getDepositBtcAddress as O, storeStakeAndBakeSignature as gt, ReferralsClient as lt } from "./ReferralsClient-W-0-383w.js";
|
|
8
|
+
import { storeNetworkFeeSignature as pt, getNetworkFeeSignature as mt } from "./storeNetworkFeeSignature-tprCigR1.js";
|
|
9
|
+
import { btcModule as vt, BtcActions as Ct } from "./BtcActions-jvzGFmpz.js";
|
|
10
|
+
import { evmModule as ft, EvmActions as Et } from "./EvmActions-hb-FhsLJ.js";
|
|
11
|
+
import { SOLANA_DEVNET_CHAIN as At, SOLANA_MAINNET_CHAIN as It, getSolanaTokenAddress as L, Token as k } from "./token-addresses-Ddar0FyS.js";
|
|
12
|
+
import { toSatoshi as T } from "./satoshi-CSoJBXc6.js";
|
|
13
|
+
import { p as B, r as c } from "./index-CfcQ_g3t.js";
|
|
14
|
+
import { AssetId as g } from "./defi-registry-CD8EUcNu.js";
|
|
15
|
+
import { getExchangeRatio as St } from "./get-exchange-ratio-Bl6pt546.js";
|
|
16
|
+
import { Vault as _t } from "./config-C8BfN_9P.js";
|
|
17
|
+
import { getVaultWithdrawals as Dt, getVaultWithdrawalsAllChains as Nt } from "./get-vault-withdrawals-QJOdxB5Z.js";
|
|
18
|
+
const P = ["debug", "info", "warn", "error", "none"];
|
|
19
|
+
function Tt(s = {}) {
|
|
20
|
+
const { level: t = "debug", prefix: e = "[Lombard SDK]", timestamp: n = !1 } = s, r = P.indexOf(t), u = (p) => P.indexOf(p) >= r && t !== "none", l = (p) => {
|
|
21
|
+
if (n) {
|
|
22
|
+
const v = (/* @__PURE__ */ new Date()).toISOString();
|
|
23
|
+
return `${e} ${v} ${p}`;
|
|
24
|
+
}
|
|
25
|
+
return `${e} ${p}`;
|
|
26
|
+
}, m = (p) => !p || Object.keys(p).length === 0 ? [] : [p];
|
|
27
|
+
return {
|
|
28
|
+
debug(p, v) {
|
|
29
|
+
u("debug") && console.debug(l(p), ...m(v));
|
|
30
|
+
},
|
|
31
|
+
info(p, v) {
|
|
32
|
+
u("info") && console.info(l(p), ...m(v));
|
|
33
|
+
},
|
|
34
|
+
warn(p, v) {
|
|
35
|
+
u("warn") && console.warn(l(p), ...m(v));
|
|
36
|
+
},
|
|
37
|
+
error(p, v) {
|
|
38
|
+
u("error") && console.error(l(p), ...m(v));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function me() {
|
|
43
|
+
return {
|
|
44
|
+
debug: () => {
|
|
45
|
+
},
|
|
46
|
+
info: () => {
|
|
47
|
+
},
|
|
48
|
+
warn: () => {
|
|
49
|
+
},
|
|
50
|
+
error: () => {
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function ve() {
|
|
55
|
+
return {
|
|
56
|
+
"X-SDK-Version": W,
|
|
57
|
+
"X-SDK-Runtime": z
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
class xt {
|
|
61
|
+
constructor(t = B) {
|
|
62
|
+
/**
|
|
63
|
+
* Internal API version flag for future v2 migration.
|
|
64
|
+
* When v2 is ready, we can switch implementations transparently.
|
|
65
|
+
*/
|
|
66
|
+
a(this, "apiVersion", "v1");
|
|
67
|
+
this.env = t;
|
|
68
|
+
}
|
|
69
|
+
/* -------------------------------------------------------------------------- */
|
|
70
|
+
/* Deposits */
|
|
71
|
+
/* -------------------------------------------------------------------------- */
|
|
72
|
+
/**
|
|
73
|
+
* Fetch all deposits for an address.
|
|
74
|
+
*
|
|
75
|
+
* Returns deposits from both Direct BTC Deposits and Native Deposits APIs,
|
|
76
|
+
* unified into a single list sorted by block time (newest first).
|
|
77
|
+
*
|
|
78
|
+
* @param address - The EVM/BTC address to fetch deposits for
|
|
79
|
+
* @returns Promise resolving to array of Deposit objects
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const deposits = await sdk.api.deposits('0x1234...');
|
|
84
|
+
* deposits.forEach(d => {
|
|
85
|
+
* console.log(`${d.amount} BTC deposited at block ${d.blockHeight}`);
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
async deposits(t) {
|
|
90
|
+
return y({ address: t, env: this.env });
|
|
91
|
+
}
|
|
92
|
+
/* -------------------------------------------------------------------------- */
|
|
93
|
+
/* Unstakes */
|
|
94
|
+
/* -------------------------------------------------------------------------- */
|
|
95
|
+
/**
|
|
96
|
+
* Fetch all unstakes/redemptions for an address.
|
|
97
|
+
*
|
|
98
|
+
* Returns unstake records for both direct BTC unstakes and
|
|
99
|
+
* native blockchain redemptions.
|
|
100
|
+
*
|
|
101
|
+
* @param address - The address that initiated the unstakes
|
|
102
|
+
* @param options - Optional filters (show_redeems, show_unstakes, to_native)
|
|
103
|
+
* @returns Promise resolving to array of Unstake objects
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* // Get all unstakes
|
|
108
|
+
* const unstakes = await sdk.api.unstakes('0x1234...');
|
|
109
|
+
*
|
|
110
|
+
* // Get only native chain redemptions
|
|
111
|
+
* const redeems = await sdk.api.unstakes('0x1234...', { to_native: true });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
async unstakes(t, e) {
|
|
115
|
+
return ht({ address: t, env: this.env, options: e });
|
|
116
|
+
}
|
|
117
|
+
async points(t, e) {
|
|
118
|
+
return dt({ address: t, env: this.env, season: e });
|
|
119
|
+
}
|
|
120
|
+
/* -------------------------------------------------------------------------- */
|
|
121
|
+
/* Token Exchange Ratios */
|
|
122
|
+
/* -------------------------------------------------------------------------- */
|
|
123
|
+
/**
|
|
124
|
+
* Fetch the current exchange ratios for all supported tokens.
|
|
125
|
+
*
|
|
126
|
+
* Returns Token:BTC and BTC:Token ratios for LBTC and other supported tokens.
|
|
127
|
+
* This is the recommended method for getting exchange rate information.
|
|
128
|
+
*
|
|
129
|
+
* @returns Promise resolving to exchange ratio info for each token
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* const ratios = await sdk.api.exchangeRatio();
|
|
134
|
+
*
|
|
135
|
+
* // Access LBTC ratios
|
|
136
|
+
* const lbtcRatio = ratios.LBTC;
|
|
137
|
+
* console.log(`LBTC:BTC = ${lbtcRatio.tokenBTCRatio}`); // How many LBTC per 1 BTC
|
|
138
|
+
* console.log(`BTC:LBTC = ${lbtcRatio.BTCTokenRatio}`); // How many BTC per 1 LBTC
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
async exchangeRatio() {
|
|
142
|
+
return St({ env: this.env });
|
|
143
|
+
}
|
|
144
|
+
/* -------------------------------------------------------------------------- */
|
|
145
|
+
/* Deposit Address */
|
|
146
|
+
/* -------------------------------------------------------------------------- */
|
|
147
|
+
/**
|
|
148
|
+
* Get an existing BTC deposit address for a recipient.
|
|
149
|
+
*
|
|
150
|
+
* Returns the most recent non-deprecated deposit address for the
|
|
151
|
+
* given recipient address and destination chain.
|
|
152
|
+
*
|
|
153
|
+
* @param address - The destination address where LBTC will be claimed
|
|
154
|
+
* @param chainId - The destination chain
|
|
155
|
+
* @param options - Optional partner ID and token type
|
|
156
|
+
* @returns Promise resolving to the BTC deposit address
|
|
157
|
+
* @throws Error if no deposit address found
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* try {
|
|
162
|
+
* const btcAddr = await sdk.api.depositAddress('0x1234...', ChainId.ethereum);
|
|
163
|
+
* console.log(`Send BTC to: ${btcAddr}`);
|
|
164
|
+
* } catch (e) {
|
|
165
|
+
* console.log('No deposit address found - need to generate one');
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
async depositAddress(t, e, n) {
|
|
170
|
+
return O({
|
|
171
|
+
address: t,
|
|
172
|
+
chainId: e,
|
|
173
|
+
env: this.env,
|
|
174
|
+
partnerId: n == null ? void 0 : n.partnerId,
|
|
175
|
+
token: n == null ? void 0 : n.token
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/* -------------------------------------------------------------------------- */
|
|
179
|
+
/* Vault Withdrawals */
|
|
180
|
+
/* -------------------------------------------------------------------------- */
|
|
181
|
+
/**
|
|
182
|
+
* Fetch all vault withdrawals for an address.
|
|
183
|
+
*
|
|
184
|
+
* Returns withdrawal objects categorized by status (cancelled, expired,
|
|
185
|
+
* fulfilled, open). If chainId is not provided, fetches from all supported chains.
|
|
186
|
+
*
|
|
187
|
+
* @param address - The address to fetch withdrawals for
|
|
188
|
+
* @param options - Optional filters (chainId, vault, rpcUrl)
|
|
189
|
+
* @returns Promise resolving to categorized vault withdrawals
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* // Get all withdrawals from all chains
|
|
194
|
+
* const result = await sdk.api.vaultWithdrawals('0x1234...');
|
|
195
|
+
* console.log(`Open: ${result.open.length}, Fulfilled: ${result.fulfilled.length}`);
|
|
196
|
+
*
|
|
197
|
+
* // Filter by specific chain
|
|
198
|
+
* const ethereumOnly = await sdk.api.vaultWithdrawals('0x1234...', {
|
|
199
|
+
* chainId: ChainId.ethereum,
|
|
200
|
+
* });
|
|
201
|
+
*
|
|
202
|
+
* // Display withdrawal info
|
|
203
|
+
* result.open.forEach(w => {
|
|
204
|
+
* console.log(`Amount: ${w.shareAmount.toFixed()}, Deadline: ${new Date(w.deadline * 1000)}`);
|
|
205
|
+
* });
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
async vaultWithdrawals(t, e) {
|
|
209
|
+
const n = t, r = (e == null ? void 0 : e.vault) ?? _t.Veda;
|
|
210
|
+
return e != null && e.chainId ? Dt({
|
|
211
|
+
account: n,
|
|
212
|
+
chainId: e.chainId,
|
|
213
|
+
vaultKey: r,
|
|
214
|
+
rpcUrl: e.rpcUrl,
|
|
215
|
+
env: this.env
|
|
216
|
+
}) : Nt({
|
|
217
|
+
account: n,
|
|
218
|
+
vaultKey: r,
|
|
219
|
+
rpcUrl: e == null ? void 0 : e.rpcUrl
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/* -------------------------------------------------------------------------- */
|
|
223
|
+
/* Utility Methods */
|
|
224
|
+
/* -------------------------------------------------------------------------- */
|
|
225
|
+
/**
|
|
226
|
+
* Get the current API version being used.
|
|
227
|
+
*
|
|
228
|
+
* @returns The API version string ('v1' or 'v2')
|
|
229
|
+
*/
|
|
230
|
+
getApiVersion() {
|
|
231
|
+
return this.apiVersion;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function Pt(s) {
|
|
235
|
+
if (!s.env)
|
|
236
|
+
throw d.missingParameter("env");
|
|
237
|
+
const t = {
|
|
238
|
+
env: s.env,
|
|
239
|
+
providers: s.providers || {}
|
|
240
|
+
};
|
|
241
|
+
return s.partner && (wt(s.partner), t.partner = s.partner), t;
|
|
242
|
+
}
|
|
243
|
+
function wt(s) {
|
|
244
|
+
if (typeof s != "object" || s === null)
|
|
245
|
+
throw d.invalidConfiguration(
|
|
246
|
+
"Partner configuration must be an object"
|
|
247
|
+
);
|
|
248
|
+
const t = s;
|
|
249
|
+
if (!t.partnerId || typeof t.partnerId != "string")
|
|
250
|
+
throw d.missingParameter("partner.partnerId");
|
|
251
|
+
if (t.partnerId.trim().length === 0)
|
|
252
|
+
throw d.invalidConfiguration("Partner ID cannot be empty");
|
|
253
|
+
}
|
|
254
|
+
class bt {
|
|
255
|
+
constructor(t) {
|
|
256
|
+
this.env = t;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Generate a new BTC deposit address
|
|
260
|
+
*/
|
|
261
|
+
async generateDepositAddress(t) {
|
|
262
|
+
return ut({
|
|
263
|
+
address: t.address,
|
|
264
|
+
chainId: t.chainId,
|
|
265
|
+
signature: t.signature,
|
|
266
|
+
token: t.token,
|
|
267
|
+
eip712Data: t.eip712Data,
|
|
268
|
+
signatureData: t.signatureData,
|
|
269
|
+
pubKey: t.pubKey,
|
|
270
|
+
env: this.env,
|
|
271
|
+
partnerId: t.partnerId,
|
|
272
|
+
referrerCode: t.referrerCode,
|
|
273
|
+
captchaToken: t.captchaToken
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get existing deposit address for a recipient
|
|
278
|
+
*/
|
|
279
|
+
async getDepositAddress(t) {
|
|
280
|
+
try {
|
|
281
|
+
return await O({
|
|
282
|
+
address: t.address,
|
|
283
|
+
chainId: t.chainId,
|
|
284
|
+
token: t.token,
|
|
285
|
+
env: this.env,
|
|
286
|
+
partnerId: t.partnerId
|
|
287
|
+
}) || void 0;
|
|
288
|
+
} catch {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Get deposits for an address
|
|
294
|
+
*/
|
|
295
|
+
async getDeposits(t) {
|
|
296
|
+
return (await y({
|
|
297
|
+
address: t,
|
|
298
|
+
env: this.env
|
|
299
|
+
})).map((n) => {
|
|
300
|
+
var r;
|
|
301
|
+
return {
|
|
302
|
+
depositAddress: n.depositAddress ?? "",
|
|
303
|
+
blockHeight: n.blockHeight,
|
|
304
|
+
isClaimed: n.isClaimed,
|
|
305
|
+
txid: n.txHash,
|
|
306
|
+
amount: (r = n.amount) == null ? void 0 : r.toString()
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Store network fee signature
|
|
312
|
+
*/
|
|
313
|
+
async storeFeeSignature(t) {
|
|
314
|
+
await pt({
|
|
315
|
+
address: t.address,
|
|
316
|
+
signature: t.signature,
|
|
317
|
+
typedData: t.typedData,
|
|
318
|
+
env: this.env,
|
|
319
|
+
tokenAddress: t.tokenAddress
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Get stored network fee signature
|
|
324
|
+
*/
|
|
325
|
+
async getFeeSignature(t) {
|
|
326
|
+
return mt({
|
|
327
|
+
address: t.address,
|
|
328
|
+
chainId: t.chainId,
|
|
329
|
+
env: this.env,
|
|
330
|
+
tokenAddress: t.tokenAddress
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Store stake and bake signature
|
|
335
|
+
*/
|
|
336
|
+
async storeStakeAndBakeSignature(t) {
|
|
337
|
+
await gt({
|
|
338
|
+
signature: t.signature,
|
|
339
|
+
typedData: t.typedData,
|
|
340
|
+
env: this.env
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function yt() {
|
|
345
|
+
return {
|
|
346
|
+
id: "api",
|
|
347
|
+
register(s) {
|
|
348
|
+
return new bt(s.env);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function Ot(s) {
|
|
353
|
+
const t = /* @__PURE__ */ new Map(), e = [vt(), ft(), yt()];
|
|
354
|
+
for (const n of e)
|
|
355
|
+
t.set(n.id, n);
|
|
356
|
+
if (s)
|
|
357
|
+
for (const n of s)
|
|
358
|
+
t.set(n.id, n);
|
|
359
|
+
return Array.from(t.values());
|
|
360
|
+
}
|
|
361
|
+
function Lt(s, t) {
|
|
362
|
+
for (const e of s)
|
|
363
|
+
for (const n of e.requiresProviders ?? [])
|
|
364
|
+
if (!kt(t, n))
|
|
365
|
+
throw d.providerMissing(n, n);
|
|
366
|
+
}
|
|
367
|
+
function kt(s, t) {
|
|
368
|
+
var e;
|
|
369
|
+
return !!((e = s.providers) != null && e[t]);
|
|
370
|
+
}
|
|
371
|
+
function Bt(s) {
|
|
372
|
+
const t = Pt(s), e = Ot(
|
|
373
|
+
s.modules
|
|
374
|
+
);
|
|
375
|
+
Lt(e, t);
|
|
376
|
+
let n = s.logger;
|
|
377
|
+
return !n && s.debug && (n = Tt({ level: "debug" })), {
|
|
378
|
+
...t,
|
|
379
|
+
modules: e,
|
|
380
|
+
logger: n
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
function x(s) {
|
|
384
|
+
switch (s) {
|
|
385
|
+
case "prod":
|
|
386
|
+
return "mainnet-beta";
|
|
387
|
+
case "testnet":
|
|
388
|
+
case "stage":
|
|
389
|
+
case "dev":
|
|
390
|
+
case "ibc":
|
|
391
|
+
default:
|
|
392
|
+
return "devnet";
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
function M(s) {
|
|
396
|
+
switch (s) {
|
|
397
|
+
case "prod":
|
|
398
|
+
return It;
|
|
399
|
+
case "testnet":
|
|
400
|
+
case "stage":
|
|
401
|
+
case "dev":
|
|
402
|
+
case "ibc":
|
|
403
|
+
default:
|
|
404
|
+
return At;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const R = {
|
|
408
|
+
routes: [
|
|
409
|
+
{
|
|
410
|
+
sourceChains: [h.SOLANA_MAINNET],
|
|
411
|
+
destChain: h.BITCOIN_MAINNET,
|
|
412
|
+
assetIn: g.BTCb,
|
|
413
|
+
assetOut: g.BTC,
|
|
414
|
+
envs: [c.prod]
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
sourceChains: [h.SOLANA_DEVNET],
|
|
418
|
+
destChain: h.BITCOIN_SIGNET,
|
|
419
|
+
assetIn: g.BTCb,
|
|
420
|
+
assetOut: g.BTC,
|
|
421
|
+
envs: [c.testnet, c.stage, c.dev]
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
recipientSchema: I
|
|
425
|
+
};
|
|
426
|
+
function Mt(s, t, e, n, r) {
|
|
427
|
+
return R.routes.some(
|
|
428
|
+
(u) => u.sourceChains.includes(s) && u.destChain === t && u.assetIn === e && u.assetOut === n && u.envs.includes(r)
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
class Rt extends C {
|
|
432
|
+
constructor(e, n) {
|
|
433
|
+
super(i.IDLE);
|
|
434
|
+
a(this, "_amount");
|
|
435
|
+
a(this, "_recipient");
|
|
436
|
+
a(this, "_txHash");
|
|
437
|
+
if (this.ctx = e, this.params = n, !Mt(
|
|
438
|
+
n.sourceChain,
|
|
439
|
+
n.destChain,
|
|
440
|
+
n.assetIn,
|
|
441
|
+
n.assetOut,
|
|
442
|
+
e.env
|
|
443
|
+
))
|
|
444
|
+
throw d.routeNotFound({
|
|
445
|
+
assetOut: n.assetOut,
|
|
446
|
+
sourceChain: n.sourceChain,
|
|
447
|
+
destChain: n.destChain,
|
|
448
|
+
env: e.env
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
get amount() {
|
|
452
|
+
return this._amount;
|
|
453
|
+
}
|
|
454
|
+
get recipient() {
|
|
455
|
+
return this._recipient;
|
|
456
|
+
}
|
|
457
|
+
get txHash() {
|
|
458
|
+
return this._txHash;
|
|
459
|
+
}
|
|
460
|
+
async prepare(e) {
|
|
461
|
+
return this.assertStatus(i.IDLE, "prepare"), this.act(async () => {
|
|
462
|
+
const n = f(this.prepareSchema, e, {
|
|
463
|
+
destChain: this.params.destChain
|
|
464
|
+
});
|
|
465
|
+
this._amount = n.amount, this._recipient = n.recipient, this.emitProgress({
|
|
466
|
+
status: i.READY,
|
|
467
|
+
steps: { burning: o.IDLE, releasing: o.IDLE }
|
|
468
|
+
});
|
|
469
|
+
}, i.READY);
|
|
470
|
+
}
|
|
471
|
+
async execute() {
|
|
472
|
+
return this.assertStatus(i.READY, "execute"), this.act(async () => {
|
|
473
|
+
const e = this._amount, n = this._recipient;
|
|
474
|
+
if (!e || !n)
|
|
475
|
+
throw d.missingParameter("amount or recipient");
|
|
476
|
+
this.emitProgress({
|
|
477
|
+
status: i.READY,
|
|
478
|
+
steps: { burning: o.PENDING, releasing: o.IDLE }
|
|
479
|
+
});
|
|
480
|
+
const r = T(e).toString(), u = x(this.ctx.env), l = L(
|
|
481
|
+
M(this.ctx.env),
|
|
482
|
+
this.ctx.env,
|
|
483
|
+
k.BTCb
|
|
484
|
+
);
|
|
485
|
+
if (!l)
|
|
486
|
+
throw d.missingParameter("Solana BTC.b mint for this environment");
|
|
487
|
+
const { signature: m } = await this.ctx.solana.redeemForBtc({
|
|
488
|
+
amount: r,
|
|
489
|
+
btcAddress: n,
|
|
490
|
+
network: u,
|
|
491
|
+
env: this.ctx.env,
|
|
492
|
+
tokenMint: l
|
|
493
|
+
});
|
|
494
|
+
return this._txHash = m, this.emitProgress({
|
|
495
|
+
status: i.COMPLETED,
|
|
496
|
+
steps: { burning: o.COMPLETE, releasing: o.COMPLETE }
|
|
497
|
+
}), this.emitCompleted(), { txHash: m };
|
|
498
|
+
}, i.COMPLETED);
|
|
499
|
+
}
|
|
500
|
+
get prepareSchema() {
|
|
501
|
+
return E({
|
|
502
|
+
amount: A,
|
|
503
|
+
recipient: R.recipientSchema
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
const H = {
|
|
508
|
+
routes: [
|
|
509
|
+
{
|
|
510
|
+
chain: h.SOLANA_MAINNET,
|
|
511
|
+
assetIn: g.BTCb,
|
|
512
|
+
assetOut: g.LBTC,
|
|
513
|
+
envs: [c.prod]
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
chain: h.SOLANA_DEVNET,
|
|
517
|
+
assetIn: g.BTCb,
|
|
518
|
+
assetOut: g.LBTC,
|
|
519
|
+
envs: [c.stage, c.dev, c.testnet]
|
|
520
|
+
}
|
|
521
|
+
],
|
|
522
|
+
recipientSchema: w
|
|
523
|
+
};
|
|
524
|
+
function Ht(s, t, e, n) {
|
|
525
|
+
return H.routes.some(
|
|
526
|
+
(r) => r.chain === s && r.assetIn === t && r.assetOut === e && r.envs.includes(n)
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
class Ft extends C {
|
|
530
|
+
constructor(e, n) {
|
|
531
|
+
super(i.IDLE);
|
|
532
|
+
a(this, "_amount");
|
|
533
|
+
a(this, "_recipient");
|
|
534
|
+
a(this, "_txHash");
|
|
535
|
+
a(this, "env");
|
|
536
|
+
if (this.ctx = e, this.params = n, this.env = e.env, !Ht(
|
|
537
|
+
n.chain,
|
|
538
|
+
n.assetIn,
|
|
539
|
+
n.assetOut,
|
|
540
|
+
this.env
|
|
541
|
+
))
|
|
542
|
+
throw d.routeNotFound({
|
|
543
|
+
assetOut: n.assetOut,
|
|
544
|
+
chain: n.chain,
|
|
545
|
+
env: this.env
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
get amount() {
|
|
549
|
+
return this._amount;
|
|
550
|
+
}
|
|
551
|
+
get recipient() {
|
|
552
|
+
return this._recipient;
|
|
553
|
+
}
|
|
554
|
+
get txHash() {
|
|
555
|
+
return this._txHash;
|
|
556
|
+
}
|
|
557
|
+
async prepare(e) {
|
|
558
|
+
return this.assertStatus(i.IDLE, "prepare"), this.act(async () => {
|
|
559
|
+
const n = f(this.prepareSchema, e, {
|
|
560
|
+
destChain: this.params.chain
|
|
561
|
+
});
|
|
562
|
+
this._amount = n.amount, this._recipient = n.recipient, this.emitProgress({
|
|
563
|
+
status: i.READY,
|
|
564
|
+
steps: { burning: o.IDLE, minting: o.IDLE }
|
|
565
|
+
});
|
|
566
|
+
}, i.READY);
|
|
567
|
+
}
|
|
568
|
+
async execute() {
|
|
569
|
+
return this.assertStatus(i.READY, "execute"), this.act(async () => {
|
|
570
|
+
const e = this._amount, n = this._recipient;
|
|
571
|
+
if (!e || !n)
|
|
572
|
+
throw d.missingParameter("amount or recipient");
|
|
573
|
+
this.emitProgress({
|
|
574
|
+
status: i.READY,
|
|
575
|
+
steps: { burning: o.PENDING, minting: o.IDLE }
|
|
576
|
+
});
|
|
577
|
+
const r = T(e).toString(), u = x(this.env), { signature: l } = await this.ctx.solana.deposit({
|
|
578
|
+
amount: r,
|
|
579
|
+
recipient: n,
|
|
580
|
+
network: u,
|
|
581
|
+
env: this.env
|
|
582
|
+
});
|
|
583
|
+
return this._txHash = l, this.emitProgress({
|
|
584
|
+
status: i.CONFIRMING,
|
|
585
|
+
steps: { burning: o.COMPLETE, minting: o.PENDING },
|
|
586
|
+
txHash: l
|
|
587
|
+
}), this.emitCompleted(), { txHash: l };
|
|
588
|
+
}, i.CONFIRMING);
|
|
589
|
+
}
|
|
590
|
+
get prepareSchema() {
|
|
591
|
+
return E({
|
|
592
|
+
amount: A,
|
|
593
|
+
recipient: H.recipientSchema
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const F = {
|
|
598
|
+
routes: [
|
|
599
|
+
{
|
|
600
|
+
sourceChains: [h.SOLANA_MAINNET],
|
|
601
|
+
destChain: h.BITCOIN_MAINNET,
|
|
602
|
+
assetIn: g.LBTC,
|
|
603
|
+
assetOut: g.BTC,
|
|
604
|
+
envs: [c.prod]
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
sourceChains: [h.SOLANA_DEVNET],
|
|
608
|
+
destChain: h.BITCOIN_SIGNET,
|
|
609
|
+
assetIn: g.LBTC,
|
|
610
|
+
assetOut: g.BTC,
|
|
611
|
+
envs: [c.testnet, c.stage, c.dev, c.ibc]
|
|
612
|
+
}
|
|
613
|
+
],
|
|
614
|
+
recipientSchema: I
|
|
615
|
+
}, Y = {
|
|
616
|
+
routes: [
|
|
617
|
+
{
|
|
618
|
+
sourceChains: [h.SOLANA_MAINNET],
|
|
619
|
+
destChain: h.SOLANA_MAINNET,
|
|
620
|
+
assetIn: g.LBTC,
|
|
621
|
+
assetOut: g.BTCb,
|
|
622
|
+
envs: [c.prod]
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
sourceChains: [h.SOLANA_DEVNET],
|
|
626
|
+
destChain: h.SOLANA_DEVNET,
|
|
627
|
+
assetIn: g.LBTC,
|
|
628
|
+
assetOut: g.BTCb,
|
|
629
|
+
envs: [c.stage, c.dev, c.testnet]
|
|
630
|
+
}
|
|
631
|
+
],
|
|
632
|
+
recipientSchema: w
|
|
633
|
+
}, Yt = [...F.routes, ...Y.routes];
|
|
634
|
+
function Gt(s, t, e, n, r) {
|
|
635
|
+
return Yt.some(
|
|
636
|
+
(u) => u.sourceChains.includes(s) && u.destChain === t && u.assetIn === e && u.assetOut === n && u.envs.includes(r)
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
class Ut extends C {
|
|
640
|
+
constructor(e, n) {
|
|
641
|
+
super(i.IDLE);
|
|
642
|
+
a(this, "_amount");
|
|
643
|
+
a(this, "_recipient");
|
|
644
|
+
a(this, "_txHash");
|
|
645
|
+
a(this, "isBtcbOutput");
|
|
646
|
+
if (this.ctx = e, this.params = n, this.isBtcbOutput = n.assetOut === g.BTCb, !Gt(
|
|
647
|
+
n.sourceChain,
|
|
648
|
+
n.destChain,
|
|
649
|
+
n.assetIn,
|
|
650
|
+
n.assetOut,
|
|
651
|
+
e.env
|
|
652
|
+
))
|
|
653
|
+
throw d.routeNotFound({
|
|
654
|
+
assetOut: n.assetOut,
|
|
655
|
+
sourceChain: n.sourceChain,
|
|
656
|
+
destChain: n.destChain,
|
|
657
|
+
env: e.env
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
get amount() {
|
|
661
|
+
return this._amount;
|
|
662
|
+
}
|
|
663
|
+
get recipient() {
|
|
664
|
+
return this._recipient;
|
|
665
|
+
}
|
|
666
|
+
get txHash() {
|
|
667
|
+
return this._txHash;
|
|
668
|
+
}
|
|
669
|
+
async prepare(e) {
|
|
670
|
+
return this.assertStatus(i.IDLE, "prepare"), this.act(async () => {
|
|
671
|
+
const n = f(this.prepareSchema, e, {
|
|
672
|
+
destChain: this.params.destChain
|
|
673
|
+
});
|
|
674
|
+
this._amount = n.amount, this._recipient = n.recipient, this.emitProgress({
|
|
675
|
+
status: i.READY,
|
|
676
|
+
steps: { burning: o.IDLE, releasing: o.IDLE }
|
|
677
|
+
});
|
|
678
|
+
}, i.READY);
|
|
679
|
+
}
|
|
680
|
+
async execute() {
|
|
681
|
+
return this.assertStatus(i.READY, "execute"), this.act(async () => {
|
|
682
|
+
const e = this._amount, n = this._recipient;
|
|
683
|
+
if (!e || !n)
|
|
684
|
+
throw d.missingParameter("amount or recipient");
|
|
685
|
+
this.emitProgress({
|
|
686
|
+
status: i.READY,
|
|
687
|
+
steps: { burning: o.PENDING, releasing: o.IDLE }
|
|
688
|
+
});
|
|
689
|
+
const r = T(e).toString(), u = x(this.ctx.env);
|
|
690
|
+
let l;
|
|
691
|
+
if (this.isBtcbOutput)
|
|
692
|
+
({ signature: l } = await this.ctx.solana.redeem({
|
|
693
|
+
amount: r,
|
|
694
|
+
recipient: n,
|
|
695
|
+
network: u,
|
|
696
|
+
env: this.ctx.env
|
|
697
|
+
}));
|
|
698
|
+
else {
|
|
699
|
+
const m = L(
|
|
700
|
+
M(this.ctx.env),
|
|
701
|
+
this.ctx.env,
|
|
702
|
+
k.LBTC
|
|
703
|
+
);
|
|
704
|
+
if (!m)
|
|
705
|
+
throw d.missingParameter(
|
|
706
|
+
"Solana LBTC mint for this environment"
|
|
707
|
+
);
|
|
708
|
+
({ signature: l } = await this.ctx.solana.redeemForBtc({
|
|
709
|
+
amount: r,
|
|
710
|
+
btcAddress: n,
|
|
711
|
+
network: u,
|
|
712
|
+
env: this.ctx.env,
|
|
713
|
+
tokenMint: m
|
|
714
|
+
}));
|
|
715
|
+
}
|
|
716
|
+
return this._txHash = l, this.emitProgress({
|
|
717
|
+
status: i.COMPLETED,
|
|
718
|
+
steps: { burning: o.COMPLETE, releasing: o.COMPLETE }
|
|
719
|
+
}), this.emitCompleted(), { txHash: l };
|
|
720
|
+
}, i.COMPLETED);
|
|
721
|
+
}
|
|
722
|
+
get prepareSchema() {
|
|
723
|
+
const e = this.isBtcbOutput ? Y : F;
|
|
724
|
+
return E({
|
|
725
|
+
amount: A,
|
|
726
|
+
recipient: e.recipientSchema
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
function Vt(s) {
|
|
731
|
+
const e = new S(s.modules, s).require("solana");
|
|
732
|
+
return {
|
|
733
|
+
env: s.env,
|
|
734
|
+
partner: new _(s.partner),
|
|
735
|
+
getProvider: async (n) => {
|
|
736
|
+
const r = D(s.providers, n);
|
|
737
|
+
if (r)
|
|
738
|
+
return r();
|
|
739
|
+
},
|
|
740
|
+
solana: e
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
class G {
|
|
744
|
+
constructor(t) {
|
|
745
|
+
a(this, "_ctx", null);
|
|
746
|
+
this.config = t;
|
|
747
|
+
}
|
|
748
|
+
get ctx() {
|
|
749
|
+
return this._ctx || (this._ctx = Vt(this.config)), this._ctx;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Stake BTC.b → LBTC
|
|
753
|
+
*
|
|
754
|
+
* Burns BTC.b on Solana and mints LBTC to the recipient via Asset Router.
|
|
755
|
+
*
|
|
756
|
+
* @throws LombardError if solana module is not registered
|
|
757
|
+
* @throws LombardError if route is not supported
|
|
758
|
+
*/
|
|
759
|
+
stake(t) {
|
|
760
|
+
return new Ft(this.ctx, t);
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Unstake LBTC → BTC (cross-chain) or LBTC → BTC.b (same-chain)
|
|
764
|
+
*
|
|
765
|
+
* Burns LBTC on Solana and outputs BTC or BTC.b depending on `assetOut`:
|
|
766
|
+
* - BTC: via LBTC program directly (cross-chain to Bitcoin)
|
|
767
|
+
* - BTC.b: via Asset Router redeem (same-chain on Solana)
|
|
768
|
+
*
|
|
769
|
+
* @throws LombardError if solana module is not registered
|
|
770
|
+
* @throws LombardError if route is not supported
|
|
771
|
+
*/
|
|
772
|
+
unstake(t) {
|
|
773
|
+
return new Ut(this.ctx, t);
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Redeem BTC.b → BTC (cross-chain)
|
|
777
|
+
*
|
|
778
|
+
* Burns BTC.b on Solana and releases BTC to a Bitcoin address via Asset Router.
|
|
779
|
+
*
|
|
780
|
+
* @throws LombardError if solana module is not registered
|
|
781
|
+
* @throws LombardError if route is not supported
|
|
782
|
+
*/
|
|
783
|
+
redeem(t) {
|
|
784
|
+
return new Rt(this.ctx, t);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
function Ce(s) {
|
|
788
|
+
return new G(s);
|
|
789
|
+
}
|
|
790
|
+
const U = {
|
|
791
|
+
routes: [
|
|
792
|
+
{
|
|
793
|
+
sourceChains: [h.STARKNET_MAINNET],
|
|
794
|
+
destChain: h.BITCOIN_MAINNET,
|
|
795
|
+
envs: [c.prod]
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
sourceChains: [h.STARKNET_SEPOLIA],
|
|
799
|
+
destChain: h.BITCOIN_SIGNET,
|
|
800
|
+
envs: [c.testnet, c.stage, c.dev, c.ibc]
|
|
801
|
+
}
|
|
802
|
+
],
|
|
803
|
+
recipientSchema: I
|
|
804
|
+
};
|
|
805
|
+
function Kt(s, t) {
|
|
806
|
+
return U.routes.some(
|
|
807
|
+
(e) => e.sourceChains.includes(s) && e.envs.includes(t)
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
class jt extends C {
|
|
811
|
+
constructor(e, n) {
|
|
812
|
+
super(i.IDLE);
|
|
813
|
+
a(this, "_amount");
|
|
814
|
+
a(this, "_recipient");
|
|
815
|
+
a(this, "_txHash");
|
|
816
|
+
a(this, "env");
|
|
817
|
+
if (this.ctx = e, this.params = n, this.env = e.env, !Kt(n.sourceChain, this.env))
|
|
818
|
+
throw d.routeNotFound({
|
|
819
|
+
assetOut: n.assetOut,
|
|
820
|
+
sourceChain: n.sourceChain,
|
|
821
|
+
destChain: n.destChain,
|
|
822
|
+
env: this.env
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
get amount() {
|
|
826
|
+
return this._amount;
|
|
827
|
+
}
|
|
828
|
+
get recipient() {
|
|
829
|
+
return this._recipient;
|
|
830
|
+
}
|
|
831
|
+
get txHash() {
|
|
832
|
+
return this._txHash;
|
|
833
|
+
}
|
|
834
|
+
async prepare(e) {
|
|
835
|
+
return this.assertStatus(i.IDLE, "prepare"), this.act(async () => {
|
|
836
|
+
const n = f(this.prepareSchema, e, {
|
|
837
|
+
destChain: this.params.destChain
|
|
838
|
+
});
|
|
839
|
+
this._amount = n.amount, this._recipient = n.recipient, this.emitProgress({
|
|
840
|
+
status: i.READY,
|
|
841
|
+
steps: { burning: o.IDLE, releasing: o.IDLE }
|
|
842
|
+
});
|
|
843
|
+
}, i.READY);
|
|
844
|
+
}
|
|
845
|
+
async execute() {
|
|
846
|
+
return this.assertStatus(i.READY, "execute"), this.act(async () => {
|
|
847
|
+
const e = this._amount, n = this._recipient;
|
|
848
|
+
if (!e || !n)
|
|
849
|
+
throw d.missingParameter("amount or recipient");
|
|
850
|
+
this.emitProgress({
|
|
851
|
+
status: i.READY,
|
|
852
|
+
steps: { burning: o.PENDING, releasing: o.IDLE }
|
|
853
|
+
});
|
|
854
|
+
const { txHash: r } = await this.ctx.starknet.unstake({
|
|
855
|
+
amount: e,
|
|
856
|
+
btcAddress: n,
|
|
857
|
+
env: this.env
|
|
858
|
+
});
|
|
859
|
+
return this._txHash = r, this.emitProgress({
|
|
860
|
+
status: i.COMPLETED,
|
|
861
|
+
steps: { burning: o.COMPLETE, releasing: o.PENDING }
|
|
862
|
+
}), this.emitCompleted(), { txHash: r };
|
|
863
|
+
}, i.COMPLETED);
|
|
864
|
+
}
|
|
865
|
+
get prepareSchema() {
|
|
866
|
+
return E({
|
|
867
|
+
amount: A,
|
|
868
|
+
recipient: U.recipientSchema
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function $t(s) {
|
|
873
|
+
const e = new S(s.modules, s).require("starknet");
|
|
874
|
+
return {
|
|
875
|
+
env: s.env,
|
|
876
|
+
partner: new _(s.partner),
|
|
877
|
+
getProvider: async (n) => {
|
|
878
|
+
const r = D(s.providers, n);
|
|
879
|
+
if (r)
|
|
880
|
+
return r();
|
|
881
|
+
},
|
|
882
|
+
starknet: e
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
class V {
|
|
886
|
+
constructor(t) {
|
|
887
|
+
a(this, "_ctx", null);
|
|
888
|
+
this.config = t;
|
|
889
|
+
}
|
|
890
|
+
get ctx() {
|
|
891
|
+
return this._ctx || (this._ctx = $t(this.config)), this._ctx;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Unstake LBTC → BTC
|
|
895
|
+
*
|
|
896
|
+
* Burns LBTC on Starknet and releases BTC on Bitcoin.
|
|
897
|
+
*
|
|
898
|
+
* @throws LombardError if starknet module is not registered
|
|
899
|
+
*/
|
|
900
|
+
unstake(t) {
|
|
901
|
+
return new jt(this.ctx, t);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
function fe(s) {
|
|
905
|
+
return new V(s);
|
|
906
|
+
}
|
|
907
|
+
const K = {
|
|
908
|
+
routes: [
|
|
909
|
+
{
|
|
910
|
+
sourceChains: [h.SUI_MAINNET],
|
|
911
|
+
destChain: h.BITCOIN_MAINNET,
|
|
912
|
+
envs: [c.prod]
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
sourceChains: [h.SUI_TESTNET],
|
|
916
|
+
destChain: h.BITCOIN_SIGNET,
|
|
917
|
+
envs: [c.testnet, c.stage, c.dev, c.ibc]
|
|
918
|
+
}
|
|
919
|
+
],
|
|
920
|
+
recipientSchema: I
|
|
921
|
+
};
|
|
922
|
+
function qt(s, t) {
|
|
923
|
+
return K.routes.some(
|
|
924
|
+
(e) => e.sourceChains.includes(s) && e.envs.includes(t)
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
function zt(s) {
|
|
928
|
+
switch (s) {
|
|
929
|
+
case h.SUI_MAINNET:
|
|
930
|
+
return "sui:mainnet";
|
|
931
|
+
case h.SUI_TESTNET:
|
|
932
|
+
return "sui:testnet";
|
|
933
|
+
default:
|
|
934
|
+
return "sui:testnet";
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
class Wt extends C {
|
|
938
|
+
constructor(e, n) {
|
|
939
|
+
super(i.IDLE);
|
|
940
|
+
a(this, "_amount");
|
|
941
|
+
a(this, "_recipient");
|
|
942
|
+
a(this, "_txHash");
|
|
943
|
+
a(this, "env");
|
|
944
|
+
if (this.ctx = e, this.params = n, this.env = e.env, !qt(n.sourceChain, this.env))
|
|
945
|
+
throw d.routeNotFound({
|
|
946
|
+
assetOut: n.assetOut,
|
|
947
|
+
sourceChain: n.sourceChain,
|
|
948
|
+
destChain: n.destChain,
|
|
949
|
+
env: this.env
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
get amount() {
|
|
953
|
+
return this._amount;
|
|
954
|
+
}
|
|
955
|
+
get recipient() {
|
|
956
|
+
return this._recipient;
|
|
957
|
+
}
|
|
958
|
+
get txHash() {
|
|
959
|
+
return this._txHash;
|
|
960
|
+
}
|
|
961
|
+
async prepare(e) {
|
|
962
|
+
return this.assertStatus(i.IDLE, "prepare"), this.act(async () => {
|
|
963
|
+
const n = f(this.prepareSchema, e, {
|
|
964
|
+
destChain: this.params.destChain
|
|
965
|
+
});
|
|
966
|
+
this._amount = n.amount, this._recipient = n.recipient, this.emitProgress({
|
|
967
|
+
status: i.READY,
|
|
968
|
+
steps: { burning: o.IDLE, releasing: o.IDLE }
|
|
969
|
+
});
|
|
970
|
+
}, i.READY);
|
|
971
|
+
}
|
|
972
|
+
async execute() {
|
|
973
|
+
return this.assertStatus(i.READY, "execute"), this.act(async () => {
|
|
974
|
+
const e = this._amount, n = this._recipient;
|
|
975
|
+
if (!e || !n)
|
|
976
|
+
throw d.missingParameter("amount or recipient");
|
|
977
|
+
this.emitProgress({
|
|
978
|
+
status: i.READY,
|
|
979
|
+
steps: { burning: o.PENDING, releasing: o.IDLE }
|
|
980
|
+
});
|
|
981
|
+
const r = zt(this.params.sourceChain), { txHash: u } = await this.ctx.sui.unstake({
|
|
982
|
+
amount: e,
|
|
983
|
+
btcAddress: n,
|
|
984
|
+
chainId: r,
|
|
985
|
+
env: this.env
|
|
986
|
+
});
|
|
987
|
+
return this._txHash = u, this.emitProgress({
|
|
988
|
+
status: i.COMPLETED,
|
|
989
|
+
steps: { burning: o.COMPLETE, releasing: o.PENDING }
|
|
990
|
+
}), this.emitCompleted(), { txHash: u };
|
|
991
|
+
}, i.COMPLETED);
|
|
992
|
+
}
|
|
993
|
+
get prepareSchema() {
|
|
994
|
+
return E({
|
|
995
|
+
amount: A,
|
|
996
|
+
recipient: K.recipientSchema
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
function Xt(s) {
|
|
1001
|
+
const e = new S(s.modules, s).require("sui");
|
|
1002
|
+
return {
|
|
1003
|
+
env: s.env,
|
|
1004
|
+
partner: new _(s.partner),
|
|
1005
|
+
getProvider: async (n) => {
|
|
1006
|
+
const r = D(s.providers, n);
|
|
1007
|
+
if (r)
|
|
1008
|
+
return r();
|
|
1009
|
+
},
|
|
1010
|
+
sui: e
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
class j {
|
|
1014
|
+
constructor(t) {
|
|
1015
|
+
a(this, "_ctx", null);
|
|
1016
|
+
this.config = t;
|
|
1017
|
+
}
|
|
1018
|
+
get ctx() {
|
|
1019
|
+
return this._ctx || (this._ctx = Xt(this.config)), this._ctx;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Unstake LBTC → BTC
|
|
1023
|
+
*
|
|
1024
|
+
* Burns LBTC on Sui and releases BTC on Bitcoin.
|
|
1025
|
+
*
|
|
1026
|
+
* @throws LombardError if sui module is not registered
|
|
1027
|
+
*/
|
|
1028
|
+
unstake(t) {
|
|
1029
|
+
return new Wt(this.ctx, t);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
function Ee(s) {
|
|
1033
|
+
return new j(s);
|
|
1034
|
+
}
|
|
1035
|
+
class Zt {
|
|
1036
|
+
constructor(t = B, e) {
|
|
1037
|
+
a(this, "catalog");
|
|
1038
|
+
this.env = t, this.catalog = e ?? b;
|
|
1039
|
+
}
|
|
1040
|
+
/** Get token contract address */
|
|
1041
|
+
getAddress(t, e) {
|
|
1042
|
+
return X(t, this.env, e, this.catalog);
|
|
1043
|
+
}
|
|
1044
|
+
/** Get token decimals */
|
|
1045
|
+
getDecimals(t) {
|
|
1046
|
+
return Z(t, this.catalog);
|
|
1047
|
+
}
|
|
1048
|
+
/** Get asset metadata (decimals, symbol, name) */
|
|
1049
|
+
getMetadata(t) {
|
|
1050
|
+
return J(t, this.catalog);
|
|
1051
|
+
}
|
|
1052
|
+
/** Check if asset uses an asset router contract */
|
|
1053
|
+
usesAssetRouter(t, e) {
|
|
1054
|
+
return Q(t, this.env, e, this.catalog);
|
|
1055
|
+
}
|
|
1056
|
+
/** Get asset router contract address */
|
|
1057
|
+
getAssetRouter(t, e) {
|
|
1058
|
+
return tt(t, this.env, e, this.catalog);
|
|
1059
|
+
}
|
|
1060
|
+
/** Get bridge adapter address */
|
|
1061
|
+
getBridgeAdapter(t, e) {
|
|
1062
|
+
return et(t, this.env, e, this.catalog);
|
|
1063
|
+
}
|
|
1064
|
+
/** Get public market maker address */
|
|
1065
|
+
getPublicMarketMaker(t, e) {
|
|
1066
|
+
return st(t, this.env, e, this.catalog);
|
|
1067
|
+
}
|
|
1068
|
+
/** Find asset by contract address (reverse lookup) */
|
|
1069
|
+
getByAddress(t, e) {
|
|
1070
|
+
return nt(t, this.env, e, this.catalog);
|
|
1071
|
+
}
|
|
1072
|
+
/** Check if asset is deployed on a chain */
|
|
1073
|
+
isDeployed(t, e) {
|
|
1074
|
+
return rt(t, this.env, e, this.catalog);
|
|
1075
|
+
}
|
|
1076
|
+
/** Get all chains where asset is deployed */
|
|
1077
|
+
getChains(t) {
|
|
1078
|
+
return it(t, this.env, this.catalog);
|
|
1079
|
+
}
|
|
1080
|
+
/** Get all environments where asset is deployed on a chain */
|
|
1081
|
+
getEnvironments(t, e) {
|
|
1082
|
+
return at(t, e, this.catalog);
|
|
1083
|
+
}
|
|
1084
|
+
/** Get all supported assets */
|
|
1085
|
+
getSupportedAssets() {
|
|
1086
|
+
return ot(this.catalog);
|
|
1087
|
+
}
|
|
1088
|
+
/** Direct access to the asset catalog */
|
|
1089
|
+
getCatalog() {
|
|
1090
|
+
return this.catalog;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
class Jt {
|
|
1094
|
+
constructor(t) {
|
|
1095
|
+
a(this, "config");
|
|
1096
|
+
a(this, "env");
|
|
1097
|
+
/** Partner configuration manager */
|
|
1098
|
+
a(this, "partnerConfig");
|
|
1099
|
+
/** Provider cache */
|
|
1100
|
+
a(this, "providerCache", /* @__PURE__ */ new Map());
|
|
1101
|
+
/**
|
|
1102
|
+
* Chain actions (user-facing API)
|
|
1103
|
+
*
|
|
1104
|
+
* Access operations for each supported chain:
|
|
1105
|
+
* - btc: Bitcoin operations (stake, stakeAndDeploy, deposit)
|
|
1106
|
+
* - evm: EVM operations (deposit, stake, unstake, deploy, redeem)
|
|
1107
|
+
* - solana: Solana operations (unstake)
|
|
1108
|
+
* - sui: Sui operations (unstake)
|
|
1109
|
+
* - starknet: Starknet operations (unstake)
|
|
1110
|
+
*/
|
|
1111
|
+
a(this, "chain");
|
|
1112
|
+
a(this, "assets");
|
|
1113
|
+
/**
|
|
1114
|
+
* API namespace for data-fetching operations
|
|
1115
|
+
*
|
|
1116
|
+
* Provides convenient access to Lombard API read operations:
|
|
1117
|
+
* - deposits: Fetch deposit history
|
|
1118
|
+
* - unstakes: Fetch unstake/redemption history
|
|
1119
|
+
* - points: Fetch Lux points
|
|
1120
|
+
* - exchangeRatio: Get exchange ratios for all supported tokens
|
|
1121
|
+
* - depositAddress: Get existing BTC deposit address
|
|
1122
|
+
*/
|
|
1123
|
+
a(this, "api");
|
|
1124
|
+
/** Feature clients */
|
|
1125
|
+
a(this, "referrals");
|
|
1126
|
+
/** Capability registry (manages optional module services) */
|
|
1127
|
+
a(this, "capabilities");
|
|
1128
|
+
this.config = t, this.env = t.env, this.partnerConfig = new _(t.partner), this.capabilities = new S(
|
|
1129
|
+
this.config.modules,
|
|
1130
|
+
this.config
|
|
1131
|
+
), this.chain = {
|
|
1132
|
+
btc: new Ct(this.config),
|
|
1133
|
+
evm: new Et(this.config),
|
|
1134
|
+
solana: new G(this.config),
|
|
1135
|
+
sui: new j(this.config),
|
|
1136
|
+
starknet: new V(this.config)
|
|
1137
|
+
}, this.referrals = new lt(this), this.assets = new Zt(this.env), this.api = new xt(this.env);
|
|
1138
|
+
}
|
|
1139
|
+
async getProvider(t) {
|
|
1140
|
+
const e = t;
|
|
1141
|
+
if (this.providerCache.has(e))
|
|
1142
|
+
return this.providerCache.get(e);
|
|
1143
|
+
const n = D(this.config.providers, t);
|
|
1144
|
+
if (!n)
|
|
1145
|
+
throw d.providerMissing(t, t);
|
|
1146
|
+
const r = await n();
|
|
1147
|
+
if (!r)
|
|
1148
|
+
throw new d(
|
|
1149
|
+
ct.PROVIDER_INITIALIZATION_FAILED,
|
|
1150
|
+
`Failed to initialize ${t} provider`
|
|
1151
|
+
);
|
|
1152
|
+
return this.providerCache.set(e, r), r;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Configure partner settings
|
|
1156
|
+
*
|
|
1157
|
+
* @param config - Partner configuration
|
|
1158
|
+
*/
|
|
1159
|
+
configure(t) {
|
|
1160
|
+
this.partnerConfig.update(t);
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Register a custom asset
|
|
1164
|
+
*
|
|
1165
|
+
* TODO: Implement asset registration
|
|
1166
|
+
*/
|
|
1167
|
+
registerAsset(t) {
|
|
1168
|
+
throw new Error("Not implemented yet");
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Get partner configuration
|
|
1172
|
+
*/
|
|
1173
|
+
getPartnerConfig() {
|
|
1174
|
+
return this.partnerConfig;
|
|
1175
|
+
}
|
|
1176
|
+
getPartnerId() {
|
|
1177
|
+
return this.partnerConfig.getPartnerId();
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
const N = /* @__PURE__ */ new Map();
|
|
1181
|
+
function Qt(s) {
|
|
1182
|
+
return N.has(s) || N.set(s, Promise.resolve(b)), N.get(s);
|
|
1183
|
+
}
|
|
1184
|
+
async function Ae(s) {
|
|
1185
|
+
const t = "modules" in s && Array.isArray(s.modules) ? s : Bt(s), e = await Qt(t.env), n = {
|
|
1186
|
+
...t,
|
|
1187
|
+
catalog: e
|
|
1188
|
+
};
|
|
1189
|
+
return new Jt(n);
|
|
1190
|
+
}
|
|
1191
|
+
function Ie(s) {
|
|
1192
|
+
return typeof s == "object" && s !== null && "request" in s && typeof s.request == "function";
|
|
1193
|
+
}
|
|
1194
|
+
function Se(s) {
|
|
1195
|
+
return typeof s == "object" && s !== null && "getAddresses" in s && typeof s.getAddresses == "function";
|
|
1196
|
+
}
|
|
1197
|
+
function _e(s) {
|
|
1198
|
+
return typeof s == "object" && s !== null && "publicKey" in s && "signAndSendTransaction" in s;
|
|
1199
|
+
}
|
|
1200
|
+
function De(s) {
|
|
1201
|
+
return typeof s == "object" && s !== null && "getAddress" in s && "signAndExecuteTransactionBlock" in s;
|
|
1202
|
+
}
|
|
1203
|
+
function Ne(s) {
|
|
1204
|
+
return typeof s == "object" && s !== null && "address" in s && "execute" in s;
|
|
1205
|
+
}
|
|
1206
|
+
const Te = {
|
|
1207
|
+
/** Progress update with detailed step information */
|
|
1208
|
+
Progress: "progress",
|
|
1209
|
+
/** Status change (e.g., 'idle' → 'preparing' → 'ready') */
|
|
1210
|
+
StatusChange: "status-change",
|
|
1211
|
+
/** Operation completed successfully */
|
|
1212
|
+
Completed: "completed",
|
|
1213
|
+
/** Operation failed */
|
|
1214
|
+
Failed: "failed",
|
|
1215
|
+
/** Error occurred */
|
|
1216
|
+
Error: "error"
|
|
1217
|
+
}, xe = {
|
|
1218
|
+
Progress: "progress",
|
|
1219
|
+
StatusChange: "status-change",
|
|
1220
|
+
Completed: "completed",
|
|
1221
|
+
Failed: "failed",
|
|
1222
|
+
Error: "error"
|
|
1223
|
+
}, Pe = {
|
|
1224
|
+
Progress: "progress",
|
|
1225
|
+
StatusChange: "status-change",
|
|
1226
|
+
Completed: "completed",
|
|
1227
|
+
Failed: "failed",
|
|
1228
|
+
Error: "error"
|
|
1229
|
+
}, we = {
|
|
1230
|
+
Progress: "progress",
|
|
1231
|
+
StatusChange: "status-change",
|
|
1232
|
+
Completed: "completed",
|
|
1233
|
+
Failed: "failed",
|
|
1234
|
+
Error: "error"
|
|
1235
|
+
}, be = {
|
|
1236
|
+
Progress: "progress",
|
|
1237
|
+
StatusChange: "status-change",
|
|
1238
|
+
Completed: "completed",
|
|
1239
|
+
Failed: "failed",
|
|
1240
|
+
Error: "error"
|
|
1241
|
+
}, ye = {
|
|
1242
|
+
Progress: "progress",
|
|
1243
|
+
StatusChange: "status-change",
|
|
1244
|
+
Completed: "completed",
|
|
1245
|
+
Failed: "failed",
|
|
1246
|
+
Error: "error"
|
|
1247
|
+
};
|
|
1248
|
+
export {
|
|
1249
|
+
xt as ApiNamespace,
|
|
1250
|
+
ye as BridgeEvent,
|
|
1251
|
+
be as DeployEvent,
|
|
1252
|
+
xe as DepositEvent,
|
|
1253
|
+
Jt as LombardSDK,
|
|
1254
|
+
Pe as RedeemEvent,
|
|
1255
|
+
G as SolanaActions,
|
|
1256
|
+
Te as StakeEvent,
|
|
1257
|
+
V as StarknetActions,
|
|
1258
|
+
j as SuiActions,
|
|
1259
|
+
we as UnstakeEvent,
|
|
1260
|
+
Bt as createConfig,
|
|
1261
|
+
Tt as createConsoleLogger,
|
|
1262
|
+
Ae as createLombardSDK,
|
|
1263
|
+
me as createSilentLogger,
|
|
1264
|
+
ve as getSdkHeaders,
|
|
1265
|
+
Se as isBtcProvider,
|
|
1266
|
+
Ie as isEvmProvider,
|
|
1267
|
+
_e as isSolanaProvider,
|
|
1268
|
+
Ne as isStarknetProvider,
|
|
1269
|
+
De as isSuiProvider,
|
|
1270
|
+
Ce as solanaActions,
|
|
1271
|
+
fe as starknetActions,
|
|
1272
|
+
Ee as suiActions
|
|
1273
|
+
};
|
|
1274
|
+
//# sourceMappingURL=events-DAiXVdGv.js.map
|