@lifi/data-types 6.69.0 → 6.70.0-alpha.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 (40) hide show
  1. package/package.json +2 -2
  2. package/src/_cjs/chains/foundry.js +1 -0
  3. package/src/_cjs/chains/foundry.js.map +1 -1
  4. package/src/_cjs/chains/index.js +3 -1
  5. package/src/_cjs/chains/index.js.map +1 -1
  6. package/src/_cjs/chains/supportedChains.js +2 -0
  7. package/src/_cjs/chains/supportedChains.js.map +1 -1
  8. package/src/_cjs/chains/supportedChains.stl.int.spec.js +48 -0
  9. package/src/_cjs/chains/supportedChains.stl.int.spec.js.map +1 -0
  10. package/src/_cjs/chains/supportedChains.stl.js +35 -0
  11. package/src/_cjs/chains/supportedChains.stl.js.map +1 -0
  12. package/src/_cjs/coins/coins.js +12 -0
  13. package/src/_cjs/coins/coins.js.map +1 -1
  14. package/src/_esm/chains/foundry.js +1 -0
  15. package/src/_esm/chains/foundry.js.map +1 -1
  16. package/src/_esm/chains/index.js +1 -0
  17. package/src/_esm/chains/index.js.map +1 -1
  18. package/src/_esm/chains/supportedChains.js +2 -0
  19. package/src/_esm/chains/supportedChains.js.map +1 -1
  20. package/src/_esm/chains/supportedChains.stl.int.spec.js +46 -0
  21. package/src/_esm/chains/supportedChains.stl.int.spec.js.map +1 -0
  22. package/src/_esm/chains/supportedChains.stl.js +32 -0
  23. package/src/_esm/chains/supportedChains.stl.js.map +1 -0
  24. package/src/_esm/coins/coins.js +13 -0
  25. package/src/_esm/coins/coins.js.map +1 -1
  26. package/src/_types/chains/foundry.d.ts.map +1 -1
  27. package/src/_types/chains/index.d.ts +1 -0
  28. package/src/_types/chains/index.d.ts.map +1 -1
  29. package/src/_types/chains/supportedChains.d.ts.map +1 -1
  30. package/src/_types/chains/supportedChains.stl.d.ts +3 -0
  31. package/src/_types/chains/supportedChains.stl.d.ts.map +1 -0
  32. package/src/_types/chains/supportedChains.stl.int.spec.d.ts +2 -0
  33. package/src/_types/chains/supportedChains.stl.int.spec.d.ts.map +1 -0
  34. package/src/_types/coins/coins.d.ts.map +1 -1
  35. package/src/chains/foundry.ts +1 -0
  36. package/src/chains/index.ts +1 -0
  37. package/src/chains/supportedChains.stl.int.spec.ts +58 -0
  38. package/src/chains/supportedChains.stl.ts +34 -0
  39. package/src/chains/supportedChains.ts +2 -0
  40. package/src/coins/coins.ts +14 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=supportedChains.stl.int.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supportedChains.stl.int.spec.d.ts","sourceRoot":"","sources":["../../chains/supportedChains.stl.int.spec.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"coins.d.ts","sourceRoot":"","sources":["../../coins/coins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAE3E,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;KAC1B,CAAA;CACF,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,SAAS,EAs6GjC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,IAAI,CAsBnC,CAAA;AAGF,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAA;CAkyB3D,CA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qB,GAAI,SAAS,OAAO,KAAG,WAMxD,CAAA;AAED,eAAO,MAAM,4BAA4B,GACvC,SAAS,MAAM,EACf,cAAc,MAAM,KACnB,WAAW,GAAG,IAUhB,CAAA"}
@@ -96,4 +96,5 @@ export const foundryChainNameMap: Record<ChainId, string> = {
96
96
  [ChainId.LTC]: 'litecoin',
97
97
  [ChainId.DGE]: 'dogecoin',
98
98
  [ChainId.ZEC]: 'zcash',
99
+ [ChainId.XLM]: 'stellar',
99
100
  }
@@ -3,6 +3,7 @@ export * from './supportedChains.js'
3
3
  export { supportedMVMChains } from './supportedChains.mvm.js'
4
4
  export { supportedSVMChains } from './supportedChains.svm.js'
5
5
  export { supportedTVMChains } from './supportedChains.tvm.js'
6
+ export { supportedSTLChains } from './supportedChains.stl.js'
6
7
  export { supportedUXTOChains } from './supportedChains.utxo.js'
7
8
  export { foundryChainNameMap } from './foundry.js'
8
9
  export * from './utils.js'
