@lombard.finance/sdk 3.1.0 → 3.4.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.
Files changed (76) hide show
  1. package/README.md +60 -1
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +73 -62
  4. package/dist/index2.cjs +62 -52
  5. package/dist/index2.cjs.map +1 -1
  6. package/dist/index2.js +8361 -12041
  7. package/dist/index2.js.map +1 -1
  8. package/package.json +35 -33
  9. package/src/api-functions/generateDepositBtcAddress/generateDepositBtcAddress.ts +4 -4
  10. package/src/api-functions/getDepositBtcAddress/getDepositBtcAddress.stories.tsx +8 -0
  11. package/src/api-functions/getDepositBtcAddress/getDepositBtcAddress.ts +3 -3
  12. package/src/api-functions/getDepositsByAddress/getDepositsByAddress.ts +8 -7
  13. package/src/api-functions/getUnstakesByAddress/getUnstakesByAddress.ts +5 -5
  14. package/src/api-functions/getUserStakeAndBakeSignature/getUserStakeAndBakeSignature.stories.tsx +8 -0
  15. package/src/bridge/abi/CCIP_BRIDGE_ADAPTER_ABI.json +704 -0
  16. package/src/bridge/abi/OFT_BRIDGE_ADAPTER_ABI.json +912 -0
  17. package/src/bridge/index.ts +11 -0
  18. package/src/bridge/lib/bridge.stories.tsx +89 -0
  19. package/src/bridge/lib/bridge.ts +101 -0
  20. package/src/bridge/lib/ccip-bridge.stories.tsx +90 -0
  21. package/src/bridge/lib/ccip-bridge.ts +163 -0
  22. package/src/bridge/lib/config.ts +338 -0
  23. package/src/bridge/lib/oft-bridge.stories.tsx +89 -0
  24. package/src/bridge/lib/oft-bridge.ts +211 -0
  25. package/src/common/api-config.ts +8 -2
  26. package/src/common/blockchain-identifier.ts +32 -5
  27. package/src/common/chains.ts +13 -1
  28. package/src/common/contract-info.ts +8 -0
  29. package/src/contract-functions/approveLBTC/approveLBTC.stories.tsx +1 -1
  30. package/src/contract-functions/approveLBTC/approveLBTC.ts +3 -2
  31. package/src/contract-functions/claimLBTC/claimLBTC.ts +3 -2
  32. package/src/contract-functions/getBasculeDepositStatus/getBasculeDepositStatus.ts +10 -4
  33. package/src/contract-functions/getLBTCMintingFee/getLBTCMintingFee.tsx +14 -11
  34. package/src/contract-functions/getLBTCTotalSupply/getLBTCTotalSupply.ts +13 -9
  35. package/src/contract-functions/getPermitNonce/getPermitNonce.ts +16 -10
  36. package/src/contract-functions/getShareValue/getShareValue.stories.tsx +1 -1
  37. package/src/contract-functions/getShareValue/getShareValue.ts +1 -1
  38. package/src/contract-functions/getSharesByAddress/getSharesByAddress.stories.tsx +1 -1
  39. package/src/contract-functions/getSharesByAddress/getSharesByAddress.ts +1 -1
  40. package/src/contract-functions/getStakeAndBakeFee/getStakeAndBakeFee.stories.tsx +14 -1
  41. package/src/contract-functions/getStakeAndBakeFee/getStakeAndBakeFee.tsx +5 -1
  42. package/src/contract-functions/signNetworkFee/signNetworkFee.ts +3 -2
  43. package/src/contract-functions/signStakeAndBake/signStakeAndBake.stories.tsx +2 -1
  44. package/src/contract-functions/signStakeAndBake/signStakeAndBake.ts +8 -3
  45. package/src/contract-functions/unstakeLBTC/unstakeLBTC.ts +3 -2
  46. package/src/index.ts +26 -28
  47. package/src/metrics/get-lbtc-stats.stories.tsx +51 -0
  48. package/src/metrics/get-lbtc-stats.ts +38 -0
  49. package/src/rewards/lib/claim-reward.stories.tsx +1 -0
  50. package/src/rewards/lib/claim-reward.ts +5 -0
  51. package/src/rewards/lib/get-reward-signing-data.stories.tsx +1 -0
  52. package/src/rewards/lib/get-reward-signing-data.ts +4 -0
  53. package/src/tokens/abi/LBTC_ABI.json +1760 -1760
  54. package/src/tokens/abi/LBTC_ABI.ts +1761 -0
  55. package/src/tokens/lbtc-addresses.ts +1 -0
  56. package/src/tokens/token-addresses.ts +32 -0
  57. package/src/tokens/tokens.ts +59 -50
  58. package/src/utils/numbers.ts +3 -0
  59. package/src/vaults/index.ts +35 -176
  60. package/src/vaults/lib/config.ts +196 -0
  61. package/src/vaults/lib/metrics/get-vault-apy.stories.tsx +57 -0
  62. package/src/vaults/lib/metrics/get-vault-apy.ts +132 -0
  63. package/src/vaults/lib/{get-vault-points.stories.tsx → metrics/get-vault-points.stories.tsx} +8 -8
  64. package/src/vaults/lib/{get-vault-points.ts → metrics/get-vault-points.ts} +1 -1
  65. package/src/vaults/lib/metrics/get-vault-tvl.stories.tsx +57 -0
  66. package/src/vaults/lib/metrics/get-vault-tvl.ts +119 -0
  67. package/src/vaults/lib/{cancel-withdraw.stories.tsx → ops/cancel-withdraw.stories.tsx} +9 -9
  68. package/src/vaults/lib/{deposit.stories.tsx → ops/deposit.stories.tsx} +9 -9
  69. package/src/vaults/lib/{deposit.ts → ops/deposit.ts} +10 -10
  70. package/src/vaults/lib/{get-vault-deposits.stories.tsx → ops/get-vault-deposits.stories.tsx} +9 -9
  71. package/src/vaults/lib/{get-vault-deposits.ts → ops/get-vault-deposits.ts} +5 -5
  72. package/src/vaults/lib/{get-vault-withdrawals.stories.tsx → ops/get-vault-withdrawals.stories.tsx} +9 -9
  73. package/src/vaults/lib/{get-vault-withdrawals.ts → ops/get-vault-withdrawals.ts} +5 -5
  74. package/src/vaults/lib/{withdraw.stories.tsx → ops/withdraw.stories.tsx} +9 -9
  75. package/src/vaults/lib/{withdraw.ts → ops/withdraw.ts} +12 -12
  76. package/src/tokens/lbtc-contract.ts +0 -89
