@pioneer-platform/pioneer-caip 9.2.5 → 9.2.6
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 +14 -6
- package/package.json +1 -1
package/lib/data.js
CHANGED
@@ -207,11 +207,19 @@ 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';
|
@@ -224,7 +232,7 @@ var tokenToCaip = function (token) {
|
|
224
232
|
token.caip = caip;
|
225
233
|
token.symbol = symbol;
|
226
234
|
token.ticker = ticker;
|
227
|
-
//
|
235
|
+
// Get pubkey for chain
|
228
236
|
return token;
|
229
237
|
}
|
230
238
|
catch (e) {
|