@pioneer-platform/pioneer-sdk 4.21.11 → 4.21.12
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 +21 -1
- package/dist/index.es.js +21 -1
- package/dist/index.js +21 -1
- package/package.json +5 -5
- package/src/TransactionManager.ts +27 -2
- package/src/fees/index.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2752,7 +2752,27 @@ class TransactionManager {
|
|
|
2752
2752
|
this.events = events;
|
|
2753
2753
|
}
|
|
2754
2754
|
async classifyCaip(caip) {
|
|
2755
|
-
|
|
2755
|
+
let caipString;
|
|
2756
|
+
if (typeof caip === "string") {
|
|
2757
|
+
caipString = caip;
|
|
2758
|
+
} else if (caip && typeof caip === "object") {
|
|
2759
|
+
if (caip.caip && typeof caip.caip === "string") {
|
|
2760
|
+
caipString = caip.caip;
|
|
2761
|
+
} else if (caip.toString && typeof caip.toString === "function") {
|
|
2762
|
+
caipString = caip.toString();
|
|
2763
|
+
if (caipString === "[object Object]") {
|
|
2764
|
+
if (caip.chainId && caip.network) {
|
|
2765
|
+
caipString = `${caip.chainId}:${caip.network}`;
|
|
2766
|
+
} else {
|
|
2767
|
+
throw new Error(`Cannot extract CAIP string from object: ${JSON.stringify(caip)}`);
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
} else {
|
|
2771
|
+
throw new Error(`Cannot extract CAIP string from object: ${JSON.stringify(caip)}`);
|
|
2772
|
+
}
|
|
2773
|
+
} else {
|
|
2774
|
+
throw new Error(`Invalid CAIP parameter: ${caip}`);
|
|
2775
|
+
}
|
|
2756
2776
|
if (SUPPORTED_CAIPS.UTXO.includes(caipString))
|
|
2757
2777
|
return "UTXO";
|
|
2758
2778
|
if (SUPPORTED_CAIPS.TENDERMINT.includes(caipString))
|
package/dist/index.es.js
CHANGED
|
@@ -2928,7 +2928,27 @@ class TransactionManager {
|
|
|
2928
2928
|
this.events = events;
|
|
2929
2929
|
}
|
|
2930
2930
|
async classifyCaip(caip) {
|
|
2931
|
-
|
|
2931
|
+
let caipString;
|
|
2932
|
+
if (typeof caip === "string") {
|
|
2933
|
+
caipString = caip;
|
|
2934
|
+
} else if (caip && typeof caip === "object") {
|
|
2935
|
+
if (caip.caip && typeof caip.caip === "string") {
|
|
2936
|
+
caipString = caip.caip;
|
|
2937
|
+
} else if (caip.toString && typeof caip.toString === "function") {
|
|
2938
|
+
caipString = caip.toString();
|
|
2939
|
+
if (caipString === "[object Object]") {
|
|
2940
|
+
if (caip.chainId && caip.network) {
|
|
2941
|
+
caipString = `${caip.chainId}:${caip.network}`;
|
|
2942
|
+
} else {
|
|
2943
|
+
throw new Error(`Cannot extract CAIP string from object: ${JSON.stringify(caip)}`);
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
} else {
|
|
2947
|
+
throw new Error(`Cannot extract CAIP string from object: ${JSON.stringify(caip)}`);
|
|
2948
|
+
}
|
|
2949
|
+
} else {
|
|
2950
|
+
throw new Error(`Invalid CAIP parameter: ${caip}`);
|
|
2951
|
+
}
|
|
2932
2952
|
if (SUPPORTED_CAIPS.UTXO.includes(caipString))
|
|
2933
2953
|
return "UTXO";
|
|
2934
2954
|
if (SUPPORTED_CAIPS.TENDERMINT.includes(caipString))
|
package/dist/index.js
CHANGED
|
@@ -2928,7 +2928,27 @@ class TransactionManager {
|
|
|
2928
2928
|
this.events = events;
|
|
2929
2929
|
}
|
|
2930
2930
|
async classifyCaip(caip) {
|
|
2931
|
-
|
|
2931
|
+
let caipString;
|
|
2932
|
+
if (typeof caip === "string") {
|
|
2933
|
+
caipString = caip;
|
|
2934
|
+
} else if (caip && typeof caip === "object") {
|
|
2935
|
+
if (caip.caip && typeof caip.caip === "string") {
|
|
2936
|
+
caipString = caip.caip;
|
|
2937
|
+
} else if (caip.toString && typeof caip.toString === "function") {
|
|
2938
|
+
caipString = caip.toString();
|
|
2939
|
+
if (caipString === "[object Object]") {
|
|
2940
|
+
if (caip.chainId && caip.network) {
|
|
2941
|
+
caipString = `${caip.chainId}:${caip.network}`;
|
|
2942
|
+
} else {
|
|
2943
|
+
throw new Error(`Cannot extract CAIP string from object: ${JSON.stringify(caip)}`);
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
} else {
|
|
2947
|
+
throw new Error(`Cannot extract CAIP string from object: ${JSON.stringify(caip)}`);
|
|
2948
|
+
}
|
|
2949
|
+
} else {
|
|
2950
|
+
throw new Error(`Invalid CAIP parameter: ${caip}`);
|
|
2951
|
+
}
|
|
2932
2952
|
if (SUPPORTED_CAIPS.UTXO.includes(caipString))
|
|
2933
2953
|
return "UTXO";
|
|
2934
2954
|
if (SUPPORTED_CAIPS.TENDERMINT.includes(caipString))
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "highlander",
|
|
3
3
|
"name": "@pioneer-platform/pioneer-sdk",
|
|
4
|
-
"version": "4.21.
|
|
4
|
+
"version": "4.21.12",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@keepkey/keepkey-sdk": "^0.2.62",
|
|
7
7
|
"@pioneer-platform/loggerdog": "^8.11.0",
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"react-native": "./src/index.ts",
|
|
50
50
|
"repository": "https://github.com/thorswap/SwapKit.git",
|
|
51
|
+
"type": "module",
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
51
53
|
"scripts": {
|
|
52
54
|
"build": "bash scripts/build.sh",
|
|
53
55
|
"build:watch": "nodemon --watch src --exec 'bun run build'",
|
|
@@ -55,7 +57,5 @@
|
|
|
55
57
|
"lint": "eslint ./ --ext .ts,.tsx --fix; tsc --noEmit",
|
|
56
58
|
"test": "echo 'vitest --run'",
|
|
57
59
|
"test:coverage": "echo 'vitest run --coverage'"
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
"types": "./dist/index.d.ts"
|
|
61
|
-
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -45,9 +45,34 @@ export class TransactionManager {
|
|
|
45
45
|
this.events = events;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
async classifyCaip(caip:
|
|
48
|
+
async classifyCaip(caip: any): Promise<string> {
|
|
49
49
|
// Ensure caip is a string (handle case where it might be an object)
|
|
50
|
-
|
|
50
|
+
let caipString: string;
|
|
51
|
+
|
|
52
|
+
if (typeof caip === 'string') {
|
|
53
|
+
caipString = caip;
|
|
54
|
+
} else if (caip && typeof caip === 'object') {
|
|
55
|
+
// If it's an object, try to extract the caip string
|
|
56
|
+
// It might have a 'caip' property, or we need to stringify it
|
|
57
|
+
if (caip.caip && typeof caip.caip === 'string') {
|
|
58
|
+
caipString = caip.caip;
|
|
59
|
+
} else if (caip.toString && typeof caip.toString === 'function') {
|
|
60
|
+
caipString = caip.toString();
|
|
61
|
+
// If toString() returned "[object Object]", it's not helpful
|
|
62
|
+
if (caipString === '[object Object]') {
|
|
63
|
+
// Try to construct from chainId and network properties if they exist
|
|
64
|
+
if (caip.chainId && caip.network) {
|
|
65
|
+
caipString = `${caip.chainId}:${caip.network}`;
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error(`Cannot extract CAIP string from object: ${JSON.stringify(caip)}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
throw new Error(`Cannot extract CAIP string from object: ${JSON.stringify(caip)}`);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
throw new Error(`Invalid CAIP parameter: ${caip}`);
|
|
75
|
+
}
|
|
51
76
|
|
|
52
77
|
if (SUPPORTED_CAIPS.UTXO.includes(caipString)) return 'UTXO';
|
|
53
78
|
if (SUPPORTED_CAIPS.TENDERMINT.includes(caipString)) return 'TENDERMINT';
|
package/src/fees/index.ts
CHANGED
|
@@ -246,7 +246,7 @@ function normalizeFeeData(
|
|
|
246
246
|
averageValue = feeData.average.toString();
|
|
247
247
|
fastestValue = feeData.fastest.toString();
|
|
248
248
|
} else if (hasAverageFastFastest) {
|
|
249
|
-
//
|
|
249
|
+
// EVM API format: {average, fast, fastest}
|
|
250
250
|
slowValue = feeData.average.toString();
|
|
251
251
|
averageValue = feeData.fast.toString();
|
|
252
252
|
fastestValue = feeData.fastest.toString();
|