@pioneer-platform/pioneer-sdk 8.15.17 → 8.15.19
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/dist/index.cjs +24 -4
- package/dist/index.es.js +24 -4
- package/dist/index.js +24 -4
- package/package.json +1 -1
- package/src/fees/index.ts +1 -1
- package/src/utils/portfolio-helpers.ts +38 -3
package/dist/index.cjs
CHANGED
|
@@ -3503,7 +3503,7 @@ function normalizeFeeData(feeData, networkType, networkName, networkId) {
|
|
|
3503
3503
|
"bip122:000000000000000000651ef99cb9fcbe": 50,
|
|
3504
3504
|
"bip122:000007d91d1254d60e2dd1ae58038307": 50,
|
|
3505
3505
|
"bip122:000000000019d6689c085ae165831e93": 5000,
|
|
3506
|
-
"bip122:4da631f2ac1bed857bd968c67c913978":
|
|
3506
|
+
"bip122:4da631f2ac1bed857bd968c67c913978": 150
|
|
3507
3507
|
};
|
|
3508
3508
|
const matchedNetworkId = networkId && sanityLimits[networkId] ? networkId : Object.keys(sanityLimits).find((id) => networkName.toLowerCase().includes(id.split(":")[1]?.substring(0, 8)));
|
|
3509
3509
|
if (matchedNetworkId && sanityLimits[matchedNetworkId]) {
|
|
@@ -4210,10 +4210,26 @@ function logQueryDiagnostics(assetQuery, tag = "") {
|
|
|
4210
4210
|
}
|
|
4211
4211
|
function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
|
|
4212
4212
|
const tag = TAG9 + " | enrichBalancesWithAssetInfo | ";
|
|
4213
|
-
|
|
4213
|
+
const validBalances = balances.filter((balance) => {
|
|
4214
|
+
if (!balance.caip || typeof balance.caip !== "string" || balance.caip.trim() === "") {
|
|
4215
|
+
console.warn(tag, "Skipping balance with invalid/empty CAIP:", {
|
|
4216
|
+
pubkey: balance.pubkey,
|
|
4217
|
+
balance: balance.balance,
|
|
4218
|
+
caip: balance.caip
|
|
4219
|
+
});
|
|
4220
|
+
return false;
|
|
4221
|
+
}
|
|
4222
|
+
return true;
|
|
4223
|
+
});
|
|
4224
|
+
if (validBalances.length < balances.length) {
|
|
4225
|
+
console.warn(tag, `Filtered out ${balances.length - validBalances.length} balances with invalid CAIPs`);
|
|
4226
|
+
}
|
|
4227
|
+
const enrichedBalances = [];
|
|
4228
|
+
for (const balance of validBalances) {
|
|
4214
4229
|
const assetInfo = assetsMap.get(balance.caip.toLowerCase()) || assetsMap.get(balance.caip);
|
|
4215
4230
|
if (!assetInfo) {
|
|
4216
|
-
|
|
4231
|
+
console.warn(tag, `Missing AssetInfo for CAIP: "${balance.caip}" - skipping this balance`);
|
|
4232
|
+
continue;
|
|
4217
4233
|
}
|
|
4218
4234
|
Object.assign(balance, assetInfo, {
|
|
4219
4235
|
type: balance.type || assetInfo.type,
|
|
@@ -4224,8 +4240,12 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
|
|
|
4224
4240
|
updated: Date.now(),
|
|
4225
4241
|
color: assetInfo.color
|
|
4226
4242
|
});
|
|
4243
|
+
enrichedBalances.push(balance);
|
|
4227
4244
|
}
|
|
4228
|
-
|
|
4245
|
+
if (enrichedBalances.length < balances.length) {
|
|
4246
|
+
console.warn(tag, `Successfully enriched ${enrichedBalances.length}/${balances.length} balances (${balances.length - enrichedBalances.length} skipped due to missing data)`);
|
|
4247
|
+
}
|
|
4248
|
+
return enrichedBalances;
|
|
4229
4249
|
}
|
|
4230
4250
|
|
|
4231
4251
|
// src/utils/sync-state.ts
|
package/dist/index.es.js
CHANGED
|
@@ -3687,7 +3687,7 @@ function normalizeFeeData(feeData, networkType, networkName, networkId) {
|
|
|
3687
3687
|
"bip122:000000000000000000651ef99cb9fcbe": 50,
|
|
3688
3688
|
"bip122:000007d91d1254d60e2dd1ae58038307": 50,
|
|
3689
3689
|
"bip122:000000000019d6689c085ae165831e93": 5000,
|
|
3690
|
-
"bip122:4da631f2ac1bed857bd968c67c913978":
|
|
3690
|
+
"bip122:4da631f2ac1bed857bd968c67c913978": 150
|
|
3691
3691
|
};
|
|
3692
3692
|
const matchedNetworkId = networkId && sanityLimits[networkId] ? networkId : Object.keys(sanityLimits).find((id) => networkName.toLowerCase().includes(id.split(":")[1]?.substring(0, 8)));
|
|
3693
3693
|
if (matchedNetworkId && sanityLimits[matchedNetworkId]) {
|
|
@@ -4394,10 +4394,26 @@ function logQueryDiagnostics(assetQuery, tag = "") {
|
|
|
4394
4394
|
}
|
|
4395
4395
|
function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
|
|
4396
4396
|
const tag = TAG9 + " | enrichBalancesWithAssetInfo | ";
|
|
4397
|
-
|
|
4397
|
+
const validBalances = balances.filter((balance) => {
|
|
4398
|
+
if (!balance.caip || typeof balance.caip !== "string" || balance.caip.trim() === "") {
|
|
4399
|
+
console.warn(tag, "Skipping balance with invalid/empty CAIP:", {
|
|
4400
|
+
pubkey: balance.pubkey,
|
|
4401
|
+
balance: balance.balance,
|
|
4402
|
+
caip: balance.caip
|
|
4403
|
+
});
|
|
4404
|
+
return false;
|
|
4405
|
+
}
|
|
4406
|
+
return true;
|
|
4407
|
+
});
|
|
4408
|
+
if (validBalances.length < balances.length) {
|
|
4409
|
+
console.warn(tag, `Filtered out ${balances.length - validBalances.length} balances with invalid CAIPs`);
|
|
4410
|
+
}
|
|
4411
|
+
const enrichedBalances = [];
|
|
4412
|
+
for (const balance of validBalances) {
|
|
4398
4413
|
const assetInfo = assetsMap.get(balance.caip.toLowerCase()) || assetsMap.get(balance.caip);
|
|
4399
4414
|
if (!assetInfo) {
|
|
4400
|
-
|
|
4415
|
+
console.warn(tag, `Missing AssetInfo for CAIP: "${balance.caip}" - skipping this balance`);
|
|
4416
|
+
continue;
|
|
4401
4417
|
}
|
|
4402
4418
|
Object.assign(balance, assetInfo, {
|
|
4403
4419
|
type: balance.type || assetInfo.type,
|
|
@@ -4408,8 +4424,12 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
|
|
|
4408
4424
|
updated: Date.now(),
|
|
4409
4425
|
color: assetInfo.color
|
|
4410
4426
|
});
|
|
4427
|
+
enrichedBalances.push(balance);
|
|
4411
4428
|
}
|
|
4412
|
-
|
|
4429
|
+
if (enrichedBalances.length < balances.length) {
|
|
4430
|
+
console.warn(tag, `Successfully enriched ${enrichedBalances.length}/${balances.length} balances (${balances.length - enrichedBalances.length} skipped due to missing data)`);
|
|
4431
|
+
}
|
|
4432
|
+
return enrichedBalances;
|
|
4413
4433
|
}
|
|
4414
4434
|
|
|
4415
4435
|
// src/utils/sync-state.ts
|
package/dist/index.js
CHANGED
|
@@ -3687,7 +3687,7 @@ function normalizeFeeData(feeData, networkType, networkName, networkId) {
|
|
|
3687
3687
|
"bip122:000000000000000000651ef99cb9fcbe": 50,
|
|
3688
3688
|
"bip122:000007d91d1254d60e2dd1ae58038307": 50,
|
|
3689
3689
|
"bip122:000000000019d6689c085ae165831e93": 5000,
|
|
3690
|
-
"bip122:4da631f2ac1bed857bd968c67c913978":
|
|
3690
|
+
"bip122:4da631f2ac1bed857bd968c67c913978": 150
|
|
3691
3691
|
};
|
|
3692
3692
|
const matchedNetworkId = networkId && sanityLimits[networkId] ? networkId : Object.keys(sanityLimits).find((id) => networkName.toLowerCase().includes(id.split(":")[1]?.substring(0, 8)));
|
|
3693
3693
|
if (matchedNetworkId && sanityLimits[matchedNetworkId]) {
|
|
@@ -4394,10 +4394,26 @@ function logQueryDiagnostics(assetQuery, tag = "") {
|
|
|
4394
4394
|
}
|
|
4395
4395
|
function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
|
|
4396
4396
|
const tag = TAG9 + " | enrichBalancesWithAssetInfo | ";
|
|
4397
|
-
|
|
4397
|
+
const validBalances = balances.filter((balance) => {
|
|
4398
|
+
if (!balance.caip || typeof balance.caip !== "string" || balance.caip.trim() === "") {
|
|
4399
|
+
console.warn(tag, "Skipping balance with invalid/empty CAIP:", {
|
|
4400
|
+
pubkey: balance.pubkey,
|
|
4401
|
+
balance: balance.balance,
|
|
4402
|
+
caip: balance.caip
|
|
4403
|
+
});
|
|
4404
|
+
return false;
|
|
4405
|
+
}
|
|
4406
|
+
return true;
|
|
4407
|
+
});
|
|
4408
|
+
if (validBalances.length < balances.length) {
|
|
4409
|
+
console.warn(tag, `Filtered out ${balances.length - validBalances.length} balances with invalid CAIPs`);
|
|
4410
|
+
}
|
|
4411
|
+
const enrichedBalances = [];
|
|
4412
|
+
for (const balance of validBalances) {
|
|
4398
4413
|
const assetInfo = assetsMap.get(balance.caip.toLowerCase()) || assetsMap.get(balance.caip);
|
|
4399
4414
|
if (!assetInfo) {
|
|
4400
|
-
|
|
4415
|
+
console.warn(tag, `Missing AssetInfo for CAIP: "${balance.caip}" - skipping this balance`);
|
|
4416
|
+
continue;
|
|
4401
4417
|
}
|
|
4402
4418
|
Object.assign(balance, assetInfo, {
|
|
4403
4419
|
type: balance.type || assetInfo.type,
|
|
@@ -4408,8 +4424,12 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
|
|
|
4408
4424
|
updated: Date.now(),
|
|
4409
4425
|
color: assetInfo.color
|
|
4410
4426
|
});
|
|
4427
|
+
enrichedBalances.push(balance);
|
|
4411
4428
|
}
|
|
4412
|
-
|
|
4429
|
+
if (enrichedBalances.length < balances.length) {
|
|
4430
|
+
console.warn(tag, `Successfully enriched ${enrichedBalances.length}/${balances.length} balances (${balances.length - enrichedBalances.length} skipped due to missing data)`);
|
|
4431
|
+
}
|
|
4432
|
+
return enrichedBalances;
|
|
4413
4433
|
}
|
|
4414
4434
|
|
|
4415
4435
|
// src/utils/sync-state.ts
|
package/package.json
CHANGED
package/src/fees/index.ts
CHANGED
|
@@ -294,7 +294,7 @@ function normalizeFeeData(
|
|
|
294
294
|
'bip122:000000000000000000651ef99cb9fcbe': 50, // BCH max 50 sat/byte (low fee chain)
|
|
295
295
|
'bip122:000007d91d1254d60e2dd1ae58038307': 50, // DASH max 50 sat/byte (low fee chain)
|
|
296
296
|
'bip122:000000000019d6689c085ae165831e93': 5000, // BTC max 5000 sat/byte (can spike during congestion)
|
|
297
|
-
'bip122:4da631f2ac1bed857bd968c67c913978':
|
|
297
|
+
'bip122:4da631f2ac1bed857bd968c67c913978': 150, // DGB max 150 sat/byte (min relay fee 22,600 sats)
|
|
298
298
|
};
|
|
299
299
|
|
|
300
300
|
const matchedNetworkId = networkId && sanityLimits[networkId] ? networkId :
|
|
@@ -187,11 +187,37 @@ export function enrichBalancesWithAssetInfo(
|
|
|
187
187
|
): any[] {
|
|
188
188
|
const tag = TAG + ' | enrichBalancesWithAssetInfo | ';
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
// Filter out balances with invalid or empty CAIPs BEFORE processing
|
|
191
|
+
const validBalances = balances.filter((balance) => {
|
|
192
|
+
// Validate CAIP exists and is a non-empty string
|
|
193
|
+
if (!balance.caip || typeof balance.caip !== 'string' || balance.caip.trim() === '') {
|
|
194
|
+
console.warn(tag, 'Skipping balance with invalid/empty CAIP:', {
|
|
195
|
+
pubkey: balance.pubkey,
|
|
196
|
+
balance: balance.balance,
|
|
197
|
+
caip: balance.caip,
|
|
198
|
+
});
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
if (validBalances.length < balances.length) {
|
|
205
|
+
console.warn(
|
|
206
|
+
tag,
|
|
207
|
+
`Filtered out ${balances.length - validBalances.length} balances with invalid CAIPs`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Track enriched balances
|
|
212
|
+
const enrichedBalances: any[] = [];
|
|
213
|
+
|
|
214
|
+
for (const balance of validBalances) {
|
|
191
215
|
const assetInfo = assetsMap.get(balance.caip.toLowerCase()) || assetsMap.get(balance.caip);
|
|
192
216
|
|
|
193
217
|
if (!assetInfo) {
|
|
194
|
-
throw
|
|
218
|
+
// Log warning but don't throw - skip this balance instead
|
|
219
|
+
console.warn(tag, `Missing AssetInfo for CAIP: "${balance.caip}" - skipping this balance`);
|
|
220
|
+
continue;
|
|
195
221
|
}
|
|
196
222
|
|
|
197
223
|
Object.assign(balance, assetInfo, {
|
|
@@ -203,7 +229,16 @@ export function enrichBalancesWithAssetInfo(
|
|
|
203
229
|
updated: Date.now(),
|
|
204
230
|
color: assetInfo.color,
|
|
205
231
|
});
|
|
232
|
+
|
|
233
|
+
enrichedBalances.push(balance);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (enrichedBalances.length < balances.length) {
|
|
237
|
+
console.warn(
|
|
238
|
+
tag,
|
|
239
|
+
`Successfully enriched ${enrichedBalances.length}/${balances.length} balances (${balances.length - enrichedBalances.length} skipped due to missing data)`
|
|
240
|
+
);
|
|
206
241
|
}
|
|
207
242
|
|
|
208
|
-
return
|
|
243
|
+
return enrichedBalances;
|
|
209
244
|
}
|