@lifi/data-types 6.33.0 → 6.35.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/package.json +2 -2
- package/src/_cjs/chains/index.js +3 -1
- package/src/_cjs/chains/index.js.map +1 -1
- package/src/_cjs/chains/supportedChains.evm.js +2 -5
- package/src/_cjs/chains/supportedChains.evm.js.map +1 -1
- package/src/_cjs/chains/supportedChains.js +2 -0
- package/src/_cjs/chains/supportedChains.js.map +1 -1
- package/src/_cjs/chains/supportedChains.tvm.int.spec.js +38 -0
- package/src/_cjs/chains/supportedChains.tvm.int.spec.js.map +1 -0
- package/src/_cjs/chains/supportedChains.tvm.js +28 -0
- package/src/_cjs/chains/supportedChains.tvm.js.map +1 -0
- package/src/_cjs/coins/coins.js +35 -5
- package/src/_cjs/coins/coins.js.map +1 -1
- package/src/_cjs/multicall.js.map +1 -1
- package/src/_esm/chains/index.js +1 -0
- package/src/_esm/chains/index.js.map +1 -1
- package/src/_esm/chains/supportedChains.evm.js +2 -5
- package/src/_esm/chains/supportedChains.evm.js.map +1 -1
- package/src/_esm/chains/supportedChains.js +2 -0
- package/src/_esm/chains/supportedChains.js.map +1 -1
- package/src/_esm/chains/supportedChains.tvm.int.spec.js +36 -0
- package/src/_esm/chains/supportedChains.tvm.int.spec.js.map +1 -0
- package/src/_esm/chains/supportedChains.tvm.js +25 -0
- package/src/_esm/chains/supportedChains.tvm.js.map +1 -0
- package/src/_esm/coins/coins.js +37 -6
- package/src/_esm/coins/coins.js.map +1 -1
- package/src/_esm/multicall.js +1 -0
- package/src/_esm/multicall.js.map +1 -1
- package/src/_types/chains/index.d.ts +1 -0
- package/src/_types/chains/index.d.ts.map +1 -1
- package/src/_types/chains/supportedChains.d.ts.map +1 -1
- package/src/_types/chains/supportedChains.evm.d.ts.map +1 -1
- package/src/_types/chains/supportedChains.tvm.d.ts +3 -0
- package/src/_types/chains/supportedChains.tvm.d.ts.map +1 -0
- package/src/_types/chains/supportedChains.tvm.int.spec.d.ts +2 -0
- package/src/_types/chains/supportedChains.tvm.int.spec.d.ts.map +1 -0
- package/src/_types/coins/coins.d.ts.map +1 -1
- package/src/_types/multicall.d.ts.map +1 -1
- package/src/chains/index.ts +1 -0
- package/src/chains/supportedChains.evm.ts +2 -5
- package/src/chains/supportedChains.ts +2 -0
- package/src/chains/supportedChains.tvm.int.spec.ts +49 -0
- package/src/chains/supportedChains.tvm.ts +27 -0
- package/src/coins/coins.ts +39 -6
- package/src/multicall.ts +1 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import { supportedTVMChains } from './supportedChains.tvm'
|
|
3
|
+
import { TronWeb } from 'tronweb'
|
|
4
|
+
|
|
5
|
+
const WalletAddress = 'TJRabPrwbZy45sbavfcjinPJC18kjpRTv8'
|
|
6
|
+
const TestContractAddress = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'
|
|
7
|
+
|
|
8
|
+
describe.concurrent('TVM chains RPC check', () => {
|
|
9
|
+
const rpcUrls = supportedTVMChains.flatMap((chain) =>
|
|
10
|
+
chain.metamask.rpcUrls.map((rpcUrl) => ({
|
|
11
|
+
rpcUrl: rpcUrl,
|
|
12
|
+
chainId: chain.id,
|
|
13
|
+
chainName: chain.name,
|
|
14
|
+
}))
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
test.for(rpcUrls)(
|
|
18
|
+
`should successfully get chain ID from $chainName - $chainId RPC: $rpcUrl`,
|
|
19
|
+
{ timeout: 10_000, retry: 3 },
|
|
20
|
+
async ({ rpcUrl }) => {
|
|
21
|
+
const tronWeb = new TronWeb({
|
|
22
|
+
fullHost: rpcUrl,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const [blockNumber, chainId, accountInfo, contractInfo] =
|
|
26
|
+
await Promise.allSettled([
|
|
27
|
+
tronWeb.trx.getCurrentBlock(),
|
|
28
|
+
tronWeb.trx.getChainParameters(),
|
|
29
|
+
tronWeb.trx.getAccount(WalletAddress),
|
|
30
|
+
tronWeb.trx.getContract(TestContractAddress),
|
|
31
|
+
])
|
|
32
|
+
|
|
33
|
+
expect(blockNumber.status).toBe('fulfilled')
|
|
34
|
+
expect(chainId.status).toBe('fulfilled')
|
|
35
|
+
expect(accountInfo.status).toBe('fulfilled')
|
|
36
|
+
expect(contractInfo.status).toBe('fulfilled')
|
|
37
|
+
|
|
38
|
+
if (blockNumber.status === 'fulfilled') {
|
|
39
|
+
expect(blockNumber.value).toBeDefined()
|
|
40
|
+
expect(typeof blockNumber.value.block_header).toBe('object')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (chainId.status === 'fulfilled') {
|
|
44
|
+
expect(chainId.value).toBeDefined()
|
|
45
|
+
expect(Array.isArray(chainId.value)).toBe(true)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TVMChain } from '@lifi/types'
|
|
2
|
+
import { ChainId, ChainKey, ChainType, CoinKey } from '@lifi/types'
|
|
3
|
+
|
|
4
|
+
export const supportedTVMChains: TVMChain[] = [
|
|
5
|
+
{
|
|
6
|
+
key: ChainKey.TRN,
|
|
7
|
+
chainType: ChainType.TVM,
|
|
8
|
+
name: 'Tron',
|
|
9
|
+
coin: CoinKey.TRX,
|
|
10
|
+
id: ChainId.TRN,
|
|
11
|
+
mainnet: true,
|
|
12
|
+
logoURI:
|
|
13
|
+
'https://lifinance.github.io/types/src/assets/icons/chains/tron.svg',
|
|
14
|
+
faucetUrls: [],
|
|
15
|
+
metamask: {
|
|
16
|
+
chainId: ChainId.TRN.toString(),
|
|
17
|
+
blockExplorerUrls: ['https://tronscan.org/'],
|
|
18
|
+
chainName: 'Tron',
|
|
19
|
+
nativeCurrency: {
|
|
20
|
+
name: 'Tron',
|
|
21
|
+
symbol: 'TRX',
|
|
22
|
+
decimals: 6,
|
|
23
|
+
},
|
|
24
|
+
rpcUrls: ['https://tron-rpc.publicnode.com'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
]
|
package/src/coins/coins.ts
CHANGED
|
@@ -585,6 +585,20 @@ export const basicCoins: BasicCoin[] = [
|
|
|
585
585
|
},
|
|
586
586
|
},
|
|
587
587
|
},
|
|
588
|
+
// > TRX
|
|
589
|
+
{
|
|
590
|
+
key: CoinKey.TRX,
|
|
591
|
+
name: CoinKey.TRX,
|
|
592
|
+
logoURI:
|
|
593
|
+
'https://lifinance.github.io/types/src/assets/icons/chains/tron.svg',
|
|
594
|
+
verified: true,
|
|
595
|
+
chains: {
|
|
596
|
+
[ChainId.TRN]: {
|
|
597
|
+
address: 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb', // Tron system contract / burn address
|
|
598
|
+
decimals: 6,
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
},
|
|
588
602
|
|
|
589
603
|
// OTHER STABLECOINS
|
|
590
604
|
// USDT
|
|
@@ -812,6 +826,10 @@ export const basicCoins: BasicCoin[] = [
|
|
|
812
826
|
address: '0x6386dA73545ae4E2B2E0393688fA8B65Bb9a7169',
|
|
813
827
|
decimals: 6,
|
|
814
828
|
},
|
|
829
|
+
[ChainId.TRN]: {
|
|
830
|
+
address: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
|
|
831
|
+
decimals: 6,
|
|
832
|
+
},
|
|
815
833
|
},
|
|
816
834
|
},
|
|
817
835
|
|
|
@@ -993,6 +1011,11 @@ export const basicCoins: BasicCoin[] = [
|
|
|
993
1011
|
address: '0x9Aa0F72392B5784Ad86c6f3E899bCc053D00Db4F',
|
|
994
1012
|
decimals: 6,
|
|
995
1013
|
},
|
|
1014
|
+
[ChainId.TRN]: {
|
|
1015
|
+
address: 'TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8',
|
|
1016
|
+
decimals: 6,
|
|
1017
|
+
name: 'USDC',
|
|
1018
|
+
},
|
|
996
1019
|
},
|
|
997
1020
|
},
|
|
998
1021
|
// USDC.e
|
|
@@ -2306,10 +2329,10 @@ export const basicCoins: BasicCoin[] = [
|
|
|
2306
2329
|
},
|
|
2307
2330
|
},
|
|
2308
2331
|
},
|
|
2309
|
-
//
|
|
2332
|
+
// KAIA
|
|
2310
2333
|
{
|
|
2311
|
-
key: CoinKey.
|
|
2312
|
-
name: CoinKey.
|
|
2334
|
+
key: CoinKey.KAIA,
|
|
2335
|
+
name: CoinKey.KAIA,
|
|
2313
2336
|
logoURI:
|
|
2314
2337
|
'https://static.debank.com/image/chain/logo_url/klay/4182ee077031d843a57e42746c30c072.png',
|
|
2315
2338
|
verified: true,
|
|
@@ -3223,11 +3246,11 @@ export const wrappedTokens: { [ChainId: string]: StaticToken } = {
|
|
|
3223
3246
|
[ChainId.KAI]: {
|
|
3224
3247
|
// https://kaiascan.io/token/0x19aac5f612f524b754ca7e7c41cbfa2e981a4432
|
|
3225
3248
|
address: '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432',
|
|
3226
|
-
symbol: '
|
|
3249
|
+
symbol: 'WKAIA',
|
|
3227
3250
|
decimals: 18,
|
|
3228
3251
|
chainId: ChainId.KAI,
|
|
3229
|
-
coinKey: CoinKey.
|
|
3230
|
-
name: 'Wrapped
|
|
3252
|
+
coinKey: CoinKey.WKAIA,
|
|
3253
|
+
name: 'Wrapped KAIA',
|
|
3231
3254
|
logoURI:
|
|
3232
3255
|
'https://static.debank.com/image/chain/logo_url/klay/4182ee077031d843a57e42746c30c072.png',
|
|
3233
3256
|
},
|
|
@@ -3520,6 +3543,16 @@ export const wrappedTokens: { [ChainId: string]: StaticToken } = {
|
|
|
3520
3543
|
logoURI:
|
|
3521
3544
|
'https://static.debank.com/image/sophon_token/logo_url/0x2b1a859de6a55c553520d7780bc5805712b128f9/b81ad042ee3060050e01af4ce4ff9217.png',
|
|
3522
3545
|
},
|
|
3546
|
+
[ChainId.TRN]: {
|
|
3547
|
+
address: 'TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR',
|
|
3548
|
+
name: 'Wrapped TRX',
|
|
3549
|
+
symbol: CoinKey.WTRX,
|
|
3550
|
+
coinKey: CoinKey.WTRX,
|
|
3551
|
+
chainId: ChainId.TRN,
|
|
3552
|
+
decimals: 6,
|
|
3553
|
+
logoURI:
|
|
3554
|
+
'https://lifinance.github.io/types/src/assets/icons/chains/tron.svg',
|
|
3555
|
+
},
|
|
3523
3556
|
}
|
|
3524
3557
|
export const findDefaultCoin = (coinKey: CoinKey): Coin => {
|
|
3525
3558
|
const coin = defaultCoins.find((coin) => coin.key === coinKey)
|