@pioneer-platform/pioneer-sdk 8.15.40 → 8.15.41
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 +19 -6
- package/dist/index.es.js +19 -6
- package/dist/index.js +19 -6
- package/package.json +6 -6
- package/src/index.ts +28 -7
package/dist/index.cjs
CHANGED
|
@@ -5791,16 +5791,29 @@ class SDK {
|
|
|
5791
5791
|
throw e;
|
|
5792
5792
|
}
|
|
5793
5793
|
};
|
|
5794
|
-
this.getBalances = async function(
|
|
5794
|
+
this.getBalances = async function(forceRefreshOrOptions, caip) {
|
|
5795
5795
|
const tag6 = `${TAG12} | getBalances | `;
|
|
5796
5796
|
try {
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5797
|
+
let forceRefresh = false;
|
|
5798
|
+
let networkId;
|
|
5799
|
+
if (typeof forceRefreshOrOptions === "object") {
|
|
5800
|
+
networkId = forceRefreshOrOptions.networkId;
|
|
5801
|
+
forceRefresh = forceRefreshOrOptions.forceRefresh ?? false;
|
|
5802
|
+
console.log(tag6, `\uD83D\uDCCD New signature - networkId: ${networkId}, forceRefresh: ${forceRefresh}`);
|
|
5803
|
+
} else {
|
|
5804
|
+
forceRefresh = forceRefreshOrOptions ?? false;
|
|
5805
|
+
if (caip) {
|
|
5806
|
+
console.log(tag6, `\uD83C\uDFAF Old signature - Refreshing single asset: ${caip}`);
|
|
5807
|
+
networkId = caip.split("/")[0];
|
|
5808
|
+
console.log(tag6, `\uD83D\uDCCD Extracted networkId: ${networkId}`);
|
|
5809
|
+
}
|
|
5810
|
+
}
|
|
5811
|
+
if (networkId) {
|
|
5812
|
+
console.log(tag6, `\uD83C\uDFAF Refreshing specific network: ${networkId}`);
|
|
5801
5813
|
const results = await this.getBalancesForNetworks([networkId], forceRefresh);
|
|
5802
|
-
return results.filter((b) => b.
|
|
5814
|
+
return results.filter((b) => b.networkId === networkId || b.caip?.startsWith(networkId));
|
|
5803
5815
|
}
|
|
5816
|
+
console.log(tag6, `\uD83C\uDF10 Refreshing all blockchains (${this.blockchains.length} networks)`);
|
|
5804
5817
|
return await this.getBalancesForNetworks(this.blockchains, forceRefresh);
|
|
5805
5818
|
} catch (e) {
|
|
5806
5819
|
console.error(tag6, "Error in getBalances: ", e);
|
package/dist/index.es.js
CHANGED
|
@@ -5975,16 +5975,29 @@ class SDK {
|
|
|
5975
5975
|
throw e;
|
|
5976
5976
|
}
|
|
5977
5977
|
};
|
|
5978
|
-
this.getBalances = async function(
|
|
5978
|
+
this.getBalances = async function(forceRefreshOrOptions, caip) {
|
|
5979
5979
|
const tag6 = `${TAG12} | getBalances | `;
|
|
5980
5980
|
try {
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5981
|
+
let forceRefresh = false;
|
|
5982
|
+
let networkId;
|
|
5983
|
+
if (typeof forceRefreshOrOptions === "object") {
|
|
5984
|
+
networkId = forceRefreshOrOptions.networkId;
|
|
5985
|
+
forceRefresh = forceRefreshOrOptions.forceRefresh ?? false;
|
|
5986
|
+
console.log(tag6, `\uD83D\uDCCD New signature - networkId: ${networkId}, forceRefresh: ${forceRefresh}`);
|
|
5987
|
+
} else {
|
|
5988
|
+
forceRefresh = forceRefreshOrOptions ?? false;
|
|
5989
|
+
if (caip) {
|
|
5990
|
+
console.log(tag6, `\uD83C\uDFAF Old signature - Refreshing single asset: ${caip}`);
|
|
5991
|
+
networkId = caip.split("/")[0];
|
|
5992
|
+
console.log(tag6, `\uD83D\uDCCD Extracted networkId: ${networkId}`);
|
|
5993
|
+
}
|
|
5994
|
+
}
|
|
5995
|
+
if (networkId) {
|
|
5996
|
+
console.log(tag6, `\uD83C\uDFAF Refreshing specific network: ${networkId}`);
|
|
5985
5997
|
const results = await this.getBalancesForNetworks([networkId], forceRefresh);
|
|
5986
|
-
return results.filter((b2) => b2.
|
|
5998
|
+
return results.filter((b2) => b2.networkId === networkId || b2.caip?.startsWith(networkId));
|
|
5987
5999
|
}
|
|
6000
|
+
console.log(tag6, `\uD83C\uDF10 Refreshing all blockchains (${this.blockchains.length} networks)`);
|
|
5988
6001
|
return await this.getBalancesForNetworks(this.blockchains, forceRefresh);
|
|
5989
6002
|
} catch (e) {
|
|
5990
6003
|
console.error(tag6, "Error in getBalances: ", e);
|
package/dist/index.js
CHANGED
|
@@ -5975,16 +5975,29 @@ class SDK {
|
|
|
5975
5975
|
throw e;
|
|
5976
5976
|
}
|
|
5977
5977
|
};
|
|
5978
|
-
this.getBalances = async function(
|
|
5978
|
+
this.getBalances = async function(forceRefreshOrOptions, caip) {
|
|
5979
5979
|
const tag6 = `${TAG12} | getBalances | `;
|
|
5980
5980
|
try {
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5981
|
+
let forceRefresh = false;
|
|
5982
|
+
let networkId;
|
|
5983
|
+
if (typeof forceRefreshOrOptions === "object") {
|
|
5984
|
+
networkId = forceRefreshOrOptions.networkId;
|
|
5985
|
+
forceRefresh = forceRefreshOrOptions.forceRefresh ?? false;
|
|
5986
|
+
console.log(tag6, `\uD83D\uDCCD New signature - networkId: ${networkId}, forceRefresh: ${forceRefresh}`);
|
|
5987
|
+
} else {
|
|
5988
|
+
forceRefresh = forceRefreshOrOptions ?? false;
|
|
5989
|
+
if (caip) {
|
|
5990
|
+
console.log(tag6, `\uD83C\uDFAF Old signature - Refreshing single asset: ${caip}`);
|
|
5991
|
+
networkId = caip.split("/")[0];
|
|
5992
|
+
console.log(tag6, `\uD83D\uDCCD Extracted networkId: ${networkId}`);
|
|
5993
|
+
}
|
|
5994
|
+
}
|
|
5995
|
+
if (networkId) {
|
|
5996
|
+
console.log(tag6, `\uD83C\uDFAF Refreshing specific network: ${networkId}`);
|
|
5985
5997
|
const results = await this.getBalancesForNetworks([networkId], forceRefresh);
|
|
5986
|
-
return results.filter((b2) => b2.
|
|
5998
|
+
return results.filter((b2) => b2.networkId === networkId || b2.caip?.startsWith(networkId));
|
|
5987
5999
|
}
|
|
6000
|
+
console.log(tag6, `\uD83C\uDF10 Refreshing all blockchains (${this.blockchains.length} networks)`);
|
|
5988
6001
|
return await this.getBalancesForNetworks(this.blockchains, forceRefresh);
|
|
5989
6002
|
} catch (e) {
|
|
5990
6003
|
console.error(tag6, "Error in getBalances: ", e);
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "highlander",
|
|
3
3
|
"name": "@pioneer-platform/pioneer-sdk",
|
|
4
|
-
"version": "8.15.
|
|
4
|
+
"version": "8.15.41",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@keepkey/keepkey-sdk": "^0.2.62",
|
|
7
|
-
"@pioneer-platform/pioneer-caip": "^9.10.
|
|
8
|
-
"@pioneer-platform/pioneer-client": "^9.10.
|
|
9
|
-
"@pioneer-platform/pioneer-coins": "^9.11.
|
|
10
|
-
"@pioneer-platform/pioneer-discovery": "^8.15.
|
|
11
|
-
"@pioneer-platform/pioneer-events": "^8.12.
|
|
7
|
+
"@pioneer-platform/pioneer-caip": "^9.10.18",
|
|
8
|
+
"@pioneer-platform/pioneer-client": "^9.10.24",
|
|
9
|
+
"@pioneer-platform/pioneer-coins": "^9.11.18",
|
|
10
|
+
"@pioneer-platform/pioneer-discovery": "^8.15.41",
|
|
11
|
+
"@pioneer-platform/pioneer-events": "^8.12.13",
|
|
12
12
|
"coinselect": "^3.1.13",
|
|
13
13
|
"eventemitter3": "^5.0.1",
|
|
14
14
|
"neotraverse": "^0.6.8",
|
package/src/index.ts
CHANGED
|
@@ -1672,20 +1672,41 @@ export class SDK {
|
|
|
1672
1672
|
throw e;
|
|
1673
1673
|
}
|
|
1674
1674
|
};
|
|
1675
|
-
this.getBalances = async function (
|
|
1675
|
+
this.getBalances = async function (
|
|
1676
|
+
forceRefreshOrOptions?: boolean | { networkId?: string; forceRefresh?: boolean },
|
|
1677
|
+
caip?: string
|
|
1678
|
+
) {
|
|
1676
1679
|
const tag = `${TAG} | getBalances | `;
|
|
1677
1680
|
try {
|
|
1678
|
-
//
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1681
|
+
// Parse parameters - support both old and new signatures
|
|
1682
|
+
let forceRefresh = false;
|
|
1683
|
+
let networkId: string | undefined;
|
|
1684
|
+
|
|
1685
|
+
if (typeof forceRefreshOrOptions === 'object') {
|
|
1686
|
+
// New signature: getBalances({ networkId, forceRefresh })
|
|
1687
|
+
networkId = forceRefreshOrOptions.networkId;
|
|
1688
|
+
forceRefresh = forceRefreshOrOptions.forceRefresh ?? false;
|
|
1689
|
+
console.log(tag, `📍 New signature - networkId: ${networkId}, forceRefresh: ${forceRefresh}`);
|
|
1690
|
+
} else {
|
|
1691
|
+
// Old signature: getBalances(forceRefresh, caip)
|
|
1692
|
+
forceRefresh = forceRefreshOrOptions ?? false;
|
|
1693
|
+
|
|
1694
|
+
if (caip) {
|
|
1695
|
+
console.log(tag, `🎯 Old signature - Refreshing single asset: ${caip}`);
|
|
1696
|
+
networkId = caip.split('/')[0];
|
|
1697
|
+
console.log(tag, `📍 Extracted networkId: ${networkId}`);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1683
1700
|
|
|
1701
|
+
// If networkId is provided, refresh only that network
|
|
1702
|
+
if (networkId) {
|
|
1703
|
+
console.log(tag, `🎯 Refreshing specific network: ${networkId}`);
|
|
1684
1704
|
const results = await this.getBalancesForNetworks([networkId], forceRefresh);
|
|
1685
|
-
return results.filter((b) => b.
|
|
1705
|
+
return results.filter((b) => b.networkId === networkId || b.caip?.startsWith(networkId));
|
|
1686
1706
|
}
|
|
1687
1707
|
|
|
1688
1708
|
// Default: refresh all blockchains
|
|
1709
|
+
console.log(tag, `🌐 Refreshing all blockchains (${this.blockchains.length} networks)`);
|
|
1689
1710
|
return await this.getBalancesForNetworks(this.blockchains, forceRefresh);
|
|
1690
1711
|
} catch (e) {
|
|
1691
1712
|
console.error(tag, 'Error in getBalances: ', e);
|