@lombard.finance/sdk 4.2.0-canary.2 → 4.3.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/dist/api.cjs +2 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.js +41 -0
- package/dist/api.js.map +1 -0
- package/dist/bridge/lib/ccip-config.d.ts.map +1 -1
- package/dist/bridge/lib/config.d.ts +3 -3
- package/dist/bridge/lib/config.d.ts.map +1 -1
- package/dist/bridge.cjs +2 -0
- package/dist/bridge.cjs.map +1 -0
- package/dist/bridge.js +11 -0
- package/dist/bridge.js.map +1 -0
- package/dist/btc.cjs +2 -0
- package/dist/btc.cjs.map +1 -0
- package/dist/btc.js +13 -0
- package/dist/btc.js.map +1 -0
- package/dist/chunks/BtcActions-ByhBml_1.cjs +2 -0
- package/dist/chunks/BtcActions-ByhBml_1.cjs.map +1 -0
- package/dist/chunks/BtcActions-C_A1dUQ0.js +1791 -0
- package/dist/chunks/BtcActions-C_A1dUQ0.js.map +1 -0
- package/dist/chunks/EvmActions-DoYIhj61.cjs +2 -0
- package/dist/chunks/EvmActions-DoYIhj61.cjs.map +1 -0
- package/dist/chunks/EvmActions-DucgT60w.js +1351 -0
- package/dist/chunks/EvmActions-DucgT60w.js.map +1 -0
- package/dist/chunks/ReferralsClient-BC-1wT1q.cjs +2 -0
- package/dist/chunks/ReferralsClient-BC-1wT1q.cjs.map +1 -0
- package/dist/chunks/ReferralsClient-DbFWWtVi.js +462 -0
- package/dist/chunks/ReferralsClient-DbFWWtVi.js.map +1 -0
- package/dist/chunks/api-config-CtcP3TVl.js +35 -0
- package/dist/chunks/api-config-CtcP3TVl.js.map +1 -0
- package/dist/chunks/api-config-DkXqqfCK.cjs +2 -0
- package/dist/chunks/api-config-DkXqqfCK.cjs.map +1 -0
- package/dist/chunks/approveLBTC-B5-ZWqct.js +26 -0
- package/dist/chunks/approveLBTC-B5-ZWqct.js.map +1 -0
- package/dist/chunks/approveLBTC-CZiZmdcX.cjs +2 -0
- package/dist/chunks/approveLBTC-CZiZmdcX.cjs.map +1 -0
- package/dist/chunks/array-Cev6kyLJ.js +15 -0
- package/dist/chunks/array-Cev6kyLJ.js.map +1 -0
- package/dist/chunks/array-DKG6Pz4i.cjs +2 -0
- package/dist/chunks/array-DKG6Pz4i.cjs.map +1 -0
- package/dist/chunks/blockchain-identifier-BmadkNtK.js +113 -0
- package/dist/chunks/blockchain-identifier-BmadkNtK.js.map +1 -0
- package/dist/chunks/blockchain-identifier-BzMQWh-C.cjs +2 -0
- package/dist/chunks/blockchain-identifier-BzMQWh-C.cjs.map +1 -0
- package/dist/chunks/bridge-BzRlY9pP.cjs +12 -0
- package/dist/chunks/bridge-BzRlY9pP.cjs.map +1 -0
- package/dist/chunks/bridge-CTsiodO1.js +670 -0
- package/dist/chunks/bridge-CTsiodO1.js.map +1 -0
- package/dist/chunks/config-hFKqUyg3.js +374 -0
- package/dist/chunks/config-hFKqUyg3.js.map +1 -0
- package/dist/chunks/config-l4ZaZw_g.cjs +2 -0
- package/dist/chunks/config-l4ZaZw_g.cjs.map +1 -0
- package/dist/chunks/constants-BBK-JNcY.cjs +2 -0
- package/dist/chunks/constants-BBK-JNcY.cjs.map +1 -0
- package/dist/chunks/constants-CuT4axsy.js +5 -0
- package/dist/chunks/constants-CuT4axsy.js.map +1 -0
- package/dist/chunks/defi-registry-BIRv_zkp.cjs +2 -0
- package/dist/chunks/defi-registry-BIRv_zkp.cjs.map +1 -0
- package/dist/chunks/defi-registry-wNFN3qyB.js +172 -0
- package/dist/chunks/defi-registry-wNFN3qyB.js.map +1 -0
- package/dist/chunks/depositStatus-C3-EgT2a.cjs +2 -0
- package/dist/chunks/depositStatus-C3-EgT2a.cjs.map +1 -0
- package/dist/chunks/depositStatus-DM7fRmbN.js +205 -0
- package/dist/chunks/depositStatus-DM7fRmbN.js.map +1 -0
- package/dist/chunks/events-BTtwgCev.cjs +2 -0
- package/dist/chunks/events-BTtwgCev.cjs.map +1 -0
- package/dist/chunks/events-DPi6MDRA.js +996 -0
- package/dist/chunks/events-DPi6MDRA.js.map +1 -0
- package/dist/chunks/evm-by-btc-address-CwLiENtM.js +39 -0
- package/dist/chunks/evm-by-btc-address-CwLiENtM.js.map +1 -0
- package/dist/chunks/evm-by-btc-address-DiQoIWsr.cjs +2 -0
- package/dist/chunks/evm-by-btc-address-DiQoIWsr.cjs.map +1 -0
- package/dist/chunks/fee-requirements-CICSxYYL.cjs +2 -0
- package/dist/chunks/fee-requirements-CICSxYYL.cjs.map +1 -0
- package/dist/chunks/fee-requirements-x8-8mpJ7.js +14 -0
- package/dist/chunks/fee-requirements-x8-8mpJ7.js.map +1 -0
- package/dist/chunks/get-exchange-ratio-C-7DadfD.cjs +2 -0
- package/dist/chunks/get-exchange-ratio-C-7DadfD.cjs.map +1 -0
- package/dist/chunks/get-exchange-ratio-NtnkG1kZ.js +20 -0
- package/dist/chunks/get-exchange-ratio-NtnkG1kZ.js.map +1 -0
- package/dist/chunks/get-positions-summary-B_MmGHLv.js +103 -0
- package/dist/chunks/get-positions-summary-B_MmGHLv.js.map +1 -0
- package/dist/chunks/get-positions-summary-DkZZYbGP.cjs +2 -0
- package/dist/chunks/get-positions-summary-DkZZYbGP.cjs.map +1 -0
- package/dist/chunks/get-vault-tvl-DmTUbOY7.cjs +2 -0
- package/dist/chunks/get-vault-tvl-DmTUbOY7.cjs.map +1 -0
- package/dist/chunks/get-vault-tvl-YAXePAW3.js +226 -0
- package/dist/chunks/get-vault-tvl-YAXePAW3.js.map +1 -0
- package/dist/chunks/get-vault-withdrawals-BrpZlt6s.js +161 -0
- package/dist/chunks/get-vault-withdrawals-BrpZlt6s.js.map +1 -0
- package/dist/chunks/get-vault-withdrawals-CWcYy_sH.cjs +2 -0
- package/dist/chunks/get-vault-withdrawals-CWcYy_sH.cjs.map +1 -0
- package/dist/chunks/getSharesByAddress-U48H_ygt.cjs +2 -0
- package/dist/chunks/getSharesByAddress-U48H_ygt.cjs.map +1 -0
- package/dist/chunks/getSharesByAddress-cUtkrKTq.js +121 -0
- package/dist/chunks/getSharesByAddress-cUtkrKTq.js.map +1 -0
- package/dist/chunks/getUserStakeAndBakeSignature-BxRq2cI1.cjs +2 -0
- package/dist/chunks/getUserStakeAndBakeSignature-BxRq2cI1.cjs.map +1 -0
- package/dist/chunks/getUserStakeAndBakeSignature-NGGblnJl.js +120 -0
- package/dist/chunks/getUserStakeAndBakeSignature-NGGblnJl.js.map +1 -0
- package/dist/chunks/index-BKzxeh1Y.cjs +2 -0
- package/dist/chunks/index-BKzxeh1Y.cjs.map +1 -0
- package/dist/chunks/index-CfcQ_g3t.js +37 -0
- package/dist/chunks/index-CfcQ_g3t.js.map +1 -0
- package/dist/chunks/lbtc-addresses-BLRmtR3c.js +10 -0
- package/dist/chunks/lbtc-addresses-BLRmtR3c.js.map +1 -0
- package/dist/chunks/lbtc-addresses-xyTYV7hx.cjs +2 -0
- package/dist/chunks/lbtc-addresses-xyTYV7hx.cjs.map +1 -0
- package/dist/chunks/numbers-3LtmxfD8.cjs +2 -0
- package/dist/chunks/numbers-3LtmxfD8.cjs.map +1 -0
- package/dist/chunks/numbers-CM-lcmt4.js +15 -0
- package/dist/chunks/numbers-CM-lcmt4.js.map +1 -0
- package/dist/chunks/parameters-CDV-6Hk5.js +11 -0
- package/dist/chunks/parameters-CDV-6Hk5.js.map +1 -0
- package/dist/chunks/parameters-DK9cYCAH.cjs +2 -0
- package/dist/chunks/parameters-DK9cYCAH.cjs.map +1 -0
- package/dist/chunks/satoshi-CZEsHl5X.cjs +2 -0
- package/dist/chunks/satoshi-CZEsHl5X.cjs.map +1 -0
- package/dist/chunks/satoshi-Ch6y8aYG.js +19 -0
- package/dist/chunks/satoshi-Ch6y8aYG.js.map +1 -0
- package/dist/chunks/statusConstants-CJk6vOiM.js +4437 -0
- package/dist/chunks/statusConstants-CJk6vOiM.js.map +1 -0
- package/dist/chunks/statusConstants-fmtIEEEM.cjs +2 -0
- package/dist/chunks/statusConstants-fmtIEEEM.cjs.map +1 -0
- package/dist/chunks/storeNetworkFeeSignature-BZGL2Zn_.js +65 -0
- package/dist/chunks/storeNetworkFeeSignature-BZGL2Zn_.js.map +1 -0
- package/dist/chunks/storeNetworkFeeSignature-D7yo6lDV.cjs +2 -0
- package/dist/chunks/storeNetworkFeeSignature-D7yo6lDV.cjs.map +1 -0
- package/dist/chunks/time-I-BeyUkG.cjs +2 -0
- package/dist/chunks/time-I-BeyUkG.cjs.map +1 -0
- package/dist/chunks/time-QPeEEEnQ.js +24 -0
- package/dist/chunks/time-QPeEEEnQ.js.map +1 -0
- package/dist/chunks/token-addresses-DRBecUa7.cjs +2 -0
- package/dist/chunks/token-addresses-DRBecUa7.cjs.map +1 -0
- package/dist/chunks/token-addresses-FKpA3uc4.js +541 -0
- package/dist/chunks/token-addresses-FKpA3uc4.js.map +1 -0
- package/dist/chunks/tokens-C6qZHzph.js +6661 -0
- package/dist/chunks/tokens-C6qZHzph.js.map +1 -0
- package/dist/chunks/tokens-D_HeVB5p.cjs +2 -0
- package/dist/chunks/tokens-D_HeVB5p.cjs.map +1 -0
- package/dist/chunks/unstakeLBTC-B4Rwf65e.js +3878 -0
- package/dist/chunks/unstakeLBTC-B4Rwf65e.js.map +1 -0
- package/dist/chunks/unstakeLBTC-Wlfi14de.cjs +2 -0
- package/dist/chunks/unstakeLBTC-Wlfi14de.cjs.map +1 -0
- package/dist/chunks/withdraw-C1fMFSwy.cjs +12 -0
- package/dist/chunks/withdraw-C1fMFSwy.cjs.map +1 -0
- package/dist/chunks/withdraw-hHueI2p7.js +209 -0
- package/dist/chunks/withdraw-hHueI2p7.js.map +1 -0
- package/dist/clients/rpc-url-config.d.ts.map +1 -1
- package/dist/common/chains.d.ts +3 -92
- package/dist/common/chains.d.ts.map +1 -1
- package/dist/common/feature-config.d.ts.map +1 -1
- package/dist/contract-functions/getLBTCMintingFee/getLBTCMintingFee.d.ts +27 -0
- package/dist/contract-functions/getLBTCMintingFee/getLBTCMintingFee.d.ts.map +1 -1
- package/dist/contract-functions/signLbtcDestionationAddr/signLbtcDestinationAddr.d.ts +26 -0
- package/dist/contract-functions/signLbtcDestionationAddr/signLbtcDestinationAddr.d.ts.map +1 -1
- package/dist/contracts.cjs +2 -0
- package/dist/contracts.cjs.map +1 -0
- package/dist/contracts.js +34 -0
- package/dist/contracts.js.map +1 -0
- package/dist/core/chains/catalog.d.ts.map +1 -1
- package/dist/core/chains/types.d.ts +0 -1
- package/dist/core/chains/types.d.ts.map +1 -1
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.js +101 -0
- package/dist/core.js.map +1 -0
- package/dist/debug.cjs +2 -0
- package/dist/debug.cjs.map +1 -0
- package/dist/debug.js +7 -0
- package/dist/debug.js.map +1 -0
- package/dist/defi.cjs +2 -0
- package/dist/defi.cjs.map +1 -0
- package/dist/defi.js +14 -0
- package/dist/defi.js.map +1 -0
- package/dist/entries/contracts.d.ts +2 -2
- package/dist/entries/contracts.d.ts.map +1 -1
- package/dist/entries/evm.d.ts +1 -1
- package/dist/entries/evm.d.ts.map +1 -1
- package/dist/entries/utils.d.ts +1 -1
- package/dist/entries/utils.d.ts.map +1 -1
- package/dist/evm.cjs +2 -0
- package/dist/evm.cjs.map +1 -0
- package/dist/evm.js +47 -0
- package/dist/evm.js.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +295 -264
- package/dist/index.js.map +1 -0
- package/dist/metrics.cjs +2 -0
- package/dist/metrics.cjs.map +1 -0
- package/dist/metrics.js +9 -0
- package/dist/metrics.js.map +1 -0
- package/dist/stories/components/decorators/wagmi-decorator.d.ts.map +1 -1
- package/dist/tokens/token-addresses.d.ts.map +1 -1
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.js +100 -0
- package/dist/utils.js.map +1 -0
- package/dist/vaults.cjs +2 -0
- package/dist/vaults.cjs.map +1 -0
- package/dist/vaults.js +18 -0
- package/dist/vaults.js.map +1 -0
- package/package.json +2 -2
- package/dist/ccip.cjs +0 -1
- package/dist/ccip.js +0 -232
- package/dist/index2.cjs +0 -58
- package/dist/index2.js +0 -48280
package/dist/api.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/ReferralsClient-BC-1wT1q.cjs"),s=require("./chunks/getUserStakeAndBakeSignature-BxRq2cI1.cjs"),r=require("./chunks/get-exchange-ratio-C-7DadfD.cjs"),t=require("./chunks/depositStatus-C3-EgT2a.cjs"),i=require("./chunks/storeNetworkFeeSignature-D7yo6lDV.cjs");exports.ENotarizationStatus=e.ENotarizationStatus;exports.ESessionState=e.ESessionState;exports.PayoutTxStatus=e.PayoutTxStatus;exports.ReferralsClient=e.ReferralsClient;exports.fetchBTCbDeposits=e.fetchBTCbDeposits;exports.fetchDirectDeposits=e.fetchDirectDeposits;exports.fetchUnstakesByAddress=e.fetchUnstakesByAddress;exports.getDepositBtcAddress=e.getDepositBtcAddress;exports.getDepositBtcAddresses=e.getDepositBtcAddresses;exports.getDepositsByAddress=e.getDepositsByAddress;exports.getLuxSeason1Points=e.getLuxSeason1Points;exports.getLuxSeason2Points=e.getLuxSeason2Points;exports.getPointsByAddress=e.getPointsByAddress;exports.getUnstakesByAddress=e.getUnstakesByAddress;exports.storeStakeAndBakeSignature=e.storeStakeAndBakeSignature;exports.SANCTIONED_ADDRESS=s.SANCTIONED_ADDRESS;exports.generateDepositBtcAddress=s.generateDepositBtcAddress;exports.getUserStakeAndBakeSignature=s.getUserStakeAndBakeSignature;exports.getExchangeRatio=r.getExchangeRatio;exports.MIN_CLAIM_AMOUNT_BTC=t.MIN_CLAIM_AMOUNT_BTC;exports.REQUIRED_CONFIRMATIONS=t.REQUIRED_CONFIRMATIONS;exports.calcConfirmations=t.calcConfirmations;exports.depositRequiresAction=t.depositRequiresAction;exports.getConfirmationProgress=t.getConfirmationProgress;exports.getDepositStatus=t.getDepositStatus;exports.getDepositStatusDisplay=t.getDepositStatusDisplay;exports.getLBTCExchangeRate=t.getLBTCExchangeRate;exports.isDepositClaimable=t.isDepositClaimable;exports.isDepositPending=t.isDepositPending;exports.isDepositTerminal=t.isDepositTerminal;exports.setReferral=t.setReferral;exports.getNetworkFeeSignature=i.getNetworkFeeSignature;exports.storeNetworkFeeSignature=i.storeNetworkFeeSignature;
|
|
2
|
+
//# sourceMappingURL=api.cjs.map
|
package/dist/api.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { E as t, a, P as o, R as i, f as r, b as g, c as n, g as d, d as S, e as p, h as D, i as A, j as c, k as f, s as u } from "./chunks/ReferralsClient-DbFWWtVi.js";
|
|
2
|
+
import { S as R, g as x, a as C } from "./chunks/getUserStakeAndBakeSignature-NGGblnJl.js";
|
|
3
|
+
import { g as m } from "./chunks/get-exchange-ratio-NtnkG1kZ.js";
|
|
4
|
+
import { M as N, R as l, c as T, d as h, g as P, a as y, b as I, e as M, i as U, f as _, h as b, s as L } from "./chunks/depositStatus-DM7fRmbN.js";
|
|
5
|
+
import { g as F, s as w } from "./chunks/storeNetworkFeeSignature-BZGL2Zn_.js";
|
|
6
|
+
export {
|
|
7
|
+
t as ENotarizationStatus,
|
|
8
|
+
a as ESessionState,
|
|
9
|
+
N as MIN_CLAIM_AMOUNT_BTC,
|
|
10
|
+
o as PayoutTxStatus,
|
|
11
|
+
l as REQUIRED_CONFIRMATIONS,
|
|
12
|
+
i as ReferralsClient,
|
|
13
|
+
R as SANCTIONED_ADDRESS,
|
|
14
|
+
T as calcConfirmations,
|
|
15
|
+
h as depositRequiresAction,
|
|
16
|
+
r as fetchBTCbDeposits,
|
|
17
|
+
g as fetchDirectDeposits,
|
|
18
|
+
n as fetchUnstakesByAddress,
|
|
19
|
+
x as generateDepositBtcAddress,
|
|
20
|
+
P as getConfirmationProgress,
|
|
21
|
+
d as getDepositBtcAddress,
|
|
22
|
+
S as getDepositBtcAddresses,
|
|
23
|
+
y as getDepositStatus,
|
|
24
|
+
I as getDepositStatusDisplay,
|
|
25
|
+
p as getDepositsByAddress,
|
|
26
|
+
m as getExchangeRatio,
|
|
27
|
+
M as getLBTCExchangeRate,
|
|
28
|
+
D as getLuxSeason1Points,
|
|
29
|
+
A as getLuxSeason2Points,
|
|
30
|
+
F as getNetworkFeeSignature,
|
|
31
|
+
c as getPointsByAddress,
|
|
32
|
+
f as getUnstakesByAddress,
|
|
33
|
+
C as getUserStakeAndBakeSignature,
|
|
34
|
+
U as isDepositClaimable,
|
|
35
|
+
_ as isDepositPending,
|
|
36
|
+
b as isDepositTerminal,
|
|
37
|
+
L as setReferral,
|
|
38
|
+
w as storeNetworkFeeSignature,
|
|
39
|
+
u as storeStakeAndBakeSignature
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ccip-config.d.ts","sourceRoot":"","sources":["../../../src/bridge/lib/ccip-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAElD,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"ccip-config.d.ts","sourceRoot":"","sources":["../../../src/bridge/lib/ccip-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAElD,eAAO,MAAM,WAAW,EAAE,UAsDzB,CAAC;AAEF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAE3E"}
|
|
@@ -11,10 +11,10 @@ export declare const BRIDGE_EXPLORER_URL_MAP: {
|
|
|
11
11
|
CCIP: string;
|
|
12
12
|
OFT: string;
|
|
13
13
|
};
|
|
14
|
-
export declare const CCIP_BRIDGE_CHAINS: (1 | 8453 | 84532 | 56 | 43114 | 43113 | 747474 |
|
|
14
|
+
export declare const CCIP_BRIDGE_CHAINS: (1 | 8453 | 84532 | 56 | 43114 | 43113 | 747474 | 146 | 11155111 | 17000 | 143 | 988)[];
|
|
15
15
|
export type CCIPBridgeChain = (typeof CCIP_BRIDGE_CHAINS)[number];
|
|
16
16
|
export declare const OFT_BRIDGE_CHAINS: (1 | 80094 | 80084 | 21000000 | 42793 | 1923 | 239 | 11155111)[];
|
|
17
|
-
export declare const BRIDGE_CHAINS: (1 | 8453 | 84532 | 56 | 43114 | 43113 | 80094 | 80084 | 21000000 | 42793 | 747474 |
|
|
17
|
+
export declare const BRIDGE_CHAINS: (1 | 8453 | 84532 | 56 | 43114 | 43113 | 80094 | 80084 | 21000000 | 42793 | 747474 | 146 | 1923 | 239 | 11155111 | 17000 | 143 | 988)[];
|
|
18
18
|
export type BridgeChain = CCIPBridgeChain | OFTBridgeChain;
|
|
19
19
|
export declare const OFT_GAS_LIMIT = 90000;
|
|
20
20
|
export declare const OFT_HI_GAS_LIMIT = 200000;
|
|
@@ -24,7 +24,7 @@ type BridgeInfo = {
|
|
|
24
24
|
type: BridgeType;
|
|
25
25
|
contract: ContractInfo;
|
|
26
26
|
};
|
|
27
|
-
export declare const BRIDGES: Map<"[from:1, to: 1]" | "[from:1, to: 8453]" | "[from:1, to: 84532]" | "[from:1, to: 56]" | "[from:1, to: 43114]" | "[from:1, to: 43113]" | "[from:1, to: 747474]" | "[from:1, to:
|
|
27
|
+
export declare const BRIDGES: Map<"[from:1, to: 1]" | "[from:1, to: 8453]" | "[from:1, to: 84532]" | "[from:1, to: 56]" | "[from:1, to: 43114]" | "[from:1, to: 43113]" | "[from:1, to: 747474]" | "[from:1, to: 146]" | "[from:1, to: 11155111]" | "[from:1, to: 17000]" | "[from:1, to: 143]" | "[from:1, to: 988]" | "[from:8453, to: 1]" | "[from:8453, to: 8453]" | "[from:8453, to: 84532]" | "[from:8453, to: 56]" | "[from:8453, to: 43114]" | "[from:8453, to: 43113]" | "[from:8453, to: 747474]" | "[from:8453, to: 146]" | "[from:8453, to: 11155111]" | "[from:8453, to: 17000]" | "[from:8453, to: 143]" | "[from:8453, to: 988]" | "[from:84532, to: 1]" | "[from:84532, to: 8453]" | "[from:84532, to: 84532]" | "[from:84532, to: 56]" | "[from:84532, to: 43114]" | "[from:84532, to: 43113]" | "[from:84532, to: 747474]" | "[from:84532, to: 146]" | "[from:84532, to: 11155111]" | "[from:84532, to: 17000]" | "[from:84532, to: 143]" | "[from:84532, to: 988]" | "[from:56, to: 1]" | "[from:56, to: 8453]" | "[from:56, to: 84532]" | "[from:56, to: 56]" | "[from:56, to: 43114]" | "[from:56, to: 43113]" | "[from:56, to: 747474]" | "[from:56, to: 146]" | "[from:56, to: 11155111]" | "[from:56, to: 17000]" | "[from:56, to: 143]" | "[from:56, to: 988]" | "[from:43114, to: 1]" | "[from:43114, to: 8453]" | "[from:43114, to: 84532]" | "[from:43114, to: 56]" | "[from:43114, to: 43114]" | "[from:43114, to: 43113]" | "[from:43114, to: 747474]" | "[from:43114, to: 146]" | "[from:43114, to: 11155111]" | "[from:43114, to: 17000]" | "[from:43114, to: 143]" | "[from:43114, to: 988]" | "[from:43113, to: 1]" | "[from:43113, to: 8453]" | "[from:43113, to: 84532]" | "[from:43113, to: 56]" | "[from:43113, to: 43114]" | "[from:43113, to: 43113]" | "[from:43113, to: 747474]" | "[from:43113, to: 146]" | "[from:43113, to: 11155111]" | "[from:43113, to: 17000]" | "[from:43113, to: 143]" | "[from:43113, to: 988]" | "[from:747474, to: 1]" | "[from:747474, to: 8453]" | "[from:747474, to: 84532]" | "[from:747474, to: 56]" | "[from:747474, to: 43114]" | "[from:747474, to: 43113]" | "[from:747474, to: 747474]" | "[from:747474, to: 146]" | "[from:747474, to: 11155111]" | "[from:747474, to: 17000]" | "[from:747474, to: 143]" | "[from:747474, to: 988]" | "[from:146, to: 1]" | "[from:146, to: 8453]" | "[from:146, to: 84532]" | "[from:146, to: 56]" | "[from:146, to: 43114]" | "[from:146, to: 43113]" | "[from:146, to: 747474]" | "[from:146, to: 146]" | "[from:146, to: 11155111]" | "[from:146, to: 17000]" | "[from:146, to: 143]" | "[from:146, to: 988]" | "[from:11155111, to: 1]" | "[from:11155111, to: 8453]" | "[from:11155111, to: 84532]" | "[from:11155111, to: 56]" | "[from:11155111, to: 43114]" | "[from:11155111, to: 43113]" | "[from:11155111, to: 747474]" | "[from:11155111, to: 146]" | "[from:11155111, to: 11155111]" | "[from:11155111, to: 17000]" | "[from:11155111, to: 143]" | "[from:11155111, to: 988]" | "[from:17000, to: 1]" | "[from:17000, to: 8453]" | "[from:17000, to: 84532]" | "[from:17000, to: 56]" | "[from:17000, to: 43114]" | "[from:17000, to: 43113]" | "[from:17000, to: 747474]" | "[from:17000, to: 146]" | "[from:17000, to: 11155111]" | "[from:17000, to: 17000]" | "[from:17000, to: 143]" | "[from:17000, to: 988]" | "[from:143, to: 1]" | "[from:143, to: 8453]" | "[from:143, to: 84532]" | "[from:143, to: 56]" | "[from:143, to: 43114]" | "[from:143, to: 43113]" | "[from:143, to: 747474]" | "[from:143, to: 146]" | "[from:143, to: 11155111]" | "[from:143, to: 17000]" | "[from:143, to: 143]" | "[from:143, to: 988]" | "[from:988, to: 1]" | "[from:988, to: 8453]" | "[from:988, to: 84532]" | "[from:988, to: 56]" | "[from:988, to: 43114]" | "[from:988, to: 43113]" | "[from:988, to: 747474]" | "[from:988, to: 146]" | "[from:988, to: 11155111]" | "[from:988, to: 17000]" | "[from:988, to: 143]" | "[from:988, to: 988]" | "[from:1, to: 80094]" | "[from:1, to: 80084]" | "[from:1, to: 21000000]" | "[from:1, to: 42793]" | "[from:1, to: 1923]" | "[from:1, to: 239]" | "[from:80094, to: 1]" | "[from:80094, to: 80094]" | "[from:80094, to: 80084]" | "[from:80094, to: 21000000]" | "[from:80094, to: 42793]" | "[from:80094, to: 1923]" | "[from:80094, to: 239]" | "[from:80094, to: 11155111]" | "[from:80084, to: 1]" | "[from:80084, to: 80094]" | "[from:80084, to: 80084]" | "[from:80084, to: 21000000]" | "[from:80084, to: 42793]" | "[from:80084, to: 1923]" | "[from:80084, to: 239]" | "[from:80084, to: 11155111]" | "[from:21000000, to: 1]" | "[from:21000000, to: 80094]" | "[from:21000000, to: 80084]" | "[from:21000000, to: 21000000]" | "[from:21000000, to: 42793]" | "[from:21000000, to: 1923]" | "[from:21000000, to: 239]" | "[from:21000000, to: 11155111]" | "[from:42793, to: 1]" | "[from:42793, to: 80094]" | "[from:42793, to: 80084]" | "[from:42793, to: 21000000]" | "[from:42793, to: 42793]" | "[from:42793, to: 1923]" | "[from:42793, to: 239]" | "[from:42793, to: 11155111]" | "[from:1923, to: 1]" | "[from:1923, to: 80094]" | "[from:1923, to: 80084]" | "[from:1923, to: 21000000]" | "[from:1923, to: 42793]" | "[from:1923, to: 1923]" | "[from:1923, to: 239]" | "[from:1923, to: 11155111]" | "[from:239, to: 1]" | "[from:239, to: 80094]" | "[from:239, to: 80084]" | "[from:239, to: 21000000]" | "[from:239, to: 42793]" | "[from:239, to: 1923]" | "[from:239, to: 239]" | "[from:239, to: 11155111]" | "[from:11155111, to: 80094]" | "[from:11155111, to: 80084]" | "[from:11155111, to: 21000000]" | "[from:11155111, to: 42793]" | "[from:11155111, to: 1923]" | "[from:11155111, to: 239]" | "[from:8453, to: 80094]" | "[from:8453, to: 80084]" | "[from:8453, to: 21000000]" | "[from:8453, to: 42793]" | "[from:8453, to: 1923]" | "[from:8453, to: 239]" | "[from:84532, to: 80094]" | "[from:84532, to: 80084]" | "[from:84532, to: 21000000]" | "[from:84532, to: 42793]" | "[from:84532, to: 1923]" | "[from:84532, to: 239]" | "[from:56, to: 80094]" | "[from:56, to: 80084]" | "[from:56, to: 21000000]" | "[from:56, to: 42793]" | "[from:56, to: 1923]" | "[from:56, to: 239]" | "[from:43114, to: 80094]" | "[from:43114, to: 80084]" | "[from:43114, to: 21000000]" | "[from:43114, to: 42793]" | "[from:43114, to: 1923]" | "[from:43114, to: 239]" | "[from:43113, to: 80094]" | "[from:43113, to: 80084]" | "[from:43113, to: 21000000]" | "[from:43113, to: 42793]" | "[from:43113, to: 1923]" | "[from:43113, to: 239]" | "[from:80094, to: 8453]" | "[from:80094, to: 84532]" | "[from:80094, to: 56]" | "[from:80094, to: 43114]" | "[from:80094, to: 43113]" | "[from:80094, to: 747474]" | "[from:80094, to: 146]" | "[from:80094, to: 17000]" | "[from:80094, to: 143]" | "[from:80094, to: 988]" | "[from:80084, to: 8453]" | "[from:80084, to: 84532]" | "[from:80084, to: 56]" | "[from:80084, to: 43114]" | "[from:80084, to: 43113]" | "[from:80084, to: 747474]" | "[from:80084, to: 146]" | "[from:80084, to: 17000]" | "[from:80084, to: 143]" | "[from:80084, to: 988]" | "[from:21000000, to: 8453]" | "[from:21000000, to: 84532]" | "[from:21000000, to: 56]" | "[from:21000000, to: 43114]" | "[from:21000000, to: 43113]" | "[from:21000000, to: 747474]" | "[from:21000000, to: 146]" | "[from:21000000, to: 17000]" | "[from:21000000, to: 143]" | "[from:21000000, to: 988]" | "[from:42793, to: 8453]" | "[from:42793, to: 84532]" | "[from:42793, to: 56]" | "[from:42793, to: 43114]" | "[from:42793, to: 43113]" | "[from:42793, to: 747474]" | "[from:42793, to: 146]" | "[from:42793, to: 17000]" | "[from:42793, to: 143]" | "[from:42793, to: 988]" | "[from:747474, to: 80094]" | "[from:747474, to: 80084]" | "[from:747474, to: 21000000]" | "[from:747474, to: 42793]" | "[from:747474, to: 1923]" | "[from:747474, to: 239]" | "[from:146, to: 80094]" | "[from:146, to: 80084]" | "[from:146, to: 21000000]" | "[from:146, to: 42793]" | "[from:146, to: 1923]" | "[from:146, to: 239]" | "[from:1923, to: 8453]" | "[from:1923, to: 84532]" | "[from:1923, to: 56]" | "[from:1923, to: 43114]" | "[from:1923, to: 43113]" | "[from:1923, to: 747474]" | "[from:1923, to: 146]" | "[from:1923, to: 17000]" | "[from:1923, to: 143]" | "[from:1923, to: 988]" | "[from:239, to: 8453]" | "[from:239, to: 84532]" | "[from:239, to: 56]" | "[from:239, to: 43114]" | "[from:239, to: 43113]" | "[from:239, to: 747474]" | "[from:239, to: 146]" | "[from:239, to: 17000]" | "[from:239, to: 143]" | "[from:239, to: 988]" | "[from:17000, to: 80094]" | "[from:17000, to: 80084]" | "[from:17000, to: 21000000]" | "[from:17000, to: 42793]" | "[from:17000, to: 1923]" | "[from:17000, to: 239]" | "[from:143, to: 80094]" | "[from:143, to: 80084]" | "[from:143, to: 21000000]" | "[from:143, to: 42793]" | "[from:143, to: 1923]" | "[from:143, to: 239]" | "[from:988, to: 80094]" | "[from:988, to: 80084]" | "[from:988, to: 21000000]" | "[from:988, to: 42793]" | "[from:988, to: 1923]" | "[from:988, to: 239]", BridgeInfo>;
|
|
28
28
|
/** Gets the bridge information */
|
|
29
29
|
export declare const getBridgeInfo: (from: BridgeChain, to: BridgeChain) => BridgeInfo | undefined;
|
|
30
30
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/bridge/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAIrC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM1D,eAAO,MAAM,iBAAiB,WAAsB,CAAC;AAErD,oBAAY,UAAU;IACpB,+DAA+D;IAC/D,IAAI,SAAS;IAEb,iDAAiD;IACjD,GAAG,QAAQ;CACZ;AAED,eAAO,MAAM,uBAAuB;;;CAGnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/bridge/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAIrC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM1D,eAAO,MAAM,iBAAiB,WAAsB,CAAC;AAErD,oBAAY,UAAU;IACpB,+DAA+D;IAC/D,IAAI,SAAS;IAEb,iDAAiD;IACjD,GAAG,QAAQ;CACZ;AAED,eAAO,MAAM,uBAAuB;;;CAGnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,yFAe9B,CAAC;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,eAAO,MAAM,iBAAiB,kEAW7B,CAAC;AAEF,eAAO,MAAM,aAAa,yIAGxB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,cAAc,CAAC;AAE3D,eAAO,MAAM,aAAa,QAAS,CAAC;AACpC,eAAO,MAAM,gBAAgB,SAAU,CAAC;AACxC,eAAO,MAAM,uBAAuB,gEAWnC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAUhE,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC;AA4Q/D,eAAO,MAAM,OAAO,whRAGlB,CAAC;AAEH,kCAAkC;AAClC,eAAO,MAAM,aAAa,GAAI,MAAM,WAAW,EAAE,IAAI,WAAW,2BAE/D,CAAC"}
|
package/dist/bridge.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./chunks/bridge-BzRlY9pP.cjs");exports.OFT_GAS_LIMIT=I.OFT_GAS_LIMIT;exports.OFT_HI_GAS_LIMIT=I.OFT_HI_GAS_LIMIT;exports.OFT_HI_GAS_LIMIT_CHAINS=I.OFT_HI_GAS_LIMIT_CHAINS;exports.bridge=I.bridge;exports.bridgeCCIP=I.bridgeCCIP;exports.bridgeOFT=I.bridgeOFT;exports.getBridgeInfo=I.getBridgeInfo;
|
|
2
|
+
//# sourceMappingURL=bridge.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/bridge.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { O as a, a as e, b as s, c as T, d as g, e as r, g as d } from "./chunks/bridge-CTsiodO1.js";
|
|
2
|
+
export {
|
|
3
|
+
a as OFT_GAS_LIMIT,
|
|
4
|
+
e as OFT_HI_GAS_LIMIT,
|
|
5
|
+
s as OFT_HI_GAS_LIMIT_CHAINS,
|
|
6
|
+
T as bridge,
|
|
7
|
+
g as bridgeCCIP,
|
|
8
|
+
r as bridgeOFT,
|
|
9
|
+
d as getBridgeInfo
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/btc.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./chunks/BtcActions-ByhBml_1.cjs"),c=require("./chunks/statusConstants-fmtIEEEM.cjs");exports.BtcActions=t.BtcActions;exports.BtcDeposit=t.BtcDeposit;exports.BtcDepositAndDeploy=t.BtcDepositAndDeploy;exports.BtcStake=t.BtcStake;exports.BtcStakeAndDeploy=t.BtcStakeAndDeploy;exports.btcActions=t.btcActions;exports.btcModule=t.btcModule;exports.BtcActionStatus=c.BtcActionStatus;
|
|
2
|
+
//# sourceMappingURL=btc.cjs.map
|
package/dist/btc.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"btc.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/btc.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { B as a, a as c, b as o, c as e, d as B, e as p, f as i } from "./chunks/BtcActions-C_A1dUQ0.js";
|
|
2
|
+
import { B as A } from "./chunks/statusConstants-CJk6vOiM.js";
|
|
3
|
+
export {
|
|
4
|
+
A as BtcActionStatus,
|
|
5
|
+
a as BtcActions,
|
|
6
|
+
c as BtcDeposit,
|
|
7
|
+
o as BtcDepositAndDeploy,
|
|
8
|
+
e as BtcStake,
|
|
9
|
+
B as BtcStakeAndDeploy,
|
|
10
|
+
p as btcActions,
|
|
11
|
+
i as btcModule
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=btc.js.map
|
package/dist/btc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"btc.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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-fmtIEEEM.cjs"),u=require("./index-BKzxeh1Y.cjs"),f=require("./tokens-D_HeVB5p.cjs"),l=require("./satoshi-CZEsHl5X.cjs"),h=require("./defi-registry-BIRv_zkp.cjs"),R=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 y(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 V=await e.getCurrentBlockHeight(i),_=Math.max(0,V-d),B=_>=n,T=c.isClaimed??!1,N={confirmations:_,requiredConfirmations:n,hasEnoughConfirmations:B,isClaimed:T,steps:{created:t.StepStatus.COMPLETE,verifying:B?t.StepStatus.COMPLETE:t.StepStatus.PENDING,issuing:T?t.StepStatus.COMPLETE:t.StepStatus.PENDING}};return a==null||a(N),T&&(o==null||o()),N}function I(s){if(s===R.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(){const i=this.getStatusConfig();return this.assertStatus(i.ready,"generateDepositAddress"),this.ensureAuthorized(),this._depositAddress?this._depositAddress:this.act(async()=>{const e=this.getDepositAddressParams(),n=await this.ctx.api.generateDepositAddress(e);I(n),this._depositAddress=n;const a=this.getInitialSteps(),o=Object.fromEntries(Object.entries(a).map(([c],d)=>[c,d===0?t.StepStatus.COMPLETE:t.StepStatus.IDLE]));return this.emitProgress({status:i.addressReady,steps:o,metadata:{depositAddress:n}}),n},i.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 y({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 b 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(){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}}async generateDepositAddress(){if(!this.authState.signature){const i=await g.signDestination(this.ctx,this.ensureRecipient(),this.chainId);this.authState.signature=i.signature,this.authState.typedData=i.typedData}return this.generateDepositAddressImpl()}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 R.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 k(s){return s in h.DEFI_REGISTRY}function At(s){if(!k(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 v={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:[...v.mainnet,...v.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 O(s){return s in h.DEFI_REGISTRY}function L(s){if(!O(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 P 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(!O(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(){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}}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,L(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:L(this.params.protocol),token:a});this.authState.signature=o.signature,this.authState.typedData=o.typedData,this.authState.authorized=!0},t.BtcActionStatus.READY)}async generateDepositAddress(){return this.assertStatus(t.BtcActionStatus.READY,"generateDepositAddress"),this.ensureAuthorized(),this._depositAddress?this._depositAddress:this.act(async()=>{const i=this.getDepositAddressParams(),e=await this.ctx.api.generateDepositAddress(i);return I(e),this._depositAddress=e,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:e}}),e},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 y({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 F 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(){var n;const i=this.ensureRecipient(),e=this.getActiveSignature();if(!e)throw new t.LombardError(t.ValidationErrorCode.INVALID_PARAMETER,"Missing signature. Complete authorization first.");return{address:e.paddedAddress??i,chainId:this.chainId,signature:e.signature,token:this.getExpectedToken(),eip712Data:(n=this.authState.networkFee)==null?void 0:n.typedData,pubKey:e.pubKey,partnerId:this.ctx.partner.getPartnerId(),referrerCode:this._referralCode}}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(){if(this.assertStatus(t.BtcActionStatus.READY,"generateDepositAddress"),this.ensureAuthorized(),this._depositAddress)return this._depositAddress;if(!this.getActiveSignature()){const i=await this.config.getSignature(this.ctx,this.ensureRecipient(),this.chainId);this.authState.destinationSignature=i}return this.act(async()=>{const i=this.getDepositAddressParams(),e=await this.ctx.api.generateDepositAddress(i);return I(e),this._depositAddress=e,this.emitProgress({status:t.BtcActionStatus.ADDRESS_READY,steps:{created:t.StepStatus.COMPLETE,verifying:t.StepStatus.IDLE,issuing:t.StepStatus.IDLE},metadata:{depositAddress:e}}),e},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 x 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(!k(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(){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}}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(){return this.assertStatus(t.BtcActionStatus.READY,"generateDepositAddress"),this.ensureAuthorized(),this._depositAddress?this._depositAddress:this.act(async()=>{const i=this.getDepositAddressParams(),e=await this.ctx.api.generateDepositAddress(i);return I(e),this._depositAddress=e,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:e}}),e},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 y({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 M{constructor(r){A(this,"ctx");this.ctx=t.createBtcCoreContext(r)}stake(r){return new F(this.ctx,r)}stakeAndDeploy(r){return new x(this.ctx,r)}deposit(r){return new b(this.ctx,r)}depositAndDeploy(r){return new P(this.ctx,r)}}function Ft(s){return new M(s)}exports.BtcActions=M;exports.BtcDeposit=b;exports.BtcDepositAndDeploy=P;exports.BtcStake=F;exports.BtcStakeAndDeploy=x;exports.btcActions=Ft;exports.btcModule=Q;
|
|
2
|
+
//# sourceMappingURL=BtcActions-ByhBml_1.cjs.map
|