package/package.json CHANGED
@@ -1,36 +1,4 @@
1
1
  {
2
- "name": "@lombard.finance/sdk",
3
- "version": "3.1.0",
4
- "exports": {
5
- ".": {
6
- "import": "./dist/index.js",
7
- "require": "./dist/index.cjs",
8
- "types": "./src/index.ts"
9
- }
10
- },
11
- "license": "MIT",
12
- "type": "module",
13
- "types": "./src/index.ts",
14
- "files": [
15
- "dist",
16
- "src"
17
- ],
18
- "engines": {
19
- "node": ">= 22.14.0"
20
- },
21
- "scripts": {
22
- "build-docs": "rimraf ./sdk-docs && typedoc --out sdk-docs",
23
- "build-storybook": "storybook build -o sdk-storybook",
24
- "build": "yarn types && vite build",
25
- "lint": "biome lint",
26
- "storybook": "storybook dev -p 6006",
27
- "types": "tsc --noEmit"
28
- },
29
- "peerDependencies": {
30
- "axios": "^1",
31
- "bignumber.js": "^9",
32
- "bitcoinjs-lib": "6.1.5"
33
- },
34
2
  "dependencies": {
35
3
  "@lombard.finance/sdk-common": "^3.0.0",
36
4
  "viem": "^2.23.15"
@@ -54,5 +22,39 @@
54
22
  "typedoc": "^0.26.6",
55
23
  "typescript": "^5.4.5",
56
24
  "wagmi": "^2.14.15"
57
- }
25
+ },
26
+ "engines": {
27
+ "node": ">= 22.14.0"
28
+ },
29
+ "exports": {
30
+ ".": {
31
+ "types": "./src/index.ts",
32
+ "import": "./dist/index.js",
33
+ "require": "./dist/index.cjs"
34
+ },
35
+ "./clients/*": "./src/clients/*.ts",
36
+ "./utils/*": "./src/utils/*.ts"
37
+ },
38
+ "files": ["dist", "src"],
39
+ "license": "MIT",
40
+ "name": "@lombard.finance/sdk",
41
+ "peerDependencies": {
42
+ "@layerzerolabs/lz-v2-utilities": "3.0.17",
43
+ "axios": "^1",
44
+ "bignumber.js": "^9",
45
+ "bitcoinjs-lib": "6.1.5"
46
+ },
47
+ "scripts": {
48
+ "build": "yarn types && vite build",
49
+ "build-docs": "rimraf ./sdk-docs && typedoc --out sdk-docs",
50
+ "build-storybook": "storybook build -o sdk-storybook",
51
+ "format": "biome format",
52
+ "lint": "biome lint --diagnostic-level=error",
53
+ "storybook": "storybook dev -p 6006",
54
+ "types": "tsc --noEmit",
55
+ "watch": "vite build --watch"
56
+ },
57
+ "type": "module",
58
+ "types": "./src/index.ts",
59
+ "version": "3.4.0"
58
60
  }
