@pioneer-platform/maya-network 8.12.0 → 8.12.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.
- package/CHANGELOG.md +10 -0
- package/lib/index.js +27 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @pioneer-platform/maya-network
|
|
2
2
|
|
|
3
|
+
## 8.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add backward compatibility wrapper for account info
|
|
8
|
+
|
|
9
|
+
- Wrap Unchained API response in old format (result.value structure)
|
|
10
|
+
- Fix transaction building errors from undefined `value` property
|
|
11
|
+
- Maintains compatibility with existing code expecting old node format
|
|
12
|
+
|
|
3
13
|
## 8.12.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/lib/index.js
CHANGED
|
@@ -5,6 +5,17 @@
|
|
|
5
5
|
Migrated from direct node calls to ShapeShift Unchained API
|
|
6
6
|
API Documentation: https://api.mayachain.shapeshift.com/swagger
|
|
7
7
|
*/
|
|
8
|
+
var __assign = (this && this.__assign) || function () {
|
|
9
|
+
__assign = Object.assign || function(t) {
|
|
10
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
11
|
+
s = arguments[i];
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
}
|
|
15
|
+
return t;
|
|
16
|
+
};
|
|
17
|
+
return __assign.apply(this, arguments);
|
|
18
|
+
};
|
|
8
19
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
20
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
21
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -151,7 +162,7 @@ var get_info = function () {
|
|
|
151
162
|
};
|
|
152
163
|
var get_account_info = function (address) {
|
|
153
164
|
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
-
var tag, result, e_2;
|
|
165
|
+
var tag, result, unchainedData, e_2;
|
|
155
166
|
return __generator(this, function (_a) {
|
|
156
167
|
switch (_a.label) {
|
|
157
168
|
case 0:
|
|
@@ -163,10 +174,23 @@ var get_account_info = function (address) {
|
|
|
163
174
|
method: 'GET',
|
|
164
175
|
url: "".concat(UNCHAINED_API, "/api/v1/account/").concat(address),
|
|
165
176
|
timeout: 5000
|
|
166
|
-
})
|
|
177
|
+
})
|
|
178
|
+
// Unchained returns flat structure, wrap it for backward compatibility
|
|
179
|
+
// Old format: { result: { value: { account_number, sequence, ... } } }
|
|
180
|
+
// New format: { accountNumber, sequence, balance, ... }
|
|
181
|
+
];
|
|
167
182
|
case 2:
|
|
168
183
|
result = _a.sent();
|
|
169
|
-
|
|
184
|
+
unchainedData = result.data;
|
|
185
|
+
return [2 /*return*/, __assign({ result: {
|
|
186
|
+
value: {
|
|
187
|
+
account_number: String(unchainedData.accountNumber || '0'),
|
|
188
|
+
sequence: String(unchainedData.sequence || '0'),
|
|
189
|
+
address: unchainedData.pubkey || address,
|
|
190
|
+
coins: unchainedData.assets || [],
|
|
191
|
+
public_key: null // Not provided by Unchained
|
|
192
|
+
}
|
|
193
|
+
} }, unchainedData)];
|
|
170
194
|
case 3:
|
|
171
195
|
e_2 = _a.sent();
|
|
172
196
|
log.error(tag, "Error:", e_2.message);
|