@pioneer-platform/pioneer-caip 9.2.12 → 9.2.14

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
@@ -121,7 +121,7 @@ export declare const shortListRangoNameToNetworkId: {
121
121
  };
122
122
  export declare const NetworkIdToRangoName: (networkId: string) => string | null;
123
123
  declare let tokenToCaip: (token: any) => any;
124
- declare let thorchainToCaip: (chain: string, symbol: string, ticker: string, type: string) => string;
124
+ declare let thorchainToCaip: (chain: string, symbol: string, ticker: any, type: string) => any;
125
125
  declare let caipToThorchain: (caip: string, ticker: string) => string | null;
126
126
  declare let caipToRango: (caip: string, ticker: string) => {
127
127
  blockchain: string;
package/lib/data.js CHANGED
@@ -284,61 +284,52 @@ var tokenToCaip = function (token) {
284
284
  exports.tokenToCaip = tokenToCaip;
285
285
  var thorchainToCaip = function (chain, symbol, ticker, type) {
286
286
  try {
287
- var caip
288
- //get networkId
289
- // let chainEnumValue = getChainEnumValue(chain)
290
- // console.log("chainEnumValue: ", chainEnumValue)
291
- = void 0;
292
- //get networkId
293
- // let chainEnumValue = getChainEnumValue(chain)
294
- // console.log("chainEnumValue: ", chainEnumValue)
295
- if (chain == "AVAX" && symbol == "WETH") {
296
- console.log("WETH detected");
297
- caip = exports.ChainToCaip[chain];
287
+ var caip = void 0;
288
+ var key = chain + '.' + symbol; // Concatenate chain and symbol
289
+ switch (key) {
290
+ case "OSMO.ATOM":
291
+ console.log("IBC atom detected");
292
+ caip = 'cosmos:osmosis-1/ibc:B011C1A0AD5E717F674BA59FD8E05B2F946E4FD41C9CB3311C95F7ED4B815620';
293
+ break;
294
+ case "AVAX.WETH":
295
+ console.log("WETH detected");
296
+ caip = exports.ChainToCaip[chain];
297
+ break;
298
+ case "BSC.BNB":
299
+ caip = exports.shortListNameToCaip['bnbsmartchain'];
300
+ break;
301
+ case "GAIA.ATOM":
302
+ caip = exports.shortListNameToCaip['cosmos'];
303
+ break;
304
+ case "ARB.ETH":
305
+ caip = exports.shortListNameToCaip['arbitrum'];
306
+ break;
307
+ case "OP.ETH":
308
+ caip = exports.shortListNameToCaip['optimism'];
309
+ break;
310
+ case "THOR.RUNE":
311
+ case "KUJI.USK":
312
+ // @ts-ignore
313
+ caip = exports.shortListNameToCaip[chain.toLowerCase()];
314
+ break;
315
+ default:
316
+ if (chain === symbol) {
317
+ caip = exports.ChainToCaip[chain];
318
+ }
319
+ else {
320
+ var networkId = exports.ChainToNetworkId[chain];
321
+ console.log("networkId: ", networkId);
322
+ if (symbol.indexOf(".") > -1) {
323
+ var contract = symbol.split("-")[1];
324
+ caip = "".concat(networkId, "/erc20:").concat(contract);
325
+ }
326
+ else {
327
+ console.error({ chain: chain, symbol: symbol, ticker: ticker, type: type });
328
+ throw Error("Unable to parse CAIP! TODO!");
329
+ }
330
+ }
331
+ break;
298
332
  }
299
- else if (chain == "BSC" && symbol == "BNB") {
300
- //if chain and symbol are the same, then we have a native token
301
- caip = exports.shortListNameToCaip['bnbsmartchain'];
302
- }
303
- else if (chain == "GAIA" && symbol == "ATOM") {
304
- //if chain and symbol are the same, then we have a native token
305
- caip = exports.shortListNameToCaip['cosmos'];
306
- }
307
- else if (chain == "ARB" && symbol == "ETH") {
308
- //if chain and symbol are the same, then we have a native token
309
- caip = exports.shortListNameToCaip['arbitrum'];
310
- }
311
- else if (chain == "OP" && symbol == "ETH") {
312
- //if chain and symbol are the same, then we have a native token
313
- caip = exports.shortListNameToCaip['optimism'];
314
- }
315
- else if (chain == "THOR" || symbol == "RUNE") {
316
- //if chain and symbol are the same, then we have a native token
317
- caip = exports.shortListNameToCaip['thorchain'];
318
- }
319
- else if (chain == "KUJI" || symbol == "USK") {
320
- //if chain and symbol are the same, then we have a native token
321
- caip = exports.shortListNameToCaip['kuji'];
322
- }
323
- else if (chain == symbol) {
324
- //if chain and symbol are the same, then we have a native token
325
- caip = exports.ChainToCaip[chain];
326
- }
327
- else {
328
- //attach symbol to chain
329
- var networkId = exports.ChainToNetworkId[chain];
330
- console.log("networkId: ", networkId);
331
- //if token
332
- if (symbol.indexOf("-") > -1) {
333
- var contract = symbol.split("-")[1];
334
- caip = "".concat(networkId, "/erc20:").concat(contract);
335
- }
336
- else {
337
- console.error({ chain: chain, symbol: symbol, ticker: ticker, type: type });
338
- throw Error("Unable to parse CAIP! TODO!");
339
- }
340
- }
341
- //build caip
342
333
  return caip;
343
334
  }
344
335
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/pioneer-caip",
3
- "version": "9.2.12",
3
+ "version": "9.2.14",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/main.d.ts",
6
6
  "_moduleAliases": {