@lombard.finance/sdk 2.2.1 → 2.4.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.
Files changed (52) hide show
  1. package/README.md +38 -37
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +3017 -728
  5. package/dist/index.js.map +1 -1
  6. package/package.json +6 -6
  7. package/src/common/const.ts +0 -4
  8. package/src/common/types/internalTypes.ts +2 -2
  9. package/src/common/types/types.ts +20 -15
  10. package/src/common/utils/convertSatoshi.ts +11 -7
  11. package/src/index.ts +2 -0
  12. package/src/sdk/apiConfig.ts +9 -5
  13. package/src/sdk/generateDepositBtcAddress/generateDepositBtcAddress.stories.tsx +1 -1
  14. package/src/sdk/generateDepositBtcAddress/generateDepositBtcAddress.ts +3 -3
  15. package/src/sdk/getDepositBtcAddress/getDepositBtcAddress.stories.tsx +3 -5
  16. package/src/sdk/getDepositBtcAddress/getDepositBtcAddress.ts +137 -75
  17. package/src/sdk/getDepositBtcAddress/getDepositBtcAddresses.stories.tsx +54 -0
  18. package/src/sdk/getDepositsByAddress/getDepositsByAddress.stories.tsx +1 -1
  19. package/src/sdk/getDepositsByAddress/getDepositsByAddress.ts +5 -4
  20. package/src/sdk/getLBTCExchangeRate/getLBTCExchangeRate.stories.tsx +3 -3
  21. package/src/sdk/getNetworkFeeSignature/getNetworkFeeSignature.stories.tsx +1 -1
  22. package/src/sdk/getPointsByAddress/getPointsByAddress.stories.tsx +49 -0
  23. package/src/sdk/getPointsByAddress/getPointsByAddress.ts +163 -0
  24. package/src/sdk/getPointsByAddress/index.ts +6 -0
  25. package/src/sdk/getUnstakesByAddress/getUnstakesByAddress.stories.tsx +49 -0
  26. package/src/sdk/getUnstakesByAddress/getUnstakesByAddress.ts +133 -0
  27. package/src/sdk/getUnstakesByAddress/index.ts +1 -0
  28. package/src/sdk/getUserStakeAndBakeSignature/getUserStakeAndBakeSignature.stories.tsx +1 -1
  29. package/src/sdk/index.ts +3 -1
  30. package/src/sdk/internalTypes.ts +3 -0
  31. package/src/sdk/setReferral/setReferral.ts +6 -5
  32. package/src/sdk/storeNetworkFeeSignature/storeNetworkFeeSignature.stories.tsx +1 -1
  33. package/src/sdk/storeStakeAndBakeSignature/storeStakeAndBakeSignature.stories.tsx +1 -1
  34. package/src/sdk/utils/getChainIdByName.ts +12 -6
  35. package/src/sdk/utils/getChainNameById.ts +25 -15
  36. package/src/web3Sdk/approveLBTC/approveLBTC.stories.tsx +1 -1
  37. package/src/web3Sdk/approveLBTC/approveLBTC.ts +1 -1
  38. package/src/web3Sdk/basculeAddressConfig.ts +7 -8
  39. package/src/web3Sdk/claimLBTC/claimLBTC.stories.tsx +1 -1
  40. package/src/web3Sdk/getBasculeDepositStatus/getBasculeDepositStatus.stories.tsx +5 -2
  41. package/src/web3Sdk/getLBTCTotalSupply/getLBTCTotalSupply.stories.tsx +1 -2
  42. package/src/web3Sdk/lbtcAddressConfig.ts +6 -8
  43. package/src/web3Sdk/signLbtcDestionationAddr/index.ts +1 -1
  44. package/src/web3Sdk/signLbtcDestionationAddr/{signLbtcDestionationAddr.ts → signLbtcDestinationAddr.ts} +4 -4
  45. package/src/web3Sdk/signLbtcDestionationAddr/signLbtcDestionationAddr.stories.tsx +3 -3
  46. package/src/web3Sdk/signNetworkFee/signNetworkFee.stories.tsx +1 -1
  47. package/src/web3Sdk/signStakeAndBake/utils.ts +4 -2
  48. package/src/web3Sdk/unstakeLBTC/unstakeLBTC.stories.tsx +1 -1
  49. package/src/web3Sdk/unstakeLBTC/unstakeLBTC.ts +2 -2
  50. package/src/web3Sdk/utils/chainIdToEnv.ts +4 -3
  51. package/src/web3Sdk/utils/getLbtcTokenContract.ts +5 -2
  52. package/src/btcSdk/utils/getOutputScript.ts +0 -67
