@lombard.finance/sdk 3.7.1 → 3.7.2

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 (204) hide show
  1. package/CHANGELOG.md +102 -98
  2. package/README.md +164 -160
  3. package/dist/api-functions/generateDepositBtcAddress/generateDepositBtcAddress.d.ts.map +1 -1
  4. package/dist/api-functions/get-badges-by-address/get-badges-by-address.d.ts +1 -1
  5. package/dist/api-functions/get-badges-by-address/get-badges-by-address.d.ts.map +1 -1
  6. package/dist/api-functions/getDepositBtcAddress/getDepositBtcAddress.d.ts +1 -1
  7. package/dist/api-functions/getDepositBtcAddress/getDepositBtcAddress.d.ts.map +1 -1
  8. package/dist/api-functions/getDepositBtcAddress/make-request.d.ts.map +1 -1
  9. package/dist/api-functions/getDepositsByAddress/getDepositsByAddress.d.ts.map +1 -1
  10. package/dist/api-functions/getLBTCExchangeRate/get-exchange-ratio.d.ts.map +1 -1
  11. package/dist/api-functions/getLBTCExchangeRate/getLBTCExchangeRate.d.ts.map +1 -1
  12. package/dist/api-functions/getLBTCExchangeRate/index.d.ts +1 -1
  13. package/dist/api-functions/getLBTCExchangeRate/index.d.ts.map +1 -1
  14. package/dist/api-functions/getPointsByAddress/getPointsByAddress.d.ts.map +1 -1
  15. package/dist/api-functions/getUnstakesByAddress/getUnstakesByAddress.d.ts.map +1 -1
  16. package/dist/api-functions/getUserStakeAndBakeSignature/getUserStakeAndBakeSignature.d.ts.map +1 -1
  17. package/dist/api-functions/setReferral/setReferral.d.ts.map +1 -1
  18. package/dist/api-functions/storeNetworkFeeSignature/storeNetworkFeeSignature.d.ts.map +1 -1
  19. package/dist/api-functions/storeStakeAndBakeSignature/storeStakeAndBakeSignature.d.ts.map +1 -1
  20. package/dist/bridge/index.d.ts +2 -2
  21. package/dist/bridge/index.d.ts.map +1 -1
  22. package/dist/bridge/lib/bridge.d.ts.map +1 -1
  23. package/dist/bridge/lib/ccip-bridge.d.ts.map +1 -1
  24. package/dist/bridge/lib/ccip-config.d.ts +1 -1
  25. package/dist/bridge/lib/ccip-config.d.ts.map +1 -1
  26. package/dist/bridge/lib/config.d.ts.map +1 -1
  27. package/dist/bridge/lib/oft-bridge.d.ts.map +1 -1
  28. package/dist/clients/evm-signer-adapter.d.ts.map +1 -1
  29. package/dist/clients/public-client.d.ts.map +1 -1
  30. package/dist/clients/rpc-url-config.d.ts.map +1 -1
  31. package/dist/clients/wallet-client.d.ts.map +1 -1
  32. package/dist/common/blockchain-identifier.d.ts +2 -0
  33. package/dist/common/blockchain-identifier.d.ts.map +1 -1
  34. package/dist/common/chains.d.ts +191 -97
  35. package/dist/common/chains.d.ts.map +1 -1
  36. package/dist/common/chains.stories.d.ts.map +1 -1
  37. package/dist/common/contract-info.d.ts.map +1 -1
  38. package/dist/common/parameters.d.ts.map +1 -1
  39. package/dist/contract-functions/approveLBTC/approveLBTC.d.ts.map +1 -1
  40. package/dist/contract-functions/approveToken/approveToken.d.ts +1 -1
  41. package/dist/contract-functions/approveToken/approveToken.d.ts.map +1 -1
  42. package/dist/contract-functions/claimLBTC/claimLBTC.d.ts.map +1 -1
  43. package/dist/contract-functions/claimUnstakeRedeem/claimUnstakeRedeem.d.ts.map +1 -1
  44. package/dist/contract-functions/deposit/depositToken.d.ts.map +1 -1
  45. package/dist/contract-functions/getBasculeDepositStatus/getBasculeDepositStatus.d.ts.map +1 -1
  46. package/dist/contract-functions/getBasculeDepositStatus/getBasculeDepositStatus.stories.d.ts.map +1 -1
  47. package/dist/contract-functions/getBasculeDepositStatus/index.d.ts +1 -1
  48. package/dist/contract-functions/getBasculeDepositStatus/index.d.ts.map +1 -1
  49. package/dist/contract-functions/getLBTCMintingFee/getLBTCMintingFee.d.ts.map +1 -1
  50. package/dist/contract-functions/getLBTCMintingFee/getLBTCMintingFee.stories.d.ts.map +1 -1
  51. package/dist/contract-functions/getLBTCTotalSupply/getLBTCTotalSupply.d.ts.map +1 -1
  52. package/dist/contract-functions/getPermitNonce/getPermitNonce.d.ts.map +1 -1
  53. package/dist/contract-functions/getShareValue/getShareValue.d.ts.map +1 -1
  54. package/dist/contract-functions/getSharesByAddress/getSharesByAddress.d.ts.map +1 -1
  55. package/dist/contract-functions/getStakeAndBakeFee/getStakeAndBakeFee.d.ts.map +1 -1
  56. package/dist/contract-functions/index.d.ts +2 -2
  57. package/dist/contract-functions/index.d.ts.map +1 -1
  58. package/dist/contract-functions/signNetworkFee/signNetworkFee.d.ts.map +1 -1
  59. package/dist/contract-functions/signStakeAndBake/handleApprove.d.ts.map +1 -1
  60. package/dist/contract-functions/signStakeAndBake/signStakeAndBake.d.ts.map +1 -1
  61. package/dist/contract-functions/signStakeAndBake/typed-data-builder.d.ts.map +1 -1
  62. package/dist/contract-functions/signStakeAndBake/utils.d.ts.map +1 -1
  63. package/dist/contract-functions/signStakeAndBake/validation.d.ts.map +1 -1
  64. package/dist/contract-functions/unstakeLBTC/unstakeLBTC.d.ts.map +1 -1
  65. package/dist/debug-api/btc-script-to-address.d.ts.map +1 -1
  66. package/dist/debug-api/btc-tx-info.d.ts.map +1 -1
  67. package/dist/debug-api/evm-by-btc-address.d.ts.map +1 -1
  68. package/dist/defi/defi-registry.d.ts +1 -1
  69. package/dist/defi/defi-registry.d.ts.map +1 -1
  70. package/dist/defi/defi-registry.stories.d.ts.map +1 -1
  71. package/dist/defi/index.d.ts +1 -1
  72. package/dist/defi/index.d.ts.map +1 -1
  73. package/dist/index.cjs +1 -1
  74. package/dist/index.d.ts +7 -7
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +51 -49
  77. package/dist/index2.cjs +54 -54
  78. package/dist/index2.js +14414 -11251
  79. package/dist/metrics/get-additional-rewards.d.ts +1 -1
  80. package/dist/metrics/get-additional-rewards.d.ts.map +1 -1
  81. package/dist/metrics/get-lbtc-apy.d.ts +1 -1
  82. package/dist/metrics/get-lbtc-apy.d.ts.map +1 -1
  83. package/dist/metrics/get-lbtc-stats.d.ts.map +1 -1
  84. package/dist/metrics/get-lbtc-stats.stories.d.ts.map +1 -1
  85. package/dist/metrics/get-positions-summary.d.ts.map +1 -1
  86. package/dist/metrics/get-positions-summary.stories.d.ts.map +1 -1
  87. package/dist/stories/arg-types.d.ts.map +1 -1
  88. package/dist/tokens/lbtc-addresses.d.ts.map +1 -1
  89. package/dist/tokens/token-addresses.d.ts +1 -1
  90. package/dist/tokens/token-addresses.d.ts.map +1 -1
  91. package/dist/tokens/tokens.d.ts +5 -5
  92. package/dist/tokens/tokens.d.ts.map +1 -1
  93. package/dist/utils/block.d.ts.map +1 -1
  94. package/dist/utils/env.d.ts.map +1 -1
  95. package/dist/utils/err.d.ts +2 -2
  96. package/dist/utils/err.d.ts.map +1 -1
  97. package/dist/utils/transaction-executor.d.ts.map +1 -1
  98. package/dist/vaults/index.d.ts +5 -5
  99. package/dist/vaults/index.d.ts.map +1 -1
  100. package/dist/vaults/lib/config.d.ts.map +1 -1
  101. package/dist/vaults/lib/metrics/get-vault-apy.d.ts.map +1 -1
  102. package/dist/vaults/lib/metrics/get-vault-points.d.ts.map +1 -1
  103. package/dist/vaults/lib/metrics/get-vault-tvl.d.ts.map +1 -1
  104. package/dist/vaults/lib/ops/deposit.d.ts.map +1 -1
  105. package/dist/vaults/lib/ops/get-vault-deposits.d.ts.map +1 -1
  106. package/dist/vaults/lib/ops/get-vault-withdrawals.d.ts.map +1 -1
  107. package/dist/vaults/lib/ops/withdraw.d.ts.map +1 -1
  108. package/package.json +4 -4
  109. package/src/api-functions/generateDepositBtcAddress/generateDepositBtcAddress.ts +4 -3
  110. package/src/api-functions/get-badges-by-address/get-badges-by-address.ts +2 -1
  111. package/src/api-functions/getDepositBtcAddress/getDepositBtcAddress.test.ts +3 -2
  112. package/src/api-functions/getDepositBtcAddress/getDepositBtcAddress.ts +3 -2
  113. package/src/api-functions/getDepositBtcAddress/make-request.ts +2 -1
  114. package/src/api-functions/getDepositsByAddress/getDepositsByAddress.ts +4 -3
  115. package/src/api-functions/getLBTCExchangeRate/get-exchange-ratio.ts +2 -1
  116. package/src/api-functions/getLBTCExchangeRate/getLBTCExchangeRate.ts +1 -0
  117. package/src/api-functions/getLBTCExchangeRate/index.ts +1 -1
  118. package/src/api-functions/getPointsByAddress/getPointsByAddress.ts +1 -0
  119. package/src/api-functions/getUnstakesByAddress/getUnstakesByAddress.ts +5 -4
  120. package/src/api-functions/getUserStakeAndBakeSignature/getUserStakeAndBakeSignature.ts +1 -0
  121. package/src/api-functions/setReferral/setReferral.ts +1 -0
  122. package/src/api-functions/storeNetworkFeeSignature/storeNetworkFeeSignature.ts +1 -0
  123. package/src/api-functions/storeStakeAndBakeSignature/storeStakeAndBakeSignature.ts +1 -0
  124. package/src/bridge/index.ts +2 -3
  125. package/src/bridge/lib/bridge.ts +3 -2
  126. package/src/bridge/lib/ccip-bridge.ts +5 -4
  127. package/src/bridge/lib/ccip-config.ts +2 -1
  128. package/src/bridge/lib/config.ts +1 -0
  129. package/src/bridge/lib/oft-bridge.ts +3 -2
  130. package/src/clients/evm-signer-adapter.ts +4 -3
  131. package/src/clients/public-client.ts +1 -0
  132. package/src/clients/rpc-url-config.ts +4 -1
  133. package/src/clients/wallet-client.ts +3 -2
  134. package/src/common/blockchain-identifier.ts +14 -2
  135. package/src/common/chains.stories.tsx +2 -2
  136. package/src/common/chains.ts +54 -10
  137. package/src/common/contract-info.ts +1 -0
  138. package/src/common/parameters.ts +1 -0
  139. package/src/contract-functions/approveLBTC/approveLBTC.ts +1 -0
  140. package/src/contract-functions/approveToken/approveToken.ts +3 -2
  141. package/src/contract-functions/approveToken/index.ts +0 -1
  142. package/src/contract-functions/claimLBTC/claimLBTC.ts +1 -0
  143. package/src/contract-functions/claimUnstakeRedeem/claimUnstakeRedeem.ts +6 -5
  144. package/src/contract-functions/claimUnstakeRedeem/index.ts +0 -1
  145. package/src/contract-functions/deposit/depositToken.ts +7 -6
  146. package/src/contract-functions/getBasculeDepositStatus/getBasculeDepositStatus.stories.tsx +6 -6
  147. package/src/contract-functions/getBasculeDepositStatus/getBasculeDepositStatus.ts +14 -9
  148. package/src/contract-functions/getBasculeDepositStatus/index.ts +1 -1
  149. package/src/contract-functions/getLBTCMintingFee/getLBTCMintingFee.stories.tsx +1 -1
  150. package/src/contract-functions/getLBTCMintingFee/getLBTCMintingFee.ts +1 -0
  151. package/src/contract-functions/getLBTCTotalSupply/getLBTCTotalSupply.ts +1 -0
  152. package/src/contract-functions/getPermitNonce/getPermitNonce.ts +1 -0
  153. package/src/contract-functions/getShareValue/getShareValue.ts +2 -1
  154. package/src/contract-functions/getSharesByAddress/getSharesByAddress.ts +2 -1
  155. package/src/contract-functions/getStakeAndBakeFee/__tests__/getStakeAndBakeFee.test.ts +8 -4
  156. package/src/contract-functions/getStakeAndBakeFee/getStakeAndBakeFee.tsx +1 -0
  157. package/src/contract-functions/index.ts +2 -2
  158. package/src/contract-functions/signNetworkFee/signNetworkFee.ts +1 -0
  159. package/src/contract-functions/signStakeAndBake/__tests__/signStakeAndBake.test.ts +5 -4
  160. package/src/contract-functions/signStakeAndBake/handleApprove.ts +1 -0
  161. package/src/contract-functions/signStakeAndBake/index.ts +0 -1
  162. package/src/contract-functions/signStakeAndBake/signStakeAndBake.ts +15 -17
  163. package/src/contract-functions/signStakeAndBake/typed-data-builder.ts +6 -6
  164. package/src/contract-functions/signStakeAndBake/utils.ts +2 -1
  165. package/src/contract-functions/signStakeAndBake/validation.ts +5 -4
  166. package/src/contract-functions/unstakeLBTC/unstakeLBTC.ts +2 -1
  167. package/src/debug-api/btc-script-to-address.ts +1 -0
  168. package/src/debug-api/btc-tx-info.ts +2 -1
  169. package/src/debug-api/evm-by-btc-address.ts +1 -0
  170. package/src/defi/README.md +62 -33
  171. package/src/defi/defi-registry.stories.tsx +3 -1
  172. package/src/defi/defi-registry.ts +2 -1
  173. package/src/defi/index.ts +1 -2
  174. package/src/index.ts +34 -32
  175. package/src/metrics/get-additional-rewards.ts +3 -2
  176. package/src/metrics/get-lbtc-apy.ts +2 -1
  177. package/src/metrics/get-lbtc-stats.stories.tsx +2 -2
  178. package/src/metrics/get-lbtc-stats.ts +1 -0
  179. package/src/metrics/get-positions-summary.stories.tsx +4 -4
  180. package/src/metrics/get-positions-summary.ts +2 -1
  181. package/src/stories/arg-types.ts +1 -1
  182. package/src/tokens/abi/ASSET_ROUTER_ABI.ts +1 -1
  183. package/src/tokens/cross-chain-addresses.stories.tsx +16 -17
  184. package/src/tokens/denomination-utils.stories.tsx +6 -7
  185. package/src/tokens/getLbtcContractAddresses.stories.tsx +7 -8
  186. package/src/tokens/getTokenByAddress.stories.tsx +6 -7
  187. package/src/tokens/getTokenContractInfo.stories.tsx +9 -10
  188. package/src/tokens/isUpgradedContract.stories.tsx +4 -5
  189. package/src/tokens/lbtc-addresses.ts +1 -0
  190. package/src/tokens/token-addresses.ts +72 -49
  191. package/src/tokens/tokens.ts +8 -7
  192. package/src/utils/block.ts +1 -0
  193. package/src/utils/env.ts +1 -0
  194. package/src/utils/err.ts +3 -2
  195. package/src/utils/transaction-executor.ts +2 -1
  196. package/src/vaults/index.ts +14 -21
  197. package/src/vaults/lib/config.ts +1 -0
  198. package/src/vaults/lib/metrics/get-vault-apy.ts +2 -1
  199. package/src/vaults/lib/metrics/get-vault-points.ts +2 -1
  200. package/src/vaults/lib/metrics/get-vault-tvl.ts +3 -2
  201. package/src/vaults/lib/ops/deposit.ts +2 -1
  202. package/src/vaults/lib/ops/get-vault-deposits.ts +6 -5
  203. package/src/vaults/lib/ops/get-vault-withdrawals.ts +6 -5
  204. package/src/vaults/lib/ops/withdraw.ts +2 -1
