@pioneer-platform/pioneer-sdk 8.15.18 → 8.15.20

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 CHANGED
@@ -3403,6 +3403,38 @@ async function getFees(pioneer, networkId) {
3403
3403
  raw: { hardcoded: true, reason: "DOGE fee estimation unreliable" }
3404
3404
  };
3405
3405
  }
3406
+ if (networkId === "bip122:4da631f2ac1bed857bd968c67c913978") {
3407
+ console.log(tag, "Using hardcoded fees for DigiByte: 100 sat/byte minimum (min relay: 22,600 sats)");
3408
+ return {
3409
+ slow: {
3410
+ label: "Economy",
3411
+ value: "100",
3412
+ unit: "sat/byte",
3413
+ description: "Minimum relay fee - 30+ minutes",
3414
+ estimatedTime: "~30 minutes",
3415
+ priority: "low"
3416
+ },
3417
+ average: {
3418
+ label: "Standard",
3419
+ value: "120",
3420
+ unit: "sat/byte",
3421
+ description: "Normal priority - 10-20 minutes",
3422
+ estimatedTime: "~15 minutes",
3423
+ priority: "medium"
3424
+ },
3425
+ fastest: {
3426
+ label: "Priority",
3427
+ value: "150",
3428
+ unit: "sat/byte",
3429
+ description: "High priority - next block",
3430
+ estimatedTime: "~5 minutes",
3431
+ priority: "high"
3432
+ },
3433
+ networkId,
3434
+ networkType: "UTXO",
3435
+ raw: { hardcoded: true, reason: "DGB has high minimum relay fee requirement (22,600 sats)" }
3436
+ };
3437
+ }
3406
3438
  let feeResponse;
3407
3439
  if (networkId === "bip122:000007d91d1254d60e2dd1ae58038307") {
3408
3440
  try {
@@ -4210,10 +4242,26 @@ function logQueryDiagnostics(assetQuery, tag = "") {
4210
4242
  }
4211
4243
  function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4212
4244
  const tag = TAG9 + " | enrichBalancesWithAssetInfo | ";
4213
- for (const balance of balances) {
4245
+ const validBalances = balances.filter((balance) => {
4246
+ if (!balance.caip || typeof balance.caip !== "string" || balance.caip.trim() === "") {
4247
+ console.warn(tag, "Skipping balance with invalid/empty CAIP:", {
4248
+ pubkey: balance.pubkey,
4249
+ balance: balance.balance,
4250
+ caip: balance.caip
4251
+ });
4252
+ return false;
4253
+ }
4254
+ return true;
4255
+ });
4256
+ if (validBalances.length < balances.length) {
4257
+ console.warn(tag, `Filtered out ${balances.length - validBalances.length} balances with invalid CAIPs`);
4258
+ }
4259
+ const enrichedBalances = [];
4260
+ for (const balance of validBalances) {
4214
4261
  const assetInfo = assetsMap.get(balance.caip.toLowerCase()) || assetsMap.get(balance.caip);
4215
4262
  if (!assetInfo) {
4216
- throw new Error(`Missing AssetInfo for ${balance.caip}`);
4263
+ console.warn(tag, `Missing AssetInfo for CAIP: "${balance.caip}" - skipping this balance`);
4264
+ continue;
4217
4265
  }
4218
4266
  Object.assign(balance, assetInfo, {
4219
4267
  type: balance.type || assetInfo.type,
@@ -4224,8 +4272,12 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4224
4272
  updated: Date.now(),
4225
4273
  color: assetInfo.color
4226
4274
  });
4275
+ enrichedBalances.push(balance);
4227
4276
  }
4228
- return balances;
4277
+ if (enrichedBalances.length < balances.length) {
4278
+ console.warn(tag, `Successfully enriched ${enrichedBalances.length}/${balances.length} balances (${balances.length - enrichedBalances.length} skipped due to missing data)`);
4279
+ }
4280
+ return enrichedBalances;
4229
4281
  }
4230
4282
 
4231
4283
  // src/utils/sync-state.ts
package/dist/index.es.js CHANGED
@@ -3587,6 +3587,38 @@ async function getFees(pioneer, networkId) {
3587
3587
  raw: { hardcoded: true, reason: "DOGE fee estimation unreliable" }
3588
3588
  };
3589
3589
  }
3590
+ if (networkId === "bip122:4da631f2ac1bed857bd968c67c913978") {
3591
+ console.log(tag, "Using hardcoded fees for DigiByte: 100 sat/byte minimum (min relay: 22,600 sats)");
3592
+ return {
3593
+ slow: {
3594
+ label: "Economy",
3595
+ value: "100",
3596
+ unit: "sat/byte",
3597
+ description: "Minimum relay fee - 30+ minutes",
3598
+ estimatedTime: "~30 minutes",
3599
+ priority: "low"
3600
+ },
3601
+ average: {
3602
+ label: "Standard",
3603
+ value: "120",
3604
+ unit: "sat/byte",
3605
+ description: "Normal priority - 10-20 minutes",
3606
+ estimatedTime: "~15 minutes",
3607
+ priority: "medium"
3608
+ },
3609
+ fastest: {
3610
+ label: "Priority",
3611
+ value: "150",
3612
+ unit: "sat/byte",
3613
+ description: "High priority - next block",
3614
+ estimatedTime: "~5 minutes",
3615
+ priority: "high"
3616
+ },
3617
+ networkId,
3618
+ networkType: "UTXO",
3619
+ raw: { hardcoded: true, reason: "DGB has high minimum relay fee requirement (22,600 sats)" }
3620
+ };
3621
+ }
3590
3622
  let feeResponse;
3591
3623
  if (networkId === "bip122:000007d91d1254d60e2dd1ae58038307") {
3592
3624
  try {
@@ -4394,10 +4426,26 @@ function logQueryDiagnostics(assetQuery, tag = "") {
4394
4426
  }
4395
4427
  function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4396
4428
  const tag = TAG9 + " | enrichBalancesWithAssetInfo | ";
4397
- for (const balance of balances) {
4429
+ const validBalances = balances.filter((balance) => {
4430
+ if (!balance.caip || typeof balance.caip !== "string" || balance.caip.trim() === "") {
4431
+ console.warn(tag, "Skipping balance with invalid/empty CAIP:", {
4432
+ pubkey: balance.pubkey,
4433
+ balance: balance.balance,
4434
+ caip: balance.caip
4435
+ });
4436
+ return false;
4437
+ }
4438
+ return true;
4439
+ });
4440
+ if (validBalances.length < balances.length) {
4441
+ console.warn(tag, `Filtered out ${balances.length - validBalances.length} balances with invalid CAIPs`);
4442
+ }
4443
+ const enrichedBalances = [];
4444
+ for (const balance of validBalances) {
4398
4445
  const assetInfo = assetsMap.get(balance.caip.toLowerCase()) || assetsMap.get(balance.caip);
4399
4446
  if (!assetInfo) {
4400
- throw new Error(`Missing AssetInfo for ${balance.caip}`);
4447
+ console.warn(tag, `Missing AssetInfo for CAIP: "${balance.caip}" - skipping this balance`);
4448
+ continue;
4401
4449
  }
4402
4450
  Object.assign(balance, assetInfo, {
4403
4451
  type: balance.type || assetInfo.type,
@@ -4408,8 +4456,12 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4408
4456
  updated: Date.now(),
4409
4457
  color: assetInfo.color
4410
4458
  });
4459
+ enrichedBalances.push(balance);
4411
4460
  }
4412
- return balances;
4461
+ if (enrichedBalances.length < balances.length) {
4462
+ console.warn(tag, `Successfully enriched ${enrichedBalances.length}/${balances.length} balances (${balances.length - enrichedBalances.length} skipped due to missing data)`);
4463
+ }
4464
+ return enrichedBalances;
4413
4465
  }
4414
4466
 
4415
4467
  // src/utils/sync-state.ts
package/dist/index.js CHANGED
@@ -3587,6 +3587,38 @@ async function getFees(pioneer, networkId) {
3587
3587
  raw: { hardcoded: true, reason: "DOGE fee estimation unreliable" }
3588
3588
  };
3589
3589
  }
3590
+ if (networkId === "bip122:4da631f2ac1bed857bd968c67c913978") {
3591
+ console.log(tag, "Using hardcoded fees for DigiByte: 100 sat/byte minimum (min relay: 22,600 sats)");
3592
+ return {
3593
+ slow: {
3594
+ label: "Economy",
3595
+ value: "100",
3596
+ unit: "sat/byte",
3597
+ description: "Minimum relay fee - 30+ minutes",
3598
+ estimatedTime: "~30 minutes",
3599
+ priority: "low"
3600
+ },
3601
+ average: {
3602
+ label: "Standard",
3603
+ value: "120",
3604
+ unit: "sat/byte",
3605
+ description: "Normal priority - 10-20 minutes",
3606
+ estimatedTime: "~15 minutes",
3607
+ priority: "medium"
3608
+ },
3609
+ fastest: {
3610
+ label: "Priority",
3611
+ value: "150",
3612
+ unit: "sat/byte",
3613
+ description: "High priority - next block",
3614
+ estimatedTime: "~5 minutes",
3615
+ priority: "high"
3616
+ },
3617
+ networkId,
3618
+ networkType: "UTXO",
3619
+ raw: { hardcoded: true, reason: "DGB has high minimum relay fee requirement (22,600 sats)" }
3620
+ };
3621
+ }
3590
3622
  let feeResponse;
3591
3623
  if (networkId === "bip122:000007d91d1254d60e2dd1ae58038307") {
3592
3624
  try {
@@ -4394,10 +4426,26 @@ function logQueryDiagnostics(assetQuery, tag = "") {
4394
4426
  }
4395
4427
  function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4396
4428
  const tag = TAG9 + " | enrichBalancesWithAssetInfo | ";
4397
- for (const balance of balances) {
4429
+ const validBalances = balances.filter((balance) => {
4430
+ if (!balance.caip || typeof balance.caip !== "string" || balance.caip.trim() === "") {
4431
+ console.warn(tag, "Skipping balance with invalid/empty CAIP:", {
4432
+ pubkey: balance.pubkey,
4433
+ balance: balance.balance,
4434
+ caip: balance.caip
4435
+ });
4436
+ return false;
4437
+ }
4438
+ return true;
4439
+ });
4440
+ if (validBalances.length < balances.length) {
4441
+ console.warn(tag, `Filtered out ${balances.length - validBalances.length} balances with invalid CAIPs`);
4442
+ }
4443
+ const enrichedBalances = [];
4444
+ for (const balance of validBalances) {
4398
4445
  const assetInfo = assetsMap.get(balance.caip.toLowerCase()) || assetsMap.get(balance.caip);
4399
4446
  if (!assetInfo) {
4400
- throw new Error(`Missing AssetInfo for ${balance.caip}`);
4447
+ console.warn(tag, `Missing AssetInfo for CAIP: "${balance.caip}" - skipping this balance`);
4448
+ continue;
4401
4449
  }
4402
4450
  Object.assign(balance, assetInfo, {
4403
4451
  type: balance.type || assetInfo.type,
@@ -4408,8 +4456,12 @@ function enrichBalancesWithAssetInfo(balances, assetsMap, caipToNetworkId7) {
4408
4456
  updated: Date.now(),
4409
4457
  color: assetInfo.color
4410
4458
  });
4459
+ enrichedBalances.push(balance);
4411
4460
  }
4412
- return balances;
4461
+ if (enrichedBalances.length < balances.length) {
4462
+ console.warn(tag, `Successfully enriched ${enrichedBalances.length}/${balances.length} balances (${balances.length - enrichedBalances.length} skipped due to missing data)`);
4463
+ }
4464
+ return enrichedBalances;
4413
4465
  }
4414
4466
 
4415
4467
  // src/utils/sync-state.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "highlander",
3
3
  "name": "@pioneer-platform/pioneer-sdk",
4
- "version": "8.15.18",
4
+ "version": "8.15.20",
5
5
  "dependencies": {
6
6
  "@keepkey/keepkey-sdk": "^0.2.62",
7
7
  "@pioneer-platform/pioneer-caip": "^9.10.2",
package/src/fees/index.ts CHANGED
@@ -137,6 +137,40 @@ export async function getFees(
137
137
  };
138
138
  }
139
139
 
140
+ // Hardcode DGB fees at 100 sat/byte minimum (min relay fee is 22,600 sats for ~226 byte tx)
141
+ if (networkId === 'bip122:4da631f2ac1bed857bd968c67c913978') {
142
+ console.log(tag, 'Using hardcoded fees for DigiByte: 100 sat/byte minimum (min relay: 22,600 sats)');
143
+ return {
144
+ slow: {
145
+ label: 'Economy',
146
+ value: '100',
147
+ unit: 'sat/byte',
148
+ description: 'Minimum relay fee - 30+ minutes',
149
+ estimatedTime: '~30 minutes',
150
+ priority: 'low'
151
+ },
152
+ average: {
153
+ label: 'Standard',
154
+ value: '120',
155
+ unit: 'sat/byte',
156
+ description: 'Normal priority - 10-20 minutes',
157
+ estimatedTime: '~15 minutes',
158
+ priority: 'medium'
159
+ },
160
+ fastest: {
161
+ label: 'Priority',
162
+ value: '150',
163
+ unit: 'sat/byte',
164
+ description: 'High priority - next block',
165
+ estimatedTime: '~5 minutes',
166
+ priority: 'high'
167
+ },
168
+ networkId,
169
+ networkType: 'UTXO',
170
+ raw: { hardcoded: true, reason: 'DGB has high minimum relay fee requirement (22,600 sats)' }
171
+ };
172
+ }
173
+
140
174
  // Get raw fee data from API with timeout for Dash (slow API)
141
175
  let feeResponse;
142
176
  if (networkId === 'bip122:000007d91d1254d60e2dd1ae58038307') {
@@ -187,11 +187,37 @@ export function enrichBalancesWithAssetInfo(
187
187
  ): any[] {
188
188
  const tag = TAG + ' | enrichBalancesWithAssetInfo | ';
189
189
 
190
- for (const balance of balances) {
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 new Error(`Missing AssetInfo for ${balance.caip}`);
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 balances;
243
+ return enrichedBalances;
209
244
  }