@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.
- package/lib/data.js +16 -6
- 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
|
-
//
|
211
|
-
var
|
212
|
-
var symbol =
|
213
|
-
|
214
|
-
|
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
|
-
|
236
|
+
token.type = type;
|
237
|
+
// Get pubkey for chain
|
228
238
|
return token;
|
229
239
|
}
|
230
240
|
catch (e) {
|