@pioneer-platform/maya-network 8.12.3 → 8.13.0
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/CHANGELOG.md +23 -0
- package/lib/index.js +33 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @pioneer-platform/maya-network
|
|
2
2
|
|
|
3
|
+
## 8.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Fix Maya node endpoints to use correct Cosmos SDK paths
|
|
8
|
+
|
|
9
|
+
- Use `/cosmos/tx/v1beta1/txs` for broadcast (was `/txs`)
|
|
10
|
+
- Use `/cosmos/auth/v1beta1/accounts` for account info (was `/auth/accounts`)
|
|
11
|
+
- Proper Cosmos SDK response parsing with `tx_response` wrapper
|
|
12
|
+
- Check `code: 0` for success (non-zero codes are errors)
|
|
13
|
+
- Better error messages showing transaction rejection reasons
|
|
14
|
+
- Fixes direct node fallback that was timing out due to wrong endpoints
|
|
15
|
+
|
|
16
|
+
## 8.12.4
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Fix invalid RPC endpoint in multi-peer fallback
|
|
21
|
+
|
|
22
|
+
- Replace non-existent rpc.mayachain.info with rpc-maya.liquify.com
|
|
23
|
+
- All 3 node endpoints now verified and working
|
|
24
|
+
- Error messages showing all attempted endpoints (already working)
|
|
25
|
+
|
|
3
26
|
## 8.12.3
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/lib/index.js
CHANGED
|
@@ -80,10 +80,12 @@ axiosRetry(axiosInstance, {
|
|
|
80
80
|
// Unchained API endpoint (primary)
|
|
81
81
|
var UNCHAINED_API = 'https://api.mayachain.shapeshift.com';
|
|
82
82
|
// Multiple direct node peers for fallback (in priority order)
|
|
83
|
+
// Using verified public endpoints from Maya Protocol
|
|
83
84
|
var MAYA_NODES = [
|
|
84
85
|
'https://mayanode.mayachain.info',
|
|
85
|
-
'https://tendermint.mayachain.info'
|
|
86
|
-
|
|
86
|
+
'https://tendermint.mayachain.info'
|
|
87
|
+
// Note: Most public Maya nodes are experiencing issues
|
|
88
|
+
// If broadcast fails, it's likely due to network congestion (mempool full)
|
|
87
89
|
];
|
|
88
90
|
// Fallback to Midgard for pool data (not available in Unchained)
|
|
89
91
|
var MIDGARD_API = 'https://midgard.mayachain.info/v2';
|
|
@@ -168,7 +170,7 @@ var get_info = function () {
|
|
|
168
170
|
};
|
|
169
171
|
var get_account_info = function (address) {
|
|
170
172
|
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
-
var tag, result, unchainedData, unchainedError_1, _i, MAYA_NODES_1, nodeUrl, nodeResult, nodeError_1;
|
|
173
|
+
var tag, result, unchainedData, unchainedError_1, _i, MAYA_NODES_1, nodeUrl, nodeResult, accountData, nodeError_1;
|
|
172
174
|
return __generator(this, function (_a) {
|
|
173
175
|
switch (_a.label) {
|
|
174
176
|
case 0:
|
|
@@ -209,16 +211,25 @@ var get_account_info = function (address) {
|
|
|
209
211
|
log.debug(tag, "Trying node: ".concat(nodeUrl));
|
|
210
212
|
return [4 /*yield*/, axiosInstance({
|
|
211
213
|
method: 'GET',
|
|
212
|
-
url: "".concat(nodeUrl, "/auth/accounts/").concat(address),
|
|
214
|
+
url: "".concat(nodeUrl, "/cosmos/auth/v1beta1/accounts/").concat(address),
|
|
213
215
|
timeout: 10000
|
|
214
216
|
})
|
|
215
|
-
//
|
|
217
|
+
// Cosmos SDK returns { account: {...} } - wrap for compatibility
|
|
216
218
|
];
|
|
217
219
|
case 6:
|
|
218
220
|
nodeResult = _a.sent();
|
|
219
|
-
|
|
221
|
+
accountData = nodeResult.data.account || nodeResult.data;
|
|
220
222
|
log.info(tag, "Account info retrieved from ".concat(nodeUrl));
|
|
221
|
-
|
|
223
|
+
// Convert Cosmos SDK format to our expected format
|
|
224
|
+
return [2 /*return*/, __assign({ result: {
|
|
225
|
+
value: {
|
|
226
|
+
account_number: String(accountData.account_number || '0'),
|
|
227
|
+
sequence: String(accountData.sequence || '0'),
|
|
228
|
+
address: accountData.address || address,
|
|
229
|
+
coins: accountData.coins || [],
|
|
230
|
+
public_key: accountData.pub_key || null
|
|
231
|
+
}
|
|
232
|
+
} }, accountData)];
|
|
222
233
|
case 7:
|
|
223
234
|
nodeError_1 = _a.sent();
|
|
224
235
|
log.debug(tag, "Node ".concat(nodeUrl, " failed:"), nodeError_1.message);
|
|
@@ -373,7 +384,7 @@ var get_transaction = function (txid) {
|
|
|
373
384
|
};
|
|
374
385
|
var broadcast_transaction = function (tx) {
|
|
375
386
|
return __awaiter(this, void 0, void 0, function () {
|
|
376
|
-
var tag, output, payload, result, unchainedError_2, nodeErrors, _i, MAYA_NODES_2, nodeUrl, nodeResult, nodeError, nodeError_2, nodeErrorMsg;
|
|
387
|
+
var tag, output, payload, result, unchainedError_2, nodeErrors, _i, MAYA_NODES_2, nodeUrl, nodeResult, txResponse, nodeError, nodeError, nodeError_2, nodeErrorMsg;
|
|
377
388
|
var _a, _b, _c, _d, _e;
|
|
378
389
|
return __generator(this, function (_f) {
|
|
379
390
|
switch (_f.label) {
|
|
@@ -429,27 +440,33 @@ var broadcast_transaction = function (tx) {
|
|
|
429
440
|
_f.trys.push([6, 8, , 9]);
|
|
430
441
|
log.info(tag, "Trying direct Maya node: ".concat(nodeUrl));
|
|
431
442
|
return [4 /*yield*/, axiosInstance({
|
|
432
|
-
url: "".concat(nodeUrl, "/txs"),
|
|
443
|
+
url: "".concat(nodeUrl, "/cosmos/tx/v1beta1/txs"),
|
|
433
444
|
method: 'POST',
|
|
434
445
|
data: {
|
|
435
|
-
|
|
436
|
-
mode: '
|
|
446
|
+
tx_bytes: tx,
|
|
447
|
+
mode: 'BROADCAST_MODE_SYNC'
|
|
437
448
|
},
|
|
438
449
|
timeout: 15000 // Increased timeout for direct nodes
|
|
439
450
|
})];
|
|
440
451
|
case 7:
|
|
441
452
|
nodeResult = _f.sent();
|
|
442
453
|
log.info(tag, 'Node response:', nodeResult.data);
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
454
|
+
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)) {
|
|
457
|
+
output.txid = txResponse.txhash || txResponse.hash;
|
|
446
458
|
output.success = true;
|
|
447
459
|
output.endpoint = nodeUrl;
|
|
448
460
|
log.info(tag, "\u2705 Broadcast SUCCESS via ".concat(nodeUrl, " - txid: ").concat(output.txid));
|
|
449
461
|
return [2 /*return*/, output];
|
|
450
462
|
}
|
|
451
|
-
else if (
|
|
452
|
-
nodeError =
|
|
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
|
+
else if (txResponse.raw_log || txResponse.message || nodeResult.data.message) {
|
|
469
|
+
nodeError = txResponse.raw_log || txResponse.message || nodeResult.data.message;
|
|
453
470
|
nodeErrors.push("".concat(nodeUrl, ": ").concat(nodeError));
|
|
454
471
|
log.warn(tag, "Node ".concat(nodeUrl, " returned error:"), nodeError);
|
|
455
472
|
}
|