@lombard.finance/sdk 3.4.0 → 3.5.7
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 +57 -153
- package/dist/ccip.cjs +1 -2
- package/dist/ccip.js +50 -48
- package/dist/index.cjs +1 -2
- package/dist/index.js +88 -75
- package/dist/index2.cjs +65 -63
- package/dist/index2.js +12028 -10438
- package/package.json +1 -1
- package/src/api-functions/generateDepositBtcAddress/generateDepositBtcAddress.stories.tsx +7 -0
- package/src/api-functions/generateDepositBtcAddress/generateDepositBtcAddress.ts +83 -4
- package/src/api-functions/getDepositBtcAddress/getDepositBtcAddress.stories.tsx +7 -8
- package/src/api-functions/getDepositBtcAddress/getDepositBtcAddress.ts +66 -3
- package/src/api-functions/getDepositBtcAddress/getDepositBtcAddresses.stories.tsx +4 -0
- package/src/api-functions/getDepositsByAddress/getDepositsByAddress.ts +4 -2
- package/src/api-functions/getLBTCExchangeRate/get-exchange-ratio.stories.tsx +47 -0
- package/src/api-functions/getLBTCExchangeRate/get-exchange-ratio.ts +58 -0
- package/src/api-functions/getLBTCExchangeRate/getLBTCExchangeRate.stories.tsx +3 -1
- package/src/api-functions/getNetworkFeeSignature/getNetworkFeeSignature.stories.tsx +2 -0
- package/src/api-functions/getUnstakesByAddress/getUnstakesByAddress.ts +35 -6
- package/src/api-functions/getUnstakesByAddress/index.ts +5 -1
- package/src/bridge/lib/ccip-bridge.ts +1 -1
- package/src/bridge/lib/config.ts +119 -104
- package/src/clients/public-client.ts +9 -1
- package/src/clients/rpc-url-config.ts +28 -0
- package/src/common/api-config.ts +4 -3
- package/src/common/blockchain-identifier.ts +11 -0
- package/src/common/chains.stories.tsx +67 -0
- package/src/common/chains.ts +83 -0
- package/src/contract-functions/approveLBTC/approveLBTC.stories.tsx +2 -0
- package/src/contract-functions/claimLBTC/claimLBTC.stories.tsx +13 -4
- package/src/contract-functions/claimLBTC/claimLBTC.ts +50 -11
- package/src/contract-functions/getBasculeDepositStatus/getBasculeDepositStatus.ts +6 -4
- package/src/contract-functions/getLBTCMintingFee/getLBTCMintingFee.stories.tsx +7 -10
- package/src/contract-functions/getLBTCMintingFee/getLBTCMintingFee.tsx +45 -6
- package/src/contract-functions/getLBTCTotalSupply/getLBTCTotalSupply.stories.tsx +3 -1
- package/src/contract-functions/getLBTCTotalSupply/getLBTCTotalSupply.ts +5 -4
- package/src/contract-functions/signNetworkFee/signNetworkFee.stories.tsx +2 -0
- package/src/contract-functions/unstakeLBTC/unstakeLBTC.stories.tsx +15 -4
- package/src/contract-functions/unstakeLBTC/unstakeLBTC.ts +55 -13
- package/src/index.ts +2 -0
- package/src/metrics/get-lbtc-stats.stories.tsx +6 -1
- package/src/metrics/get-lbtc-stats.ts +46 -9
- package/src/metrics/get-rewards-info.stories.tsx +57 -0
- package/src/metrics/get-rewards-info.ts +35 -0
- package/src/stories/arg-types.ts +34 -0
- package/src/stories/components/CodeBlock/CodeBlock.tsx +1 -0
- package/src/stories/components/Spinner/Spinner.tsx +2 -0
- package/src/stories/components/decorators/wagmi-decorator.tsx +5 -0
- package/src/stories/hooks/useConnection.ts +3 -13
- package/src/tokens/abi/BTCK_ABI.ts +1092 -0
- package/src/tokens/lbtc-addresses.ts +7 -0
- package/src/tokens/token-addresses.ts +102 -10
- package/src/tokens/tokens.ts +29 -18
- package/src/utils/env.ts +7 -0
- package/src/utils/err.ts +14 -0
- package/src/utils/gas.ts +36 -0
- package/src/vaults/lib/metrics/get-vault-tvl.ts +1 -0
- package/dist/ccip.cjs.map +0 -1
- package/dist/ccip.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index2.cjs.map +0 -1
- package/dist/index2.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,93 +4,6 @@ The Lombard's SDK package provides a set of functions that allow interacting wit
|
|
|
4
4
|
|
|
5
5
|
Read more about Lombard's mission: https://www.lombard.finance
|
|
6
6
|
|
|
7
|
-
# Table of Contents
|
|
8
|
-
|
|
9
|
-
[Installation](#installation)
|
|
10
|
-
|
|
11
|
-
1. [Dependencies installation](#1-dependencies-installation)
|
|
12
|
-
|
|
13
|
-
2. [SDK installation](#2-sdk-installation)
|
|
14
|
-
|
|
15
|
-
[Usage](#usage)
|
|
16
|
-
|
|
17
|
-
1. [Depositing BTC in order to get LBTC (aka staking)](#1-depositing-btc-in-order-to-get-lbtc-aka-staking)
|
|
18
|
-
|
|
19
|
-
1.1. [Get the current minting fee](#11-get-the-current-minting-fee)
|
|
20
|
-
|
|
21
|
-
1.2. [Sign the network fee signature](#12-sign-the-network-fee-signature)
|
|
22
|
-
|
|
23
|
-
1.3. [Store the signature to the Lombard's systems](#13-store-the-signature-to-the-lombards-systems)
|
|
24
|
-
|
|
25
|
-
1.4. [Get or generate the BTC deposit address](#14-get-or-generate-the-btc-deposit-address)
|
|
26
|
-
|
|
27
|
-
1.5. [Deposit BTC to the address](#15-deposit-btc-to-the-address)
|
|
28
|
-
|
|
29
|
-
1.6. [Check the status of your deposit](#16-check-the-status-of-your-deposit)
|
|
30
|
-
|
|
31
|
-
2. [Manually claiming LBTC](#2-manually-claiming-lbtc)
|
|
32
|
-
|
|
33
|
-
3. [Depositing BTC and automatically staking LBTC into the DeFi vault (aka stake and bake)](#3-depositing-btc-and-automatically-staking-lbtc-into-the-defi-vault-aka-stake-and-bake)
|
|
34
|
-
|
|
35
|
-
3.1. [See what's the current stake and bake fee](#31-see-whats-the-current-stake-and-bake-fee)
|
|
36
|
-
|
|
37
|
-
3.2. [Sign the stake and bake signature](#32-sign-the-stake-and-bake-signature)
|
|
38
|
-
|
|
39
|
-
3.3. [Store the signature to the Lombard's systems](#33-store-the-signature-to-the-lombards-systems)
|
|
40
|
-
|
|
41
|
-
3.4. [Get or generate the BTC deposit address](#34-get-or-generate-the-btc-deposit-address)
|
|
42
|
-
|
|
43
|
-
3.5. [Deposit BTC to the address](#35-deposit-btc-to-the-address)
|
|
44
|
-
|
|
45
|
-
3.6. [Check the status of your deposit](#36-check-the-status-of-your-deposit)
|
|
46
|
-
|
|
47
|
-
3.7. [Check the amount of shares acquired](#37-check-the-amount-of-shares-acquired)
|
|
48
|
-
|
|
49
|
-
4. [Unstaking LBTC and getting BTC back](#4-unstaking-lbtc-and-getting-btc-back)
|
|
50
|
-
|
|
51
|
-
4.1. [Unstake LBTC](#41-unstake-lbtc)
|
|
52
|
-
|
|
53
|
-
4.2. [Check the status of your unstakes](#42-check-the-status-of-your-unstakes)
|
|
54
|
-
|
|
55
|
-
5. [Depositing LBTC to the DeFi vault](#5-depositing-lbtc-to-the-defi-vault)
|
|
56
|
-
|
|
57
|
-
5.1. [Making a deposit to the DeFi vault](#51-making-a-deposit-to-the-defi-vault)
|
|
58
|
-
|
|
59
|
-
5.2. [Checking the deposit history](#52-checking-the-deposit-history)
|
|
60
|
-
|
|
61
|
-
5.3. [Checking the user's DeFi vault balance](#53-checking-the-users-defi-vault-balance)
|
|
62
|
-
|
|
63
|
-
6. [Withdrawing LBTC from the DeFi vault](#6-withdrawing-lbtc-from-the-defi-vault)
|
|
64
|
-
|
|
65
|
-
6.1. [Requesting a withdrawal from the DeFi vault](#61-requesting-a-withdrawal-from-the-defi-vault)
|
|
66
|
-
|
|
67
|
-
6.2. [Checking the withdrawal history (tracking the withdrawal request)](#62-checking-the-withdrawal-history-tracking-the-withdrawal-request)
|
|
68
|
-
|
|
69
|
-
6.3. [Cancelling the withdrawal](#63-cancelling-the-withdrawal)
|
|
70
|
-
|
|
71
|
-
7. [Getting the points earned by an address](#7-getting-the-points-earned-by-an-address)
|
|
72
|
-
|
|
73
|
-
8. [Getting the DeFi vault points earned by an address](#8-getting-the-defi-vault-points-earned-by-an-address)
|
|
74
|
-
|
|
75
|
-
9. [Claiming rewards](#9-claiming-rewards)
|
|
76
|
-
|
|
77
|
-
9.1. [Checking reward balances](#91-checking-reward-balances)
|
|
78
|
-
|
|
79
|
-
9.2. [Claiming rewards](#92-claiming-rewards)
|
|
80
|
-
|
|
81
|
-
9.3. [Checking the reward withdrawal fee](#93-checking-the-reward-withdrawal-fee)
|
|
82
|
-
|
|
83
|
-
9.4. [Getting the withdrawal history (checking withdrawal status)](#94-getting-the-withdrawal-history-checking-withdrawal-status)
|
|
84
|
-
|
|
85
|
-
10. [Metrics](#10-metrics)
|
|
86
|
-
|
|
87
|
-
10.1. [Getting the vault's TVL](#101-getting-the-vaults-tvl)
|
|
88
|
-
|
|
89
|
-
10.2. [Getting the vault's performance data](#102-getting-the-vaults-performance-data)
|
|
90
|
-
|
|
91
|
-
10.3. [Getting the LBTC statistics](#103-getting-the-lbtc-statistics)
|
|
92
|
-
|
|
93
|
-
|
|
94
7
|
|
|
95
8
|
## Installation
|
|
96
9
|
|
|
@@ -224,7 +137,7 @@ const txHash = await claimLBTC({
|
|
|
224
137
|
|
|
225
138
|
The successful execution of the above will result with the transaction id.
|
|
226
139
|
|
|
227
|
-
### 3. Depositing BTC and automatically staking LBTC into the DeFi vault
|
|
140
|
+
### 3. Depositing BTC and automatically staking LBTC into the DeFi vault
|
|
228
141
|
|
|
229
142
|
You can read more about the DeFi vaults here: https://docs.lombard.finance/lbtc-liquid-bitcoin/defi-vaults/lombard-defi-vault
|
|
230
143
|
|
|
@@ -351,6 +264,7 @@ Every entry in the result of the above may consist of:
|
|
|
351
264
|
* `amount` - The amount unstaked,
|
|
352
265
|
* `payoutTxHash` - The BTC transaction hash,
|
|
353
266
|
* `payoutTxIndex` - The index of the actual payout transfer,
|
|
267
|
+
* `payoutTxStatus` - The status of the payout, available values: `PayoutTxStatus.Completed` or `PayoutTxStatus.Pending`,
|
|
354
268
|
* `sanctioned` - A flag indicating whether the unstake transaction has been sanctioned and flagged as suspicious.
|
|
355
269
|
|
|
356
270
|
### 5. Depositing LBTC to the DeFi vault.
|
|
@@ -532,70 +446,9 @@ const {
|
|
|
532
446
|
})
|
|
533
447
|
```
|
|
534
448
|
|
|
535
|
-
### 9.
|
|
536
|
-
|
|
537
|
-
#### 9.1. Checking reward balances.
|
|
538
|
-
|
|
539
|
-
```javascript
|
|
540
|
-
const rewards = await getRewardBalances({
|
|
541
|
-
address,
|
|
542
|
-
rewardToken: RewardToken.BABY
|
|
543
|
-
});
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
The data returned by the above function contains:
|
|
547
|
-
|
|
548
|
-
* `address` - the address of the reward earner (claimer),
|
|
549
|
-
* `availableBalance` - the available balance of the reward token (ready to be withdrawn),
|
|
550
|
-
* `lockedBalance` - the locked balance (in processing),
|
|
551
|
-
* `pendingBalance` - the pending balance to be credited,
|
|
552
|
-
* `rewardToken` - the reward token,
|
|
553
|
-
* `timestamp` - the timestamp.
|
|
554
|
-
|
|
555
|
-
#### 9.2. Claiming rewards.
|
|
556
|
-
|
|
557
|
-
```javascript
|
|
558
|
-
const withdrawal = await claimReward({
|
|
559
|
-
account, // The account address.
|
|
560
|
-
rewardToken, // The reward token, e.g. RewardToken.BABY
|
|
561
|
-
amount, // The amount to be claimed (withdrawn)
|
|
562
|
-
to, // The destination address, e.g. BABYLON chain address.
|
|
563
|
-
signingDataVariant: 'json', // Optional signing data variant, available values: 'json', 'plain-text'
|
|
564
|
-
chainId, // The chain id
|
|
565
|
-
provider, // The EIP-1193 provider.
|
|
566
|
-
});
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
The function will ask a user to sign a message that consists of the amount, destination address and also a withdrawal fee and after obtaining this signature it will request a reward withdrawal from the pool to the provided destination address.
|
|
570
|
-
|
|
571
|
-
The function returns the `RewardWithdrawal` object.
|
|
572
|
-
|
|
573
|
-
#### 9.3. Checking the reward withdrawal fee.
|
|
574
|
-
|
|
575
|
-
```javascript
|
|
576
|
-
const withdrawalFee = await getRewardWithdrawalFee({ address, rewardToken });
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
#### 9.4. Getting the withdrawal history (checking withdrawal status).
|
|
580
|
-
|
|
581
|
-
```javascript
|
|
582
|
-
const withdrawals = await getRewardWithdrawals({ address })
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
The function returns an array of:
|
|
449
|
+
### 9. Metrics
|
|
586
450
|
|
|
587
|
-
|
|
588
|
-
* `rewardToken` - the reward token,
|
|
589
|
-
* `fee` - the applied withdrawal fee,
|
|
590
|
-
* `to` - the destination address,
|
|
591
|
-
* `signature` - the signature used,
|
|
592
|
-
* `status` - the withdrawal status,
|
|
593
|
-
* `estimatedTimeSent` - the estimated time when the funds are sent,
|
|
594
|
-
* `timestamp` - the timestamp.
|
|
595
|
-
|
|
596
|
-
### 10. Metrics
|
|
597
|
-
|
|
598
|
-
#### 10.1. Getting the vault's TVL
|
|
451
|
+
#### 9.1. Getting the vault's TVL
|
|
599
452
|
|
|
600
453
|
The vault's TVL can be obtained by calling the `getVaultTVL` function.
|
|
601
454
|
|
|
@@ -608,7 +461,7 @@ The above returns:
|
|
|
608
461
|
* `btcPrice` - the current price of BTC,
|
|
609
462
|
* `tvl` - the amount of USD locked into the vault.
|
|
610
463
|
|
|
611
|
-
####
|
|
464
|
+
#### 9.2. Getting the vault's performance data.
|
|
612
465
|
|
|
613
466
|
The performance of the vault can be checked via the `getVaultApy` function.
|
|
614
467
|
As in the example below:
|
|
@@ -629,10 +482,17 @@ Each entry contains:
|
|
|
629
482
|
* `breakdown` - the detailed record of allocations and APY values broken down by chain and protocol,
|
|
630
483
|
* `timestamp` - the timestamp of the entry.
|
|
631
484
|
|
|
632
|
-
####
|
|
485
|
+
#### 9.3. Getting the LBTC statistics.
|
|
633
486
|
|
|
634
487
|
The simple set of LBTC statistics is accessible via `getLBTCStats` function.
|
|
635
488
|
|
|
489
|
+
```javascript
|
|
490
|
+
const stats = await getLBTCStats({
|
|
491
|
+
partnerId, // The partner id - passing the partnerId will ensure relevant stats are returned
|
|
492
|
+
env // Optional env flag
|
|
493
|
+
})
|
|
494
|
+
```
|
|
495
|
+
|
|
636
496
|
The stats contain:
|
|
637
497
|
|
|
638
498
|
* `historicalHolders` - the number of all-time LBTC holders,
|
|
@@ -640,3 +500,47 @@ The stats contain:
|
|
|
640
500
|
* `price` - the current BTC price,
|
|
641
501
|
* `supply` - the number of LBTC minted,
|
|
642
502
|
* `tvl` - the Lombard's TVL in USD.
|
|
503
|
+
* `apr` - staking APR
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
#### 9.4. Getting the LBTC exchange ratio.
|
|
507
|
+
|
|
508
|
+
LBTC is a yield-bearing token and its exchange rate to BTC is not guaranteed to be 1:1.
|
|
509
|
+
|
|
510
|
+
In order to check the current exchange rate use:
|
|
511
|
+
|
|
512
|
+
```javascript
|
|
513
|
+
const ratioData = await getExchangeRatio();
|
|
514
|
+
|
|
515
|
+
// returns:
|
|
516
|
+
//
|
|
517
|
+
// ratioData = {
|
|
518
|
+
// [Token.LBTC]: {
|
|
519
|
+
// tokenBTCRatio: BigNumber(1)
|
|
520
|
+
// BTCTokenRatio: BigNumber(1)
|
|
521
|
+
// }
|
|
522
|
+
// }
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
The result of the above function is an object which contains:
|
|
526
|
+
* `tokenBTCRatio` - The Token:BTC ratio answering the question of how many tokens will I get for 1 BTC.
|
|
527
|
+
* `BTCTokenRatio` - The BTC:Token ratio (1 / tokenBTCRatio) answering the question of how many BTC will I get for 1 Token.
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
#### 9.5. Getting the rewards info
|
|
531
|
+
|
|
532
|
+
The information about the rewards acquired by an account can be obtained via the `getRewardsInfo` function as shown below:
|
|
533
|
+
|
|
534
|
+
```javascript
|
|
535
|
+
const rewardsInfo = await getRewardsInfo({
|
|
536
|
+
account, // The account address
|
|
537
|
+
partnerId, // The partner id - passing the partnerId will ensure relevant stats are returned
|
|
538
|
+
env // Optional env flag
|
|
539
|
+
});
|
|
540
|
+
```
|
|
541
|
+
The results of the includes:
|
|
542
|
+
|
|
543
|
+
* `type` - the type of a reward,
|
|
544
|
+
* `totalLbtcBalance` - the total LBTC balance,
|
|
545
|
+
* `totalRewards` - the amount of total rewards earned,
|
|
546
|
+
* `totalRewardsCost` - the amount of cost associated with the earned rewards
|
package/dist/ccip.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
//# sourceMappingURL=ccip.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index2.cjs");class w extends e.BaseError{constructor({callbackSelector:o,cause:a,data:c,extraData:u,sender:d,urls:r}){var n;super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],(n=a.metaMessages)!=null&&n.length?"":[],"Offchain Gateway Call:",r&&[" Gateway URL(s):",...r.map(f=>` ${e.getUrl(f)}`)],` Sender: ${d}`,` Data: ${c}`,` Callback selector: ${o}`,` Extra data: ${u}`].flat(),name:"OffchainLookupError"})}}class k extends e.BaseError{constructor({result:o,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${e.getUrl(a)}`,`Response: ${e.stringify(o)}`],name:"OffchainLookupResponseMalformedError"})}}class b extends e.BaseError{constructor({sender:o,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${o}`],name:"OffchainLookupSenderMismatchError"})}}const L="0x556f1830",y={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function E(i,{blockNumber:o,blockTag:a,data:c,to:u}){const{args:d}=e.decodeErrorResult({data:c,abi:[y]}),[r,n,f,l,s]=d,{ccipRead:t}=i,h=t&&typeof(t==null?void 0:t.request)=="function"?t.request:m;try{if(!e.isAddressEqual(u,r))throw new b({sender:r,to:u});const p=n.includes(e.localBatchGatewayUrl)?await e.localBatchGatewayRequest({data:f,ccipRequest:h}):await h({data:f,sender:r,urls:n}),{data:g}=await e.call(i,{blockNumber:o,blockTag:a,data:e.concat([l,e.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[p,s])]),to:u});return g}catch(p){throw new w({callbackSelector:l,cause:p,data:c,extraData:s,sender:r,urls:n})}}async function m({data:i,sender:o,urls:a}){var u;let c=new Error("An unknown error occurred.");for(let d=0;d<a.length;d++){const r=a[d],n=r.includes("{data}")?"GET":"POST",f=n==="POST"?{data:i,sender:o}:void 0,l=n==="POST"?{"Content-Type":"application/json"}:{};try{const s=await fetch(r.replace("{sender}",o.toLowerCase()).replace("{data}",i),{body:JSON.stringify(f),headers:l,method:n});let t;if((u=s.headers.get("Content-Type"))!=null&&u.startsWith("application/json")?t=(await s.json()).data:t=await s.text(),!s.ok){c=new e.HttpRequestError({body:f,details:t!=null&&t.error?e.stringify(t.error):s.statusText,headers:s.headers,status:s.status,url:r});continue}if(!e.isHex(t)){c=new k({result:t,url:r});continue}return t}catch(s){c=new e.HttpRequestError({body:f,details:s.message,url:r})}}throw c}exports.ccipRequest=m;exports.offchainLookup=E;exports.offchainLookupAbiItem=y;exports.offchainLookupSignature=L;
|
package/dist/ccip.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
class
|
|
3
|
-
constructor({ callbackSelector: r, cause: a, data:
|
|
4
|
-
var
|
|
1
|
+
import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index2.js";
|
|
2
|
+
class S extends p {
|
|
3
|
+
constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
|
|
4
|
+
var o;
|
|
5
5
|
super(a.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
6
6
|
cause: a,
|
|
7
7
|
metaMessages: [
|
|
8
8
|
...a.metaMessages || [],
|
|
9
|
-
(
|
|
9
|
+
(o = a.metaMessages) != null && o.length ? "" : [],
|
|
10
10
|
"Offchain Gateway Call:",
|
|
11
11
|
t && [
|
|
12
12
|
" Gateway URL(s):",
|
|
13
|
-
...t.map((
|
|
13
|
+
...t.map((d) => ` ${m(d)}`)
|
|
14
14
|
],
|
|
15
|
-
` Sender: ${
|
|
16
|
-
` Data: ${
|
|
15
|
+
` Sender: ${f}`,
|
|
16
|
+
` Data: ${n}`,
|
|
17
17
|
` Callback selector: ${r}`,
|
|
18
18
|
` Extra data: ${i}`
|
|
19
19
|
].flat(),
|
|
@@ -21,18 +21,18 @@ class M extends l {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class $ extends p {
|
|
25
25
|
constructor({ result: r, url: a }) {
|
|
26
26
|
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
|
27
27
|
metaMessages: [
|
|
28
28
|
`Gateway URL: ${m(a)}`,
|
|
29
|
-
`Response: ${
|
|
29
|
+
`Response: ${w(r)}`
|
|
30
30
|
],
|
|
31
31
|
name: "OffchainLookupResponseMalformedError"
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
class
|
|
35
|
+
class q extends p {
|
|
36
36
|
constructor({ sender: r, to: a }) {
|
|
37
37
|
super("Reverted sender address does not match target contract address (`to`).", {
|
|
38
38
|
metaMessages: [
|
|
@@ -43,7 +43,7 @@ class S extends l {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
const
|
|
46
|
+
const A = "0x556f1830", T = {
|
|
47
47
|
name: "OffchainLookup",
|
|
48
48
|
type: "error",
|
|
49
49
|
inputs: [
|
|
@@ -69,59 +69,62 @@ const C = "0x556f1830", $ = {
|
|
|
69
69
|
}
|
|
70
70
|
]
|
|
71
71
|
};
|
|
72
|
-
async function
|
|
73
|
-
const { args:
|
|
74
|
-
data:
|
|
75
|
-
abi: [
|
|
76
|
-
}), [t,
|
|
72
|
+
async function D(c, { blockNumber: r, blockTag: a, data: n, to: i }) {
|
|
73
|
+
const { args: f } = k({
|
|
74
|
+
data: n,
|
|
75
|
+
abi: [T]
|
|
76
|
+
}), [t, o, d, l, s] = f, { ccipRead: e } = c, h = e && typeof (e == null ? void 0 : e.request) == "function" ? e.request : C;
|
|
77
77
|
try {
|
|
78
78
|
if (!b(i, t))
|
|
79
|
-
throw new
|
|
80
|
-
const
|
|
79
|
+
throw new q({ sender: t, to: i });
|
|
80
|
+
const u = o.includes(L) ? await O({
|
|
81
|
+
data: d,
|
|
82
|
+
ccipRequest: h
|
|
83
|
+
}) : await h({ data: d, sender: t, urls: o }), { data: g } = await E(c, {
|
|
81
84
|
blockNumber: r,
|
|
82
85
|
blockTag: a,
|
|
83
|
-
data:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
data: x([
|
|
87
|
+
l,
|
|
88
|
+
R([{ type: "bytes" }, { type: "bytes" }], [u, s])
|
|
86
89
|
]),
|
|
87
90
|
to: i
|
|
88
91
|
});
|
|
89
92
|
return g;
|
|
90
|
-
} catch (
|
|
91
|
-
throw new
|
|
92
|
-
callbackSelector:
|
|
93
|
-
cause:
|
|
94
|
-
data:
|
|
93
|
+
} catch (u) {
|
|
94
|
+
throw new S({
|
|
95
|
+
callbackSelector: l,
|
|
96
|
+
cause: u,
|
|
97
|
+
data: n,
|
|
95
98
|
extraData: s,
|
|
96
99
|
sender: t,
|
|
97
|
-
urls:
|
|
100
|
+
urls: o
|
|
98
101
|
});
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
async function
|
|
104
|
+
async function C({ data: c, sender: r, urls: a }) {
|
|
102
105
|
var i;
|
|
103
|
-
let
|
|
104
|
-
for (let
|
|
105
|
-
const t = a[
|
|
106
|
+
let n = new Error("An unknown error occurred.");
|
|
107
|
+
for (let f = 0; f < a.length; f++) {
|
|
108
|
+
const t = a[f], o = t.includes("{data}") ? "GET" : "POST", d = o === "POST" ? { data: c, sender: r } : void 0, l = o === "POST" ? { "Content-Type": "application/json" } : {};
|
|
106
109
|
try {
|
|
107
110
|
const s = await fetch(t.replace("{sender}", r.toLowerCase()).replace("{data}", c), {
|
|
108
|
-
body: JSON.stringify(
|
|
109
|
-
headers:
|
|
110
|
-
method:
|
|
111
|
+
body: JSON.stringify(d),
|
|
112
|
+
headers: l,
|
|
113
|
+
method: o
|
|
111
114
|
});
|
|
112
115
|
let e;
|
|
113
116
|
if ((i = s.headers.get("Content-Type")) != null && i.startsWith("application/json") ? e = (await s.json()).data : e = await s.text(), !s.ok) {
|
|
114
|
-
|
|
115
|
-
body:
|
|
116
|
-
details: e != null && e.error ?
|
|
117
|
+
n = new y({
|
|
118
|
+
body: d,
|
|
119
|
+
details: e != null && e.error ? w(e.error) : s.statusText,
|
|
117
120
|
headers: s.headers,
|
|
118
121
|
status: s.status,
|
|
119
122
|
url: t
|
|
120
123
|
});
|
|
121
124
|
continue;
|
|
122
125
|
}
|
|
123
|
-
if (!
|
|
124
|
-
|
|
126
|
+
if (!M(e)) {
|
|
127
|
+
n = new $({
|
|
125
128
|
result: e,
|
|
126
129
|
url: t
|
|
127
130
|
});
|
|
@@ -129,19 +132,18 @@ async function T({ data: c, sender: r, urls: a }) {
|
|
|
129
132
|
}
|
|
130
133
|
return e;
|
|
131
134
|
} catch (s) {
|
|
132
|
-
|
|
133
|
-
body:
|
|
135
|
+
n = new y({
|
|
136
|
+
body: d,
|
|
134
137
|
details: s.message,
|
|
135
138
|
url: t
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
|
-
throw
|
|
142
|
+
throw n;
|
|
140
143
|
}
|
|
141
144
|
export {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
C as ccipRequest,
|
|
146
|
+
D as offchainLookup,
|
|
147
|
+
T as offchainLookupAbiItem,
|
|
148
|
+
A as offchainLookupSignature
|
|
146
149
|
};
|
|
147
|
-
//# sourceMappingURL=ccip.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index2.cjs");exports.BTC_DECIMALS=e.BTC_DECIMALS;exports.BasculeDepositStatus=e.BasculeDepositStatus;exports.BlockchainIdentifier=e.BlockchainIdentifier;exports.CHAIN_ID_TO_VIEM_CHAIN_MAP=e.CHAIN_ID_TO_VIEM_CHAIN_MAP;exports.ChainId=e.ChainId;exports.ENotarizationStatus=e.ENotarizationStatus;exports.ESessionState=e.ESessionState;exports.Env=e.
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index2.cjs");exports.BTC_DECIMALS=e.BTC_DECIMALS;exports.BasculeDepositStatus=e.BasculeDepositStatus;exports.BlockchainIdentifier=e.BlockchainIdentifier;exports.CHAIN_ID_TO_VIEM_CHAIN_MAP=e.CHAIN_ID_TO_VIEM_CHAIN_MAP;exports.ChainId=e.ChainId;exports.ENotarizationStatus=e.ENotarizationStatus;exports.ESessionState=e.ESessionState;exports.Env=e.t;exports.PayoutTxStatus=e.PayoutTxStatus;exports.RATIO_TOKEN_MAP=e.RATIO_TOKEN_MAP;exports.RewardBlockchainType=e.RewardBlockchainType;exports.RewardToken=e.RewardToken;exports.RewardWithdrawalStatus=e.RewardWithdrawalStatus;exports.SANCTIONED_ADDRESS=e.SANCTIONED_ADDRESS;exports.SATOSHI_SCALE=e.SATOSHI_SCALE;exports.SOLANA_DEVNET_CHAIN=e.SOLANA_DEVNET_CHAIN;exports.SOLANA_MAINNET_CHAIN=e.SOLANA_MAINNET_CHAIN;exports.SOLANA_TESTNET_CHAIN=e.SOLANA_TESTNET_CHAIN;exports.SUI_DEVNET_CHAIN=e.SUI_DEVNET_CHAIN;exports.SUI_LOCALNET_CHAIN=e.SUI_LOCALNET_CHAIN;exports.SUI_MAINNET_CHAIN=e.SUI_MAINNET_CHAIN;exports.SUI_TESTNET_CHAIN=e.SUI_TESTNET_CHAIN;exports.TOKEN_ADDRESSES=e.TOKEN_ADDRESSES;exports.Token=e.Token;exports.Vault=e.Vault;exports.addChain=e.addChain;exports.approveLBTC=e.approveLBTC;exports.bridge=e.bridge;exports.bridgeCCIP=e.bridgeCCIP;exports.bridgeOFT=e.bridgeOFT;exports.cancelWithdraw=e.cancelWithdraw;exports.claimLBTC=e.claimLBTC;exports.claimReward=e.claimReward;exports.deposit=e.deposit;exports.fromSatoshi=e.fromSatoshi;exports.generateDepositBtcAddress=e.generateDepositBtcAddress;exports.getApiConfig=e.getApiConfig;exports.getBasculeDepositStatus=e.getBasculeDepositStatus;exports.getBaseNetworkByEnv=e.getBaseNetworkByEnv;exports.getBridgeInfo=e.getBridgeInfo;exports.getBscNetworkByEnv=e.getBscNetworkByEnv;exports.getBurningFee=e.getBurningFee;exports.getChainIdByName=e.getChainIdByName;exports.getChainNameById=e.getChainNameById;exports.getDepositBtcAddress=e.getDepositBtcAddress;exports.getDepositBtcAddresses=e.getDepositBtcAddresses;exports.getDepositsByAddress=e.getDepositsByAddress;exports.getEthNetworkByEnv=e.getEthNetworkByEnv;exports.getLBTCBurningFee=e.getLBTCBurningFee;exports.getLBTCExchangeRate=e.getLBTCExchangeRate;exports.getLBTCMintingFee=e.getLBTCMintingFee;exports.getLBTCStats=e.getLBTCStats;exports.getLBTCTotalSupply=e.getLBTCTotalSupply;exports.getLbtcContractAddresses=e.getLbtcContractAddresses;exports.getMintingFee=e.getMintingFee;exports.getNetworkFeeSignature=e.getNetworkFeeSignature;exports.getPermitNonce=e.getPermitNonce;exports.getPointsByAddress=e.getPointsByAddress;exports.getRewardBalances=e.getRewardBalances;exports.getRewardSigningData=e.getRewardSigningData;exports.getRewardWithdrawalFee=e.getRewardWithdrawalFee;exports.getRewardWithdrawals=e.getRewardWithdrawals;exports.getRewardsInfo=e.getRewardsInfo;exports.getShareValue=e.getShareValue;exports.getSharesByAddress=e.getSharesByAddress;exports.getSolanaNetworkByEnv=e.getSolanaNetworkByEnv;exports.getSonicNetworkByEnv=e.getSonicNetworkByEnv;exports.getStakeAndBakeFee=e.getStakeAndBakeFee;exports.getSuiNetworkByEnv=e.getSuiNetworkByEnv;exports.getUnstakesByAddress=e.getUnstakesByAddress;exports.getUserStakeAndBakeSignature=e.getUserStakeAndBakeSignature;exports.getVaultApy=e.getVaultApy;exports.getVaultDeposits=e.getVaultDeposits;exports.getVaultPoints=e.getVaultPoints;exports.getVaultTVL=e.getVaultTVL;exports.getVaultWithdrawals=e.getVaultWithdrawals;exports.isKatanaChain=e.isKatanaChain;exports.isRewardTokenSupported=e.isRewardTokenSupported;exports.isValidChain=e.isValidChain;exports.katana=e.katana;exports.katanaTatara=e.katanaTatara;exports.mintToken=e.mintToken;exports.queueWithdraw=e.queueWithdraw;exports.redeemToken=e.redeemToken;exports.setReferral=e.setReferral;exports.signLbtcDestinationAddr=e.signLbtcDestinationAddr;exports.signNetworkFee=e.signNetworkFee;exports.signStakeAndBake=e.signStakeAndBake;exports.storeNetworkFeeSignature=e.storeNetworkFeeSignature;exports.storeStakeAndBakeSignature=e.storeStakeAndBakeSignature;exports.toSatoshi=e.toSatoshi;exports.unstakeLBTC=e.unstakeLBTC;
|
package/dist/index.js
CHANGED
|
@@ -1,82 +1,95 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aK as s, N as t, ap as n, aC as i, aB as r, E as g, A as d, t as o, P as S, aI as A, ah as N, an as B, al as T, w as C, aL as E, S as k, h as I, j as u, k as w, aA as _, m as l, n as c, aJ as h, aH as p, a6 as D, aF as L, Y as y, r as R, u as V, v as F, aa as O, Z as m, af as H, a7 as v, aM as M, x as f, ao as P, O as U, at as W, q as b, as as x, U as K, ax as q, aq as z, y as j, z as G, C as J, ar as Q, R as X, D as Y, Q as Z, o as $, V as aa, aG as ea, T as sa, F as ta, W as na, G as ia, ag as ra, ai as ga, aj as da, ak as oa, p as Sa, a4 as Aa, a5 as Na, aw as Ba, av as Ta, X as Ca, au as Ea, I as ka, J as Ia, ae as ua, a8 as wa, ac as _a, ad as la, ab as ca, aD as ha, am as pa, aE as Da, ay as La, az as ya, _ as Ra, a9 as Va, a3 as Fa, K as Oa, $ as ma, a0 as Ha, a1 as va, L as Ma, M as fa, aN as Pa, a2 as Ua } from "./index2.js";
|
|
2
2
|
export {
|
|
3
3
|
s as BTC_DECIMALS,
|
|
4
4
|
t as BasculeDepositStatus,
|
|
5
|
-
|
|
5
|
+
n as BlockchainIdentifier,
|
|
6
6
|
i as CHAIN_ID_TO_VIEM_CHAIN_MAP,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
r as ChainId,
|
|
8
|
+
g as ENotarizationStatus,
|
|
9
9
|
d as ESessionState,
|
|
10
10
|
o as Env,
|
|
11
|
-
S as
|
|
12
|
-
A as
|
|
13
|
-
N as
|
|
14
|
-
B as
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
E as
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
c as
|
|
25
|
-
h as
|
|
26
|
-
p as
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
y as
|
|
30
|
-
R as
|
|
31
|
-
V as
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
m as
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
x as
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
z as
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Q as
|
|
51
|
-
X as
|
|
52
|
-
Y as
|
|
53
|
-
Z as
|
|
54
|
-
$ as
|
|
55
|
-
aa as
|
|
56
|
-
ea as
|
|
57
|
-
sa as
|
|
58
|
-
ta as
|
|
59
|
-
|
|
60
|
-
ia as
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
da as
|
|
64
|
-
oa as
|
|
65
|
-
Sa as
|
|
66
|
-
Aa as
|
|
67
|
-
Na as
|
|
68
|
-
Ba as
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Ea as
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
ca as
|
|
79
|
-
ha as
|
|
80
|
-
pa as
|
|
11
|
+
S as PayoutTxStatus,
|
|
12
|
+
A as RATIO_TOKEN_MAP,
|
|
13
|
+
N as RewardBlockchainType,
|
|
14
|
+
B as RewardToken,
|
|
15
|
+
T as RewardWithdrawalStatus,
|
|
16
|
+
C as SANCTIONED_ADDRESS,
|
|
17
|
+
E as SATOSHI_SCALE,
|
|
18
|
+
k as SOLANA_DEVNET_CHAIN,
|
|
19
|
+
I as SOLANA_MAINNET_CHAIN,
|
|
20
|
+
u as SOLANA_TESTNET_CHAIN,
|
|
21
|
+
w as SUI_DEVNET_CHAIN,
|
|
22
|
+
_ as SUI_LOCALNET_CHAIN,
|
|
23
|
+
l as SUI_MAINNET_CHAIN,
|
|
24
|
+
c as SUI_TESTNET_CHAIN,
|
|
25
|
+
h as TOKEN_ADDRESSES,
|
|
26
|
+
p as Token,
|
|
27
|
+
D as Vault,
|
|
28
|
+
L as addChain,
|
|
29
|
+
y as approveLBTC,
|
|
30
|
+
R as bridge,
|
|
31
|
+
V as bridgeCCIP,
|
|
32
|
+
F as bridgeOFT,
|
|
33
|
+
O as cancelWithdraw,
|
|
34
|
+
m as claimLBTC,
|
|
35
|
+
H as claimReward,
|
|
36
|
+
v as deposit,
|
|
37
|
+
M as fromSatoshi,
|
|
38
|
+
f as generateDepositBtcAddress,
|
|
39
|
+
P as getApiConfig,
|
|
40
|
+
U as getBasculeDepositStatus,
|
|
41
|
+
W as getBaseNetworkByEnv,
|
|
42
|
+
b as getBridgeInfo,
|
|
43
|
+
x as getBscNetworkByEnv,
|
|
44
|
+
K as getBurningFee,
|
|
45
|
+
q as getChainIdByName,
|
|
46
|
+
z as getChainNameById,
|
|
47
|
+
j as getDepositBtcAddress,
|
|
48
|
+
G as getDepositBtcAddresses,
|
|
49
|
+
J as getDepositsByAddress,
|
|
50
|
+
Q as getEthNetworkByEnv,
|
|
51
|
+
X as getLBTCBurningFee,
|
|
52
|
+
Y as getLBTCExchangeRate,
|
|
53
|
+
Z as getLBTCMintingFee,
|
|
54
|
+
$ as getLBTCStats,
|
|
55
|
+
aa as getLBTCTotalSupply,
|
|
56
|
+
ea as getLbtcContractAddresses,
|
|
57
|
+
sa as getMintingFee,
|
|
58
|
+
ta as getNetworkFeeSignature,
|
|
59
|
+
na as getPermitNonce,
|
|
60
|
+
ia as getPointsByAddress,
|
|
61
|
+
ra as getRewardBalances,
|
|
62
|
+
ga as getRewardSigningData,
|
|
63
|
+
da as getRewardWithdrawalFee,
|
|
64
|
+
oa as getRewardWithdrawals,
|
|
65
|
+
Sa as getRewardsInfo,
|
|
66
|
+
Aa as getShareValue,
|
|
67
|
+
Na as getSharesByAddress,
|
|
68
|
+
Ba as getSolanaNetworkByEnv,
|
|
69
|
+
Ta as getSonicNetworkByEnv,
|
|
70
|
+
Ca as getStakeAndBakeFee,
|
|
71
|
+
Ea as getSuiNetworkByEnv,
|
|
72
|
+
ka as getUnstakesByAddress,
|
|
73
|
+
Ia as getUserStakeAndBakeSignature,
|
|
74
|
+
ua as getVaultApy,
|
|
75
|
+
wa as getVaultDeposits,
|
|
76
|
+
_a as getVaultPoints,
|
|
77
|
+
la as getVaultTVL,
|
|
78
|
+
ca as getVaultWithdrawals,
|
|
79
|
+
ha as isKatanaChain,
|
|
80
|
+
pa as isRewardTokenSupported,
|
|
81
|
+
Da as isValidChain,
|
|
82
|
+
La as katana,
|
|
83
|
+
ya as katanaTatara,
|
|
84
|
+
Ra as mintToken,
|
|
85
|
+
Va as queueWithdraw,
|
|
86
|
+
Fa as redeemToken,
|
|
87
|
+
Oa as setReferral,
|
|
88
|
+
ma as signLbtcDestinationAddr,
|
|
89
|
+
Ha as signNetworkFee,
|
|
90
|
+
va as signStakeAndBake,
|
|
91
|
+
Ma as storeNetworkFeeSignature,
|
|
92
|
+
fa as storeStakeAndBakeSignature,
|
|
93
|
+
Pa as toSatoshi,
|
|
94
|
+
Ua as unstakeLBTC
|
|
81
95
|
};
|
|
82
|
-
//# sourceMappingURL=index.js.map
|