@pioneer-platform/pioneer-sdk 4.20.10 → 4.20.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 CHANGED
@@ -314,9 +314,9 @@ var require_lib = __commonJS((exports2) => {
314
314
  spec: specData_1,
315
315
  execute: function(request) {
316
316
  return __awaiter(_this, undefined, undefined, function() {
317
- var operationId, parameters, requestBody, targetPath, targetMethod, path, method, baseUrl, url, httpReq;
318
- return __generator(this, function(_a2) {
319
- switch (_a2.label) {
317
+ var operationId, parameters, requestBody, targetPath, targetMethod, path, method, baseUrl, finalPath, _i, _a2, _b2, key, value, placeholder, url, httpReq;
318
+ return __generator(this, function(_c) {
319
+ switch (_c.label) {
320
320
  case 0:
321
321
  operationId = request.operationId, parameters = request.parameters, requestBody = request.requestBody;
322
322
  targetPath = "";
@@ -339,7 +339,17 @@ var require_lib = __commonJS((exports2) => {
339
339
  if (specData_1.servers && specData_1.servers.length > 0) {
340
340
  baseUrl = specData_1.servers[0].url;
341
341
  }
342
- url = "".concat(baseUrl).concat(targetPath);
342
+ finalPath = targetPath;
343
+ if (parameters) {
344
+ for (_i = 0, _a2 = Object.entries(parameters);_i < _a2.length; _i++) {
345
+ _b2 = _a2[_i], key = _b2[0], value = _b2[1];
346
+ placeholder = "{".concat(key, "}");
347
+ if (finalPath.includes(placeholder)) {
348
+ finalPath = finalPath.replace(placeholder, encodeURIComponent(String(value)));
349
+ }
350
+ }
351
+ }
352
+ url = "".concat(baseUrl).concat(finalPath);
343
353
  httpReq = {
344
354
  method: targetMethod.toUpperCase(),
345
355
  url,
@@ -351,7 +361,7 @@ var require_lib = __commonJS((exports2) => {
351
361
  };
352
362
  return [4, customHttpClient(httpReq)];
353
363
  case 1:
354
- return [2, _a2.sent()];
364
+ return [2, _c.sent()];
355
365
  }
356
366
  });
357
367
  });
@@ -1881,7 +1891,7 @@ async function createUnsignedEvmTx(caip, to, amount, memo, pubkeys, pioneer, pub
1881
1891
  let nonce;
1882
1892
  try {
1883
1893
  const nonceData = await pioneer.GetNonceByNetwork({ networkId, address });
1884
- nonce = nonceData.data;
1894
+ nonce = nonceData.data.nonce;
1885
1895
  if (nonce === undefined || nonce === null) {
1886
1896
  console.log(tag5, "No nonce found for address (likely fresh address), defaulting to 0");
1887
1897
  nonce = 0;
@@ -1891,7 +1901,7 @@ async function createUnsignedEvmTx(caip, to, amount, memo, pubkeys, pioneer, pub
1891
1901
  nonce = 0;
1892
1902
  }
1893
1903
  const balanceData = await pioneer.GetBalanceAddressByNetwork({ networkId, address });
1894
- const balanceEth = balanceData.data;
1904
+ const balanceEth = parseFloat(balanceData.data.balance);
1895
1905
  const balance = BigInt(Math.round(balanceEth * 1000000000000000000));
1896
1906
  if (balance <= 0n)
1897
1907
  throw new Error("Wallet balance is zero");
package/dist/index.es.js CHANGED
@@ -297,9 +297,9 @@ var require_lib = __commonJS((exports) => {
297
297
  spec: specData_1,
298
298
  execute: function(request) {
299
299
  return __awaiter(_this, undefined, undefined, function() {
300
- var operationId, parameters, requestBody, targetPath, targetMethod, path, method, baseUrl, url, httpReq;
301
- return __generator(this, function(_a2) {
302
- switch (_a2.label) {
300
+ var operationId, parameters, requestBody, targetPath, targetMethod, path, method, baseUrl, finalPath, _i, _a2, _b2, key, value, placeholder, url, httpReq;
301
+ return __generator(this, function(_c) {
302
+ switch (_c.label) {
303
303
  case 0:
304
304
  operationId = request.operationId, parameters = request.parameters, requestBody = request.requestBody;
305
305
  targetPath = "";
@@ -322,7 +322,17 @@ var require_lib = __commonJS((exports) => {
322
322
  if (specData_1.servers && specData_1.servers.length > 0) {
323
323
  baseUrl = specData_1.servers[0].url;
324
324
  }
325
- url = "".concat(baseUrl).concat(targetPath);
325
+ finalPath = targetPath;
326
+ if (parameters) {
327
+ for (_i = 0, _a2 = Object.entries(parameters);_i < _a2.length; _i++) {
328
+ _b2 = _a2[_i], key = _b2[0], value = _b2[1];
329
+ placeholder = "{".concat(key, "}");
330
+ if (finalPath.includes(placeholder)) {
331
+ finalPath = finalPath.replace(placeholder, encodeURIComponent(String(value)));
332
+ }
333
+ }
334
+ }
335
+ url = "".concat(baseUrl).concat(finalPath);
326
336
  httpReq = {
327
337
  method: targetMethod.toUpperCase(),
328
338
  url,
@@ -334,7 +344,7 @@ var require_lib = __commonJS((exports) => {
334
344
  };
335
345
  return [4, customHttpClient(httpReq)];
336
346
  case 1:
337
- return [2, _a2.sent()];
347
+ return [2, _c.sent()];
338
348
  }
339
349
  });
340
350
  });
@@ -2057,7 +2067,7 @@ async function createUnsignedEvmTx(caip, to, amount, memo, pubkeys, pioneer, pub
2057
2067
  let nonce;
2058
2068
  try {
2059
2069
  const nonceData = await pioneer.GetNonceByNetwork({ networkId, address });
2060
- nonce = nonceData.data;
2070
+ nonce = nonceData.data.nonce;
2061
2071
  if (nonce === undefined || nonce === null) {
2062
2072
  console.log(tag5, "No nonce found for address (likely fresh address), defaulting to 0");
2063
2073
  nonce = 0;
@@ -2067,7 +2077,7 @@ async function createUnsignedEvmTx(caip, to, amount, memo, pubkeys, pioneer, pub
2067
2077
  nonce = 0;
2068
2078
  }
2069
2079
  const balanceData = await pioneer.GetBalanceAddressByNetwork({ networkId, address });
2070
- const balanceEth = balanceData.data;
2080
+ const balanceEth = parseFloat(balanceData.data.balance);
2071
2081
  const balance = BigInt(Math.round(balanceEth * 1000000000000000000));
2072
2082
  if (balance <= 0n)
2073
2083
  throw new Error("Wallet balance is zero");
package/dist/index.js CHANGED
@@ -297,9 +297,9 @@ var require_lib = __commonJS((exports) => {
297
297
  spec: specData_1,
298
298
  execute: function(request) {
299
299
  return __awaiter(_this, undefined, undefined, function() {
300
- var operationId, parameters, requestBody, targetPath, targetMethod, path, method, baseUrl, url, httpReq;
301
- return __generator(this, function(_a2) {
302
- switch (_a2.label) {
300
+ var operationId, parameters, requestBody, targetPath, targetMethod, path, method, baseUrl, finalPath, _i, _a2, _b2, key, value, placeholder, url, httpReq;
301
+ return __generator(this, function(_c) {
302
+ switch (_c.label) {
303
303
  case 0:
304
304
  operationId = request.operationId, parameters = request.parameters, requestBody = request.requestBody;
305
305
  targetPath = "";
@@ -322,7 +322,17 @@ var require_lib = __commonJS((exports) => {
322
322
  if (specData_1.servers && specData_1.servers.length > 0) {
323
323
  baseUrl = specData_1.servers[0].url;
324
324
  }
325
- url = "".concat(baseUrl).concat(targetPath);
325
+ finalPath = targetPath;
326
+ if (parameters) {
327
+ for (_i = 0, _a2 = Object.entries(parameters);_i < _a2.length; _i++) {
328
+ _b2 = _a2[_i], key = _b2[0], value = _b2[1];
329
+ placeholder = "{".concat(key, "}");
330
+ if (finalPath.includes(placeholder)) {
331
+ finalPath = finalPath.replace(placeholder, encodeURIComponent(String(value)));
332
+ }
333
+ }
334
+ }
335
+ url = "".concat(baseUrl).concat(finalPath);
326
336
  httpReq = {
327
337
  method: targetMethod.toUpperCase(),
328
338
  url,
@@ -334,7 +344,7 @@ var require_lib = __commonJS((exports) => {
334
344
  };
335
345
  return [4, customHttpClient(httpReq)];
336
346
  case 1:
337
- return [2, _a2.sent()];
347
+ return [2, _c.sent()];
338
348
  }
339
349
  });
340
350
  });
@@ -2057,7 +2067,7 @@ async function createUnsignedEvmTx(caip, to, amount, memo, pubkeys, pioneer, pub
2057
2067
  let nonce;
2058
2068
  try {
2059
2069
  const nonceData = await pioneer.GetNonceByNetwork({ networkId, address });
2060
- nonce = nonceData.data;
2070
+ nonce = nonceData.data.nonce;
2061
2071
  if (nonce === undefined || nonce === null) {
2062
2072
  console.log(tag5, "No nonce found for address (likely fresh address), defaulting to 0");
2063
2073
  nonce = 0;
@@ -2067,7 +2077,7 @@ async function createUnsignedEvmTx(caip, to, amount, memo, pubkeys, pioneer, pub
2067
2077
  nonce = 0;
2068
2078
  }
2069
2079
  const balanceData = await pioneer.GetBalanceAddressByNetwork({ networkId, address });
2070
- const balanceEth = balanceData.data;
2080
+ const balanceEth = parseFloat(balanceData.data.balance);
2071
2081
  const balance = BigInt(Math.round(balanceEth * 1000000000000000000));
2072
2082
  if (balance <= 0n)
2073
2083
  throw new Error("Wallet balance is zero");
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "author": "highlander",
3
3
  "name": "@pioneer-platform/pioneer-sdk",
4
- "version": "4.20.10",
4
+ "version": "4.20.12",
5
5
  "dependencies": {
6
6
  "@keepkey/keepkey-sdk": "^0.2.62",
7
7
  "@pioneer-platform/loggerdog": "^8.11.0",
8
8
  "@pioneer-platform/pioneer-caip": "^9.10.0",
9
- "@pioneer-platform/pioneer-client": "^9.10.3",
9
+ "@pioneer-platform/pioneer-client": "^9.10.4",
10
10
  "@pioneer-platform/pioneer-coins": "^9.11.0",
11
11
  "@pioneer-platform/pioneer-discovery": "^0.8.0",
12
12
  "@pioneer-platform/pioneer-events": "^8.11.0",
@@ -241,8 +241,8 @@ export async function createUnsignedEvmTx(
241
241
  let nonce;
242
242
  try {
243
243
  const nonceData = await pioneer.GetNonceByNetwork({ networkId, address });
244
- nonce = nonceData.data;
245
-
244
+ nonce = nonceData.data.nonce;
245
+
246
246
  // Handle fresh addresses that have never sent a transaction
247
247
  if (nonce === undefined || nonce === null) {
248
248
  console.log(tag, 'No nonce found for address (likely fresh address), defaulting to 0');
@@ -256,7 +256,7 @@ export async function createUnsignedEvmTx(
256
256
  //console.log(tag, 'nonce:', nonce);
257
257
 
258
258
  const balanceData = await pioneer.GetBalanceAddressByNetwork({ networkId, address });
259
- const balanceEth = balanceData.data; // Assuming this is in ETH
259
+ const balanceEth = parseFloat(balanceData.data.balance); // Assuming this is in ETH
260
260
  const balance = BigInt(Math.round(balanceEth * 1e18)); // Convert to wei
261
261
  //console.log(tag, 'balance (wei):', balance.toString());
262
262
  if (balance <= 0n) throw new Error('Wallet balance is zero');