package/README.md CHANGED
@@ -69,7 +69,7 @@ Parameters:
69
69
  |-----------|----------|--------------------------------------------------------------|
70
70
  | `address` | `string` | The destination EVM user address where LBTC will be claimed. |
71
71
  | `chainId` | `TChainId` | The destination chain ID where LBTC will be claimed. |
72
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
72
+ | `env` | `Env` | Environment (optional, default: 'prod') |
73
73
  | `partnerId` | `string` | Partner ID (optional) |
74
74
 
75
75
  Usage
@@ -108,7 +108,7 @@ Parameters:
108
108
  | `chainId` | `TChainId` | The destination chain ID where LBTC will be claimed. |
109
109
  | `signature` | `string` | The signature of the address. The signature is generated by signing the address using EVM wallet. |
110
110
  | `referrerCode` | `string` | The referrer code. |
111
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
111
+ | `env` | `Env` | Environment (optional, default: 'prod') |
112
112
  | `captchaToken` | `string` | The captcha token (optional) |
113
113
  | `partnerId` | `string` | The partner ID (optional) |
114
114
 
@@ -133,10 +133,10 @@ Returns all deposits for a given address.
133
133
 
134
134
  Parameters:
135
135
 
136
- | name | type | description |
137
- | --------- | -------- | --------------------------------------- |
136
+ | name | type | description |
137
+ | --------- | ------- | --------------------------------------- |
138
138
  | `address` | `string` | The EVM address to get deposits for |
139
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
139
+ | `env` | `Env` | Environment (optional, default: 'prod') |
140
140
 
141
141
  Usage
142
142
 
@@ -156,11 +156,11 @@ Returns the exchange rate for LBTC.
156
156
 
157
157
  Parameters:
158
158
 
159
- | name | type | description |
160
- | --------- | ---------- | ------------------------------------------------------ |
159
+ | name | type | description |
160
+ | --------- | --------- | ------------------------------------------------------ |
161
161
  | `chainId` | `TChainId` | The chain id of the asset to get the exchange rate for |
162
- | `amount` | `number` | The amount of the asset to get the exchange rate for |
163
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
162
+ | `amount` | `number` | The amount of the asset to get the exchange rate for |
163
+ | `env` | `Env` | Environment (optional, default: 'prod') |
164
164
 
165
165
  Usage
166
166
 
@@ -191,11 +191,12 @@ Parameters:
191
191
  Usage
192
192
 