@@ -0,0 +1,58 @@
1
+ import { describe, expect, test } from 'vitest'
2
+ import { supportedSTLChains } from './supportedChains.stl.js'
3
+
4
+ const TestTransactionHash =
5
+ 'b9d0b229812a7e729b5ea43cb8218786e2c5e6f4e80be59e86a36c7eff4a03c4'
6
+
7
+ describe.concurrent('STL chains RPC check', () => {
8
+ const rpcUrls = supportedSTLChains.flatMap((chain) =>
9
+ chain.metamask.rpcUrls.map((rpcUrl) => ({
10
+ rpcUrl: rpcUrl,
11
+ chainId: chain.id,
12
+ chainName: chain.name,
13
+ }))
14
+ )
15
+
16
+ test.for(rpcUrls)(
17
+ `should successfully get chain ID from $chainName - $chainId RPC: $rpcUrl`,
18
+ { timeout: 10_000, retry: 3 },
19
+ async ({ rpcUrl }) => {
20
+ const [latestLedger, transaction] = await Promise.allSettled([
21
+ fetch(rpcUrl, {
22
+ method: 'POST',
23
+ headers: { 'Content-Type': 'application/json' },
24
+ body: JSON.stringify({
25
+ jsonrpc: '2.0',
26
+ id: 1,
27
+ method: 'getLatestLedger',
28
+ }),
29
+ }),
30
+ fetch(rpcUrl, {
31
+ method: 'POST',
32
+ headers: { 'Content-Type': 'application/json' },
33
+ body: JSON.stringify({
34
+ jsonrpc: '2.0',
35
+ id: 2,
36
+ method: 'getTransaction',
37
+ params: { hash: TestTransactionHash },
38
+ }),
39
+ }),
40
+ ])
41
+
42
+ expect(latestLedger.status).toBe('fulfilled')
43
+ expect(transaction.status).toBe('fulfilled')
44
+
45
+ if (latestLedger.status === 'fulfilled') {
46
+ expect(latestLedger.value.ok).toBe(true)
47
+ const data = await latestLedger.value.json()
48
+ expect(data.result).toBeDefined()
49
+ expect(data.result.sequence).toBeGreaterThan(0)
50
+ expect(data.result.protocolVersion).toBeGreaterThan(0)
51
+ }
52
+
53
+ if (transaction.status === 'fulfilled') {
54
+ expect(transaction.value.ok).toBe(true)
55
+ }
56
+ }
57
+ )
58
+ })
@@ -0,0 +1,34 @@
1
+ import type { STLChain } from '@lifi/types'
2
+ import { ChainId, ChainKey, ChainType, CoinKey } from '@lifi/types'
3
+
4
+ export const supportedSTLChains: STLChain[] = [
5
+ {
6
+ key: ChainKey.XLM,
7
+ chainType: ChainType.STL,
8
+ name: 'Stellar',
9
+ coin: CoinKey.XLM,
10
+ id: ChainId.XLM,
11
+ mainnet: true,
12
+ logoURI:
13
+ 'https://lifinance.github.io/types/src/assets/icons/chains/stellar.svg',
14
+ faucetUrls: [],
15
+ metamask: {
16
+ chainId: ChainId.XLM.toString(),
17
+ blockExplorerUrls: [
18
+ 'https://stellarchain.io/',
19
+ 'https://stellarscan.io/',
20
+ ],
21
+ chainName: 'Stellar',
22
+ nativeCurrency: {
23
+ name: 'Stellar',
24
+ symbol: 'XLM',
25
+ decimals: 7,
26
+ },
27
+ rpcUrls: [
28
+ 'https://soroban-rpc.mainnet.stellar.gateway.fm',
29
+ 'https://mainnet.sorobanrpc.com',
30
+ 'https://stellar-soroban-public.nodies.app',
31
+ ],
32
+ },
33
+ },
34
+ ]
@@ -4,6 +4,7 @@ import { supportedMVMChains } from './supportedChains.mvm.js'
4
4
  import { supportedSVMChains } from './supportedChains.svm.js'
5
5
  import { supportedUXTOChains } from './supportedChains.utxo.js'
6
6
  import { supportedTVMChains } from './supportedChains.tvm.js'
7
+ import { supportedSTLChains } from './supportedChains.stl.js'
7
8
 
8
9
  // This assignment is required to avoid breaking
9
10
  // changes with the new non EVM support types release
@@ -14,6 +15,7 @@ export const supportedChains = [
14
15
  ...supportedMVMChains,
15
16
  ...supportedUXTOChains,
16
17
  ...supportedTVMChains,
18
+ ...supportedSTLChains,
17
19
  ]
18
20
 
19
21
  export const getChainByKey = (chainKey: ChainKey): Chain => {
@@ -627,6 +627,20 @@ export const basicCoins: BasicCoin[] = [
627
627
  },
628
628
  },
629
629
  },
630
+ // > XLM
631
+ {
632
+ key: CoinKey.XLM,
633
+ name: CoinKey.XLM,
634
+ logoURI:
635
+ 'https://lifinance.github.io/types/src/assets/icons/chains/stellar.svg',
636
+ verified: true,
637
+ chains: {
638
+ [ChainId.XLM]: {
639
+ address: 'lumen',
640
+ decimals: 7,
641
+ },
642
+ },
643
+ },
630
644
  // > Fogo
631
645
  {
632
646
  key: CoinKey.FOGO,