@lombard.finance/sdk-solana 1.2.2 → 2.0.0-canary.0.4
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/README.md +48 -15
- package/dist/index.cjs +1 -1
- package/dist/index.js +37 -31
- package/dist/index2.cjs +57 -54
- package/dist/index2.js +7608 -7206
- package/package.json +2 -2
- package/src/const/errors.ts +0 -4
- package/src/const/getConfig.ts +43 -20
- package/src/const/rpcUrls.ts +2 -2
- package/src/idl/asset_router.json +548 -179
- package/src/idl/consortium.json +24 -43
- package/src/idl/mailbox.json +118 -107
- package/src/index.ts +1 -3
- package/src/services/SolanaServiceImpl.test.ts +123 -0
- package/src/services/SolanaServiceImpl.ts +53 -17
- package/src/stories/components/OutputSelector/OutputSelector.tsx +1 -0
- package/src/types/errors.ts +2 -0
- package/src/utils/createDebugLogger.ts +6 -13
- package/src/utils/errors.ts +2 -0
- package/src/utils/tokenAccount.ts +3 -1
- package/src/utils/transactions.ts +1 -1
- package/src/web3Sdk/claimToken/claimBtcb.ts +37 -28
- package/src/web3Sdk/claimToken/claimLbtcGmp.ts +66 -8
- package/src/web3Sdk/claimToken/claimToken.stories.tsx +2 -2
- package/src/web3Sdk/claimToken/claimToken.ts +20 -16
- package/src/web3Sdk/claimToken/constants.ts +5 -0
- package/src/web3Sdk/claimToken/index.ts +1 -0
- package/src/web3Sdk/claimToken/shared.ts +88 -80
- package/src/web3Sdk/deposit/deposit.stories.tsx +240 -0
- package/src/web3Sdk/deposit/deposit.test.ts +327 -0
- package/src/web3Sdk/deposit/deposit.ts +339 -0
- package/src/web3Sdk/deposit/index.ts +1 -0
- package/src/web3Sdk/getTokenFeeConfig/getTokenFeeConfig.stories.tsx +166 -0
- package/src/web3Sdk/getTokenFeeConfig/getTokenFeeConfig.test.ts +224 -0
- package/src/web3Sdk/getTokenFeeConfig/getTokenFeeConfig.ts +154 -0
- package/src/web3Sdk/getTokenFeeConfig/index.ts +11 -0
- package/src/web3Sdk/index.ts +3 -4
- package/src/web3Sdk/redeem/index.ts +1 -0
- package/src/web3Sdk/redeem/redeem.stories.tsx +226 -0
- package/src/web3Sdk/redeem/redeem.test.ts +327 -0
- package/src/web3Sdk/redeem/redeem.ts +352 -0
- package/src/web3Sdk/redeemToken/redeemBtcb.ts +174 -0
- package/src/web3Sdk/redeemToken/redeemForBtc.stories.tsx +35 -21
- package/src/web3Sdk/redeemToken/redeemForBtc.test.ts +306 -0
- package/src/web3Sdk/redeemToken/redeemForBtc.ts +54 -215
- package/src/web3Sdk/redeemToken/redeemLbtc.ts +174 -0
- package/src/web3Sdk/redeemToken/shared.test.ts +45 -0
- package/src/web3Sdk/redeemToken/shared.ts +97 -0
- package/src/web3Sdk/claimLBTC/claimLBTC.stories.tsx +0 -189
- package/src/web3Sdk/claimLBTC/claimLBTC.ts +0 -225
- package/src/web3Sdk/claimLBTC/index.ts +0 -1
- package/src/web3Sdk/claimLBTC/utils/generateDepositId.ts +0 -75
- package/src/web3Sdk/claimLBTC/utils/index.ts +0 -2
- package/src/web3Sdk/claimLBTC/utils/parseTransactionLogs.ts +0 -44
- package/src/web3Sdk/claimLBTC/utils/payloadUtils.ts +0 -58
- package/src/web3Sdk/claimLBTC/utils/postMintSignatures.ts +0 -50
- package/src/web3Sdk/unstakeLBTC/index.ts +0 -1
- package/src/web3Sdk/unstakeLBTC/unstakeLBTC.stories.tsx +0 -141
- package/src/web3Sdk/unstakeLBTC/unstakeLBTC.ts +0 -140
- /package/src/web3Sdk/{claimLBTC → claimToken}/utils/__tests__/signatureUtils.test.ts +0 -0
- /package/src/web3Sdk/{claimLBTC → claimToken}/utils/signatureUtils.ts +0 -0
package/README.md
CHANGED
|
@@ -113,31 +113,64 @@ const depositAddress = await generateDepositBtcAddress({
|
|
|
113
113
|
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
### Claiming
|
|
116
|
+
### Claiming tokens (Asset Router)
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
Mints BTC.b or LBTC on Solana from a notarized deposit payload using the
|
|
119
|
+
Asset Router program. Replaces the previous `claimLBTC` helper.
|
|
120
120
|
|
|
121
|
-
```
|
|
122
|
-
|
|
121
|
+
```typescript
|
|
122
|
+
import { claimToken } from '@lombard.finance/sdk-solana';
|
|
123
|
+
|
|
124
|
+
const txHash = await claimToken(provider, {
|
|
123
125
|
recipientAddress: address,
|
|
124
|
-
|
|
126
|
+
tokenMint: getConfig(Env.prod).btcbTokenMint, // or lbtcTokenMint
|
|
125
127
|
network: 'mainnet-beta',
|
|
126
|
-
//
|
|
128
|
+
// Obtained from `getDepositsByAddress`
|
|
127
129
|
proofSignature: selectedOutput.proof,
|
|
128
130
|
rawPayload: selectedOutput.raw_payload,
|
|
129
131
|
});
|
|
130
132
|
```
|
|
131
133
|
|
|
132
|
-
###
|
|
134
|
+
### Redeeming tokens for BTC (Asset Router)
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
Burns BTC.b or LBTC on Solana and sends a GMP message through the Mailbox to
|
|
137
|
+
trigger a BTC payout to the specified Bitcoin address.
|
|
136
138
|
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
```typescript
|
|
140
|
+
import { redeemForBtc } from '@lombard.finance/sdk-solana';
|
|
141
|
+
|
|
142
|
+
// BTC.b → BTC (default)
|
|
143
|
+
const { signature } = await redeemForBtc(provider, {
|
|
144
|
+
amount: '2000',
|
|
145
|
+
btcAddress: 'bc1q...',
|
|
146
|
+
network: 'devnet',
|
|
147
|
+
env: 'stage',
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// LBTC → BTC (pass LBTC mint)
|
|
151
|
+
const { signature } = await redeemForBtc(provider, {
|
|
152
|
+
amount: '2000',
|
|
153
|
+
btcAddress: 'bc1q...',
|
|
154
|
+
tokenMint: 'LBTCojyVJ63rsEED2DLEGWMzSxWJyQynXE91LMLgV1J',
|
|
155
|
+
network: 'devnet',
|
|
156
|
+
env: 'stage',
|
|
142
157
|
});
|
|
143
158
|
```
|
|
159
|
+
|
|
160
|
+
### Redeeming LBTC for BTC.b (Asset Router)
|
|
161
|
+
|
|
162
|
+
Burns LBTC and sends a GMP message to route BTC.b to the recipient on Solana.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { redeem } from '@lombard.finance/sdk-solana';
|
|
166
|
+
|
|
167
|
+
const txHash = await redeem(provider, {
|
|
168
|
+
amount: '2000',
|
|
169
|
+
recipient: '8yarEiDaJVik7n6wX8JCbubTbtZD3WZ67Q1ytMDA2BKA',
|
|
170
|
+
network: 'devnet',
|
|
171
|
+
env: 'dev',
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Optional overrides: `tokenMint` (source token), `toTokenAddress` (destination
|
|
176
|
+
token), `toLchainId` (destination chain). All default to LBTC → BTC.b on Solana.
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index2.cjs");exports.ALREADY_MINTED_TX_HASH=e.ALREADY_MINTED_TX_HASH;exports.BFF_BASE_URL_PROD=e.BFF_BASE_URL_PROD;exports.BFF_BASE_URL_STAGE=e.BFF_BASE_URL_STAGE;exports.BFF_WS_URL_PROD=e.BFF_WS_URL_PROD;exports.BFF_WS_URL_STAGE=e.BFF_WS_URL_STAGE;exports.DEFAULT_COMMITMENT=e.DEFAULT_COMMITMENT;exports.DEFAULT_NETWORK=e.DEFAULT_NETWORK;exports.INVALID_ADDRESS_ERROR=e.INVALID_ADDRESS_ERROR;exports.InjectedWallet=e.InjectedWallet;exports.RPC_URLS=e.RPC_URLS;exports.SolanaNetwork=e.SolanaNetwork;exports.WS_URLS=e.WS_URLS;exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index2.cjs");exports.ALREADY_MINTED_TX_HASH=e.ALREADY_MINTED_TX_HASH;exports.BFF_BASE_URL_PROD=e.BFF_BASE_URL_PROD;exports.BFF_BASE_URL_STAGE=e.BFF_BASE_URL_STAGE;exports.BFF_WS_URL_PROD=e.BFF_WS_URL_PROD;exports.BFF_WS_URL_STAGE=e.BFF_WS_URL_STAGE;exports.DEFAULT_COMMITMENT=e.DEFAULT_COMMITMENT;exports.DEFAULT_NETWORK=e.DEFAULT_NETWORK;exports.INVALID_ADDRESS_ERROR=e.INVALID_ADDRESS_ERROR;exports.InjectedWallet=e.InjectedWallet;exports.RPC_URLS=e.RPC_URLS;exports.SolanaNetwork=e.SolanaNetwork;exports.WS_URLS=e.WS_URLS;exports.claimToken=e.claimToken;exports.deposit=e.deposit;exports.getBTCBAddress=e.getBTCBAddress;exports.getBalance=e.getBalance;exports.getConfig=e.getConfig;exports.getConnection=e.getConnection;exports.getLBTCAddress=e.getLBTCAddress;exports.getLBTCProgramAddress=e.getLBTCProgramAddress;exports.getMinRedeemAmountSolana=e.getMinRedeemAmountSolana;exports.getMinRedeemAmountWithFeeSolana=e.getMinRedeemAmountWithFeeSolana;exports.getMintingFeeSolana=e.getMintingFeeSolana;exports.getOftAmountCanBeSent=e.getOftAmountCanBeSent;exports.getRedeemFeeSolana=e.getRedeemFeeSolana;exports.getRpcUrl=e.getRpcUrl;exports.getSolanaWalletProvider=e.getSolanaWalletProvider;exports.getTokenFeeConfig=e.getTokenFeeConfig;exports.getUnifiedChainId=e.getUnifiedChainId;exports.isWalletAvailable=e.isWalletAvailable;exports.loadBridgeFunctions=e.loadBridgeFunctions;exports.parseOFTRecipient=e.parseOFTRecipient;exports.redeem=e.redeem;exports.redeemForBtc=e.redeemForBtc;exports.signLbtcDestinationAddrSolana=e.signLbtcDestinationAddrSolana;exports.signMessage=e.signMessage;exports.signTermsOfService=e.signTermsOfService;exports.solanaModule=e.solanaModule;
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as s, x as n, y as t, z as o, D as i, E as g, F as d, I as S, G as _, R as l, S as R, W as A, H as r, J as F, K as T, L as B, k as L, c as E, d as m, M as c, N as D, O as C, Q as M, X as U, Y as O, Z as W, _ as I, $ as f, a0 as N, a1 as p, a2 as u, a3 as P, a4 as k, a5 as v, a6 as G, a7 as H, a8 as b, a9 as h } from "./index2.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
s as ALREADY_MINTED_TX_HASH,
|
|
4
|
+
n as BFF_BASE_URL_PROD,
|
|
5
|
+
t as BFF_BASE_URL_STAGE,
|
|
6
|
+
o as BFF_WS_URL_PROD,
|
|
7
7
|
i as BFF_WS_URL_STAGE,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
B as
|
|
19
|
-
|
|
20
|
-
E as
|
|
8
|
+
g as DEFAULT_COMMITMENT,
|
|
9
|
+
d as DEFAULT_NETWORK,
|
|
10
|
+
S as INVALID_ADDRESS_ERROR,
|
|
11
|
+
_ as InjectedWallet,
|
|
12
|
+
l as RPC_URLS,
|
|
13
|
+
R as SolanaNetwork,
|
|
14
|
+
A as WS_URLS,
|
|
15
|
+
r as claimToken,
|
|
16
|
+
F as deposit,
|
|
17
|
+
T as getBTCBAddress,
|
|
18
|
+
B as getBalance,
|
|
19
|
+
L as getConfig,
|
|
20
|
+
E as getConnection,
|
|
21
|
+
m as getLBTCAddress,
|
|
21
22
|
c as getLBTCProgramAddress,
|
|
22
|
-
D as
|
|
23
|
-
C as
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
I as
|
|
29
|
-
|
|
30
|
-
N as
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
D as getMinRedeemAmountSolana,
|
|
24
|
+
C as getMinRedeemAmountWithFeeSolana,
|
|
25
|
+
M as getMintingFeeSolana,
|
|
26
|
+
U as getOftAmountCanBeSent,
|
|
27
|
+
O as getRedeemFeeSolana,
|
|
28
|
+
W as getRpcUrl,
|
|
29
|
+
I as getSolanaWalletProvider,
|
|
30
|
+
f as getTokenFeeConfig,
|
|
31
|
+
N as getUnifiedChainId,
|
|
32
|
+
p as isWalletAvailable,
|
|
33
|
+
u as loadBridgeFunctions,
|
|
34
|
+
P as parseOFTRecipient,
|
|
35
|
+
k as redeem,
|
|
36
|
+
v as redeemForBtc,
|
|
37
|
+
G as signLbtcDestinationAddrSolana,
|
|
38
|
+
H as signMessage,
|
|
39
|
+
b as signTermsOfService,
|
|
40
|
+
h as solanaModule
|
|
35
41
|
};
|