@lombard.finance/sdk 0.2.0 → 0.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/README.md +30 -1
- package/dist/index.js +664 -436
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/common/const.ts +1 -1
- package/src/common/types/internalTypes.ts +3 -1
- package/src/common/types/types.ts +1 -0
- package/src/provider/ReadProvider.ts +6 -0
- package/src/sdk/apiConfig.ts +15 -6
- package/src/sdk/generateDepositBtcAddress/generateDepositBtcAddress.ts +27 -9
- package/src/sdk/getDepositBtcAddress/getDepositBtcAddress.ts +23 -10
- package/src/sdk/getDepositsByAddress/getDepositsByAddress.ts +4 -2
- package/src/sdk/getLBTCExchageRate/getLBTCExchageRate.stories.tsx +46 -0
- package/src/sdk/getLBTCExchageRate/getLBTCExchageRate.ts +43 -0
- package/src/sdk/getLBTCExchageRate/index.ts +1 -0
- package/src/sdk/index.ts +2 -0
- package/src/web3Sdk/abi/LBTC.json +407 -234
- package/src/web3Sdk/index.ts +1 -0
- package/src/web3Sdk/lbtcAddressConfig.ts +15 -4
- package/src/web3Sdk/unstakeLBTC/unstakeLBTC.ts +2 -2
- package/src/web3Sdk/utils/getLbtcTokenContract.ts +9 -5
package/README.md
CHANGED
|
@@ -20,7 +20,36 @@ npm i web3@^4 axios@^1 bignumber.js@^9
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
API based methods:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { getDepositBtcAddress } from '@lombard.finance/sdk';
|
|
27
|
+
|
|
28
|
+
const depositBtcAddress = await getDepositBtcAddress({
|
|
29
|
+
address: '0x...', // Ethereum address
|
|
30
|
+
chainId: 1,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
console.log(depositBtcAddress); // bc1q...
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Web3 based methods:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { unstakeLBTC } from '@lombard.finance/sdk';
|
|
40
|
+
|
|
41
|
+
const { receiptPromise, transactionHash } = await unstakeLBTC({
|
|
42
|
+
amount: '1', // 1 LBTC
|
|
43
|
+
btcAddress: 'bc1q...', // The BTC address to send the unstaked BTC to
|
|
44
|
+
account: '0x...', // current address in the web3 wallet
|
|
45
|
+
chainId: 1, // current chain id in the web3 wallet
|
|
46
|
+
provider: window.ethereum, // EIP-1193 provider
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
console.log(transactionHash); // 0x...
|
|
50
|
+
|
|
51
|
+
const receipt = await receiptPromise; // will return the tx receipt
|
|
52
|
+
```
|
|
24
53
|
|
|
25
54
|
## Development
|
|
26
55
|
|