@pioneer-platform/pioneer-caip 9.2.5 → 9.2.7

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 (2) hide show
  1. package/lib/data.js +16 -6
  2. package/package.json +1 -1
package/lib/data.js CHANGED
@@ -207,24 +207,34 @@ exports.shortListNameToCaip = {
207
207
  };
208
208
  var tokenToCaip = function (token) {
209
209
  try {
210
- //get caip from identifier ie. BTC.BTC -> 'bip122:000000000019d6689c085ae165831e93/slip44:0'
211
- var chain = token.identifier.split('.')[0];
212
- var symbol = token.identifier.split('.')[1];
213
- var type = void 0;
214
- var ticker = void 0;
210
+ // Handle identifiers with an extra period
211
+ var parts = token.identifier.split('.');
212
+ var chain = void 0, symbol = void 0;
213
+ if (parts.length >= 2) {
214
+ chain = parts[0];
215
+ symbol = parts.slice(1).join('.'); // Re-join the remaining parts excluding the first
216
+ }
217
+ else {
218
+ // Fallback to the original method if there's only one or no period
219
+ chain = token.identifier.split('.')[0];
220
+ symbol = token.identifier.split('.')[1];
221
+ }
222
+ var type = void 0, ticker = void 0;
215
223
  if (token.address) {
216
224
  ticker = symbol.split('-')[0];
217
225
  type = 'token';
218
226
  }
219
227
  else {
220
228
  type = 'native';
229
+ ticker = symbol;
221
230
  }
222
231
  var caip = thorchainToCaip(chain, symbol, ticker, type);
223
232
  token.networkId = exports.ChainToNetworkId[chain];
224
233
  token.caip = caip;
225
234
  token.symbol = symbol;
226
235
  token.ticker = ticker;
227
- //get pubkey for chain
236
+ token.type = type;
237
+ // Get pubkey for chain
228
238
  return token;
229
239
  }
230
240
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/pioneer-caip",
3
- "version": "9.2.5",
3
+ "version": "9.2.7",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/main.d.ts",
6
6
  "_moduleAliases": {