@@ -1,8 +1,9 @@
1
- import { Address } from 'viem';
2
1
  import axios from 'axios';
2
+ import BigNumber from 'bignumber.js';
3
+ import { Address } from 'viem';
4
+
3
5
  import { getApiConfig } from '../common/api-config';
4
6
  import { IEnvParam } from '../common/parameters';
5
- import BigNumber from 'bignumber.js';
6
7
 
7
8
  type Response = {
8
9
  btc_distributed: { name: string; amount: number }[];
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
- import { Address, zeroAddress } from 'viem';
3
2
  import BigNumber from 'bignumber.js';
3
+ import { Address, zeroAddress } from 'viem';
4
+
4
5
  import { getApiConfig } from '../common/api-config';
5
6
  import { IEnvParam } from '../common/parameters';
6
7
 
@@ -1,12 +1,12 @@
1
+ import { DEFAULT_ENV } from '@lombard.finance/sdk-common';
1
2
  import type { Meta, StoryObj } from '@storybook/react';
3
+ import { envSelector } from '../stories/arg-types';
2
4
  import { Button } from '../stories/components/Button';
3
5
  import { CodeBlock } from '../stories/components/CodeBlock';
4
6
  import { functionType, wagmiDecorator } from '../stories/components/decorators';
5
7
  import { ErrorBlock } from '../stories/components/error-block';
6
8
  import useQuery from '../stories/hooks/useQuery';
7
9
  import { getLBTCStats } from './get-lbtc-stats';
8
- import { envSelector } from '../stories/arg-types';
9
- import { DEFAULT_ENV } from '@lombard.finance/sdk-common';
10
10
 
11
11
  const meta = {
12
12
  title: 'metrics/getLBTCStats',
@@ -1,5 +1,6 @@
1
1
  import axios from 'axios';
2
2
  import BigNumber from 'bignumber.js';
3
+
3
4
  import { getApiConfig } from '../common/api-config';
4
5
  import { IEnvParam } from '../common/parameters';
5
6
 
@@ -1,13 +1,13 @@
1
+ import { Env } from '@lombard.finance/sdk-common';
1
2
  import type { Meta, StoryObj } from '@storybook/react';
3
+ import { envSelector } from '../stories/arg-types';
2
4
  import { Button } from '../stories/components/Button';
3
5
  import { CodeBlock } from '../stories/components/CodeBlock';
4
- import useQuery from '../stories/hooks/useQuery';
5
6
  import { functionType, wagmiDecorator } from '../stories/components/decorators';
6
7
  import { ErrorBlock } from '../stories/components/error-block';
7
- import { getPositionsSummary } from './get-positions-summary';
8
8
  import { EXAMPLE_EVM_ADDRESS } from '../stories/constants';
9
- import { envSelector } from '../stories/arg-types';
10
- import { Env } from '@lombard.finance/sdk-common';
9
+ import useQuery from '../stories/hooks/useQuery';
10
+ import { getPositionsSummary } from './get-positions-summary';
11
11
 
12
12
  const meta = {
13
13
  title: 'metrics/getPositionsSummary',
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import BigNumber from 'bignumber.js';
3
3
  import { Address } from 'viem';
4
+
4
5
  import { getApiConfig } from '../common/api-config';
5
6
  import { IEnvParam } from '../common/parameters';
6
7
  import { Token } from '../tokens/token-addresses';
@@ -116,7 +117,7 @@ export async function getPositionsSummary({
116
117
  },
117
118
  btcValue: BigNumber(data.btc_value || 0),
118
119
  btcPnl: BigNumber(data.btc_pnl || 0),
119
- snapshot: data?.snapshot?.map(ds => ({
120
+ snapshot: data.snapshot?.map(ds => ({
120
121
  token: mapRewardAssetToToken(ds.asset),
121
122
  type: ds.type,
122
123
  balance: BigNumber(ds.balance || 0),
@@ -1,6 +1,6 @@
1
+ import { Env } from '@lombard.finance/sdk-common';
1
2
  import { ArgTypes } from 'storybook/internal/types';
2
3
  import { ChainId } from '../common/chains';
3
- import { Env } from '@lombard.finance/sdk-common';
4
4
  import { Token } from '../tokens/token-addresses';
5
5
 
6
6
  export const chainSelector: Partial<ArgTypes> = {
@@ -1963,4 +1963,4 @@ export default [
1963
1963
  stateMutability: 'view',
1964
1964
  type: 'function',
1965
1965
  },
1966
- ];
1966
+ ];
@@ -2,22 +2,22 @@ import { Env } from '@lombard.finance/sdk-common';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { useState } from 'react';
4
4
  import {
5
- SOLANA_DEVNET_CHAIN,
6
- SOLANA_MAINNET_CHAIN,
7
- SOLANA_TESTNET_CHAIN,
8
- STARKNET_MAINNET_CHAIN,
9
- STARKNET_SEPOLIA_CHAIN,
10
- SUI_MAINNET_CHAIN,
11
- SUI_TESTNET_CHAIN,
5
+ SOLANA_DEVNET_CHAIN,
6
+ SOLANA_MAINNET_CHAIN,
7
+ SOLANA_TESTNET_CHAIN,
8
+ STARKNET_MAINNET_CHAIN,
9
+ STARKNET_SEPOLIA_CHAIN,
10
+ SUI_MAINNET_CHAIN,
11
+ SUI_TESTNET_CHAIN,
12
12
  } from '../common/chains';
13
13
  import { envSelector } from '../stories/arg-types';
14
14
  import { Button } from '../stories/components/Button';
15
15
  import { CodeBlock } from '../stories/components/CodeBlock';
16
16
  import { functionType } from '../stories/components/decorators';
17
17
  import {
18
- getSolanaTokenAddress,
19
- getStarknetTokenAddress,
20
- getSuiTokenAddress,
18
+ getSolanaTokenAddress,
19
+ getStarknetTokenAddress,
20
+ getSuiTokenAddress,
21
21
  } from './token-addresses';
22
22
 
23
23
  const meta = {
@@ -73,32 +73,32 @@ interface StoryViewProps {
73
73
 
74
74
  /**
75
75
  * Get LBTC token addresses for non-EVM blockchains.
76
- *
76
+ *
77
77
  * Lombard tokens are deployed across multiple blockchain ecosystems.
78
78
  * These helper functions provide easy access to token addresses for:
79
- *
79
+ *
80
80
  * **Sui Network:**
81
81
  * - `getSuiTokenAddress(chainId, env)`
82
82
  * - Supported: Mainnet, Testnet
83
83
  * - Returns Sui package/object address
84
- *
84
+ *
85
85
  * **Solana:**
86
86
  * - `getSolanaTokenAddress(chainId, env)`
87
87
  * - Supported: Mainnet, Testnet, Devnet
88
88
  * - Returns SPL token mint address
89
- *
89
+ *
90
90
  * **Starknet:**
91
91
  * - `getStarknetTokenAddress(chainId, env, variant)`
92
92
  * - Supported: Mainnet, Sepolia
93
93
  * - Variants: 'token' (default), 'assetRouter'
94
94
  * - Returns Cairo contract address
95
- *
95
+ *
96
96
  * **Use Cases:**
97
97
  * - Cross-chain integrations
98
98
  * - Multi-wallet support
99
99
  * - Token verification on different chains
100
100
  * - SDK initialization for non-EVM chains
101
- *
101
+ *
102
102
  * **Returns:**
103
103
  * - String address if deployed
104
104
  * - `undefined` if not deployed on that chain/environment
@@ -233,4 +233,3 @@ export function StoryView(props: StoryViewProps) {
233
233
  </div>
234
234
  );
235
235
  }
236
-
@@ -54,27 +54,27 @@ interface StoryViewProps {
54
54
 
55
55
  /**
56
56
  * Convert between human-readable amounts and base denominations.
57
- *
57
+ *
58
58
  * These utility functions handle conversion between display values and
59
59
  * contract-compatible base units (like satoshis for BTC or wei for ETH).
60
- *
60
+ *
61
61
  * **Functions:**
62
- *
62
+ *
63
63
  * 1. `toBaseDenomination(amount, decimals)`:
64
64
  * - Converts human-readable amount to base units
65
65
  * - Example: 1 BTC → 100,000,000 satoshis (decimals=8)
66
66
  * - Use before sending amounts to smart contracts
67
- *
67
+ *
68
68
  * 2. `fromBaseDenomination(amount, decimals)`:
69
69
  * - Converts base units to human-readable amount
70
70
  * - Example: 100,000,000 satoshis → 1 BTC (decimals=8)
71
71
  * - Use when displaying contract values to users
72
- *
72
+ *
73
73
  * **Common Decimal Places:**
74
74
  * - BTC/LBTC: 8 decimals
75
75
  * - ETH: 18 decimals
76
76
  * - USDC/USDT: 6 decimals
77
- *
77
+ *
78
78
  * **Important Notes:**
79
79
  * - Uses BigNumber.js for precision
80
80
  * - Rounds to nearest integer for base denomination
@@ -173,4 +173,3 @@ export function StoryView(props: StoryViewProps) {
173
173
  </div>
174
174
  );
175
175
  }
176
-
@@ -46,17 +46,17 @@ interface StoryViewProps {
46
46
 
47
47
  /**
48
48
  * Get all LBTC contract addresses for a specific environment.
49
- *
49
+ *
50
50
  * This function returns a complete mapping of LBTC contract addresses
51
51
  * across all supported EVM chains for a given environment (prod, testnet, dev).
52
- *
52
+ *
53
53
  * **Environments:**
54
54
  * - `prod`: Production/mainnet addresses
55
55
  * - `testnet`: Public testnet addresses
56
56
  * - `stage`: Staging environment
57
57
  * - `dev`: Development environment
58
58
  * - `ibc`: IBC environment
59
- *
59
+ *
60
60
  * **Supported Chains:**
61
61
  * - Ethereum
62
62
  * - Base
@@ -72,13 +72,13 @@ interface StoryViewProps {
72
72
  * - Swell
73
73
  * - TAC
74
74
  * - And their testnets
75
- *
75
+ *
76
76
  * **Use Cases:**
77
77
  * - Display all deployment addresses
78
78
  * - Validate contract addresses
79
79
  * - Multi-chain integration setup
80
80
  * - Configuration management
81
- *
81
+ *
82
82
  * **Returns:**
83
83
  * Object mapping ChainId to contract Address
84
84
  */
@@ -135,8 +135,8 @@ export function StoryView(props: StoryViewProps) {
135
135
  return (
136
136
  <tr key={chainId}>
137
137
  <td>
138
- <strong>{chain?.name || 'Unknown'}</strong> (
139
- {chainId})
138
+ <strong>{chain?.name || 'Unknown'}</strong> ({chainId}
139
+ )
140
140
  </td>
141
141
  <td>
142
142
  <code className="text-break">{address}</code>
@@ -155,4 +155,3 @@ export function StoryView(props: StoryViewProps) {
155
155
  </div>
156
156
  );
157
157
  }
158
-
@@ -76,28 +76,28 @@ interface StoryViewProps {
76
76
 
77
77
  /**
78
78
  * Reverse lookup: find which token a contract address belongs to.
79
- *
79
+ *
80
80
  * This function searches through all known token addresses to identify
81
81
  * which Lombard token matches the given address on a specific chain.
82
- *
82
+ *
83
83
  * **Supported Tokens:**
84
84
  * - LBTC
85
85
  * - BTCb
86
- *
86
+ *
87
87
  * **Address Kinds:**
88
88
  * - `Token`: The token contract address (default)
89
89
  * - `Adapter`: The bridge adapter address (for BTCb on Avalanche)
90
- *
90
+ *
91
91
  * **Use Cases:**
92
92
  * - Identify tokens from transaction logs
93
93
  * - Validate if an address is a known Lombard token
94
94
  * - Display token metadata based on contract address
95
95
  * - Parse events from smart contracts
96
- *
96
+ *
97
97
  * **Returns:**
98
98
  * - Token enum if found (e.g., `Token.LBTC`)
99
99
  * - `undefined` if address is not a known token
100
- *
100
+ *
101
101
  * **Note:** The comparison is case-insensitive
102
102
  */
103
103
  export function StoryView(props: StoryViewProps) {
@@ -169,4 +169,3 @@ export function StoryView(props: StoryViewProps) {
169
169
  </div>
170
170
  );
171
171
  }
172
-
@@ -2,9 +2,9 @@ import { Env } from '@lombard.finance/sdk-common';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { ChainId } from '../common/chains';
4
4
  import {
5
- chainSelector,
6
- envSelector,
7
- makeTokenSelector,
5
+ chainSelector,
6
+ envSelector,
7
+ makeTokenSelector,
8
8
  } from '../stories/arg-types';
9
9
  import { Button } from '../stories/components/Button';
10
10
  import { CodeBlock } from '../stories/components/CodeBlock';
@@ -69,20 +69,20 @@ interface StoryViewProps {
69
69
 
70
70
  /**
71
71
  * Get token contract information with the appropriate ABI.
72
- *
72
+ *
73
73
  * This function returns the contract address, ABI, and chain ID for a token.
74
74
  * It automatically selects the correct ABI based on whether the contract has
75
75
  * been upgraded to the new version.
76
- *
76
+ *
77
77
  * **Address Kinds:**
78
78
  * - `Token`: The token contract address (default)
79
79
  * - `Adapter`: The bridge adapter address (for BTCb on Avalanche)
80
- *
80
+ *
81
81
  * **Use Cases:**
82
82
  * - Prepare contract calls with the correct ABI
83
83
  * - Get bridge adapter addresses for cross-chain operations
84
84
  * - Verify contract addresses before transactions
85
- *
85
+ *
86
86
  * **Contract Upgrades:**
87
87
  * - LBTC: May use either LBTC_ABI or STLBTC_ABI
88
88
  * - BTCK: May use either BTCK_ABI or NATIVE_LBTC_ABI
@@ -109,8 +109,8 @@ export function StoryView(props: StoryViewProps) {
109
109
  <div className="mb-3">
110
110
  <h3>Token Contract Information</h3>
111
111
  <p className="text-muted">
112
- Retrieves contract address, ABI, and chain ID. Supports both token
113
- and adapter addresses for bridge operations.
112
+ Retrieves contract address, ABI, and chain ID. Supports both token and
113
+ adapter addresses for bridge operations.
114
114
  </p>
115
115
  </div>
116
116
 
@@ -145,4 +145,3 @@ export function StoryView(props: StoryViewProps) {
145
145
  </div>
146
146
  );
147
147
  }
148
-
@@ -60,20 +60,20 @@ interface StoryViewProps {
60
60
 
61
61
  /**
62
62
  * Check if a token contract has been upgraded to the new version.
63
- *
63
+ *
64
64
  * Lombard token contracts can be upgraded to new versions with additional
65
65
  * functionality. This function checks if a contract has the `getAssetRouter`
66
66
  * function, which indicates it's using the upgraded version.
67
- *
67
+ *
68
68
  * **Supported Tokens:**
69
69
  * - `LBTC`: Checks for STLBTC_ABI (upgraded) vs LBTC_ABI (legacy)
70
70
  * - `BTCK`: Checks for NATIVE_LBTC_ABI (upgraded) vs BTCK_ABI (legacy)
71
- *
71
+ *
72
72
  * **Use Cases:**
73
73
  * - Determine which ABI to use for contract interactions
74
74
  * - Feature detection for upgraded contract functions
75
75
  * - Display upgrade status in UI
76
- *
76
+ *
77
77
  * **Returns:**
78
78
  * - `true`: Contract is upgraded (has getAssetRouter)
79
79
  * - `false`: Contract is legacy or doesn't support upgrades
@@ -121,4 +121,3 @@ export function StoryView(props: StoryViewProps) {
121
121
  </div>
122
122
  );
123
123
  }
124
-
@@ -1,5 +1,6 @@
1
1
  import { DEFAULT_ENV, Env } from '@lombard.finance/sdk-common';
2
2
  import { Address } from 'viem';
3
+
3
4
  import { ChainId } from '../common/chains';
4
5
  import { EVM_LBTC_ADDRESSES } from './token-addresses';
5
6
 
@@ -1,28 +1,29 @@
1
1
  import { DEFAULT_ENV, Env } from '@lombard.finance/sdk-common';
2
2
  import { Address } from 'viem';
3
+
3
4
  import {
4
5
  ChainId,
6
+ isSolanaChain,
7
+ isStarknetChainId,
8
+ isSuiChain,
9
+ isValidChain,
5
10
  SOLANA_DEVNET_CHAIN,
6
11
  SOLANA_MAINNET_CHAIN,
7
12
  SOLANA_TESTNET_CHAIN,
13
+ SolanaChain,
8
14
  STARKNET_MAINNET_CHAIN,
9
15
  STARKNET_SEPOLIA_CHAIN,
16
+ StarknetChainId,
10
17
  SUI_MAINNET_CHAIN,
11
18
  SUI_TESTNET_CHAIN,
12
- SolanaChain,
13
- StarknetChainId,
14
19
  SuiChain,
15
- isSolanaChain,
16
- isStarknetChainId,
17
- isSuiChain,
18
- isValidChain,
19
20
  } from '../common/chains';
20
21
  import { featureConfig } from '../common/feature-config';
21
22
  import { AddressKind, BridgeTokenAddresses } from './types';
22
23
 
23
24
  // Re-export for backward compatibility
24
- export { AddressKind } from './types';
25
25
  export type { BridgeTokenAddresses } from './types';
26
+ export { AddressKind } from './types';
26
27
 
27
28
  export enum Token {
28
29
  // Lombard tokens:
@@ -111,32 +112,41 @@ type TokenAddresses<
111
112
  const EVM_BTCB_ADDRESSES: TokenAddressesPerEnv<Token.BTCb, ChainId> = {
112
113
  [Env.prod]: {
113
114
  [ChainId.katana]: '0xB0F70C0bD6FD87dbEb7C10dC692a2a6106817072',
114
- ...(featureConfig.isAvalancheEnabled ? {
115
- [ChainId.avalanche]: {
116
- token: '0x152b9d0FdC40C096757F570A51E494bd4b943E50',
117
- adapter: '0x85D1D52e11290F174444d21C2a167bEDBE36e4d2',
118
- },
119
- } : {}),
120
- ...(featureConfig.isMonadEnabled ? {
121
- [ChainId.monad]: '0xB0F70C0bD6FD87dbEb7C10dC692a2a6106817072',
122
- } : {}),
115
+ ...(featureConfig.isAvalancheEnabled
116
+ ? {
117
+ [ChainId.avalanche]: {
118
+ token: '0x152b9d0FdC40C096757F570A51E494bd4b943E50',
119
+ adapter: '0x85D1D52e11290F174444d21C2a167bEDBE36e4d2',
120
+ },
121
+ }
122
+ : {}),
123
+ ...(featureConfig.isMonadEnabled
124
+ ? {
125
+ [ChainId.monad]: '0xB0F70C0bD6FD87dbEb7C10dC692a2a6106817072',
126
+ }
127
+ : {}),
123
128
  [ChainId.megaeth]: '0xB0F70C0bD6FD87dbEb7C10dC692a2a6106817072',
129
+ [ChainId.stable]: '0xB0F70C0bD6FD87dbEb7C10dC692a2a6106817072',
124
130
  },
125
131
  [Env.ibc]: {
126
- ...(featureConfig.isAvalancheEnabled ? {
127
- [ChainId.avalancheFuji]: {
128
- adapter: '0x1391f9AC408cf13214DDB71d359002658eaF9ebb',
129
- token: '0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02',
130
- },
131
- } : {}),
132
+ ...(featureConfig.isAvalancheEnabled
133
+ ? {
134
+ [ChainId.avalancheFuji]: {
135
+ adapter: '0x1391f9AC408cf13214DDB71d359002658eaF9ebb',
136
+ token: '0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02',
137
+ },
138
+ }
139
+ : {}),
132
140
  },
133
141
  [Env.dev]: {
134
- ...(featureConfig.isAvalancheEnabled ? {
135
- [ChainId.avalancheFuji]: {
136
- adapter: '0x0A65C37d07c32E5eA8ea40495b7f249cdE26935e',
137
- token: '0x7FbdC44BfEBDe80C970ba622B678daB36cee31f6',
138
- },
139
- } : {}),
142
+ ...(featureConfig.isAvalancheEnabled
143
+ ? {
144
+ [ChainId.avalancheFuji]: {
145
+ adapter: '0x0A65C37d07c32E5eA8ea40495b7f249cdE26935e',
146
+ token: '0x7FbdC44BfEBDe80C970ba622B678daB36cee31f6',
147
+ },
148
+ }
149
+ : {}),
140
150
  [ChainId.binanceSmartChainTestnet]:
141
151
  '0xea3F66E5f2928dB9673103BfA01a2153A57a8050',
142
152
  [ChainId.sepolia]: '0x195219A262423d209E126BD21cf4F4F9AA796927',
@@ -147,12 +157,14 @@ const EVM_BTCB_ADDRESSES: TokenAddressesPerEnv<Token.BTCb, ChainId> = {
147
157
  [ChainId.katanaTatara]: '0x600e4006278EB11FA1691cA0FE6C5fcfC4992d58',
148
158
  },
149
159
  [Env.testnet]: {
150
- ...(featureConfig.isAvalancheEnabled ? {
151
- [ChainId.avalancheFuji]: {
152
- adapter: '0x41BCd71e7C92b1c8dDe53037F9b2c4AA2058b1cB',
153
- token: '0xB14f240714Bd23Bda103A7189D512A90326E4D01',
154
- },
155
- } : {}),
160
+ ...(featureConfig.isAvalancheEnabled
161
+ ? {
162
+ [ChainId.avalancheFuji]: {
163
+ adapter: '0x41BCd71e7C92b1c8dDe53037F9b2c4AA2058b1cB',
164
+ token: '0xB14f240714Bd23Bda103A7189D512A90326E4D01',
165
+ },
166
+ }
167
+ : {}),
156
168
  [ChainId.sepolia]: '0x20eA7b8ABb4B583788F1DFC738C709a2d9675681',
157
169
  [ChainId.katanaTatara]: '0x20eA7b8ABb4B583788F1DFC738C709a2d9675681',
158
170
  },
@@ -161,9 +173,11 @@ const EVM_BTCB_ADDRESSES: TokenAddressesPerEnv<Token.BTCb, ChainId> = {
161
173
  export const EVM_LBTC_ADDRESSES: TokenAddressesPerEnv<Token.LBTC, ChainId> = {
162
174
  [Env.prod]: {
163
175
  [ChainId.ethereum]: '0x8236a87084f8b84306f72007f36f2618a5634494',
164
- ...(featureConfig.isAvalancheEnabled ? {
165
- [ChainId.avalanche]: undefined,
166
- } : {}),
176
+ ...(featureConfig.isAvalancheEnabled
177
+ ? {
178
+ [ChainId.avalanche]: undefined,
179
+ }
180
+ : {}),
167
181
  [ChainId.base]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
168
182
  [ChainId.berachain]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
169
183
  [ChainId.binanceSmartChain]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
@@ -172,18 +186,23 @@ export const EVM_LBTC_ADDRESSES: TokenAddressesPerEnv<Token.LBTC, ChainId> = {
172
186
  [ChainId.katana]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
173
187
  [ChainId.morph]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
174
188
  [ChainId.sonic]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
189
+ [ChainId.stable]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
175
190
  [ChainId.swell]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
176
191
  [ChainId.tac]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
177
192
  [ChainId.bob]: '0xA45d4121b3D47719FF57a947A9d961539Ba33204',
178
- ...(featureConfig.isMonadEnabled ? {
179
- [ChainId.monad]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
180
- } : {}),
193
+ ...(featureConfig.isMonadEnabled
194
+ ? {
195
+ [ChainId.monad]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
196
+ }
197
+ : {}),
181
198
  [ChainId.megaeth]: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
182
199
  },
183
200
  [Env.stage]: {
184
- ...(featureConfig.isAvalancheEnabled ? {
185
- [ChainId.avalancheFuji]: undefined,
186
- } : {}),
201
+ ...(featureConfig.isAvalancheEnabled
202
+ ? {
203
+ [ChainId.avalancheFuji]: undefined,
204
+ }
205
+ : {}),
187
206
  [ChainId.baseSepoliaTestnet]: '0x731eFa688F3679688cf60A3993b8658138953ED6',
188
207
  [ChainId.berachainBartioTestnet]:
189
208
  '0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30',
@@ -195,9 +214,11 @@ export const EVM_LBTC_ADDRESSES: TokenAddressesPerEnv<Token.LBTC, ChainId> = {
195
214
  [ChainId.sonicBlazeTestnet]: '0x731eFa688F3679688cf60A3993b8658138953ED6',
196
215
  },
197
216
  [Env.testnet]: {
198
- ...(featureConfig.isAvalancheEnabled ? {
199
- [ChainId.avalancheFuji]: '0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5',
200
- } : {}),
217
+ ...(featureConfig.isAvalancheEnabled
218
+ ? {
219
+ [ChainId.avalancheFuji]: '0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5',
220
+ }
221
+ : {}),
201
222
  [ChainId.berachainBartioTestnet]:
202
223
  '0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30',
203
224
  [ChainId.binanceSmartChainTestnet]:
@@ -209,9 +230,11 @@ export const EVM_LBTC_ADDRESSES: TokenAddressesPerEnv<Token.LBTC, ChainId> = {
209
230
  [ChainId.baseSepoliaTestnet]: '0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5',
210
231
  },
211
232
  [Env.dev]: {
212
- ...(featureConfig.isAvalancheEnabled ? {
213
- [ChainId.avalancheFuji]: '0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30',
214
- } : {}),
233
+ ...(featureConfig.isAvalancheEnabled
234
+ ? {
235
+ [ChainId.avalancheFuji]: '0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30',
236
+ }
237
+ : {}),
215
238
  [ChainId.sepolia]: '0x93283b6B889C591893dB0dc93baD71656D5d8923',
216
239
  [ChainId.baseSepoliaTestnet]: '0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30',
217
240
  [ChainId.berachainBartioTestnet]:
@@ -1,15 +1,16 @@
1
1
  import { DEFAULT_ENV, Env } from '@lombard.finance/sdk-common';
2
2
  import BigNumber from 'bignumber.js';
3
3
  import { type Abi, Address, erc20Abi, PublicClient, zeroAddress } from 'viem';
4
- import { AddressKind, TOKEN_ADDRESSES, Token } from './token-addresses';
5
- import { LBTC_ABI } from './abi/LBTC_ABI';
4
+
5
+ import { makePublicClient } from '../clients/public-client';
6
+ import { ChainId } from '../common/chains';
6
7
  import { TokenContractAddressNotFoundError } from '../utils/err';
8
+ import BRIDGE_TOKEN_ADAPTER_ABI from './abi/BRIDGE_TOKEN_ADAPTER_ABI';
7
9
  import BTCK_ABI from './abi/BTCK_ABI';
8
- import STLBTC_ABI from './abi/STLBTC_ABI';
10
+ import { LBTC_ABI } from './abi/LBTC_ABI';
9
11
  import NATIVE_LBTC_ABI from './abi/NATIVE_LBTC_ABI';
10
- import { ChainId } from '../common/chains';
11
- import { makePublicClient } from '../clients/public-client';
12
- import BRIDGE_TOKEN_ADAPTER_ABI from './abi/BRIDGE_TOKEN_ADAPTER_ABI';
12
+ import STLBTC_ABI from './abi/STLBTC_ABI';
13
+ import { AddressKind, Token, TOKEN_ADDRESSES } from './token-addresses';
13
14
 
14
15
  export type TokenInfo = {
15
16
  address: Address;
@@ -50,7 +51,7 @@ export async function isUpgradedContract(
50
51
  functionName: UPGRADED_CONTRACT_POINTER,
51
52
  });
52
53
  return assetRouter !== zeroAddress;
53
- } catch (_err) {
54
+ } catch {
54
55
  return false;
55
56
  }
56
57
  }
@@ -1,4 +1,5 @@
1
1
  import axios from 'axios';
2
+
2
3
  import { ChainId, getLlamaChainName } from '../common/chains';
3
4
 
4
5
  type Response = {
package/src/utils/env.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Env } from '@lombard.finance/sdk-common';
2
+
2
3
  import { ChainId } from '../common/chains';
3
4
 
4
5
  const PROD_NATIVE_MINT_CHAINS = [
package/src/utils/err.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import { Env } from '@lombard.finance/sdk-common';
1
2
  import { AxiosError } from 'axios';
2
- import { Token } from '../tokens/token-addresses';
3
+
3
4
  import { ChainId } from '../common/chains';
4
- import { Env } from '@lombard.finance/sdk-common';
5
+ import { Token } from '../tokens/token-addresses';
5
6
 
6
7
  /**
7
8
  * Retrieves the error message from the given error object.