@@ -1,9 +1,9 @@
1
1
  import axios from 'axios';
2
- import { IEnvParam } from '../../common/parameters';
3
- import { SuiChain, ChainId } from '../../common/chains';
4
- import { getErrorMessage } from '../../utils/err';
5
2
  import { getApiConfig } from '../../common/api-config';
6
3
  import { getChainNameById } from '../../common/blockchain-identifier';
4
+ import { ChainId, SolanaChain, SuiChain } from '../../common/chains';
5
+ import { IEnvParam } from '../../common/parameters';
6
+ import { getErrorMessage } from '../../utils/err';
7
7
 
8
8
  /**
9
9
  * The address wich will be returned if the provided EVM address is sanctioned.
@@ -24,7 +24,7 @@ export interface IGenerateDepositBtcAddressParams extends IEnvParam {
24
24
  /**
25
25
  * The destination chain ID where LBTC will be claimed.
26
26
  */
27
- chainId: ChainId | SuiChain;
27
+ chainId: ChainId | SuiChain | SolanaChain;
28
28
  /**
29
29
  * The signature of the address. The signature is generated by signing the address using EVM wallet.
30
30
  */
@@ -29,6 +29,14 @@ export const WithParams: Story = {
29
29
  env: DEFAULT_ENV,
30
30
  partnerId: 'lombard',
31
31
  },
32
+ argTypes: {
33
+ chainId: {
34
+ mapping: ChainId,
35
+ options: Object.keys(ChainId),
36
+ description: 'The chain',
37
+ control: { type: 'select' },
38
+ },
39
+ },
32
40
  };
33
41
 
