@pioneer-platform/pioneer-discovery 4.21.16 → 8.11.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/.turbo/turbo-build.log +1 -2
- package/CHANGELOG.md +18 -0
- package/lib/generatedAssetData.json +294 -192
- package/package.json +1 -1
- package/scripts/.coingecko-failed.json +553 -0
- package/scripts/.coingecko-progress.json +72 -1
- package/scripts/generate-native-assets.js +211 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generate Native Gas Asset Definitions
|
|
4
|
+
*
|
|
5
|
+
* This script generates asset definitions for native blockchain gas assets
|
|
6
|
+
* (BTC, ETH, ATOM, etc.) using data from pioneer-coins and pioneer-caip.
|
|
7
|
+
*
|
|
8
|
+
* These assets were missing from generatedAssetData.json, causing getGasAssets()
|
|
9
|
+
* to fail during SDK initialization.
|
|
10
|
+
*
|
|
11
|
+
* Usage: node scripts/generate-native-assets.js
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// Native gas assets configuration
|
|
15
|
+
// Format: { symbol, name, chainId (CAIP), icon URL, decimals }
|
|
16
|
+
const NATIVE_GAS_ASSETS = [
|
|
17
|
+
{
|
|
18
|
+
symbol: 'BTC',
|
|
19
|
+
name: 'Bitcoin',
|
|
20
|
+
chainId: 'bip122:000000000019d6689c085ae165831e93',
|
|
21
|
+
icon: 'https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579',
|
|
22
|
+
decimals: 8,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
symbol: 'ETH',
|
|
26
|
+
name: 'Ethereum',
|
|
27
|
+
chainId: 'eip155:1',
|
|
28
|
+
icon: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png?1595348880',
|
|
29
|
+
decimals: 18,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
symbol: 'ATOM',
|
|
33
|
+
name: 'Cosmos',
|
|
34
|
+
chainId: 'cosmos:cosmoshub-4',
|
|
35
|
+
icon: 'https://assets.coingecko.com/coins/images/16724/thumb/atom.png',
|
|
36
|
+
decimals: 6,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
symbol: 'OSMO',
|
|
40
|
+
name: 'Osmosis',
|
|
41
|
+
chainId: 'cosmos:osmosis-1',
|
|
42
|
+
icon: 'https://assets.coingecko.com/coins/images/16724/thumb/osmo.png',
|
|
43
|
+
decimals: 6,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
symbol: 'RUNE',
|
|
47
|
+
name: 'THORChain',
|
|
48
|
+
chainId: 'cosmos:thorchain-mainnet-v1',
|
|
49
|
+
icon: 'https://assets.coingecko.com/coins/images/6595/thumb/RUNE.png',
|
|
50
|
+
decimals: 8,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
symbol: 'CACAO',
|
|
54
|
+
name: 'Mayachain',
|
|
55
|
+
chainId: 'cosmos:mayachain-mainnet-v1',
|
|
56
|
+
icon: 'https://assets.coingecko.com/coins/images/25662/small/cacao.png',
|
|
57
|
+
decimals: 10,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
symbol: 'LTC',
|
|
61
|
+
name: 'Litecoin',
|
|
62
|
+
chainId: 'bip122:12a765e31ffd4059bada1e25190f6e98',
|
|
63
|
+
icon: 'https://assets.coingecko.com/coins/images/16724/thumb/ltc.png',
|
|
64
|
+
decimals: 8,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
symbol: 'BCH',
|
|
68
|
+
name: 'Bitcoin Cash',
|
|
69
|
+
chainId: 'bip122:000000000000000000651ef99cb9fcbe',
|
|
70
|
+
icon: 'https://assets.coingecko.com/coins/images/780/thumb/bitcoin-cash-circle.png?1594689492',
|
|
71
|
+
decimals: 8,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
symbol: 'DOGE',
|
|
75
|
+
name: 'Dogecoin',
|
|
76
|
+
chainId: 'bip122:00000000001a91e3dace36e2be3bf030',
|
|
77
|
+
icon: 'https://assets.coingecko.com/coins/images/5/small/dogecoin.png?1547792256',
|
|
78
|
+
decimals: 8,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
symbol: 'DASH',
|
|
82
|
+
name: 'Dash',
|
|
83
|
+
chainId: 'bip122:000007d91d1254d60e2dd1ae58038307',
|
|
84
|
+
icon: 'https://assets.coingecko.com/coins/images/19/small/dash-logo.png?1548385930',
|
|
85
|
+
decimals: 8,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
symbol: 'BNB',
|
|
89
|
+
name: 'BNB',
|
|
90
|
+
chainId: 'binance:bnb-beacon-chain',
|
|
91
|
+
icon: 'https://assets.coingecko.com/coins/images/825/thumb/binance-coin-logo.png?1547034615',
|
|
92
|
+
decimals: 8,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
symbol: 'AVAX',
|
|
96
|
+
name: 'Avalanche',
|
|
97
|
+
chainId: 'eip155:43114',
|
|
98
|
+
icon: 'https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818',
|
|
99
|
+
decimals: 18,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
symbol: 'MATIC',
|
|
103
|
+
name: 'Polygon',
|
|
104
|
+
chainId: 'eip155:137',
|
|
105
|
+
icon: 'https://assets.coingecko.com/coins/images/4713/small/matic-token-icon.png?1624446912',
|
|
106
|
+
decimals: 18,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
symbol: 'ARB',
|
|
110
|
+
name: 'Arbitrum',
|
|
111
|
+
chainId: 'eip155:42161',
|
|
112
|
+
icon: 'https://assets.coingecko.com/coins/images/16547/small/photo_2023-03-29_21.47.00.jpeg?1680097630',
|
|
113
|
+
decimals: 18,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
symbol: 'OP',
|
|
117
|
+
name: 'Optimism',
|
|
118
|
+
chainId: 'eip155:10',
|
|
119
|
+
icon: 'https://assets.coingecko.com/coins/images/25244/small/Optimism.png?1660904599',
|
|
120
|
+
decimals: 18,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
symbol: 'BASE',
|
|
124
|
+
name: 'Base',
|
|
125
|
+
chainId: 'eip155:8453',
|
|
126
|
+
icon: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png?1595348880', // Using ETH icon as Base uses ETH
|
|
127
|
+
decimals: 18,
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Generate asset data entries in the format expected by generatedAssetData.json
|
|
133
|
+
*/
|
|
134
|
+
function generateNativeAssetData() {
|
|
135
|
+
const assetData = {};
|
|
136
|
+
|
|
137
|
+
for (const asset of NATIVE_GAS_ASSETS) {
|
|
138
|
+
// Create CAIP assetId with slip44 for native assets
|
|
139
|
+
const assetId = `${asset.chainId}/slip44:${getSlip44(asset.symbol)}`;
|
|
140
|
+
|
|
141
|
+
assetData[assetId] = {
|
|
142
|
+
symbol: asset.symbol,
|
|
143
|
+
name: asset.name,
|
|
144
|
+
chainId: asset.chainId,
|
|
145
|
+
icon: asset.icon,
|
|
146
|
+
assetId: assetId,
|
|
147
|
+
decimals: asset.decimals,
|
|
148
|
+
isNative: true, // Mark as native gas asset for easy filtering
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return assetData;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Get SLIP44 coin type for a given symbol
|
|
157
|
+
* Reference: https://github.com/satoshilabs/slips/blob/master/slip-0044.md
|
|
158
|
+
*/
|
|
159
|
+
function getSlip44(symbol) {
|
|
160
|
+
const slip44Map = {
|
|
161
|
+
'BTC': 0,
|
|
162
|
+
'LTC': 2,
|
|
163
|
+
'DOGE': 3,
|
|
164
|
+
'DASH': 5,
|
|
165
|
+
'DGB': 20,
|
|
166
|
+
'ETH': 60,
|
|
167
|
+
'AVAX': 60,
|
|
168
|
+
'MATIC': 60,
|
|
169
|
+
'ARB': 60,
|
|
170
|
+
'OP': 60,
|
|
171
|
+
'BASE': 60,
|
|
172
|
+
'ATOM': 118,
|
|
173
|
+
'OSMO': 118,
|
|
174
|
+
'BCH': 145,
|
|
175
|
+
'XRP': 144,
|
|
176
|
+
'EOS': 194,
|
|
177
|
+
'BNB': 714,
|
|
178
|
+
'RUNE': 931,
|
|
179
|
+
'THOR': 931,
|
|
180
|
+
'CACAO': 931,
|
|
181
|
+
'MAYA': 931,
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
return slip44Map[symbol] || 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Output the generated asset data
|
|
189
|
+
*/
|
|
190
|
+
function main() {
|
|
191
|
+
const nativeAssets = generateNativeAssetData();
|
|
192
|
+
|
|
193
|
+
console.log('Generated Native Gas Assets:');
|
|
194
|
+
console.log(JSON.stringify(nativeAssets, null, 2));
|
|
195
|
+
console.log(`\nTotal: ${Object.keys(nativeAssets).length} native gas assets`);
|
|
196
|
+
|
|
197
|
+
// Instructions for manual integration
|
|
198
|
+
console.log('\n=== Integration Instructions ===');
|
|
199
|
+
console.log('1. Copy the JSON output above');
|
|
200
|
+
console.log('2. Add it to the TOP of generatedAssetData.json (before ERC20 tokens)');
|
|
201
|
+
console.log('3. Run: cd modules/pioneer/pioneer-discovery && bun run build');
|
|
202
|
+
console.log('4. Run: cd modules/pioneer/pioneer-sdk && bun run build');
|
|
203
|
+
console.log('5. Test: getGasAssets() should now return native assets\n');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Execute if run directly
|
|
207
|
+
if (require.main === module) {
|
|
208
|
+
main();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
module.exports = { generateNativeAssetData, NATIVE_GAS_ASSETS };
|