@pioneer-platform/pioneer-caip 9.2.4 → 9.2.5
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 +2 -1
- package/lib/data.js +23 -2
- package/package.json +1 -1
package/lib/data.d.ts
CHANGED
@@ -105,8 +105,9 @@ export declare const shortListNameToCaip: {
|
|
105
105
|
eos: string;
|
106
106
|
fio: string;
|
107
107
|
};
|
108
|
+
declare let tokenToCaip: (token: any) => any;
|
108
109
|
declare let thorchainToCaip: (chain: string, symbol: string, ticker: string, type: string) => string;
|
109
|
-
export { thorchainToCaip };
|
110
|
+
export { thorchainToCaip, tokenToCaip };
|
110
111
|
export declare const primaryBlockchains: {
|
111
112
|
"eip155:1/slip44:60": {
|
112
113
|
name: string;
|
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.thorchainToCaip = exports.shortListNameToCaip = exports.shortListSymbolToCaip = exports.shortListSymbolToCoinGeckoPlatformId = exports.getChainEnumValue = exports.ChainToNetworkId = exports.ChainToCaip = exports.Chain = exports.evmCaips = void 0;
|
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;
|
4
4
|
exports.evmCaips = {
|
5
5
|
ethereum: 'eip155:1/slip44:60',
|
6
6
|
base: 'eip155:8453/slip44:60',
|
@@ -205,12 +205,33 @@ exports.shortListNameToCaip = {
|
|
205
205
|
eos: 'eip155:1:/erc20:0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0',
|
206
206
|
fio: 'placeholder:caip:fio:native:fio-protocol'
|
207
207
|
};
|
208
|
-
var
|
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;
|
215
|
+
if (token.address) {
|
216
|
+
ticker = symbol.split('-')[0];
|
217
|
+
type = 'token';
|
218
|
+
}
|
219
|
+
else {
|
220
|
+
type = 'native';
|
221
|
+
}
|
222
|
+
var caip = thorchainToCaip(chain, symbol, ticker, type);
|
223
|
+
token.networkId = exports.ChainToNetworkId[chain];
|
224
|
+
token.caip = caip;
|
225
|
+
token.symbol = symbol;
|
226
|
+
token.ticker = ticker;
|
227
|
+
//get pubkey for chain
|
228
|
+
return token;
|
210
229
|
}
|
211
230
|
catch (e) {
|
231
|
+
console.error(e);
|
212
232
|
}
|
213
233
|
};
|
234
|
+
exports.tokenToCaip = tokenToCaip;
|
214
235
|
var thorchainToCaip = function (chain, symbol, ticker, type) {
|
215
236
|
try {
|
216
237
|
var caip
|