34
42
  export function StoryView(props: IGetDepositBtcAddressParameters) {
@@ -1,11 +1,11 @@
1
1
  import axios from 'axios';
2
- import { IEnvParam } from '../../common/parameters';
3
- import { SuiChain, ChainId } from '../../common/chains';
4
2
  import { getApiConfig } from '../../common/api-config';
5
3
  import {
6
4
  BlockchainIdentifier,
7
5
  getChainNameById,
8
6
  } from '../../common/blockchain-identifier';
7
+ import { ChainId, SolanaChain, SuiChain } from '../../common/chains';
8
+ import { IEnvParam } from '../../common/parameters';
9
9
 
10
10
  export interface IDepositAddress {
11
11
  /**
@@ -72,7 +72,7 @@ export interface IGetDepositBtcAddressesParameters extends IEnvParam {
72
72
  /**
73
73
  * The destination chain where the `address` exists and where LBTC will be claimed.
74
74
  */
75
- chainId: ChainId | SuiChain;
75
+ chainId: ChainId | SuiChain | SolanaChain;
76
76
  /**
77
77
  * The maximum number of items to return.
78
78
  * @default {number} 1
@@ -1,11 +1,11 @@
1
+ import { Env } from '@lombard.finance/sdk-common';
1
2
  import axios from 'axios';
2
3
  import BigNumber from 'bignumber.js';
3
- import { IEnvParam } from '../../common/parameters';
4
- import { SuiChain, ChainId } from '../../common/chains';
5
- import { fromSatoshi } from '../../utils/satoshi';
6
4
  import { getApiConfig } from '../../common/api-config';
7
- import { Env } from '@lombard.finance/sdk-common';
8
5
  import { getChainIdByName } from '../../common/blockchain-identifier';
6
+ import { ChainId, SolanaChain, SuiChain } from '../../common/chains';
7
+ import { IEnvParam } from '../../common/parameters';
8
+ import { fromSatoshi } from '../../utils/satoshi';
9
9
 
10
10
  type Address = string;
11
11
  type Seconds = number;
@@ -60,7 +60,7 @@ export interface IDeposit {
60
60
  blockTime?: number;
61
61
  value: BigNumber;
62
62
  address: Address;
63
- chainId: ChainId | SuiChain;
63
+ chainId: ChainId | SuiChain | SolanaChain;
64
64
  isClaimed?: boolean;
65
65
  claimedTxId?: string;
66
66
  rawPayload?: string;
@@ -73,9 +73,10 @@ export interface IDeposit {
73
73
  sessionId: number;
74
74
  notarizationStatus: ENotarizationStatus;
75
75
  sessionState: ESessionState;
76
- fromChainId?: ChainId;
77
- toChainId?: ChainId;
76
+ fromChainId?: ChainId | SuiChain | SolanaChain;
77
+ toChainId?: ChainId | SuiChain | SolanaChain;
78
78
  status?: string;
79
+ toAddress?: string;
79
80
  }
80
81
 
81
82
  export interface IGetDepositsByAddressParams extends IEnvParam {
@@ -1,14 +1,14 @@
1
1
  import axios from 'axios';
2
+ import BigNumber from 'bignumber.js';
2
3
  import { address, networks } from 'bitcoinjs-lib';
3
- import { IEnvParam } from '../../common/parameters';
4
- import { SuiChain, ChainId } from '../../common/chains';
5
- import { fromSatoshi } from '../../utils/satoshi';
6
4
  import { getApiConfig } from '../../common/api-config';
7
5
  import {
8
6
  BlockchainIdentifier,
9
7
  getChainIdByName,
10
8
  } from '../../common/blockchain-identifier';
11
- import BigNumber from 'bignumber.js';
9
+ import { ChainId, SolanaChain, SuiChain } from '../../common/chains';
10
+ import { IEnvParam } from '../../common/parameters';
11
+ import { fromSatoshi } from '../../utils/satoshi';
12
12
 
13
13
  interface IUnstakeResponse {
14
14
  tx_hash: string;
@@ -35,7 +35,7 @@ export interface IUnstake {
35
35
  /**
36
36
  * The chain id where unstake transaction happened.
37
37
  */
38
- chainId: ChainId | SuiChain;
38
+ chainId: ChainId | SuiChain | SolanaChain;
39
39
  /**
40
40
  * The block height.
41
41
  */
@@ -28,6 +28,14 @@ export const WithParams: Story = {
28
28
  chainId: ChainId.ethereum,
29
29
  env: DEFAULT_ENV,
30
30
  },
31
+ argTypes: {
32
+ chainId: {
33
+ mapping: ChainId,
34
+ options: Object.keys(ChainId),
35
+ description: 'The chain',
36
+ control: { type: 'select' },
37
+ },
38
+ },
31
39
  };
32
40
 
33
41
  type GetUserStakeAndBakeSignatureProps = IGetUserStakeAndBakeSignatureParams;