@pioneer-platform/pioneer-discovery 8.15.31 → 8.15.33

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.
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+
3
+ # Upload all case variants for ERC20/BEP20 tokens
4
+ # For each token with an address, upload both lowercase and checksummed variants
5
+
6
+ export AWS_ACCESS_KEY_ID="DO00FXP8KK64LCXYAEZP"
7
+ export AWS_SECRET_ACCESS_KEY="Uyw/cq63rrQmFV9yy1HbovTSMNhLkEwImqPa88N/E/s"
8
+
9
+ COINS_DIR="/Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer/services/pioneer-server/coins"
10
+ cd "$COINS_DIR"
11
+
12
+ echo "šŸš€ Uploading all case variants for ERC20/BEP20 tokens"
13
+ echo "======================================================"
14
+
15
+ total=0
16
+ uploaded=0
17
+
18
+ # Process each PNG file
19
+ for file in *.png; do
20
+ # Decode the base64 filename to get the CAIP
21
+ caip=$(echo "$file" | sed 's/.png$//' | base64 -d 2>/dev/null)
22
+
23
+ # Check if it's an ERC20/BEP20 token (contains address)
24
+ if [[ "$caip" =~ (erc20|bep20):0x[a-fA-F0-9]{40} ]]; then
25
+ ((total++))
26
+
27
+ # Extract the address
28
+ address=$(echo "$caip" | grep -o '0x[a-fA-F0-9]\{40\}')
29
+
30
+ # Create lowercase variant
31
+ lower_caip="${caip,,}" # Convert to lowercase
32
+ lower_encoded=$(echo -n "$lower_caip" | base64)
33
+ lower_file="${lower_encoded}.png"
34
+
35
+ # Create checksummed variant (simple approximation)
36
+ # Real checksumming would need proper keccak256, but we'll use uppercase
37
+ upper_caip=$(echo "$caip" | sed "s/$address/${address^^}/")
38
+ upper_encoded=$(echo -n "$upper_caip" | base64)
39
+ upper_file="${upper_encoded}.png"
40
+
41
+ echo ""
42
+ echo "šŸ”„ Processing: $caip"
43
+
44
+ # Upload lowercase variant if different from current
45
+ if [ "$file" != "$lower_file" ] && [ ! -f "$lower_file" ]; then
46
+ cp "$file" "$lower_file"
47
+ aws s3 cp "$lower_file" "s3://keepkey/coins/$lower_file" \
48
+ --endpoint-url=https://sfo3.digitaloceanspaces.com \
49
+ --acl public-read \
50
+ --region sfo3 \
51
+ --quiet
52
+ echo " āœ… Uploaded lowercase variant"
53
+ ((uploaded++))
54
+ fi
55
+
56
+ # Upload checksummed variant if different from current
57
+ if [ "$file" != "$upper_file" ] && [ ! -f "$upper_file" ]; then
58
+ cp "$file" "$upper_file"
59
+ aws s3 cp "$upper_file" "s3://keepkey/coins/$upper_file" \
60
+ --endpoint-url=https://sfo3.digitaloceanspaces.com \
61
+ --acl public-read \
62
+ --region sfo3 \
63
+ --quiet
64
+ echo " āœ… Uploaded checksummed variant"
65
+ ((uploaded++))
66
+ fi
67
+ fi
68
+ done
69
+
70
+ echo ""
71
+ echo "======================================================"
72
+ echo "āœ… Processed $total ERC20/BEP20 tokens"
73
+ echo "āœ… Uploaded $uploaded additional case variants"
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env node
2
+
3
+ /*
4
+ * Upload icons with BOTH lowercase and checksummed Ethereum addresses
5
+ * This fixes the case sensitivity issue by uploading both variants
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { execSync } = require('child_process');
11
+ const https = require('https');
12
+
13
+ // Configuration
14
+ const S3_ENDPOINT = 'https://sfo3.digitaloceanspaces.com';
15
+ const S3_BUCKET = 'keepkey';
16
+ const S3_REGION = 'sfo3';
17
+ const CDN_URL = 'https://keepkey.sfo3.cdn.digitaloceanspaces.com';
18
+
19
+ // Paths
20
+ const DATA_FILE = path.join(__dirname, '..', 'src', 'generatedAssetData.json');
21
+ const LOCAL_COINS_DIR = path.join(__dirname, '..', '..', '..', '..', 'services', 'pioneer-server', 'coins');
22
+
23
+ // AWS credentials
24
+ const AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID || 'DO00FXP8KK64LCXYAEZP';
25
+ const AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY || 'Uyw/cq63rrQmFV9yy1HbovTSMNhLkEwImqPa88N/E/s';
26
+
27
+ function encodeAssetId(assetId) {
28
+ return Buffer.from(assetId).toString('base64');
29
+ }
30
+
31
+ function toChecksumAddress(address) {
32
+ // Simple checksum implementation
33
+ const addr = address.toLowerCase().replace('0x', '');
34
+ const hash = require('crypto').createHash('sha256').update(addr).digest('hex');
35
+ let checksummed = '0x';
36
+
37
+ for (let i = 0; i < addr.length; i++) {
38
+ if (parseInt(hash[i], 16) >= 8) {
39
+ checksummed += addr[i].toUpperCase();
40
+ } else {
41
+ checksummed += addr[i];
42
+ }
43
+ }
44
+ return checksummed;
45
+ }
46
+
47
+ function generateVariants(assetId) {
48
+ const variants = [assetId];
49
+
50
+ // Check if it's an ERC20 token (contains erc20: and 0x address)
51
+ if (assetId.includes('/erc20:0x') || assetId.includes('/bep20:0x')) {
52
+ const parts = assetId.split(':');
53
+ const address = parts[parts.length - 1];
54
+
55
+ if (address && address.startsWith('0x')) {
56
+ // Generate lowercase variant
57
+ const lowerParts = [...parts];
58
+ lowerParts[lowerParts.length - 1] = address.toLowerCase();
59
+ const lowerVariant = lowerParts.join(':');
60
+
61
+ // Generate checksummed variant
62
+ const checksummed = toChecksumAddress(address);
63
+ const checksumParts = [...parts];
64
+ checksumParts[checksumParts.length - 1] = checksummed;
65
+ const checksumVariant = checksumParts.join(':');
66
+
67
+ return [lowerVariant, checksumVariant];
68
+ }
69
+ }
70
+
71
+ return variants;
72
+ }
73
+
74
+ function uploadFile(localFile, s3Key) {
75
+ const cmd = `aws s3 cp "${localFile}" "s3://${S3_BUCKET}/${s3Key}" \
76
+ --endpoint-url=${S3_ENDPOINT} \
77
+ --acl public-read \
78
+ --region ${S3_REGION}`;
79
+
80
+ execSync(cmd, {
81
+ env: {
82
+ ...process.env,
83
+ AWS_ACCESS_KEY_ID,
84
+ AWS_SECRET_ACCESS_KEY
85
+ }
86
+ });
87
+ }
88
+
89
+ function checkAccessible(url) {
90
+ return new Promise((resolve) => {
91
+ https.get(url, { method: 'HEAD' }, (res) => {
92
+ resolve(res.statusCode === 200);
93
+ }).on('error', () => resolve(false));
94
+ });
95
+ }
96
+
97
+ async function main() {
98
+ console.log('šŸš€ Starting dual-case icon upload...\n');
99
+ console.log(`šŸ“‚ Local coins directory: ${LOCAL_COINS_DIR}`);
100
+ console.log(`ā˜ļø S3 bucket: ${S3_BUCKET}`);
101
+ console.log(`🌐 CDN URL: ${CDN_URL}\n`);
102
+
103
+ // Check local directory exists
104
+ if (!fs.existsSync(LOCAL_COINS_DIR)) {
105
+ console.error(`āŒ Local coins directory not found: ${LOCAL_COINS_DIR}`);
106
+ process.exit(1);
107
+ }
108
+
109
+ // Read asset data
110
+ const assetData = JSON.parse(fs.readFileSync(DATA_FILE, 'utf8'));
111
+ const assets = Object.entries(assetData);
112
+
113
+ console.log(`šŸ“Š Total assets: ${assets.length}\n`);
114
+
115
+ let processed = 0;
116
+ let uploaded = 0;
117
+ let variants = 0;
118
+
119
+ for (const [assetId, asset] of assets) {
120
+ processed++;
121
+
122
+ // Generate all variants (lowercase + checksummed for ERC20)
123
+ const assetVariants = generateVariants(assetId);
124
+ const primaryEncoded = encodeAssetId(assetVariants[0]);
125
+ const localFile = path.join(LOCAL_COINS_DIR, `${primaryEncoded}.png`);
126
+
127
+ if (!fs.existsSync(localFile)) {
128
+ continue; // Skip if no local file
129
+ }
130
+
131
+ console.log(`\nšŸ”„ [${processed}] ${asset.symbol || asset.name}`);
132
+ console.log(` šŸ“¦ Variants: ${assetVariants.length}`);
133
+
134
+ for (const variant of assetVariants) {
135
+ const encoded = encodeAssetId(variant);
136
+ const s3Key = `coins/${encoded}.png`;
137
+ const cdnUrl = `${CDN_URL}/coins/${encoded}.png`;
138
+
139
+ try {
140
+ // Upload
141
+ uploadFile(localFile, s3Key);
142
+
143
+ // Verify
144
+ await new Promise(resolve => setTimeout(resolve, 500));
145
+ const accessible = await checkAccessible(cdnUrl);
146
+
147
+ if (accessible) {
148
+ console.log(` āœ… ${variant} → accessible`);
149
+ uploaded++;
150
+ } else {
151
+ console.log(` āš ļø ${variant} → not accessible yet`);
152
+ }
153
+
154
+ variants++;
155
+ } catch (error) {
156
+ console.log(` āŒ ${variant} → upload failed: ${error.message}`);
157
+ }
158
+ }
159
+
160
+ if (processed % 10 === 0) {
161
+ console.log(`\nšŸ“Š Progress: ${processed}/${assets.length} processed, ${uploaded} verified, ${variants} variants uploaded`);
162
+ }
163
+ }
164
+
165
+ console.log(`\n\nšŸ“Š FINAL SUMMARY`);
166
+ console.log(`================================================================================`);
167
+ console.log(`Total assets processed: ${processed}`);
168
+ console.log(`Total variants uploaded: ${variants}`);
169
+ console.log(`Verified accessible: ${uploaded}`);
170
+ console.log(`================================================================================`);
171
+ console.log(`\nāœ… Dual-case upload complete!`);
172
+ }
173
+
174
+ main().catch(console.error);
@@ -0,0 +1,68 @@
1
+ šŸš€ Starting dual-case icon upload...
2
+
3
+ šŸ“‚ Local coins directory: /Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer/services/pioneer-server/coins
4
+ ā˜ļø S3 bucket: keepkey
5
+ 🌐 CDN URL: https://keepkey.sfo3.cdn.digitaloceanspaces.com
6
+
7
+ šŸ“Š Total assets: 14173
8
+
9
+
10
+ šŸ”„ [4] BTC
11
+ šŸ“¦ Variants: 1
12
+ āœ… bip122:000000000019d6689c085ae165831e93/slip44:0 → accessible
13
+
14
+ šŸ”„ [5] ETH
15
+ šŸ“¦ Variants: 1
16
+ āœ… eip155:1/slip44:60 → accessible
17
+
18
+ šŸ”„ [7] OSMO
19
+ šŸ“¦ Variants: 1
20
+ āœ… cosmos:osmosis-1/slip44:118 → accessible
21
+
22
+ šŸ”„ [8] RUNE
23
+ šŸ“¦ Variants: 1
24
+ āœ… cosmos:thorchain-mainnet-v1/slip44:931 → accessible
25
+
26
+ šŸ”„ [12] BCH
27
+ šŸ“¦ Variants: 1
28
+ āœ… bip122:000000000000000000651ef99cb9fcbe/slip44:145 → accessible
29
+
30
+ šŸ”„ [13] DOGE
31
+ šŸ“¦ Variants: 1
32
+ āœ… bip122:00000000001a91e3dace36e2be3bf030/slip44:3 → accessible
33
+
34
+ šŸ”„ [14] DASH
35
+ šŸ“¦ Variants: 1
36
+ āœ… bip122:000007d91d1254d60e2dd1ae58038307/slip44:5 → accessible
37
+
38
+ šŸ”„ [18] AVAX
39
+ šŸ“¦ Variants: 1
40
+ āœ… eip155:43114/slip44:60 → accessible
41
+
42
+ šŸ”„ [19] MATIC
43
+ šŸ“¦ Variants: 1
44
+ āœ… eip155:137/slip44:60 → accessible
45
+
46
+ šŸ”„ [20] ARB
47
+ šŸ“¦ Variants: 1
48
+ āœ… eip155:42161/slip44:60 → accessible
49
+
50
+ šŸ“Š Progress: 20/14173 processed, 10 verified, 10 variants uploaded
51
+
52
+ šŸ”„ [21] OP
53
+ šŸ“¦ Variants: 1
54
+ āœ… eip155:10/slip44:60 → accessible
55
+
56
+ šŸ”„ [22] BASE
57
+ šŸ“¦ Variants: 1
58
+ āœ… eip155:8453/slip44:60 → accessible
59
+
60
+
61
+ šŸ“Š FINAL SUMMARY
62
+ ================================================================================
63
+ Total assets processed: 14173
64
+ Total variants uploaded: 12
65
+ Verified accessible: 12
66
+ ================================================================================
67
+
68
+ āœ… Dual-case upload complete!
@@ -26,7 +26,7 @@ const CDN_URL = 'https://keepkey.sfo3.cdn.digitaloceanspaces.com';
26
26
 
27
27
  // Paths
28
28
  const DATA_FILE = path.join(__dirname, '..', 'src', 'generatedAssetData.json');
29
- const LOCAL_COINS_DIR = path.join(__dirname, '..', '..', '..', '..', '..', 'services', 'pioneer-server', 'public', 'coins');
29
+ const LOCAL_COINS_DIR = path.join(__dirname, '..', '..', '..', '..', 'services', 'pioneer-server', 'coins');
30
30
  const PROGRESS_FILE = path.join(__dirname, '.upload-progress.json');
31
31
  const FAILED_FILE = path.join(__dirname, '.upload-failed.json');
32
32