@pioneer-platform/pioneer-sdk 8.15.2 → 8.15.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
@@ -654,12 +654,19 @@ async function getCosmosStakingCharts(params) {
654
654
  } catch (_) {
655
655
  }
656
656
  console.log(tag4, "Adding Cosmos staking positions to charts...");
657
+ console.log(tag4, "Total pubkeys:", pubkeys.length);
658
+ console.log(tag4, "All pubkeys:", pubkeys.map((p) => ({ address: p.address, networks: p.networks })));
657
659
  const cosmosPubkeys = pubkeys.filter((p) => p.networks && Array.isArray(p.networks) && p.networks.some((n) => n.includes("cosmos:cosmoshub") || n.includes("cosmos:osmosis")));
658
660
  if (cosmosPubkeys.length === 0) {
659
661
  console.log(tag4, "No cosmos pubkeys found for staking positions");
662
+ console.log(tag4, "Available networks across all pubkeys:", pubkeys.flatMap((p) => p.networks || []).filter((n) => n));
660
663
  return balances;
661
664
  }
662
665
  console.log(tag4, "Found cosmos pubkeys for staking:", cosmosPubkeys.length);
666
+ console.log(tag4, "Cosmos pubkeys details:", cosmosPubkeys.map((p) => ({
667
+ address: p.address,
668
+ networks: p.networks.filter((n) => n.includes("cosmos"))
669
+ })));
663
670
  await Promise.allSettled(cosmosPubkeys.map(async (cosmosPubkey) => {
664
671
  if (!cosmosPubkey.address)
665
672
  return;
@@ -753,6 +760,9 @@ var tag5 = "| getCharts |", getCharts = async (blockchains, pioneer, pubkeys, co
753
760
  try {
754
761
  const balances = [];
755
762
  console.log(tag5, "init");
763
+ console.log(tag5, "blockchains passed to getCharts:", blockchains);
764
+ console.log(tag5, "pubkeys count:", pubkeys?.length || 0);
765
+ console.log(tag5, "context:", context);
756
766
  const params = {
757
767
  blockchains,
758
768
  pioneer,
@@ -1982,9 +1992,16 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
1982
1992
  accountInfo = accountInfo.data;
1983
1993
  const sequence = accountInfo.Sequence.toString();
1984
1994
  const ledgerIndexCurrent = parseInt(accountInfo.ledger_index_current);
1985
- let desttag = memo;
1986
- if (!desttag || /^\s*$/.test(desttag) || isNaN(desttag)) {
1987
- desttag = "0";
1995
+ let desttag = undefined;
1996
+ if (memo && memo.trim() !== "") {
1997
+ if (!/^\d+$/.test(memo.trim())) {
1998
+ throw new Error(`XRP destination tag must be numeric. Got: "${memo}"`);
1999
+ }
2000
+ const tagNum = parseInt(memo.trim(), 10);
2001
+ if (isNaN(tagNum) || tagNum < 0 || tagNum > 4294967295) {
2002
+ throw new Error(`XRP destination tag must be 0-4294967295. Got: ${memo}`);
2003
+ }
2004
+ desttag = tagNum.toString();
1988
2005
  }
1989
2006
  if (isMax) {
1990
2007
  amount = Number(accountInfo.Balance) - 1e6 - 1;
@@ -1993,6 +2010,22 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
1993
2010
  amount = amount * 1e6;
1994
2011
  amount = amount.toString();
1995
2012
  }
2013
+ const msg = {
2014
+ type: "ripple-sdk/MsgSend",
2015
+ value: {
2016
+ amount: [
2017
+ {
2018
+ amount,
2019
+ denom: "drop"
2020
+ }
2021
+ ],
2022
+ from_address: fromAddress,
2023
+ to_address: to
2024
+ }
2025
+ };
2026
+ if (desttag !== undefined) {
2027
+ msg.DestinationTag = desttag;
2028
+ }
1996
2029
  let tx = {
1997
2030
  type: "auth/StdTx",
1998
2031
  value: {
@@ -2006,36 +2039,24 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
2006
2039
  gas: "28000"
2007
2040
  },
2008
2041
  memo: memo || "",
2009
- msg: [
2010
- {
2011
- type: "ripple-sdk/MsgSend",
2012
- DestinationTag: desttag,
2013
- value: {
2014
- amount: [
2015
- {
2016
- amount,
2017
- denom: "drop"
2018
- }
2019
- ],
2020
- from_address: fromAddress,
2021
- to_address: to
2022
- }
2023
- }
2024
- ],
2042
+ msg: [msg],
2025
2043
  signatures: null
2026
2044
  }
2027
2045
  };
2046
+ const payment = {
2047
+ amount,
2048
+ destination: to
2049
+ };
2050
+ if (desttag !== undefined) {
2051
+ payment.destinationTag = desttag;
2052
+ }
2028
2053
  let unsignedTx = {
2029
2054
  addressNList: [2147483692, 2147483792, 2147483648, 0, 0],
2030
2055
  tx,
2031
2056
  flags: undefined,
2032
2057
  lastLedgerSequence: (ledgerIndexCurrent + 1000).toString(),
2033
2058
  sequence: sequence || "0",
2034
- payment: {
2035
- amount,
2036
- destination: to,
2037
- destinationTag: desttag
2038
- }
2059
+ payment
2039
2060
  };
2040
2061
  return unsignedTx;
2041
2062
  } catch (error) {
package/dist/index.es.js CHANGED
@@ -645,12 +645,19 @@ async function getCosmosStakingCharts(params) {
645
645
  } catch (_2) {
646
646
  }
647
647
  console.log(tag4, "Adding Cosmos staking positions to charts...");
648
+ console.log(tag4, "Total pubkeys:", pubkeys.length);
649
+ console.log(tag4, "All pubkeys:", pubkeys.map((p) => ({ address: p.address, networks: p.networks })));
648
650
  const cosmosPubkeys = pubkeys.filter((p) => p.networks && Array.isArray(p.networks) && p.networks.some((n) => n.includes("cosmos:cosmoshub") || n.includes("cosmos:osmosis")));
649
651
  if (cosmosPubkeys.length === 0) {
650
652
  console.log(tag4, "No cosmos pubkeys found for staking positions");
653
+ console.log(tag4, "Available networks across all pubkeys:", pubkeys.flatMap((p) => p.networks || []).filter((n) => n));
651
654
  return balances;
652
655
  }
653
656
  console.log(tag4, "Found cosmos pubkeys for staking:", cosmosPubkeys.length);
657
+ console.log(tag4, "Cosmos pubkeys details:", cosmosPubkeys.map((p) => ({
658
+ address: p.address,
659
+ networks: p.networks.filter((n) => n.includes("cosmos"))
660
+ })));
654
661
  await Promise.allSettled(cosmosPubkeys.map(async (cosmosPubkey) => {
655
662
  if (!cosmosPubkey.address)
656
663
  return;
@@ -744,6 +751,9 @@ var tag5 = "| getCharts |", getCharts = async (blockchains, pioneer, pubkeys, co
744
751
  try {
745
752
  const balances = [];
746
753
  console.log(tag5, "init");
754
+ console.log(tag5, "blockchains passed to getCharts:", blockchains);
755
+ console.log(tag5, "pubkeys count:", pubkeys?.length || 0);
756
+ console.log(tag5, "context:", context);
747
757
  const params = {
748
758
  blockchains,
749
759
  pioneer,
@@ -2166,9 +2176,16 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
2166
2176
  accountInfo = accountInfo.data;
2167
2177
  const sequence = accountInfo.Sequence.toString();
2168
2178
  const ledgerIndexCurrent = parseInt(accountInfo.ledger_index_current);
2169
- let desttag = memo;
2170
- if (!desttag || /^\s*$/.test(desttag) || isNaN(desttag)) {
2171
- desttag = "0";
2179
+ let desttag = undefined;
2180
+ if (memo && memo.trim() !== "") {
2181
+ if (!/^\d+$/.test(memo.trim())) {
2182
+ throw new Error(`XRP destination tag must be numeric. Got: "${memo}"`);
2183
+ }
2184
+ const tagNum = parseInt(memo.trim(), 10);
2185
+ if (isNaN(tagNum) || tagNum < 0 || tagNum > 4294967295) {
2186
+ throw new Error(`XRP destination tag must be 0-4294967295. Got: ${memo}`);
2187
+ }
2188
+ desttag = tagNum.toString();
2172
2189
  }
2173
2190
  if (isMax) {
2174
2191
  amount = Number(accountInfo.Balance) - 1e6 - 1;
@@ -2177,6 +2194,22 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
2177
2194
  amount = amount * 1e6;
2178
2195
  amount = amount.toString();
2179
2196
  }
2197
+ const msg = {
2198
+ type: "ripple-sdk/MsgSend",
2199
+ value: {
2200
+ amount: [
2201
+ {
2202
+ amount,
2203
+ denom: "drop"
2204
+ }
2205
+ ],
2206
+ from_address: fromAddress,
2207
+ to_address: to
2208
+ }
2209
+ };
2210
+ if (desttag !== undefined) {
2211
+ msg.DestinationTag = desttag;
2212
+ }
2180
2213
  let tx = {
2181
2214
  type: "auth/StdTx",
2182
2215
  value: {
@@ -2190,36 +2223,24 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
2190
2223
  gas: "28000"
2191
2224
  },
2192
2225
  memo: memo || "",
2193
- msg: [
2194
- {
2195
- type: "ripple-sdk/MsgSend",
2196
- DestinationTag: desttag,
2197
- value: {
2198
- amount: [
2199
- {
2200
- amount,
2201
- denom: "drop"
2202
- }
2203
- ],
2204
- from_address: fromAddress,
2205
- to_address: to
2206
- }
2207
- }
2208
- ],
2226
+ msg: [msg],
2209
2227
  signatures: null
2210
2228
  }
2211
2229
  };
2230
+ const payment = {
2231
+ amount,
2232
+ destination: to
2233
+ };
2234
+ if (desttag !== undefined) {
2235
+ payment.destinationTag = desttag;
2236
+ }
2212
2237
  let unsignedTx = {
2213
2238
  addressNList: [2147483692, 2147483792, 2147483648, 0, 0],
2214
2239
  tx,
2215
2240
  flags: undefined,
2216
2241
  lastLedgerSequence: (ledgerIndexCurrent + 1000).toString(),
2217
2242
  sequence: sequence || "0",
2218
- payment: {
2219
- amount,
2220
- destination: to,
2221
- destinationTag: desttag
2222
- }
2243
+ payment
2223
2244
  };
2224
2245
  return unsignedTx;
2225
2246
  } catch (error) {
package/dist/index.js CHANGED
@@ -645,12 +645,19 @@ async function getCosmosStakingCharts(params) {
645
645
  } catch (_2) {
646
646
  }
647
647
  console.log(tag4, "Adding Cosmos staking positions to charts...");
648
+ console.log(tag4, "Total pubkeys:", pubkeys.length);
649
+ console.log(tag4, "All pubkeys:", pubkeys.map((p) => ({ address: p.address, networks: p.networks })));
648
650
  const cosmosPubkeys = pubkeys.filter((p) => p.networks && Array.isArray(p.networks) && p.networks.some((n) => n.includes("cosmos:cosmoshub") || n.includes("cosmos:osmosis")));
649
651
  if (cosmosPubkeys.length === 0) {
650
652
  console.log(tag4, "No cosmos pubkeys found for staking positions");
653
+ console.log(tag4, "Available networks across all pubkeys:", pubkeys.flatMap((p) => p.networks || []).filter((n) => n));
651
654
  return balances;
652
655
  }
653
656
  console.log(tag4, "Found cosmos pubkeys for staking:", cosmosPubkeys.length);
657
+ console.log(tag4, "Cosmos pubkeys details:", cosmosPubkeys.map((p) => ({
658
+ address: p.address,
659
+ networks: p.networks.filter((n) => n.includes("cosmos"))
660
+ })));
654
661
  await Promise.allSettled(cosmosPubkeys.map(async (cosmosPubkey) => {
655
662
  if (!cosmosPubkey.address)
656
663
  return;
@@ -744,6 +751,9 @@ var tag5 = "| getCharts |", getCharts = async (blockchains, pioneer, pubkeys, co
744
751
  try {
745
752
  const balances = [];
746
753
  console.log(tag5, "init");
754
+ console.log(tag5, "blockchains passed to getCharts:", blockchains);
755
+ console.log(tag5, "pubkeys count:", pubkeys?.length || 0);
756
+ console.log(tag5, "context:", context);
747
757
  const params = {
748
758
  blockchains,
749
759
  pioneer,
@@ -2166,9 +2176,16 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
2166
2176
  accountInfo = accountInfo.data;
2167
2177
  const sequence = accountInfo.Sequence.toString();
2168
2178
  const ledgerIndexCurrent = parseInt(accountInfo.ledger_index_current);
2169
- let desttag = memo;
2170
- if (!desttag || /^\s*$/.test(desttag) || isNaN(desttag)) {
2171
- desttag = "0";
2179
+ let desttag = undefined;
2180
+ if (memo && memo.trim() !== "") {
2181
+ if (!/^\d+$/.test(memo.trim())) {
2182
+ throw new Error(`XRP destination tag must be numeric. Got: "${memo}"`);
2183
+ }
2184
+ const tagNum = parseInt(memo.trim(), 10);
2185
+ if (isNaN(tagNum) || tagNum < 0 || tagNum > 4294967295) {
2186
+ throw new Error(`XRP destination tag must be 0-4294967295. Got: ${memo}`);
2187
+ }
2188
+ desttag = tagNum.toString();
2172
2189
  }
2173
2190
  if (isMax) {
2174
2191
  amount = Number(accountInfo.Balance) - 1e6 - 1;
@@ -2177,6 +2194,22 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
2177
2194
  amount = amount * 1e6;
2178
2195
  amount = amount.toString();
2179
2196
  }
2197
+ const msg = {
2198
+ type: "ripple-sdk/MsgSend",
2199
+ value: {
2200
+ amount: [
2201
+ {
2202
+ amount,
2203
+ denom: "drop"
2204
+ }
2205
+ ],
2206
+ from_address: fromAddress,
2207
+ to_address: to
2208
+ }
2209
+ };
2210
+ if (desttag !== undefined) {
2211
+ msg.DestinationTag = desttag;
2212
+ }
2180
2213
  let tx = {
2181
2214
  type: "auth/StdTx",
2182
2215
  value: {
@@ -2190,36 +2223,24 @@ async function createUnsignedRippleTx(caip, to, amount, memo, pubkeys, pioneer,
2190
2223
  gas: "28000"
2191
2224
  },
2192
2225
  memo: memo || "",
2193
- msg: [
2194
- {
2195
- type: "ripple-sdk/MsgSend",
2196
- DestinationTag: desttag,
2197
- value: {
2198
- amount: [
2199
- {
2200
- amount,
2201
- denom: "drop"
2202
- }
2203
- ],
2204
- from_address: fromAddress,
2205
- to_address: to
2206
- }
2207
- }
2208
- ],
2226
+ msg: [msg],
2209
2227
  signatures: null
2210
2228
  }
2211
2229
  };
2230
+ const payment = {
2231
+ amount,
2232
+ destination: to
2233
+ };
2234
+ if (desttag !== undefined) {
2235
+ payment.destinationTag = desttag;
2236
+ }
2212
2237
  let unsignedTx = {
2213
2238
  addressNList: [2147483692, 2147483792, 2147483648, 0, 0],
2214
2239
  tx,
2215
2240
  flags: undefined,
2216
2241
  lastLedgerSequence: (ledgerIndexCurrent + 1000).toString(),
2217
2242
  sequence: sequence || "0",
2218
- payment: {
2219
- amount,
2220
- destination: to,
2221
- destinationTag: desttag
2222
- }
2243
+ payment
2223
2244
  };
2224
2245
  return unsignedTx;
2225
2246
  } catch (error) {
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.2",
4
+ "version": "8.15.4",
5
5
  "dependencies": {
6
6
  "@keepkey/keepkey-sdk": "^0.2.62",
7
7
  "@pioneer-platform/loggerdog": "^8.11.0",
@@ -21,6 +21,8 @@ export async function getCosmosStakingCharts(params: ChartParams): Promise<Chart
21
21
  }
22
22
 
23
23
  console.log(tag, 'Adding Cosmos staking positions to charts...');
24
+ console.log(tag, 'Total pubkeys:', pubkeys.length);
25
+ console.log(tag, 'All pubkeys:', pubkeys.map((p: any) => ({ address: p.address, networks: p.networks })));
24
26
 
25
27
  // Find cosmos pubkeys that could have staking positions
26
28
  const cosmosPubkeys = pubkeys.filter(
@@ -34,10 +36,17 @@ export async function getCosmosStakingCharts(params: ChartParams): Promise<Chart
34
36
 
35
37
  if (cosmosPubkeys.length === 0) {
36
38
  console.log(tag, 'No cosmos pubkeys found for staking positions');
39
+ console.log(tag, 'Available networks across all pubkeys:',
40
+ pubkeys.flatMap((p: any) => p.networks || []).filter((n: any) => n)
41
+ );
37
42
  return balances;
38
43
  }
39
44
 
40
45
  console.log(tag, 'Found cosmos pubkeys for staking:', cosmosPubkeys.length);
46
+ console.log(tag, 'Cosmos pubkeys details:', cosmosPubkeys.map((p: any) => ({
47
+ address: p.address,
48
+ networks: p.networks.filter((n: string) => n.includes('cosmos'))
49
+ })));
41
50
 
42
51
  await Promise.allSettled(
43
52
  cosmosPubkeys.map(async (cosmosPubkey: any) => {
@@ -15,7 +15,10 @@ export const getCharts = async (
15
15
  try {
16
16
  const balances: ChartBalance[] = [];
17
17
  console.log(tag, 'init');
18
-
18
+ console.log(tag, 'blockchains passed to getCharts:', blockchains);
19
+ console.log(tag, 'pubkeys count:', pubkeys?.length || 0);
20
+ console.log(tag, 'context:', context);
21
+
19
22
  const params: ChartParams = {
20
23
  blockchains,
21
24
  pioneer,
@@ -50,11 +50,22 @@ export async function createUnsignedRippleTx(
50
50
 
51
51
  const sequence = accountInfo.Sequence.toString();
52
52
  const ledgerIndexCurrent = parseInt(accountInfo.ledger_index_current);
53
- let desttag = memo;
54
- // Check if desttag is null, undefined, a space, or any non-numeric value
55
- //@ts-ignore
56
- if (!desttag || /^\s*$/.test(desttag) || isNaN(desttag)) {
57
- desttag = '0';
53
+
54
+ // XRP Destination Tag Validation (CRITICAL: uint32 range 0-4294967295)
55
+ let desttag: string | undefined = undefined;
56
+ if (memo && memo.trim() !== '') {
57
+ // Must be numeric
58
+ if (!/^\d+$/.test(memo.trim())) {
59
+ throw new Error(`XRP destination tag must be numeric. Got: "${memo}"`);
60
+ }
61
+
62
+ // Must be in valid range (uint32)
63
+ const tagNum = parseInt(memo.trim(), 10);
64
+ if (isNaN(tagNum) || tagNum < 0 || tagNum > 4294967295) {
65
+ throw new Error(`XRP destination tag must be 0-4294967295. Got: ${memo}`);
66
+ }
67
+
68
+ desttag = tagNum.toString();
58
69
  }
59
70
 
60
71
  //console.log(tag, 'amount:', amount);
@@ -68,6 +79,24 @@ export async function createUnsignedRippleTx(
68
79
  amount = amount.toString();
69
80
  }
70
81
 
82
+ // Build message - only include DestinationTag if provided
83
+ const msg: any = {
84
+ type: 'ripple-sdk/MsgSend',
85
+ value: {
86
+ amount: [
87
+ {
88
+ amount: amount,
89
+ denom: 'drop',
90
+ },
91
+ ],
92
+ from_address: fromAddress,
93
+ to_address: to,
94
+ },
95
+ };
96
+ if (desttag !== undefined) {
97
+ msg.DestinationTag = desttag;
98
+ }
99
+
71
100
  let tx = {
72
101
  type: 'auth/StdTx',
73
102
  value: {
@@ -81,26 +110,20 @@ export async function createUnsignedRippleTx(
81
110
  gas: '28000',
82
111
  },
83
112
  memo: memo || '',
84
- msg: [
85
- {
86
- type: 'ripple-sdk/MsgSend',
87
- DestinationTag: desttag,
88
- value: {
89
- amount: [
90
- {
91
- amount: amount,
92
- denom: 'drop',
93
- },
94
- ],
95
- from_address: fromAddress,
96
- to_address: to,
97
- },
98
- },
99
- ],
113
+ msg: [msg],
100
114
  signatures: null,
101
115
  },
102
116
  };
103
117
 
118
+ // Build payment object - only include destinationTag if provided
119
+ const payment: any = {
120
+ amount,
121
+ destination: to,
122
+ };
123
+ if (desttag !== undefined) {
124
+ payment.destinationTag = desttag;
125
+ }
126
+
104
127
  //Unsigned TX
105
128
  let unsignedTx = {
106
129
  addressNList: [2147483692, 2147483792, 2147483648, 0, 0],
@@ -108,11 +131,7 @@ export async function createUnsignedRippleTx(
108
131
  flags: undefined,
109
132
  lastLedgerSequence: (ledgerIndexCurrent + 1000).toString(), // Add 1000 ledgers (~16 minutes) for transaction validity
110
133
  sequence: sequence || '0',
111
- payment: {
112
- amount,
113
- destination: to,
114
- destinationTag: desttag,
115
- },
134
+ payment,
116
135
  };
117
136
 
118
137
  return unsignedTx;