@lombard.finance/sdk 4.2.0 → 4.3.1
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 +2 -90
- package/README.md +10 -59
- package/dist/api.cjs +1 -1
- package/dist/api.js +5 -5
- 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 +1 -1
- package/dist/bridge.js +1 -1
- package/dist/btc.cjs +1 -1
- package/dist/btc.js +2 -2
- package/dist/chains/evm/actions/deploy/EvmDeploy.d.ts.map +1 -1
- package/dist/chains/evm/actions/stake/EvmStake.d.ts.map +1 -1
- package/dist/chains/evm/actions/withdraw/EvmWithdraw.d.ts.map +1 -1
- package/dist/chunks/{BtcActions-DGqmtxjd.js → BtcActions-1_ZaUpvL.js} +20 -20
- package/dist/chunks/{BtcActions-DGqmtxjd.js.map → BtcActions-1_ZaUpvL.js.map} +1 -1
- package/dist/chunks/{BtcActions-D9eBmDj6.cjs → BtcActions-DH_wPOz5.cjs} +2 -2
- package/dist/chunks/{BtcActions-D9eBmDj6.cjs.map → BtcActions-DH_wPOz5.cjs.map} +1 -1
- package/dist/chunks/EvmActions-CjExg-28.cjs +2 -0
- package/dist/chunks/EvmActions-CjExg-28.cjs.map +1 -0
- package/dist/chunks/{EvmActions-MW5mNmqs.js → EvmActions-fH7CLc6N.js} +207 -207
- package/dist/chunks/EvmActions-fH7CLc6N.js.map +1 -0
- package/dist/chunks/{ReferralsClient-DUwyIUe3.cjs → ReferralsClient-BC-1wT1q.cjs} +2 -2
- package/dist/chunks/{ReferralsClient-DUwyIUe3.cjs.map → ReferralsClient-BC-1wT1q.cjs.map} +1 -1
- package/dist/chunks/{ReferralsClient-JjWLlIO4.js → ReferralsClient-DbFWWtVi.js} +20 -20
- package/dist/chunks/{ReferralsClient-JjWLlIO4.js.map → ReferralsClient-DbFWWtVi.js.map} +1 -1
- package/dist/chunks/approveLBTC-B5-ZWqct.js +26 -0
- package/dist/chunks/{approveLBTC-DOP0wsm3.js.map → approveLBTC-B5-ZWqct.js.map} +1 -1
- package/dist/chunks/{approveLBTC-CN6rJF6_.cjs → approveLBTC-CZiZmdcX.cjs} +2 -2
- package/dist/chunks/{approveLBTC-CN6rJF6_.cjs.map → approveLBTC-CZiZmdcX.cjs.map} +1 -1
- package/dist/chunks/blockchain-identifier-BmadkNtK.js +113 -0
- package/dist/chunks/blockchain-identifier-BmadkNtK.js.map +1 -0
- package/dist/chunks/{blockchain-identifier-DtIGGlIi.cjs → blockchain-identifier-BzMQWh-C.cjs} +2 -2
- 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-DyAiDpxD.js → bridge-CTsiodO1.js} +72 -95
- package/dist/chunks/bridge-CTsiodO1.js.map +1 -0
- package/dist/chunks/{config-_8X_2sG4.js → config-hFKqUyg3.js} +2 -2
- package/dist/chunks/{config-_8X_2sG4.js.map → config-hFKqUyg3.js.map} +1 -1
- package/dist/chunks/{config-DqbLaiRi.cjs → config-l4ZaZw_g.cjs} +2 -2
- package/dist/chunks/{config-DqbLaiRi.cjs.map → config-l4ZaZw_g.cjs.map} +1 -1
- package/dist/chunks/{defi-registry-NGWlyxAY.cjs → defi-registry-BIRv_zkp.cjs} +2 -2
- package/dist/chunks/{defi-registry-NGWlyxAY.cjs.map → defi-registry-BIRv_zkp.cjs.map} +1 -1
- package/dist/chunks/{defi-registry-dhrQMy94.js → defi-registry-wNFN3qyB.js} +7 -7
- package/dist/chunks/{defi-registry-dhrQMy94.js.map → defi-registry-wNFN3qyB.js.map} +1 -1
- package/dist/chunks/{depositStatus-K6gky8zH.cjs → depositStatus-C3-EgT2a.cjs} +2 -2
- package/dist/chunks/{depositStatus-K6gky8zH.cjs.map → depositStatus-C3-EgT2a.cjs.map} +1 -1
- package/dist/chunks/{depositStatus-DeCO-K5Q.js → depositStatus-DM7fRmbN.js} +8 -8
- package/dist/chunks/{depositStatus-DeCO-K5Q.js.map → depositStatus-DM7fRmbN.js.map} +1 -1
- package/dist/chunks/{events-DIKZG4SZ.cjs → events-DURabzL2.cjs} +2 -2
- package/dist/chunks/{events-DIKZG4SZ.cjs.map → events-DURabzL2.cjs.map} +1 -1
- package/dist/chunks/{events-CLVUaKQS.js → events-bwurClEA.js} +35 -35
- package/dist/chunks/{events-CLVUaKQS.js.map → events-bwurClEA.js.map} +1 -1
- package/dist/chunks/{get-exchange-ratio-CM8W0jTw.cjs → get-exchange-ratio-C-7DadfD.cjs} +2 -2
- package/dist/chunks/{get-exchange-ratio-CM8W0jTw.cjs.map → get-exchange-ratio-C-7DadfD.cjs.map} +1 -1
- package/dist/chunks/get-exchange-ratio-NtnkG1kZ.js +20 -0
- package/dist/chunks/{get-exchange-ratio-B0CNEGOB.js.map → get-exchange-ratio-NtnkG1kZ.js.map} +1 -1
- package/dist/chunks/{get-positions-summary-Cled5YPA.js → get-positions-summary-B_MmGHLv.js} +4 -4
- package/dist/chunks/{get-positions-summary-Cled5YPA.js.map → get-positions-summary-B_MmGHLv.js.map} +1 -1
- package/dist/chunks/{get-positions-summary-Co7RZBiK.cjs → get-positions-summary-DkZZYbGP.cjs} +2 -2
- package/dist/chunks/{get-positions-summary-Co7RZBiK.cjs.map → get-positions-summary-DkZZYbGP.cjs.map} +1 -1
- package/dist/chunks/{get-vault-tvl-Bydlvlrv.cjs → get-vault-tvl-DmTUbOY7.cjs} +2 -2
- package/dist/chunks/{get-vault-tvl-Bydlvlrv.cjs.map → get-vault-tvl-DmTUbOY7.cjs.map} +1 -1
- package/dist/chunks/{get-vault-tvl-DxjO9xDs.js → get-vault-tvl-YAXePAW3.js} +4 -4
- package/dist/chunks/{get-vault-tvl-DxjO9xDs.js.map → get-vault-tvl-YAXePAW3.js.map} +1 -1
- package/dist/chunks/{get-vault-withdrawals-CSQqKFB8.js → get-vault-withdrawals-BrpZlt6s.js} +3 -3
- package/dist/chunks/{get-vault-withdrawals-CSQqKFB8.js.map → get-vault-withdrawals-BrpZlt6s.js.map} +1 -1
- package/dist/chunks/{get-vault-withdrawals-DBA3ok0m.cjs → get-vault-withdrawals-CWcYy_sH.cjs} +2 -2
- package/dist/chunks/{get-vault-withdrawals-DBA3ok0m.cjs.map → get-vault-withdrawals-CWcYy_sH.cjs.map} +1 -1
- package/dist/chunks/{getSharesByAddress-De7as74h.cjs → getSharesByAddress-BEgOf1C0.cjs} +2 -2
- package/dist/chunks/{getSharesByAddress-De7as74h.cjs.map → getSharesByAddress-BEgOf1C0.cjs.map} +1 -1
- package/dist/chunks/{getSharesByAddress-CK2q7gBI.js → getSharesByAddress-BiruCDp6.js} +14 -14
- package/dist/chunks/{getSharesByAddress-CK2q7gBI.js.map → getSharesByAddress-BiruCDp6.js.map} +1 -1
- package/dist/chunks/{getUserStakeAndBakeSignature--XsK93Lb.cjs → getUserStakeAndBakeSignature-BxRq2cI1.cjs} +2 -2
- package/dist/chunks/{getUserStakeAndBakeSignature--XsK93Lb.cjs.map → getUserStakeAndBakeSignature-BxRq2cI1.cjs.map} +1 -1
- package/dist/chunks/{getUserStakeAndBakeSignature-2xPkL9v_.js → getUserStakeAndBakeSignature-NGGblnJl.js} +11 -11
- package/dist/chunks/{getUserStakeAndBakeSignature-2xPkL9v_.js.map → getUserStakeAndBakeSignature-NGGblnJl.js.map} +1 -1
- package/dist/chunks/index-BKzxeh1Y.cjs.map +1 -1
- package/dist/chunks/index-CfcQ_g3t.js.map +1 -1
- package/dist/chunks/{lbtc-addresses-NHg9Gk5y.js → lbtc-addresses-BLRmtR3c.js} +2 -2
- package/dist/chunks/{lbtc-addresses-NHg9Gk5y.js.map → lbtc-addresses-BLRmtR3c.js.map} +1 -1
- package/dist/chunks/{lbtc-addresses-bj--zuK9.cjs → lbtc-addresses-xyTYV7hx.cjs} +2 -2
- package/dist/chunks/{lbtc-addresses-bj--zuK9.cjs.map → lbtc-addresses-xyTYV7hx.cjs.map} +1 -1
- package/dist/chunks/{statusConstants-ZJia15m2.js → statusConstants-CZi3v4OC.js} +844 -853
- package/dist/chunks/statusConstants-CZi3v4OC.js.map +1 -0
- package/dist/chunks/statusConstants-JFhg-q-u.cjs +2 -0
- package/dist/chunks/statusConstants-JFhg-q-u.cjs.map +1 -0
- package/dist/chunks/{storeNetworkFeeSignature-BZUZOxns.js → storeNetworkFeeSignature-BZGL2Zn_.js} +8 -8
- package/dist/chunks/{storeNetworkFeeSignature-BZUZOxns.js.map → storeNetworkFeeSignature-BZGL2Zn_.js.map} +1 -1
- package/dist/chunks/{storeNetworkFeeSignature-pV7xUOSo.cjs → storeNetworkFeeSignature-D7yo6lDV.cjs} +2 -2
- package/dist/chunks/{storeNetworkFeeSignature-pV7xUOSo.cjs.map → storeNetworkFeeSignature-D7yo6lDV.cjs.map} +1 -1
- 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-Bw35TZqd.js → tokens-C6qZHzph.js} +28 -30
- 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-Huy_ncVl.js → unstakeLBTC-DAIR9NO_.js} +373 -360
- package/dist/chunks/unstakeLBTC-DAIR9NO_.js.map +1 -0
- package/dist/chunks/unstakeLBTC-H0zdYQa6.cjs +2 -0
- package/dist/chunks/unstakeLBTC-H0zdYQa6.cjs.map +1 -0
- package/dist/chunks/{withdraw-Z77x7Hj4.cjs → withdraw-C1fMFSwy.cjs} +2 -2
- package/dist/chunks/{withdraw-Z77x7Hj4.cjs.map → withdraw-C1fMFSwy.cjs.map} +1 -1
- package/dist/chunks/{withdraw-CVNVJ7-x.js → withdraw-hHueI2p7.js} +9 -9
- package/dist/chunks/{withdraw-CVNVJ7-x.js.map → withdraw-hHueI2p7.js.map} +1 -1
- package/dist/clients/rpc-url-config.d.ts.map +1 -1
- package/dist/common/chains.d.ts +343 -112
- 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 +1 -1
- package/dist/contracts.js +26 -24
- 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 +1 -1
- package/dist/core.js +29 -29
- package/dist/defi.cjs +1 -1
- package/dist/defi.js +3 -3
- 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 +1 -1
- package/dist/evm.js +34 -35
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +188 -187
- package/dist/metrics.cjs +1 -1
- package/dist/metrics.js +1 -1
- 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 +1 -1
- package/dist/utils.js +48 -49
- package/dist/vaults.cjs +1 -1
- package/dist/vaults.js +15 -15
- package/package.json +2 -2
- package/dist/chunks/EvmActions-BOwYPThp.cjs +0 -2
- package/dist/chunks/EvmActions-BOwYPThp.cjs.map +0 -1
- package/dist/chunks/EvmActions-MW5mNmqs.js.map +0 -1
- package/dist/chunks/approveLBTC-DOP0wsm3.js +0 -26
- package/dist/chunks/blockchain-identifier-DtIGGlIi.cjs.map +0 -1
- package/dist/chunks/blockchain-identifier-PNEhu-QU.js +0 -113
- package/dist/chunks/blockchain-identifier-PNEhu-QU.js.map +0 -1
- package/dist/chunks/bridge-DkZMwO7c.cjs +0 -12
- package/dist/chunks/bridge-DkZMwO7c.cjs.map +0 -1
- package/dist/chunks/bridge-DyAiDpxD.js.map +0 -1
- package/dist/chunks/get-exchange-ratio-B0CNEGOB.js +0 -20
- package/dist/chunks/statusConstants-DTDi_4Go.cjs +0 -2
- package/dist/chunks/statusConstants-DTDi_4Go.cjs.map +0 -1
- package/dist/chunks/statusConstants-ZJia15m2.js.map +0 -1
- package/dist/chunks/token-addresses-D859i6tX.cjs +0 -2
- package/dist/chunks/token-addresses-D859i6tX.cjs.map +0 -1
- package/dist/chunks/token-addresses-DmAr89jP.js +0 -579
- package/dist/chunks/token-addresses-DmAr89jP.js.map +0 -1
- package/dist/chunks/tokens-Bw35TZqd.js.map +0 -1
- package/dist/chunks/tokens-DLGMNeqZ.cjs +0 -2
- package/dist/chunks/tokens-DLGMNeqZ.cjs.map +0 -1
- package/dist/chunks/unstakeLBTC-CqZzj9WL.cjs +0 -2
- package/dist/chunks/unstakeLBTC-CqZzj9WL.cjs.map +0 -1
- package/dist/chunks/unstakeLBTC-Huy_ncVl.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (n, a, t) =>
|
|
1
|
+
var et = Object.defineProperty;
|
|
2
|
+
var st = (n, a, t) => a in n ? et(n, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[a] = t;
|
|
3
|
+
var u = (n, a, t) => st(n, typeof a != "symbol" ? a + "" : a, t);
|
|
4
4
|
import w from "bignumber.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { e as
|
|
9
|
-
import { g as
|
|
10
|
-
import { r as
|
|
11
|
-
import {
|
|
5
|
+
import { m as U, v as z, q as at, w as it, u as rt, C as M, c as nt, t as W, r as ot, a as ct, e as ht } from "./unstakeLBTC-DAIR9NO_.js";
|
|
6
|
+
import { o as l, U as $, a as Z, A as ut, b as V } from "./token-addresses-FKpA3uc4.js";
|
|
7
|
+
import { e as q, m as O, t as b, b as H, f as G } from "./tokens-C6qZHzph.js";
|
|
8
|
+
import { a as C, y as P, c as e, z as S, L as c, X as _, g as i, A as x, Y as L, Z as pt, _ as K, $ as I, x as Q, a0 as j, a1 as y, a2 as dt } from "./statusConstants-CZi3v4OC.js";
|
|
9
|
+
import { g as mt, s as vt } from "./storeNetworkFeeSignature-BZGL2Zn_.js";
|
|
10
|
+
import { r as lt } from "./fee-requirements-x8-8mpJ7.js";
|
|
11
|
+
import { a as T, A as v } from "./defi-registry-wNFN3qyB.js";
|
|
12
12
|
import { r } from "./index-CfcQ_g3t.js";
|
|
13
|
-
import { t as
|
|
14
|
-
import { c as B, a as D, b as
|
|
15
|
-
import { d as
|
|
16
|
-
class
|
|
13
|
+
import { t as X } from "./numbers-CM-lcmt4.js";
|
|
14
|
+
import { c as B, a as D, b as J } from "./config-hFKqUyg3.js";
|
|
15
|
+
import { d as Et, c as _t, q as Ct } from "./withdraw-hHueI2p7.js";
|
|
16
|
+
class gt {
|
|
17
17
|
constructor(a) {
|
|
18
18
|
this.env = a;
|
|
19
19
|
}
|
|
@@ -23,7 +23,7 @@ class Ct {
|
|
|
23
23
|
* @param token - Optional token (defaults to LBTC). Use Token.BTCb for BTC.b deposits.
|
|
24
24
|
*/
|
|
25
25
|
async getMintingFee(a, t) {
|
|
26
|
-
return (await
|
|
26
|
+
return (await U({
|
|
27
27
|
token: t || l.LBTC,
|
|
28
28
|
chainId: a,
|
|
29
29
|
env: this.env
|
|
@@ -33,7 +33,7 @@ class Ct {
|
|
|
33
33
|
* Sign network fee authorization (EIP-712)
|
|
34
34
|
*/
|
|
35
35
|
async signNetworkFee(a) {
|
|
36
|
-
const t = await
|
|
36
|
+
const t = await z({
|
|
37
37
|
fee: new w(a.fee),
|
|
38
38
|
account: a.account,
|
|
39
39
|
chainId: a.chainId,
|
|
@@ -51,7 +51,7 @@ class Ct {
|
|
|
51
51
|
* Get stake and bake fee for a vault
|
|
52
52
|
*/
|
|
53
53
|
async getStakeAndBakeFee(a, t) {
|
|
54
|
-
return (await
|
|
54
|
+
return (await at({
|
|
55
55
|
chainId: a,
|
|
56
56
|
protocol: t
|
|
57
57
|
})).toString();
|
|
@@ -60,7 +60,7 @@ class Ct {
|
|
|
60
60
|
* Sign stake and bake authorization
|
|
61
61
|
*/
|
|
62
62
|
async signStakeAndBake(a) {
|
|
63
|
-
const t = await
|
|
63
|
+
const t = await it({
|
|
64
64
|
value: new w(a.value),
|
|
65
65
|
account: a.account,
|
|
66
66
|
chainId: a.chainId,
|
|
@@ -78,62 +78,62 @@ class Ct {
|
|
|
78
78
|
* Sign LBTC destination address (for non-Ethereum EVM chains)
|
|
79
79
|
*/
|
|
80
80
|
async signLbtcDestination(a) {
|
|
81
|
-
return { signature: await
|
|
81
|
+
return { signature: await rt({
|
|
82
82
|
account: a.address,
|
|
83
83
|
chainId: a.chainId,
|
|
84
84
|
provider: a.provider
|
|
85
85
|
}) };
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function pe() {
|
|
89
89
|
return {
|
|
90
90
|
id: "evm",
|
|
91
91
|
chain: "evm",
|
|
92
92
|
register(n) {
|
|
93
|
-
return new
|
|
93
|
+
return new gt(n.env);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
const
|
|
97
|
+
const At = {
|
|
98
98
|
routes: [
|
|
99
99
|
// Veda - Ethereum
|
|
100
100
|
{
|
|
101
|
-
asset:
|
|
102
|
-
sourceChains: [
|
|
101
|
+
asset: v.LBTC,
|
|
102
|
+
sourceChains: [C.ETHEREUM],
|
|
103
103
|
protocols: [T.Veda],
|
|
104
104
|
envs: [r.prod]
|
|
105
105
|
},
|
|
106
106
|
// Veda - Base
|
|
107
107
|
{
|
|
108
|
-
asset:
|
|
109
|
-
sourceChains: [
|
|
108
|
+
asset: v.LBTC,
|
|
109
|
+
sourceChains: [C.BASE],
|
|
110
110
|
protocols: [T.Veda],
|
|
111
111
|
envs: [r.prod]
|
|
112
112
|
},
|
|
113
113
|
// Veda - BSC
|
|
114
114
|
{
|
|
115
|
-
asset:
|
|
116
|
-
sourceChains: [
|
|
115
|
+
asset: v.LBTC,
|
|
116
|
+
sourceChains: [C.BSC],
|
|
117
117
|
protocols: [T.Veda],
|
|
118
118
|
envs: [r.prod]
|
|
119
119
|
},
|
|
120
120
|
// Veda - Corn
|
|
121
121
|
{
|
|
122
|
-
asset:
|
|
123
|
-
sourceChains: [
|
|
122
|
+
asset: v.LBTC,
|
|
123
|
+
sourceChains: [C.CORN],
|
|
124
124
|
protocols: [T.Veda],
|
|
125
125
|
envs: [r.prod]
|
|
126
126
|
},
|
|
127
127
|
// Silo - Avalanche
|
|
128
128
|
{
|
|
129
|
-
asset:
|
|
130
|
-
sourceChains: [
|
|
129
|
+
asset: v.LBTC,
|
|
130
|
+
sourceChains: [C.AVALANCHE],
|
|
131
131
|
protocols: [T.Silo],
|
|
132
132
|
envs: [r.prod]
|
|
133
133
|
}
|
|
134
134
|
]
|
|
135
135
|
};
|
|
136
|
-
class
|
|
136
|
+
class It extends P {
|
|
137
137
|
constructor(t, s) {
|
|
138
138
|
super(e.IDLE);
|
|
139
139
|
u(this, "_amount");
|
|
@@ -168,16 +168,16 @@ class At extends P {
|
|
|
168
168
|
}))[0];
|
|
169
169
|
if (!p)
|
|
170
170
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
171
|
-
this._account = p, this._chainId =
|
|
172
|
-
const
|
|
171
|
+
this._account = p, this._chainId = _(this.params.sourceChain);
|
|
172
|
+
const m = B[D.Veda], h = await q(l.LBTC, this._chainId, this.ctx.env);
|
|
173
173
|
if (!h)
|
|
174
174
|
throw c.invalidParameter("token", "Could not get LBTC token info");
|
|
175
|
-
const
|
|
175
|
+
const E = await O({ chainId: this._chainId }).readContract({
|
|
176
176
|
address: h.address,
|
|
177
177
|
abi: h.abi,
|
|
178
178
|
functionName: "allowance",
|
|
179
|
-
args: [p,
|
|
180
|
-
}), f = new w(s.amount), N =
|
|
179
|
+
args: [p, m.vaultContract.address]
|
|
180
|
+
}), f = new w(s.amount), N = b(f, h.decimals), R = new w(String(E));
|
|
181
181
|
this._needsApproval = N.isGreaterThan(R), this._needsApproval ? (this.emitProgress({
|
|
182
182
|
status: e.NEEDS_APPROVAL,
|
|
183
183
|
steps: { approval: i.PENDING, deploying: i.IDLE }
|
|
@@ -194,21 +194,21 @@ class At extends P {
|
|
|
194
194
|
const t = await this.ctx.getProvider("evm");
|
|
195
195
|
if (!t)
|
|
196
196
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
197
|
-
const s = B[D.Veda], o = await
|
|
197
|
+
const s = B[D.Veda], o = await q(l.LBTC, this._chainId, this.ctx.env);
|
|
198
198
|
if (!o)
|
|
199
199
|
throw c.invalidParameter("token", "Could not get LBTC token info");
|
|
200
|
-
const d = new w(this._amount), p =
|
|
200
|
+
const d = new w(this._amount), p = X(b(d, o.decimals)), m = O({ chainId: this._chainId }), h = $({
|
|
201
201
|
provider: t,
|
|
202
202
|
chainId: this._chainId
|
|
203
|
-
}), { request: A } = await
|
|
203
|
+
}), { request: A } = await m.simulateContract({
|
|
204
204
|
account: this._account,
|
|
205
|
-
chain:
|
|
205
|
+
chain: Z[this._chainId],
|
|
206
206
|
address: o.address,
|
|
207
207
|
abi: o.abi,
|
|
208
208
|
functionName: "approve",
|
|
209
209
|
args: [s.vaultContract.address, p]
|
|
210
|
-
});
|
|
211
|
-
await
|
|
210
|
+
}), E = await h.writeContract(A);
|
|
211
|
+
await M(m, E, "LBTC vault deposit approval"), this._needsApproval = !1, this.emitProgress({
|
|
212
212
|
status: e.READY,
|
|
213
213
|
steps: { approval: i.COMPLETE, deploying: i.PENDING }
|
|
214
214
|
});
|
|
@@ -226,7 +226,7 @@ class At extends P {
|
|
|
226
226
|
status: e.READY,
|
|
227
227
|
steps: { approval: i.COMPLETE, deploying: i.PENDING }
|
|
228
228
|
});
|
|
229
|
-
const o = await
|
|
229
|
+
const o = await Et({
|
|
230
230
|
amount: this._amount,
|
|
231
231
|
approve: !1,
|
|
232
232
|
// Approval was handled in approve() step
|
|
@@ -246,11 +246,11 @@ class At extends P {
|
|
|
246
246
|
get prepareSchema() {
|
|
247
247
|
return x({
|
|
248
248
|
amount: L,
|
|
249
|
-
protocol:
|
|
249
|
+
protocol: pt().min(1, "Protocol is required")
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
validateProtocol(t) {
|
|
253
|
-
if (!
|
|
253
|
+
if (!At.routes.some(
|
|
254
254
|
(o) => o.protocols.includes(t) && o.envs.includes(this.ctx.env)
|
|
255
255
|
))
|
|
256
256
|
throw c.invalidParameter(
|
|
@@ -259,47 +259,47 @@ class At extends P {
|
|
|
259
259
|
);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
return new
|
|
262
|
+
function ft(n, a) {
|
|
263
|
+
return new It(n, a);
|
|
264
264
|
}
|
|
265
|
-
const
|
|
265
|
+
const Dt = [
|
|
266
266
|
.../* @__PURE__ */ new Set([
|
|
267
|
-
...I(
|
|
268
|
-
...I(
|
|
267
|
+
...I(v.WBTC, [r.prod]),
|
|
268
|
+
...I(v.BTCb, [r.prod])
|
|
269
269
|
])
|
|
270
|
-
],
|
|
270
|
+
], wt = [
|
|
271
271
|
.../* @__PURE__ */ new Set([
|
|
272
|
-
...I(
|
|
273
|
-
...I(
|
|
272
|
+
...I(v.WBTC, [r.testnet, r.stage, r.dev, r.ibc]),
|
|
273
|
+
...I(v.BTCb, [r.testnet, r.stage, r.dev, r.ibc])
|
|
274
274
|
])
|
|
275
|
-
],
|
|
275
|
+
], Pt = I(v.LBTC, [r.prod]), Tt = I(v.LBTC, [
|
|
276
276
|
r.testnet,
|
|
277
277
|
r.stage,
|
|
278
278
|
r.dev,
|
|
279
279
|
r.ibc
|
|
280
|
-
]),
|
|
280
|
+
]), St = {
|
|
281
281
|
routes: [
|
|
282
282
|
// Production: WBTC/BTCb → LBTC
|
|
283
283
|
{
|
|
284
|
-
assetsIn: [
|
|
285
|
-
assetOut:
|
|
286
|
-
sourceChains:
|
|
287
|
-
destChains:
|
|
284
|
+
assetsIn: [v.WBTC, v.BTCb],
|
|
285
|
+
assetOut: v.LBTC,
|
|
286
|
+
sourceChains: Dt,
|
|
287
|
+
destChains: Pt,
|
|
288
288
|
envs: [r.prod]
|
|
289
289
|
},
|
|
290
290
|
// Testnet
|
|
291
291
|
{
|
|
292
|
-
assetsIn: [
|
|
293
|
-
assetOut:
|
|
294
|
-
sourceChains:
|
|
295
|
-
destChains:
|
|
292
|
+
assetsIn: [v.WBTC, v.BTCb],
|
|
293
|
+
assetOut: v.LBTC,
|
|
294
|
+
sourceChains: wt,
|
|
295
|
+
destChains: Tt,
|
|
296
296
|
envs: [r.testnet, r.stage, r.dev, r.ibc]
|
|
297
297
|
}
|
|
298
298
|
],
|
|
299
|
-
addressSchema:
|
|
299
|
+
addressSchema: K
|
|
300
300
|
};
|
|
301
301
|
var g = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.NEEDS_APPROVAL = "needs-approval", n.READY = "ready", n.BRIDGING = "bridging", n.COMPLETED = "completed", n))(g || {});
|
|
302
|
-
class
|
|
302
|
+
class xt extends P {
|
|
303
303
|
constructor(t, s) {
|
|
304
304
|
super(g.IDLE);
|
|
305
305
|
u(this, "_amount");
|
|
@@ -351,7 +351,7 @@ class St extends P {
|
|
|
351
351
|
const t = await this.ctx.getProvider("evm");
|
|
352
352
|
if (!t)
|
|
353
353
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
354
|
-
const s =
|
|
354
|
+
const s = _(this.params.destChain);
|
|
355
355
|
this.emitProgress({
|
|
356
356
|
status: g.READY,
|
|
357
357
|
steps: {
|
|
@@ -360,7 +360,7 @@ class St extends P {
|
|
|
360
360
|
bridging: i.IDLE
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
|
-
const o = await
|
|
363
|
+
const o = await nt({
|
|
364
364
|
provider: t,
|
|
365
365
|
account: this._recipient,
|
|
366
366
|
data: this._claimData.data,
|
|
@@ -381,43 +381,43 @@ class St extends P {
|
|
|
381
381
|
get prepareSchema() {
|
|
382
382
|
return x({
|
|
383
383
|
amount: L,
|
|
384
|
-
recipient:
|
|
384
|
+
recipient: St.addressSchema
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
function
|
|
389
|
-
return new
|
|
388
|
+
function Lt(n, a) {
|
|
389
|
+
return new xt(n, a);
|
|
390
390
|
}
|
|
391
|
-
const
|
|
391
|
+
const Nt = I(v.BTCb, [r.prod]), Ot = I(v.BTCb, [
|
|
392
392
|
r.testnet,
|
|
393
393
|
r.stage,
|
|
394
394
|
r.dev,
|
|
395
395
|
r.ibc
|
|
396
|
-
]),
|
|
396
|
+
]), Bt = {
|
|
397
397
|
routes: [
|
|
398
398
|
// BTC.b → BTC (to Bitcoin Mainnet)
|
|
399
399
|
{
|
|
400
|
-
assetIn:
|
|
401
|
-
assetOut:
|
|
402
|
-
sourceChains:
|
|
403
|
-
destChain:
|
|
400
|
+
assetIn: v.BTCb,
|
|
401
|
+
assetOut: v.BTC,
|
|
402
|
+
sourceChains: Nt,
|
|
403
|
+
destChain: C.BITCOIN_MAINNET,
|
|
404
404
|
envs: [r.prod]
|
|
405
405
|
},
|
|
406
406
|
// BTC.b → BTC (to Bitcoin Signet - testnet)
|
|
407
407
|
{
|
|
408
|
-
assetIn:
|
|
409
|
-
assetOut:
|
|
410
|
-
sourceChains:
|
|
411
|
-
destChain:
|
|
408
|
+
assetIn: v.BTCb,
|
|
409
|
+
assetOut: v.BTC,
|
|
410
|
+
sourceChains: Ot,
|
|
411
|
+
destChain: C.BITCOIN_SIGNET,
|
|
412
412
|
envs: [r.testnet, r.stage, r.dev, r.ibc]
|
|
413
413
|
}
|
|
414
414
|
// TODO: Add L-Asset routes when deployed
|
|
415
415
|
// L-ZEC → ZEC, L-SOL → SOL, L-XRP → XRP, L-DOGE → DOGE
|
|
416
416
|
],
|
|
417
|
-
recipientSchema:
|
|
417
|
+
recipientSchema: Q
|
|
418
418
|
};
|
|
419
419
|
async function k(n, a, t, s) {
|
|
420
|
-
if (!
|
|
420
|
+
if (!lt(n))
|
|
421
421
|
return {
|
|
422
422
|
requiresAuth: !1,
|
|
423
423
|
hasValidSignature: !1,
|
|
@@ -425,31 +425,31 @@ async function k(n, a, t, s) {
|
|
|
425
425
|
feeFormatted: null,
|
|
426
426
|
expirationDate: null
|
|
427
427
|
};
|
|
428
|
-
const o = await
|
|
428
|
+
const o = await H(s, n, t), d = await mt({
|
|
429
429
|
address: a,
|
|
430
430
|
chainId: n,
|
|
431
431
|
env: t,
|
|
432
432
|
tokenAddress: o.address
|
|
433
|
-
}), p = d.expirationDate ? new Date(Number(d.expirationDate) * 1e3) < /* @__PURE__ */ new Date() : !1,
|
|
433
|
+
}), p = d.expirationDate ? new Date(Number(d.expirationDate) * 1e3) < /* @__PURE__ */ new Date() : !1, m = d.hasSignature && !p;
|
|
434
434
|
let h = null, A = null;
|
|
435
|
-
if (!
|
|
436
|
-
const
|
|
435
|
+
if (!m) {
|
|
436
|
+
const E = await U({
|
|
437
437
|
token: s,
|
|
438
438
|
chainId: n,
|
|
439
439
|
env: t
|
|
440
440
|
});
|
|
441
|
-
h = BigInt(
|
|
441
|
+
h = BigInt(E.times(1e8).toFixed(0)), A = E.toFixed(8);
|
|
442
442
|
}
|
|
443
443
|
return {
|
|
444
444
|
requiresAuth: !0,
|
|
445
|
-
hasValidSignature:
|
|
445
|
+
hasValidSignature: m,
|
|
446
446
|
feeInSatoshis: h,
|
|
447
447
|
feeFormatted: A,
|
|
448
448
|
expirationDate: d.expirationDate ?? null
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
|
-
async function
|
|
452
|
-
const { chainId: a, account: t, feeInSatoshis: s, provider: o, env: d, token: p } = n,
|
|
451
|
+
async function F(n) {
|
|
452
|
+
const { chainId: a, account: t, feeInSatoshis: s, provider: o, env: d, token: p } = n, m = await H(p, a, d), h = await z({
|
|
453
453
|
fee: s,
|
|
454
454
|
account: t,
|
|
455
455
|
chainId: a,
|
|
@@ -457,15 +457,15 @@ async function H(n) {
|
|
|
457
457
|
env: d,
|
|
458
458
|
token: p
|
|
459
459
|
});
|
|
460
|
-
return await
|
|
460
|
+
return await vt({
|
|
461
461
|
signature: h.signature,
|
|
462
462
|
typedData: h.typedData,
|
|
463
463
|
address: t,
|
|
464
464
|
env: d,
|
|
465
|
-
tokenAddress:
|
|
465
|
+
tokenAddress: m.address
|
|
466
466
|
}), h;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function Y() {
|
|
469
469
|
return {
|
|
470
470
|
requiresAuth: !1,
|
|
471
471
|
isAuthorized: !1,
|
|
@@ -474,14 +474,14 @@ function F() {
|
|
|
474
474
|
expirationDate: null
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
|
-
class
|
|
477
|
+
class Rt extends P {
|
|
478
478
|
constructor(t, s) {
|
|
479
479
|
super(e.IDLE);
|
|
480
480
|
u(this, "_amount");
|
|
481
481
|
u(this, "_recipient");
|
|
482
482
|
u(this, "_needsApproval", !1);
|
|
483
483
|
u(this, "_txHash");
|
|
484
|
-
u(this, "_feeAuth",
|
|
484
|
+
u(this, "_feeAuth", Y());
|
|
485
485
|
this.ctx = t, this.params = s;
|
|
486
486
|
}
|
|
487
487
|
get amount() {
|
|
@@ -506,14 +506,14 @@ class Bt extends P {
|
|
|
506
506
|
destChain: this.params.destChain
|
|
507
507
|
});
|
|
508
508
|
this._amount = s.amount, this._recipient = s.recipient;
|
|
509
|
-
const o =
|
|
509
|
+
const o = _(this.params.sourceChain), d = await this.ctx.getProvider("evm");
|
|
510
510
|
if (!d)
|
|
511
511
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
512
|
-
const
|
|
512
|
+
const m = (await d.request({
|
|
513
513
|
method: "eth_accounts"
|
|
514
514
|
}))[0], h = await k(
|
|
515
515
|
o,
|
|
516
|
-
|
|
516
|
+
m,
|
|
517
517
|
this.ctx.env,
|
|
518
518
|
l.BTCb
|
|
519
519
|
);
|
|
@@ -546,13 +546,13 @@ class Bt extends P {
|
|
|
546
546
|
if (this.assertStatus(e.NEEDS_FEE_AUTHORIZATION, "authorizeFee"), !this._feeAuth.feeInSatoshis)
|
|
547
547
|
throw c.missingParameter("feeInSatoshis");
|
|
548
548
|
return this.act(async () => {
|
|
549
|
-
const t =
|
|
549
|
+
const t = _(this.params.sourceChain), s = await this.ctx.getProvider("evm");
|
|
550
550
|
if (!s)
|
|
551
551
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
552
552
|
const d = (await s.request({
|
|
553
553
|
method: "eth_accounts"
|
|
554
554
|
}))[0];
|
|
555
|
-
await
|
|
555
|
+
await F({
|
|
556
556
|
chainId: t,
|
|
557
557
|
account: d,
|
|
558
558
|
feeInSatoshis: this._feeAuth.feeInSatoshis,
|
|
@@ -583,12 +583,12 @@ class Bt extends P {
|
|
|
583
583
|
}))[0];
|
|
584
584
|
if (!o)
|
|
585
585
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
586
|
-
const d =
|
|
586
|
+
const d = _(this.params.sourceChain);
|
|
587
587
|
this.emitProgress({
|
|
588
588
|
status: e.READY,
|
|
589
589
|
steps: { burning: i.PENDING, releasing: i.IDLE }
|
|
590
590
|
});
|
|
591
|
-
const p = await
|
|
591
|
+
const p = await W({
|
|
592
592
|
provider: t,
|
|
593
593
|
account: o,
|
|
594
594
|
amount: this._amount,
|
|
@@ -609,26 +609,26 @@ class Bt extends P {
|
|
|
609
609
|
get prepareSchema() {
|
|
610
610
|
return x({
|
|
611
611
|
amount: L,
|
|
612
|
-
recipient:
|
|
612
|
+
recipient: Bt.recipientSchema
|
|
613
613
|
});
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
return new
|
|
616
|
+
function bt(n, a) {
|
|
617
|
+
return new Rt(n, a);
|
|
618
618
|
}
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
|
|
619
|
+
const yt = [
|
|
620
|
+
V.avalanche,
|
|
621
|
+
V.avalancheFuji
|
|
622
622
|
];
|
|
623
|
-
function
|
|
624
|
-
return
|
|
623
|
+
function Mt(n) {
|
|
624
|
+
return yt.includes(n);
|
|
625
625
|
}
|
|
626
|
-
class
|
|
626
|
+
class Ht extends P {
|
|
627
627
|
constructor(t, s) {
|
|
628
628
|
super(e.IDLE);
|
|
629
629
|
u(this, "_amount");
|
|
630
630
|
u(this, "_txHash");
|
|
631
|
-
u(this, "_feeAuth",
|
|
631
|
+
u(this, "_feeAuth", Y());
|
|
632
632
|
u(this, "_account");
|
|
633
633
|
u(this, "_needsApproval", !1);
|
|
634
634
|
u(this, "_spenderAddress");
|
|
@@ -661,20 +661,20 @@ class Mt extends P {
|
|
|
661
661
|
if (!p)
|
|
662
662
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
663
663
|
this._account = p;
|
|
664
|
-
const
|
|
665
|
-
if (
|
|
666
|
-
const
|
|
664
|
+
const m = _(this.params.sourceChain);
|
|
665
|
+
if (Mt(m)) {
|
|
666
|
+
const E = await H(
|
|
667
667
|
l.BTCb,
|
|
668
|
-
|
|
668
|
+
m,
|
|
669
669
|
this.ctx.env,
|
|
670
|
-
|
|
670
|
+
ut.Adapter
|
|
671
671
|
);
|
|
672
|
-
this._spenderAddress =
|
|
673
|
-
const f = await
|
|
672
|
+
this._spenderAddress = E.address;
|
|
673
|
+
const f = await ot({
|
|
674
674
|
token: l.BTCb,
|
|
675
675
|
owner: p,
|
|
676
|
-
spender:
|
|
677
|
-
chainId:
|
|
676
|
+
spender: E.address,
|
|
677
|
+
chainId: m,
|
|
678
678
|
env: this.ctx.env
|
|
679
679
|
}), N = new w(s.amount);
|
|
680
680
|
if (this._needsApproval = f.isLessThan(N), this._needsApproval) {
|
|
@@ -686,7 +686,7 @@ class Mt extends P {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
const h = await k(
|
|
689
|
-
|
|
689
|
+
m,
|
|
690
690
|
p,
|
|
691
691
|
this.ctx.env,
|
|
692
692
|
l.LBTC
|
|
@@ -720,8 +720,7 @@ class Mt extends P {
|
|
|
720
720
|
const t = await this.ctx.getProvider("evm");
|
|
721
721
|
if (!t)
|
|
722
722
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
723
|
-
const s =
|
|
724
|
-
await ot({
|
|
723
|
+
const s = _(this.params.sourceChain), o = await ct({
|
|
725
724
|
account: this._account,
|
|
726
725
|
token: l.BTCb,
|
|
727
726
|
spender: this._spenderAddress,
|
|
@@ -729,7 +728,8 @@ class Mt extends P {
|
|
|
729
728
|
chainId: s,
|
|
730
729
|
provider: t,
|
|
731
730
|
env: this.ctx.env
|
|
732
|
-
}),
|
|
731
|
+
}), d = O({ chainId: s, env: this.ctx.env });
|
|
732
|
+
await M(d, o, "BTC.b approval"), this._needsApproval = !1, this.emitProgress({
|
|
733
733
|
status: e.READY,
|
|
734
734
|
steps: { approval: i.COMPLETE, staking: i.PENDING }
|
|
735
735
|
});
|
|
@@ -745,8 +745,8 @@ class Mt extends P {
|
|
|
745
745
|
const t = await this.ctx.getProvider("evm");
|
|
746
746
|
if (!t)
|
|
747
747
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
748
|
-
const s =
|
|
749
|
-
await
|
|
748
|
+
const s = _(this.params.sourceChain);
|
|
749
|
+
await F({
|
|
750
750
|
chainId: s,
|
|
751
751
|
account: this._account,
|
|
752
752
|
feeInSatoshis: this._feeAuth.feeInSatoshis,
|
|
@@ -768,7 +768,7 @@ class Mt extends P {
|
|
|
768
768
|
const t = await this.ctx.getProvider("evm");
|
|
769
769
|
if (!t)
|
|
770
770
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
771
|
-
const s =
|
|
771
|
+
const s = _(this.params.sourceChain), d = (await t.request({
|
|
772
772
|
method: "eth_accounts"
|
|
773
773
|
}))[0];
|
|
774
774
|
if (!d)
|
|
@@ -777,7 +777,7 @@ class Mt extends P {
|
|
|
777
777
|
status: e.READY,
|
|
778
778
|
steps: { staking: i.PENDING }
|
|
779
779
|
});
|
|
780
|
-
const p = await
|
|
780
|
+
const p = await ht({
|
|
781
781
|
amount: this._amount,
|
|
782
782
|
tokenIn: l.BTCb,
|
|
783
783
|
tokenOut: l.LBTC,
|
|
@@ -799,59 +799,59 @@ class Mt extends P {
|
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
function kt(n, a) {
|
|
802
|
-
return new
|
|
802
|
+
return new Ht(n, a);
|
|
803
803
|
}
|
|
804
|
-
const
|
|
804
|
+
const Ft = I(v.LBTC, [r.prod]), Yt = I(v.LBTC, [
|
|
805
805
|
r.testnet,
|
|
806
806
|
r.stage,
|
|
807
807
|
r.dev,
|
|
808
808
|
r.ibc
|
|
809
|
-
]),
|
|
810
|
-
[
|
|
809
|
+
]), Vt = j(
|
|
810
|
+
[v.LBTC, v.BTCb],
|
|
811
811
|
[r.prod]
|
|
812
|
-
),
|
|
813
|
-
[
|
|
812
|
+
), qt = j(
|
|
813
|
+
[v.LBTC, v.BTCb],
|
|
814
814
|
[r.testnet, r.stage, r.dev, r.ibc]
|
|
815
|
-
),
|
|
815
|
+
), Gt = {
|
|
816
816
|
routes: [
|
|
817
817
|
// Production: EVM chains with LBTC → Bitcoin Mainnet
|
|
818
818
|
{
|
|
819
|
-
sourceChains:
|
|
820
|
-
destChain:
|
|
819
|
+
sourceChains: Ft,
|
|
820
|
+
destChain: C.BITCOIN_MAINNET,
|
|
821
821
|
envs: [r.prod]
|
|
822
822
|
},
|
|
823
823
|
// Testnet: EVM chains with LBTC → Bitcoin Signet
|
|
824
824
|
{
|
|
825
|
-
sourceChains:
|
|
826
|
-
destChain:
|
|
825
|
+
sourceChains: Yt,
|
|
826
|
+
destChain: C.BITCOIN_SIGNET,
|
|
827
827
|
envs: [r.testnet, r.stage, r.dev, r.ibc]
|
|
828
828
|
}
|
|
829
829
|
],
|
|
830
|
-
recipientSchema:
|
|
831
|
-
},
|
|
830
|
+
recipientSchema: Q
|
|
831
|
+
}, Ut = {
|
|
832
832
|
routes: [
|
|
833
833
|
// Production: Same-chain routes for chains with both LBTC and BTCb
|
|
834
|
-
...
|
|
834
|
+
...Vt.map((n) => ({
|
|
835
835
|
sourceChains: [n],
|
|
836
836
|
destChain: n,
|
|
837
837
|
envs: [r.prod]
|
|
838
838
|
})),
|
|
839
839
|
// Testnet: Same-chain routes
|
|
840
|
-
...
|
|
840
|
+
...qt.map((n) => ({
|
|
841
841
|
sourceChains: [n],
|
|
842
842
|
destChain: n,
|
|
843
843
|
envs: [r.testnet, r.stage, r.dev, r.ibc]
|
|
844
844
|
}))
|
|
845
845
|
],
|
|
846
|
-
recipientSchema:
|
|
846
|
+
recipientSchema: K
|
|
847
847
|
};
|
|
848
|
-
class
|
|
848
|
+
class zt extends P {
|
|
849
849
|
constructor(t, s) {
|
|
850
850
|
super(e.IDLE);
|
|
851
851
|
u(this, "_amount");
|
|
852
852
|
u(this, "_recipient");
|
|
853
853
|
u(this, "_txHash");
|
|
854
|
-
u(this, "_feeAuth",
|
|
854
|
+
u(this, "_feeAuth", Y());
|
|
855
855
|
this.ctx = t, this.params = s;
|
|
856
856
|
}
|
|
857
857
|
get amount() {
|
|
@@ -869,7 +869,7 @@ class Ut extends P {
|
|
|
869
869
|
}
|
|
870
870
|
/** Whether output is BTC.b (requires fee auth on unsubsidized chains) */
|
|
871
871
|
get isBtcbOutput() {
|
|
872
|
-
return this.params.assetOut ===
|
|
872
|
+
return this.params.assetOut === v.BTCb;
|
|
873
873
|
}
|
|
874
874
|
async prepare(t) {
|
|
875
875
|
return this.assertStatus(e.IDLE, "prepare"), this.act(async () => {
|
|
@@ -877,16 +877,16 @@ class Ut extends P {
|
|
|
877
877
|
destChain: this.params.destChain
|
|
878
878
|
});
|
|
879
879
|
this._amount = s.amount, this._recipient = s.recipient;
|
|
880
|
-
const o =
|
|
880
|
+
const o = _(this.params.sourceChain);
|
|
881
881
|
if (this.isBtcbOutput) {
|
|
882
882
|
const d = await this.ctx.getProvider("evm");
|
|
883
883
|
if (!d)
|
|
884
884
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
885
|
-
const
|
|
885
|
+
const m = (await d.request({
|
|
886
886
|
method: "eth_accounts"
|
|
887
887
|
}))[0], h = await k(
|
|
888
888
|
o,
|
|
889
|
-
|
|
889
|
+
m,
|
|
890
890
|
this.ctx.env,
|
|
891
891
|
l.BTCb
|
|
892
892
|
);
|
|
@@ -920,13 +920,13 @@ class Ut extends P {
|
|
|
920
920
|
if (this.assertStatus(e.NEEDS_FEE_AUTHORIZATION, "authorizeFee"), !this._feeAuth.feeInSatoshis)
|
|
921
921
|
throw c.missingParameter("feeInSatoshis");
|
|
922
922
|
return this.act(async () => {
|
|
923
|
-
const t =
|
|
923
|
+
const t = _(this.params.sourceChain), s = await this.ctx.getProvider("evm");
|
|
924
924
|
if (!s)
|
|
925
925
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
926
926
|
const d = (await s.request({
|
|
927
927
|
method: "eth_accounts"
|
|
928
928
|
}))[0];
|
|
929
|
-
await
|
|
929
|
+
await F({
|
|
930
930
|
chainId: t,
|
|
931
931
|
account: d,
|
|
932
932
|
feeInSatoshis: this._feeAuth.feeInSatoshis,
|
|
@@ -949,12 +949,12 @@ class Ut extends P {
|
|
|
949
949
|
}))[0];
|
|
950
950
|
if (!o)
|
|
951
951
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
952
|
-
const d =
|
|
952
|
+
const d = _(this.params.sourceChain), p = this.params.assetOut === v.BTCb;
|
|
953
953
|
this.emitProgress({
|
|
954
954
|
status: e.READY,
|
|
955
955
|
steps: { burning: i.PENDING, releasing: i.IDLE }
|
|
956
956
|
});
|
|
957
|
-
const
|
|
957
|
+
const m = await W({
|
|
958
958
|
provider: t,
|
|
959
959
|
account: p ? this._recipient : o,
|
|
960
960
|
amount: this._amount,
|
|
@@ -964,37 +964,37 @@ class Ut extends P {
|
|
|
964
964
|
tokenIn: l.LBTC,
|
|
965
965
|
tokenOut: p ? l.BTCb : void 0
|
|
966
966
|
});
|
|
967
|
-
return this._txHash =
|
|
967
|
+
return this._txHash = m, this.emitProgress({
|
|
968
968
|
status: e.COMPLETED,
|
|
969
969
|
steps: {
|
|
970
970
|
burning: i.COMPLETE,
|
|
971
971
|
releasing: p ? i.COMPLETE : i.PENDING
|
|
972
972
|
}
|
|
973
|
-
}), this.emitCompleted(), { txHash:
|
|
973
|
+
}), this.emitCompleted(), { txHash: m };
|
|
974
974
|
}, e.COMPLETED);
|
|
975
975
|
}
|
|
976
976
|
get prepareSchema() {
|
|
977
|
-
const t = this.params.assetOut ===
|
|
977
|
+
const t = this.params.assetOut === v.BTC ? Gt : Ut;
|
|
978
978
|
return x({
|
|
979
979
|
amount: L,
|
|
980
980
|
recipient: t.recipientSchema
|
|
981
981
|
});
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
|
-
function
|
|
985
|
-
return new
|
|
984
|
+
function Wt(n, a) {
|
|
985
|
+
return new zt(n, a);
|
|
986
986
|
}
|
|
987
|
-
const
|
|
987
|
+
const tt = {
|
|
988
988
|
routes: [
|
|
989
989
|
// Veda - Ethereum, Base, BSC, Corn
|
|
990
990
|
{
|
|
991
|
-
sourceChains: [
|
|
991
|
+
sourceChains: [C.ETHEREUM, C.BASE, C.BSC, C.CORN],
|
|
992
992
|
protocols: [T.Veda],
|
|
993
993
|
envs: [r.prod]
|
|
994
994
|
}
|
|
995
995
|
]
|
|
996
996
|
};
|
|
997
|
-
class
|
|
997
|
+
class $t extends P {
|
|
998
998
|
constructor(t, s) {
|
|
999
999
|
super(e.IDLE);
|
|
1000
1000
|
u(this, "_txHash");
|
|
@@ -1016,9 +1016,9 @@ class Wt extends P {
|
|
|
1016
1016
|
}))[0];
|
|
1017
1017
|
if (!o)
|
|
1018
1018
|
throw c.providerMissing(this.params.chain, "evm");
|
|
1019
|
-
if (this._account = o, this._chainId =
|
|
1019
|
+
if (this._account = o, this._chainId = _(this.params.chain), !J(this._chainId))
|
|
1020
1020
|
throw new c(
|
|
1021
|
-
|
|
1021
|
+
y.PROTOCOL_NOT_SUPPORTED,
|
|
1022
1022
|
`Chain ${this.params.chain} does not support Veda vault withdrawals`,
|
|
1023
1023
|
{ chain: this.params.chain, protocol: this.params.protocol }
|
|
1024
1024
|
);
|
|
@@ -1039,7 +1039,7 @@ class Wt extends P {
|
|
|
1039
1039
|
status: e.READY,
|
|
1040
1040
|
steps: { cancelling: i.PENDING }
|
|
1041
1041
|
});
|
|
1042
|
-
const s = await
|
|
1042
|
+
const s = await _t({
|
|
1043
1043
|
vaultKey: D.Veda,
|
|
1044
1044
|
account: this._account,
|
|
1045
1045
|
chainId: this._chainId,
|
|
@@ -1053,7 +1053,7 @@ class Wt extends P {
|
|
|
1053
1053
|
}, e.COMPLETED);
|
|
1054
1054
|
}
|
|
1055
1055
|
validateProtocol(t) {
|
|
1056
|
-
if (!
|
|
1056
|
+
if (!tt.routes.some(
|
|
1057
1057
|
(o) => o.protocols.includes(t) && o.envs.includes(this.ctx.env)
|
|
1058
1058
|
))
|
|
1059
1059
|
throw c.invalidParameter(
|
|
@@ -1062,7 +1062,7 @@ class Wt extends P {
|
|
|
1062
1062
|
);
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
|
-
class
|
|
1065
|
+
class Zt extends P {
|
|
1066
1066
|
constructor(t, s) {
|
|
1067
1067
|
super(e.IDLE);
|
|
1068
1068
|
u(this, "_amount");
|
|
@@ -1097,30 +1097,30 @@ class $t extends P {
|
|
|
1097
1097
|
}))[0];
|
|
1098
1098
|
if (!p)
|
|
1099
1099
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
1100
|
-
if (this._account = p, this._chainId =
|
|
1100
|
+
if (this._account = p, this._chainId = _(this.params.sourceChain), !J(this._chainId))
|
|
1101
1101
|
throw new c(
|
|
1102
|
-
|
|
1102
|
+
y.PROTOCOL_NOT_SUPPORTED,
|
|
1103
1103
|
`Chain ${this.params.sourceChain} does not support Veda vault withdrawals`,
|
|
1104
1104
|
{ chain: this.params.sourceChain, protocol: this._protocol }
|
|
1105
1105
|
);
|
|
1106
|
-
const
|
|
1107
|
-
address:
|
|
1108
|
-
abi:
|
|
1106
|
+
const m = B[D.Veda], h = O({ chainId: this._chainId }), A = await h.readContract({
|
|
1107
|
+
address: m.lensContract.address,
|
|
1108
|
+
abi: m.lensContract.abi,
|
|
1109
1109
|
functionName: "balanceOf",
|
|
1110
|
-
args: [p,
|
|
1111
|
-
}),
|
|
1112
|
-
if (f.isGreaterThan(
|
|
1110
|
+
args: [p, m.vaultContract.address]
|
|
1111
|
+
}), E = G(String(A), m.decimals), f = new w(s.amount);
|
|
1112
|
+
if (f.isGreaterThan(E))
|
|
1113
1113
|
throw new c(
|
|
1114
|
-
|
|
1115
|
-
`Insufficient vault shares. Requested: ${f.toFixed()}, Available: ${
|
|
1116
|
-
{ requested: f.toFixed(), available:
|
|
1114
|
+
y.INSUFFICIENT_SHARES,
|
|
1115
|
+
`Insufficient vault shares. Requested: ${f.toFixed()}, Available: ${E.toFixed()}`,
|
|
1116
|
+
{ requested: f.toFixed(), available: E.toFixed() }
|
|
1117
1117
|
);
|
|
1118
1118
|
const N = await h.readContract({
|
|
1119
|
-
address:
|
|
1120
|
-
abi:
|
|
1119
|
+
address: m.vaultContract.address,
|
|
1120
|
+
abi: m.vaultContract.abi,
|
|
1121
1121
|
functionName: "allowance",
|
|
1122
|
-
args: [p,
|
|
1123
|
-
}), R =
|
|
1122
|
+
args: [p, m.withdrawQueueContracts[this._chainId].address]
|
|
1123
|
+
}), R = G(String(N), m.decimals);
|
|
1124
1124
|
this._needsApproval = f.isGreaterThan(R), this._needsApproval ? (this.emitProgress({
|
|
1125
1125
|
status: e.NEEDS_APPROVAL,
|
|
1126
1126
|
steps: { approval: i.PENDING, queueing: i.IDLE }
|
|
@@ -1137,18 +1137,18 @@ class $t extends P {
|
|
|
1137
1137
|
const t = await this.ctx.getProvider("evm");
|
|
1138
1138
|
if (!t)
|
|
1139
1139
|
throw c.providerMissing(this.params.sourceChain, "evm");
|
|
1140
|
-
const s = B[D.Veda], o = new w(this._amount), d =
|
|
1140
|
+
const s = B[D.Veda], o = new w(this._amount), d = X(b(o, s.decimals)), p = O({ chainId: this._chainId }), m = $({
|
|
1141
1141
|
provider: t,
|
|
1142
1142
|
chainId: this._chainId
|
|
1143
1143
|
}), h = this._chainId, { request: A } = await p.simulateContract({
|
|
1144
1144
|
account: this._account,
|
|
1145
|
-
chain:
|
|
1145
|
+
chain: Z[this._chainId],
|
|
1146
1146
|
address: s.vaultContract.address,
|
|
1147
1147
|
abi: s.vaultContract.abi,
|
|
1148
1148
|
functionName: "approve",
|
|
1149
1149
|
args: [s.withdrawQueueContracts[h].address, d]
|
|
1150
|
-
});
|
|
1151
|
-
await
|
|
1150
|
+
}), E = await m.writeContract(A);
|
|
1151
|
+
await M(p, E, "vault share approval"), this._needsApproval = !1, this.emitProgress({
|
|
1152
1152
|
status: e.READY,
|
|
1153
1153
|
steps: { approval: i.COMPLETE, queueing: i.PENDING }
|
|
1154
1154
|
});
|
|
@@ -1165,7 +1165,7 @@ class $t extends P {
|
|
|
1165
1165
|
status: e.READY,
|
|
1166
1166
|
steps: { approval: i.COMPLETE, queueing: i.PENDING }
|
|
1167
1167
|
});
|
|
1168
|
-
const s = await
|
|
1168
|
+
const s = await Ct({
|
|
1169
1169
|
amount: this._amount,
|
|
1170
1170
|
approve: !1,
|
|
1171
1171
|
vaultKey: D.Veda,
|
|
@@ -1186,7 +1186,7 @@ class $t extends P {
|
|
|
1186
1186
|
});
|
|
1187
1187
|
}
|
|
1188
1188
|
validateProtocol(t) {
|
|
1189
|
-
if (!
|
|
1189
|
+
if (!tt.routes.some(
|
|
1190
1190
|
(o) => o.protocols.includes(t) && o.envs.includes(this.ctx.env)
|
|
1191
1191
|
))
|
|
1192
1192
|
throw c.invalidParameter(
|
|
@@ -1195,16 +1195,16 @@ class $t extends P {
|
|
|
1195
1195
|
);
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
|
-
function Zt(n, a) {
|
|
1199
|
-
return new $t(n, a);
|
|
1200
|
-
}
|
|
1201
1198
|
function Kt(n, a) {
|
|
1202
|
-
return new
|
|
1199
|
+
return new Zt(n, a);
|
|
1200
|
+
}
|
|
1201
|
+
function Qt(n, a) {
|
|
1202
|
+
return new $t(n, a);
|
|
1203
1203
|
}
|
|
1204
1204
|
class jt {
|
|
1205
1205
|
constructor(a) {
|
|
1206
1206
|
u(this, "ctx");
|
|
1207
|
-
this.ctx =
|
|
1207
|
+
this.ctx = dt(a);
|
|
1208
1208
|
}
|
|
1209
1209
|
/**
|
|
1210
1210
|
* Stake BTC.b to receive LBTC
|
|
@@ -1242,7 +1242,7 @@ class jt {
|
|
|
1242
1242
|
* ```
|
|
1243
1243
|
*/
|
|
1244
1244
|
unstake(a) {
|
|
1245
|
-
return
|
|
1245
|
+
return Wt(this.ctx, a);
|
|
1246
1246
|
}
|
|
1247
1247
|
/**
|
|
1248
1248
|
* Deposit wrapped BTC to get LBTC
|
|
@@ -1260,7 +1260,7 @@ class jt {
|
|
|
1260
1260
|
* ```
|
|
1261
1261
|
*/
|
|
1262
1262
|
deposit(a) {
|
|
1263
|
-
return
|
|
1263
|
+
return Lt(this.ctx, a);
|
|
1264
1264
|
}
|
|
1265
1265
|
/**
|
|
1266
1266
|
* Deploy L-Assets to DeFi protocols
|
|
@@ -1278,7 +1278,7 @@ class jt {
|
|
|
1278
1278
|
* ```
|
|
1279
1279
|
*/
|
|
1280
1280
|
deploy(a) {
|
|
1281
|
-
return
|
|
1281
|
+
return ft(this.ctx, a);
|
|
1282
1282
|
}
|
|
1283
1283
|
/**
|
|
1284
1284
|
* Withdraw vault shares from DeFi protocols
|
|
@@ -1300,7 +1300,7 @@ class jt {
|
|
|
1300
1300
|
* ```
|
|
1301
1301
|
*/
|
|
1302
1302
|
withdraw(a) {
|
|
1303
|
-
return
|
|
1303
|
+
return Kt(this.ctx, a);
|
|
1304
1304
|
}
|
|
1305
1305
|
/**
|
|
1306
1306
|
* Cancel a pending withdrawal from DeFi protocols
|
|
@@ -1318,7 +1318,7 @@ class jt {
|
|
|
1318
1318
|
* ```
|
|
1319
1319
|
*/
|
|
1320
1320
|
cancelWithdraw(a) {
|
|
1321
|
-
return
|
|
1321
|
+
return Qt(this.ctx, a);
|
|
1322
1322
|
}
|
|
1323
1323
|
/**
|
|
1324
1324
|
* Redeem LBTC to BTC.b (same-chain unwrap)
|
|
@@ -1336,16 +1336,16 @@ class jt {
|
|
|
1336
1336
|
* ```
|
|
1337
1337
|
*/
|
|
1338
1338
|
redeem(a) {
|
|
1339
|
-
return
|
|
1339
|
+
return bt(this.ctx, a);
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
|
-
function
|
|
1342
|
+
function de(n) {
|
|
1343
1343
|
return new jt(n);
|
|
1344
1344
|
}
|
|
1345
1345
|
export {
|
|
1346
1346
|
jt as E,
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1347
|
+
g as a,
|
|
1348
|
+
pe as b,
|
|
1349
|
+
de as e
|
|
1350
1350
|
};
|
|
1351
|
-
//# sourceMappingURL=EvmActions-
|
|
1351
|
+
//# sourceMappingURL=EvmActions-fH7CLc6N.js.map
|