@shapeshiftoss/utils 1.0.3-alpha.1 → 1.0.4
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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/assetData/baseAssets.d.ts +3 -0
- package/dist/cjs/assetData/baseAssets.js +47 -1
- package/dist/cjs/assetData/getBaseAsset.js +6 -0
- package/dist/cjs/chainIdToFeeAssetId.js +6 -0
- package/dist/cjs/getAssetNamespaceFromChainId.js +4 -0
- package/dist/cjs/getChainShortName.d.ts +1 -1
- package/dist/cjs/getChainShortName.js +6 -0
- package/dist/cjs/getNativeFeeAssetReference.js +16 -0
- package/dist/cjs/index.js +2 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/assetData/baseAssets.d.ts +3 -0
- package/dist/esm/assetData/baseAssets.js +46 -0
- package/dist/esm/assetData/getBaseAsset.js +7 -1
- package/dist/esm/chainIdToFeeAssetId.js +7 -1
- package/dist/esm/getAssetNamespaceFromChainId.js +4 -0
- package/dist/esm/getChainShortName.d.ts +1 -1
- package/dist/esm/getChainShortName.js +6 -0
- package/dist/esm/getNativeFeeAssetReference.js +16 -0
- package/dist/esm/index.js +2 -0
- package/package.json +6 -3
|
@@ -18,4 +18,7 @@ export declare const gnosis: Readonly<Asset>;
|
|
|
18
18
|
export declare const arbitrum: Readonly<Asset>;
|
|
19
19
|
export declare const arbitrumNova: Readonly<Asset>;
|
|
20
20
|
export declare const base: Readonly<Asset>;
|
|
21
|
+
export declare const monad: Readonly<Asset>;
|
|
21
22
|
export declare const solana: Readonly<Asset>;
|
|
23
|
+
export declare const tron: Readonly<Asset>;
|
|
24
|
+
export declare const sui: Readonly<Asset>;
|
|
@@ -276,6 +276,22 @@ export const base = Object.freeze({
|
|
|
276
276
|
explorerTxLink: 'https://basescan.org/tx/',
|
|
277
277
|
relatedAssetKey: 'eip155:1/slip44:60',
|
|
278
278
|
});
|
|
279
|
+
export const monad = Object.freeze({
|
|
280
|
+
assetId: caip.monadAssetId,
|
|
281
|
+
chainId: caip.monadChainId,
|
|
282
|
+
name: 'Monad',
|
|
283
|
+
networkName: 'Monad',
|
|
284
|
+
symbol: 'MON',
|
|
285
|
+
precision: 18,
|
|
286
|
+
color: '#3B82F6',
|
|
287
|
+
networkColor: '#3B82F6',
|
|
288
|
+
icon: 'https://assets.coingecko.com/coins/images/38927/standard/monad.png?1764042736',
|
|
289
|
+
networkIcon: 'https://assets.coingecko.com/coins/images/38927/standard/monad.png?1764042736',
|
|
290
|
+
explorer: 'https://monadvision.com',
|
|
291
|
+
explorerAddressLink: 'https://monadvision.com/address/',
|
|
292
|
+
explorerTxLink: 'https://monadvision.com/tx/',
|
|
293
|
+
relatedAssetKey: null,
|
|
294
|
+
});
|
|
279
295
|
export const solana = Object.freeze({
|
|
280
296
|
assetId: caip.solAssetId,
|
|
281
297
|
chainId: caip.solanaChainId,
|
|
@@ -291,3 +307,33 @@ export const solana = Object.freeze({
|
|
|
291
307
|
explorerTxLink: 'https://explorer.solana.com/tx/',
|
|
292
308
|
relatedAssetKey: null,
|
|
293
309
|
});
|
|
310
|
+
export const tron = Object.freeze({
|
|
311
|
+
assetId: caip.tronAssetId,
|
|
312
|
+
chainId: caip.tronChainId,
|
|
313
|
+
name: 'Tron',
|
|
314
|
+
networkName: 'Tron',
|
|
315
|
+
symbol: 'TRX',
|
|
316
|
+
precision: 6,
|
|
317
|
+
color: '#FF0013',
|
|
318
|
+
networkColor: '#FF0013',
|
|
319
|
+
icon: 'https://rawcdn.githack.com/trustwallet/assets/b7a5f12d893fcf58e0eb1dd64478f076857b720b/blockchains/tron/info/logo.png',
|
|
320
|
+
explorer: 'https://tronscan.org',
|
|
321
|
+
explorerAddressLink: 'https://tronscan.org/#/address/',
|
|
322
|
+
explorerTxLink: 'https://tronscan.org/#/transaction/',
|
|
323
|
+
relatedAssetKey: null,
|
|
324
|
+
});
|
|
325
|
+
export const sui = Object.freeze({
|
|
326
|
+
assetId: caip.suiAssetId,
|
|
327
|
+
chainId: caip.suiChainId,
|
|
328
|
+
name: 'Sui',
|
|
329
|
+
networkName: 'Sui',
|
|
330
|
+
symbol: 'SUI',
|
|
331
|
+
precision: 9,
|
|
332
|
+
color: '#6fbcf0',
|
|
333
|
+
networkColor: '#6fbcf0',
|
|
334
|
+
icon: 'https://assets.coingecko.com/coins/images/26375/large/sui_asset.jpeg?1727791290',
|
|
335
|
+
explorer: 'https://suiscan.xyz/mainnet',
|
|
336
|
+
explorerAddressLink: 'https://suiscan.xyz/mainnet/account/',
|
|
337
|
+
explorerTxLink: 'https://suiscan.xyz/mainnet/tx/',
|
|
338
|
+
relatedAssetKey: null,
|
|
339
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KnownChainIds } from '@shapeshiftoss/types';
|
|
2
2
|
import { assertUnreachable } from '../assertUnreachable.js';
|
|
3
|
-
import { arbitrum, arbitrumNova, atom, avax, base, bitcoin, bitcoincash, bnbsmartchain, dogecoin, ethereum, gnosis, litecoin, mayachain, optimism, polygon, solana, thorchain, } from './baseAssets.js';
|
|
3
|
+
import { arbitrum, arbitrumNova, atom, avax, base, bitcoin, bitcoincash, bnbsmartchain, dogecoin, ethereum, gnosis, litecoin, mayachain, monad, optimism, polygon, solana, sui, thorchain, tron, } from './baseAssets.js';
|
|
4
4
|
export const getBaseAsset = (chainId) => {
|
|
5
5
|
const knownChainId = chainId;
|
|
6
6
|
switch (knownChainId) {
|
|
@@ -24,6 +24,8 @@ export const getBaseAsset = (chainId) => {
|
|
|
24
24
|
return base;
|
|
25
25
|
case KnownChainIds.SolanaMainnet:
|
|
26
26
|
return solana;
|
|
27
|
+
case KnownChainIds.SuiMainnet:
|
|
28
|
+
return sui;
|
|
27
29
|
case KnownChainIds.BitcoinMainnet:
|
|
28
30
|
return bitcoin;
|
|
29
31
|
case KnownChainIds.BitcoinCashMainnet:
|
|
@@ -38,6 +40,10 @@ export const getBaseAsset = (chainId) => {
|
|
|
38
40
|
return thorchain;
|
|
39
41
|
case KnownChainIds.MayachainMainnet:
|
|
40
42
|
return mayachain;
|
|
43
|
+
case KnownChainIds.TronMainnet:
|
|
44
|
+
return tron;
|
|
45
|
+
case KnownChainIds.MonadMainnet:
|
|
46
|
+
return monad;
|
|
41
47
|
default:
|
|
42
48
|
return assertUnreachable(knownChainId);
|
|
43
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arbitrumAssetId, arbitrumNovaAssetId, avalancheAssetId, baseAssetId, bchAssetId, bscAssetId, btcAssetId, cosmosAssetId, dogeAssetId, ethAssetId, gnosisAssetId, ltcAssetId, mayachainAssetId, optimismAssetId, polygonAssetId, solAssetId, thorchainAssetId, } from '@shapeshiftoss/caip';
|
|
1
|
+
import { arbitrumAssetId, arbitrumNovaAssetId, avalancheAssetId, baseAssetId, bchAssetId, bscAssetId, btcAssetId, cosmosAssetId, dogeAssetId, ethAssetId, gnosisAssetId, ltcAssetId, mayachainAssetId, monadAssetId, optimismAssetId, polygonAssetId, solAssetId, suiAssetId, thorchainAssetId, tronAssetId, } from '@shapeshiftoss/caip';
|
|
2
2
|
import { KnownChainIds } from '@shapeshiftoss/types';
|
|
3
3
|
import { assertUnreachable } from './assertUnreachable.js';
|
|
4
4
|
export const chainIdToFeeAssetId = (_chainId) => {
|
|
@@ -38,6 +38,12 @@ export const chainIdToFeeAssetId = (_chainId) => {
|
|
|
38
38
|
return mayachainAssetId;
|
|
39
39
|
case KnownChainIds.SolanaMainnet:
|
|
40
40
|
return solAssetId;
|
|
41
|
+
case KnownChainIds.TronMainnet:
|
|
42
|
+
return tronAssetId;
|
|
43
|
+
case KnownChainIds.SuiMainnet:
|
|
44
|
+
return suiAssetId;
|
|
45
|
+
case KnownChainIds.MonadMainnet:
|
|
46
|
+
return monadAssetId;
|
|
41
47
|
default:
|
|
42
48
|
return assertUnreachable(chainId);
|
|
43
49
|
}
|
|
@@ -5,6 +5,8 @@ export const getAssetNamespaceFromChainId = (chainId) => {
|
|
|
5
5
|
switch (chainId) {
|
|
6
6
|
case KnownChainIds.SolanaMainnet:
|
|
7
7
|
return ASSET_NAMESPACE.splToken;
|
|
8
|
+
case KnownChainIds.SuiMainnet:
|
|
9
|
+
return ASSET_NAMESPACE.slip44;
|
|
8
10
|
case KnownChainIds.EthereumMainnet:
|
|
9
11
|
case KnownChainIds.AvalancheMainnet:
|
|
10
12
|
case KnownChainIds.OptimismMainnet:
|
|
@@ -14,6 +16,7 @@ export const getAssetNamespaceFromChainId = (chainId) => {
|
|
|
14
16
|
case KnownChainIds.ArbitrumNovaMainnet:
|
|
15
17
|
case KnownChainIds.BaseMainnet:
|
|
16
18
|
case KnownChainIds.BnbSmartChainMainnet:
|
|
19
|
+
case KnownChainIds.MonadMainnet:
|
|
17
20
|
return ASSET_NAMESPACE.erc20;
|
|
18
21
|
case KnownChainIds.CosmosMainnet:
|
|
19
22
|
case KnownChainIds.BitcoinMainnet:
|
|
@@ -22,6 +25,7 @@ export const getAssetNamespaceFromChainId = (chainId) => {
|
|
|
22
25
|
case KnownChainIds.LitecoinMainnet:
|
|
23
26
|
case KnownChainIds.ThorchainMainnet:
|
|
24
27
|
case KnownChainIds.MayachainMainnet:
|
|
28
|
+
case KnownChainIds.TronMainnet:
|
|
25
29
|
throw Error(`Unhandled case '${chainId}'`);
|
|
26
30
|
default:
|
|
27
31
|
return assertUnreachable(chainId);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { KnownChainIds } from '@shapeshiftoss/types';
|
|
2
|
-
export declare const getChainShortName: (chainId: KnownChainIds) => "AVA" | "OP" | "ETH" | "POLY" | "GNO" | "BNB" | "ARB" | "ARB-Nova" | "BAS" | "BTC" | "BCH" | "COSM" | "THOR" | "MAYA" | "DOGE" | "LTC" | "SOL" | undefined;
|
|
2
|
+
export declare const getChainShortName: (chainId: KnownChainIds) => "AVA" | "OP" | "ETH" | "POLY" | "GNO" | "BNB" | "ARB" | "ARB-Nova" | "BAS" | "BTC" | "BCH" | "COSM" | "THOR" | "MAYA" | "DOGE" | "LTC" | "SOL" | "TRX" | "SUI" | "MON" | undefined;
|
|
@@ -36,6 +36,12 @@ export const getChainShortName = (chainId) => {
|
|
|
36
36
|
return 'LTC';
|
|
37
37
|
case KnownChainIds.SolanaMainnet:
|
|
38
38
|
return 'SOL';
|
|
39
|
+
case KnownChainIds.TronMainnet:
|
|
40
|
+
return 'TRX';
|
|
41
|
+
case KnownChainIds.SuiMainnet:
|
|
42
|
+
return 'SUI';
|
|
43
|
+
case KnownChainIds.MonadMainnet:
|
|
44
|
+
return 'MON';
|
|
39
45
|
default: {
|
|
40
46
|
assertUnreachable(chainId);
|
|
41
47
|
}
|
|
@@ -35,6 +35,8 @@ export const getNativeFeeAssetReference = (chainNamespace, chainReference) => {
|
|
|
35
35
|
return ASSET_REFERENCE.ArbitrumNova;
|
|
36
36
|
case CHAIN_REFERENCE.BaseMainnet:
|
|
37
37
|
return ASSET_REFERENCE.Base;
|
|
38
|
+
case CHAIN_REFERENCE.MonadMainnet:
|
|
39
|
+
return ASSET_REFERENCE.Monad;
|
|
38
40
|
default:
|
|
39
41
|
throw new Error(`Chain namespace ${chainNamespace} on ${chainReference} not supported.`);
|
|
40
42
|
}
|
|
@@ -56,6 +58,20 @@ export const getNativeFeeAssetReference = (chainNamespace, chainReference) => {
|
|
|
56
58
|
default:
|
|
57
59
|
throw new Error(`Chain namespace ${chainNamespace} on ${chainReference} not supported.`);
|
|
58
60
|
}
|
|
61
|
+
case CHAIN_NAMESPACE.Tron:
|
|
62
|
+
switch (chainReference) {
|
|
63
|
+
case CHAIN_REFERENCE.TronMainnet:
|
|
64
|
+
return ASSET_REFERENCE.Tron;
|
|
65
|
+
default:
|
|
66
|
+
throw new Error(`Chain namespace ${chainNamespace} on ${chainReference} not supported.`);
|
|
67
|
+
}
|
|
68
|
+
case CHAIN_NAMESPACE.Sui:
|
|
69
|
+
switch (chainReference) {
|
|
70
|
+
case CHAIN_REFERENCE.SuiMainnet:
|
|
71
|
+
return ASSET_REFERENCE.Sui;
|
|
72
|
+
default:
|
|
73
|
+
throw new Error(`Chain namespace ${chainNamespace} on ${chainReference} not supported.`);
|
|
74
|
+
}
|
|
59
75
|
default:
|
|
60
76
|
throw new Error(`Chain namespace ${chainNamespace} on ${chainReference} not supported.`);
|
|
61
77
|
}
|
package/dist/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"packageManager": "yarn@3.5.0",
|
|
5
5
|
"repository": "https://github.com/shapeshift/web",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,11 +30,14 @@
|
|
|
30
30
|
"postbuild:cjs": "echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@shapeshiftoss/caip": "^8.16.
|
|
34
|
-
"@shapeshiftoss/types": "^8.6.
|
|
33
|
+
"@shapeshiftoss/caip": "^8.16.5",
|
|
34
|
+
"@shapeshiftoss/types": "^8.6.5",
|
|
35
35
|
"@sniptt/monads": "^0.5.10",
|
|
36
36
|
"bignumber.js": "^9.3.1",
|
|
37
37
|
"dayjs": "^1.11.3",
|
|
38
38
|
"lodash": "^4.17.21"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/lodash": "^4.14.178"
|
|
39
42
|
}
|
|
40
43
|
}
|