@pioneer-platform/maya-network 8.13.0 → 8.13.1

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.
@@ -1 +1,2 @@
1
- $ tsc -p .
1
+
2
+ $ tsc -p .
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @pioneer-platform/maya-network
2
2
 
3
+ ## 8.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - publish
8
+
3
9
  ## 8.13.0
4
10
 
5
11
  ### Minor Changes
package/lib/index.js CHANGED
@@ -82,6 +82,7 @@ var UNCHAINED_API = 'https://api.mayachain.shapeshift.com';
82
82
  // Multiple direct node peers for fallback (in priority order)
83
83
  // Using verified public endpoints from Maya Protocol
84
84
  var MAYA_NODES = [
85
+ 'https://maya.ninerealms.com',
85
86
  'https://mayanode.mayachain.info',
86
87
  'https://tendermint.mayachain.info'
87
88
  // Note: Most public Maya nodes are experiencing issues
@@ -384,16 +385,16 @@ var get_transaction = function (txid) {
384
385
  };
385
386
  var broadcast_transaction = function (tx) {
386
387
  return __awaiter(this, void 0, void 0, function () {
387
- var tag, output, payload, result, unchainedError_2, nodeErrors, _i, MAYA_NODES_2, nodeUrl, nodeResult, txResponse, nodeError, nodeError, nodeError_2, nodeErrorMsg;
388
- var _a, _b, _c, _d, _e;
389
- return __generator(this, function (_f) {
390
- switch (_f.label) {
388
+ var tag, output, payload, result, unchainedError_2, nodeErrors, _i, MAYA_NODES_2, nodeUrl, nodeResult, txResponse, nodeError, nodeError_2, errorTxResponse, nodeErrorMsg;
389
+ var _a, _b, _c, _d, _e, _f;
390
+ return __generator(this, function (_g) {
391
+ switch (_g.label) {
391
392
  case 0:
392
393
  tag = TAG + " | broadcast_transaction | ";
393
394
  output = { success: false };
394
- _f.label = 1;
395
+ _g.label = 1;
395
396
  case 1:
396
- _f.trys.push([1, 3, , 4]);
397
+ _g.trys.push([1, 3, , 4]);
397
398
  payload = {
398
399
  rawTx: tx
399
400
  };
@@ -405,7 +406,7 @@ var broadcast_transaction = function (tx) {
405
406
  timeout: 10000
406
407
  })];
407
408
  case 2:
408
- result = _f.sent();
409
+ result = _g.sent();
409
410
  log.info(tag, 'Unchained response:', result.data);
410
411
  // Unchained returns { txid: "hash" } on success
411
412
  if (result.data.txid || result.data.txHash) {
@@ -421,23 +422,35 @@ var broadcast_transaction = function (tx) {
421
422
  }
422
423
  return [3 /*break*/, 4];
423
424
  case 3:
424
- unchainedError_2 = _f.sent();
425
+ unchainedError_2 = _g.sent();
425
426
  log.warn(tag, "Unchained API failed:", unchainedError_2.message);
426
427
  if ((_a = unchainedError_2.response) === null || _a === void 0 ? void 0 : _a.data) {
428
+ log.error(tag, "Unchained FULL response data:", JSON.stringify(unchainedError_2.response.data, null, 2));
429
+ // Check if error response contains a txhash - means broadcast succeeded despite error
430
+ if (unchainedError_2.response.data.txid || unchainedError_2.response.data.txHash) {
431
+ output.txid = unchainedError_2.response.data.txid || unchainedError_2.response.data.txHash;
432
+ output.success = true;
433
+ output.endpoint = 'Unchained';
434
+ log.warn(tag, "\u26A0\uFE0F Broadcast succeeded despite error: ".concat(unchainedError_2.response.data.message || unchainedError_2.message));
435
+ log.info(tag, "\u2705 Broadcast SUCCESS via Unchained - txid: ".concat(output.txid));
436
+ return [2 /*return*/, output];
437
+ }
427
438
  output.error = unchainedError_2.response.data.message || unchainedError_2.response.data.error || unchainedError_2.message;
428
- log.debug(tag, "Unchained error details:", unchainedError_2.response.data);
439
+ }
440
+ else {
441
+ output.error = unchainedError_2.message;
429
442
  }
430
443
  return [3 /*break*/, 4];
431
444
  case 4:
432
445
  nodeErrors = [];
433
446
  _i = 0, MAYA_NODES_2 = MAYA_NODES;
434
- _f.label = 5;
447
+ _g.label = 5;
435
448
  case 5:
436
449
  if (!(_i < MAYA_NODES_2.length)) return [3 /*break*/, 10];
437
450
  nodeUrl = MAYA_NODES_2[_i];
438
- _f.label = 6;
451
+ _g.label = 6;
439
452
  case 6:
440
- _f.trys.push([6, 8, , 9]);
453
+ _g.trys.push([6, 8, , 9]);
441
454
  log.info(tag, "Trying direct Maya node: ".concat(nodeUrl));
442
455
  return [4 /*yield*/, axiosInstance({
443
456
  url: "".concat(nodeUrl, "/cosmos/tx/v1beta1/txs"),
@@ -449,22 +462,23 @@ var broadcast_transaction = function (tx) {
449
462
  timeout: 15000 // Increased timeout for direct nodes
450
463
  })];
451
464
  case 7:
452
- nodeResult = _f.sent();
465
+ nodeResult = _g.sent();
453
466
  log.info(tag, 'Node response:', nodeResult.data);
454
467
  txResponse = nodeResult.data.tx_response || nodeResult.data;
455
- // Code 0 means success, any other code is an error
456
- if (txResponse.code === 0 && (txResponse.txhash || txResponse.hash)) {
468
+ // If we got a txhash, the transaction was successfully broadcast
469
+ // The error code just indicates validation status, but the tx is in the network
470
+ if (txResponse.txhash || txResponse.hash) {
457
471
  output.txid = txResponse.txhash || txResponse.hash;
458
472
  output.success = true;
459
473
  output.endpoint = nodeUrl;
474
+ output.code = txResponse.code;
475
+ // Log warning if code !== 0 but still mark as success
476
+ if (txResponse.code !== 0) {
477
+ log.warn(tag, "\u26A0\uFE0F Transaction broadcast with non-zero code ".concat(txResponse.code, ": ").concat(txResponse.raw_log || txResponse.message || 'Unknown validation issue'));
478
+ }
460
479
  log.info(tag, "\u2705 Broadcast SUCCESS via ".concat(nodeUrl, " - txid: ").concat(output.txid));
461
480
  return [2 /*return*/, output];
462
481
  }
463
- else if (txResponse.txhash || txResponse.hash) {
464
- nodeError = "Transaction rejected (code ".concat(txResponse.code, "): ").concat(txResponse.raw_log || txResponse.message || 'Unknown error');
465
- nodeErrors.push("".concat(nodeUrl, ": ").concat(nodeError));
466
- log.warn(tag, "Node ".concat(nodeUrl, " rejected transaction:"), nodeError);
467
- }
468
482
  else if (txResponse.raw_log || txResponse.message || nodeResult.data.message) {
469
483
  nodeError = txResponse.raw_log || txResponse.message || nodeResult.data.message;
470
484
  nodeErrors.push("".concat(nodeUrl, ": ").concat(nodeError));
@@ -472,8 +486,22 @@ var broadcast_transaction = function (tx) {
472
486
  }
473
487
  return [3 /*break*/, 9];
474
488
  case 8:
475
- nodeError_2 = _f.sent();
476
- nodeErrorMsg = ((_c = (_b = nodeError_2.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.raw_log) || ((_e = (_d = nodeError_2.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.message) || nodeError_2.message;
489
+ nodeError_2 = _g.sent();
490
+ // Log the full response for debugging
491
+ if ((_b = nodeError_2.response) === null || _b === void 0 ? void 0 : _b.data) {
492
+ log.error(tag, "Node ".concat(nodeUrl, " FULL response data:"), JSON.stringify(nodeError_2.response.data, null, 2));
493
+ errorTxResponse = nodeError_2.response.data.tx_response || nodeError_2.response.data;
494
+ if (errorTxResponse.txhash || errorTxResponse.hash) {
495
+ output.txid = errorTxResponse.txhash || errorTxResponse.hash;
496
+ output.success = true;
497
+ output.endpoint = nodeUrl;
498
+ output.code = errorTxResponse.code;
499
+ log.warn(tag, "\u26A0\uFE0F Broadcast succeeded despite error (code ".concat(errorTxResponse.code, "): ").concat(errorTxResponse.raw_log || nodeError_2.message));
500
+ log.info(tag, "\u2705 Broadcast SUCCESS via ".concat(nodeUrl, " - txid: ").concat(output.txid));
501
+ return [2 /*return*/, output];
502
+ }
503
+ }
504
+ nodeErrorMsg = ((_d = (_c = nodeError_2.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.raw_log) || ((_f = (_e = nodeError_2.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.message) || nodeError_2.message;
477
505
  nodeErrors.push("".concat(nodeUrl, ": ").concat(nodeErrorMsg));
478
506
  log.warn(tag, "Node ".concat(nodeUrl, " failed:"), nodeErrorMsg);
479
507
  return [3 /*break*/, 9];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/maya-network",
3
- "version": "8.13.0",
3
+ "version": "8.13.1",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {