@pioneer-platform/pioneer-sdk 4.20.3 → 4.20.4

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
@@ -3380,10 +3380,9 @@ function estimateTransactionFee(feeRate, unit, networkType, txSize) {
3380
3380
  }
3381
3381
  }
3382
3382
 
3383
- // src/index.ts
3384
- var TAG7 = " | Pioneer-sdk | ";
3383
+ // src/utils/kkapi-detection.ts
3385
3384
  async function detectKkApiAvailability(forceLocalhost) {
3386
- const tag5 = `${TAG7} | detectKkApiAvailability | `;
3385
+ const tag5 = " | detectKkApiAvailability | ";
3387
3386
  try {
3388
3387
  const isTauri = typeof window !== "undefined" && "__TAURI__" in window;
3389
3388
  const isBrowser = typeof window !== "undefined";
@@ -3430,6 +3429,9 @@ async function detectKkApiAvailability(forceLocalhost) {
3430
3429
  };
3431
3430
  }
3432
3431
  }
3432
+
3433
+ // src/index.ts
3434
+ var TAG7 = " | Pioneer-sdk | ";
3433
3435
  function formatTime(durationMs) {
3434
3436
  let seconds = Math.floor(durationMs / 1000 % 60);
3435
3437
  let minutes = Math.floor(durationMs / (1000 * 60) % 60);
package/dist/index.es.js CHANGED
@@ -3556,10 +3556,9 @@ function estimateTransactionFee(feeRate, unit, networkType, txSize) {
3556
3556
  }
3557
3557
  }
3558
3558
 
3559
- // src/index.ts
3560
- var TAG7 = " | Pioneer-sdk | ";
3559
+ // src/utils/kkapi-detection.ts
3561
3560
  async function detectKkApiAvailability(forceLocalhost) {
3562
- const tag5 = `${TAG7} | detectKkApiAvailability | `;
3561
+ const tag5 = " | detectKkApiAvailability | ";
3563
3562
  try {
3564
3563
  const isTauri = typeof window !== "undefined" && "__TAURI__" in window;
3565
3564
  const isBrowser = typeof window !== "undefined";
@@ -3606,6 +3605,9 @@ async function detectKkApiAvailability(forceLocalhost) {
3606
3605
  };
3607
3606
  }
3608
3607
  }
3608
+
3609
+ // src/index.ts
3610
+ var TAG7 = " | Pioneer-sdk | ";
3609
3611
  function formatTime(durationMs) {
3610
3612
  let seconds = Math.floor(durationMs / 1000 % 60);
3611
3613
  let minutes = Math.floor(durationMs / (1000 * 60) % 60);
package/dist/index.js CHANGED
@@ -3556,10 +3556,9 @@ function estimateTransactionFee(feeRate, unit, networkType, txSize) {
3556
3556
  }
3557
3557
  }
3558
3558
 
3559
- // src/index.ts
3560
- var TAG7 = " | Pioneer-sdk | ";
3559
+ // src/utils/kkapi-detection.ts
3561
3560
  async function detectKkApiAvailability(forceLocalhost) {
3562
- const tag5 = `${TAG7} | detectKkApiAvailability | `;
3561
+ const tag5 = " | detectKkApiAvailability | ";
3563
3562
  try {
3564
3563
  const isTauri = typeof window !== "undefined" && "__TAURI__" in window;
3565
3564
  const isBrowser = typeof window !== "undefined";
@@ -3606,6 +3605,9 @@ async function detectKkApiAvailability(forceLocalhost) {
3606
3605
  };
3607
3606
  }
3608
3607
  }
3608
+
3609
+ // src/index.ts
3610
+ var TAG7 = " | Pioneer-sdk | ";
3609
3611
  function formatTime(durationMs) {
3610
3612
  let seconds = Math.floor(durationMs / 1000 % 60);
3611
3613
  let minutes = Math.floor(durationMs / (1000 * 60) % 60);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "highlander",
3
3
  "name": "@pioneer-platform/pioneer-sdk",
4
- "version": "4.20.3",
4
+ "version": "4.20.4",
5
5
  "dependencies": {
6
6
  "@keepkey/keepkey-sdk": "^0.2.62",
7
7
  "@pioneer-platform/loggerdog": "^8.11.0",
package/src/index.ts CHANGED
@@ -15,73 +15,13 @@ import { TransactionManager } from './TransactionManager.js';
15
15
  import { createUnsignedTendermintTx } from './txbuilder/createUnsignedTendermintTx.js';
16
16
  import { createUnsignedStakingTx, type StakingTxParams } from './txbuilder/createUnsignedStakingTx.js';
17
17
  import { getFees, estimateTransactionFee, type NormalizedFeeRates, type FeeEstimate } from './fees/index.js';
18
+ // Utils
19
+ import { detectKkApiAvailability } from './utils/kkapi-detection.js';
20
+ import { formatTime } from './utils/format-time.js';
21
+ import { buildDashboardFromBalances } from './utils/build-dashboard.js';
18
22
 
19
23
  const TAG = ' | Pioneer-sdk | ';
20
24
 
21
- // Utility function to detect if kkapi is available with smart environment detection
22
- async function detectKkApiAvailability(forceLocalhost?: boolean): Promise<{
23
- isAvailable: boolean;
24
- baseUrl: string;
25
- basePath: string;
26
- }> {
27
- const tag = `${TAG} | detectKkApiAvailability | `;
28
-
29
- try {
30
- // Smart detection: Check environment (Tauri, browser, or Node.js)
31
- const isTauri = typeof window !== 'undefined' && '__TAURI__' in window;
32
- const isBrowser = typeof window !== 'undefined';
33
- const isNodeJS = typeof process !== 'undefined' && process.versions && process.versions.node;
34
- const isLocalhost = isBrowser && window.location.hostname === 'localhost';
35
-
36
- // If in Tauri, use kkapi:// (will be proxied by Tauri)
37
- if (isTauri) {
38
- return {
39
- isAvailable: true,
40
- baseUrl: 'kkapi://',
41
- basePath: 'kkapi://spec/swagger.json',
42
- };
43
- }
44
-
45
- // In Node.js test environment or localhost browser, test if localhost:1646 is available
46
- // Force localhost if flag is set
47
- const shouldTestLocalhost = forceLocalhost || isLocalhost || isNodeJS;
48
-
49
- if (shouldTestLocalhost) {
50
- const testEnv = isNodeJS ? 'Node.js test environment' : 'development browser';
51
- try {
52
- const httpResponse = await fetch('http://localhost:1646/api/v1/health', {
53
- method: 'GET',
54
- signal: AbortSignal.timeout(1000), // 1 second timeout for localhost
55
- });
56
-
57
- if (httpResponse.ok) {
58
- return {
59
- isAvailable: true,
60
- baseUrl: 'http://localhost:1646',
61
- basePath: 'http://localhost:1646/spec/swagger.json',
62
- };
63
- }
64
- } catch (httpError: any) {
65
- console.error('❌ [KKAPI DETECTION] HTTP localhost:1646 not available:', httpError.message);
66
- }
67
- }
68
-
69
- // Fallback for production non-Tauri or when vault server is not running
70
- console.warn('⚠️ [KKAPI DETECTION] Using fallback config (vault may not be available)');
71
- return {
72
- isAvailable: false,
73
- baseUrl: 'http://localhost:1646',
74
- basePath: 'http://localhost:1646/spec/swagger.json',
75
- };
76
- } catch (error) {
77
- console.error('❌ [KKAPI DETECTION] Error during detection:', error);
78
- return {
79
- isAvailable: false,
80
- baseUrl: 'http://localhost:1646',
81
- basePath: 'http://localhost:1646/spec/swagger.json',
82
- };
83
- }
84
- }
85
25
 
86
26
  export interface PioneerSDKConfig {
87
27
  appName: string;