@airgap/aeternity 0.13.7-beta.13 → 0.13.7-beta.14

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.
@@ -32105,7 +32105,7 @@ module.exports = function whichTypedArray(value) {
32105
32105
  },{"available-typed-arrays":29,"call-bind/callBound":78,"es-abstract/helpers/getOwnPropertyDescriptor":116,"for-each":119,"has-tostringtag/shams":125,"is-typed-array":162}],223:[function(require,module,exports){
32106
32106
  "use strict";
32107
32107
  Object.defineProperty(exports, "__esModule", { value: true });
32108
- exports.createProtocolByIdentifier = exports.AeternityAddress = exports.AeternityProtocolNetwork = exports.AeternalBlockExplorer = exports.AeternityProtocolOptions = exports.AeternityCryptoClient = exports.AeternityProtocol = void 0;
32108
+ exports.AeternityAddress = exports.AeternityProtocolNetwork = exports.AeternalBlockExplorer = exports.AeternityProtocolOptions = exports.AeternityCryptoClient = exports.AeternityProtocol = void 0;
32109
32109
  var AeternityAddress_1 = require("./protocol/AeternityAddress");
32110
32110
  Object.defineProperty(exports, "AeternityAddress", { enumerable: true, get: function () { return AeternityAddress_1.AeternityAddress; } });
32111
32111
  var AeternityCryptoClient_1 = require("./protocol/AeternityCryptoClient");
@@ -32116,10 +32116,8 @@ var AeternityProtocolOptions_1 = require("./protocol/AeternityProtocolOptions");
32116
32116
  Object.defineProperty(exports, "AeternalBlockExplorer", { enumerable: true, get: function () { return AeternityProtocolOptions_1.AeternalBlockExplorer; } });
32117
32117
  Object.defineProperty(exports, "AeternityProtocolNetwork", { enumerable: true, get: function () { return AeternityProtocolOptions_1.AeternityProtocolNetwork; } });
32118
32118
  Object.defineProperty(exports, "AeternityProtocolOptions", { enumerable: true, get: function () { return AeternityProtocolOptions_1.AeternityProtocolOptions; } });
32119
- var create_protocol_1 = require("./utils/create-protocol");
32120
- Object.defineProperty(exports, "createProtocolByIdentifier", { enumerable: true, get: function () { return create_protocol_1.createProtocolByIdentifier; } });
32121
32119
 
32122
- },{"./protocol/AeternityAddress":224,"./protocol/AeternityCryptoClient":225,"./protocol/AeternityProtocol":226,"./protocol/AeternityProtocolOptions":227,"./utils/create-protocol":228}],224:[function(require,module,exports){
32120
+ },{"./protocol/AeternityAddress":224,"./protocol/AeternityCryptoClient":225,"./protocol/AeternityProtocol":226,"./protocol/AeternityProtocolOptions":227}],224:[function(require,module,exports){
32123
32121
  (function (Buffer){(function (){
32124
32122
  "use strict";
32125
32123
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -32160,7 +32158,7 @@ var AeternityAddress = /** @class */ (function () {
32160
32158
  exports.AeternityAddress = AeternityAddress;
32161
32159
 
32162
32160
  }).call(this)}).call(this,require("buffer").Buffer)
32163
- },{"@airgap/coinlib-core/dependencies/src/bs58check-2.1.2/index":273,"buffer":76}],225:[function(require,module,exports){
32161
+ },{"@airgap/coinlib-core/dependencies/src/bs58check-2.1.2/index":267,"buffer":76}],225:[function(require,module,exports){
32164
32162
  (function (Buffer){(function (){
32165
32163
  "use strict";
32166
32164
  var __extends = (this && this.__extends) || (function () {
@@ -32256,7 +32254,7 @@ var AeternityCryptoClient = /** @class */ (function (_super) {
32256
32254
  exports.AeternityCryptoClient = AeternityCryptoClient;
32257
32255
 
32258
32256
  }).call(this)}).call(this,require("buffer").Buffer)
32259
- },{"@airgap/coinlib-core/errors":307,"@airgap/coinlib-core/errors/coinlib-error":306,"@airgap/coinlib-core/protocols/Ed25519CryptoClient":310,"@stablelib/ed25519":2,"buffer":76}],226:[function(require,module,exports){
32257
+ },{"@airgap/coinlib-core/errors":301,"@airgap/coinlib-core/errors/coinlib-error":300,"@airgap/coinlib-core/protocols/Ed25519CryptoClient":303,"@stablelib/ed25519":2,"buffer":76}],226:[function(require,module,exports){
32260
32258
  (function (Buffer){(function (){
32261
32259
  "use strict";
32262
32260
  var __extends = (this && this.__extends) || (function () {
@@ -32956,7 +32954,7 @@ var AeternityProtocol = /** @class */ (function (_super) {
32956
32954
  exports.AeternityProtocol = AeternityProtocol;
32957
32955
 
32958
32956
  }).call(this)}).call(this,require("buffer").Buffer)
32959
- },{"./AeternityAddress":224,"./AeternityCryptoClient":225,"./AeternityProtocolOptions":227,"@airgap/coinlib-core/dependencies/src/axios-0.19.0/index":234,"@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber":260,"@airgap/coinlib-core/dependencies/src/bip39-2.5.0/index":262,"@airgap/coinlib-core/dependencies/src/bs58check-2.1.2/index":273,"@airgap/coinlib-core/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index":281,"@airgap/coinlib-core/dependencies/src/rlp-2.2.3/index":293,"@airgap/coinlib-core/errors":307,"@airgap/coinlib-core/errors/coinlib-error":306,"@airgap/coinlib-core/protocols/NonExtendedProtocol":312,"@airgap/coinlib-core/utils/ProtocolSymbols":317,"@airgap/coinlib-core/utils/base64Check":319,"@airgap/coinlib-core/utils/hex":321,"@stablelib/ed25519":2,"buffer":76}],227:[function(require,module,exports){
32957
+ },{"./AeternityAddress":224,"./AeternityCryptoClient":225,"./AeternityProtocolOptions":227,"@airgap/coinlib-core/dependencies/src/axios-0.19.0/index":228,"@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber":254,"@airgap/coinlib-core/dependencies/src/bip39-2.5.0/index":256,"@airgap/coinlib-core/dependencies/src/bs58check-2.1.2/index":267,"@airgap/coinlib-core/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index":275,"@airgap/coinlib-core/dependencies/src/rlp-2.2.3/index":287,"@airgap/coinlib-core/errors":301,"@airgap/coinlib-core/errors/coinlib-error":300,"@airgap/coinlib-core/protocols/NonExtendedProtocol":304,"@airgap/coinlib-core/utils/ProtocolSymbols":307,"@airgap/coinlib-core/utils/base64Check":308,"@airgap/coinlib-core/utils/hex":309,"@stablelib/ed25519":2,"buffer":76}],227:[function(require,module,exports){
32960
32958
  "use strict";
32961
32959
  var __extends = (this && this.__extends) || (function () {
32962
32960
  var extendStatics = function (d, b) {
@@ -33064,684 +33062,240 @@ var AeternityProtocolOptions = /** @class */ (function () {
33064
33062
  }());
33065
33063
  exports.AeternityProtocolOptions = AeternityProtocolOptions;
33066
33064
 
33067
- },{"@airgap/coinlib-core/utils/ProtocolNetwork":316}],228:[function(require,module,exports){
33068
- "use strict";
33069
- Object.defineProperty(exports, "__esModule", { value: true });
33070
- exports.createProtocolByIdentifier = void 0;
33071
- var coinlib_core_1 = require("@airgap/coinlib-core");
33072
- var AeternityProtocol_1 = require("../protocol/AeternityProtocol");
33073
- // tslint:disable-next-line: cyclomatic-complexity
33074
- function createProtocolByIdentifier(identifier, options) {
33075
- switch (identifier) {
33076
- case coinlib_core_1.MainProtocolSymbols.AE:
33077
- return new AeternityProtocol_1.AeternityProtocol(options);
33078
- default:
33079
- throw new Error("Unkown protocol identifier " + identifier + ".");
33065
+ },{"@airgap/coinlib-core/utils/ProtocolNetwork":306}],228:[function(require,module,exports){
33066
+ module.exports = require('./lib/axios');
33067
+ },{"./lib/axios":230}],229:[function(require,module,exports){
33068
+ 'use strict';
33069
+
33070
+ var utils = require('./../utils');
33071
+ var settle = require('./../core/settle');
33072
+ var buildURL = require('./../helpers/buildURL');
33073
+ var parseHeaders = require('./../helpers/parseHeaders');
33074
+ var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
33075
+ var createError = require('../core/createError');
33076
+
33077
+ module.exports = function xhrAdapter(config) {
33078
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
33079
+ var requestData = config.data;
33080
+ var requestHeaders = config.headers;
33081
+
33082
+ if (utils.isFormData(requestData)) {
33083
+ delete requestHeaders['Content-Type']; // Let the browser set it
33080
33084
  }
33081
- }
33082
- exports.createProtocolByIdentifier = createProtocolByIdentifier;
33083
33085
 
33084
- },{"../protocol/AeternityProtocol":226,"@airgap/coinlib-core":308}],229:[function(require,module,exports){
33085
- "use strict";
33086
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33087
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33088
- return new (P || (P = Promise))(function (resolve, reject) {
33089
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
33090
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33091
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33092
- step((generator = generator.apply(thisArg, _arguments || [])).next());
33093
- });
33094
- };
33095
- var __generator = (this && this.__generator) || function (thisArg, body) {
33096
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
33097
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
33098
- function verb(n) { return function (v) { return step([n, v]); }; }
33099
- function step(op) {
33100
- if (f) throw new TypeError("Generator is already executing.");
33101
- while (_) try {
33102
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33103
- if (y = 0, t) op = [op[0] & 2, t.value];
33104
- switch (op[0]) {
33105
- case 0: case 1: t = op; break;
33106
- case 4: _.label++; return { value: op[1], done: false };
33107
- case 5: _.label++; y = op[1]; op = [0]; continue;
33108
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
33109
- default:
33110
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33111
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
33112
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33113
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
33114
- if (t[2]) _.ops.pop();
33115
- _.trys.pop(); continue;
33116
- }
33117
- op = body.call(thisArg, _);
33118
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
33119
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
33086
+ var request = new XMLHttpRequest();
33087
+
33088
+ // HTTP basic authentication
33089
+ if (config.auth) {
33090
+ var username = config.auth.username || '';
33091
+ var password = config.auth.password || '';
33092
+ requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
33120
33093
  }
33121
- };
33122
- Object.defineProperty(exports, "__esModule", { value: true });
33123
- exports.Action = exports.ActionState = void 0;
33124
- var errors_1 = require("../errors");
33125
- var coinlib_error_1 = require("../errors/coinlib-error");
33126
- var StateMachine_1 = require("./StateMachine");
33127
- var ActionState;
33128
- (function (ActionState) {
33129
- ActionState[ActionState["READY"] = 0] = "READY";
33130
- ActionState[ActionState["EXECUTING"] = 1] = "EXECUTING";
33131
- ActionState[ActionState["COMPLETED"] = 2] = "COMPLETED";
33132
- ActionState[ActionState["CANCELLED"] = 3] = "CANCELLED";
33133
- })(ActionState = exports.ActionState || (exports.ActionState = {}));
33134
- var Action = /** @class */ (function () {
33135
- function Action(context) {
33136
- this.stateMachine = new StateMachine_1.StateMachine(ActionState.READY, new Map([
33137
- [ActionState.READY, []],
33138
- [ActionState.EXECUTING, [ActionState.READY]],
33139
- [ActionState.COMPLETED, [ActionState.EXECUTING]],
33140
- [ActionState.CANCELLED, [ActionState.READY, ActionState.EXECUTING]]
33141
- ]));
33142
- this.context = context;
33143
- }
33144
- Object.defineProperty(Action.prototype, "identifier", {
33145
- get: function () {
33146
- return 'action';
33147
- },
33148
- enumerable: false,
33149
- configurable: true
33150
- });
33151
- Action.prototype.getState = function () {
33152
- return this.stateMachine.getState();
33094
+
33095
+ request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
33096
+
33097
+ // Set the request timeout in MS
33098
+ request.timeout = config.timeout;
33099
+
33100
+ // Listen for ready state
33101
+ request.onreadystatechange = function handleLoad() {
33102
+ if (!request || request.readyState !== 4) {
33103
+ return;
33104
+ }
33105
+
33106
+ // The request errored out and we didn't get a response, this will be
33107
+ // handled by onerror instead
33108
+ // With one exception: request that using file: protocol, most browsers
33109
+ // will return status as 0 even though it's a successful request
33110
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
33111
+ return;
33112
+ }
33113
+
33114
+ // Prepare the response
33115
+ var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
33116
+ var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
33117
+ var response = {
33118
+ data: responseData,
33119
+ status: request.status,
33120
+ statusText: request.statusText,
33121
+ headers: responseHeaders,
33122
+ config: config,
33123
+ request: request
33124
+ };
33125
+
33126
+ settle(resolve, reject, response);
33127
+
33128
+ // Clean up request
33129
+ request = null;
33153
33130
  };
33154
- Action.prototype.start = function () {
33155
- return __awaiter(this, void 0, void 0, function () {
33156
- var result, error_1;
33157
- return __generator(this, function (_a) {
33158
- switch (_a.label) {
33159
- case 0:
33160
- _a.trys.push([0, 2, , 3]);
33161
- this.stateMachine.transitionTo(ActionState.EXECUTING);
33162
- return [4 /*yield*/, this.perform()];
33163
- case 1:
33164
- result = _a.sent();
33165
- this.handleSuccess(result);
33166
- return [3 /*break*/, 3];
33167
- case 2:
33168
- error_1 = _a.sent();
33169
- this.handleError(error_1);
33170
- return [3 /*break*/, 3];
33171
- case 3: return [2 /*return*/];
33172
- }
33173
- });
33174
- });
33131
+
33132
+ // Handle browser request cancellation (as opposed to a manual cancellation)
33133
+ request.onabort = function handleAbort() {
33134
+ if (!request) {
33135
+ return;
33136
+ }
33137
+
33138
+ reject(createError('Request aborted', config, 'ECONNABORTED', request));
33139
+
33140
+ // Clean up request
33141
+ request = null;
33175
33142
  };
33176
- Action.prototype.cancel = function () {
33177
- this.stateMachine.transitionTo(ActionState.CANCELLED);
33178
- if (this.onCancel) {
33179
- this.onCancel();
33180
- }
33143
+
33144
+ // Handle low level network errors
33145
+ request.onerror = function handleError() {
33146
+ // Real errors are hidden from us by the browser
33147
+ // onerror should only fire if it's a network error
33148
+ reject(createError('Network Error', config, null, request));
33149
+
33150
+ // Clean up request
33151
+ request = null;
33181
33152
  };
33182
- Action.prototype.addValidTransition = function (from, to) {
33183
- this.stateMachine.addValidStateTransition(from, to);
33153
+
33154
+ // Handle timeout
33155
+ request.ontimeout = function handleTimeout() {
33156
+ reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
33157
+ request));
33158
+
33159
+ // Clean up request
33160
+ request = null;
33184
33161
  };
33185
- Action.prototype.handleSuccess = function (result) {
33186
- this.result = result;
33187
- this.stateMachine.transitionTo(ActionState.COMPLETED);
33188
- if (this.onComplete) {
33189
- this.onComplete(result);
33162
+
33163
+ // Add xsrf header
33164
+ // This is only done if running in a standard browser environment.
33165
+ // Specifically not if we're in a web worker, or react-native.
33166
+ if (utils.isStandardBrowserEnv()) {
33167
+ var cookies = require('./../helpers/cookies');
33168
+
33169
+ // Add xsrf header
33170
+ var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
33171
+ cookies.read(config.xsrfCookieName) :
33172
+ undefined;
33173
+
33174
+ if (xsrfValue) {
33175
+ requestHeaders[config.xsrfHeaderName] = xsrfValue;
33176
+ }
33177
+ }
33178
+
33179
+ // Add headers to the request
33180
+ if ('setRequestHeader' in request) {
33181
+ utils.forEach(requestHeaders, function setRequestHeader(val, key) {
33182
+ if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
33183
+ // Remove Content-Type if data is undefined
33184
+ delete requestHeaders[key];
33185
+ } else {
33186
+ // Otherwise add header to the request
33187
+ request.setRequestHeader(key, val);
33190
33188
  }
33191
- };
33192
- Action.prototype.handleError = function (error) {
33193
- this.error = error;
33194
- this.stateMachine.transitionTo(ActionState.COMPLETED);
33195
- if (this.onError) {
33196
- this.onError(error);
33189
+ });
33190
+ }
33191
+
33192
+ // Add withCredentials to request if needed
33193
+ if (config.withCredentials) {
33194
+ request.withCredentials = true;
33195
+ }
33196
+
33197
+ // Add responseType to request if needed
33198
+ if (config.responseType) {
33199
+ try {
33200
+ request.responseType = config.responseType;
33201
+ } catch (e) {
33202
+ // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
33203
+ // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
33204
+ if (config.responseType !== 'json') {
33205
+ throw e;
33197
33206
  }
33198
- throw new errors_1.InvalidValueError(coinlib_error_1.Domain.ACTIONS, error.message);
33199
- };
33200
- return Action;
33201
- }());
33202
- exports.Action = Action;
33207
+ }
33208
+ }
33203
33209
 
33204
- },{"../errors":307,"../errors/coinlib-error":306,"./StateMachine":233}],230:[function(require,module,exports){
33205
- "use strict";
33206
- var __extends = (this && this.__extends) || (function () {
33207
- var extendStatics = function (d, b) {
33208
- extendStatics = Object.setPrototypeOf ||
33209
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33210
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
33211
- return extendStatics(d, b);
33212
- };
33213
- return function (d, b) {
33214
- extendStatics(d, b);
33215
- function __() { this.constructor = d; }
33216
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33217
- };
33218
- })();
33219
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33220
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33221
- return new (P || (P = Promise))(function (resolve, reject) {
33222
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
33223
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33224
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33225
- step((generator = generator.apply(thisArg, _arguments || [])).next());
33226
- });
33227
- };
33228
- var __generator = (this && this.__generator) || function (thisArg, body) {
33229
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
33230
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
33231
- function verb(n) { return function (v) { return step([n, v]); }; }
33232
- function step(op) {
33233
- if (f) throw new TypeError("Generator is already executing.");
33234
- while (_) try {
33235
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33236
- if (y = 0, t) op = [op[0] & 2, t.value];
33237
- switch (op[0]) {
33238
- case 0: case 1: t = op; break;
33239
- case 4: _.label++; return { value: op[1], done: false };
33240
- case 5: _.label++; y = op[1]; op = [0]; continue;
33241
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
33242
- default:
33243
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33244
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
33245
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33246
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
33247
- if (t[2]) _.ops.pop();
33248
- _.trys.pop(); continue;
33249
- }
33250
- op = body.call(thisArg, _);
33251
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
33252
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
33210
+ // Handle progress if needed
33211
+ if (typeof config.onDownloadProgress === 'function') {
33212
+ request.addEventListener('progress', config.onDownloadProgress);
33253
33213
  }
33254
- };
33255
- Object.defineProperty(exports, "__esModule", { value: true });
33256
- exports.LinkedAction = void 0;
33257
- var Action_1 = require("./Action");
33258
- var LinkedAction = /** @class */ (function (_super) {
33259
- __extends(LinkedAction, _super);
33260
- function LinkedAction(action, linkedActionType) {
33261
- var _this = _super.call(this) || this;
33262
- _this.linkedActionType = linkedActionType;
33263
- _this.action = action;
33264
- return _this;
33214
+
33215
+ // Not all browsers support upload events
33216
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
33217
+ request.upload.addEventListener('progress', config.onUploadProgress);
33265
33218
  }
33266
- LinkedAction.prototype.getLinkedAction = function () {
33267
- return this.linkedAction;
33268
- };
33269
- LinkedAction.prototype.perform = function () {
33270
- return __awaiter(this, void 0, void 0, function () {
33271
- return __generator(this, function (_a) {
33272
- switch (_a.label) {
33273
- case 0: return [4 /*yield*/, this.action.start()];
33274
- case 1:
33275
- _a.sent();
33276
- this.linkedAction = new this.linkedActionType(this.action.result);
33277
- return [4 /*yield*/, this.linkedAction.start()];
33278
- case 2:
33279
- _a.sent();
33280
- return [2 /*return*/, this.linkedAction.result];
33281
- }
33282
- });
33283
- });
33284
- };
33285
- LinkedAction.prototype.cancel = function () {
33286
- if (this.action.getState() === Action_1.ActionState.EXECUTING) {
33287
- this.action.cancel();
33288
- }
33289
- else if (this.linkedAction !== undefined && this.linkedAction.getState() === Action_1.ActionState.EXECUTING) {
33290
- this.linkedAction.cancel();
33291
- }
33292
- _super.prototype.cancel.call(this);
33293
- };
33294
- return LinkedAction;
33295
- }(Action_1.Action));
33296
- exports.LinkedAction = LinkedAction;
33297
33219
 
33298
- },{"./Action":229}],231:[function(require,module,exports){
33299
- "use strict";
33300
- var __extends = (this && this.__extends) || (function () {
33301
- var extendStatics = function (d, b) {
33302
- extendStatics = Object.setPrototypeOf ||
33303
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33304
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
33305
- return extendStatics(d, b);
33306
- };
33307
- return function (d, b) {
33308
- extendStatics(d, b);
33309
- function __() { this.constructor = d; }
33310
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33311
- };
33312
- })();
33313
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33314
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33315
- return new (P || (P = Promise))(function (resolve, reject) {
33316
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
33317
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33318
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33319
- step((generator = generator.apply(thisArg, _arguments || [])).next());
33320
- });
33321
- };
33322
- var __generator = (this && this.__generator) || function (thisArg, body) {
33323
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
33324
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
33325
- function verb(n) { return function (v) { return step([n, v]); }; }
33326
- function step(op) {
33327
- if (f) throw new TypeError("Generator is already executing.");
33328
- while (_) try {
33329
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33330
- if (y = 0, t) op = [op[0] & 2, t.value];
33331
- switch (op[0]) {
33332
- case 0: case 1: t = op; break;
33333
- case 4: _.label++; return { value: op[1], done: false };
33334
- case 5: _.label++; y = op[1]; op = [0]; continue;
33335
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
33336
- default:
33337
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33338
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
33339
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33340
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
33341
- if (t[2]) _.ops.pop();
33342
- _.trys.pop(); continue;
33343
- }
33344
- op = body.call(thisArg, _);
33345
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
33346
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
33347
- }
33348
- };
33349
- Object.defineProperty(exports, "__esModule", { value: true });
33350
- exports.RepeatableAction = void 0;
33351
- var Action_1 = require("./Action");
33352
- var RepeatableAction = /** @class */ (function (_super) {
33353
- __extends(RepeatableAction, _super);
33354
- function RepeatableAction(context, actionFactory) {
33355
- var _this = _super.call(this, context) || this;
33356
- _this.actionFactory = actionFactory;
33357
- _this.addValidTransition(Action_1.ActionState.EXECUTING, Action_1.ActionState.EXECUTING);
33358
- _this.addValidTransition(Action_1.ActionState.COMPLETED, Action_1.ActionState.EXECUTING);
33359
- _this.addValidTransition(Action_1.ActionState.CANCELLED, Action_1.ActionState.EXECUTING);
33360
- return _this;
33361
- }
33362
- RepeatableAction.prototype.perform = function () {
33363
- return __awaiter(this, void 0, void 0, function () {
33364
- return __generator(this, function (_a) {
33365
- switch (_a.label) {
33366
- case 0:
33367
- if (this.innerAction !== undefined && this.innerAction.getState() === Action_1.ActionState.EXECUTING) {
33368
- this.innerAction.cancel();
33369
- }
33370
- this.innerAction = this.actionFactory();
33371
- return [4 /*yield*/, this.innerAction.start()];
33372
- case 1:
33373
- _a.sent();
33374
- return [2 /*return*/, this.innerAction.result];
33375
- }
33376
- });
33377
- });
33378
- };
33379
- RepeatableAction.prototype.cancel = function () {
33380
- if (this.innerAction !== undefined && this.innerAction.getState() === Action_1.ActionState.EXECUTING) {
33381
- this.innerAction.cancel();
33220
+ if (config.cancelToken) {
33221
+ // Handle cancellation
33222
+ config.cancelToken.promise.then(function onCanceled(cancel) {
33223
+ if (!request) {
33224
+ return;
33382
33225
  }
33383
- _super.prototype.cancel.call(this);
33384
- };
33385
- return RepeatableAction;
33386
- }(Action_1.Action));
33387
- exports.RepeatableAction = RepeatableAction;
33388
33226
 
33389
- },{"./Action":229}],232:[function(require,module,exports){
33390
- "use strict";
33391
- var __extends = (this && this.__extends) || (function () {
33392
- var extendStatics = function (d, b) {
33393
- extendStatics = Object.setPrototypeOf ||
33394
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
33395
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
33396
- return extendStatics(d, b);
33397
- };
33398
- return function (d, b) {
33399
- extendStatics(d, b);
33400
- function __() { this.constructor = d; }
33401
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33402
- };
33403
- })();
33404
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33405
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33406
- return new (P || (P = Promise))(function (resolve, reject) {
33407
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
33408
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33409
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33410
- step((generator = generator.apply(thisArg, _arguments || [])).next());
33411
- });
33412
- };
33413
- var __generator = (this && this.__generator) || function (thisArg, body) {
33414
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
33415
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
33416
- function verb(n) { return function (v) { return step([n, v]); }; }
33417
- function step(op) {
33418
- if (f) throw new TypeError("Generator is already executing.");
33419
- while (_) try {
33420
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33421
- if (y = 0, t) op = [op[0] & 2, t.value];
33422
- switch (op[0]) {
33423
- case 0: case 1: t = op; break;
33424
- case 4: _.label++; return { value: op[1], done: false };
33425
- case 5: _.label++; y = op[1]; op = [0]; continue;
33426
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
33427
- default:
33428
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33429
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
33430
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33431
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
33432
- if (t[2]) _.ops.pop();
33433
- _.trys.pop(); continue;
33434
- }
33435
- op = body.call(thisArg, _);
33436
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
33437
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
33227
+ request.abort();
33228
+ reject(cancel);
33229
+ // Clean up request
33230
+ request = null;
33231
+ });
33438
33232
  }
33439
- };
33440
- Object.defineProperty(exports, "__esModule", { value: true });
33441
- exports.SimpleAction = void 0;
33442
- var Action_1 = require("./Action");
33443
- var SimpleAction = /** @class */ (function (_super) {
33444
- __extends(SimpleAction, _super);
33445
- function SimpleAction(promise) {
33446
- var _this = _super.call(this) || this;
33447
- _this.promise = promise;
33448
- return _this;
33233
+
33234
+ if (requestData === undefined) {
33235
+ requestData = null;
33449
33236
  }
33450
- Object.defineProperty(SimpleAction.prototype, "identifier", {
33451
- get: function () {
33452
- return 'simple-action';
33453
- },
33454
- enumerable: false,
33455
- configurable: true
33456
- });
33457
- SimpleAction.prototype.perform = function () {
33458
- return __awaiter(this, void 0, void 0, function () {
33459
- return __generator(this, function (_a) {
33460
- return [2 /*return*/, this.promise()];
33461
- });
33462
- });
33463
- };
33464
- return SimpleAction;
33465
- }(Action_1.Action));
33466
- exports.SimpleAction = SimpleAction;
33467
33237
 
33468
- },{"./Action":229}],233:[function(require,module,exports){
33469
- "use strict";
33470
- Object.defineProperty(exports, "__esModule", { value: true });
33471
- exports.StateMachine = void 0;
33472
- var errors_1 = require("../errors");
33473
- var coinlib_error_1 = require("../errors/coinlib-error");
33474
- var StateMachine = /** @class */ (function () {
33475
- function StateMachine(initialState, validTransitions) {
33476
- this.state = initialState;
33477
- this.validTransitions = validTransitions;
33478
- }
33479
- StateMachine.prototype.transitionTo = function (state) {
33480
- if (this.canTransitionTo(state)) {
33481
- this.state = state;
33482
- }
33483
- else {
33484
- throw new errors_1.OperationFailedError(coinlib_error_1.Domain.ACTIONS, "Invalid state transition: " + this.state + " -> " + state);
33485
- }
33486
- };
33487
- StateMachine.prototype.getState = function () {
33488
- return this.state;
33489
- };
33490
- StateMachine.prototype.addValidStateTransition = function (from, to) {
33491
- var states = this.validTransitions.get(to);
33492
- if (states !== undefined && states.indexOf(from) === -1) {
33493
- states.push(from);
33494
- this.validTransitions.set(to, states);
33495
- }
33496
- else {
33497
- this.validTransitions.set(to, [from]);
33498
- }
33499
- };
33500
- StateMachine.prototype.canTransitionTo = function (state) {
33501
- var states = this.validTransitions.get(state);
33502
- if (states !== undefined) {
33503
- return states.indexOf(this.state) !== -1;
33504
- }
33505
- return false;
33506
- };
33507
- return StateMachine;
33508
- }());
33509
- exports.StateMachine = StateMachine;
33238
+ // Send the request
33239
+ request.send(requestData);
33240
+ });
33241
+ };
33510
33242
 
33511
- },{"../errors":307,"../errors/coinlib-error":306}],234:[function(require,module,exports){
33512
- module.exports = require('./lib/axios');
33513
- },{"./lib/axios":236}],235:[function(require,module,exports){
33243
+ },{"../core/createError":236,"./../core/settle":240,"./../helpers/buildURL":244,"./../helpers/cookies":246,"./../helpers/isURLSameOrigin":248,"./../helpers/parseHeaders":250,"./../utils":252}],230:[function(require,module,exports){
33514
33244
  'use strict';
33515
33245
 
33516
- var utils = require('./../utils');
33517
- var settle = require('./../core/settle');
33518
- var buildURL = require('./../helpers/buildURL');
33519
- var parseHeaders = require('./../helpers/parseHeaders');
33520
- var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
33521
- var createError = require('../core/createError');
33246
+ var utils = require('./utils');
33247
+ var bind = require('./helpers/bind');
33248
+ var Axios = require('./core/Axios');
33249
+ var mergeConfig = require('./core/mergeConfig');
33250
+ var defaults = require('./defaults');
33522
33251
 
33523
- module.exports = function xhrAdapter(config) {
33524
- return new Promise(function dispatchXhrRequest(resolve, reject) {
33525
- var requestData = config.data;
33526
- var requestHeaders = config.headers;
33252
+ /**
33253
+ * Create an instance of Axios
33254
+ *
33255
+ * @param {Object} defaultConfig The default config for the instance
33256
+ * @return {Axios} A new instance of Axios
33257
+ */
33258
+ function createInstance(defaultConfig) {
33259
+ var context = new Axios(defaultConfig);
33260
+ var instance = bind(Axios.prototype.request, context);
33527
33261
 
33528
- if (utils.isFormData(requestData)) {
33529
- delete requestHeaders['Content-Type']; // Let the browser set it
33530
- }
33262
+ // Copy axios.prototype to instance
33263
+ utils.extend(instance, Axios.prototype, context);
33531
33264
 
33532
- var request = new XMLHttpRequest();
33265
+ // Copy context to instance
33266
+ utils.extend(instance, context);
33533
33267
 
33534
- // HTTP basic authentication
33535
- if (config.auth) {
33536
- var username = config.auth.username || '';
33537
- var password = config.auth.password || '';
33538
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
33539
- }
33268
+ return instance;
33269
+ }
33540
33270
 
33541
- request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
33271
+ // Create the default instance to be exported
33272
+ var axios = createInstance(defaults);
33542
33273
 
33543
- // Set the request timeout in MS
33544
- request.timeout = config.timeout;
33274
+ // Expose Axios class to allow class inheritance
33275
+ axios.Axios = Axios;
33545
33276
 
33546
- // Listen for ready state
33547
- request.onreadystatechange = function handleLoad() {
33548
- if (!request || request.readyState !== 4) {
33549
- return;
33550
- }
33277
+ // Factory for creating new instances
33278
+ axios.create = function create(instanceConfig) {
33279
+ return createInstance(mergeConfig(axios.defaults, instanceConfig));
33280
+ };
33551
33281
 
33552
- // The request errored out and we didn't get a response, this will be
33553
- // handled by onerror instead
33554
- // With one exception: request that using file: protocol, most browsers
33555
- // will return status as 0 even though it's a successful request
33556
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
33557
- return;
33558
- }
33282
+ // Expose Cancel & CancelToken
33283
+ axios.Cancel = require('./cancel/Cancel');
33284
+ axios.CancelToken = require('./cancel/CancelToken');
33285
+ axios.isCancel = require('./cancel/isCancel');
33559
33286
 
33560
- // Prepare the response
33561
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
33562
- var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
33563
- var response = {
33564
- data: responseData,
33565
- status: request.status,
33566
- statusText: request.statusText,
33567
- headers: responseHeaders,
33568
- config: config,
33569
- request: request
33570
- };
33287
+ // Expose all/spread
33288
+ axios.all = function all(promises) {
33289
+ return Promise.all(promises);
33290
+ };
33291
+ axios.spread = require('./helpers/spread');
33571
33292
 
33572
- settle(resolve, reject, response);
33573
-
33574
- // Clean up request
33575
- request = null;
33576
- };
33577
-
33578
- // Handle browser request cancellation (as opposed to a manual cancellation)
33579
- request.onabort = function handleAbort() {
33580
- if (!request) {
33581
- return;
33582
- }
33583
-
33584
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
33585
-
33586
- // Clean up request
33587
- request = null;
33588
- };
33589
-
33590
- // Handle low level network errors
33591
- request.onerror = function handleError() {
33592
- // Real errors are hidden from us by the browser
33593
- // onerror should only fire if it's a network error
33594
- reject(createError('Network Error', config, null, request));
33595
-
33596
- // Clean up request
33597
- request = null;
33598
- };
33599
-
33600
- // Handle timeout
33601
- request.ontimeout = function handleTimeout() {
33602
- reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
33603
- request));
33604
-
33605
- // Clean up request
33606
- request = null;
33607
- };
33608
-
33609
- // Add xsrf header
33610
- // This is only done if running in a standard browser environment.
33611
- // Specifically not if we're in a web worker, or react-native.
33612
- if (utils.isStandardBrowserEnv()) {
33613
- var cookies = require('./../helpers/cookies');
33614
-
33615
- // Add xsrf header
33616
- var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
33617
- cookies.read(config.xsrfCookieName) :
33618
- undefined;
33619
-
33620
- if (xsrfValue) {
33621
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
33622
- }
33623
- }
33624
-
33625
- // Add headers to the request
33626
- if ('setRequestHeader' in request) {
33627
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
33628
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
33629
- // Remove Content-Type if data is undefined
33630
- delete requestHeaders[key];
33631
- } else {
33632
- // Otherwise add header to the request
33633
- request.setRequestHeader(key, val);
33634
- }
33635
- });
33636
- }
33637
-
33638
- // Add withCredentials to request if needed
33639
- if (config.withCredentials) {
33640
- request.withCredentials = true;
33641
- }
33642
-
33643
- // Add responseType to request if needed
33644
- if (config.responseType) {
33645
- try {
33646
- request.responseType = config.responseType;
33647
- } catch (e) {
33648
- // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
33649
- // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
33650
- if (config.responseType !== 'json') {
33651
- throw e;
33652
- }
33653
- }
33654
- }
33655
-
33656
- // Handle progress if needed
33657
- if (typeof config.onDownloadProgress === 'function') {
33658
- request.addEventListener('progress', config.onDownloadProgress);
33659
- }
33660
-
33661
- // Not all browsers support upload events
33662
- if (typeof config.onUploadProgress === 'function' && request.upload) {
33663
- request.upload.addEventListener('progress', config.onUploadProgress);
33664
- }
33665
-
33666
- if (config.cancelToken) {
33667
- // Handle cancellation
33668
- config.cancelToken.promise.then(function onCanceled(cancel) {
33669
- if (!request) {
33670
- return;
33671
- }
33672
-
33673
- request.abort();
33674
- reject(cancel);
33675
- // Clean up request
33676
- request = null;
33677
- });
33678
- }
33679
-
33680
- if (requestData === undefined) {
33681
- requestData = null;
33682
- }
33683
-
33684
- // Send the request
33685
- request.send(requestData);
33686
- });
33687
- };
33688
-
33689
- },{"../core/createError":242,"./../core/settle":246,"./../helpers/buildURL":250,"./../helpers/cookies":252,"./../helpers/isURLSameOrigin":254,"./../helpers/parseHeaders":256,"./../utils":258}],236:[function(require,module,exports){
33690
- 'use strict';
33691
-
33692
- var utils = require('./utils');
33693
- var bind = require('./helpers/bind');
33694
- var Axios = require('./core/Axios');
33695
- var mergeConfig = require('./core/mergeConfig');
33696
- var defaults = require('./defaults');
33697
-
33698
- /**
33699
- * Create an instance of Axios
33700
- *
33701
- * @param {Object} defaultConfig The default config for the instance
33702
- * @return {Axios} A new instance of Axios
33703
- */
33704
- function createInstance(defaultConfig) {
33705
- var context = new Axios(defaultConfig);
33706
- var instance = bind(Axios.prototype.request, context);
33707
-
33708
- // Copy axios.prototype to instance
33709
- utils.extend(instance, Axios.prototype, context);
33710
-
33711
- // Copy context to instance
33712
- utils.extend(instance, context);
33713
-
33714
- return instance;
33715
- }
33716
-
33717
- // Create the default instance to be exported
33718
- var axios = createInstance(defaults);
33719
-
33720
- // Expose Axios class to allow class inheritance
33721
- axios.Axios = Axios;
33722
-
33723
- // Factory for creating new instances
33724
- axios.create = function create(instanceConfig) {
33725
- return createInstance(mergeConfig(axios.defaults, instanceConfig));
33726
- };
33727
-
33728
- // Expose Cancel & CancelToken
33729
- axios.Cancel = require('./cancel/Cancel');
33730
- axios.CancelToken = require('./cancel/CancelToken');
33731
- axios.isCancel = require('./cancel/isCancel');
33732
-
33733
- // Expose all/spread
33734
- axios.all = function all(promises) {
33735
- return Promise.all(promises);
33736
- };
33737
- axios.spread = require('./helpers/spread');
33738
-
33739
- module.exports = axios;
33293
+ module.exports = axios;
33740
33294
 
33741
33295
  // Allow use of default import syntax in TypeScript
33742
33296
  module.exports.default = axios;
33743
33297
 
33744
- },{"./cancel/Cancel":237,"./cancel/CancelToken":238,"./cancel/isCancel":239,"./core/Axios":240,"./core/mergeConfig":245,"./defaults":248,"./helpers/bind":249,"./helpers/spread":257,"./utils":258}],237:[function(require,module,exports){
33298
+ },{"./cancel/Cancel":231,"./cancel/CancelToken":232,"./cancel/isCancel":233,"./core/Axios":234,"./core/mergeConfig":239,"./defaults":242,"./helpers/bind":243,"./helpers/spread":251,"./utils":252}],231:[function(require,module,exports){
33745
33299
  'use strict';
33746
33300
 
33747
33301
  /**
@@ -33762,7 +33316,7 @@ Cancel.prototype.__CANCEL__ = true;
33762
33316
 
33763
33317
  module.exports = Cancel;
33764
33318
 
33765
- },{}],238:[function(require,module,exports){
33319
+ },{}],232:[function(require,module,exports){
33766
33320
  'use strict';
33767
33321
 
33768
33322
  var Cancel = require('./Cancel');
@@ -33821,14 +33375,14 @@ CancelToken.source = function source() {
33821
33375
 
33822
33376
  module.exports = CancelToken;
33823
33377
 
33824
- },{"./Cancel":237}],239:[function(require,module,exports){
33378
+ },{"./Cancel":231}],233:[function(require,module,exports){
33825
33379
  'use strict';
33826
33380
 
33827
33381
  module.exports = function isCancel(value) {
33828
33382
  return !!(value && value.__CANCEL__);
33829
33383
  };
33830
33384
 
33831
- },{}],240:[function(require,module,exports){
33385
+ },{}],234:[function(require,module,exports){
33832
33386
  'use strict';
33833
33387
 
33834
33388
  var utils = require('./../utils');
@@ -33916,7 +33470,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
33916
33470
 
33917
33471
  module.exports = Axios;
33918
33472
 
33919
- },{"../helpers/buildURL":250,"./../utils":258,"./InterceptorManager":241,"./dispatchRequest":243,"./mergeConfig":245}],241:[function(require,module,exports){
33473
+ },{"../helpers/buildURL":244,"./../utils":252,"./InterceptorManager":235,"./dispatchRequest":237,"./mergeConfig":239}],235:[function(require,module,exports){
33920
33474
  'use strict';
33921
33475
 
33922
33476
  var utils = require('./../utils');
@@ -33970,7 +33524,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
33970
33524
 
33971
33525
  module.exports = InterceptorManager;
33972
33526
 
33973
- },{"./../utils":258}],242:[function(require,module,exports){
33527
+ },{"./../utils":252}],236:[function(require,module,exports){
33974
33528
  'use strict';
33975
33529
 
33976
33530
  var enhanceError = require('./enhanceError');
@@ -33990,7 +33544,7 @@ module.exports = function createError(message, config, code, request, response)
33990
33544
  return enhanceError(error, config, code, request, response);
33991
33545
  };
33992
33546
 
33993
- },{"./enhanceError":244}],243:[function(require,module,exports){
33547
+ },{"./enhanceError":238}],237:[function(require,module,exports){
33994
33548
  'use strict';
33995
33549
 
33996
33550
  var utils = require('./../utils');
@@ -34078,7 +33632,7 @@ module.exports = function dispatchRequest(config) {
34078
33632
  });
34079
33633
  };
34080
33634
 
34081
- },{"../cancel/isCancel":239,"../defaults":248,"./../helpers/combineURLs":251,"./../helpers/isAbsoluteURL":253,"./../utils":258,"./transformData":247}],244:[function(require,module,exports){
33635
+ },{"../cancel/isCancel":233,"../defaults":242,"./../helpers/combineURLs":245,"./../helpers/isAbsoluteURL":247,"./../utils":252,"./transformData":241}],238:[function(require,module,exports){
34082
33636
  'use strict';
34083
33637
 
34084
33638
  /**
@@ -34122,7 +33676,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
34122
33676
  return error;
34123
33677
  };
34124
33678
 
34125
- },{}],245:[function(require,module,exports){
33679
+ },{}],239:[function(require,module,exports){
34126
33680
  'use strict';
34127
33681
 
34128
33682
  var utils = require('../utils');
@@ -34175,7 +33729,7 @@ module.exports = function mergeConfig(config1, config2) {
34175
33729
  return config;
34176
33730
  };
34177
33731
 
34178
- },{"../utils":258}],246:[function(require,module,exports){
33732
+ },{"../utils":252}],240:[function(require,module,exports){
34179
33733
  'use strict';
34180
33734
 
34181
33735
  var createError = require('./createError');
@@ -34202,7 +33756,7 @@ module.exports = function settle(resolve, reject, response) {
34202
33756
  }
34203
33757
  };
34204
33758
 
34205
- },{"./createError":242}],247:[function(require,module,exports){
33759
+ },{"./createError":236}],241:[function(require,module,exports){
34206
33760
  'use strict';
34207
33761
 
34208
33762
  var utils = require('./../utils');
@@ -34224,7 +33778,7 @@ module.exports = function transformData(data, headers, fns) {
34224
33778
  return data;
34225
33779
  };
34226
33780
 
34227
- },{"./../utils":258}],248:[function(require,module,exports){
33781
+ },{"./../utils":252}],242:[function(require,module,exports){
34228
33782
  (function (process){(function (){
34229
33783
  'use strict';
34230
33784
 
@@ -34326,7 +33880,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
34326
33880
  module.exports = defaults;
34327
33881
 
34328
33882
  }).call(this)}).call(this,require('_process'))
34329
- },{"./adapters/http":235,"./adapters/xhr":235,"./helpers/normalizeHeaderName":255,"./utils":258,"_process":180}],249:[function(require,module,exports){
33883
+ },{"./adapters/http":229,"./adapters/xhr":229,"./helpers/normalizeHeaderName":249,"./utils":252,"_process":180}],243:[function(require,module,exports){
34330
33884
  'use strict';
34331
33885
 
34332
33886
  module.exports = function bind(fn, thisArg) {
@@ -34339,7 +33893,7 @@ module.exports = function bind(fn, thisArg) {
34339
33893
  };
34340
33894
  };
34341
33895
 
34342
- },{}],250:[function(require,module,exports){
33896
+ },{}],244:[function(require,module,exports){
34343
33897
  'use strict';
34344
33898
 
34345
33899
  var utils = require('./../utils');
@@ -34412,7 +33966,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
34412
33966
  return url;
34413
33967
  };
34414
33968
 
34415
- },{"./../utils":258}],251:[function(require,module,exports){
33969
+ },{"./../utils":252}],245:[function(require,module,exports){
34416
33970
  'use strict';
34417
33971
 
34418
33972
  /**
@@ -34428,7 +33982,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
34428
33982
  : baseURL;
34429
33983
  };
34430
33984
 
34431
- },{}],252:[function(require,module,exports){
33985
+ },{}],246:[function(require,module,exports){
34432
33986
  'use strict';
34433
33987
 
34434
33988
  var utils = require('./../utils');
@@ -34483,7 +34037,7 @@ module.exports = (
34483
34037
  })()
34484
34038
  );
34485
34039
 
34486
- },{"./../utils":258}],253:[function(require,module,exports){
34040
+ },{"./../utils":252}],247:[function(require,module,exports){
34487
34041
  'use strict';
34488
34042
 
34489
34043
  /**
@@ -34499,7 +34053,7 @@ module.exports = function isAbsoluteURL(url) {
34499
34053
  return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
34500
34054
  };
34501
34055
 
34502
- },{}],254:[function(require,module,exports){
34056
+ },{}],248:[function(require,module,exports){
34503
34057
  'use strict';
34504
34058
 
34505
34059
  var utils = require('./../utils');
@@ -34569,7 +34123,7 @@ module.exports = (
34569
34123
  })()
34570
34124
  );
34571
34125
 
34572
- },{"./../utils":258}],255:[function(require,module,exports){
34126
+ },{"./../utils":252}],249:[function(require,module,exports){
34573
34127
  'use strict';
34574
34128
 
34575
34129
  var utils = require('../utils');
@@ -34583,7 +34137,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
34583
34137
  });
34584
34138
  };
34585
34139
 
34586
- },{"../utils":258}],256:[function(require,module,exports){
34140
+ },{"../utils":252}],250:[function(require,module,exports){
34587
34141
  'use strict';
34588
34142
 
34589
34143
  var utils = require('./../utils');
@@ -34638,7 +34192,7 @@ module.exports = function parseHeaders(headers) {
34638
34192
  return parsed;
34639
34193
  };
34640
34194
 
34641
- },{"./../utils":258}],257:[function(require,module,exports){
34195
+ },{"./../utils":252}],251:[function(require,module,exports){
34642
34196
  'use strict';
34643
34197
 
34644
34198
  /**
@@ -34667,7 +34221,7 @@ module.exports = function spread(callback) {
34667
34221
  };
34668
34222
  };
34669
34223
 
34670
- },{}],258:[function(require,module,exports){
34224
+ },{}],252:[function(require,module,exports){
34671
34225
  'use strict';
34672
34226
 
34673
34227
  var bind = require('./helpers/bind');
@@ -35003,7 +34557,7 @@ module.exports = {
35003
34557
  trim: trim
35004
34558
  };
35005
34559
 
35006
- },{"../../is-buffer-2.0.3/index":284,"./helpers/bind":249}],259:[function(require,module,exports){
34560
+ },{"../../is-buffer-2.0.3/index":278,"./helpers/bind":243}],253:[function(require,module,exports){
35007
34561
  'use strict'
35008
34562
  // base-x encoding / decoding
35009
34563
  // Copyright (c) 2018 base-x contributors
@@ -35125,7 +34679,7 @@ function base (ALPHABET) {
35125
34679
  }
35126
34680
  module.exports = base
35127
34681
 
35128
- },{"../../safe-buffer-5.2.0/index":294}],260:[function(require,module,exports){
34682
+ },{"../../safe-buffer-5.2.0/index":288}],254:[function(require,module,exports){
35129
34683
  ;(function (globalObject) {
35130
34684
  'use strict';
35131
34685
 
@@ -38029,7 +37583,7 @@ module.exports = base
38029
37583
  }
38030
37584
  })(this);
38031
37585
 
38032
- },{}],261:[function(require,module,exports){
37586
+ },{}],255:[function(require,module,exports){
38033
37587
  /*
38034
37588
  * Bitcoin BIP32 path helpers
38035
37589
  * (C) 2016 Alex Beregszaszi
@@ -38127,7 +37681,7 @@ BIPPath.prototype.inspect = function () {
38127
37681
 
38128
37682
  module.exports = BIPPath
38129
37683
 
38130
- },{}],262:[function(require,module,exports){
37684
+ },{}],256:[function(require,module,exports){
38131
37685
  var Buffer = require('../safe-buffer-5.2.0/index').Buffer
38132
37686
  var createHash = require('../create-hash-1.2.0/browser')
38133
37687
  var pbkdf2 = require('../pbkdf2-3.0.17/index').pbkdf2Sync
@@ -38282,7 +37836,7 @@ module.exports = {
38282
37836
  }
38283
37837
  }
38284
37838
 
38285
- },{"../create-hash-1.2.0/browser":275,"../pbkdf2-3.0.17/index":286,"../randombytes-2.1.0/browser":291,"../safe-buffer-5.2.0/index":294,"../unorm-1.6.0/lib/unorm":305,"./wordlists/chinese_simplified.json":263,"./wordlists/chinese_traditional.json":264,"./wordlists/english.json":265,"./wordlists/french.json":266,"./wordlists/italian.json":267,"./wordlists/japanese.json":268,"./wordlists/korean.json":269,"./wordlists/spanish.json":270}],263:[function(require,module,exports){
37839
+ },{"../create-hash-1.2.0/browser":269,"../pbkdf2-3.0.17/index":280,"../randombytes-2.1.0/browser":285,"../safe-buffer-5.2.0/index":288,"../unorm-1.6.0/lib/unorm":299,"./wordlists/chinese_simplified.json":257,"./wordlists/chinese_traditional.json":258,"./wordlists/english.json":259,"./wordlists/french.json":260,"./wordlists/italian.json":261,"./wordlists/japanese.json":262,"./wordlists/korean.json":263,"./wordlists/spanish.json":264}],257:[function(require,module,exports){
38286
37840
  module.exports=[
38287
37841
  "的",
38288
37842
  "一",
@@ -40333,7 +39887,7 @@ module.exports=[
40333
39887
  "矮",
40334
39888
  "歇"
40335
39889
  ]
40336
- },{}],264:[function(require,module,exports){
39890
+ },{}],258:[function(require,module,exports){
40337
39891
  module.exports=[
40338
39892
  "的",
40339
39893
  "一",
@@ -42384,7 +41938,7 @@ module.exports=[
42384
41938
  "矮",
42385
41939
  "歇"
42386
41940
  ]
42387
- },{}],265:[function(require,module,exports){
41941
+ },{}],259:[function(require,module,exports){
42388
41942
  module.exports=[
42389
41943
  "abandon",
42390
41944
  "ability",
@@ -44435,7 +43989,7 @@ module.exports=[
44435
43989
  "zone",
44436
43990
  "zoo"
44437
43991
  ]
44438
- },{}],266:[function(require,module,exports){
43992
+ },{}],260:[function(require,module,exports){
44439
43993
  module.exports=[
44440
43994
  "abaisser",
44441
43995
  "abandon",
@@ -46486,7 +46040,7 @@ module.exports=[
46486
46040
  "zeste",
46487
46041
  "zoologie"
46488
46042
  ]
46489
- },{}],267:[function(require,module,exports){
46043
+ },{}],261:[function(require,module,exports){
46490
46044
  module.exports=[
46491
46045
  "abaco",
46492
46046
  "abbaglio",
@@ -48537,7 +48091,7 @@ module.exports=[
48537
48091
  "zulu",
48538
48092
  "zuppa"
48539
48093
  ]
48540
- },{}],268:[function(require,module,exports){
48094
+ },{}],262:[function(require,module,exports){
48541
48095
  module.exports=[
48542
48096
  "あいこくしん",
48543
48097
  "あいさつ",
@@ -50588,7 +50142,7 @@ module.exports=[
50588
50142
  "わらう",
50589
50143
  "われる"
50590
50144
  ]
50591
- },{}],269:[function(require,module,exports){
50145
+ },{}],263:[function(require,module,exports){
50592
50146
  module.exports=[
50593
50147
  "가격",
50594
50148
  "가끔",
@@ -52639,7 +52193,7 @@ module.exports=[
52639
52193
  "흰색",
52640
52194
  "힘껏"
52641
52195
  ]
52642
- },{}],270:[function(require,module,exports){
52196
+ },{}],264:[function(require,module,exports){
52643
52197
  module.exports=[
52644
52198
  "ábaco",
52645
52199
  "abdomen",
@@ -54690,13 +54244,13 @@ module.exports=[
54690
54244
  "zumo",
54691
54245
  "zurdo"
54692
54246
  ]
54693
- },{}],271:[function(require,module,exports){
54247
+ },{}],265:[function(require,module,exports){
54694
54248
  var basex = require('../base-x-3.0.7/src/index')
54695
54249
  var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
54696
54250
 
54697
54251
  module.exports = basex(ALPHABET)
54698
54252
 
54699
- },{"../base-x-3.0.7/src/index":259}],272:[function(require,module,exports){
54253
+ },{"../base-x-3.0.7/src/index":253}],266:[function(require,module,exports){
54700
54254
  'use strict'
54701
54255
 
54702
54256
  var base58 = require('../bs58-4.0.1/index')
@@ -54748,7 +54302,7 @@ module.exports = function (checksumFn) {
54748
54302
  }
54749
54303
  }
54750
54304
 
54751
- },{"../bs58-4.0.1/index":271,"../safe-buffer-5.2.0/index":294}],273:[function(require,module,exports){
54305
+ },{"../bs58-4.0.1/index":265,"../safe-buffer-5.2.0/index":288}],267:[function(require,module,exports){
54752
54306
  'use strict'
54753
54307
 
54754
54308
  var createHash = require('../create-hash-1.2.0/browser')
@@ -54762,7 +54316,7 @@ function sha256x2 (buffer) {
54762
54316
 
54763
54317
  module.exports = bs58checkBase(sha256x2)
54764
54318
 
54765
- },{"../create-hash-1.2.0/browser":275,"./base":272}],274:[function(require,module,exports){
54319
+ },{"../create-hash-1.2.0/browser":269,"./base":266}],268:[function(require,module,exports){
54766
54320
  var Buffer = require('../safe-buffer-5.2.0/index').Buffer
54767
54321
  var Transform = require('stream').Transform
54768
54322
  var StringDecoder = require('string_decoder').StringDecoder
@@ -54863,7 +54417,7 @@ CipherBase.prototype._toString = function (value, enc, fin) {
54863
54417
 
54864
54418
  module.exports = CipherBase
54865
54419
 
54866
- },{"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294,"stream":201,"string_decoder":216}],275:[function(require,module,exports){
54420
+ },{"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288,"stream":201,"string_decoder":216}],269:[function(require,module,exports){
54867
54421
  'use strict'
54868
54422
  var inherits = require('../inherits-2.0.4/inherits')
54869
54423
  var MD5 = require('../md5.js-1.3.5/index')
@@ -54895,10 +54449,10 @@ module.exports = function createHash (alg) {
54895
54449
  return new Hash(sha(alg))
54896
54450
  }
54897
54451
 
54898
- },{"../cipher-base-1.0.4/index":274,"../inherits-2.0.4/inherits":282,"../md5.js-1.3.5/index":285,"../ripemd160-2.0.2/index":292,"../sha.js-2.4.11/index":296}],276:[function(require,module,exports){
54452
+ },{"../cipher-base-1.0.4/index":268,"../inherits-2.0.4/inherits":276,"../md5.js-1.3.5/index":279,"../ripemd160-2.0.2/index":286,"../sha.js-2.4.11/index":290}],270:[function(require,module,exports){
54899
54453
  module.exports = require('crypto').createHash
54900
54454
 
54901
- },{"crypto":87}],277:[function(require,module,exports){
54455
+ },{"crypto":87}],271:[function(require,module,exports){
54902
54456
  (function (Buffer){(function (){
54903
54457
  'use strict';
54904
54458
  var createHash = require('../create-hash-1.2.0/browser')
@@ -54970,7 +54524,7 @@ module.exports = function createHmac(alg, key) {
54970
54524
  }
54971
54525
 
54972
54526
  }).call(this)}).call(this,require("buffer").Buffer)
54973
- },{"../create-hash-1.2.0/browser":275,"../inherits-2.0.4/inherits":282,"buffer":76,"stream":201}],278:[function(require,module,exports){
54527
+ },{"../create-hash-1.2.0/browser":269,"../inherits-2.0.4/inherits":276,"buffer":76,"stream":201}],272:[function(require,module,exports){
54974
54528
  'use strict'
54975
54529
  var Buffer = require('../safe-buffer-5.2.0/index').Buffer
54976
54530
  var Transform = require('stream').Transform
@@ -55067,7 +54621,7 @@ HashBase.prototype._digest = function () {
55067
54621
 
55068
54622
  module.exports = HashBase
55069
54623
 
55070
- },{"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294,"stream":201}],279:[function(require,module,exports){
54624
+ },{"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288,"stream":201}],273:[function(require,module,exports){
55071
54625
  (function (Buffer){(function (){
55072
54626
  "use strict";
55073
54627
  /*
@@ -55167,7 +54721,7 @@ function derivePathFromSeed(path, seed) {
55167
54721
  exports.derivePathFromSeed = derivePathFromSeed;
55168
54722
 
55169
54723
  }).call(this)}).call(this,require("buffer").Buffer)
55170
- },{"../../bip32-path-0.4.2/index":261,"../../tweetnacl-1.0.1/nacl":303,"../../tweetnacl-auth-1.0.1/nacl-auth":304,"buffer":76}],280:[function(require,module,exports){
54724
+ },{"../../bip32-path-0.4.2/index":255,"../../tweetnacl-1.0.1/nacl":297,"../../tweetnacl-auth-1.0.1/nacl-auth":298,"buffer":76}],274:[function(require,module,exports){
55171
54725
  "use strict";
55172
54726
  /*
55173
54727
  * ISC License (ISC)
@@ -55205,7 +54759,7 @@ function getHDWalletAccounts(wallet, accountCount) {
55205
54759
  }
55206
54760
  exports.getHDWalletAccounts = getHDWalletAccounts;
55207
54761
 
55208
- },{"./hd-key":279}],281:[function(require,module,exports){
54762
+ },{"./hd-key":273}],275:[function(require,module,exports){
55209
54763
  "use strict";
55210
54764
  /*
55211
54765
  * ISC License (ISC)
@@ -55236,7 +54790,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
55236
54790
  Object.defineProperty(exports, "__esModule", { value: true });
55237
54791
  __exportStar(require("./hd-wallet"), exports);
55238
54792
 
55239
- },{"./hd-wallet":280}],282:[function(require,module,exports){
54793
+ },{"./hd-wallet":274}],276:[function(require,module,exports){
55240
54794
  try {
55241
54795
  var util = require('util');
55242
54796
  /* istanbul ignore next */
@@ -55247,9 +54801,9 @@ try {
55247
54801
  module.exports = require('./inherits_browser.js');
55248
54802
  }
55249
54803
 
55250
- },{"./inherits_browser.js":283,"util":221}],283:[function(require,module,exports){
54804
+ },{"./inherits_browser.js":277,"util":221}],277:[function(require,module,exports){
55251
54805
  arguments[4][157][0].apply(exports,arguments)
55252
- },{"dup":157}],284:[function(require,module,exports){
54806
+ },{"dup":157}],278:[function(require,module,exports){
55253
54807
  /*!
55254
54808
  * Determine if an object is a Buffer
55255
54809
  *
@@ -55262,7 +54816,7 @@ module.exports = function isBuffer (obj) {
55262
54816
  typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
55263
54817
  }
55264
54818
 
55265
- },{}],285:[function(require,module,exports){
54819
+ },{}],279:[function(require,module,exports){
55266
54820
  'use strict'
55267
54821
  var inherits = require('../inherits-2.0.4/inherits')
55268
54822
  var HashBase = require('../hash-base-3.0.4/index')
@@ -55410,7 +54964,7 @@ function fnI (a, b, c, d, m, k, s) {
55410
54964
 
55411
54965
  module.exports = MD5
55412
54966
 
55413
- },{"../hash-base-3.0.4/index":278,"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294}],286:[function(require,module,exports){
54967
+ },{"../hash-base-3.0.4/index":272,"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288}],280:[function(require,module,exports){
55414
54968
  var checkParameters = require('./lib/precondition')
55415
54969
  var native = require('crypto')
55416
54970
 
@@ -55443,7 +54997,7 @@ if (!native.pbkdf2Sync || native.pbkdf2Sync.toString().indexOf('keylen, digest')
55443
54997
  exports.pbkdf2 = nativePBKDF2
55444
54998
  }
55445
54999
 
55446
- },{"./lib/async":287,"./lib/precondition":289,"./lib/sync":290,"crypto":87}],287:[function(require,module,exports){
55000
+ },{"./lib/async":281,"./lib/precondition":283,"./lib/sync":284,"crypto":87}],281:[function(require,module,exports){
55447
55001
  (function (process,global){(function (){
55448
55002
  var checkParameters = require('./precondition')
55449
55003
  var defaultEncoding = require('./default-encoding')
@@ -55547,7 +55101,7 @@ module.exports = function (password, salt, iterations, keylen, digest, callback)
55547
55101
  }
55548
55102
 
55549
55103
  }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
55550
- },{"../../safe-buffer-5.2.0/index":294,"./default-encoding":288,"./precondition":289,"./sync":290,"_process":180}],288:[function(require,module,exports){
55104
+ },{"../../safe-buffer-5.2.0/index":288,"./default-encoding":282,"./precondition":283,"./sync":284,"_process":180}],282:[function(require,module,exports){
55551
55105
  (function (process){(function (){
55552
55106
  var defaultEncoding
55553
55107
  /* istanbul ignore next */
@@ -55561,7 +55115,7 @@ if (process.browser) {
55561
55115
  module.exports = defaultEncoding
55562
55116
 
55563
55117
  }).call(this)}).call(this,require('_process'))
55564
- },{"_process":180}],289:[function(require,module,exports){
55118
+ },{"_process":180}],283:[function(require,module,exports){
55565
55119
  (function (Buffer){(function (){
55566
55120
  var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
55567
55121
 
@@ -55593,7 +55147,7 @@ module.exports = function (password, salt, iterations, keylen) {
55593
55147
  }
55594
55148
 
55595
55149
  }).call(this)}).call(this,{"isBuffer":require("../../../../../../../node_modules/is-buffer/index.js")})
55596
- },{"../../../../../../../node_modules/is-buffer/index.js":159}],290:[function(require,module,exports){
55150
+ },{"../../../../../../../node_modules/is-buffer/index.js":159}],284:[function(require,module,exports){
55597
55151
  var sizes = {
55598
55152
  md5: 16,
55599
55153
  sha1: 20,
@@ -55646,7 +55200,7 @@ function pbkdf2 (password, salt, iterations, keylen, digest) {
55646
55200
 
55647
55201
  module.exports = pbkdf2
55648
55202
 
55649
- },{"../../create-hmac-1.1.4/browser":277,"../../safe-buffer-5.2.0/index":294,"../lib/default-encoding":288,"../lib/precondition":289}],291:[function(require,module,exports){
55203
+ },{"../../create-hmac-1.1.4/browser":271,"../../safe-buffer-5.2.0/index":288,"../lib/default-encoding":282,"../lib/precondition":283}],285:[function(require,module,exports){
55650
55204
  (function (process,global){(function (){
55651
55205
  'use strict'
55652
55206
 
@@ -55700,7 +55254,7 @@ function randomBytes (size, cb) {
55700
55254
  }
55701
55255
 
55702
55256
  }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
55703
- },{"../safe-buffer-5.2.0/index":294,"_process":180}],292:[function(require,module,exports){
55257
+ },{"../safe-buffer-5.2.0/index":288,"_process":180}],286:[function(require,module,exports){
55704
55258
  'use strict'
55705
55259
  var Buffer = require('buffer').Buffer
55706
55260
  var inherits = require('../inherits-2.0.4/inherits')
@@ -55865,7 +55419,7 @@ function fn5 (a, b, c, d, e, m, k, s) {
55865
55419
 
55866
55420
  module.exports = RIPEMD160
55867
55421
 
55868
- },{"../hash-base-3.0.4/index":278,"../inherits-2.0.4/inherits":282,"buffer":76}],293:[function(require,module,exports){
55422
+ },{"../hash-base-3.0.4/index":272,"../inherits-2.0.4/inherits":276,"buffer":76}],287:[function(require,module,exports){
55869
55423
  const assert = require('assert')
55870
55424
  const Buffer = require('../safe-buffer-5.2.0/index').Buffer
55871
55425
  /**
@@ -56097,7 +55651,7 @@ function toBuffer (v) {
56097
55651
  return v
56098
55652
  }
56099
55653
 
56100
- },{"../safe-buffer-5.2.0/index":294,"assert":25}],294:[function(require,module,exports){
55654
+ },{"../safe-buffer-5.2.0/index":288,"assert":25}],288:[function(require,module,exports){
56101
55655
  /* eslint-disable node/no-deprecated-api */
56102
55656
  var buffer = require('buffer')
56103
55657
  var Buffer = buffer.Buffer
@@ -56163,7 +55717,7 @@ SafeBuffer.allocUnsafeSlow = function (size) {
56163
55717
  return buffer.SlowBuffer(size)
56164
55718
  }
56165
55719
 
56166
- },{"buffer":76}],295:[function(require,module,exports){
55720
+ },{"buffer":76}],289:[function(require,module,exports){
56167
55721
  var Buffer = require('../safe-buffer-5.2.0/index').Buffer
56168
55722
 
56169
55723
  // prototype class for hash functions
@@ -56246,7 +55800,7 @@ Hash.prototype._update = function () {
56246
55800
 
56247
55801
  module.exports = Hash
56248
55802
 
56249
- },{"../safe-buffer-5.2.0/index":294}],296:[function(require,module,exports){
55803
+ },{"../safe-buffer-5.2.0/index":288}],290:[function(require,module,exports){
56250
55804
  'use strict'
56251
55805
  var exports = (module.exports = function SHA(algorithm) {
56252
55806
  algorithm = algorithm.toLowerCase()
@@ -56264,7 +55818,7 @@ exports.sha256 = require('./sha256')
56264
55818
  exports.sha384 = require('./sha384')
56265
55819
  exports.sha512 = require('./sha512')
56266
55820
 
56267
- },{"./sha":297,"./sha1":298,"./sha224":299,"./sha256":300,"./sha384":301,"./sha512":302}],297:[function(require,module,exports){
55821
+ },{"./sha":291,"./sha1":292,"./sha224":293,"./sha256":294,"./sha384":295,"./sha512":296}],291:[function(require,module,exports){
56268
55822
  /*
56269
55823
  * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
56270
55824
  * in FIPS PUB 180-1
@@ -56360,7 +55914,7 @@ Sha.prototype._hash = function () {
56360
55914
 
56361
55915
  module.exports = Sha
56362
55916
 
56363
- },{"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294,"./hash":295}],298:[function(require,module,exports){
55917
+ },{"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288,"./hash":289}],292:[function(require,module,exports){
56364
55918
  /*
56365
55919
  * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
56366
55920
  * in FIPS PUB 180-1
@@ -56461,7 +56015,7 @@ Sha1.prototype._hash = function () {
56461
56015
 
56462
56016
  module.exports = Sha1
56463
56017
 
56464
- },{"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294,"./hash":295}],299:[function(require,module,exports){
56018
+ },{"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288,"./hash":289}],293:[function(require,module,exports){
56465
56019
  /**
56466
56020
  * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
56467
56021
  * in FIPS 180-2
@@ -56516,7 +56070,7 @@ Sha224.prototype._hash = function () {
56516
56070
 
56517
56071
  module.exports = Sha224
56518
56072
 
56519
- },{"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294,"./hash":295,"./sha256":300}],300:[function(require,module,exports){
56073
+ },{"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288,"./hash":289,"./sha256":294}],294:[function(require,module,exports){
56520
56074
  /**
56521
56075
  * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
56522
56076
  * in FIPS 180-2
@@ -56653,7 +56207,7 @@ Sha256.prototype._hash = function () {
56653
56207
 
56654
56208
  module.exports = Sha256
56655
56209
 
56656
- },{"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294,"./hash":295}],301:[function(require,module,exports){
56210
+ },{"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288,"./hash":289}],295:[function(require,module,exports){
56657
56211
  var inherits = require('../inherits-2.0.4/inherits')
56658
56212
  var SHA512 = require('./sha512')
56659
56213
  var Hash = require('./hash')
@@ -56712,7 +56266,7 @@ Sha384.prototype._hash = function () {
56712
56266
 
56713
56267
  module.exports = Sha384
56714
56268
 
56715
- },{"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294,"./hash":295,"./sha512":302}],302:[function(require,module,exports){
56269
+ },{"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288,"./hash":289,"./sha512":296}],296:[function(require,module,exports){
56716
56270
  var inherits = require('../inherits-2.0.4/inherits')
56717
56271
  var Hash = require('./hash')
56718
56272
  var Buffer = require('../safe-buffer-5.2.0/index').Buffer
@@ -56974,7 +56528,7 @@ Sha512.prototype._hash = function () {
56974
56528
 
56975
56529
  module.exports = Sha512
56976
56530
 
56977
- },{"../inherits-2.0.4/inherits":282,"../safe-buffer-5.2.0/index":294,"./hash":295}],303:[function(require,module,exports){
56531
+ },{"../inherits-2.0.4/inherits":276,"../safe-buffer-5.2.0/index":288,"./hash":289}],297:[function(require,module,exports){
56978
56532
  (function(nacl) {
56979
56533
  'use strict';
56980
56534
 
@@ -58140,7 +57694,7 @@ nacl.setPRNG = function(fn) {
58140
57694
 
58141
57695
  })(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {}));
58142
57696
 
58143
- },{"crypto":87}],304:[function(require,module,exports){
57697
+ },{"crypto":87}],298:[function(require,module,exports){
58144
57698
  (function(root, f) {
58145
57699
  'use strict';
58146
57700
  if (typeof module !== 'undefined' && module.exports) module.exports = f(require('../tweetnacl-1.0.1/nacl'));
@@ -58189,7 +57743,7 @@ nacl.setPRNG = function(fn) {
58189
57743
 
58190
57744
  }));
58191
57745
 
58192
- },{"../tweetnacl-1.0.1/nacl":303}],305:[function(require,module,exports){
57746
+ },{"../tweetnacl-1.0.1/nacl":297}],299:[function(require,module,exports){
58193
57747
  (function (root) {
58194
57748
  "use strict";
58195
57749
 
@@ -58643,7 +58197,7 @@ UChar.udata={
58643
58197
  }
58644
58198
  }(this));
58645
58199
 
58646
- },{}],306:[function(require,module,exports){
58200
+ },{}],300:[function(require,module,exports){
58647
58201
  "use strict";
58648
58202
  var __extends = (this && this.__extends) || (function () {
58649
58203
  var extendStatics = function (d, b) {
@@ -58703,7 +58257,7 @@ var CoinlibAssertionError = /** @class */ (function (_super) {
58703
58257
  }(Error));
58704
58258
  exports.CoinlibAssertionError = CoinlibAssertionError;
58705
58259
 
58706
- },{}],307:[function(require,module,exports){
58260
+ },{}],301:[function(require,module,exports){
58707
58261
  "use strict";
58708
58262
  var __extends = (this && this.__extends) || (function () {
58709
58263
  var extendStatics = function (d, b) {
@@ -58949,847 +58503,41 @@ var InvalidSchemaType = /** @class */ (function (_super) {
58949
58503
  }(SerializerError));
58950
58504
  exports.InvalidSchemaType = InvalidSchemaType;
58951
58505
  /**
58952
- * Gets thrown if the payload that is being decoded does not match the schema
58953
- */
58954
- var InvalidPayloadError = /** @class */ (function (_super) {
58955
- __extends(InvalidPayloadError, _super);
58956
- function InvalidPayloadError(description) {
58957
- return _super.call(this, SerializerErrorType.INVALID_PAYLOAD, description) || this;
58958
- }
58959
- return InvalidPayloadError;
58960
- }(SerializerError));
58961
- exports.InvalidPayloadError = InvalidPayloadError;
58962
- /**
58963
- * Gets thrown if the string is not a valid hex string
58964
- */
58965
- var InvalidHexString = /** @class */ (function (_super) {
58966
- __extends(InvalidHexString, _super);
58967
- function InvalidHexString(description) {
58968
- return _super.call(this, SerializerErrorType.INVALID_HEX_STRING, description) || this;
58969
- }
58970
- return InvalidHexString;
58971
- }(SerializerError));
58972
- exports.InvalidHexString = InvalidHexString;
58973
- /**
58974
- * Gets thrown if the string starts with "0x". This causes problems with RLP
58975
- */
58976
- var InvalidString = /** @class */ (function (_super) {
58977
- __extends(InvalidString, _super);
58978
- function InvalidString(description) {
58979
- return _super.call(this, SerializerErrorType.INVALID_STRING, description) || this;
58980
- }
58981
- return InvalidString;
58982
- }(SerializerError));
58983
- exports.InvalidString = InvalidString;
58984
-
58985
- },{"./coinlib-error":306}],308:[function(require,module,exports){
58986
- "use strict";
58987
- Object.defineProperty(exports, "__esModule", { value: true });
58988
- exports.bufferFrom = exports.assertNever = exports.SubProtocolType = exports.TimeInterval = exports.Domain = exports.TransactionError = exports.BalanceError = exports.ProtocolErrorType = exports.SerializerErrorType = exports.CoinlibError = exports.NetworkError = exports.ProtocolNotSupported = exports.SerializerVersionMismatch = exports.TypeNotSupported = exports.isSubProtocolSymbol = exports.isMainProtocolSymbol = exports.isProtocolSymbol = exports.isNetworkEqual = exports.SimpleAction = exports.LinkedAction = exports.RepeatableAction = exports.Action = exports.NetworkType = exports.SubProtocolSymbols = exports.MainProtocolSymbols = exports.ProtocolNetwork = exports.ProtocolBlockExplorer = exports.CryptoClient = exports.AirGapNFTWallet = exports.AirGapWalletStatus = exports.AirGapCoinWallet = exports.AirGapMarketWallet = exports.AirGapWallet = void 0;
58989
- var Action_1 = require("./actions/Action");
58990
- Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return Action_1.Action; } });
58991
- var LinkedAction_1 = require("./actions/LinkedAction");
58992
- Object.defineProperty(exports, "LinkedAction", { enumerable: true, get: function () { return LinkedAction_1.LinkedAction; } });
58993
- var RepeatableAction_1 = require("./actions/RepeatableAction");
58994
- Object.defineProperty(exports, "RepeatableAction", { enumerable: true, get: function () { return RepeatableAction_1.RepeatableAction; } });
58995
- var SimpleAction_1 = require("./actions/SimpleAction");
58996
- Object.defineProperty(exports, "SimpleAction", { enumerable: true, get: function () { return SimpleAction_1.SimpleAction; } });
58997
- var errors_1 = require("./errors");
58998
- Object.defineProperty(exports, "BalanceError", { enumerable: true, get: function () { return errors_1.BalanceError; } });
58999
- Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return errors_1.NetworkError; } });
59000
- Object.defineProperty(exports, "ProtocolErrorType", { enumerable: true, get: function () { return errors_1.ProtocolErrorType; } });
59001
- Object.defineProperty(exports, "ProtocolNotSupported", { enumerable: true, get: function () { return errors_1.ProtocolNotSupported; } });
59002
- Object.defineProperty(exports, "SerializerErrorType", { enumerable: true, get: function () { return errors_1.SerializerErrorType; } });
59003
- Object.defineProperty(exports, "SerializerVersionMismatch", { enumerable: true, get: function () { return errors_1.SerializerVersionMismatch; } });
59004
- Object.defineProperty(exports, "TransactionError", { enumerable: true, get: function () { return errors_1.TransactionError; } });
59005
- Object.defineProperty(exports, "TypeNotSupported", { enumerable: true, get: function () { return errors_1.TypeNotSupported; } });
59006
- var coinlib_error_1 = require("./errors/coinlib-error");
59007
- Object.defineProperty(exports, "CoinlibError", { enumerable: true, get: function () { return coinlib_error_1.CoinlibError; } });
59008
- Object.defineProperty(exports, "Domain", { enumerable: true, get: function () { return coinlib_error_1.Domain; } });
59009
- var CryptoClient_1 = require("./protocols/CryptoClient");
59010
- Object.defineProperty(exports, "CryptoClient", { enumerable: true, get: function () { return CryptoClient_1.CryptoClient; } });
59011
- var ICoinSubProtocol_1 = require("./protocols/ICoinSubProtocol");
59012
- Object.defineProperty(exports, "SubProtocolType", { enumerable: true, get: function () { return ICoinSubProtocol_1.SubProtocolType; } });
59013
- var assert_1 = require("./utils/assert");
59014
- Object.defineProperty(exports, "assertNever", { enumerable: true, get: function () { return assert_1.assertNever; } });
59015
- var buffer_1 = require("./utils/buffer");
59016
- Object.defineProperty(exports, "bufferFrom", { enumerable: true, get: function () { return buffer_1.bufferFrom; } });
59017
- var Network_1 = require("./utils/Network");
59018
- Object.defineProperty(exports, "isNetworkEqual", { enumerable: true, get: function () { return Network_1.isNetworkEqual; } });
59019
- var ProtocolBlockExplorer_1 = require("./utils/ProtocolBlockExplorer");
59020
- Object.defineProperty(exports, "ProtocolBlockExplorer", { enumerable: true, get: function () { return ProtocolBlockExplorer_1.ProtocolBlockExplorer; } });
59021
- var ProtocolNetwork_1 = require("./utils/ProtocolNetwork");
59022
- Object.defineProperty(exports, "NetworkType", { enumerable: true, get: function () { return ProtocolNetwork_1.NetworkType; } });
59023
- Object.defineProperty(exports, "ProtocolNetwork", { enumerable: true, get: function () { return ProtocolNetwork_1.ProtocolNetwork; } });
59024
- var ProtocolSymbols_1 = require("./utils/ProtocolSymbols");
59025
- Object.defineProperty(exports, "isMainProtocolSymbol", { enumerable: true, get: function () { return ProtocolSymbols_1.isMainProtocolSymbol; } });
59026
- Object.defineProperty(exports, "isProtocolSymbol", { enumerable: true, get: function () { return ProtocolSymbols_1.isProtocolSymbol; } });
59027
- Object.defineProperty(exports, "isSubProtocolSymbol", { enumerable: true, get: function () { return ProtocolSymbols_1.isSubProtocolSymbol; } });
59028
- Object.defineProperty(exports, "MainProtocolSymbols", { enumerable: true, get: function () { return ProtocolSymbols_1.MainProtocolSymbols; } });
59029
- Object.defineProperty(exports, "SubProtocolSymbols", { enumerable: true, get: function () { return ProtocolSymbols_1.SubProtocolSymbols; } });
59030
- var AirGapCoinWallet_1 = require("./wallet/AirGapCoinWallet");
59031
- Object.defineProperty(exports, "AirGapCoinWallet", { enumerable: true, get: function () { return AirGapCoinWallet_1.AirGapCoinWallet; } });
59032
- Object.defineProperty(exports, "TimeInterval", { enumerable: true, get: function () { return AirGapCoinWallet_1.TimeInterval; } });
59033
- var AirGapMarketWallet_1 = require("./wallet/AirGapMarketWallet");
59034
- Object.defineProperty(exports, "AirGapMarketWallet", { enumerable: true, get: function () { return AirGapMarketWallet_1.AirGapMarketWallet; } });
59035
- var AirGapNFTWallet_1 = require("./wallet/AirGapNFTWallet");
59036
- Object.defineProperty(exports, "AirGapNFTWallet", { enumerable: true, get: function () { return AirGapNFTWallet_1.AirGapNFTWallet; } });
59037
- var AirGapWallet_1 = require("./wallet/AirGapWallet");
59038
- Object.defineProperty(exports, "AirGapWallet", { enumerable: true, get: function () { return AirGapWallet_1.AirGapWallet; } });
59039
- Object.defineProperty(exports, "AirGapWalletStatus", { enumerable: true, get: function () { return AirGapWallet_1.AirGapWalletStatus; } });
59040
-
59041
- },{"./actions/Action":229,"./actions/LinkedAction":230,"./actions/RepeatableAction":231,"./actions/SimpleAction":232,"./errors":307,"./errors/coinlib-error":306,"./protocols/CryptoClient":309,"./protocols/ICoinSubProtocol":311,"./utils/Network":314,"./utils/ProtocolBlockExplorer":315,"./utils/ProtocolNetwork":316,"./utils/ProtocolSymbols":317,"./utils/assert":318,"./utils/buffer":320,"./wallet/AirGapCoinWallet":323,"./wallet/AirGapMarketWallet":324,"./wallet/AirGapNFTWallet":325,"./wallet/AirGapWallet":326}],309:[function(require,module,exports){
59042
- "use strict";
59043
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
59044
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59045
- return new (P || (P = Promise))(function (resolve, reject) {
59046
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
59047
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
59048
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
59049
- step((generator = generator.apply(thisArg, _arguments || [])).next());
59050
- });
59051
- };
59052
- var __generator = (this && this.__generator) || function (thisArg, body) {
59053
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
59054
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
59055
- function verb(n) { return function (v) { return step([n, v]); }; }
59056
- function step(op) {
59057
- if (f) throw new TypeError("Generator is already executing.");
59058
- while (_) try {
59059
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
59060
- if (y = 0, t) op = [op[0] & 2, t.value];
59061
- switch (op[0]) {
59062
- case 0: case 1: t = op; break;
59063
- case 4: _.label++; return { value: op[1], done: false };
59064
- case 5: _.label++; y = op[1]; op = [0]; continue;
59065
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
59066
- default:
59067
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
59068
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
59069
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
59070
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
59071
- if (t[2]) _.ops.pop();
59072
- _.trys.pop(); continue;
59073
- }
59074
- op = body.call(thisArg, _);
59075
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
59076
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59077
- }
59078
- };
59079
- Object.defineProperty(exports, "__esModule", { value: true });
59080
- exports.CryptoClient = void 0;
59081
- var errors_1 = require("../errors");
59082
- var coinlib_error_1 = require("../errors/coinlib-error");
59083
- var AES_1 = require("../utils/AES");
59084
- var CryptoClient = /** @class */ (function () {
59085
- function CryptoClient() {
59086
- }
59087
- CryptoClient.prototype.encryptAES = function (payload, privateKey) {
59088
- return __awaiter(this, void 0, void 0, function () {
59089
- return __generator(this, function (_a) {
59090
- return [2 /*return*/, new AES_1.AES().encryptString(payload, privateKey)];
59091
- });
59092
- });
59093
- };
59094
- CryptoClient.prototype.decryptAES = function (encryptedPayload, privateKey) {
59095
- return __awaiter(this, void 0, void 0, function () {
59096
- return __generator(this, function (_a) {
59097
- return [2 /*return*/, new AES_1.AES().decryptString(encryptedPayload, privateKey)];
59098
- });
59099
- });
59100
- };
59101
- CryptoClient.prototype.encryptAsymmetric = function (payload, publicKey) {
59102
- return __awaiter(this, void 0, void 0, function () {
59103
- return __generator(this, function (_a) {
59104
- throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, "encryptAsymmetric() not Implemented");
59105
- });
59106
- });
59107
- };
59108
- CryptoClient.prototype.decryptAsymmetric = function (encryptedPayload, keypair) {
59109
- return __awaiter(this, void 0, void 0, function () {
59110
- return __generator(this, function (_a) {
59111
- throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, "decryptAsymmetric() not Implemented");
59112
- });
59113
- });
59114
- };
59115
- CryptoClient.prototype.recoverPublicKeyFromSignature = function () {
59116
- return __awaiter(this, void 0, void 0, function () {
59117
- return __generator(this, function (_a) {
59118
- throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, "Recovering public key from signature not supported");
59119
- });
59120
- });
59121
- };
59122
- return CryptoClient;
59123
- }());
59124
- exports.CryptoClient = CryptoClient;
59125
-
59126
- },{"../errors":307,"../errors/coinlib-error":306,"../utils/AES":313}],310:[function(require,module,exports){
59127
- (function (Buffer){(function (){
59128
- "use strict";
59129
- var __extends = (this && this.__extends) || (function () {
59130
- var extendStatics = function (d, b) {
59131
- extendStatics = Object.setPrototypeOf ||
59132
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
59133
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
59134
- return extendStatics(d, b);
59135
- };
59136
- return function (d, b) {
59137
- extendStatics(d, b);
59138
- function __() { this.constructor = d; }
59139
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
59140
- };
59141
- })();
59142
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
59143
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59144
- return new (P || (P = Promise))(function (resolve, reject) {
59145
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
59146
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
59147
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
59148
- step((generator = generator.apply(thisArg, _arguments || [])).next());
59149
- });
59150
- };
59151
- var __generator = (this && this.__generator) || function (thisArg, body) {
59152
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
59153
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
59154
- function verb(n) { return function (v) { return step([n, v]); }; }
59155
- function step(op) {
59156
- if (f) throw new TypeError("Generator is already executing.");
59157
- while (_) try {
59158
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
59159
- if (y = 0, t) op = [op[0] & 2, t.value];
59160
- switch (op[0]) {
59161
- case 0: case 1: t = op; break;
59162
- case 4: _.label++; return { value: op[1], done: false };
59163
- case 5: _.label++; y = op[1]; op = [0]; continue;
59164
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
59165
- default:
59166
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
59167
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
59168
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
59169
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
59170
- if (t[2]) _.ops.pop();
59171
- _.trys.pop(); continue;
59172
- }
59173
- op = body.call(thisArg, _);
59174
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
59175
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59176
- }
59177
- };
59178
- Object.defineProperty(exports, "__esModule", { value: true });
59179
- exports.Ed25519CryptoClient = void 0;
59180
- var bytes_1 = require("@stablelib/bytes");
59181
- var blake2b_1 = require("@stablelib/blake2b");
59182
- var ed25519_1 = require("@stablelib/ed25519");
59183
- var nacl_1 = require("@stablelib/nacl");
59184
- var utf8_1 = require("@stablelib/utf8");
59185
- var hex_1 = require("../utils/hex");
59186
- var CryptoClient_1 = require("./CryptoClient");
59187
- function toHex(value) {
59188
- return Buffer.from(value).toString('hex');
59189
- }
59190
- var Ed25519CryptoClient = /** @class */ (function (_super) {
59191
- __extends(Ed25519CryptoClient, _super);
59192
- function Ed25519CryptoClient() {
59193
- return _super !== null && _super.apply(this, arguments) || this;
59194
- }
59195
- Ed25519CryptoClient.prototype.encryptAsymmetric = function (payload, publicKey) {
59196
- return __awaiter(this, void 0, void 0, function () {
59197
- var kxOtherPublicKey, keypair, state, nonce, encryptedMessage;
59198
- return __generator(this, function (_a) {
59199
- kxOtherPublicKey = ed25519_1.convertPublicKeyToX25519(Buffer.from(publicKey, 'hex'));
59200
- keypair = nacl_1.generateKeyPair();
59201
- state = new blake2b_1.BLAKE2b(24);
59202
- nonce = state.update(keypair.publicKey, 32).update(kxOtherPublicKey, 32).digest();
59203
- encryptedMessage = nacl_1.box(kxOtherPublicKey, keypair.secretKey, nonce, hex_1.isHex(payload) ? Buffer.from(payload, 'hex') : utf8_1.encode(payload));
59204
- return [2 /*return*/, toHex(bytes_1.concat(keypair.publicKey, encryptedMessage))];
59205
- });
59206
- });
59207
- };
59208
- Ed25519CryptoClient.prototype.decryptAsymmetric = function (encryptedPayload, keypair) {
59209
- return __awaiter(this, void 0, void 0, function () {
59210
- var kxSelfPrivateKey, kxSelfPublicKey, encryptedPayloadBytes, kxOtherPublicKey, ciphertext, state, nonce, decryptedMessage;
59211
- return __generator(this, function (_a) {
59212
- kxSelfPrivateKey = ed25519_1.convertSecretKeyToX25519(Buffer.from(keypair.privateKey, 'hex')) // Secret bytes to scalar bytes
59213
- ;
59214
- kxSelfPublicKey = ed25519_1.convertPublicKeyToX25519(Buffer.from(keypair.publicKey, 'hex')) // Secret bytes to scalar bytes
59215
- ;
59216
- encryptedPayloadBytes = Buffer.from(encryptedPayload, hex_1.isHex(encryptedPayload) ? 'hex' : 'utf-8');
59217
- kxOtherPublicKey = encryptedPayloadBytes.slice(0, 32);
59218
- ciphertext = encryptedPayloadBytes.slice(32);
59219
- state = new blake2b_1.BLAKE2b(24);
59220
- nonce = state.update(kxOtherPublicKey, 32).update(kxSelfPublicKey, 32).digest();
59221
- decryptedMessage = nacl_1.openBox(kxOtherPublicKey, kxSelfPrivateKey, nonce, ciphertext);
59222
- if (decryptedMessage === null) {
59223
- throw new Error('Ed25519 decryption failed.');
59224
- }
59225
- return [2 /*return*/, Buffer.from(decryptedMessage).toString()];
59226
- });
59227
- });
59228
- };
59229
- return Ed25519CryptoClient;
59230
- }(CryptoClient_1.CryptoClient));
59231
- exports.Ed25519CryptoClient = Ed25519CryptoClient;
59232
-
59233
- }).call(this)}).call(this,require("buffer").Buffer)
59234
- },{"../utils/hex":321,"./CryptoClient":309,"@stablelib/blake2b":328,"@stablelib/bytes":329,"@stablelib/ed25519":331,"@stablelib/nacl":334,"@stablelib/utf8":343,"buffer":76}],311:[function(require,module,exports){
59235
- "use strict";
59236
- Object.defineProperty(exports, "__esModule", { value: true });
59237
- exports.SubProtocolType = void 0;
59238
- var SubProtocolType;
59239
- (function (SubProtocolType) {
59240
- SubProtocolType["ACCOUNT"] = "account";
59241
- SubProtocolType["TOKEN"] = "token";
59242
- })(SubProtocolType = exports.SubProtocolType || (exports.SubProtocolType = {}));
59243
-
59244
- },{}],312:[function(require,module,exports){
59245
- "use strict";
59246
- Object.defineProperty(exports, "__esModule", { value: true });
59247
- exports.NonExtendedProtocol = void 0;
59248
- var NonExtendedProtocol = /** @class */ (function () {
59249
- function NonExtendedProtocol() {
59250
- }
59251
- NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
59252
- throw Promise.reject('extended private key support not implemented');
59253
- };
59254
- NonExtendedProtocol.prototype.getExtendedPrivateKeyFromHexSecret = function (secret, derivationPath) {
59255
- throw Promise.reject('extended private key support not implemented');
59256
- };
59257
- NonExtendedProtocol.prototype.getBalanceOfExtendedPublicKey = function (extendedPublicKey, offset) {
59258
- return Promise.reject('extended public balance not implemented');
59259
- };
59260
- NonExtendedProtocol.prototype.signWithExtendedPrivateKey = function (extendedPrivateKey, transaction, childDerivationPath) {
59261
- return Promise.reject('extended private key signing for not implemented');
59262
- };
59263
- NonExtendedProtocol.prototype.getAddressFromExtendedPublicKey = function (extendedPublicKey, visibilityDerivationIndex, addressDerivationIndex) {
59264
- return Promise.resolve({
59265
- address: '',
59266
- cursor: { hasNext: false }
59267
- });
59268
- };
59269
- NonExtendedProtocol.prototype.getAddressesFromExtendedPublicKey = function (extendedPublicKey, visibilityDerivationIndex, addressCount, offset) {
59270
- return Promise.resolve([]);
59271
- };
59272
- NonExtendedProtocol.prototype.estimateMaxTransactionValueFromExtendedPublicKey = function (extendedPublicKey, recipients, fee) {
59273
- return Promise.reject('estimating max value using extended public key not implemented');
59274
- };
59275
- NonExtendedProtocol.prototype.estimateFeeDefaultsFromExtendedPublicKey = function (publicKey, recipients, values, data) {
59276
- return Promise.reject('estimating fee defaults using extended public key not implemented');
59277
- };
59278
- NonExtendedProtocol.prototype.getTransactionsFromExtendedPublicKey = function (extendedPublicKey, limit, cursor) {
59279
- return Promise.reject('fetching txs using extended public key not implemented');
59280
- };
59281
- NonExtendedProtocol.prototype.prepareTransactionFromExtendedPublicKey = function (extendedPublicKey, offset, recipients, values, fee) {
59282
- return Promise.reject('extended public key tx not implemented');
59283
- };
59284
- return NonExtendedProtocol;
59285
- }());
59286
- exports.NonExtendedProtocol = NonExtendedProtocol;
59287
-
59288
- },{}],313:[function(require,module,exports){
59289
- (function (Buffer){(function (){
59290
- "use strict";
59291
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
59292
- if (k2 === undefined) k2 = k;
59293
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
59294
- }) : (function(o, m, k, k2) {
59295
- if (k2 === undefined) k2 = k;
59296
- o[k2] = m[k];
59297
- }));
59298
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
59299
- Object.defineProperty(o, "default", { enumerable: true, value: v });
59300
- }) : function(o, v) {
59301
- o["default"] = v;
59302
- });
59303
- var __importStar = (this && this.__importStar) || function (mod) {
59304
- if (mod && mod.__esModule) return mod;
59305
- var result = {};
59306
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
59307
- __setModuleDefault(result, mod);
59308
- return result;
59309
- };
59310
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
59311
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59312
- return new (P || (P = Promise))(function (resolve, reject) {
59313
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
59314
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
59315
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
59316
- step((generator = generator.apply(thisArg, _arguments || [])).next());
59317
- });
59318
- };
59319
- var __generator = (this && this.__generator) || function (thisArg, body) {
59320
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
59321
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
59322
- function verb(n) { return function (v) { return step([n, v]); }; }
59323
- function step(op) {
59324
- if (f) throw new TypeError("Generator is already executing.");
59325
- while (_) try {
59326
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
59327
- if (y = 0, t) op = [op[0] & 2, t.value];
59328
- switch (op[0]) {
59329
- case 0: case 1: t = op; break;
59330
- case 4: _.label++; return { value: op[1], done: false };
59331
- case 5: _.label++; y = op[1]; op = [0]; continue;
59332
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
59333
- default:
59334
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
59335
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
59336
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
59337
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
59338
- if (t[2]) _.ops.pop();
59339
- _.trys.pop(); continue;
59340
- }
59341
- op = body.call(thisArg, _);
59342
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
59343
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59344
- }
59345
- };
59346
- Object.defineProperty(exports, "__esModule", { value: true });
59347
- exports.AES = void 0;
59348
- var crypto = __importStar(require("crypto"));
59349
- var errors_1 = require("../errors");
59350
- var coinlib_error_1 = require("../errors/coinlib-error");
59351
- var hex_1 = require("./hex");
59352
- // https://github.com/microsoft/botbuilder-js/blob/master/libraries/botframework-config/src/encrypt.ts#L20
59353
- var AES = /** @class */ (function () {
59354
- function AES(AES_KEY_SIZE, KEY_DERIVATION_ITERATION_COUNT, ALGORITHM, encoding) {
59355
- if (AES_KEY_SIZE === void 0) { AES_KEY_SIZE = 256; }
59356
- if (KEY_DERIVATION_ITERATION_COUNT === void 0) { KEY_DERIVATION_ITERATION_COUNT = 10000; }
59357
- if (ALGORITHM === void 0) { ALGORITHM = 'aes-256-gcm'; }
59358
- if (encoding === void 0) { encoding = 'hex'; }
59359
- this.AES_KEY_SIZE = AES_KEY_SIZE;
59360
- this.KEY_DERIVATION_ITERATION_COUNT = KEY_DERIVATION_ITERATION_COUNT;
59361
- this.ALGORITHM = ALGORITHM;
59362
- this.encoding = encoding;
59363
- }
59364
- AES.prototype.encryptString = function (plainText, privateKey) {
59365
- return __awaiter(this, void 0, void 0, function () {
59366
- var keyBytes, ivBytes, ivText, cipher, encryptedValue, authTagText;
59367
- return __generator(this, function (_a) {
59368
- switch (_a.label) {
59369
- case 0:
59370
- if (!plainText || plainText.length === 0) {
59371
- throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'you must pass an input message');
59372
- }
59373
- if (!privateKey || privateKey.length === 0) {
59374
- throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'you must pass a privateKey');
59375
- }
59376
- return [4 /*yield*/, this.deriveKeyFromPrivateKey(privateKey)
59377
- // Generates 16 byte cryptographically strong pseudo-random data as IV
59378
- // https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback
59379
- ];
59380
- case 1:
59381
- keyBytes = _a.sent();
59382
- ivBytes = crypto.randomBytes(16);
59383
- ivText = ivBytes.toString(this.encoding);
59384
- cipher = crypto.createCipheriv(this.ALGORITHM, keyBytes, ivBytes);
59385
- encryptedValue = cipher.update(plainText, 'utf8', this.encoding);
59386
- encryptedValue += cipher.final(this.encoding);
59387
- authTagText = cipher.getAuthTag().toString(this.encoding);
59388
- return [2 /*return*/, ivText + "!" + encryptedValue + "!" + authTagText];
59389
- }
59390
- });
59391
- });
59392
- };
59393
- AES.prototype.decryptString = function (encryptedValue, privateKey) {
59394
- return __awaiter(this, void 0, void 0, function () {
59395
- var parts, ivText, encryptedText, authTagText, ivBytes, keyBytes, authTagBytes, decipher, value;
59396
- return __generator(this, function (_a) {
59397
- switch (_a.label) {
59398
- case 0:
59399
- if (!encryptedValue || encryptedValue.length === 0) {
59400
- return [2 /*return*/, encryptedValue];
59401
- }
59402
- if (!privateKey || privateKey.length === 0) {
59403
- throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'you must pass a privateKey');
59404
- }
59405
- parts = encryptedValue.split('!');
59406
- if (parts.length !== 3) {
59407
- throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'The encrypted value is not in a valid format');
59408
- }
59409
- ivText = parts[0];
59410
- encryptedText = parts[1];
59411
- authTagText = parts[2];
59412
- ivBytes = Buffer.from(ivText, this.encoding);
59413
- return [4 /*yield*/, this.deriveKeyFromPrivateKey(privateKey)];
59414
- case 1:
59415
- keyBytes = _a.sent();
59416
- authTagBytes = Buffer.from(authTagText, this.encoding);
59417
- if (ivBytes.length !== 16) {
59418
- throw new errors_1.InvalidValueError(coinlib_error_1.Domain.UTILS, 'The IV length is invalid');
59419
- }
59420
- if (keyBytes.length !== 32) {
59421
- throw new errors_1.InvalidValueError(coinlib_error_1.Domain.UTILS, 'The key length is invalid');
59422
- }
59423
- if (authTagBytes.length !== 16) {
59424
- throw new errors_1.InvalidValueError(coinlib_error_1.Domain.UTILS, 'The authtag length is invalid');
59425
- }
59426
- decipher = crypto.createDecipheriv(this.ALGORITHM, keyBytes, ivBytes);
59427
- decipher.setAuthTag(authTagBytes);
59428
- value = decipher.update(encryptedText, this.encoding, 'utf8');
59429
- value += decipher.final('utf8');
59430
- return [2 /*return*/, value];
59431
- }
59432
- });
59433
- });
59434
- };
59435
- AES.prototype.deriveKeyFromPrivateKey = function (privateKey) {
59436
- var _this = this;
59437
- var password = hex_1.isHex(privateKey) ? Buffer.from(privateKey, 'hex') : privateKey;
59438
- return new Promise(function (resolve, reject) {
59439
- crypto.pbkdf2(password, '', _this.KEY_DERIVATION_ITERATION_COUNT, 32, 'sha512', function (pbkdf2Error, key) {
59440
- if (pbkdf2Error) {
59441
- reject(pbkdf2Error);
59442
- }
59443
- resolve(key);
59444
- });
59445
- });
59446
- };
59447
- return AES;
59448
- }());
59449
- exports.AES = AES;
59450
-
59451
- }).call(this)}).call(this,require("buffer").Buffer)
59452
- },{"../errors":307,"../errors/coinlib-error":306,"./hex":321,"buffer":76,"crypto":87}],314:[function(require,module,exports){
59453
- "use strict";
59454
- Object.defineProperty(exports, "__esModule", { value: true });
59455
- exports.isNetworkEqual = void 0;
59456
- var isNetworkEqual = function (network1, network2) {
59457
- return network1.name === network2.name && network1.type === network2.type && network1.rpcUrl === network2.rpcUrl;
59458
- };
59459
- exports.isNetworkEqual = isNetworkEqual;
59460
-
59461
- },{}],315:[function(require,module,exports){
59462
- "use strict";
59463
- Object.defineProperty(exports, "__esModule", { value: true });
59464
- exports.ProtocolBlockExplorer = void 0;
59465
- var ProtocolBlockExplorer = /** @class */ (function () {
59466
- function ProtocolBlockExplorer(blockExplorer) {
59467
- this.blockExplorer = blockExplorer;
59468
- }
59469
- return ProtocolBlockExplorer;
59470
- }());
59471
- exports.ProtocolBlockExplorer = ProtocolBlockExplorer;
59472
-
59473
- },{}],316:[function(require,module,exports){
59474
- "use strict";
59475
- Object.defineProperty(exports, "__esModule", { value: true });
59476
- exports.ProtocolNetwork = exports.NetworkType = void 0;
59477
- var createHash = require("../dependencies/src/create-hash-1.2.0/index");
59478
- var sha256hashShort = function (input) {
59479
- var hash = createHash('sha256');
59480
- hash.update(input);
59481
- return hash.digest('base64').slice(0, 10);
59482
- };
59483
- var NetworkType;
59484
- (function (NetworkType) {
59485
- NetworkType["MAINNET"] = "MAINNET";
59486
- NetworkType["TESTNET"] = "TESTNET";
59487
- NetworkType["CUSTOM"] = "CUSTOM";
59488
- })(NetworkType = exports.NetworkType || (exports.NetworkType = {}));
59489
- var ProtocolNetwork = /** @class */ (function () {
59490
- function ProtocolNetwork(name, type, rpcUrl, blockExplorer, extras) {
59491
- this.name = name;
59492
- this.type = type;
59493
- this.rpcUrl = rpcUrl;
59494
- this.blockExplorer = blockExplorer;
59495
- this.extras = extras;
59496
- }
59497
- Object.defineProperty(ProtocolNetwork.prototype, "identifier", {
59498
- get: function () {
59499
- var hashed = sha256hashShort(this.name + "-" + this.rpcUrl);
59500
- return this.type + "-" + hashed;
59501
- },
59502
- enumerable: false,
59503
- configurable: true
59504
- });
59505
- return ProtocolNetwork;
59506
- }());
59507
- exports.ProtocolNetwork = ProtocolNetwork;
59508
-
59509
- },{"../dependencies/src/create-hash-1.2.0/index":276}],317:[function(require,module,exports){
59510
- "use strict";
59511
- Object.defineProperty(exports, "__esModule", { value: true });
59512
- exports.isProtocolSymbol = exports.isSubProtocolSymbol = exports.isMainProtocolSymbol = exports.SubProtocolSymbols = exports.MainProtocolSymbols = void 0;
59513
- var MainProtocolSymbols;
59514
- (function (MainProtocolSymbols) {
59515
- MainProtocolSymbols["AE"] = "ae";
59516
- MainProtocolSymbols["BTC"] = "btc";
59517
- MainProtocolSymbols["BTC_SEGWIT"] = "btc_segwit";
59518
- MainProtocolSymbols["ETH"] = "eth";
59519
- MainProtocolSymbols["XTZ"] = "xtz";
59520
- MainProtocolSymbols["XTZ_SHIELDED"] = "xtz_shielded";
59521
- MainProtocolSymbols["GRS"] = "grs";
59522
- MainProtocolSymbols["COSMOS"] = "cosmos";
59523
- MainProtocolSymbols["POLKADOT"] = "polkadot";
59524
- MainProtocolSymbols["KUSAMA"] = "kusama";
59525
- MainProtocolSymbols["MOONBASE"] = "moonbase";
59526
- MainProtocolSymbols["MOONRIVER"] = "moonriver";
59527
- MainProtocolSymbols["MOONBEAM"] = "moonbeam";
59528
- MainProtocolSymbols["ASTAR"] = "astar";
59529
- MainProtocolSymbols["SHIDEN"] = "shiden";
59530
- })(MainProtocolSymbols = exports.MainProtocolSymbols || (exports.MainProtocolSymbols = {}));
59531
- var SubProtocolSymbols;
59532
- (function (SubProtocolSymbols) {
59533
- SubProtocolSymbols["XTZ_KT"] = "xtz-kt";
59534
- SubProtocolSymbols["XTZ_BTC"] = "xtz-btc";
59535
- SubProtocolSymbols["XTZ_USD"] = "xtz-usd";
59536
- SubProtocolSymbols["XTZ_KUSD"] = "xtz-kusd";
59537
- SubProtocolSymbols["XTZ_STKR"] = "xtz-stkr";
59538
- SubProtocolSymbols["XTZ_ETHTZ"] = "xtz-eth";
59539
- SubProtocolSymbols["XTZ_UUSD"] = "xtz-uusd";
59540
- SubProtocolSymbols["XTZ_YOU"] = "xtz-you";
59541
- SubProtocolSymbols["XTZ_W"] = "xtz-w";
59542
- SubProtocolSymbols["XTZ_UDEFI"] = "xtz-udefi";
59543
- SubProtocolSymbols["XTZ_UBTC"] = "xtz-ubtc";
59544
- SubProtocolSymbols["XTZ_CTEZ"] = "xtz-ctez";
59545
- SubProtocolSymbols["XTZ_PLENTY"] = "xtz-plenty";
59546
- SubProtocolSymbols["XTZ_WRAP"] = "xtz-wrap";
59547
- SubProtocolSymbols["XTZ_QUIPU"] = "xtz-quipu";
59548
- SubProtocolSymbols["XTZ_DOGA"] = "xtz-doga";
59549
- SubProtocolSymbols["XTZ_BTC_TEZ"] = "xtz-btc-tez";
59550
- SubProtocolSymbols["XTZ_USDT"] = "xtz-usdt";
59551
- SubProtocolSymbols["XTZ_SIRS"] = "xtz-sirs";
59552
- SubProtocolSymbols["ETH_ERC20"] = "eth-erc20";
59553
- SubProtocolSymbols["ETH_ERC20_XCHF"] = "eth-erc20-xchf";
59554
- })(SubProtocolSymbols = exports.SubProtocolSymbols || (exports.SubProtocolSymbols = {}));
59555
- function isMainProtocolSymbol(identifier) {
59556
- return Object.values(MainProtocolSymbols).includes(identifier);
59557
- }
59558
- exports.isMainProtocolSymbol = isMainProtocolSymbol;
59559
- function isSubProtocolSymbol(identifier) {
59560
- return Object.values(SubProtocolSymbols).includes(identifier);
59561
- }
59562
- exports.isSubProtocolSymbol = isSubProtocolSymbol;
59563
- function isProtocolSymbol(identifier) {
59564
- return isMainProtocolSymbol(identifier) || isSubProtocolSymbol(identifier);
59565
- }
59566
- exports.isProtocolSymbol = isProtocolSymbol;
59567
-
59568
- },{}],318:[function(require,module,exports){
59569
- "use strict";
59570
- Object.defineProperty(exports, "__esModule", { value: true });
59571
- exports.assertFields = exports.assertNever = void 0;
59572
- var errors_1 = require("../errors");
59573
- var coinlib_error_1 = require("../errors/coinlib-error");
59574
- var assertNever = function (x) { return undefined; };
59575
- exports.assertNever = assertNever;
59576
- function assertFields(name, object) {
59577
- var fields = [];
59578
- for (var _i = 2; _i < arguments.length; _i++) {
59579
- fields[_i - 2] = arguments[_i];
59580
- }
59581
- fields.forEach(function (field) {
59582
- if (object[field] === undefined || object[field] === null) {
59583
- throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, name + ", required: " + fields.join(', ') + ", but " + field + " is missing.");
59584
- }
59585
- });
59586
- }
59587
- exports.assertFields = assertFields;
59588
-
59589
- },{"../errors":307,"../errors/coinlib-error":306}],319:[function(require,module,exports){
59590
- (function (Buffer){(function (){
59591
- "use strict";
59592
- Object.defineProperty(exports, "__esModule", { value: true });
59593
- var createHash = require("../dependencies/src/create-hash-1.2.0/index");
59594
- var errors_1 = require("../errors");
59595
- var coinlib_error_1 = require("../errors/coinlib-error");
59596
- var sha256hash = function (input) {
59597
- var hash = createHash('sha256');
59598
- hash.update(input);
59599
- return hash.digest();
59600
- };
59601
- var checkSum = function (payload) {
59602
- return sha256hash(sha256hash(payload)).slice(0, 4);
59603
- };
59604
- var bs64check = {
59605
- encode: function (input) {
59606
- if (!Buffer.isBuffer(input)) {
59607
- input = Buffer.from(input);
59608
- }
59609
- var checksum = checkSum(input);
59610
- var payloadWithChecksum = Buffer.concat([input, checksum], input.length + 4);
59611
- return payloadWithChecksum.toString('base64');
59612
- },
59613
- decode: function (input) {
59614
- if (!Buffer.isBuffer(input)) {
59615
- input = Buffer.from(input, 'base64');
59616
- }
59617
- var payload = input.slice(0, -4);
59618
- var checksum = input.slice(-4);
59619
- var newChecksum = checkSum(payload);
59620
- // tslint:disable-next-line:no-bitwise
59621
- if ((checksum[0] ^ newChecksum[0]) | (checksum[1] ^ newChecksum[1]) | (checksum[2] ^ newChecksum[2]) | (checksum[3] ^ newChecksum[3])) {
59622
- throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'bs64check checksum does not match');
59623
- }
59624
- return payload;
59625
- },
59626
- checkSum: checkSum
59627
- };
59628
- exports.default = bs64check;
59629
-
59630
- }).call(this)}).call(this,require("buffer").Buffer)
59631
- },{"../dependencies/src/create-hash-1.2.0/index":276,"../errors":307,"../errors/coinlib-error":306,"buffer":76}],320:[function(require,module,exports){
59632
- (function (Buffer){(function (){
59633
- "use strict";
59634
- Object.defineProperty(exports, "__esModule", { value: true });
59635
- exports.bufferFrom = void 0;
59636
- var bufferFrom = function (data, encoding) {
59637
- return Buffer.from(data, encoding);
59638
- };
59639
- exports.bufferFrom = bufferFrom;
59640
-
59641
- }).call(this)}).call(this,require("buffer").Buffer)
59642
- },{"buffer":76}],321:[function(require,module,exports){
59643
- (function (Buffer){(function (){
59644
- "use strict";
59645
- var __importDefault = (this && this.__importDefault) || function (mod) {
59646
- return (mod && mod.__esModule) ? mod : { "default": mod };
59647
- };
59648
- Object.defineProperty(exports, "__esModule", { value: true });
59649
- exports.changeEndianness = exports.bytesToHex = exports.hexToBytes = exports.toHexString = exports.toHexStringRaw = exports.toHexBuffer = exports.isHex = exports.stripHexPrefix = exports.addHexPrefix = void 0;
59650
- var bignumber_1 = __importDefault(require("../dependencies/src/bignumber.js-9.0.0/bignumber"));
59651
- var padStart_1 = require("./padStart");
59652
- var HEX_PREFIX = '0x';
59653
- var HEX_REGEX = new RegExp("^(" + HEX_PREFIX + ")?[0-9a-fA-F]*$");
59654
- function hasPrefix(value) {
59655
- return value.startsWith(HEX_PREFIX);
59656
- }
59657
- function addHexPrefix(raw) {
59658
- return hasPrefix(raw) ? raw : HEX_PREFIX + raw;
59659
- }
59660
- exports.addHexPrefix = addHexPrefix;
59661
- function stripHexPrefix(hex) {
59662
- return hasPrefix(hex) ? hex.substring(2) : hex;
59663
- }
59664
- exports.stripHexPrefix = stripHexPrefix;
59665
- function isHex(value) {
59666
- return HEX_REGEX.test(value);
59667
- }
59668
- exports.isHex = isHex;
59669
- function toHexBuffer(value, bitLength, encoding) {
59670
- if (bitLength === void 0) { bitLength = 8; }
59671
- if (encoding === void 0) { encoding = 'default'; }
59672
- return Buffer.from(toHexStringRaw(value, bitLength, encoding), 'hex');
59673
- }
59674
- exports.toHexBuffer = toHexBuffer;
59675
- function toHexStringRaw(value, bitLength, encoding) {
59676
- if (bitLength === void 0) { bitLength = 8; }
59677
- if (encoding === void 0) { encoding = '2sComplement'; }
59678
- if (new bignumber_1.default(value).isPositive()) {
59679
- return toHexStringRawPositive(value, bitLength);
59680
- }
59681
- else {
59682
- return toHexStringRawNegative(value, bitLength, encoding);
59683
- }
59684
- }
59685
- exports.toHexStringRaw = toHexStringRaw;
59686
- function toHexString(value, bitLength, encoding) {
59687
- if (bitLength === void 0) { bitLength = 8; }
59688
- if (encoding === void 0) { encoding = 'default'; }
59689
- return addHexPrefix(toHexStringRaw(value, bitLength, encoding));
59690
- }
59691
- exports.toHexString = toHexString;
59692
- function hexToBytes(hex, bitLength) {
59693
- var byteLength = bitLength !== undefined ? Math.ceil(bitLength / 8) : undefined;
59694
- var buffer;
59695
- if (typeof hex === 'string' && isHex(hex)) {
59696
- buffer = Buffer.from(stripHexPrefix(hex), 'hex');
59697
- }
59698
- else if (!(typeof hex === 'string')) {
59699
- buffer = Buffer.from(hex);
59700
- }
59701
- else {
59702
- buffer = Buffer.from([0]);
59703
- }
59704
- if (byteLength !== undefined && buffer.length < byteLength) {
59705
- var newBuffer = Buffer.alloc(byteLength, 0);
59706
- var offset = newBuffer.length - buffer.length;
59707
- buffer.copy(newBuffer, offset);
59708
- return newBuffer;
59709
- }
59710
- else {
59711
- return buffer;
59712
- }
59713
- }
59714
- exports.hexToBytes = hexToBytes;
59715
- function bytesToHex(bytes, config) {
59716
- var hex;
59717
- if (typeof bytes === 'string') {
59718
- hex = bytes;
59719
- }
59720
- else {
59721
- var buffer = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes);
59722
- hex = buffer.toString('hex');
59723
- }
59724
- return (config === null || config === void 0 ? void 0 : config.withPrefix) ? addHexPrefix(hex) : hex;
59725
- }
59726
- exports.bytesToHex = bytesToHex;
59727
- function changeEndianness(hex) {
59728
- var _hex = stripHexPrefix(hex);
59729
- _hex = _hex.length % 2 !== 0 ? '0' + _hex : _hex;
59730
- var bytes = _hex.match(/.{2}/g) || [];
59731
- return bytes.reverse().join('');
59732
- }
59733
- exports.changeEndianness = changeEndianness;
59734
- function toHexStringRawPositive(value, bitLength) {
59735
- var hexString = value.toString(16);
59736
- return fillToTargetLength(hexString, bitLength);
59737
- }
59738
- function toHexStringRawNegative(value, bitLength, encoding) {
59739
- // tslint:disable-next-line: switch-default
59740
- switch (encoding) {
59741
- case 'default':
59742
- var hexString = value.toString(16);
59743
- return hexString.startsWith('-') ? "-" + fillToTargetLength(hexString.substr(1), bitLength) : fillToTargetLength(hexString, bitLength);
59744
- case '2sComplement':
59745
- var value2sComplement = new bignumber_1.default(2).pow(bitLength).minus(new bignumber_1.default(value).abs());
59746
- return value2sComplement.toString(16);
58506
+ * Gets thrown if the payload that is being decoded does not match the schema
58507
+ */
58508
+ var InvalidPayloadError = /** @class */ (function (_super) {
58509
+ __extends(InvalidPayloadError, _super);
58510
+ function InvalidPayloadError(description) {
58511
+ return _super.call(this, SerializerErrorType.INVALID_PAYLOAD, description) || this;
59747
58512
  }
59748
- }
59749
- function fillToTargetLength(hexString, bitLength) {
59750
- var nibbleLength = Math.ceil(bitLength / 4);
59751
- var targetLength = hexString.length >= nibbleLength ? hexString.length : nibbleLength;
59752
- targetLength = targetLength % 2 === 0 ? targetLength : targetLength + 1;
59753
- return padStart_1.padStart(hexString, targetLength, '0');
59754
- }
59755
-
59756
- }).call(this)}).call(this,require("buffer").Buffer)
59757
- },{"../dependencies/src/bignumber.js-9.0.0/bignumber":260,"./padStart":322,"buffer":76}],322:[function(require,module,exports){
59758
- "use strict";
59759
- Object.defineProperty(exports, "__esModule", { value: true });
59760
- exports.padStart = void 0;
59761
- function padStart(targetString, targetLength, padString) {
59762
- // truncate if number, or convert non-number to 0
59763
- targetLength = targetLength >> 0;
59764
- if (targetString.length >= targetLength) {
59765
- return targetString;
58513
+ return InvalidPayloadError;
58514
+ }(SerializerError));
58515
+ exports.InvalidPayloadError = InvalidPayloadError;
58516
+ /**
58517
+ * Gets thrown if the string is not a valid hex string
58518
+ */
58519
+ var InvalidHexString = /** @class */ (function (_super) {
58520
+ __extends(InvalidHexString, _super);
58521
+ function InvalidHexString(description) {
58522
+ return _super.call(this, SerializerErrorType.INVALID_HEX_STRING, description) || this;
59766
58523
  }
59767
- else {
59768
- targetLength = targetLength - targetString.length;
59769
- if (targetLength > padString.length) {
59770
- // append to original to ensure we are longer than needed
59771
- padString += padString.repeat(targetLength / padString.length);
59772
- }
59773
- return padString.slice(0, targetLength) + targetString;
58524
+ return InvalidHexString;
58525
+ }(SerializerError));
58526
+ exports.InvalidHexString = InvalidHexString;
58527
+ /**
58528
+ * Gets thrown if the string starts with "0x". This causes problems with RLP
58529
+ */
58530
+ var InvalidString = /** @class */ (function (_super) {
58531
+ __extends(InvalidString, _super);
58532
+ function InvalidString(description) {
58533
+ return _super.call(this, SerializerErrorType.INVALID_STRING, description) || this;
59774
58534
  }
59775
- }
59776
- exports.padStart = padStart;
58535
+ return InvalidString;
58536
+ }(SerializerError));
58537
+ exports.InvalidString = InvalidString;
59777
58538
 
59778
- },{}],323:[function(require,module,exports){
58539
+ },{"./coinlib-error":300}],302:[function(require,module,exports){
59779
58540
  "use strict";
59780
- var __extends = (this && this.__extends) || (function () {
59781
- var extendStatics = function (d, b) {
59782
- extendStatics = Object.setPrototypeOf ||
59783
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
59784
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
59785
- return extendStatics(d, b);
59786
- };
59787
- return function (d, b) {
59788
- extendStatics(d, b);
59789
- function __() { this.constructor = d; }
59790
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
59791
- };
59792
- })();
59793
58541
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
59794
58542
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59795
58543
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -59826,154 +58574,55 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
59826
58574
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59827
58575
  }
59828
58576
  };
59829
- var __importDefault = (this && this.__importDefault) || function (mod) {
59830
- return (mod && mod.__esModule) ? mod : { "default": mod };
59831
- };
59832
58577
  Object.defineProperty(exports, "__esModule", { value: true });
59833
- exports.AirGapCoinWallet = exports.TimeInterval = void 0;
59834
- var bignumber_1 = __importDefault(require("../dependencies/src/bignumber.js-9.0.0/bignumber"));
59835
- var ProtocolNetwork_1 = require("../utils/ProtocolNetwork");
59836
- var ProtocolSymbols_1 = require("../utils/ProtocolSymbols");
59837
- var AirGapMarketWallet_1 = require("./AirGapMarketWallet");
59838
- var TimeInterval;
59839
- (function (TimeInterval) {
59840
- TimeInterval["HOURS"] = "24h";
59841
- TimeInterval["DAYS"] = "7d";
59842
- TimeInterval["MONTH"] = "30d";
59843
- })(TimeInterval = exports.TimeInterval || (exports.TimeInterval = {}));
59844
- var AirGapCoinWallet = /** @class */ (function (_super) {
59845
- __extends(AirGapCoinWallet, _super);
59846
- function AirGapCoinWallet() {
59847
- return _super !== null && _super.apply(this, arguments) || this;
58578
+ exports.CryptoClient = void 0;
58579
+ var errors_1 = require("../errors");
58580
+ var coinlib_error_1 = require("../errors/coinlib-error");
58581
+ var AES_1 = require("../utils/AES");
58582
+ var CryptoClient = /** @class */ (function () {
58583
+ function CryptoClient() {
59848
58584
  }
59849
- AirGapCoinWallet.prototype.getCurrentBalance = function () {
59850
- return this.currentBalance;
59851
- };
59852
- AirGapCoinWallet.prototype.setCurrentBalance = function (balance) {
59853
- this.currentBalance = balance;
59854
- };
59855
- AirGapCoinWallet.prototype.getCurrentMarketPrice = function () {
59856
- return this.currentMarketPrice;
59857
- };
59858
- AirGapCoinWallet.prototype.setCurrentMarketPrice = function (marketPrice) {
58585
+ CryptoClient.prototype.encryptAES = function (payload, privateKey) {
59859
58586
  return __awaiter(this, void 0, void 0, function () {
59860
- var _a;
59861
- return __generator(this, function (_b) {
59862
- switch (_b.label) {
59863
- case 0:
59864
- _a = this;
59865
- return [4 /*yield*/, this.protocol.getOptions()];
59866
- case 1:
59867
- _a.currentMarketPrice = (_b.sent()).network.type === ProtocolNetwork_1.NetworkType.MAINNET ? marketPrice : new bignumber_1.default(0);
59868
- return [2 /*return*/];
59869
- }
58587
+ return __generator(this, function (_a) {
58588
+ return [2 /*return*/, new AES_1.AES().encryptString(payload, privateKey)];
59870
58589
  });
59871
58590
  });
59872
58591
  };
59873
- AirGapCoinWallet.prototype._synchronize = function () {
58592
+ CryptoClient.prototype.decryptAES = function (encryptedPayload, privateKey) {
59874
58593
  return __awaiter(this, void 0, void 0, function () {
59875
- var _a, balance, marketPrice;
59876
- return __generator(this, function (_b) {
59877
- switch (_b.label) {
59878
- case 0: return [4 /*yield*/, Promise.all([this.balanceOf(), this.fetchCurrentMarketPrice()])];
59879
- case 1:
59880
- _a = _b.sent(), balance = _a[0], marketPrice = _a[1];
59881
- this.setCurrentBalance(balance);
59882
- return [4 /*yield*/, this.setCurrentMarketPrice(marketPrice)];
59883
- case 2:
59884
- _b.sent();
59885
- return [2 /*return*/];
59886
- }
58594
+ return __generator(this, function (_a) {
58595
+ return [2 /*return*/, new AES_1.AES().decryptString(encryptedPayload, privateKey)];
59887
58596
  });
59888
58597
  });
59889
58598
  };
59890
- AirGapCoinWallet.prototype.reset = function () {
59891
- this.currentBalance = undefined;
59892
- this.currentMarketPrice = undefined;
58599
+ CryptoClient.prototype.encryptAsymmetric = function (payload, publicKey) {
58600
+ return __awaiter(this, void 0, void 0, function () {
58601
+ return __generator(this, function (_a) {
58602
+ throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, "encryptAsymmetric() not Implemented");
58603
+ });
58604
+ });
59893
58605
  };
59894
- AirGapCoinWallet.prototype.fetchCurrentMarketPrice = function (baseSymbol) {
59895
- if (baseSymbol === void 0) { baseSymbol = 'USD'; }
58606
+ CryptoClient.prototype.decryptAsymmetric = function (encryptedPayload, keypair) {
59896
58607
  return __awaiter(this, void 0, void 0, function () {
59897
- var marketPrice;
59898
58608
  return __generator(this, function (_a) {
59899
- switch (_a.label) {
59900
- case 0: return [4 /*yield*/, this.priceService.getCurrentMarketPrice(this.protocol, baseSymbol)];
59901
- case 1:
59902
- marketPrice = _a.sent();
59903
- return [4 /*yield*/, this.setCurrentMarketPrice(marketPrice)];
59904
- case 2:
59905
- _a.sent();
59906
- return [2 /*return*/, marketPrice];
59907
- }
58609
+ throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, "decryptAsymmetric() not Implemented");
59908
58610
  });
59909
58611
  });
59910
58612
  };
59911
- AirGapCoinWallet.prototype.balanceOf = function () {
58613
+ CryptoClient.prototype.recoverPublicKeyFromSignature = function () {
59912
58614
  return __awaiter(this, void 0, void 0, function () {
59913
- var protocolIdentifier, result, _a, _b, _c, _d, _e;
59914
- return __generator(this, function (_f) {
59915
- switch (_f.label) {
59916
- case 0: return [4 /*yield*/, this.protocol.getIdentifier()];
59917
- case 1:
59918
- protocolIdentifier = _f.sent();
59919
- if (!((protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.BTC ||
59920
- protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.BTC_SEGWIT ||
59921
- protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.GRS) &&
59922
- this.isExtendedPublicKey)) return [3 /*break*/, 3];
59923
- _a = bignumber_1.default.bind;
59924
- return [4 /*yield*/, this.protocol.getBalanceOfExtendedPublicKey(this.publicKey, 0)];
59925
- case 2:
59926
- // TODO: Remove and test
59927
- /*
59928
- We should remove this if BTC also uses blockbook. (And change the order of the if/else below)
59929
-
59930
- The problem is that we have addresses cached for all protocols. But blockbook (grs) doesn't allow
59931
- multiple addresses to be checked at once, so we need to xPub key there (or we would do 100s of requests).
59932
-
59933
- We can also not simply change the order of the following if/else, because then it would use the xPub method for
59934
- BTC as well, which results in the addresses being derived again, which causes massive lags in the apps.
59935
- */
59936
- result = new (_a.apply(bignumber_1.default, [void 0, _f.sent()]))();
59937
- return [3 /*break*/, 11];
59938
- case 3:
59939
- if (!(protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.XTZ_SHIELDED) /* TODO: cover ALL sapling protocols */) return [3 /*break*/, 5]; /* TODO: cover ALL sapling protocols */
59940
- _b = bignumber_1.default.bind;
59941
- return [4 /*yield*/, this.protocol.getBalanceOfPublicKey(this.publicKey)];
59942
- case 4:
59943
- result = new (_b.apply(bignumber_1.default, [void 0, _f.sent()]))();
59944
- return [3 /*break*/, 11];
59945
- case 5:
59946
- if (!(this.addresses.length > 0)) return [3 /*break*/, 7];
59947
- _c = bignumber_1.default.bind;
59948
- return [4 /*yield*/, this.protocol.getBalanceOfAddresses(this.addressesToCheck())];
59949
- case 6:
59950
- result = new (_c.apply(bignumber_1.default, [void 0, _f.sent()]))();
59951
- return [3 /*break*/, 11];
59952
- case 7:
59953
- if (!this.isExtendedPublicKey) return [3 /*break*/, 9];
59954
- _d = bignumber_1.default.bind;
59955
- return [4 /*yield*/, this.protocol.getBalanceOfExtendedPublicKey(this.publicKey, 0)];
59956
- case 8:
59957
- result = new (_d.apply(bignumber_1.default, [void 0, _f.sent()]))();
59958
- return [3 /*break*/, 11];
59959
- case 9:
59960
- _e = bignumber_1.default.bind;
59961
- return [4 /*yield*/, this.protocol.getBalanceOfPublicKey(this.publicKey)];
59962
- case 10:
59963
- result = new (_e.apply(bignumber_1.default, [void 0, _f.sent()]))();
59964
- _f.label = 11;
59965
- case 11:
59966
- this.setCurrentBalance(result);
59967
- return [2 /*return*/, result];
59968
- }
58615
+ return __generator(this, function (_a) {
58616
+ throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, "Recovering public key from signature not supported");
59969
58617
  });
59970
58618
  });
59971
58619
  };
59972
- return AirGapCoinWallet;
59973
- }(AirGapMarketWallet_1.AirGapMarketWallet));
59974
- exports.AirGapCoinWallet = AirGapCoinWallet;
58620
+ return CryptoClient;
58621
+ }());
58622
+ exports.CryptoClient = CryptoClient;
59975
58623
 
59976
- },{"../dependencies/src/bignumber.js-9.0.0/bignumber":260,"../utils/ProtocolNetwork":316,"../utils/ProtocolSymbols":317,"./AirGapMarketWallet":324}],324:[function(require,module,exports){
58624
+ },{"../errors":301,"../errors/coinlib-error":300,"../utils/AES":305}],303:[function(require,module,exports){
58625
+ (function (Buffer){(function (){
59977
58626
  "use strict";
59978
58627
  var __extends = (this && this.__extends) || (function () {
59979
58628
  var extendStatics = function (d, b) {
@@ -60024,187 +58673,128 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
60024
58673
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
60025
58674
  }
60026
58675
  };
60027
- var __importDefault = (this && this.__importDefault) || function (mod) {
60028
- return (mod && mod.__esModule) ? mod : { "default": mod };
60029
- };
60030
58676
  Object.defineProperty(exports, "__esModule", { value: true });
60031
- exports.AirGapMarketWallet = void 0;
60032
- var bignumber_1 = __importDefault(require("../dependencies/src/bignumber.js-9.0.0/bignumber"));
60033
- var ProtocolSymbols_1 = require("../utils/ProtocolSymbols");
60034
- var AirGapWallet_1 = require("./AirGapWallet");
60035
- var AirGapMarketWallet = /** @class */ (function (_super) {
60036
- __extends(AirGapMarketWallet, _super);
60037
- function AirGapMarketWallet(protocol, publicKey, isExtendedPublicKey, derivationPath, masterFingerprint, status, priceService, addressIndex) {
60038
- var _this = _super.call(this, protocol, publicKey, isExtendedPublicKey, derivationPath, masterFingerprint, status, addressIndex) || this;
60039
- _this.protocol = protocol;
60040
- _this.publicKey = publicKey;
60041
- _this.isExtendedPublicKey = isExtendedPublicKey;
60042
- _this.derivationPath = derivationPath;
60043
- _this.masterFingerprint = masterFingerprint;
60044
- _this.status = status;
60045
- _this.priceService = priceService;
60046
- _this.addressIndex = addressIndex;
60047
- return _this;
58677
+ exports.Ed25519CryptoClient = void 0;
58678
+ var bytes_1 = require("@stablelib/bytes");
58679
+ var blake2b_1 = require("@stablelib/blake2b");
58680
+ var ed25519_1 = require("@stablelib/ed25519");
58681
+ var nacl_1 = require("@stablelib/nacl");
58682
+ var utf8_1 = require("@stablelib/utf8");
58683
+ var hex_1 = require("../utils/hex");
58684
+ var CryptoClient_1 = require("./CryptoClient");
58685
+ function toHex(value) {
58686
+ return Buffer.from(value).toString('hex');
58687
+ }
58688
+ var Ed25519CryptoClient = /** @class */ (function (_super) {
58689
+ __extends(Ed25519CryptoClient, _super);
58690
+ function Ed25519CryptoClient() {
58691
+ return _super !== null && _super.apply(this, arguments) || this;
60048
58692
  }
60049
- AirGapMarketWallet.prototype.addressesToCheck = function () {
60050
- var addressesToReceive = this.addressIndex !== undefined ? [this.addresses[this.addressIndex]] : this.addresses;
60051
- return addressesToReceive;
60052
- };
60053
- AirGapMarketWallet.prototype.setProtocol = function (protocol) {
58693
+ Ed25519CryptoClient.prototype.encryptAsymmetric = function (payload, publicKey) {
60054
58694
  return __awaiter(this, void 0, void 0, function () {
58695
+ var kxOtherPublicKey, keypair, state, nonce, encryptedMessage;
60055
58696
  return __generator(this, function (_a) {
60056
- switch (_a.label) {
60057
- case 0: return [4 /*yield*/, _super.prototype.setProtocol.call(this, protocol)];
60058
- case 1:
60059
- _a.sent();
60060
- this.reset();
60061
- return [4 /*yield*/, this.synchronize()];
60062
- case 2:
60063
- _a.sent();
60064
- return [2 /*return*/];
60065
- }
58697
+ kxOtherPublicKey = ed25519_1.convertPublicKeyToX25519(Buffer.from(publicKey, 'hex'));
58698
+ keypair = nacl_1.generateKeyPair();
58699
+ state = new blake2b_1.BLAKE2b(24);
58700
+ nonce = state.update(keypair.publicKey, 32).update(kxOtherPublicKey, 32).digest();
58701
+ encryptedMessage = nacl_1.box(kxOtherPublicKey, keypair.secretKey, nonce, hex_1.isHex(payload) ? Buffer.from(payload, 'hex') : utf8_1.encode(payload));
58702
+ return [2 /*return*/, toHex(bytes_1.concat(keypair.publicKey, encryptedMessage))];
60066
58703
  });
60067
58704
  });
60068
58705
  };
60069
- AirGapMarketWallet.prototype.synchronize = function () {
60070
- var args = [];
60071
- for (var _i = 0; _i < arguments.length; _i++) {
60072
- args[_i] = arguments[_i];
60073
- }
58706
+ Ed25519CryptoClient.prototype.decryptAsymmetric = function (encryptedPayload, keypair) {
60074
58707
  return __awaiter(this, void 0, void 0, function () {
60075
- var _this = this;
58708
+ var kxSelfPrivateKey, kxSelfPublicKey, encryptedPayloadBytes, kxOtherPublicKey, ciphertext, state, nonce, decryptedMessage;
60076
58709
  return __generator(this, function (_a) {
60077
- if (this.synchronizePromise === undefined) {
60078
- this.synchronizePromise = this._synchronize.apply(this, args).finally(function () {
60079
- _this.synchronizePromise = undefined;
60080
- });
58710
+ kxSelfPrivateKey = ed25519_1.convertSecretKeyToX25519(Buffer.from(keypair.privateKey, 'hex')) // Secret bytes to scalar bytes
58711
+ ;
58712
+ kxSelfPublicKey = ed25519_1.convertPublicKeyToX25519(Buffer.from(keypair.publicKey, 'hex')) // Secret bytes to scalar bytes
58713
+ ;
58714
+ encryptedPayloadBytes = Buffer.from(encryptedPayload, hex_1.isHex(encryptedPayload) ? 'hex' : 'utf-8');
58715
+ kxOtherPublicKey = encryptedPayloadBytes.slice(0, 32);
58716
+ ciphertext = encryptedPayloadBytes.slice(32);
58717
+ state = new blake2b_1.BLAKE2b(24);
58718
+ nonce = state.update(kxOtherPublicKey, 32).update(kxSelfPublicKey, 32).digest();
58719
+ decryptedMessage = nacl_1.openBox(kxOtherPublicKey, kxSelfPrivateKey, nonce, ciphertext);
58720
+ if (decryptedMessage === null) {
58721
+ throw new Error('Ed25519 decryption failed.');
60081
58722
  }
60082
- return [2 /*return*/, this.synchronizePromise];
58723
+ return [2 /*return*/, Buffer.from(decryptedMessage).toString()];
60083
58724
  });
60084
58725
  });
60085
58726
  };
60086
- AirGapMarketWallet.prototype.fetchTransactions = function (limit, cursor) {
60087
- return __awaiter(this, void 0, void 0, function () {
60088
- var protocolIdentifier, transactionResult;
60089
- return __generator(this, function (_a) {
60090
- switch (_a.label) {
60091
- case 0: return [4 /*yield*/, this.protocol.getIdentifier()
60092
- // let transactions: IAirGapTransaction[] = []
60093
- ];
60094
- case 1:
60095
- protocolIdentifier = _a.sent();
60096
- if (!((protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.BTC ||
60097
- protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.BTC_SEGWIT ||
60098
- protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.GRS) &&
60099
- this.isExtendedPublicKey)) return [3 /*break*/, 3];
60100
- return [4 /*yield*/, this.protocol.getTransactionsFromExtendedPublicKey(this.publicKey, limit, cursor)];
60101
- case 2:
60102
- // TODO: Remove and test
60103
- /*
60104
- We should remove this if BTC also uses blockbook. (And change the order of the if/else below)
60105
-
60106
- The problem is that we have addresses cached for all protocols. But blockbook (grs) doesn't allow
60107
- multiple addresses to be checked at once, so we need to xPub key there (or we would do 100s of requests).
60108
-
60109
- We can also not simply change the order of the following if/else, because then it would use the xPub method for
60110
- BTC as well, which results in the addresses being derived again, which causes massive lags in the apps.
60111
- */
60112
- transactionResult = _a.sent();
60113
- return [3 /*break*/, 11];
60114
- case 3:
60115
- if (!(protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.XTZ_SHIELDED) /* TODO: cover ALL sapling protocols */) return [3 /*break*/, 5]; /* TODO: cover ALL sapling protocols */
60116
- return [4 /*yield*/, this.protocol.getTransactionsFromPublicKey(this.publicKey, limit, cursor)];
60117
- case 4:
60118
- transactionResult = _a.sent();
60119
- return [3 /*break*/, 11];
60120
- case 5:
60121
- if (!(this.addresses.length > 0)) return [3 /*break*/, 7];
60122
- return [4 /*yield*/, this.protocol.getTransactionsFromAddresses(this.addressesToCheck(), limit, cursor)];
60123
- case 6:
60124
- transactionResult = _a.sent();
60125
- return [3 /*break*/, 11];
60126
- case 7:
60127
- if (!this.isExtendedPublicKey) return [3 /*break*/, 9];
60128
- return [4 /*yield*/, this.protocol.getTransactionsFromExtendedPublicKey(this.publicKey, limit, cursor)];
60129
- case 8:
60130
- transactionResult = _a.sent();
60131
- return [3 /*break*/, 11];
60132
- case 9: return [4 /*yield*/, this.protocol.getTransactionsFromPublicKey(this.publicKey, limit, cursor)];
60133
- case 10:
60134
- transactionResult = _a.sent();
60135
- _a.label = 11;
60136
- case 11: return [2 /*return*/, transactionResult];
60137
- }
60138
- });
60139
- });
58727
+ return Ed25519CryptoClient;
58728
+ }(CryptoClient_1.CryptoClient));
58729
+ exports.Ed25519CryptoClient = Ed25519CryptoClient;
58730
+
58731
+ }).call(this)}).call(this,require("buffer").Buffer)
58732
+ },{"../utils/hex":309,"./CryptoClient":302,"@stablelib/blake2b":312,"@stablelib/bytes":313,"@stablelib/ed25519":315,"@stablelib/nacl":318,"@stablelib/utf8":327,"buffer":76}],304:[function(require,module,exports){
58733
+ "use strict";
58734
+ Object.defineProperty(exports, "__esModule", { value: true });
58735
+ exports.NonExtendedProtocol = void 0;
58736
+ var NonExtendedProtocol = /** @class */ (function () {
58737
+ function NonExtendedProtocol() {
58738
+ }
58739
+ NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
58740
+ throw Promise.reject('extended private key support not implemented');
60140
58741
  };
60141
- AirGapMarketWallet.prototype.prepareTransaction = function (recipients, values, fee, data) {
60142
- if (this.isExtendedPublicKey) {
60143
- return this.protocol.prepareTransactionFromExtendedPublicKey(this.publicKey, 0, recipients, values, fee, data);
60144
- }
60145
- else {
60146
- if (this.addressIndex) {
60147
- data = Object.assign(data, { addressIndex: this.addressIndex });
60148
- }
60149
- return this.protocol.prepareTransactionFromPublicKey(this.publicKey, recipients, values, fee, data);
60150
- }
58742
+ NonExtendedProtocol.prototype.getExtendedPrivateKeyFromHexSecret = function (secret, derivationPath) {
58743
+ throw Promise.reject('extended private key support not implemented');
60151
58744
  };
60152
- AirGapMarketWallet.prototype.getMaxTransferValue = function (recipients, fee, data) {
60153
- return __awaiter(this, void 0, void 0, function () {
60154
- var _a, _b;
60155
- return __generator(this, function (_c) {
60156
- switch (_c.label) {
60157
- case 0:
60158
- if (!this.isExtendedPublicKey) return [3 /*break*/, 2];
60159
- _a = bignumber_1.default.bind;
60160
- return [4 /*yield*/, this.protocol.estimateMaxTransactionValueFromExtendedPublicKey(this.publicKey, recipients, fee, data)];
60161
- case 1: return [2 /*return*/, new (_a.apply(bignumber_1.default, [void 0, _c.sent()]))()];
60162
- case 2:
60163
- if (this.addressIndex) {
60164
- data = Object.assign(data, { addressIndex: this.addressIndex });
60165
- }
60166
- _b = bignumber_1.default.bind;
60167
- return [4 /*yield*/, this.protocol.estimateMaxTransactionValueFromPublicKey(this.publicKey, recipients, fee, data)];
60168
- case 3: return [2 /*return*/, new (_b.apply(bignumber_1.default, [void 0, _c.sent()]))()];
60169
- }
60170
- });
60171
- });
58745
+ NonExtendedProtocol.prototype.getBalanceOfExtendedPublicKey = function (extendedPublicKey, offset) {
58746
+ return Promise.reject('extended public balance not implemented');
60172
58747
  };
60173
- AirGapMarketWallet.prototype.estimateFees = function (recipients, values, data) {
60174
- return __awaiter(this, void 0, void 0, function () {
60175
- return __generator(this, function (_a) {
60176
- if (this.isExtendedPublicKey) {
60177
- return [2 /*return*/, this.protocol.estimateFeeDefaultsFromExtendedPublicKey(this.publicKey, recipients, values, data)];
60178
- }
60179
- else {
60180
- if (this.addressIndex) {
60181
- data = Object.assign(data, { addressIndex: this.addressIndex });
60182
- }
60183
- return [2 /*return*/, this.protocol.estimateFeeDefaultsFromPublicKey(this.publicKey, recipients, values, data)];
60184
- }
60185
- return [2 /*return*/];
60186
- });
58748
+ NonExtendedProtocol.prototype.signWithExtendedPrivateKey = function (extendedPrivateKey, transaction, childDerivationPath) {
58749
+ return Promise.reject('extended private key signing for not implemented');
58750
+ };
58751
+ NonExtendedProtocol.prototype.getAddressFromExtendedPublicKey = function (extendedPublicKey, visibilityDerivationIndex, addressDerivationIndex) {
58752
+ return Promise.resolve({
58753
+ address: '',
58754
+ cursor: { hasNext: false }
60187
58755
  });
60188
58756
  };
60189
- return AirGapMarketWallet;
60190
- }(AirGapWallet_1.AirGapWallet));
60191
- exports.AirGapMarketWallet = AirGapMarketWallet;
60192
-
60193
- },{"../dependencies/src/bignumber.js-9.0.0/bignumber":260,"../utils/ProtocolSymbols":317,"./AirGapWallet":326}],325:[function(require,module,exports){
60194
- "use strict";
60195
- var __extends = (this && this.__extends) || (function () {
60196
- var extendStatics = function (d, b) {
60197
- extendStatics = Object.setPrototypeOf ||
60198
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
60199
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
60200
- return extendStatics(d, b);
58757
+ NonExtendedProtocol.prototype.getAddressesFromExtendedPublicKey = function (extendedPublicKey, visibilityDerivationIndex, addressCount, offset) {
58758
+ return Promise.resolve([]);
60201
58759
  };
60202
- return function (d, b) {
60203
- extendStatics(d, b);
60204
- function __() { this.constructor = d; }
60205
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
58760
+ NonExtendedProtocol.prototype.estimateMaxTransactionValueFromExtendedPublicKey = function (extendedPublicKey, recipients, fee) {
58761
+ return Promise.reject('estimating max value using extended public key not implemented');
60206
58762
  };
60207
- })();
58763
+ NonExtendedProtocol.prototype.estimateFeeDefaultsFromExtendedPublicKey = function (publicKey, recipients, values, data) {
58764
+ return Promise.reject('estimating fee defaults using extended public key not implemented');
58765
+ };
58766
+ NonExtendedProtocol.prototype.getTransactionsFromExtendedPublicKey = function (extendedPublicKey, limit, cursor) {
58767
+ return Promise.reject('fetching txs using extended public key not implemented');
58768
+ };
58769
+ NonExtendedProtocol.prototype.prepareTransactionFromExtendedPublicKey = function (extendedPublicKey, offset, recipients, values, fee) {
58770
+ return Promise.reject('extended public key tx not implemented');
58771
+ };
58772
+ return NonExtendedProtocol;
58773
+ }());
58774
+ exports.NonExtendedProtocol = NonExtendedProtocol;
58775
+
58776
+ },{}],305:[function(require,module,exports){
58777
+ (function (Buffer){(function (){
58778
+ "use strict";
58779
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
58780
+ if (k2 === undefined) k2 = k;
58781
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
58782
+ }) : (function(o, m, k, k2) {
58783
+ if (k2 === undefined) k2 = k;
58784
+ o[k2] = m[k];
58785
+ }));
58786
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
58787
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
58788
+ }) : function(o, v) {
58789
+ o["default"] = v;
58790
+ });
58791
+ var __importStar = (this && this.__importStar) || function (mod) {
58792
+ if (mod && mod.__esModule) return mod;
58793
+ var result = {};
58794
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
58795
+ __setModuleDefault(result, mod);
58796
+ return result;
58797
+ };
60208
58798
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
60209
58799
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
60210
58800
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -60241,279 +58831,388 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
60241
58831
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
60242
58832
  }
60243
58833
  };
58834
+ Object.defineProperty(exports, "__esModule", { value: true });
58835
+ exports.AES = void 0;
58836
+ var crypto = __importStar(require("crypto"));
58837
+ var errors_1 = require("../errors");
58838
+ var coinlib_error_1 = require("../errors/coinlib-error");
58839
+ var hex_1 = require("./hex");
58840
+ // https://github.com/microsoft/botbuilder-js/blob/master/libraries/botframework-config/src/encrypt.ts#L20
58841
+ var AES = /** @class */ (function () {
58842
+ function AES(AES_KEY_SIZE, KEY_DERIVATION_ITERATION_COUNT, ALGORITHM, encoding) {
58843
+ if (AES_KEY_SIZE === void 0) { AES_KEY_SIZE = 256; }
58844
+ if (KEY_DERIVATION_ITERATION_COUNT === void 0) { KEY_DERIVATION_ITERATION_COUNT = 10000; }
58845
+ if (ALGORITHM === void 0) { ALGORITHM = 'aes-256-gcm'; }
58846
+ if (encoding === void 0) { encoding = 'hex'; }
58847
+ this.AES_KEY_SIZE = AES_KEY_SIZE;
58848
+ this.KEY_DERIVATION_ITERATION_COUNT = KEY_DERIVATION_ITERATION_COUNT;
58849
+ this.ALGORITHM = ALGORITHM;
58850
+ this.encoding = encoding;
58851
+ }
58852
+ AES.prototype.encryptString = function (plainText, privateKey) {
58853
+ return __awaiter(this, void 0, void 0, function () {
58854
+ var keyBytes, ivBytes, ivText, cipher, encryptedValue, authTagText;
58855
+ return __generator(this, function (_a) {
58856
+ switch (_a.label) {
58857
+ case 0:
58858
+ if (!plainText || plainText.length === 0) {
58859
+ throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'you must pass an input message');
58860
+ }
58861
+ if (!privateKey || privateKey.length === 0) {
58862
+ throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'you must pass a privateKey');
58863
+ }
58864
+ return [4 /*yield*/, this.deriveKeyFromPrivateKey(privateKey)
58865
+ // Generates 16 byte cryptographically strong pseudo-random data as IV
58866
+ // https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback
58867
+ ];
58868
+ case 1:
58869
+ keyBytes = _a.sent();
58870
+ ivBytes = crypto.randomBytes(16);
58871
+ ivText = ivBytes.toString(this.encoding);
58872
+ cipher = crypto.createCipheriv(this.ALGORITHM, keyBytes, ivBytes);
58873
+ encryptedValue = cipher.update(plainText, 'utf8', this.encoding);
58874
+ encryptedValue += cipher.final(this.encoding);
58875
+ authTagText = cipher.getAuthTag().toString(this.encoding);
58876
+ return [2 /*return*/, ivText + "!" + encryptedValue + "!" + authTagText];
58877
+ }
58878
+ });
58879
+ });
58880
+ };
58881
+ AES.prototype.decryptString = function (encryptedValue, privateKey) {
58882
+ return __awaiter(this, void 0, void 0, function () {
58883
+ var parts, ivText, encryptedText, authTagText, ivBytes, keyBytes, authTagBytes, decipher, value;
58884
+ return __generator(this, function (_a) {
58885
+ switch (_a.label) {
58886
+ case 0:
58887
+ if (!encryptedValue || encryptedValue.length === 0) {
58888
+ return [2 /*return*/, encryptedValue];
58889
+ }
58890
+ if (!privateKey || privateKey.length === 0) {
58891
+ throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'you must pass a privateKey');
58892
+ }
58893
+ parts = encryptedValue.split('!');
58894
+ if (parts.length !== 3) {
58895
+ throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'The encrypted value is not in a valid format');
58896
+ }
58897
+ ivText = parts[0];
58898
+ encryptedText = parts[1];
58899
+ authTagText = parts[2];
58900
+ ivBytes = Buffer.from(ivText, this.encoding);
58901
+ return [4 /*yield*/, this.deriveKeyFromPrivateKey(privateKey)];
58902
+ case 1:
58903
+ keyBytes = _a.sent();
58904
+ authTagBytes = Buffer.from(authTagText, this.encoding);
58905
+ if (ivBytes.length !== 16) {
58906
+ throw new errors_1.InvalidValueError(coinlib_error_1.Domain.UTILS, 'The IV length is invalid');
58907
+ }
58908
+ if (keyBytes.length !== 32) {
58909
+ throw new errors_1.InvalidValueError(coinlib_error_1.Domain.UTILS, 'The key length is invalid');
58910
+ }
58911
+ if (authTagBytes.length !== 16) {
58912
+ throw new errors_1.InvalidValueError(coinlib_error_1.Domain.UTILS, 'The authtag length is invalid');
58913
+ }
58914
+ decipher = crypto.createDecipheriv(this.ALGORITHM, keyBytes, ivBytes);
58915
+ decipher.setAuthTag(authTagBytes);
58916
+ value = decipher.update(encryptedText, this.encoding, 'utf8');
58917
+ value += decipher.final('utf8');
58918
+ return [2 /*return*/, value];
58919
+ }
58920
+ });
58921
+ });
58922
+ };
58923
+ AES.prototype.deriveKeyFromPrivateKey = function (privateKey) {
58924
+ var _this = this;
58925
+ var password = hex_1.isHex(privateKey) ? Buffer.from(privateKey, 'hex') : privateKey;
58926
+ return new Promise(function (resolve, reject) {
58927
+ crypto.pbkdf2(password, '', _this.KEY_DERIVATION_ITERATION_COUNT, 32, 'sha512', function (pbkdf2Error, key) {
58928
+ if (pbkdf2Error) {
58929
+ reject(pbkdf2Error);
58930
+ }
58931
+ resolve(key);
58932
+ });
58933
+ });
58934
+ };
58935
+ return AES;
58936
+ }());
58937
+ exports.AES = AES;
58938
+
58939
+ }).call(this)}).call(this,require("buffer").Buffer)
58940
+ },{"../errors":301,"../errors/coinlib-error":300,"./hex":309,"buffer":76,"crypto":87}],306:[function(require,module,exports){
58941
+ "use strict";
58942
+ Object.defineProperty(exports, "__esModule", { value: true });
58943
+ exports.ProtocolNetwork = exports.NetworkType = void 0;
58944
+ var createHash = require("../dependencies/src/create-hash-1.2.0/index");
58945
+ var sha256hashShort = function (input) {
58946
+ var hash = createHash('sha256');
58947
+ hash.update(input);
58948
+ return hash.digest('base64').slice(0, 10);
58949
+ };
58950
+ var NetworkType;
58951
+ (function (NetworkType) {
58952
+ NetworkType["MAINNET"] = "MAINNET";
58953
+ NetworkType["TESTNET"] = "TESTNET";
58954
+ NetworkType["CUSTOM"] = "CUSTOM";
58955
+ })(NetworkType = exports.NetworkType || (exports.NetworkType = {}));
58956
+ var ProtocolNetwork = /** @class */ (function () {
58957
+ function ProtocolNetwork(name, type, rpcUrl, blockExplorer, extras) {
58958
+ this.name = name;
58959
+ this.type = type;
58960
+ this.rpcUrl = rpcUrl;
58961
+ this.blockExplorer = blockExplorer;
58962
+ this.extras = extras;
58963
+ }
58964
+ Object.defineProperty(ProtocolNetwork.prototype, "identifier", {
58965
+ get: function () {
58966
+ var hashed = sha256hashShort(this.name + "-" + this.rpcUrl);
58967
+ return this.type + "-" + hashed;
58968
+ },
58969
+ enumerable: false,
58970
+ configurable: true
58971
+ });
58972
+ return ProtocolNetwork;
58973
+ }());
58974
+ exports.ProtocolNetwork = ProtocolNetwork;
58975
+
58976
+ },{"../dependencies/src/create-hash-1.2.0/index":270}],307:[function(require,module,exports){
58977
+ "use strict";
58978
+ Object.defineProperty(exports, "__esModule", { value: true });
58979
+ exports.isProtocolSymbol = exports.isSubProtocolSymbol = exports.isMainProtocolSymbol = exports.SubProtocolSymbols = exports.MainProtocolSymbols = void 0;
58980
+ var MainProtocolSymbols;
58981
+ (function (MainProtocolSymbols) {
58982
+ MainProtocolSymbols["AE"] = "ae";
58983
+ MainProtocolSymbols["BTC"] = "btc";
58984
+ MainProtocolSymbols["BTC_SEGWIT"] = "btc_segwit";
58985
+ MainProtocolSymbols["ETH"] = "eth";
58986
+ MainProtocolSymbols["XTZ"] = "xtz";
58987
+ MainProtocolSymbols["XTZ_SHIELDED"] = "xtz_shielded";
58988
+ MainProtocolSymbols["GRS"] = "grs";
58989
+ MainProtocolSymbols["COSMOS"] = "cosmos";
58990
+ MainProtocolSymbols["POLKADOT"] = "polkadot";
58991
+ MainProtocolSymbols["KUSAMA"] = "kusama";
58992
+ MainProtocolSymbols["MOONBASE"] = "moonbase";
58993
+ MainProtocolSymbols["MOONRIVER"] = "moonriver";
58994
+ MainProtocolSymbols["MOONBEAM"] = "moonbeam";
58995
+ MainProtocolSymbols["ASTAR"] = "astar";
58996
+ MainProtocolSymbols["SHIDEN"] = "shiden";
58997
+ })(MainProtocolSymbols = exports.MainProtocolSymbols || (exports.MainProtocolSymbols = {}));
58998
+ var SubProtocolSymbols;
58999
+ (function (SubProtocolSymbols) {
59000
+ SubProtocolSymbols["XTZ_KT"] = "xtz-kt";
59001
+ SubProtocolSymbols["XTZ_BTC"] = "xtz-btc";
59002
+ SubProtocolSymbols["XTZ_USD"] = "xtz-usd";
59003
+ SubProtocolSymbols["XTZ_KUSD"] = "xtz-kusd";
59004
+ SubProtocolSymbols["XTZ_STKR"] = "xtz-stkr";
59005
+ SubProtocolSymbols["XTZ_ETHTZ"] = "xtz-eth";
59006
+ SubProtocolSymbols["XTZ_UUSD"] = "xtz-uusd";
59007
+ SubProtocolSymbols["XTZ_YOU"] = "xtz-you";
59008
+ SubProtocolSymbols["XTZ_W"] = "xtz-w";
59009
+ SubProtocolSymbols["XTZ_UDEFI"] = "xtz-udefi";
59010
+ SubProtocolSymbols["XTZ_UBTC"] = "xtz-ubtc";
59011
+ SubProtocolSymbols["XTZ_CTEZ"] = "xtz-ctez";
59012
+ SubProtocolSymbols["XTZ_PLENTY"] = "xtz-plenty";
59013
+ SubProtocolSymbols["XTZ_WRAP"] = "xtz-wrap";
59014
+ SubProtocolSymbols["XTZ_QUIPU"] = "xtz-quipu";
59015
+ SubProtocolSymbols["XTZ_DOGA"] = "xtz-doga";
59016
+ SubProtocolSymbols["XTZ_BTC_TEZ"] = "xtz-btc-tez";
59017
+ SubProtocolSymbols["XTZ_USDT"] = "xtz-usdt";
59018
+ SubProtocolSymbols["XTZ_SIRS"] = "xtz-sirs";
59019
+ SubProtocolSymbols["ETH_ERC20"] = "eth-erc20";
59020
+ SubProtocolSymbols["ETH_ERC20_XCHF"] = "eth-erc20-xchf";
59021
+ })(SubProtocolSymbols = exports.SubProtocolSymbols || (exports.SubProtocolSymbols = {}));
59022
+ function isMainProtocolSymbol(identifier) {
59023
+ return Object.values(MainProtocolSymbols).includes(identifier);
59024
+ }
59025
+ exports.isMainProtocolSymbol = isMainProtocolSymbol;
59026
+ function isSubProtocolSymbol(identifier) {
59027
+ return Object.values(SubProtocolSymbols).includes(identifier);
59028
+ }
59029
+ exports.isSubProtocolSymbol = isSubProtocolSymbol;
59030
+ function isProtocolSymbol(identifier) {
59031
+ return isMainProtocolSymbol(identifier) || isSubProtocolSymbol(identifier);
59032
+ }
59033
+ exports.isProtocolSymbol = isProtocolSymbol;
59034
+
59035
+ },{}],308:[function(require,module,exports){
59036
+ (function (Buffer){(function (){
59037
+ "use strict";
59038
+ Object.defineProperty(exports, "__esModule", { value: true });
59039
+ var createHash = require("../dependencies/src/create-hash-1.2.0/index");
59040
+ var errors_1 = require("../errors");
59041
+ var coinlib_error_1 = require("../errors/coinlib-error");
59042
+ var sha256hash = function (input) {
59043
+ var hash = createHash('sha256');
59044
+ hash.update(input);
59045
+ return hash.digest();
59046
+ };
59047
+ var checkSum = function (payload) {
59048
+ return sha256hash(sha256hash(payload)).slice(0, 4);
59049
+ };
59050
+ var bs64check = {
59051
+ encode: function (input) {
59052
+ if (!Buffer.isBuffer(input)) {
59053
+ input = Buffer.from(input);
59054
+ }
59055
+ var checksum = checkSum(input);
59056
+ var payloadWithChecksum = Buffer.concat([input, checksum], input.length + 4);
59057
+ return payloadWithChecksum.toString('base64');
59058
+ },
59059
+ decode: function (input) {
59060
+ if (!Buffer.isBuffer(input)) {
59061
+ input = Buffer.from(input, 'base64');
59062
+ }
59063
+ var payload = input.slice(0, -4);
59064
+ var checksum = input.slice(-4);
59065
+ var newChecksum = checkSum(payload);
59066
+ // tslint:disable-next-line:no-bitwise
59067
+ if ((checksum[0] ^ newChecksum[0]) | (checksum[1] ^ newChecksum[1]) | (checksum[2] ^ newChecksum[2]) | (checksum[3] ^ newChecksum[3])) {
59068
+ throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.UTILS, 'bs64check checksum does not match');
59069
+ }
59070
+ return payload;
59071
+ },
59072
+ checkSum: checkSum
59073
+ };
59074
+ exports.default = bs64check;
59075
+
59076
+ }).call(this)}).call(this,require("buffer").Buffer)
59077
+ },{"../dependencies/src/create-hash-1.2.0/index":270,"../errors":301,"../errors/coinlib-error":300,"buffer":76}],309:[function(require,module,exports){
59078
+ (function (Buffer){(function (){
59079
+ "use strict";
60244
59080
  var __importDefault = (this && this.__importDefault) || function (mod) {
60245
59081
  return (mod && mod.__esModule) ? mod : { "default": mod };
60246
59082
  };
60247
59083
  Object.defineProperty(exports, "__esModule", { value: true });
60248
- exports.AirGapNFTWallet = void 0;
59084
+ exports.changeEndianness = exports.bytesToHex = exports.hexToBytes = exports.toHexString = exports.toHexStringRaw = exports.toHexBuffer = exports.isHex = exports.stripHexPrefix = exports.addHexPrefix = void 0;
60249
59085
  var bignumber_1 = __importDefault(require("../dependencies/src/bignumber.js-9.0.0/bignumber"));
60250
- var ProtocolNetwork_1 = require("../utils/ProtocolNetwork");
60251
- var AirGapMarketWallet_1 = require("./AirGapMarketWallet");
60252
- var AirGapNFTWallet = /** @class */ (function (_super) {
60253
- __extends(AirGapNFTWallet, _super);
60254
- function AirGapNFTWallet() {
60255
- var _this = _super !== null && _super.apply(this, arguments) || this;
60256
- _this.currentBalance = {};
60257
- _this.currentMarketPrice = {};
60258
- return _this;
59086
+ var padStart_1 = require("./padStart");
59087
+ var HEX_PREFIX = '0x';
59088
+ var HEX_REGEX = new RegExp("^(" + HEX_PREFIX + ")?[0-9a-fA-F]*$");
59089
+ function hasPrefix(value) {
59090
+ return value.startsWith(HEX_PREFIX);
59091
+ }
59092
+ function addHexPrefix(raw) {
59093
+ return hasPrefix(raw) ? raw : HEX_PREFIX + raw;
59094
+ }
59095
+ exports.addHexPrefix = addHexPrefix;
59096
+ function stripHexPrefix(hex) {
59097
+ return hasPrefix(hex) ? hex.substring(2) : hex;
59098
+ }
59099
+ exports.stripHexPrefix = stripHexPrefix;
59100
+ function isHex(value) {
59101
+ return HEX_REGEX.test(value);
59102
+ }
59103
+ exports.isHex = isHex;
59104
+ function toHexBuffer(value, bitLength, encoding) {
59105
+ if (bitLength === void 0) { bitLength = 8; }
59106
+ if (encoding === void 0) { encoding = 'default'; }
59107
+ return Buffer.from(toHexStringRaw(value, bitLength, encoding), 'hex');
59108
+ }
59109
+ exports.toHexBuffer = toHexBuffer;
59110
+ function toHexStringRaw(value, bitLength, encoding) {
59111
+ if (bitLength === void 0) { bitLength = 8; }
59112
+ if (encoding === void 0) { encoding = '2sComplement'; }
59113
+ if (new bignumber_1.default(value).isPositive()) {
59114
+ return toHexStringRawPositive(value, bitLength);
60259
59115
  }
60260
- AirGapNFTWallet.prototype.getCurrentBalance = function (assetID) {
60261
- return this.currentBalance[assetID];
60262
- };
60263
- AirGapNFTWallet.prototype.setCurrentBalance = function (balance, assetID) {
60264
- this.currentBalance[assetID] = balance;
60265
- };
60266
- AirGapNFTWallet.prototype.getCurrentMarketPrice = function (assetID) {
60267
- return this.currentMarketPrice[assetID];
60268
- };
60269
- AirGapNFTWallet.prototype.setCurrentMarketPrice = function (marketPrice, assetID) {
60270
- return __awaiter(this, void 0, void 0, function () {
60271
- var _a, _b;
60272
- return __generator(this, function (_c) {
60273
- switch (_c.label) {
60274
- case 0:
60275
- _a = this.getCurrentMarketPrice;
60276
- _b = assetID;
60277
- return [4 /*yield*/, this.protocol.getOptions()];
60278
- case 1:
60279
- _a[_b] =
60280
- (_c.sent()).network.type === ProtocolNetwork_1.NetworkType.MAINNET ? marketPrice : new bignumber_1.default(0);
60281
- return [2 /*return*/];
60282
- }
60283
- });
60284
- });
60285
- };
60286
- AirGapNFTWallet.prototype.synchronize = function (assetsID) {
60287
- if (assetsID === void 0) { assetsID = []; }
60288
- return __awaiter(this, void 0, void 0, function () {
60289
- return __generator(this, function (_a) {
60290
- return [2 /*return*/, _super.prototype.synchronize.call(this, assetsID)];
60291
- });
60292
- });
60293
- };
60294
- AirGapNFTWallet.prototype._synchronize = function (assetIDs) {
60295
- if (assetIDs === void 0) { assetIDs = []; }
60296
- return __awaiter(this, void 0, void 0, function () {
60297
- var _this = this;
60298
- return __generator(this, function (_a) {
60299
- switch (_a.label) {
60300
- case 0: return [4 /*yield*/, Promise.all(assetIDs.map(function (assetID) { return __awaiter(_this, void 0, void 0, function () {
60301
- var _a, balance, marketPrice;
60302
- return __generator(this, function (_b) {
60303
- switch (_b.label) {
60304
- case 0: return [4 /*yield*/, Promise.all([this.balanceOf(assetID), this.fetchCurrentMarketPrice(assetID)])];
60305
- case 1:
60306
- _a = _b.sent(), balance = _a[0], marketPrice = _a[1];
60307
- this.setCurrentBalance(balance, assetID);
60308
- return [4 /*yield*/, this.setCurrentMarketPrice(marketPrice, assetID)];
60309
- case 2:
60310
- _b.sent();
60311
- return [2 /*return*/];
60312
- }
60313
- });
60314
- }); }))];
60315
- case 1:
60316
- _a.sent();
60317
- return [2 /*return*/];
60318
- }
60319
- });
60320
- });
60321
- };
60322
- AirGapNFTWallet.prototype.reset = function () {
60323
- this.currentBalance = {};
60324
- this.currentMarketPrice = {};
60325
- };
60326
- AirGapNFTWallet.prototype.fetchCurrentMarketPrice = function (assetID, _baseSymbol) {
60327
- if (_baseSymbol === void 0) { _baseSymbol = 'USD'; }
60328
- return __awaiter(this, void 0, void 0, function () {
60329
- var result;
60330
- return __generator(this, function (_a) {
60331
- switch (_a.label) {
60332
- case 0:
60333
- result = new bignumber_1.default(0);
60334
- return [4 /*yield*/, this.setCurrentMarketPrice(result, assetID)];
60335
- case 1:
60336
- _a.sent();
60337
- return [2 /*return*/, result];
60338
- }
60339
- });
60340
- });
60341
- };
60342
- AirGapNFTWallet.prototype.balanceOf = function (assetID) {
60343
- return __awaiter(this, void 0, void 0, function () {
60344
- var result, _a, _b;
60345
- return __generator(this, function (_c) {
60346
- switch (_c.label) {
60347
- case 0:
60348
- if (!this.isExtendedPublicKey) return [3 /*break*/, 2];
60349
- _a = bignumber_1.default.bind;
60350
- return [4 /*yield*/, this.protocol.getBalanceOfExtendedPublicKey(this.publicKey, 0, { assetID: assetID })];
60351
- case 1:
60352
- result = new (_a.apply(bignumber_1.default, [void 0, _c.sent()]))();
60353
- return [3 /*break*/, 4];
60354
- case 2:
60355
- _b = bignumber_1.default.bind;
60356
- return [4 /*yield*/, this.protocol.getBalanceOfPublicKey(this.publicKey, { addressIndex: this.addressIndex, assetID: assetID })];
60357
- case 3:
60358
- result = new (_b.apply(bignumber_1.default, [void 0, _c.sent()]))();
60359
- _c.label = 4;
60360
- case 4:
60361
- this.setCurrentBalance(result, assetID);
60362
- return [2 /*return*/, result];
60363
- }
60364
- });
60365
- });
60366
- };
60367
- return AirGapNFTWallet;
60368
- }(AirGapMarketWallet_1.AirGapMarketWallet));
60369
- exports.AirGapNFTWallet = AirGapNFTWallet;
59116
+ else {
59117
+ return toHexStringRawNegative(value, bitLength, encoding);
59118
+ }
59119
+ }
59120
+ exports.toHexStringRaw = toHexStringRaw;
59121
+ function toHexString(value, bitLength, encoding) {
59122
+ if (bitLength === void 0) { bitLength = 8; }
59123
+ if (encoding === void 0) { encoding = 'default'; }
59124
+ return addHexPrefix(toHexStringRaw(value, bitLength, encoding));
59125
+ }
59126
+ exports.toHexString = toHexString;
59127
+ function hexToBytes(hex, bitLength) {
59128
+ var byteLength = bitLength !== undefined ? Math.ceil(bitLength / 8) : undefined;
59129
+ var buffer;
59130
+ if (typeof hex === 'string' && isHex(hex)) {
59131
+ buffer = Buffer.from(stripHexPrefix(hex), 'hex');
59132
+ }
59133
+ else if (!(typeof hex === 'string')) {
59134
+ buffer = Buffer.from(hex);
59135
+ }
59136
+ else {
59137
+ buffer = Buffer.from([0]);
59138
+ }
59139
+ if (byteLength !== undefined && buffer.length < byteLength) {
59140
+ var newBuffer = Buffer.alloc(byteLength, 0);
59141
+ var offset = newBuffer.length - buffer.length;
59142
+ buffer.copy(newBuffer, offset);
59143
+ return newBuffer;
59144
+ }
59145
+ else {
59146
+ return buffer;
59147
+ }
59148
+ }
59149
+ exports.hexToBytes = hexToBytes;
59150
+ function bytesToHex(bytes, config) {
59151
+ var hex;
59152
+ if (typeof bytes === 'string') {
59153
+ hex = bytes;
59154
+ }
59155
+ else {
59156
+ var buffer = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes);
59157
+ hex = buffer.toString('hex');
59158
+ }
59159
+ return (config === null || config === void 0 ? void 0 : config.withPrefix) ? addHexPrefix(hex) : hex;
59160
+ }
59161
+ exports.bytesToHex = bytesToHex;
59162
+ function changeEndianness(hex) {
59163
+ var _hex = stripHexPrefix(hex);
59164
+ _hex = _hex.length % 2 !== 0 ? '0' + _hex : _hex;
59165
+ var bytes = _hex.match(/.{2}/g) || [];
59166
+ return bytes.reverse().join('');
59167
+ }
59168
+ exports.changeEndianness = changeEndianness;
59169
+ function toHexStringRawPositive(value, bitLength) {
59170
+ var hexString = value.toString(16);
59171
+ return fillToTargetLength(hexString, bitLength);
59172
+ }
59173
+ function toHexStringRawNegative(value, bitLength, encoding) {
59174
+ // tslint:disable-next-line: switch-default
59175
+ switch (encoding) {
59176
+ case 'default':
59177
+ var hexString = value.toString(16);
59178
+ return hexString.startsWith('-') ? "-" + fillToTargetLength(hexString.substr(1), bitLength) : fillToTargetLength(hexString, bitLength);
59179
+ case '2sComplement':
59180
+ var value2sComplement = new bignumber_1.default(2).pow(bitLength).minus(new bignumber_1.default(value).abs());
59181
+ return value2sComplement.toString(16);
59182
+ }
59183
+ }
59184
+ function fillToTargetLength(hexString, bitLength) {
59185
+ var nibbleLength = Math.ceil(bitLength / 4);
59186
+ var targetLength = hexString.length >= nibbleLength ? hexString.length : nibbleLength;
59187
+ targetLength = targetLength % 2 === 0 ? targetLength : targetLength + 1;
59188
+ return padStart_1.padStart(hexString, targetLength, '0');
59189
+ }
60370
59190
 
60371
- },{"../dependencies/src/bignumber.js-9.0.0/bignumber":260,"../utils/ProtocolNetwork":316,"./AirGapMarketWallet":324}],326:[function(require,module,exports){
59191
+ }).call(this)}).call(this,require("buffer").Buffer)
59192
+ },{"../dependencies/src/bignumber.js-9.0.0/bignumber":254,"./padStart":310,"buffer":76}],310:[function(require,module,exports){
60372
59193
  "use strict";
60373
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
60374
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
60375
- return new (P || (P = Promise))(function (resolve, reject) {
60376
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
60377
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
60378
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
60379
- step((generator = generator.apply(thisArg, _arguments || [])).next());
60380
- });
60381
- };
60382
- var __generator = (this && this.__generator) || function (thisArg, body) {
60383
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
60384
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
60385
- function verb(n) { return function (v) { return step([n, v]); }; }
60386
- function step(op) {
60387
- if (f) throw new TypeError("Generator is already executing.");
60388
- while (_) try {
60389
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60390
- if (y = 0, t) op = [op[0] & 2, t.value];
60391
- switch (op[0]) {
60392
- case 0: case 1: t = op; break;
60393
- case 4: _.label++; return { value: op[1], done: false };
60394
- case 5: _.label++; y = op[1]; op = [0]; continue;
60395
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
60396
- default:
60397
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
60398
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
60399
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
60400
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
60401
- if (t[2]) _.ops.pop();
60402
- _.trys.pop(); continue;
60403
- }
60404
- op = body.call(thisArg, _);
60405
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
60406
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
60407
- }
60408
- };
60409
59194
  Object.defineProperty(exports, "__esModule", { value: true });
60410
- exports.AirGapWallet = exports.AirGapWalletStatus = void 0;
60411
- var errors_1 = require("../errors");
60412
- var coinlib_error_1 = require("../errors/coinlib-error");
60413
- var AirGapWalletStatus;
60414
- (function (AirGapWalletStatus) {
60415
- AirGapWalletStatus["ACTIVE"] = "active";
60416
- AirGapWalletStatus["HIDDEN"] = "hidden";
60417
- AirGapWalletStatus["DELETED"] = "deleted";
60418
- AirGapWalletStatus["TRANSIENT"] = "transient";
60419
- })(AirGapWalletStatus = exports.AirGapWalletStatus || (exports.AirGapWalletStatus = {}));
60420
- var AirGapWallet = /** @class */ (function () {
60421
- function AirGapWallet(protocol, publicKey, isExtendedPublicKey, derivationPath, masterFingerprint, status, addressIndex) {
60422
- this.protocol = protocol;
60423
- this.publicKey = publicKey;
60424
- this.isExtendedPublicKey = isExtendedPublicKey;
60425
- this.derivationPath = derivationPath;
60426
- this.masterFingerprint = masterFingerprint;
60427
- this.status = status;
60428
- this.addressIndex = addressIndex;
60429
- this.addresses = []; // used for cache
60430
- }
60431
- Object.defineProperty(AirGapWallet.prototype, "receivingPublicAddress", {
60432
- get: function () {
60433
- return this.addresses[this.addressIndex !== undefined ? this.addressIndex : 0];
60434
- },
60435
- enumerable: false,
60436
- configurable: true
60437
- });
60438
- AirGapWallet.prototype.setProtocol = function (protocol) {
60439
- return __awaiter(this, void 0, void 0, function () {
60440
- var _a;
60441
- return __generator(this, function (_b) {
60442
- switch (_b.label) {
60443
- case 0: return [4 /*yield*/, this.protocol.getIdentifier()];
60444
- case 1:
60445
- _a = (_b.sent());
60446
- return [4 /*yield*/, protocol.getIdentifier()];
60447
- case 2:
60448
- if (_a !== (_b.sent())) {
60449
- throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.WALLET, 'Can only set same protocol with a different network');
60450
- }
60451
- this.protocol = protocol;
60452
- return [2 /*return*/];
60453
- }
60454
- });
60455
- });
60456
- };
60457
- AirGapWallet.prototype.deriveAddresses = function (amount) {
60458
- if (amount === void 0) { amount = 50; }
60459
- return __awaiter(this, void 0, void 0, function () {
60460
- var addresses, parts, offset;
60461
- return __generator(this, function (_a) {
60462
- switch (_a.label) {
60463
- case 0:
60464
- if (!this.isExtendedPublicKey) return [3 /*break*/, 2];
60465
- parts = this.derivationPath.split('/');
60466
- offset = 0;
60467
- if (!parts[parts.length - 1].endsWith("'")) {
60468
- offset = Number.parseInt(parts[parts.length - 1], 10);
60469
- }
60470
- return [4 /*yield*/, Promise.all([
60471
- this.protocol.getAddressesFromExtendedPublicKey(this.publicKey, 0, amount, offset),
60472
- this.protocol.getAddressesFromExtendedPublicKey(this.publicKey, 1, amount, offset)
60473
- ])];
60474
- case 1:
60475
- addresses = (_a.sent()).reduce(function (flatten, next) { return flatten.concat(next); }, []);
60476
- return [3 /*break*/, 4];
60477
- case 2: return [4 /*yield*/, this.protocol.getAddressesFromPublicKey(this.publicKey)];
60478
- case 3:
60479
- addresses = _a.sent();
60480
- _a.label = 4;
60481
- case 4: return [2 /*return*/, addresses.map(function (address) { return address.address; })];
60482
- }
60483
- });
60484
- });
60485
- };
60486
- AirGapWallet.prototype.toJSON = function () {
60487
- return __awaiter(this, void 0, void 0, function () {
60488
- var _a;
60489
- return __generator(this, function (_b) {
60490
- switch (_b.label) {
60491
- case 0:
60492
- _a = {};
60493
- return [4 /*yield*/, this.protocol.getIdentifier()];
60494
- case 1:
60495
- _a.protocolIdentifier = _b.sent();
60496
- return [4 /*yield*/, this.protocol.getOptions()];
60497
- case 2: return [2 /*return*/, (_a.networkIdentifier = (_b.sent()).network.identifier,
60498
- _a.publicKey = this.publicKey,
60499
- _a.isExtendedPublicKey = this.isExtendedPublicKey,
60500
- _a.derivationPath = this.derivationPath,
60501
- _a.addresses = this.addresses,
60502
- _a.masterFingerprint = this.masterFingerprint,
60503
- _a.status = this.status,
60504
- _a.addressIndex = this.addressIndex,
60505
- _a)];
60506
- }
60507
- });
60508
- });
60509
- };
60510
- return AirGapWallet;
60511
- }());
60512
- exports.AirGapWallet = AirGapWallet;
59195
+ exports.padStart = void 0;
59196
+ function padStart(targetString, targetLength, padString) {
59197
+ // truncate if number, or convert non-number to 0
59198
+ targetLength = targetLength >> 0;
59199
+ if (targetString.length >= targetLength) {
59200
+ return targetString;
59201
+ }
59202
+ else {
59203
+ targetLength = targetLength - targetString.length;
59204
+ if (targetLength > padString.length) {
59205
+ // append to original to ensure we are longer than needed
59206
+ padString += padString.repeat(targetLength / padString.length);
59207
+ }
59208
+ return padString.slice(0, targetLength) + targetString;
59209
+ }
59210
+ }
59211
+ exports.padStart = padStart;
60513
59212
 
60514
- },{"../errors":307,"../errors/coinlib-error":306}],327:[function(require,module,exports){
59213
+ },{}],311:[function(require,module,exports){
60515
59214
  arguments[4][1][0].apply(exports,arguments)
60516
- },{"@stablelib/int":332,"dup":1}],328:[function(require,module,exports){
59215
+ },{"@stablelib/int":316,"dup":1}],312:[function(require,module,exports){
60517
59216
  "use strict";
60518
59217
  // Copyright (C) 2017 Dmitry Chestnykh
60519
59218
  // MIT License. See LICENSE file for details.
@@ -60968,7 +59667,7 @@ function hash(data, digestLength, config) {
60968
59667
  }
60969
59668
  exports.hash = hash;
60970
59669
 
60971
- },{"@stablelib/binary":327,"@stablelib/wipe":344}],329:[function(require,module,exports){
59670
+ },{"@stablelib/binary":311,"@stablelib/wipe":328}],313:[function(require,module,exports){
60972
59671
  "use strict";
60973
59672
  // Copyright (C) 2016 Dmitry Chestnykh
60974
59673
  // MIT License. See LICENSE file for details.
@@ -60992,7 +59691,7 @@ function concat() {
60992
59691
  }
60993
59692
  exports.concat = concat;
60994
59693
 
60995
- },{}],330:[function(require,module,exports){
59694
+ },{}],314:[function(require,module,exports){
60996
59695
  "use strict";
60997
59696
  // Copyright (C) 2016 Dmitry Chestnykh
60998
59697
  // MIT License. See LICENSE file for details.
@@ -61055,11 +59754,11 @@ function equal(a, b) {
61055
59754
  }
61056
59755
  exports.equal = equal;
61057
59756
 
61058
- },{}],331:[function(require,module,exports){
59757
+ },{}],315:[function(require,module,exports){
61059
59758
  arguments[4][2][0].apply(exports,arguments)
61060
- },{"@stablelib/random":337,"@stablelib/sha512":342,"@stablelib/wipe":344,"dup":2}],332:[function(require,module,exports){
59759
+ },{"@stablelib/random":321,"@stablelib/sha512":326,"@stablelib/wipe":328,"dup":2}],316:[function(require,module,exports){
61061
59760
  arguments[4][3][0].apply(exports,arguments)
61062
- },{"dup":3}],333:[function(require,module,exports){
59761
+ },{"dup":3}],317:[function(require,module,exports){
61063
59762
  "use strict";
61064
59763
  // Copyright (C) 2016 Dmitry Chestnykh
61065
59764
  // MIT License. See LICENSE file for details.
@@ -61095,7 +59794,7 @@ function openBox(theirPublicKey, mySecretKey, nonce, data) {
61095
59794
  }
61096
59795
  exports.openBox = openBox;
61097
59796
 
61098
- },{"./secretbox":335,"@stablelib/wipe":344,"@stablelib/x25519":345,"@stablelib/xsalsa20":346}],334:[function(require,module,exports){
59797
+ },{"./secretbox":319,"@stablelib/wipe":328,"@stablelib/x25519":329,"@stablelib/xsalsa20":330}],318:[function(require,module,exports){
61099
59798
  "use strict";
61100
59799
  // Copyright (C) 2016 Dmitry Chestnykh
61101
59800
  // MIT License. See LICENSE file for details.
@@ -61120,7 +59819,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
61120
59819
  __exportStar(require("./box"), exports);
61121
59820
  __exportStar(require("./secretbox"), exports);
61122
59821
 
61123
- },{"./box":333,"./secretbox":335}],335:[function(require,module,exports){
59822
+ },{"./box":317,"./secretbox":319}],319:[function(require,module,exports){
61124
59823
  "use strict";
61125
59824
  // Copyright (C) 2016 Dmitry Chestnykh
61126
59825
  // MIT License. See LICENSE file for details.
@@ -61222,7 +59921,7 @@ function generateKey(prng) {
61222
59921
  }
61223
59922
  exports.generateKey = generateKey;
61224
59923
 
61225
- },{"@stablelib/poly1305":336,"@stablelib/random":337,"@stablelib/wipe":344,"@stablelib/xsalsa20":346}],336:[function(require,module,exports){
59924
+ },{"@stablelib/poly1305":320,"@stablelib/random":321,"@stablelib/wipe":328,"@stablelib/xsalsa20":330}],320:[function(require,module,exports){
61226
59925
  "use strict";
61227
59926
  // Copyright (C) 2016 Dmitry Chestnykh
61228
59927
  // MIT License. See LICENSE file for details.
@@ -61645,15 +60344,15 @@ function equal(a, b) {
61645
60344
  }
61646
60345
  exports.equal = equal;
61647
60346
 
61648
- },{"@stablelib/constant-time":330,"@stablelib/wipe":344}],337:[function(require,module,exports){
60347
+ },{"@stablelib/constant-time":314,"@stablelib/wipe":328}],321:[function(require,module,exports){
61649
60348
  arguments[4][4][0].apply(exports,arguments)
61650
- },{"./source/system":340,"@stablelib/binary":327,"@stablelib/wipe":344,"dup":4}],338:[function(require,module,exports){
60349
+ },{"./source/system":324,"@stablelib/binary":311,"@stablelib/wipe":328,"dup":4}],322:[function(require,module,exports){
61651
60350
  arguments[4][5][0].apply(exports,arguments)
61652
- },{"dup":5}],339:[function(require,module,exports){
60351
+ },{"dup":5}],323:[function(require,module,exports){
61653
60352
  arguments[4][6][0].apply(exports,arguments)
61654
- },{"@stablelib/wipe":344,"crypto":33,"dup":6}],340:[function(require,module,exports){
60353
+ },{"@stablelib/wipe":328,"crypto":33,"dup":6}],324:[function(require,module,exports){
61655
60354
  arguments[4][7][0].apply(exports,arguments)
61656
- },{"./browser":338,"./node":339,"dup":7}],341:[function(require,module,exports){
60355
+ },{"./browser":322,"./node":323,"dup":7}],325:[function(require,module,exports){
61657
60356
  "use strict";
61658
60357
  // Copyright (C) 2016 Dmitry Chestnykh
61659
60358
  // MIT License. See LICENSE file for details.
@@ -61880,9 +60579,9 @@ function incrementCounter(counter, pos, len) {
61880
60579
  }
61881
60580
  }
61882
60581
 
61883
- },{"@stablelib/binary":327,"@stablelib/wipe":344}],342:[function(require,module,exports){
60582
+ },{"@stablelib/binary":311,"@stablelib/wipe":328}],326:[function(require,module,exports){
61884
60583
  arguments[4][8][0].apply(exports,arguments)
61885
- },{"@stablelib/binary":327,"@stablelib/wipe":344,"dup":8}],343:[function(require,module,exports){
60584
+ },{"@stablelib/binary":311,"@stablelib/wipe":328,"dup":8}],327:[function(require,module,exports){
61886
60585
  "use strict";
61887
60586
  // Copyright (C) 2016 Dmitry Chestnykh
61888
60587
  // MIT License. See LICENSE file for details.
@@ -62032,9 +60731,9 @@ function decode(arr) {
62032
60731
  }
62033
60732
  exports.decode = decode;
62034
60733
 
62035
- },{}],344:[function(require,module,exports){
60734
+ },{}],328:[function(require,module,exports){
62036
60735
  arguments[4][9][0].apply(exports,arguments)
62037
- },{"dup":9}],345:[function(require,module,exports){
60736
+ },{"dup":9}],329:[function(require,module,exports){
62038
60737
  "use strict";
62039
60738
  // Copyright (C) 2016 Dmitry Chestnykh
62040
60739
  // MIT License. See LICENSE file for details.
@@ -62671,7 +61370,7 @@ function sharedKey(mySecretKey, theirPublicKey, rejectZero = false) {
62671
61370
  }
62672
61371
  exports.sharedKey = sharedKey;
62673
61372
 
62674
- },{"@stablelib/random":337,"@stablelib/wipe":344}],346:[function(require,module,exports){
61373
+ },{"@stablelib/random":321,"@stablelib/wipe":328}],330:[function(require,module,exports){
62675
61374
  "use strict";
62676
61375
  // Copyright (C) 2016 Dmitry Chestnykh
62677
61376
  // MIT License. See LICENSE file for details.
@@ -62834,5 +61533,5 @@ function hsalsa(key, src, dst) {
62834
61533
  }
62835
61534
  exports.hsalsa = hsalsa;
62836
61535
 
62837
- },{"@stablelib/binary":327,"@stablelib/salsa20":341,"@stablelib/wipe":344}]},{},[223])(223)
61536
+ },{"@stablelib/binary":311,"@stablelib/salsa20":325,"@stablelib/wipe":328}]},{},[223])(223)
62838
61537
  });