@pioneer-platform/pioneer-sdk 4.21.2 → 4.21.3
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 +46 -117
- package/dist/index.es.js +46 -117
- package/dist/index.js +46 -117
- package/package.json +2 -2
- package/src/index.ts +9 -8
package/dist/index.cjs
CHANGED
|
@@ -157,46 +157,44 @@ var require_lib = __commonJS((exports2) => {
|
|
|
157
157
|
return { value: op[0] ? op[1] : undefined, done: true };
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
161
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
162
|
+
};
|
|
160
163
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
161
164
|
exports2.Pioneer = undefined;
|
|
162
|
-
var
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
log = {
|
|
170
|
-
debug: function() {
|
|
171
|
-
var args = [];
|
|
172
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
173
|
-
args[_i] = arguments[_i];
|
|
174
|
-
}
|
|
175
|
-
return console.debug.apply(console, args);
|
|
176
|
-
},
|
|
177
|
-
info: function() {
|
|
178
|
-
var args = [];
|
|
179
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
180
|
-
args[_i] = arguments[_i];
|
|
181
|
-
}
|
|
182
|
-
return console.info.apply(console, args);
|
|
183
|
-
},
|
|
184
|
-
warn: function() {
|
|
185
|
-
var args = [];
|
|
186
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
187
|
-
args[_i] = arguments[_i];
|
|
188
|
-
}
|
|
189
|
-
return console.warn.apply(console, args);
|
|
190
|
-
},
|
|
191
|
-
error: function() {
|
|
192
|
-
var args = [];
|
|
193
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
194
|
-
args[_i] = arguments[_i];
|
|
195
|
-
}
|
|
196
|
-
return console.error.apply(console, args);
|
|
165
|
+
var swagger_client_1 = __importDefault(require("swagger-client"));
|
|
166
|
+
var loggerdog_1 = __importDefault(require("@pioneer-platform/loggerdog"));
|
|
167
|
+
var log = typeof window === "undefined" ? (0, loggerdog_1.default)() : {
|
|
168
|
+
debug: function() {
|
|
169
|
+
var args = [];
|
|
170
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
171
|
+
args[_i] = arguments[_i];
|
|
197
172
|
}
|
|
198
|
-
|
|
199
|
-
|
|
173
|
+
return console.debug.apply(console, args);
|
|
174
|
+
},
|
|
175
|
+
info: function() {
|
|
176
|
+
var args = [];
|
|
177
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
178
|
+
args[_i] = arguments[_i];
|
|
179
|
+
}
|
|
180
|
+
return console.info.apply(console, args);
|
|
181
|
+
},
|
|
182
|
+
warn: function() {
|
|
183
|
+
var args = [];
|
|
184
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
185
|
+
args[_i] = arguments[_i];
|
|
186
|
+
}
|
|
187
|
+
return console.warn.apply(console, args);
|
|
188
|
+
},
|
|
189
|
+
error: function() {
|
|
190
|
+
var args = [];
|
|
191
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
192
|
+
args[_i] = arguments[_i];
|
|
193
|
+
}
|
|
194
|
+
return console.error.apply(console, args);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
var Swagger = swagger_client_1.default;
|
|
200
198
|
var TAG = " | Client | ";
|
|
201
199
|
function customHttpClient(req) {
|
|
202
200
|
var _this = this;
|
|
@@ -206,7 +204,7 @@ var require_lib = __commonJS((exports2) => {
|
|
|
206
204
|
}, 60000);
|
|
207
205
|
log.debug(TAG, "HTTP request URL:", req.url);
|
|
208
206
|
log.debug(TAG, "HTTP request details:", req);
|
|
209
|
-
if (Swagger
|
|
207
|
+
if (Swagger.http) {
|
|
210
208
|
Swagger.http(req).then(function(response) {
|
|
211
209
|
clearTimeout(timer);
|
|
212
210
|
resolve(response);
|
|
@@ -264,7 +262,7 @@ var require_lib = __commonJS((exports2) => {
|
|
|
264
262
|
}
|
|
265
263
|
Pioneer2.prototype.init = function() {
|
|
266
264
|
return __awaiter(this, undefined, undefined, function() {
|
|
267
|
-
var tag, _a,
|
|
265
|
+
var tag, _a, e_1;
|
|
268
266
|
var _this = this;
|
|
269
267
|
return __generator(this, function(_b) {
|
|
270
268
|
switch (_b.label) {
|
|
@@ -272,11 +270,9 @@ var require_lib = __commonJS((exports2) => {
|
|
|
272
270
|
tag = TAG + " | init | ";
|
|
273
271
|
_b.label = 1;
|
|
274
272
|
case 1:
|
|
275
|
-
_b.trys.push([1,
|
|
273
|
+
_b.trys.push([1, 3, , 4]);
|
|
276
274
|
if (!this.queryKey)
|
|
277
275
|
throw Error(" You must create an api key! ");
|
|
278
|
-
if (!Swagger)
|
|
279
|
-
return [3, 3];
|
|
280
276
|
_a = this;
|
|
281
277
|
return [4, new Swagger({
|
|
282
278
|
url: this.spec,
|
|
@@ -302,73 +298,6 @@ var require_lib = __commonJS((exports2) => {
|
|
|
302
298
|
})];
|
|
303
299
|
case 2:
|
|
304
300
|
_a.client = _b.sent();
|
|
305
|
-
return [3, 6];
|
|
306
|
-
case 3:
|
|
307
|
-
return [4, fetch(this.spec)];
|
|
308
|
-
case 4:
|
|
309
|
-
specResponse = _b.sent();
|
|
310
|
-
return [4, specResponse.json()];
|
|
311
|
-
case 5:
|
|
312
|
-
specData_1 = _b.sent();
|
|
313
|
-
this.client = {
|
|
314
|
-
spec: specData_1,
|
|
315
|
-
execute: function(request) {
|
|
316
|
-
return __awaiter(_this, undefined, undefined, function() {
|
|
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
|
-
case 0:
|
|
321
|
-
operationId = request.operationId, parameters = request.parameters, requestBody = request.requestBody;
|
|
322
|
-
targetPath = "";
|
|
323
|
-
targetMethod = "";
|
|
324
|
-
for (path in specData_1.paths) {
|
|
325
|
-
for (method in specData_1.paths[path]) {
|
|
326
|
-
if (specData_1.paths[path][method].operationId === operationId) {
|
|
327
|
-
targetPath = path;
|
|
328
|
-
targetMethod = method;
|
|
329
|
-
break;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
if (targetPath)
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
if (!targetPath) {
|
|
336
|
-
throw new Error("Operation ".concat(operationId, " not found in spec"));
|
|
337
|
-
}
|
|
338
|
-
baseUrl = this.spec.replace("/spec/swagger.json", "");
|
|
339
|
-
if (specData_1.servers && specData_1.servers.length > 0) {
|
|
340
|
-
baseUrl = specData_1.servers[0].url;
|
|
341
|
-
}
|
|
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);
|
|
353
|
-
httpReq = {
|
|
354
|
-
method: targetMethod.toUpperCase(),
|
|
355
|
-
url,
|
|
356
|
-
headers: {
|
|
357
|
-
Authorization: this.queryKey,
|
|
358
|
-
"Content-Type": "application/json"
|
|
359
|
-
},
|
|
360
|
-
body: requestBody
|
|
361
|
-
};
|
|
362
|
-
return [4, customHttpClient(httpReq)];
|
|
363
|
-
case 1:
|
|
364
|
-
return [2, _c.sent()];
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
_b.label = 6;
|
|
371
|
-
case 6:
|
|
372
301
|
Object.keys(this.client.spec.paths).forEach(function(path) {
|
|
373
302
|
Object.keys(_this.client.spec.paths[path]).forEach(function(method) {
|
|
374
303
|
var operationId = _this.client.spec.paths[path][method].operationId;
|
|
@@ -426,11 +355,11 @@ var require_lib = __commonJS((exports2) => {
|
|
|
426
355
|
});
|
|
427
356
|
});
|
|
428
357
|
return [2, this.pioneer];
|
|
429
|
-
case
|
|
358
|
+
case 3:
|
|
430
359
|
e_1 = _b.sent();
|
|
431
360
|
log.error(TAG, "Initialization error:", e_1);
|
|
432
361
|
throw e_1;
|
|
433
|
-
case
|
|
362
|
+
case 4:
|
|
434
363
|
return [2];
|
|
435
364
|
}
|
|
436
365
|
});
|
|
@@ -4245,12 +4174,6 @@ class SDK {
|
|
|
4245
4174
|
this.blockchains = config.blockchains ? [...new Set(config.blockchains)] : [];
|
|
4246
4175
|
if (config.blockchains && config.blockchains.length !== this.blockchains.length) {
|
|
4247
4176
|
}
|
|
4248
|
-
if (config.pubkeys && config.pubkeys.length > 0) {
|
|
4249
|
-
this.setPubkeys(config.pubkeys);
|
|
4250
|
-
} else {
|
|
4251
|
-
this.pubkeys = [];
|
|
4252
|
-
this.pubkeySet.clear();
|
|
4253
|
-
}
|
|
4254
4177
|
this.balances = config.balances || [];
|
|
4255
4178
|
this.nodes = config.nodes || [];
|
|
4256
4179
|
this.charts = ["covalent", "zapper"];
|
|
@@ -4318,6 +4241,12 @@ class SDK {
|
|
|
4318
4241
|
}
|
|
4319
4242
|
}
|
|
4320
4243
|
};
|
|
4244
|
+
if (config.pubkeys && config.pubkeys.length > 0) {
|
|
4245
|
+
this.setPubkeys(config.pubkeys);
|
|
4246
|
+
} else {
|
|
4247
|
+
this.pubkeys = [];
|
|
4248
|
+
this.pubkeySet.clear();
|
|
4249
|
+
}
|
|
4321
4250
|
this.getUnifiedPortfolio = async function() {
|
|
4322
4251
|
const tag6 = `${TAG9} | getUnifiedPortfolio | `;
|
|
4323
4252
|
try {
|
package/dist/index.es.js
CHANGED
|
@@ -140,46 +140,44 @@ var require_lib = __commonJS((exports) => {
|
|
|
140
140
|
return { value: op[0] ? op[1] : undefined, done: true };
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
144
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
145
|
+
};
|
|
143
146
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
144
147
|
exports.Pioneer = undefined;
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
log = {
|
|
153
|
-
debug: function() {
|
|
154
|
-
var args = [];
|
|
155
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
156
|
-
args[_i] = arguments[_i];
|
|
157
|
-
}
|
|
158
|
-
return console.debug.apply(console, args);
|
|
159
|
-
},
|
|
160
|
-
info: function() {
|
|
161
|
-
var args = [];
|
|
162
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
163
|
-
args[_i] = arguments[_i];
|
|
164
|
-
}
|
|
165
|
-
return console.info.apply(console, args);
|
|
166
|
-
},
|
|
167
|
-
warn: function() {
|
|
168
|
-
var args = [];
|
|
169
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
170
|
-
args[_i] = arguments[_i];
|
|
171
|
-
}
|
|
172
|
-
return console.warn.apply(console, args);
|
|
173
|
-
},
|
|
174
|
-
error: function() {
|
|
175
|
-
var args = [];
|
|
176
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
177
|
-
args[_i] = arguments[_i];
|
|
178
|
-
}
|
|
179
|
-
return console.error.apply(console, args);
|
|
148
|
+
var swagger_client_1 = __importDefault(__require("swagger-client"));
|
|
149
|
+
var loggerdog_1 = __importDefault(__require("@pioneer-platform/loggerdog"));
|
|
150
|
+
var log = typeof window === "undefined" ? (0, loggerdog_1.default)() : {
|
|
151
|
+
debug: function() {
|
|
152
|
+
var args = [];
|
|
153
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
154
|
+
args[_i] = arguments[_i];
|
|
180
155
|
}
|
|
181
|
-
|
|
182
|
-
|
|
156
|
+
return console.debug.apply(console, args);
|
|
157
|
+
},
|
|
158
|
+
info: function() {
|
|
159
|
+
var args = [];
|
|
160
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
161
|
+
args[_i] = arguments[_i];
|
|
162
|
+
}
|
|
163
|
+
return console.info.apply(console, args);
|
|
164
|
+
},
|
|
165
|
+
warn: function() {
|
|
166
|
+
var args = [];
|
|
167
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
168
|
+
args[_i] = arguments[_i];
|
|
169
|
+
}
|
|
170
|
+
return console.warn.apply(console, args);
|
|
171
|
+
},
|
|
172
|
+
error: function() {
|
|
173
|
+
var args = [];
|
|
174
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
175
|
+
args[_i] = arguments[_i];
|
|
176
|
+
}
|
|
177
|
+
return console.error.apply(console, args);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var Swagger = swagger_client_1.default;
|
|
183
181
|
var TAG = " | Client | ";
|
|
184
182
|
function customHttpClient(req) {
|
|
185
183
|
var _this = this;
|
|
@@ -189,7 +187,7 @@ var require_lib = __commonJS((exports) => {
|
|
|
189
187
|
}, 60000);
|
|
190
188
|
log.debug(TAG, "HTTP request URL:", req.url);
|
|
191
189
|
log.debug(TAG, "HTTP request details:", req);
|
|
192
|
-
if (Swagger
|
|
190
|
+
if (Swagger.http) {
|
|
193
191
|
Swagger.http(req).then(function(response) {
|
|
194
192
|
clearTimeout(timer);
|
|
195
193
|
resolve(response);
|
|
@@ -247,7 +245,7 @@ var require_lib = __commonJS((exports) => {
|
|
|
247
245
|
}
|
|
248
246
|
Pioneer2.prototype.init = function() {
|
|
249
247
|
return __awaiter(this, undefined, undefined, function() {
|
|
250
|
-
var tag, _a,
|
|
248
|
+
var tag, _a, e_1;
|
|
251
249
|
var _this = this;
|
|
252
250
|
return __generator(this, function(_b) {
|
|
253
251
|
switch (_b.label) {
|
|
@@ -255,11 +253,9 @@ var require_lib = __commonJS((exports) => {
|
|
|
255
253
|
tag = TAG + " | init | ";
|
|
256
254
|
_b.label = 1;
|
|
257
255
|
case 1:
|
|
258
|
-
_b.trys.push([1,
|
|
256
|
+
_b.trys.push([1, 3, , 4]);
|
|
259
257
|
if (!this.queryKey)
|
|
260
258
|
throw Error(" You must create an api key! ");
|
|
261
|
-
if (!Swagger)
|
|
262
|
-
return [3, 3];
|
|
263
259
|
_a = this;
|
|
264
260
|
return [4, new Swagger({
|
|
265
261
|
url: this.spec,
|
|
@@ -285,73 +281,6 @@ var require_lib = __commonJS((exports) => {
|
|
|
285
281
|
})];
|
|
286
282
|
case 2:
|
|
287
283
|
_a.client = _b.sent();
|
|
288
|
-
return [3, 6];
|
|
289
|
-
case 3:
|
|
290
|
-
return [4, fetch(this.spec)];
|
|
291
|
-
case 4:
|
|
292
|
-
specResponse = _b.sent();
|
|
293
|
-
return [4, specResponse.json()];
|
|
294
|
-
case 5:
|
|
295
|
-
specData_1 = _b.sent();
|
|
296
|
-
this.client = {
|
|
297
|
-
spec: specData_1,
|
|
298
|
-
execute: function(request) {
|
|
299
|
-
return __awaiter(_this, undefined, undefined, function() {
|
|
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
|
-
case 0:
|
|
304
|
-
operationId = request.operationId, parameters = request.parameters, requestBody = request.requestBody;
|
|
305
|
-
targetPath = "";
|
|
306
|
-
targetMethod = "";
|
|
307
|
-
for (path in specData_1.paths) {
|
|
308
|
-
for (method in specData_1.paths[path]) {
|
|
309
|
-
if (specData_1.paths[path][method].operationId === operationId) {
|
|
310
|
-
targetPath = path;
|
|
311
|
-
targetMethod = method;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (targetPath)
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
if (!targetPath) {
|
|
319
|
-
throw new Error("Operation ".concat(operationId, " not found in spec"));
|
|
320
|
-
}
|
|
321
|
-
baseUrl = this.spec.replace("/spec/swagger.json", "");
|
|
322
|
-
if (specData_1.servers && specData_1.servers.length > 0) {
|
|
323
|
-
baseUrl = specData_1.servers[0].url;
|
|
324
|
-
}
|
|
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);
|
|
336
|
-
httpReq = {
|
|
337
|
-
method: targetMethod.toUpperCase(),
|
|
338
|
-
url,
|
|
339
|
-
headers: {
|
|
340
|
-
Authorization: this.queryKey,
|
|
341
|
-
"Content-Type": "application/json"
|
|
342
|
-
},
|
|
343
|
-
body: requestBody
|
|
344
|
-
};
|
|
345
|
-
return [4, customHttpClient(httpReq)];
|
|
346
|
-
case 1:
|
|
347
|
-
return [2, _c.sent()];
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
_b.label = 6;
|
|
354
|
-
case 6:
|
|
355
284
|
Object.keys(this.client.spec.paths).forEach(function(path) {
|
|
356
285
|
Object.keys(_this.client.spec.paths[path]).forEach(function(method) {
|
|
357
286
|
var operationId = _this.client.spec.paths[path][method].operationId;
|
|
@@ -409,11 +338,11 @@ var require_lib = __commonJS((exports) => {
|
|
|
409
338
|
});
|
|
410
339
|
});
|
|
411
340
|
return [2, this.pioneer];
|
|
412
|
-
case
|
|
341
|
+
case 3:
|
|
413
342
|
e_1 = _b.sent();
|
|
414
343
|
log.error(TAG, "Initialization error:", e_1);
|
|
415
344
|
throw e_1;
|
|
416
|
-
case
|
|
345
|
+
case 4:
|
|
417
346
|
return [2];
|
|
418
347
|
}
|
|
419
348
|
});
|
|
@@ -4421,12 +4350,6 @@ class SDK {
|
|
|
4421
4350
|
this.blockchains = config.blockchains ? [...new Set(config.blockchains)] : [];
|
|
4422
4351
|
if (config.blockchains && config.blockchains.length !== this.blockchains.length) {
|
|
4423
4352
|
}
|
|
4424
|
-
if (config.pubkeys && config.pubkeys.length > 0) {
|
|
4425
|
-
this.setPubkeys(config.pubkeys);
|
|
4426
|
-
} else {
|
|
4427
|
-
this.pubkeys = [];
|
|
4428
|
-
this.pubkeySet.clear();
|
|
4429
|
-
}
|
|
4430
4353
|
this.balances = config.balances || [];
|
|
4431
4354
|
this.nodes = config.nodes || [];
|
|
4432
4355
|
this.charts = ["covalent", "zapper"];
|
|
@@ -4494,6 +4417,12 @@ class SDK {
|
|
|
4494
4417
|
}
|
|
4495
4418
|
}
|
|
4496
4419
|
};
|
|
4420
|
+
if (config.pubkeys && config.pubkeys.length > 0) {
|
|
4421
|
+
this.setPubkeys(config.pubkeys);
|
|
4422
|
+
} else {
|
|
4423
|
+
this.pubkeys = [];
|
|
4424
|
+
this.pubkeySet.clear();
|
|
4425
|
+
}
|
|
4497
4426
|
this.getUnifiedPortfolio = async function() {
|
|
4498
4427
|
const tag6 = `${TAG9} | getUnifiedPortfolio | `;
|
|
4499
4428
|
try {
|
package/dist/index.js
CHANGED
|
@@ -140,46 +140,44 @@ var require_lib = __commonJS((exports) => {
|
|
|
140
140
|
return { value: op[0] ? op[1] : undefined, done: true };
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
144
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
145
|
+
};
|
|
143
146
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
144
147
|
exports.Pioneer = undefined;
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
log = {
|
|
153
|
-
debug: function() {
|
|
154
|
-
var args = [];
|
|
155
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
156
|
-
args[_i] = arguments[_i];
|
|
157
|
-
}
|
|
158
|
-
return console.debug.apply(console, args);
|
|
159
|
-
},
|
|
160
|
-
info: function() {
|
|
161
|
-
var args = [];
|
|
162
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
163
|
-
args[_i] = arguments[_i];
|
|
164
|
-
}
|
|
165
|
-
return console.info.apply(console, args);
|
|
166
|
-
},
|
|
167
|
-
warn: function() {
|
|
168
|
-
var args = [];
|
|
169
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
170
|
-
args[_i] = arguments[_i];
|
|
171
|
-
}
|
|
172
|
-
return console.warn.apply(console, args);
|
|
173
|
-
},
|
|
174
|
-
error: function() {
|
|
175
|
-
var args = [];
|
|
176
|
-
for (var _i = 0;_i < arguments.length; _i++) {
|
|
177
|
-
args[_i] = arguments[_i];
|
|
178
|
-
}
|
|
179
|
-
return console.error.apply(console, args);
|
|
148
|
+
var swagger_client_1 = __importDefault(__require("swagger-client"));
|
|
149
|
+
var loggerdog_1 = __importDefault(__require("@pioneer-platform/loggerdog"));
|
|
150
|
+
var log = typeof window === "undefined" ? (0, loggerdog_1.default)() : {
|
|
151
|
+
debug: function() {
|
|
152
|
+
var args = [];
|
|
153
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
154
|
+
args[_i] = arguments[_i];
|
|
180
155
|
}
|
|
181
|
-
|
|
182
|
-
|
|
156
|
+
return console.debug.apply(console, args);
|
|
157
|
+
},
|
|
158
|
+
info: function() {
|
|
159
|
+
var args = [];
|
|
160
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
161
|
+
args[_i] = arguments[_i];
|
|
162
|
+
}
|
|
163
|
+
return console.info.apply(console, args);
|
|
164
|
+
},
|
|
165
|
+
warn: function() {
|
|
166
|
+
var args = [];
|
|
167
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
168
|
+
args[_i] = arguments[_i];
|
|
169
|
+
}
|
|
170
|
+
return console.warn.apply(console, args);
|
|
171
|
+
},
|
|
172
|
+
error: function() {
|
|
173
|
+
var args = [];
|
|
174
|
+
for (var _i = 0;_i < arguments.length; _i++) {
|
|
175
|
+
args[_i] = arguments[_i];
|
|
176
|
+
}
|
|
177
|
+
return console.error.apply(console, args);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var Swagger = swagger_client_1.default;
|
|
183
181
|
var TAG = " | Client | ";
|
|
184
182
|
function customHttpClient(req) {
|
|
185
183
|
var _this = this;
|
|
@@ -189,7 +187,7 @@ var require_lib = __commonJS((exports) => {
|
|
|
189
187
|
}, 60000);
|
|
190
188
|
log.debug(TAG, "HTTP request URL:", req.url);
|
|
191
189
|
log.debug(TAG, "HTTP request details:", req);
|
|
192
|
-
if (Swagger
|
|
190
|
+
if (Swagger.http) {
|
|
193
191
|
Swagger.http(req).then(function(response) {
|
|
194
192
|
clearTimeout(timer);
|
|
195
193
|
resolve(response);
|
|
@@ -247,7 +245,7 @@ var require_lib = __commonJS((exports) => {
|
|
|
247
245
|
}
|
|
248
246
|
Pioneer2.prototype.init = function() {
|
|
249
247
|
return __awaiter(this, undefined, undefined, function() {
|
|
250
|
-
var tag, _a,
|
|
248
|
+
var tag, _a, e_1;
|
|
251
249
|
var _this = this;
|
|
252
250
|
return __generator(this, function(_b) {
|
|
253
251
|
switch (_b.label) {
|
|
@@ -255,11 +253,9 @@ var require_lib = __commonJS((exports) => {
|
|
|
255
253
|
tag = TAG + " | init | ";
|
|
256
254
|
_b.label = 1;
|
|
257
255
|
case 1:
|
|
258
|
-
_b.trys.push([1,
|
|
256
|
+
_b.trys.push([1, 3, , 4]);
|
|
259
257
|
if (!this.queryKey)
|
|
260
258
|
throw Error(" You must create an api key! ");
|
|
261
|
-
if (!Swagger)
|
|
262
|
-
return [3, 3];
|
|
263
259
|
_a = this;
|
|
264
260
|
return [4, new Swagger({
|
|
265
261
|
url: this.spec,
|
|
@@ -285,73 +281,6 @@ var require_lib = __commonJS((exports) => {
|
|
|
285
281
|
})];
|
|
286
282
|
case 2:
|
|
287
283
|
_a.client = _b.sent();
|
|
288
|
-
return [3, 6];
|
|
289
|
-
case 3:
|
|
290
|
-
return [4, fetch(this.spec)];
|
|
291
|
-
case 4:
|
|
292
|
-
specResponse = _b.sent();
|
|
293
|
-
return [4, specResponse.json()];
|
|
294
|
-
case 5:
|
|
295
|
-
specData_1 = _b.sent();
|
|
296
|
-
this.client = {
|
|
297
|
-
spec: specData_1,
|
|
298
|
-
execute: function(request) {
|
|
299
|
-
return __awaiter(_this, undefined, undefined, function() {
|
|
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
|
-
case 0:
|
|
304
|
-
operationId = request.operationId, parameters = request.parameters, requestBody = request.requestBody;
|
|
305
|
-
targetPath = "";
|
|
306
|
-
targetMethod = "";
|
|
307
|
-
for (path in specData_1.paths) {
|
|
308
|
-
for (method in specData_1.paths[path]) {
|
|
309
|
-
if (specData_1.paths[path][method].operationId === operationId) {
|
|
310
|
-
targetPath = path;
|
|
311
|
-
targetMethod = method;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (targetPath)
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
if (!targetPath) {
|
|
319
|
-
throw new Error("Operation ".concat(operationId, " not found in spec"));
|
|
320
|
-
}
|
|
321
|
-
baseUrl = this.spec.replace("/spec/swagger.json", "");
|
|
322
|
-
if (specData_1.servers && specData_1.servers.length > 0) {
|
|
323
|
-
baseUrl = specData_1.servers[0].url;
|
|
324
|
-
}
|
|
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);
|
|
336
|
-
httpReq = {
|
|
337
|
-
method: targetMethod.toUpperCase(),
|
|
338
|
-
url,
|
|
339
|
-
headers: {
|
|
340
|
-
Authorization: this.queryKey,
|
|
341
|
-
"Content-Type": "application/json"
|
|
342
|
-
},
|
|
343
|
-
body: requestBody
|
|
344
|
-
};
|
|
345
|
-
return [4, customHttpClient(httpReq)];
|
|
346
|
-
case 1:
|
|
347
|
-
return [2, _c.sent()];
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
_b.label = 6;
|
|
354
|
-
case 6:
|
|
355
284
|
Object.keys(this.client.spec.paths).forEach(function(path) {
|
|
356
285
|
Object.keys(_this.client.spec.paths[path]).forEach(function(method) {
|
|
357
286
|
var operationId = _this.client.spec.paths[path][method].operationId;
|
|
@@ -409,11 +338,11 @@ var require_lib = __commonJS((exports) => {
|
|
|
409
338
|
});
|
|
410
339
|
});
|
|
411
340
|
return [2, this.pioneer];
|
|
412
|
-
case
|
|
341
|
+
case 3:
|
|
413
342
|
e_1 = _b.sent();
|
|
414
343
|
log.error(TAG, "Initialization error:", e_1);
|
|
415
344
|
throw e_1;
|
|
416
|
-
case
|
|
345
|
+
case 4:
|
|
417
346
|
return [2];
|
|
418
347
|
}
|
|
419
348
|
});
|
|
@@ -4421,12 +4350,6 @@ class SDK {
|
|
|
4421
4350
|
this.blockchains = config.blockchains ? [...new Set(config.blockchains)] : [];
|
|
4422
4351
|
if (config.blockchains && config.blockchains.length !== this.blockchains.length) {
|
|
4423
4352
|
}
|
|
4424
|
-
if (config.pubkeys && config.pubkeys.length > 0) {
|
|
4425
|
-
this.setPubkeys(config.pubkeys);
|
|
4426
|
-
} else {
|
|
4427
|
-
this.pubkeys = [];
|
|
4428
|
-
this.pubkeySet.clear();
|
|
4429
|
-
}
|
|
4430
4353
|
this.balances = config.balances || [];
|
|
4431
4354
|
this.nodes = config.nodes || [];
|
|
4432
4355
|
this.charts = ["covalent", "zapper"];
|
|
@@ -4494,6 +4417,12 @@ class SDK {
|
|
|
4494
4417
|
}
|
|
4495
4418
|
}
|
|
4496
4419
|
};
|
|
4420
|
+
if (config.pubkeys && config.pubkeys.length > 0) {
|
|
4421
|
+
this.setPubkeys(config.pubkeys);
|
|
4422
|
+
} else {
|
|
4423
|
+
this.pubkeys = [];
|
|
4424
|
+
this.pubkeySet.clear();
|
|
4425
|
+
}
|
|
4497
4426
|
this.getUnifiedPortfolio = async function() {
|
|
4498
4427
|
const tag6 = `${TAG9} | getUnifiedPortfolio | `;
|
|
4499
4428
|
try {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "highlander",
|
|
3
3
|
"name": "@pioneer-platform/pioneer-sdk",
|
|
4
|
-
"version": "4.21.
|
|
4
|
+
"version": "4.21.3",
|
|
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.
|
|
9
|
+
"@pioneer-platform/pioneer-client": "^9.10.7",
|
|
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",
|
package/src/index.ts
CHANGED
|
@@ -188,14 +188,6 @@ export class SDK {
|
|
|
188
188
|
if (config.blockchains && config.blockchains.length !== this.blockchains.length) {
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
// Initialize pubkeys with deduplication if provided in config
|
|
192
|
-
if (config.pubkeys && config.pubkeys.length > 0) {
|
|
193
|
-
this.setPubkeys(config.pubkeys);
|
|
194
|
-
} else {
|
|
195
|
-
this.pubkeys = [];
|
|
196
|
-
this.pubkeySet.clear();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
191
|
this.balances = config.balances || [];
|
|
200
192
|
this.nodes = config.nodes || [];
|
|
201
193
|
this.charts = ['covalent', 'zapper'];
|
|
@@ -288,6 +280,15 @@ export class SDK {
|
|
|
288
280
|
}
|
|
289
281
|
};
|
|
290
282
|
|
|
283
|
+
// Initialize pubkeys with deduplication if provided in config
|
|
284
|
+
// IMPORTANT: This must come AFTER setPubkeys is defined above
|
|
285
|
+
if (config.pubkeys && config.pubkeys.length > 0) {
|
|
286
|
+
this.setPubkeys(config.pubkeys);
|
|
287
|
+
} else {
|
|
288
|
+
this.pubkeys = [];
|
|
289
|
+
this.pubkeySet.clear();
|
|
290
|
+
}
|
|
291
|
+
|
|
291
292
|
// Fast portfolio loading from kkapi:// cache
|
|
292
293
|
this.getUnifiedPortfolio = async function () {
|
|
293
294
|
const tag = `${TAG} | getUnifiedPortfolio | `;
|