@pioneer-platform/pioneer-discovery 0.0.9 → 0.0.11
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 +4 -0
- package/lib/data.js +116 -5
- package/lib/generatedAssetData.json +6 -0
- package/package.json +9 -2
package/lib/data.d.ts
CHANGED
package/lib/data.js
CHANGED
|
@@ -1,15 +1,126 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
6
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
24
|
};
|
|
9
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.relatedAssets = exports.assetData = void 0;
|
|
26
|
+
exports.getAssets = exports.relatedAssets = exports.assetData = void 0;
|
|
27
|
+
/*
|
|
28
|
+
Asset Tools
|
|
29
|
+
|
|
30
|
+
-highlander
|
|
31
|
+
|
|
32
|
+
*/
|
|
33
|
+
var TAG = ' | pioneer-discovery | ';
|
|
34
|
+
var log = require('@pioneer-platform/loggerdog')();
|
|
35
|
+
var tokens_1 = require("@coinmasters/tokens");
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
var pioneer_caip_1 = require("@pioneer-platform/pioneer-caip");
|
|
38
|
+
var router = require("@pioneer-platform/pioneer-router");
|
|
39
|
+
router.init();
|
|
11
40
|
//dataByCaip
|
|
12
41
|
var generatedAssetData_json_1 = __importDefault(require("./generatedAssetData.json"));
|
|
13
42
|
exports.assetData = generatedAssetData_json_1.default;
|
|
14
43
|
var relatedAssetIndex_json_1 = __importDefault(require("./relatedAssetIndex.json"));
|
|
15
44
|
exports.relatedAssets = relatedAssetIndex_json_1.default;
|
|
45
|
+
var MEMOLESS_INTERGRATIONS = ['changelly', 'chainflip'];
|
|
46
|
+
//get assets
|
|
47
|
+
var getAssets = function () {
|
|
48
|
+
var tag = "".concat(TAG, " | getAssets | ");
|
|
49
|
+
try {
|
|
50
|
+
var tokenMap_1 = new Map();
|
|
51
|
+
var chains_1 = new Set();
|
|
52
|
+
var chainTokenCounts_1 = {};
|
|
53
|
+
var allAssets_1 = [];
|
|
54
|
+
// Function to add tokens with their source list
|
|
55
|
+
var addTokens_1 = function (tokens, sourceList) {
|
|
56
|
+
tokens.forEach(function (token) {
|
|
57
|
+
chains_1.add(token.chain);
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
chainTokenCounts_1[token.chain] = (chainTokenCounts_1[token.chain] || 0) + 1;
|
|
60
|
+
// console.log('*** token: ', token);
|
|
61
|
+
var expandedInfo = (0, pioneer_caip_1.tokenToCaip)(token);
|
|
62
|
+
if (expandedInfo.caip) {
|
|
63
|
+
expandedInfo.sourceList = sourceList;
|
|
64
|
+
var assetInfoKey = expandedInfo.caip.toLowerCase();
|
|
65
|
+
var assetInfo =
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
generatedAssetData_json_1.default[expandedInfo.caip] || generatedAssetData_json_1.default[expandedInfo.caip.toLowerCase()];
|
|
68
|
+
if (assetInfo) {
|
|
69
|
+
var combinedInfo = __assign(__assign(__assign({}, expandedInfo), assetInfo), { integrations: [] }); // Prepare integration array
|
|
70
|
+
tokenMap_1.set(assetInfoKey, combinedInfo);
|
|
71
|
+
allAssets_1.push(combinedInfo);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
//TODO deal witht this at some point, generate caips on a the fly?
|
|
75
|
+
// console.error('Missing assetData(PIONEER DATA) for: ', token);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.error('*** expandedInfo: ', expandedInfo);
|
|
80
|
+
console.error('*** Failed to expand token: ', token);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
// Add tokens from various lists with their source
|
|
85
|
+
var primaryAssets = [tokens_1.NativeList, tokens_1.MayaList, tokens_1.PioneerList];
|
|
86
|
+
var tokenAssets = [
|
|
87
|
+
tokens_1.StargateARBList,
|
|
88
|
+
tokens_1.SushiswapList,
|
|
89
|
+
tokens_1.ThorchainList,
|
|
90
|
+
tokens_1.TraderjoeList,
|
|
91
|
+
tokens_1.UniswapList,
|
|
92
|
+
tokens_1.WoofiList,
|
|
93
|
+
tokens_1.CoinGeckoList,
|
|
94
|
+
tokens_1.OneInchList,
|
|
95
|
+
tokens_1.PancakeswapETHList,
|
|
96
|
+
tokens_1.PancakeswapList,
|
|
97
|
+
tokens_1.PangolinList,
|
|
98
|
+
];
|
|
99
|
+
var tokenLists = [];
|
|
100
|
+
tokenLists = __spreadArray(__spreadArray([], tokenAssets, true), tokenLists, true);
|
|
101
|
+
tokenLists.forEach(function (list) { return addTokens_1(list.tokens, list.name); });
|
|
102
|
+
// Get integration support by asset and enrich the token map with this data
|
|
103
|
+
var integrationSupport_1 = router.assetSupport();
|
|
104
|
+
integrationSupport_1 = integrationSupport_1.data || {};
|
|
105
|
+
//console.log('integrationSupport: ', integrationSupport);
|
|
106
|
+
// Enrich tokenMap directly with integration support
|
|
107
|
+
Object.keys(integrationSupport_1).forEach(function (key) {
|
|
108
|
+
integrationSupport_1[key].forEach(function (id) {
|
|
109
|
+
if (id) {
|
|
110
|
+
var asset = tokenMap_1.get(id.toLowerCase());
|
|
111
|
+
if (asset) {
|
|
112
|
+
if (MEMOLESS_INTERGRATIONS.indexOf(key) > -1)
|
|
113
|
+
asset.memoless = true;
|
|
114
|
+
asset.integrations.push(key);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
return { tokenMap: tokenMap_1, allAssets: allAssets_1 };
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
log.error("getAssets | e: ", e);
|
|
123
|
+
throw e;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
exports.getAssets = getAssets;
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"icon": "https://pioneers.dev/coins/zcash.png",
|
|
37
37
|
"explorer": "https://blockchair.com/zcash",
|
|
38
38
|
"explorerAddressLink": "https://blockchair.com/zcash/address/",
|
|
39
|
+
"explorerXpubLink": "https://zec1.trezor.io/xpub/",
|
|
39
40
|
"explorerTxLink": "https://blockchair.com/zcash/transaction/"
|
|
40
41
|
},
|
|
41
42
|
"cosmos:kaiyo-1/slip44:118": {
|
|
@@ -127,6 +128,7 @@
|
|
|
127
128
|
"icon": "https://assets.coincap.io/assets/icons/256/bch.png",
|
|
128
129
|
"explorer": "https://blockchair.com",
|
|
129
130
|
"explorerAddressLink": "https://blockchair.com/bitcoin-cash/address/",
|
|
131
|
+
"explorerXpubLink": "https://bch1.trezor.io/xpub/",
|
|
130
132
|
"explorerTxLink": "https://blockchair.com/bitcoin-cash/transaction/"
|
|
131
133
|
},
|
|
132
134
|
"bip122:000007d91d1254d60e2dd1ae58038307/slip44:5": {
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"icon": "https://pioneers.dev/coins/base.png",
|
|
141
143
|
"explorer": "https://blockchair.com/dash",
|
|
142
144
|
"explorerAddressLink": "https://blockchair.com/dash/address/",
|
|
145
|
+
"explorerXpubLink": "https://dash1.trezor.io/xpub/",
|
|
143
146
|
"explorerTxLink": "https://blockchair.com/dash/transaction/"
|
|
144
147
|
},
|
|
145
148
|
"bip122:000000000019d6689c085ae165831e93/slip44:0": {
|
|
@@ -153,6 +156,7 @@
|
|
|
153
156
|
"icon": "https://assets.coincap.io/assets/icons/256/btc.png",
|
|
154
157
|
"explorer": "https://live.blockcypher.com",
|
|
155
158
|
"explorerAddressLink": "https://live.blockcypher.com/btc/address/",
|
|
159
|
+
"explorerXpubLink": "https://btc1.trezor.io/xpub/",
|
|
156
160
|
"explorerTxLink": "https://live.blockcypher.com/btc/tx/"
|
|
157
161
|
},
|
|
158
162
|
"bip122:00000000001a91e3dace36e2be3bf030/slip44:3": {
|
|
@@ -166,6 +170,7 @@
|
|
|
166
170
|
"icon": "https://assets.coincap.io/assets/icons/256/doge.png",
|
|
167
171
|
"explorer": "https://live.blockcypher.com",
|
|
168
172
|
"explorerAddressLink": "https://live.blockcypher.com/doge/address/",
|
|
173
|
+
"explorerXpubLink": "https://blockbook.doge-1.zelcore.io/xpub/",
|
|
169
174
|
"explorerTxLink": "https://live.blockcypher.com/doge/tx/"
|
|
170
175
|
},
|
|
171
176
|
"bip122:12a765e31ffd4059bada1e25190f6e98/slip44:2": {
|
|
@@ -179,6 +184,7 @@
|
|
|
179
184
|
"icon": "https://assets.coincap.io/assets/icons/256/ltc.png",
|
|
180
185
|
"explorer": "https://live.blockcypher.com",
|
|
181
186
|
"explorerAddressLink": "https://live.blockcypher.com/ltc/address/",
|
|
187
|
+
"explorerXpubLink": "https://ltc1.trezor.io/xpub/",
|
|
182
188
|
"explorerTxLink": "https://live.blockcypher.com/ltc/tx/"
|
|
183
189
|
},
|
|
184
190
|
"cosmos:cosmoshub-4/ibc:0025F8A87464A471E66B234C4F93AEC5B4DA3D42D7986451A059273426290DD5": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/pioneer-discovery",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/main.d.ts",
|
|
6
6
|
"_moduleAliases": {
|
|
@@ -20,5 +20,12 @@
|
|
|
20
20
|
"nodemon": "^2.0.3",
|
|
21
21
|
"typescript": "^5.0.2"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "a76012f6693a12181c4744e53e977a9eaeef0ed3"
|
|
23
|
+
"gitHead": "a76012f6693a12181c4744e53e977a9eaeef0ed3",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@coinmasters/tokens": "^3.7.33",
|
|
26
|
+
"@coinmasters/types": "^4.7.33",
|
|
27
|
+
"@pioneer-platform/loggerdog": "^8.3.1",
|
|
28
|
+
"@pioneer-platform/pioneer-caip": "^9.2.27",
|
|
29
|
+
"@pioneer-platform/pioneer-router": "^8.4.92"
|
|
30
|
+
}
|
|
24
31
|
}
|