193
193
  ```typescript
194
- import { signLbtcDestionationAddr } from '@lombard.finance/sdk';
194
+ import { signLbtcDestinationAddr } from '@lombard.finance/sdk';
195
+
195
196
  ...
196
197
  // do connect to the wallet using web3.js or ethers.js or any other library
197
198
  // and get the provider, account and chainId
198
- const destinationAddr = await signLbtcDestionationAddr({
199
+ const destinationAddr = await signLbtcDestinationAddr({
199
200
  provider: window.ethereum,
200
201
  account: '0x...',
201
202
  chainId: 1,
@@ -210,14 +211,14 @@ Claims LBTC.
210
211
 
211
212
  Parameters:
212
213
 
213
- | name | type | description |
214
- | ---------------- | ------------------ | -------------------------------------------------------------------------------------- |
215
- | `data` | `string` | Raw payload from deposit notarization. Can be obtained from the `getDepositsByAddress` |
216
- | `proofSignature` | `string` | Signature from deposit notarization. Can be obtained from the `getDepositsByAddress` |
214
+ | name | type | description |
215
+ | ---------------- | ----------------- | -------------------------------------------------------------------------------------- |
216
+ | `data` | `string` | Raw payload from deposit notarization. Can be obtained from the `getDepositsByAddress` |
217
+ | `proofSignature` | `string` | Signature from deposit notarization. Can be obtained from the `getDepositsByAddress` |
217
218
  | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
218
- | `account` | `string` | Current account address |
219
- | `chainId` | `TChainId` | Current chain ID |
220
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
219
+ | `account` | `string` | Current account address |
220
+ | `chainId` | `TChainId` | Current chain ID |
221
+ | `env` | `Env` | Environment (optional, default: 'prod') |
221
222
 
222
223
  Usage
223
224
 
@@ -245,14 +246,14 @@ Unstakes LBTC to the specified BTC address.
245
246
 
246
247
  Parameters:
247
248
 
248
- | name | type | description |
249
- | ------------ | ------------------ | ------------------------------------------- |
250
- | `btcAddress` | `string` | The BTC address to send the unstaked BTC to |
251
- | `amount` | `string` | The amount of LBTC to unstake |
249
+ | name | type | description |
250
+ | ------------ | ----------------- | ------------------------------------------- |
251
+ | `btcAddress` | `string` | The BTC address to send the unstaked BTC to |
252
+ | `amount` | `string` | The amount of LBTC to unstake |
252
253
  | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
253
- | `account` | `string` | Current account address |
254
- | `chainId` | `TChainId` | Current chain ID |
255
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
254
+ | `account` | `string` | Current account address |
255
+ | `chainId` | `TChainId` | Current chain ID |
256
+ | `env` | `Env` | Environment (optional, default: 'prod') |
256
257
 
257
258
  Usage
258
259
 
@@ -280,13 +281,13 @@ Check Deposit Status by hash id through Bascule
280
281
 
281
282
  Parameters:
282
283
 
283
- | name | type | description |
284
- | ---------- | ------------------ | ---------------------------------------------------------------------------------- |
285
- | `txId` | `string` | Payload from deposit notarization. Can be obtained from the `getDepositsByAddress` |
284
+ | name | type | description |
285
+ | ---------- | ----------------- | ---------------------------------------------------------------------------------- |
286
+ | `txId` | `string` | Payload from deposit notarization. Can be obtained from the `getDepositsByAddress` |
286
287
  | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
287
- | `account` | `string` | Current account address |
288
- | `chainId` | `TChainId` | Current chain ID |
289
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
288
+ | `account` | `string` | Current account address |
289
+ | `chainId` | `TChainId` | Current chain ID |
290
+ | `env` | `Env` | Environment (optional, default: 'prod') |
290
291
 
291
292
  Usage
292
293
 
@@ -311,11 +312,11 @@ Get LBTC total supply
311
312
 
312
313
  Parameters:
313
314
 
314
- | name | type | description |
315
- | --------- | ---------- | --------------------------------------- |
316
- | `rpcUrl` | `string` | Rpc url for the chain |
315
+ | name | type | description |
316
+ | --------- | --------- | --------------------------------------- |
317
+ | `rpcUrl` | `string` | Rpc url for the chain |
317
318
  | `chainId` | `TChainId` | Current chain ID |
318
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
319
+ | `env` | `Env` | Environment (optional, default: 'prod') |
319
320
 
320
321
  Usage
321
322
 
@@ -396,8 +397,8 @@ Get user's stake and bake signature from the API
396
397
 
397
398
  ## Parameters
398
399
 
399
- | name | type | description |
400
- | ------------------------ | -------- | --------------------------------------- |
400
+ | name | type | description |
401
+ | ------------------------ | ------- | --------------------------------------- |
401
402
  | `userDestinationAddress` | `string` | The user's destination address |
402
403
  | `chainId` | `string` | The chain ID |
403
404
  | `env` | `TEnv` | Environment (e.g., 'prod', 'stage', etc.) |