@pioneer-platform/pioneer-caip 9.2.7 → 9.2.8

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/lib/data.d.ts CHANGED
@@ -107,42 +107,5 @@ export declare const shortListNameToCaip: {
107
107
  };
108
108
  declare let tokenToCaip: (token: any) => any;
109
109
  declare let thorchainToCaip: (chain: string, symbol: string, ticker: string, type: string) => string;
110
- export { thorchainToCaip, tokenToCaip };
111
- export declare const primaryBlockchains: {
112
- "eip155:1/slip44:60": {
113
- name: string;
114
- type: string;
115
- caip: string;
116
- tags: string[];
117
- blockchain: string;
118
- symbol: string;
119
- decimals: number;
120
- image: string;
121
- description: string;
122
- website: string;
123
- explorer: string;
124
- rank: number;
125
- };
126
- };
127
- export declare const primaryAssets: {
128
- "eip155:1/slip44:60": {
129
- blockchain: string;
130
- caip: string;
131
- chainId: number;
132
- description: string;
133
- explorer: string;
134
- faucets: never[];
135
- feeAssetCaip: string;
136
- feeAssetName: string;
137
- feeAssetRank: number;
138
- feeAssetSymbol: string;
139
- image: string;
140
- isCharted: boolean;
141
- name: string;
142
- network: string;
143
- service: null;
144
- symbol: string;
145
- tags: (string | number | null)[];
146
- type: string;
147
- };
148
- };
110
+ declare let caipToThorchain: (caip: string, ticker: string) => string | null;
111
+ export { thorchainToCaip, tokenToCaip, caipToThorchain };
package/lib/data.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.primaryAssets = exports.primaryBlockchains = exports.tokenToCaip = exports.thorchainToCaip = exports.shortListNameToCaip = exports.shortListSymbolToCaip = exports.shortListSymbolToCoinGeckoPlatformId = exports.getChainEnumValue = exports.ChainToNetworkId = exports.ChainToCaip = exports.Chain = exports.evmCaips = void 0;
3
+ exports.caipToThorchain = exports.tokenToCaip = exports.thorchainToCaip = exports.shortListNameToCaip = exports.shortListSymbolToCaip = exports.shortListSymbolToCoinGeckoPlatformId = exports.getChainEnumValue = exports.ChainToNetworkId = exports.ChainToCaip = exports.Chain = exports.evmCaips = void 0;
4
4
  exports.evmCaips = {
5
5
  ethereum: 'eip155:1/slip44:60',
6
6
  base: 'eip155:8453/slip44:60',
@@ -306,60 +306,36 @@ var thorchainToCaip = function (chain, symbol, ticker, type) {
306
306
  }
307
307
  };
308
308
  exports.thorchainToCaip = thorchainToCaip;
309
- //Primary blockchain caips
310
- exports.primaryBlockchains = {
311
- "eip155:1/slip44:60": {
312
- name: 'ethereum',
313
- type: 'coin',
314
- caip: 'eip155:1/slip44:60',
315
- tags: [
316
- 'ethereum',
317
- 'isAsset',
318
- 'isNative',
319
- 'KeepKeySupport',
320
- 'DappSupport',
321
- 'WalletConnectSupport'
322
- ],
323
- blockchain: 'ethereum',
324
- symbol: 'ETH',
325
- decimals: 18,
326
- image: 'https://pioneers.dev/coins/ethereum.png',
327
- description: 'Open source platform to write and distribute decentralized applications.',
328
- website: 'https://ethereum.org/',
329
- explorer: 'https://etherscan.io/',
330
- rank: 2
309
+ //NOTE THIS IS IMPOSSIBLE to do well!
310
+ // Caips do NOT include the token tickers!
311
+ var caipToThorchain = function (caip, ticker) {
312
+ try {
313
+ var parts = caip.split(':');
314
+ var networkId = parts[0];
315
+ var chainId = parts[1];
316
+ var contractType = parts.length > 2 ? parts[2] : null;
317
+ var contractAddress = parts.length > 3 ? parts[3] : null;
318
+ var thorChainSymbol = void 0;
319
+ for (var _i = 0, _a = Object.entries(exports.ChainToNetworkId); _i < _a.length; _i++) {
320
+ var _b = _a[_i], symbol = _b[0], thorChainNetworkId = _b[1];
321
+ var thorChainId = thorChainNetworkId.split(':')[1];
322
+ if (thorChainId === chainId) {
323
+ thorChainSymbol = symbol;
324
+ break;
325
+ }
326
+ }
327
+ if (!thorChainSymbol) {
328
+ console.error("No matching THORChain symbol found for network ID", networkId);
329
+ return null;
330
+ }
331
+ if (contractType && contractAddress) {
332
+ return "".concat(thorChainSymbol, ".").concat(ticker, "-").concat(contractAddress.toUpperCase());
333
+ }
334
+ return thorChainSymbol;
331
335
  }
332
- };
333
- exports.primaryAssets = {
334
- "eip155:1/slip44:60": {
335
- blockchain: 'ethereum',
336
- caip: 'eip155:1/slip44:60',
337
- chainId: 1,
338
- description: 'more info here: https://ethereum.org This is a EVM network with chainId: 1 Follows EIP:155',
339
- explorer: 'https://ethereum.org',
340
- faucets: [],
341
- feeAssetCaip: 'eip155:1/slip44:60',
342
- feeAssetName: 'ethereum',
343
- feeAssetRank: 2,
344
- feeAssetSymbol: 'ETH',
345
- image: 'https://pioneers.dev/coins/ethereum-mainnet.png',
346
- isCharted: false,
347
- name: 'ethereum',
348
- network: 'ETH',
349
- service: null,
350
- symbol: 'ETH',
351
- tags: [
352
- 'KeepKeySupport',
353
- 'DappSupport',
354
- 'WalletConnectSupport',
355
- 'EVM',
356
- 'EIP:155',
357
- 'ethereum',
358
- 'Ether',
359
- 'ETH',
360
- 1,
361
- null
362
- ],
363
- type: 'EVM'
336
+ catch (e) {
337
+ console.error("Error processing CAIP to THORChain", e);
338
+ return null;
364
339
  }
365
340
  };
341
+ exports.caipToThorchain = caipToThorchain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/pioneer-caip",
3
- "version": "9.2.7",
3
+ "version": "9.2.8",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/main.d.ts",
6
6
  "_moduleAliases": {