@stellar/typescript-wallet-sdk 1.0.0-alpha.2 → 1.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundle.js +1468 -98
- package/lib/bundle.js.map +1 -1
- package/lib/walletSdk/Watcher/Types.d.ts +65 -0
- package/lib/walletSdk/Watcher/index.d.ts +54 -0
- package/lib/walletSdk/anchor/index.d.ts +77 -7
- package/lib/walletSdk/auth/WalletSigner.d.ts +3 -0
- package/lib/walletSdk/auth/index.d.ts +8 -5
- package/lib/walletSdk/exception/index.d.ts +9 -0
- package/lib/walletSdk/index.d.ts +12 -13
- package/lib/walletSdk/interactive/index.d.ts +16 -5
- package/lib/walletSdk/util/camelToSnakeCase.d.ts +2 -0
- package/package.json +12 -7
- package/src/walletSdk/Anchor/index.ts +214 -22
- package/src/walletSdk/Auth/WalletSigner.ts +18 -3
- package/src/walletSdk/Auth/index.ts +41 -15
- package/src/walletSdk/Watcher/Types.ts +81 -0
- package/src/walletSdk/Watcher/index.ts +355 -0
- package/src/walletSdk/exception/index.ts +23 -2
- package/src/walletSdk/index.ts +41 -28
- package/src/walletSdk/interactive/index.ts +32 -43
- package/src/walletSdk/util/camelToSnakeCase.ts +13 -0
- package/test/fixtures/TransactionsResponse.ts +230 -0
- package/test/index.test.ts +1668 -19
package/lib/bundle.js
CHANGED
|
@@ -6129,6 +6129,111 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6129
6129
|
});
|
|
6130
6130
|
|
|
6131
6131
|
|
|
6132
|
+
/***/ }),
|
|
6133
|
+
|
|
6134
|
+
/***/ "./node_modules/decode-uri-component/index.js":
|
|
6135
|
+
/*!****************************************************!*\
|
|
6136
|
+
!*** ./node_modules/decode-uri-component/index.js ***!
|
|
6137
|
+
\****************************************************/
|
|
6138
|
+
/***/ ((module) => {
|
|
6139
|
+
|
|
6140
|
+
"use strict";
|
|
6141
|
+
|
|
6142
|
+
var token = '%[a-f0-9]{2}';
|
|
6143
|
+
var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi');
|
|
6144
|
+
var multiMatcher = new RegExp('(' + token + ')+', 'gi');
|
|
6145
|
+
|
|
6146
|
+
function decodeComponents(components, split) {
|
|
6147
|
+
try {
|
|
6148
|
+
// Try to decode the entire string first
|
|
6149
|
+
return [decodeURIComponent(components.join(''))];
|
|
6150
|
+
} catch (err) {
|
|
6151
|
+
// Do nothing
|
|
6152
|
+
}
|
|
6153
|
+
|
|
6154
|
+
if (components.length === 1) {
|
|
6155
|
+
return components;
|
|
6156
|
+
}
|
|
6157
|
+
|
|
6158
|
+
split = split || 1;
|
|
6159
|
+
|
|
6160
|
+
// Split the array in 2 parts
|
|
6161
|
+
var left = components.slice(0, split);
|
|
6162
|
+
var right = components.slice(split);
|
|
6163
|
+
|
|
6164
|
+
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
|
|
6165
|
+
}
|
|
6166
|
+
|
|
6167
|
+
function decode(input) {
|
|
6168
|
+
try {
|
|
6169
|
+
return decodeURIComponent(input);
|
|
6170
|
+
} catch (err) {
|
|
6171
|
+
var tokens = input.match(singleMatcher) || [];
|
|
6172
|
+
|
|
6173
|
+
for (var i = 1; i < tokens.length; i++) {
|
|
6174
|
+
input = decodeComponents(tokens, i).join('');
|
|
6175
|
+
|
|
6176
|
+
tokens = input.match(singleMatcher) || [];
|
|
6177
|
+
}
|
|
6178
|
+
|
|
6179
|
+
return input;
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
|
|
6183
|
+
function customDecodeURIComponent(input) {
|
|
6184
|
+
// Keep track of all the replacements and prefill the map with the `BOM`
|
|
6185
|
+
var replaceMap = {
|
|
6186
|
+
'%FE%FF': '\uFFFD\uFFFD',
|
|
6187
|
+
'%FF%FE': '\uFFFD\uFFFD'
|
|
6188
|
+
};
|
|
6189
|
+
|
|
6190
|
+
var match = multiMatcher.exec(input);
|
|
6191
|
+
while (match) {
|
|
6192
|
+
try {
|
|
6193
|
+
// Decode as big chunks as possible
|
|
6194
|
+
replaceMap[match[0]] = decodeURIComponent(match[0]);
|
|
6195
|
+
} catch (err) {
|
|
6196
|
+
var result = decode(match[0]);
|
|
6197
|
+
|
|
6198
|
+
if (result !== match[0]) {
|
|
6199
|
+
replaceMap[match[0]] = result;
|
|
6200
|
+
}
|
|
6201
|
+
}
|
|
6202
|
+
|
|
6203
|
+
match = multiMatcher.exec(input);
|
|
6204
|
+
}
|
|
6205
|
+
|
|
6206
|
+
// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
|
|
6207
|
+
replaceMap['%C2'] = '\uFFFD';
|
|
6208
|
+
|
|
6209
|
+
var entries = Object.keys(replaceMap);
|
|
6210
|
+
|
|
6211
|
+
for (var i = 0; i < entries.length; i++) {
|
|
6212
|
+
// Replace all decoded components
|
|
6213
|
+
var key = entries[i];
|
|
6214
|
+
input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
|
|
6215
|
+
}
|
|
6216
|
+
|
|
6217
|
+
return input;
|
|
6218
|
+
}
|
|
6219
|
+
|
|
6220
|
+
module.exports = function (encodedURI) {
|
|
6221
|
+
if (typeof encodedURI !== 'string') {
|
|
6222
|
+
throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
|
|
6223
|
+
}
|
|
6224
|
+
|
|
6225
|
+
try {
|
|
6226
|
+
encodedURI = encodedURI.replace(/\+/g, ' ');
|
|
6227
|
+
|
|
6228
|
+
// Try the built in decoder first
|
|
6229
|
+
return decodeURIComponent(encodedURI);
|
|
6230
|
+
} catch (err) {
|
|
6231
|
+
// Fallback to a more advanced decoder
|
|
6232
|
+
return customDecodeURIComponent(encodedURI);
|
|
6233
|
+
}
|
|
6234
|
+
};
|
|
6235
|
+
|
|
6236
|
+
|
|
6132
6237
|
/***/ }),
|
|
6133
6238
|
|
|
6134
6239
|
/***/ "./node_modules/detect-node/browser.js":
|
|
@@ -8327,6 +8432,34 @@ function getOrigin (url) {
|
|
|
8327
8432
|
}
|
|
8328
8433
|
|
|
8329
8434
|
|
|
8435
|
+
/***/ }),
|
|
8436
|
+
|
|
8437
|
+
/***/ "./node_modules/filter-obj/index.js":
|
|
8438
|
+
/*!******************************************!*\
|
|
8439
|
+
!*** ./node_modules/filter-obj/index.js ***!
|
|
8440
|
+
\******************************************/
|
|
8441
|
+
/***/ ((module) => {
|
|
8442
|
+
|
|
8443
|
+
"use strict";
|
|
8444
|
+
|
|
8445
|
+
module.exports = function (obj, predicate) {
|
|
8446
|
+
var ret = {};
|
|
8447
|
+
var keys = Object.keys(obj);
|
|
8448
|
+
var isArr = Array.isArray(predicate);
|
|
8449
|
+
|
|
8450
|
+
for (var i = 0; i < keys.length; i++) {
|
|
8451
|
+
var key = keys[i];
|
|
8452
|
+
var val = obj[key];
|
|
8453
|
+
|
|
8454
|
+
if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) {
|
|
8455
|
+
ret[key] = val;
|
|
8456
|
+
}
|
|
8457
|
+
}
|
|
8458
|
+
|
|
8459
|
+
return ret;
|
|
8460
|
+
};
|
|
8461
|
+
|
|
8462
|
+
|
|
8330
8463
|
/***/ }),
|
|
8331
8464
|
|
|
8332
8465
|
/***/ "./node_modules/for-each/index.js":
|
|
@@ -18714,6 +18847,51 @@ function isEmpty(value) {
|
|
|
18714
18847
|
module.exports = isEmpty;
|
|
18715
18848
|
|
|
18716
18849
|
|
|
18850
|
+
/***/ }),
|
|
18851
|
+
|
|
18852
|
+
/***/ "./node_modules/lodash/isEqual.js":
|
|
18853
|
+
/*!****************************************!*\
|
|
18854
|
+
!*** ./node_modules/lodash/isEqual.js ***!
|
|
18855
|
+
\****************************************/
|
|
18856
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
18857
|
+
|
|
18858
|
+
var baseIsEqual = __webpack_require__(/*! ./_baseIsEqual */ "./node_modules/lodash/_baseIsEqual.js");
|
|
18859
|
+
|
|
18860
|
+
/**
|
|
18861
|
+
* Performs a deep comparison between two values to determine if they are
|
|
18862
|
+
* equivalent.
|
|
18863
|
+
*
|
|
18864
|
+
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
18865
|
+
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
18866
|
+
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
18867
|
+
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
18868
|
+
* nodes are compared by strict equality, i.e. `===`.
|
|
18869
|
+
*
|
|
18870
|
+
* @static
|
|
18871
|
+
* @memberOf _
|
|
18872
|
+
* @since 0.1.0
|
|
18873
|
+
* @category Lang
|
|
18874
|
+
* @param {*} value The value to compare.
|
|
18875
|
+
* @param {*} other The other value to compare.
|
|
18876
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
18877
|
+
* @example
|
|
18878
|
+
*
|
|
18879
|
+
* var object = { 'a': 1 };
|
|
18880
|
+
* var other = { 'a': 1 };
|
|
18881
|
+
*
|
|
18882
|
+
* _.isEqual(object, other);
|
|
18883
|
+
* // => true
|
|
18884
|
+
*
|
|
18885
|
+
* object === other;
|
|
18886
|
+
* // => false
|
|
18887
|
+
*/
|
|
18888
|
+
function isEqual(value, other) {
|
|
18889
|
+
return baseIsEqual(value, other);
|
|
18890
|
+
}
|
|
18891
|
+
|
|
18892
|
+
module.exports = isEqual;
|
|
18893
|
+
|
|
18894
|
+
|
|
18717
18895
|
/***/ }),
|
|
18718
18896
|
|
|
18719
18897
|
/***/ "./node_modules/lodash/isFinite.js":
|
|
@@ -21769,6 +21947,499 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.3.2 by @mathia
|
|
|
21769
21947
|
}(this));
|
|
21770
21948
|
|
|
21771
21949
|
|
|
21950
|
+
/***/ }),
|
|
21951
|
+
|
|
21952
|
+
/***/ "./node_modules/query-string/index.js":
|
|
21953
|
+
/*!********************************************!*\
|
|
21954
|
+
!*** ./node_modules/query-string/index.js ***!
|
|
21955
|
+
\********************************************/
|
|
21956
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
21957
|
+
|
|
21958
|
+
"use strict";
|
|
21959
|
+
|
|
21960
|
+
const strictUriEncode = __webpack_require__(/*! strict-uri-encode */ "./node_modules/strict-uri-encode/index.js");
|
|
21961
|
+
const decodeComponent = __webpack_require__(/*! decode-uri-component */ "./node_modules/decode-uri-component/index.js");
|
|
21962
|
+
const splitOnFirst = __webpack_require__(/*! split-on-first */ "./node_modules/split-on-first/index.js");
|
|
21963
|
+
const filterObject = __webpack_require__(/*! filter-obj */ "./node_modules/filter-obj/index.js");
|
|
21964
|
+
|
|
21965
|
+
const isNullOrUndefined = value => value === null || value === undefined;
|
|
21966
|
+
|
|
21967
|
+
const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');
|
|
21968
|
+
|
|
21969
|
+
function encoderForArrayFormat(options) {
|
|
21970
|
+
switch (options.arrayFormat) {
|
|
21971
|
+
case 'index':
|
|
21972
|
+
return key => (result, value) => {
|
|
21973
|
+
const index = result.length;
|
|
21974
|
+
|
|
21975
|
+
if (
|
|
21976
|
+
value === undefined ||
|
|
21977
|
+
(options.skipNull && value === null) ||
|
|
21978
|
+
(options.skipEmptyString && value === '')
|
|
21979
|
+
) {
|
|
21980
|
+
return result;
|
|
21981
|
+
}
|
|
21982
|
+
|
|
21983
|
+
if (value === null) {
|
|
21984
|
+
return [...result, [encode(key, options), '[', index, ']'].join('')];
|
|
21985
|
+
}
|
|
21986
|
+
|
|
21987
|
+
return [
|
|
21988
|
+
...result,
|
|
21989
|
+
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
|
|
21990
|
+
];
|
|
21991
|
+
};
|
|
21992
|
+
|
|
21993
|
+
case 'bracket':
|
|
21994
|
+
return key => (result, value) => {
|
|
21995
|
+
if (
|
|
21996
|
+
value === undefined ||
|
|
21997
|
+
(options.skipNull && value === null) ||
|
|
21998
|
+
(options.skipEmptyString && value === '')
|
|
21999
|
+
) {
|
|
22000
|
+
return result;
|
|
22001
|
+
}
|
|
22002
|
+
|
|
22003
|
+
if (value === null) {
|
|
22004
|
+
return [...result, [encode(key, options), '[]'].join('')];
|
|
22005
|
+
}
|
|
22006
|
+
|
|
22007
|
+
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
|
|
22008
|
+
};
|
|
22009
|
+
|
|
22010
|
+
case 'colon-list-separator':
|
|
22011
|
+
return key => (result, value) => {
|
|
22012
|
+
if (
|
|
22013
|
+
value === undefined ||
|
|
22014
|
+
(options.skipNull && value === null) ||
|
|
22015
|
+
(options.skipEmptyString && value === '')
|
|
22016
|
+
) {
|
|
22017
|
+
return result;
|
|
22018
|
+
}
|
|
22019
|
+
|
|
22020
|
+
if (value === null) {
|
|
22021
|
+
return [...result, [encode(key, options), ':list='].join('')];
|
|
22022
|
+
}
|
|
22023
|
+
|
|
22024
|
+
return [...result, [encode(key, options), ':list=', encode(value, options)].join('')];
|
|
22025
|
+
};
|
|
22026
|
+
|
|
22027
|
+
case 'comma':
|
|
22028
|
+
case 'separator':
|
|
22029
|
+
case 'bracket-separator': {
|
|
22030
|
+
const keyValueSep = options.arrayFormat === 'bracket-separator' ?
|
|
22031
|
+
'[]=' :
|
|
22032
|
+
'=';
|
|
22033
|
+
|
|
22034
|
+
return key => (result, value) => {
|
|
22035
|
+
if (
|
|
22036
|
+
value === undefined ||
|
|
22037
|
+
(options.skipNull && value === null) ||
|
|
22038
|
+
(options.skipEmptyString && value === '')
|
|
22039
|
+
) {
|
|
22040
|
+
return result;
|
|
22041
|
+
}
|
|
22042
|
+
|
|
22043
|
+
// Translate null to an empty string so that it doesn't serialize as 'null'
|
|
22044
|
+
value = value === null ? '' : value;
|
|
22045
|
+
|
|
22046
|
+
if (result.length === 0) {
|
|
22047
|
+
return [[encode(key, options), keyValueSep, encode(value, options)].join('')];
|
|
22048
|
+
}
|
|
22049
|
+
|
|
22050
|
+
return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
|
|
22051
|
+
};
|
|
22052
|
+
}
|
|
22053
|
+
|
|
22054
|
+
default:
|
|
22055
|
+
return key => (result, value) => {
|
|
22056
|
+
if (
|
|
22057
|
+
value === undefined ||
|
|
22058
|
+
(options.skipNull && value === null) ||
|
|
22059
|
+
(options.skipEmptyString && value === '')
|
|
22060
|
+
) {
|
|
22061
|
+
return result;
|
|
22062
|
+
}
|
|
22063
|
+
|
|
22064
|
+
if (value === null) {
|
|
22065
|
+
return [...result, encode(key, options)];
|
|
22066
|
+
}
|
|
22067
|
+
|
|
22068
|
+
return [...result, [encode(key, options), '=', encode(value, options)].join('')];
|
|
22069
|
+
};
|
|
22070
|
+
}
|
|
22071
|
+
}
|
|
22072
|
+
|
|
22073
|
+
function parserForArrayFormat(options) {
|
|
22074
|
+
let result;
|
|
22075
|
+
|
|
22076
|
+
switch (options.arrayFormat) {
|
|
22077
|
+
case 'index':
|
|
22078
|
+
return (key, value, accumulator) => {
|
|
22079
|
+
result = /\[(\d*)\]$/.exec(key);
|
|
22080
|
+
|
|
22081
|
+
key = key.replace(/\[\d*\]$/, '');
|
|
22082
|
+
|
|
22083
|
+
if (!result) {
|
|
22084
|
+
accumulator[key] = value;
|
|
22085
|
+
return;
|
|
22086
|
+
}
|
|
22087
|
+
|
|
22088
|
+
if (accumulator[key] === undefined) {
|
|
22089
|
+
accumulator[key] = {};
|
|
22090
|
+
}
|
|
22091
|
+
|
|
22092
|
+
accumulator[key][result[1]] = value;
|
|
22093
|
+
};
|
|
22094
|
+
|
|
22095
|
+
case 'bracket':
|
|
22096
|
+
return (key, value, accumulator) => {
|
|
22097
|
+
result = /(\[\])$/.exec(key);
|
|
22098
|
+
key = key.replace(/\[\]$/, '');
|
|
22099
|
+
|
|
22100
|
+
if (!result) {
|
|
22101
|
+
accumulator[key] = value;
|
|
22102
|
+
return;
|
|
22103
|
+
}
|
|
22104
|
+
|
|
22105
|
+
if (accumulator[key] === undefined) {
|
|
22106
|
+
accumulator[key] = [value];
|
|
22107
|
+
return;
|
|
22108
|
+
}
|
|
22109
|
+
|
|
22110
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
22111
|
+
};
|
|
22112
|
+
|
|
22113
|
+
case 'colon-list-separator':
|
|
22114
|
+
return (key, value, accumulator) => {
|
|
22115
|
+
result = /(:list)$/.exec(key);
|
|
22116
|
+
key = key.replace(/:list$/, '');
|
|
22117
|
+
|
|
22118
|
+
if (!result) {
|
|
22119
|
+
accumulator[key] = value;
|
|
22120
|
+
return;
|
|
22121
|
+
}
|
|
22122
|
+
|
|
22123
|
+
if (accumulator[key] === undefined) {
|
|
22124
|
+
accumulator[key] = [value];
|
|
22125
|
+
return;
|
|
22126
|
+
}
|
|
22127
|
+
|
|
22128
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
22129
|
+
};
|
|
22130
|
+
|
|
22131
|
+
case 'comma':
|
|
22132
|
+
case 'separator':
|
|
22133
|
+
return (key, value, accumulator) => {
|
|
22134
|
+
const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);
|
|
22135
|
+
const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));
|
|
22136
|
+
value = isEncodedArray ? decode(value, options) : value;
|
|
22137
|
+
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
|
|
22138
|
+
accumulator[key] = newValue;
|
|
22139
|
+
};
|
|
22140
|
+
|
|
22141
|
+
case 'bracket-separator':
|
|
22142
|
+
return (key, value, accumulator) => {
|
|
22143
|
+
const isArray = /(\[\])$/.test(key);
|
|
22144
|
+
key = key.replace(/\[\]$/, '');
|
|
22145
|
+
|
|
22146
|
+
if (!isArray) {
|
|
22147
|
+
accumulator[key] = value ? decode(value, options) : value;
|
|
22148
|
+
return;
|
|
22149
|
+
}
|
|
22150
|
+
|
|
22151
|
+
const arrayValue = value === null ?
|
|
22152
|
+
[] :
|
|
22153
|
+
value.split(options.arrayFormatSeparator).map(item => decode(item, options));
|
|
22154
|
+
|
|
22155
|
+
if (accumulator[key] === undefined) {
|
|
22156
|
+
accumulator[key] = arrayValue;
|
|
22157
|
+
return;
|
|
22158
|
+
}
|
|
22159
|
+
|
|
22160
|
+
accumulator[key] = [].concat(accumulator[key], arrayValue);
|
|
22161
|
+
};
|
|
22162
|
+
|
|
22163
|
+
default:
|
|
22164
|
+
return (key, value, accumulator) => {
|
|
22165
|
+
if (accumulator[key] === undefined) {
|
|
22166
|
+
accumulator[key] = value;
|
|
22167
|
+
return;
|
|
22168
|
+
}
|
|
22169
|
+
|
|
22170
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
22171
|
+
};
|
|
22172
|
+
}
|
|
22173
|
+
}
|
|
22174
|
+
|
|
22175
|
+
function validateArrayFormatSeparator(value) {
|
|
22176
|
+
if (typeof value !== 'string' || value.length !== 1) {
|
|
22177
|
+
throw new TypeError('arrayFormatSeparator must be single character string');
|
|
22178
|
+
}
|
|
22179
|
+
}
|
|
22180
|
+
|
|
22181
|
+
function encode(value, options) {
|
|
22182
|
+
if (options.encode) {
|
|
22183
|
+
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
|
22184
|
+
}
|
|
22185
|
+
|
|
22186
|
+
return value;
|
|
22187
|
+
}
|
|
22188
|
+
|
|
22189
|
+
function decode(value, options) {
|
|
22190
|
+
if (options.decode) {
|
|
22191
|
+
return decodeComponent(value);
|
|
22192
|
+
}
|
|
22193
|
+
|
|
22194
|
+
return value;
|
|
22195
|
+
}
|
|
22196
|
+
|
|
22197
|
+
function keysSorter(input) {
|
|
22198
|
+
if (Array.isArray(input)) {
|
|
22199
|
+
return input.sort();
|
|
22200
|
+
}
|
|
22201
|
+
|
|
22202
|
+
if (typeof input === 'object') {
|
|
22203
|
+
return keysSorter(Object.keys(input))
|
|
22204
|
+
.sort((a, b) => Number(a) - Number(b))
|
|
22205
|
+
.map(key => input[key]);
|
|
22206
|
+
}
|
|
22207
|
+
|
|
22208
|
+
return input;
|
|
22209
|
+
}
|
|
22210
|
+
|
|
22211
|
+
function removeHash(input) {
|
|
22212
|
+
const hashStart = input.indexOf('#');
|
|
22213
|
+
if (hashStart !== -1) {
|
|
22214
|
+
input = input.slice(0, hashStart);
|
|
22215
|
+
}
|
|
22216
|
+
|
|
22217
|
+
return input;
|
|
22218
|
+
}
|
|
22219
|
+
|
|
22220
|
+
function getHash(url) {
|
|
22221
|
+
let hash = '';
|
|
22222
|
+
const hashStart = url.indexOf('#');
|
|
22223
|
+
if (hashStart !== -1) {
|
|
22224
|
+
hash = url.slice(hashStart);
|
|
22225
|
+
}
|
|
22226
|
+
|
|
22227
|
+
return hash;
|
|
22228
|
+
}
|
|
22229
|
+
|
|
22230
|
+
function extract(input) {
|
|
22231
|
+
input = removeHash(input);
|
|
22232
|
+
const queryStart = input.indexOf('?');
|
|
22233
|
+
if (queryStart === -1) {
|
|
22234
|
+
return '';
|
|
22235
|
+
}
|
|
22236
|
+
|
|
22237
|
+
return input.slice(queryStart + 1);
|
|
22238
|
+
}
|
|
22239
|
+
|
|
22240
|
+
function parseValue(value, options) {
|
|
22241
|
+
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
|
|
22242
|
+
value = Number(value);
|
|
22243
|
+
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
|
|
22244
|
+
value = value.toLowerCase() === 'true';
|
|
22245
|
+
}
|
|
22246
|
+
|
|
22247
|
+
return value;
|
|
22248
|
+
}
|
|
22249
|
+
|
|
22250
|
+
function parse(query, options) {
|
|
22251
|
+
options = Object.assign({
|
|
22252
|
+
decode: true,
|
|
22253
|
+
sort: true,
|
|
22254
|
+
arrayFormat: 'none',
|
|
22255
|
+
arrayFormatSeparator: ',',
|
|
22256
|
+
parseNumbers: false,
|
|
22257
|
+
parseBooleans: false
|
|
22258
|
+
}, options);
|
|
22259
|
+
|
|
22260
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
22261
|
+
|
|
22262
|
+
const formatter = parserForArrayFormat(options);
|
|
22263
|
+
|
|
22264
|
+
// Create an object with no prototype
|
|
22265
|
+
const ret = Object.create(null);
|
|
22266
|
+
|
|
22267
|
+
if (typeof query !== 'string') {
|
|
22268
|
+
return ret;
|
|
22269
|
+
}
|
|
22270
|
+
|
|
22271
|
+
query = query.trim().replace(/^[?#&]/, '');
|
|
22272
|
+
|
|
22273
|
+
if (!query) {
|
|
22274
|
+
return ret;
|
|
22275
|
+
}
|
|
22276
|
+
|
|
22277
|
+
for (const param of query.split('&')) {
|
|
22278
|
+
if (param === '') {
|
|
22279
|
+
continue;
|
|
22280
|
+
}
|
|
22281
|
+
|
|
22282
|
+
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '=');
|
|
22283
|
+
|
|
22284
|
+
// Missing `=` should be `null`:
|
|
22285
|
+
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
|
22286
|
+
value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options);
|
|
22287
|
+
formatter(decode(key, options), value, ret);
|
|
22288
|
+
}
|
|
22289
|
+
|
|
22290
|
+
for (const key of Object.keys(ret)) {
|
|
22291
|
+
const value = ret[key];
|
|
22292
|
+
if (typeof value === 'object' && value !== null) {
|
|
22293
|
+
for (const k of Object.keys(value)) {
|
|
22294
|
+
value[k] = parseValue(value[k], options);
|
|
22295
|
+
}
|
|
22296
|
+
} else {
|
|
22297
|
+
ret[key] = parseValue(value, options);
|
|
22298
|
+
}
|
|
22299
|
+
}
|
|
22300
|
+
|
|
22301
|
+
if (options.sort === false) {
|
|
22302
|
+
return ret;
|
|
22303
|
+
}
|
|
22304
|
+
|
|
22305
|
+
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
|
|
22306
|
+
const value = ret[key];
|
|
22307
|
+
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
|
|
22308
|
+
// Sort object keys, not values
|
|
22309
|
+
result[key] = keysSorter(value);
|
|
22310
|
+
} else {
|
|
22311
|
+
result[key] = value;
|
|
22312
|
+
}
|
|
22313
|
+
|
|
22314
|
+
return result;
|
|
22315
|
+
}, Object.create(null));
|
|
22316
|
+
}
|
|
22317
|
+
|
|
22318
|
+
exports.extract = extract;
|
|
22319
|
+
exports.parse = parse;
|
|
22320
|
+
|
|
22321
|
+
exports.stringify = (object, options) => {
|
|
22322
|
+
if (!object) {
|
|
22323
|
+
return '';
|
|
22324
|
+
}
|
|
22325
|
+
|
|
22326
|
+
options = Object.assign({
|
|
22327
|
+
encode: true,
|
|
22328
|
+
strict: true,
|
|
22329
|
+
arrayFormat: 'none',
|
|
22330
|
+
arrayFormatSeparator: ','
|
|
22331
|
+
}, options);
|
|
22332
|
+
|
|
22333
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
22334
|
+
|
|
22335
|
+
const shouldFilter = key => (
|
|
22336
|
+
(options.skipNull && isNullOrUndefined(object[key])) ||
|
|
22337
|
+
(options.skipEmptyString && object[key] === '')
|
|
22338
|
+
);
|
|
22339
|
+
|
|
22340
|
+
const formatter = encoderForArrayFormat(options);
|
|
22341
|
+
|
|
22342
|
+
const objectCopy = {};
|
|
22343
|
+
|
|
22344
|
+
for (const key of Object.keys(object)) {
|
|
22345
|
+
if (!shouldFilter(key)) {
|
|
22346
|
+
objectCopy[key] = object[key];
|
|
22347
|
+
}
|
|
22348
|
+
}
|
|
22349
|
+
|
|
22350
|
+
const keys = Object.keys(objectCopy);
|
|
22351
|
+
|
|
22352
|
+
if (options.sort !== false) {
|
|
22353
|
+
keys.sort(options.sort);
|
|
22354
|
+
}
|
|
22355
|
+
|
|
22356
|
+
return keys.map(key => {
|
|
22357
|
+
const value = object[key];
|
|
22358
|
+
|
|
22359
|
+
if (value === undefined) {
|
|
22360
|
+
return '';
|
|
22361
|
+
}
|
|
22362
|
+
|
|
22363
|
+
if (value === null) {
|
|
22364
|
+
return encode(key, options);
|
|
22365
|
+
}
|
|
22366
|
+
|
|
22367
|
+
if (Array.isArray(value)) {
|
|
22368
|
+
if (value.length === 0 && options.arrayFormat === 'bracket-separator') {
|
|
22369
|
+
return encode(key, options) + '[]';
|
|
22370
|
+
}
|
|
22371
|
+
|
|
22372
|
+
return value
|
|
22373
|
+
.reduce(formatter(key), [])
|
|
22374
|
+
.join('&');
|
|
22375
|
+
}
|
|
22376
|
+
|
|
22377
|
+
return encode(key, options) + '=' + encode(value, options);
|
|
22378
|
+
}).filter(x => x.length > 0).join('&');
|
|
22379
|
+
};
|
|
22380
|
+
|
|
22381
|
+
exports.parseUrl = (url, options) => {
|
|
22382
|
+
options = Object.assign({
|
|
22383
|
+
decode: true
|
|
22384
|
+
}, options);
|
|
22385
|
+
|
|
22386
|
+
const [url_, hash] = splitOnFirst(url, '#');
|
|
22387
|
+
|
|
22388
|
+
return Object.assign(
|
|
22389
|
+
{
|
|
22390
|
+
url: url_.split('?')[0] || '',
|
|
22391
|
+
query: parse(extract(url), options)
|
|
22392
|
+
},
|
|
22393
|
+
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
|
|
22394
|
+
);
|
|
22395
|
+
};
|
|
22396
|
+
|
|
22397
|
+
exports.stringifyUrl = (object, options) => {
|
|
22398
|
+
options = Object.assign({
|
|
22399
|
+
encode: true,
|
|
22400
|
+
strict: true,
|
|
22401
|
+
[encodeFragmentIdentifier]: true
|
|
22402
|
+
}, options);
|
|
22403
|
+
|
|
22404
|
+
const url = removeHash(object.url).split('?')[0] || '';
|
|
22405
|
+
const queryFromUrl = exports.extract(object.url);
|
|
22406
|
+
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
|
|
22407
|
+
|
|
22408
|
+
const query = Object.assign(parsedQueryFromUrl, object.query);
|
|
22409
|
+
let queryString = exports.stringify(query, options);
|
|
22410
|
+
if (queryString) {
|
|
22411
|
+
queryString = `?${queryString}`;
|
|
22412
|
+
}
|
|
22413
|
+
|
|
22414
|
+
let hash = getHash(object.url);
|
|
22415
|
+
if (object.fragmentIdentifier) {
|
|
22416
|
+
hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`;
|
|
22417
|
+
}
|
|
22418
|
+
|
|
22419
|
+
return `${url}${queryString}${hash}`;
|
|
22420
|
+
};
|
|
22421
|
+
|
|
22422
|
+
exports.pick = (input, filter, options) => {
|
|
22423
|
+
options = Object.assign({
|
|
22424
|
+
parseFragmentIdentifier: true,
|
|
22425
|
+
[encodeFragmentIdentifier]: false
|
|
22426
|
+
}, options);
|
|
22427
|
+
|
|
22428
|
+
const {url, query, fragmentIdentifier} = exports.parseUrl(input, options);
|
|
22429
|
+
return exports.stringifyUrl({
|
|
22430
|
+
url,
|
|
22431
|
+
query: filterObject(query, filter),
|
|
22432
|
+
fragmentIdentifier
|
|
22433
|
+
}, options);
|
|
22434
|
+
};
|
|
22435
|
+
|
|
22436
|
+
exports.exclude = (input, filter, options) => {
|
|
22437
|
+
const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value);
|
|
22438
|
+
|
|
22439
|
+
return exports.pick(input, exclusionFilter, options);
|
|
22440
|
+
};
|
|
22441
|
+
|
|
22442
|
+
|
|
21772
22443
|
/***/ }),
|
|
21773
22444
|
|
|
21774
22445
|
/***/ "./node_modules/querystring/decode.js":
|
|
@@ -25925,6 +26596,39 @@ Sha512.prototype._hash = function () {
|
|
|
25925
26596
|
module.exports = Sha512
|
|
25926
26597
|
|
|
25927
26598
|
|
|
26599
|
+
/***/ }),
|
|
26600
|
+
|
|
26601
|
+
/***/ "./node_modules/split-on-first/index.js":
|
|
26602
|
+
/*!**********************************************!*\
|
|
26603
|
+
!*** ./node_modules/split-on-first/index.js ***!
|
|
26604
|
+
\**********************************************/
|
|
26605
|
+
/***/ ((module) => {
|
|
26606
|
+
|
|
26607
|
+
"use strict";
|
|
26608
|
+
|
|
26609
|
+
|
|
26610
|
+
module.exports = (string, separator) => {
|
|
26611
|
+
if (!(typeof string === 'string' && typeof separator === 'string')) {
|
|
26612
|
+
throw new TypeError('Expected the arguments to be of type `string`');
|
|
26613
|
+
}
|
|
26614
|
+
|
|
26615
|
+
if (separator === '') {
|
|
26616
|
+
return [string];
|
|
26617
|
+
}
|
|
26618
|
+
|
|
26619
|
+
const separatorIndex = string.indexOf(separator);
|
|
26620
|
+
|
|
26621
|
+
if (separatorIndex === -1) {
|
|
26622
|
+
return [string];
|
|
26623
|
+
}
|
|
26624
|
+
|
|
26625
|
+
return [
|
|
26626
|
+
string.slice(0, separatorIndex),
|
|
26627
|
+
string.slice(separatorIndex + separator.length)
|
|
26628
|
+
];
|
|
26629
|
+
};
|
|
26630
|
+
|
|
26631
|
+
|
|
25928
26632
|
/***/ }),
|
|
25929
26633
|
|
|
25930
26634
|
/***/ "./node_modules/stellar-base/lib/account.js":
|
|
@@ -45354,6 +46058,19 @@ IncomingMessage.prototype._onXHRProgress = function (resetTimers) {
|
|
|
45354
46058
|
}
|
|
45355
46059
|
|
|
45356
46060
|
|
|
46061
|
+
/***/ }),
|
|
46062
|
+
|
|
46063
|
+
/***/ "./node_modules/strict-uri-encode/index.js":
|
|
46064
|
+
/*!*************************************************!*\
|
|
46065
|
+
!*** ./node_modules/strict-uri-encode/index.js ***!
|
|
46066
|
+
\*************************************************/
|
|
46067
|
+
/***/ ((module) => {
|
|
46068
|
+
|
|
46069
|
+
"use strict";
|
|
46070
|
+
|
|
46071
|
+
module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
46072
|
+
|
|
46073
|
+
|
|
45357
46074
|
/***/ }),
|
|
45358
46075
|
|
|
45359
46076
|
/***/ "./node_modules/string_decoder/lib/string_decoder.js":
|
|
@@ -49788,6 +50505,17 @@ exports["default"] = { walletSdk: walletSdk };
|
|
|
49788
50505
|
|
|
49789
50506
|
"use strict";
|
|
49790
50507
|
|
|
50508
|
+
var __assign = (this && this.__assign) || function () {
|
|
50509
|
+
__assign = Object.assign || function(t) {
|
|
50510
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
50511
|
+
s = arguments[i];
|
|
50512
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
50513
|
+
t[p] = s[p];
|
|
50514
|
+
}
|
|
50515
|
+
return t;
|
|
50516
|
+
};
|
|
50517
|
+
return __assign.apply(this, arguments);
|
|
50518
|
+
};
|
|
49791
50519
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
49792
50520
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
49793
50521
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -49824,35 +50552,56 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49824
50552
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49825
50553
|
}
|
|
49826
50554
|
};
|
|
50555
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50556
|
+
var t = {};
|
|
50557
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50558
|
+
t[p] = s[p];
|
|
50559
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50560
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
50561
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
50562
|
+
t[p[i]] = s[p[i]];
|
|
50563
|
+
}
|
|
50564
|
+
return t;
|
|
50565
|
+
};
|
|
49827
50566
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
49828
50567
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49829
50568
|
};
|
|
49830
50569
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
49831
50570
|
exports.Anchor = void 0;
|
|
50571
|
+
var query_string_1 = __importDefault(__webpack_require__(/*! query-string */ "./node_modules/query-string/index.js"));
|
|
49832
50572
|
var stellar_sdk_1 = __webpack_require__(/*! stellar-sdk */ "./node_modules/stellar-sdk/lib/index.js");
|
|
49833
|
-
var axios_1 = __importDefault(__webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs"));
|
|
49834
50573
|
var Auth_1 = __webpack_require__(/*! ../Auth */ "./src/walletSdk/Auth/index.ts");
|
|
49835
50574
|
var interactive_1 = __webpack_require__(/*! ../interactive */ "./src/walletSdk/interactive/index.ts");
|
|
49836
50575
|
var toml_1 = __webpack_require__(/*! ../toml */ "./src/walletSdk/toml/index.ts");
|
|
50576
|
+
var Watcher_1 = __webpack_require__(/*! ../Watcher */ "./src/walletSdk/Watcher/index.ts");
|
|
49837
50577
|
var exception_1 = __webpack_require__(/*! ../exception */ "./src/walletSdk/exception/index.ts");
|
|
50578
|
+
var camelToSnakeCase_1 = __webpack_require__(/*! ../util/camelToSnakeCase */ "./src/walletSdk/util/camelToSnakeCase.ts");
|
|
50579
|
+
var Types_1 = __webpack_require__(/*! ../Watcher/Types */ "./src/walletSdk/Watcher/Types.ts");
|
|
49838
50580
|
// Do not create this object directly, use the Wallet class.
|
|
49839
50581
|
var Anchor = /** @class */ (function () {
|
|
49840
|
-
function Anchor(
|
|
49841
|
-
|
|
49842
|
-
this.
|
|
50582
|
+
function Anchor(_a) {
|
|
50583
|
+
var cfg = _a.cfg, homeDomain = _a.homeDomain, httpClient = _a.httpClient, language = _a.language;
|
|
50584
|
+
this.cfg = cfg;
|
|
49843
50585
|
this.homeDomain = homeDomain;
|
|
49844
50586
|
this.httpClient = httpClient;
|
|
49845
|
-
this.
|
|
50587
|
+
this.language = language;
|
|
49846
50588
|
}
|
|
49847
|
-
Anchor.prototype.getInfo = function () {
|
|
50589
|
+
Anchor.prototype.getInfo = function (shouldRefresh) {
|
|
49848
50590
|
return __awaiter(this, void 0, void 0, function () {
|
|
49849
|
-
var
|
|
50591
|
+
var stellarToml, parsedToml;
|
|
49850
50592
|
return __generator(this, function (_a) {
|
|
49851
50593
|
switch (_a.label) {
|
|
49852
|
-
case 0:
|
|
50594
|
+
case 0:
|
|
50595
|
+
// return cached TOML values by default
|
|
50596
|
+
if (this.toml && !shouldRefresh) {
|
|
50597
|
+
return [2 /*return*/, this.toml];
|
|
50598
|
+
}
|
|
50599
|
+
return [4 /*yield*/, stellar_sdk_1.StellarTomlResolver.resolve(this.homeDomain)];
|
|
49853
50600
|
case 1:
|
|
49854
|
-
|
|
49855
|
-
|
|
50601
|
+
stellarToml = _a.sent();
|
|
50602
|
+
parsedToml = (0, toml_1.parseToml)(stellarToml);
|
|
50603
|
+
this.toml = parsedToml;
|
|
50604
|
+
return [2 /*return*/, parsedToml];
|
|
49856
50605
|
}
|
|
49857
50606
|
});
|
|
49858
50607
|
});
|
|
@@ -49865,15 +50614,19 @@ var Anchor = /** @class */ (function () {
|
|
|
49865
50614
|
case 0: return [4 /*yield*/, this.getInfo()];
|
|
49866
50615
|
case 1:
|
|
49867
50616
|
tomlInfo = _a.sent();
|
|
49868
|
-
return [2 /*return*/, new Auth_1.Auth(tomlInfo.webAuthEndpoint)];
|
|
50617
|
+
return [2 /*return*/, new Auth_1.Auth(this.cfg, tomlInfo.webAuthEndpoint, this.httpClient)];
|
|
49869
50618
|
}
|
|
49870
50619
|
});
|
|
49871
50620
|
});
|
|
49872
50621
|
};
|
|
49873
50622
|
Anchor.prototype.interactive = function () {
|
|
49874
|
-
return new interactive_1.Interactive(this.homeDomain, this);
|
|
50623
|
+
return new interactive_1.Interactive(this.homeDomain, this, this.httpClient);
|
|
50624
|
+
};
|
|
50625
|
+
Anchor.prototype.watcher = function () {
|
|
50626
|
+
return new Watcher_1.Watcher(this);
|
|
49875
50627
|
};
|
|
49876
|
-
Anchor.prototype.getServicesInfo = function () {
|
|
50628
|
+
Anchor.prototype.getServicesInfo = function (lang) {
|
|
50629
|
+
if (lang === void 0) { lang = this.language; }
|
|
49877
50630
|
return __awaiter(this, void 0, void 0, function () {
|
|
49878
50631
|
var toml, transferServerEndpoint, resp, e_1;
|
|
49879
50632
|
return __generator(this, function (_a) {
|
|
@@ -49885,7 +50638,7 @@ var Anchor = /** @class */ (function () {
|
|
|
49885
50638
|
_a.label = 2;
|
|
49886
50639
|
case 2:
|
|
49887
50640
|
_a.trys.push([2, 4, , 5]);
|
|
49888
|
-
return [4 /*yield*/,
|
|
50641
|
+
return [4 /*yield*/, this.httpClient.get("".concat(transferServerEndpoint, "/info?lang=").concat(lang), {
|
|
49889
50642
|
headers: {
|
|
49890
50643
|
"Content-Type": "application/json",
|
|
49891
50644
|
},
|
|
@@ -49901,9 +50654,167 @@ var Anchor = /** @class */ (function () {
|
|
|
49901
50654
|
});
|
|
49902
50655
|
});
|
|
49903
50656
|
};
|
|
49904
|
-
|
|
49905
|
-
|
|
49906
|
-
|
|
50657
|
+
/**
|
|
50658
|
+
* Get single transaction's current status and details. One of the [id], [stellarTransactionId],
|
|
50659
|
+
* [externalTransactionId] must be provided.
|
|
50660
|
+
*
|
|
50661
|
+
* @param authToken auth token of the account authenticated with the anchor
|
|
50662
|
+
* @param id transaction ID
|
|
50663
|
+
* @param stellarTransactionId stellar transaction ID
|
|
50664
|
+
* @param externalTransactionId external transaction ID
|
|
50665
|
+
* @return transaction object
|
|
50666
|
+
* @throws [MissingTransactionIdError] if none of the id params is provided
|
|
50667
|
+
* @throws [InvalidTransactionResponseError] if Anchor returns an invalid transaction
|
|
50668
|
+
* @throws [ServerRequestFailedError] if server request fails
|
|
50669
|
+
*/
|
|
50670
|
+
Anchor.prototype.getTransactionBy = function (_a) {
|
|
50671
|
+
var _b;
|
|
50672
|
+
var authToken = _a.authToken, id = _a.id, stellarTransactionId = _a.stellarTransactionId, externalTransactionId = _a.externalTransactionId, _c = _a.lang, lang = _c === void 0 ? this.language : _c;
|
|
50673
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50674
|
+
var toml, transferServerEndpoint, qs, resp, transaction, e_2;
|
|
50675
|
+
return __generator(this, function (_d) {
|
|
50676
|
+
switch (_d.label) {
|
|
50677
|
+
case 0:
|
|
50678
|
+
if (!id && !stellarTransactionId && !externalTransactionId) {
|
|
50679
|
+
throw new exception_1.MissingTransactionIdError();
|
|
50680
|
+
}
|
|
50681
|
+
return [4 /*yield*/, this.getInfo()];
|
|
50682
|
+
case 1:
|
|
50683
|
+
toml = _d.sent();
|
|
50684
|
+
transferServerEndpoint = toml.transferServerSep24;
|
|
50685
|
+
qs = {};
|
|
50686
|
+
if (id) {
|
|
50687
|
+
qs = { id: id };
|
|
50688
|
+
}
|
|
50689
|
+
else if (stellarTransactionId) {
|
|
50690
|
+
qs = { stellar_transaction_id: stellarTransactionId };
|
|
50691
|
+
}
|
|
50692
|
+
else if (externalTransactionId) {
|
|
50693
|
+
qs = { external_transaction_id: externalTransactionId };
|
|
50694
|
+
}
|
|
50695
|
+
qs = __assign({ lang: lang }, qs);
|
|
50696
|
+
_d.label = 2;
|
|
50697
|
+
case 2:
|
|
50698
|
+
_d.trys.push([2, 4, , 5]);
|
|
50699
|
+
return [4 /*yield*/, this.httpClient.get("".concat(transferServerEndpoint, "/transaction?").concat(query_string_1.default.stringify(qs)), {
|
|
50700
|
+
headers: {
|
|
50701
|
+
Authorization: "Bearer ".concat(authToken),
|
|
50702
|
+
},
|
|
50703
|
+
})];
|
|
50704
|
+
case 3:
|
|
50705
|
+
resp = _d.sent();
|
|
50706
|
+
transaction = (_b = resp.data) === null || _b === void 0 ? void 0 : _b.transaction;
|
|
50707
|
+
if (!transaction || Object.keys(transaction).length === 0) {
|
|
50708
|
+
throw new exception_1.InvalidTransactionResponseError(transaction);
|
|
50709
|
+
}
|
|
50710
|
+
return [2 /*return*/, transaction];
|
|
50711
|
+
case 4:
|
|
50712
|
+
e_2 = _d.sent();
|
|
50713
|
+
throw new exception_1.ServerRequestFailedError(e_2);
|
|
50714
|
+
case 5: return [2 /*return*/];
|
|
50715
|
+
}
|
|
50716
|
+
});
|
|
50717
|
+
});
|
|
50718
|
+
};
|
|
50719
|
+
/**
|
|
50720
|
+
* Get account's transactions specified by asset and other params.
|
|
50721
|
+
*
|
|
50722
|
+
* @param authToken auth token of the account authenticated with the anchor
|
|
50723
|
+
* @param assetCode target asset to query for
|
|
50724
|
+
* @param noOlderThan response should contain transactions starting on or after this date & time
|
|
50725
|
+
* @param limit response should contain at most 'limit' transactions
|
|
50726
|
+
* @param kind kind of transaction that is desired. E.g.: 'deposit', 'withdrawal'
|
|
50727
|
+
* @param pagingId response should contain transactions starting prior to this ID (exclusive)
|
|
50728
|
+
* @param lang desired language (localization), it can also accept locale in the format 'en-US'
|
|
50729
|
+
* @return list of transactions as requested by the client, sorted in time-descending order
|
|
50730
|
+
* @throws [InvalidTransactionsResponseError] if Anchor returns an invalid response
|
|
50731
|
+
* @throws [ServerRequestFailedError] if server request fails
|
|
50732
|
+
*/
|
|
50733
|
+
Anchor.prototype.getTransactionsForAsset = function (params) {
|
|
50734
|
+
var _a;
|
|
50735
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50736
|
+
var authToken, _b, lang, otherParams, toml, transferServerEndpoint, apiParams, resp, transactions, e_3;
|
|
50737
|
+
return __generator(this, function (_c) {
|
|
50738
|
+
switch (_c.label) {
|
|
50739
|
+
case 0:
|
|
50740
|
+
authToken = params.authToken, _b = params.lang, lang = _b === void 0 ? this.language : _b, otherParams = __rest(params, ["authToken", "lang"]);
|
|
50741
|
+
return [4 /*yield*/, this.getInfo()];
|
|
50742
|
+
case 1:
|
|
50743
|
+
toml = _c.sent();
|
|
50744
|
+
transferServerEndpoint = toml.transferServerSep24;
|
|
50745
|
+
apiParams = (0, camelToSnakeCase_1.camelToSnakeCaseObject)(__assign({ lang: lang }, otherParams));
|
|
50746
|
+
_c.label = 2;
|
|
50747
|
+
case 2:
|
|
50748
|
+
_c.trys.push([2, 4, , 5]);
|
|
50749
|
+
return [4 /*yield*/, this.httpClient.get("".concat(transferServerEndpoint, "/transactions?").concat(query_string_1.default.stringify(apiParams)), {
|
|
50750
|
+
headers: {
|
|
50751
|
+
Authorization: "Bearer ".concat(authToken),
|
|
50752
|
+
},
|
|
50753
|
+
})];
|
|
50754
|
+
case 3:
|
|
50755
|
+
resp = _c.sent();
|
|
50756
|
+
transactions = (_a = resp.data) === null || _a === void 0 ? void 0 : _a.transactions;
|
|
50757
|
+
if (!transactions || !Array.isArray(transactions)) {
|
|
50758
|
+
throw new exception_1.InvalidTransactionsResponseError(transactions);
|
|
50759
|
+
}
|
|
50760
|
+
return [2 /*return*/, transactions];
|
|
50761
|
+
case 4:
|
|
50762
|
+
e_3 = _c.sent();
|
|
50763
|
+
throw new exception_1.ServerRequestFailedError(e_3);
|
|
50764
|
+
case 5: return [2 /*return*/];
|
|
50765
|
+
}
|
|
50766
|
+
});
|
|
50767
|
+
});
|
|
50768
|
+
};
|
|
50769
|
+
/**
|
|
50770
|
+
* Get all successfully finished (either completed or refunded) account transactions for specified
|
|
50771
|
+
* asset. Optional field implementation depends on anchor.
|
|
50772
|
+
*
|
|
50773
|
+
* @param authToken auth token of the account authenticated with the anchor
|
|
50774
|
+
* @param assetCode target asset to query for
|
|
50775
|
+
* @param noOlderThan response should contain transactions starting on or after this date & time
|
|
50776
|
+
* @param limit response should contain at most 'limit' transactions
|
|
50777
|
+
* @param kind kind of transaction that is desired. E.g.: 'deposit', 'withdrawal'
|
|
50778
|
+
* @param pagingId response should contain transactions starting prior to this ID (exclusive)
|
|
50779
|
+
* @param lang desired language (localization), it can also accept locale in the format 'en-US'
|
|
50780
|
+
* @return list of filtered transactions that achieved a final state (completed or refunded)
|
|
50781
|
+
* @throws [AssetNotSupportedError] if asset is not supported by the anchor
|
|
50782
|
+
* @throws [InvalidTransactionsResponseError] if Anchor returns an invalid response
|
|
50783
|
+
* @throws [ServerRequestFailedError] if server request fails
|
|
50784
|
+
*/
|
|
50785
|
+
Anchor.prototype.getHistory = function (params) {
|
|
50786
|
+
var _a;
|
|
50787
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50788
|
+
var assetCode, toml, transactions, finishedTransactions;
|
|
50789
|
+
return __generator(this, function (_b) {
|
|
50790
|
+
switch (_b.label) {
|
|
50791
|
+
case 0:
|
|
50792
|
+
assetCode = params.assetCode;
|
|
50793
|
+
return [4 /*yield*/, this.getInfo()];
|
|
50794
|
+
case 1:
|
|
50795
|
+
toml = _b.sent();
|
|
50796
|
+
if (!((_a = toml.currencies) === null || _a === void 0 ? void 0 : _a.find(function (_a) {
|
|
50797
|
+
var code = _a.code;
|
|
50798
|
+
return code === assetCode;
|
|
50799
|
+
}))) {
|
|
50800
|
+
throw new exception_1.AssetNotSupportedError(null, assetCode);
|
|
50801
|
+
}
|
|
50802
|
+
return [4 /*yield*/, this.getTransactionsForAsset(params)];
|
|
50803
|
+
case 2:
|
|
50804
|
+
transactions = _b.sent();
|
|
50805
|
+
finishedTransactions = transactions
|
|
50806
|
+
.filter(function (_a) {
|
|
50807
|
+
var status = _a.status;
|
|
50808
|
+
return [
|
|
50809
|
+
Types_1.TransactionStatus.completed,
|
|
50810
|
+
Types_1.TransactionStatus.refunded
|
|
50811
|
+
].includes(status);
|
|
50812
|
+
});
|
|
50813
|
+
return [2 /*return*/, finishedTransactions];
|
|
50814
|
+
}
|
|
50815
|
+
});
|
|
50816
|
+
});
|
|
50817
|
+
};
|
|
49907
50818
|
return Anchor;
|
|
49908
50819
|
}());
|
|
49909
50820
|
exports.Anchor = Anchor;
|
|
@@ -49919,10 +50830,17 @@ exports.Anchor = Anchor;
|
|
|
49919
50830
|
|
|
49920
50831
|
"use strict";
|
|
49921
50832
|
|
|
49922
|
-
// TODO - https://stellarorg.atlassian.net/browse/WAL-813?atlOrigin=eyJpIjoiODBkZTQ1MDMzYTJmNDFjOWI0NDM3MTQ2YWYxNTEzNTgiLCJwIjoiaiJ9
|
|
49923
50833
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
49924
50834
|
exports.DefaultSigner = void 0;
|
|
49925
|
-
exports.DefaultSigner = {
|
|
50835
|
+
exports.DefaultSigner = {
|
|
50836
|
+
signWithClientAccount: function (txn, account) {
|
|
50837
|
+
txn.sign(account);
|
|
50838
|
+
return txn;
|
|
50839
|
+
},
|
|
50840
|
+
signWithDomainAccount: function (transactionXDR, networkPassPhrase, account) {
|
|
50841
|
+
throw new Error("The DefaultSigner can't sign transactions with domain");
|
|
50842
|
+
},
|
|
50843
|
+
};
|
|
49926
50844
|
|
|
49927
50845
|
|
|
49928
50846
|
/***/ }),
|
|
@@ -49976,17 +50894,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
49976
50894
|
};
|
|
49977
50895
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
49978
50896
|
exports.Auth = void 0;
|
|
49979
|
-
var axios_1 = __importDefault(__webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs"));
|
|
49980
50897
|
var stellar_sdk_1 = __importDefault(__webpack_require__(/*! stellar-sdk */ "./node_modules/stellar-sdk/lib/index.js"));
|
|
49981
50898
|
var exception_1 = __webpack_require__(/*! ../exception */ "./src/walletSdk/exception/index.ts");
|
|
49982
50899
|
// Do not create this object directly, use the Wallet class.
|
|
49983
50900
|
var Auth = /** @class */ (function () {
|
|
49984
|
-
|
|
49985
|
-
function Auth(webAuthEndpoint) {
|
|
50901
|
+
function Auth(cfg, webAuthEndpoint, httpClient) {
|
|
49986
50902
|
this.webAuthEndpoint = "";
|
|
50903
|
+
this.cfg = cfg;
|
|
49987
50904
|
this.webAuthEndpoint = webAuthEndpoint;
|
|
50905
|
+
this.httpClient = httpClient;
|
|
49988
50906
|
}
|
|
49989
|
-
Auth.prototype.authenticate = function (accountKp, memoId, clientDomain) {
|
|
50907
|
+
Auth.prototype.authenticate = function (accountKp, walletSigner, memoId, clientDomain) {
|
|
49990
50908
|
return __awaiter(this, void 0, void 0, function () {
|
|
49991
50909
|
var challengeResponse, signedTx;
|
|
49992
50910
|
return __generator(this, function (_a) {
|
|
@@ -49994,7 +50912,7 @@ var Auth = /** @class */ (function () {
|
|
|
49994
50912
|
case 0: return [4 /*yield*/, this.challenge(accountKp, memoId, clientDomain)];
|
|
49995
50913
|
case 1:
|
|
49996
50914
|
challengeResponse = _a.sent();
|
|
49997
|
-
signedTx = this.sign(accountKp, challengeResponse
|
|
50915
|
+
signedTx = this.sign(accountKp, challengeResponse, walletSigner !== null && walletSigner !== void 0 ? walletSigner : this.cfg.app.defaultSigner);
|
|
49998
50916
|
return [4 /*yield*/, this.getToken(signedTx)];
|
|
49999
50917
|
case 2: return [2 /*return*/, _a.sent()];
|
|
50000
50918
|
}
|
|
@@ -50017,7 +50935,7 @@ var Auth = /** @class */ (function () {
|
|
|
50017
50935
|
_a.label = 1;
|
|
50018
50936
|
case 1:
|
|
50019
50937
|
_a.trys.push([1, 3, , 4]);
|
|
50020
|
-
return [4 /*yield*/,
|
|
50938
|
+
return [4 /*yield*/, this.httpClient.get(url)];
|
|
50021
50939
|
case 2:
|
|
50022
50940
|
auth = _a.sent();
|
|
50023
50941
|
return [2 /*return*/, auth.data];
|
|
@@ -50029,10 +50947,16 @@ var Auth = /** @class */ (function () {
|
|
|
50029
50947
|
});
|
|
50030
50948
|
});
|
|
50031
50949
|
};
|
|
50032
|
-
|
|
50033
|
-
|
|
50034
|
-
|
|
50035
|
-
transaction.
|
|
50950
|
+
Auth.prototype.sign = function (accountKp, challengeResponse, walletSigner) {
|
|
50951
|
+
var transaction = stellar_sdk_1.default.TransactionBuilder.fromXDR(challengeResponse.transaction, challengeResponse.network_passphrase);
|
|
50952
|
+
// check if verifying client domain as well
|
|
50953
|
+
for (var _i = 0, _a = transaction.operations; _i < _a.length; _i++) {
|
|
50954
|
+
var op = _a[_i];
|
|
50955
|
+
if (op.type === "manageData" && op.name === "client_domain") {
|
|
50956
|
+
transaction = walletSigner.signWithDomainAccount(challengeResponse.transaction, challengeResponse.network_passphrase, accountKp);
|
|
50957
|
+
}
|
|
50958
|
+
}
|
|
50959
|
+
walletSigner.signWithClientAccount(transaction, accountKp);
|
|
50036
50960
|
return transaction;
|
|
50037
50961
|
};
|
|
50038
50962
|
Auth.prototype.getToken = function (signedTx) {
|
|
@@ -50042,7 +50966,7 @@ var Auth = /** @class */ (function () {
|
|
|
50042
50966
|
switch (_a.label) {
|
|
50043
50967
|
case 0:
|
|
50044
50968
|
_a.trys.push([0, 2, , 3]);
|
|
50045
|
-
return [4 /*yield*/,
|
|
50969
|
+
return [4 /*yield*/, this.httpClient.post(this.webAuthEndpoint, {
|
|
50046
50970
|
transaction: signedTx.toXDR(),
|
|
50047
50971
|
})];
|
|
50048
50972
|
case 1:
|
|
@@ -50061,6 +50985,341 @@ var Auth = /** @class */ (function () {
|
|
|
50061
50985
|
exports.Auth = Auth;
|
|
50062
50986
|
|
|
50063
50987
|
|
|
50988
|
+
/***/ }),
|
|
50989
|
+
|
|
50990
|
+
/***/ "./src/walletSdk/Watcher/Types.ts":
|
|
50991
|
+
/*!****************************************!*\
|
|
50992
|
+
!*** ./src/walletSdk/Watcher/Types.ts ***!
|
|
50993
|
+
\****************************************/
|
|
50994
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
50995
|
+
|
|
50996
|
+
"use strict";
|
|
50997
|
+
|
|
50998
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
50999
|
+
exports.TransactionStatus = void 0;
|
|
51000
|
+
var TransactionStatus;
|
|
51001
|
+
(function (TransactionStatus) {
|
|
51002
|
+
/**
|
|
51003
|
+
* There is not yet enough information for this transaction to be initiated. Perhaps the user has
|
|
51004
|
+
* not yet entered necessary info in an interactive flow
|
|
51005
|
+
*/
|
|
51006
|
+
TransactionStatus["incomplete"] = "incomplete";
|
|
51007
|
+
/**
|
|
51008
|
+
* The user has not yet initiated their transfer to the anchor. This is the next necessary step in
|
|
51009
|
+
* any deposit or withdrawal flow after transitioning from `incomplete`
|
|
51010
|
+
*/
|
|
51011
|
+
TransactionStatus["pending_user_transfer_start"] = "pending_user_transfer_start";
|
|
51012
|
+
/**
|
|
51013
|
+
* The Stellar payment has been successfully received by the anchor and the off-chain funds are
|
|
51014
|
+
* available for the customer to pick up. Only used for withdrawal transactions.
|
|
51015
|
+
*/
|
|
51016
|
+
TransactionStatus["pending_user_transfer_complete"] = "pending_user_transfer_complete";
|
|
51017
|
+
/**
|
|
51018
|
+
* Pending External deposit/withdrawal has been submitted to external network, but is not yet
|
|
51019
|
+
* confirmed. This is the status when waiting on Bitcoin or other external crypto network to
|
|
51020
|
+
* complete a transaction, or when waiting on a bank transfer.
|
|
51021
|
+
*/
|
|
51022
|
+
TransactionStatus["pending_external"] = "pending_external";
|
|
51023
|
+
/**
|
|
51024
|
+
* Deposit/withdrawal is being processed internally by anchor. This can also be used when the
|
|
51025
|
+
* anchor must verify KYC information prior to deposit/withdrawal.
|
|
51026
|
+
*/
|
|
51027
|
+
TransactionStatus["pending_anchor"] = "pending_anchor";
|
|
51028
|
+
/**
|
|
51029
|
+
* Deposit/withdrawal operation has been submitted to Stellar network, but is not yet confirmed.
|
|
51030
|
+
*/
|
|
51031
|
+
TransactionStatus["pending_stellar"] = "pending_stellar";
|
|
51032
|
+
/** The user must add a trustline for the asset for the deposit to complete. */
|
|
51033
|
+
TransactionStatus["pending_trust"] = "pending_trust";
|
|
51034
|
+
/**
|
|
51035
|
+
* The user must take additional action before the deposit / withdrawal can complete, for example
|
|
51036
|
+
* an email or 2fa confirmation of a withdrawal.
|
|
51037
|
+
*/
|
|
51038
|
+
TransactionStatus["pending_user"] = "pending_user";
|
|
51039
|
+
/** Deposit/withdrawal fully completed */
|
|
51040
|
+
TransactionStatus["completed"] = "completed";
|
|
51041
|
+
/** The deposit/withdrawal is fully refunded */
|
|
51042
|
+
TransactionStatus["refunded"] = "refunded";
|
|
51043
|
+
/**
|
|
51044
|
+
* Funds were never received by the anchor and the transaction is considered abandoned by the
|
|
51045
|
+
* user. Anchors are responsible for determining when transactions are considered expired.
|
|
51046
|
+
*/
|
|
51047
|
+
TransactionStatus["expired"] = "expired";
|
|
51048
|
+
/**
|
|
51049
|
+
* Could not complete deposit because no satisfactory asset/XLM market was available to create the
|
|
51050
|
+
* account
|
|
51051
|
+
*/
|
|
51052
|
+
TransactionStatus["no_market"] = "no_market";
|
|
51053
|
+
/** Deposit/withdrawal size less than min_amount. */
|
|
51054
|
+
TransactionStatus["too_small"] = "too_small";
|
|
51055
|
+
/** Deposit/withdrawal size exceeded max_amount. */
|
|
51056
|
+
TransactionStatus["too_large"] = "too_large";
|
|
51057
|
+
/** Catch-all for any error not enumerated above. */
|
|
51058
|
+
TransactionStatus["error"] = "error";
|
|
51059
|
+
})(TransactionStatus = exports.TransactionStatus || (exports.TransactionStatus = {}));
|
|
51060
|
+
|
|
51061
|
+
|
|
51062
|
+
/***/ }),
|
|
51063
|
+
|
|
51064
|
+
/***/ "./src/walletSdk/Watcher/index.ts":
|
|
51065
|
+
/*!****************************************!*\
|
|
51066
|
+
!*** ./src/walletSdk/Watcher/index.ts ***!
|
|
51067
|
+
\****************************************/
|
|
51068
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
51069
|
+
|
|
51070
|
+
"use strict";
|
|
51071
|
+
|
|
51072
|
+
var __assign = (this && this.__assign) || function () {
|
|
51073
|
+
__assign = Object.assign || function(t) {
|
|
51074
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
51075
|
+
s = arguments[i];
|
|
51076
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
51077
|
+
t[p] = s[p];
|
|
51078
|
+
}
|
|
51079
|
+
return t;
|
|
51080
|
+
};
|
|
51081
|
+
return __assign.apply(this, arguments);
|
|
51082
|
+
};
|
|
51083
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
51084
|
+
var t = {};
|
|
51085
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51086
|
+
t[p] = s[p];
|
|
51087
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
51088
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51089
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
51090
|
+
t[p[i]] = s[p[i]];
|
|
51091
|
+
}
|
|
51092
|
+
return t;
|
|
51093
|
+
};
|
|
51094
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51095
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51096
|
+
};
|
|
51097
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51098
|
+
exports.Watcher = void 0;
|
|
51099
|
+
var isEqual_1 = __importDefault(__webpack_require__(/*! lodash/isEqual */ "./node_modules/lodash/isEqual.js"));
|
|
51100
|
+
var Types_1 = __webpack_require__(/*! ./Types */ "./src/walletSdk/Watcher/Types.ts");
|
|
51101
|
+
// Do not create this object directly, use the Anchor class.
|
|
51102
|
+
var Watcher = /** @class */ (function () {
|
|
51103
|
+
function Watcher(anchor) {
|
|
51104
|
+
this.anchor = anchor;
|
|
51105
|
+
this._oneTransactionWatcher = {};
|
|
51106
|
+
this._allTransactionsWatcher = undefined;
|
|
51107
|
+
this._watchOneTransactionRegistry = {};
|
|
51108
|
+
this._watchAllTransactionsRegistry = {};
|
|
51109
|
+
this._transactionsRegistry = {};
|
|
51110
|
+
this._transactionsIgnoredRegistry = {};
|
|
51111
|
+
}
|
|
51112
|
+
/**
|
|
51113
|
+
* Watch all transactions returned from a transfer server. When new or
|
|
51114
|
+
* updated transactions come in, run an `onMessage` callback.
|
|
51115
|
+
*
|
|
51116
|
+
* On initial load, it'll return ALL pending transactions via onMessage.
|
|
51117
|
+
* Subsequent messages will be any one of these events:
|
|
51118
|
+
* - Any new transaction appears
|
|
51119
|
+
* - Any of the initial pending transactions change any state
|
|
51120
|
+
*
|
|
51121
|
+
* You may also provide an array of transaction ids, `watchlist`, and this
|
|
51122
|
+
* watcher will always react to transactions whose ids are in the watchlist.
|
|
51123
|
+
*/
|
|
51124
|
+
Watcher.prototype.watchAllTransactions = function (params) {
|
|
51125
|
+
var _this = this;
|
|
51126
|
+
var authToken = params.authToken, assetCode = params.assetCode, onMessage = params.onMessage, onError = params.onError, _a = params.watchlist, watchlist = _a === void 0 ? [] : _a, _b = params.timeout, timeout = _b === void 0 ? 5000 : _b, _c = params.isRetry, isRetry = _c === void 0 ? false : _c, _d = params.lang, lang = _d === void 0 ? this.anchor.language : _d, otherParams = __rest(params, ["authToken", "assetCode", "onMessage", "onError", "watchlist", "timeout", "isRetry", "lang"]);
|
|
51127
|
+
// make an object map out of watchlist
|
|
51128
|
+
var watchlistMap = watchlist.reduce(function (memo, id) {
|
|
51129
|
+
var _a;
|
|
51130
|
+
return (__assign(__assign({}, memo), (_a = {}, _a[id] = true, _a)));
|
|
51131
|
+
}, {});
|
|
51132
|
+
// make sure to initiate registries for the given asset code
|
|
51133
|
+
// to prevent 'Cannot read properties of undefined' errors
|
|
51134
|
+
if (!this._transactionsRegistry[assetCode]) {
|
|
51135
|
+
this._transactionsRegistry[assetCode] = {};
|
|
51136
|
+
}
|
|
51137
|
+
if (!this._transactionsIgnoredRegistry[assetCode]) {
|
|
51138
|
+
this._transactionsIgnoredRegistry[assetCode] = {};
|
|
51139
|
+
}
|
|
51140
|
+
// if it's a first run, drop it in the registry for the given asset code
|
|
51141
|
+
if (!isRetry) {
|
|
51142
|
+
this._watchAllTransactionsRegistry[assetCode] = true;
|
|
51143
|
+
}
|
|
51144
|
+
this.anchor.getTransactionsForAsset(__assign({ authToken: authToken, assetCode: assetCode, lang: lang }, otherParams))
|
|
51145
|
+
.then(function (transactions) {
|
|
51146
|
+
// make sure we're still watching
|
|
51147
|
+
if (!_this._watchAllTransactionsRegistry[assetCode]) {
|
|
51148
|
+
return;
|
|
51149
|
+
}
|
|
51150
|
+
try {
|
|
51151
|
+
var newTransactions = transactions.filter(function (transaction) {
|
|
51152
|
+
var isInProgress = transaction.status.indexOf("pending") === 0 ||
|
|
51153
|
+
transaction.status === Types_1.TransactionStatus.incomplete;
|
|
51154
|
+
var registeredTransaction = _this._transactionsRegistry[assetCode][transaction.id];
|
|
51155
|
+
// if this is the first watch, only keep the pending ones
|
|
51156
|
+
if (!isRetry) {
|
|
51157
|
+
// always show transactions on the watchlist
|
|
51158
|
+
if (watchlistMap[transaction.id]) {
|
|
51159
|
+
return true;
|
|
51160
|
+
}
|
|
51161
|
+
// if we're not in progress, then save this in an ignore reg
|
|
51162
|
+
if (!isInProgress) {
|
|
51163
|
+
_this._transactionsIgnoredRegistry[assetCode][transaction.id] = transaction;
|
|
51164
|
+
}
|
|
51165
|
+
return isInProgress;
|
|
51166
|
+
}
|
|
51167
|
+
// if we've had the transaction before, only report updates
|
|
51168
|
+
if (registeredTransaction) {
|
|
51169
|
+
return !(0, isEqual_1.default)(registeredTransaction, transaction);
|
|
51170
|
+
}
|
|
51171
|
+
// if it's NOT a registered transaction, and it's not the first
|
|
51172
|
+
// roll, maybe it's a new transaction that achieved a final
|
|
51173
|
+
// status immediately so register that!
|
|
51174
|
+
if ([
|
|
51175
|
+
Types_1.TransactionStatus.completed,
|
|
51176
|
+
Types_1.TransactionStatus.refunded,
|
|
51177
|
+
Types_1.TransactionStatus.expired,
|
|
51178
|
+
Types_1.TransactionStatus.error,
|
|
51179
|
+
].includes(transaction.status) &&
|
|
51180
|
+
isRetry &&
|
|
51181
|
+
!_this._transactionsIgnoredRegistry[assetCode][transaction.id]) {
|
|
51182
|
+
return true;
|
|
51183
|
+
}
|
|
51184
|
+
// always use in progress transactions
|
|
51185
|
+
if (isInProgress) {
|
|
51186
|
+
return true;
|
|
51187
|
+
}
|
|
51188
|
+
return false;
|
|
51189
|
+
});
|
|
51190
|
+
newTransactions.forEach(function (transaction) {
|
|
51191
|
+
_this._transactionsRegistry[assetCode][transaction.id] = transaction;
|
|
51192
|
+
if (transaction.status === Types_1.TransactionStatus.error) {
|
|
51193
|
+
onError(transaction);
|
|
51194
|
+
}
|
|
51195
|
+
else {
|
|
51196
|
+
onMessage(transaction);
|
|
51197
|
+
}
|
|
51198
|
+
});
|
|
51199
|
+
}
|
|
51200
|
+
catch (e) {
|
|
51201
|
+
onError(e);
|
|
51202
|
+
return;
|
|
51203
|
+
}
|
|
51204
|
+
// call it again
|
|
51205
|
+
if (_this._allTransactionsWatcher) {
|
|
51206
|
+
clearTimeout(_this._allTransactionsWatcher);
|
|
51207
|
+
}
|
|
51208
|
+
_this._allTransactionsWatcher = setTimeout(function () {
|
|
51209
|
+
_this.watchAllTransactions(__assign(__assign({}, params), { isRetry: true }));
|
|
51210
|
+
}, timeout);
|
|
51211
|
+
})
|
|
51212
|
+
.catch(function (e) {
|
|
51213
|
+
onError(e);
|
|
51214
|
+
});
|
|
51215
|
+
return {
|
|
51216
|
+
refresh: function () {
|
|
51217
|
+
// don't do that if we stopped watching
|
|
51218
|
+
if (!_this._watchAllTransactionsRegistry[assetCode]) {
|
|
51219
|
+
return;
|
|
51220
|
+
}
|
|
51221
|
+
if (_this._allTransactionsWatcher) {
|
|
51222
|
+
clearTimeout(_this._allTransactionsWatcher);
|
|
51223
|
+
}
|
|
51224
|
+
_this.watchAllTransactions(__assign(__assign({}, params), { isRetry: true }));
|
|
51225
|
+
},
|
|
51226
|
+
stop: function () {
|
|
51227
|
+
if (_this._allTransactionsWatcher) {
|
|
51228
|
+
_this._watchAllTransactionsRegistry[assetCode] = false;
|
|
51229
|
+
_this._transactionsRegistry[assetCode] = {};
|
|
51230
|
+
_this._transactionsIgnoredRegistry[assetCode] = {};
|
|
51231
|
+
clearTimeout(_this._allTransactionsWatcher);
|
|
51232
|
+
}
|
|
51233
|
+
},
|
|
51234
|
+
};
|
|
51235
|
+
};
|
|
51236
|
+
/**
|
|
51237
|
+
* Watch a transaction until it stops pending. Takes three callbacks:
|
|
51238
|
+
* * onMessage - When the transaction comes back as pending_ or incomplete.
|
|
51239
|
+
* * onSuccess - When the transaction comes back as completed / refunded / expired.
|
|
51240
|
+
* * onError - When there's a runtime error, or the transaction comes back as
|
|
51241
|
+
* no_market / too_small / too_large / error.
|
|
51242
|
+
*/
|
|
51243
|
+
Watcher.prototype.watchOneTransaction = function (params) {
|
|
51244
|
+
var _a;
|
|
51245
|
+
var _this = this;
|
|
51246
|
+
var authToken = params.authToken, assetCode = params.assetCode, id = params.id, onMessage = params.onMessage, onSuccess = params.onSuccess, onError = params.onError, _b = params.timeout, timeout = _b === void 0 ? 5000 : _b, _c = params.isRetry, isRetry = _c === void 0 ? false : _c, _d = params.lang, lang = _d === void 0 ? this.anchor.language : _d;
|
|
51247
|
+
// make sure to initiate registries for the given asset code
|
|
51248
|
+
// to prevent 'Cannot read properties of undefined' errors
|
|
51249
|
+
if (!this._transactionsRegistry[assetCode]) {
|
|
51250
|
+
this._transactionsRegistry[assetCode] = {};
|
|
51251
|
+
}
|
|
51252
|
+
if (!this._oneTransactionWatcher[assetCode]) {
|
|
51253
|
+
this._oneTransactionWatcher[assetCode] = {};
|
|
51254
|
+
}
|
|
51255
|
+
// if it's a first run, drop it in the registry for the given asset code
|
|
51256
|
+
if (!isRetry) {
|
|
51257
|
+
this._watchOneTransactionRegistry[assetCode] = __assign(__assign({}, (this._watchOneTransactionRegistry[assetCode] || {})), (_a = {}, _a[id] = true, _a));
|
|
51258
|
+
}
|
|
51259
|
+
// do this all asynchronously (since this func needs to return a cancel fun)
|
|
51260
|
+
this.anchor.getTransactionBy({ authToken: authToken, id: id, lang: lang })
|
|
51261
|
+
.then(function (transaction) {
|
|
51262
|
+
var _a;
|
|
51263
|
+
// make sure we're still watching
|
|
51264
|
+
if (!((_a = _this._watchOneTransactionRegistry[assetCode]) === null || _a === void 0 ? void 0 : _a[id])) {
|
|
51265
|
+
return;
|
|
51266
|
+
}
|
|
51267
|
+
var registeredTransaction = _this._transactionsRegistry[assetCode][transaction.id];
|
|
51268
|
+
// if we've had the transaction before, only report if there is a change
|
|
51269
|
+
if (registeredTransaction &&
|
|
51270
|
+
(0, isEqual_1.default)(registeredTransaction, transaction)) {
|
|
51271
|
+
return;
|
|
51272
|
+
}
|
|
51273
|
+
_this._transactionsRegistry[assetCode][transaction.id] = transaction;
|
|
51274
|
+
if (transaction.status.indexOf("pending") === 0 ||
|
|
51275
|
+
transaction.status === Types_1.TransactionStatus.incomplete) {
|
|
51276
|
+
if (_this._oneTransactionWatcher[assetCode][id]) {
|
|
51277
|
+
clearTimeout(_this._oneTransactionWatcher[assetCode][id]);
|
|
51278
|
+
}
|
|
51279
|
+
_this._oneTransactionWatcher[assetCode][id] = setTimeout(function () {
|
|
51280
|
+
_this.watchOneTransaction(__assign(__assign({}, params), { isRetry: true }));
|
|
51281
|
+
}, timeout);
|
|
51282
|
+
onMessage(transaction);
|
|
51283
|
+
}
|
|
51284
|
+
else if ([
|
|
51285
|
+
Types_1.TransactionStatus.completed,
|
|
51286
|
+
Types_1.TransactionStatus.refunded,
|
|
51287
|
+
Types_1.TransactionStatus.expired
|
|
51288
|
+
].includes(transaction.status)) {
|
|
51289
|
+
onSuccess(transaction);
|
|
51290
|
+
}
|
|
51291
|
+
else {
|
|
51292
|
+
onError(transaction);
|
|
51293
|
+
}
|
|
51294
|
+
})
|
|
51295
|
+
.catch(function (e) {
|
|
51296
|
+
onError(e);
|
|
51297
|
+
});
|
|
51298
|
+
return {
|
|
51299
|
+
refresh: function () {
|
|
51300
|
+
var _a;
|
|
51301
|
+
// don't do that if we stopped watching
|
|
51302
|
+
if (!((_a = _this._watchOneTransactionRegistry[assetCode]) === null || _a === void 0 ? void 0 : _a[id])) {
|
|
51303
|
+
return;
|
|
51304
|
+
}
|
|
51305
|
+
if (_this._oneTransactionWatcher[assetCode][id]) {
|
|
51306
|
+
clearTimeout(_this._oneTransactionWatcher[assetCode][id]);
|
|
51307
|
+
}
|
|
51308
|
+
_this.watchOneTransaction(__assign(__assign({}, params), { isRetry: true }));
|
|
51309
|
+
},
|
|
51310
|
+
stop: function () {
|
|
51311
|
+
if (_this._oneTransactionWatcher[assetCode][id]) {
|
|
51312
|
+
_this._watchOneTransactionRegistry[assetCode][id] = false;
|
|
51313
|
+
clearTimeout(_this._oneTransactionWatcher[assetCode][id]);
|
|
51314
|
+
}
|
|
51315
|
+
},
|
|
51316
|
+
};
|
|
51317
|
+
};
|
|
51318
|
+
return Watcher;
|
|
51319
|
+
}());
|
|
51320
|
+
exports.Watcher = Watcher;
|
|
51321
|
+
|
|
51322
|
+
|
|
50064
51323
|
/***/ }),
|
|
50065
51324
|
|
|
50066
51325
|
/***/ "./src/walletSdk/exception/index.ts":
|
|
@@ -50087,11 +51346,11 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
50087
51346
|
};
|
|
50088
51347
|
})();
|
|
50089
51348
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
50090
|
-
exports.ClientDomainWithMemoError = exports.InvalidMemoError = exports.AssetNotSupportedError = exports.ServerRequestFailedError = void 0;
|
|
51349
|
+
exports.InvalidTransactionsResponseError = exports.InvalidTransactionResponseError = exports.MissingTransactionIdError = exports.ClientDomainWithMemoError = exports.InvalidMemoError = exports.AssetNotSupportedError = exports.ServerRequestFailedError = void 0;
|
|
50091
51350
|
var ServerRequestFailedError = /** @class */ (function (_super) {
|
|
50092
51351
|
__extends(ServerRequestFailedError, _super);
|
|
50093
51352
|
function ServerRequestFailedError(e) {
|
|
50094
|
-
var _this = _super.call(this, "
|
|
51353
|
+
var _this = _super.call(this, "Server request failed with error: ".concat(e)) || this;
|
|
50095
51354
|
Object.setPrototypeOf(_this, ServerRequestFailedError.prototype);
|
|
50096
51355
|
return _this;
|
|
50097
51356
|
}
|
|
@@ -50101,7 +51360,7 @@ exports.ServerRequestFailedError = ServerRequestFailedError;
|
|
|
50101
51360
|
var AssetNotSupportedError = /** @class */ (function (_super) {
|
|
50102
51361
|
__extends(AssetNotSupportedError, _super);
|
|
50103
51362
|
function AssetNotSupportedError(type, assetCode) {
|
|
50104
|
-
var _this = _super.call(this, "
|
|
51363
|
+
var _this = _super.call(this, "Asset ".concat(assetCode, " not supported") + (type ? " for ".concat(type) : "")) || this;
|
|
50105
51364
|
Object.setPrototypeOf(_this, AssetNotSupportedError.prototype);
|
|
50106
51365
|
return _this;
|
|
50107
51366
|
}
|
|
@@ -50128,6 +51387,36 @@ var ClientDomainWithMemoError = /** @class */ (function (_super) {
|
|
|
50128
51387
|
return ClientDomainWithMemoError;
|
|
50129
51388
|
}(Error));
|
|
50130
51389
|
exports.ClientDomainWithMemoError = ClientDomainWithMemoError;
|
|
51390
|
+
var MissingTransactionIdError = /** @class */ (function (_super) {
|
|
51391
|
+
__extends(MissingTransactionIdError, _super);
|
|
51392
|
+
function MissingTransactionIdError() {
|
|
51393
|
+
var _this = _super.call(this, "One of id, stellarTransactionId or externalTransactionId is required") || this;
|
|
51394
|
+
Object.setPrototypeOf(_this, MissingTransactionIdError.prototype);
|
|
51395
|
+
return _this;
|
|
51396
|
+
}
|
|
51397
|
+
return MissingTransactionIdError;
|
|
51398
|
+
}(Error));
|
|
51399
|
+
exports.MissingTransactionIdError = MissingTransactionIdError;
|
|
51400
|
+
var InvalidTransactionResponseError = /** @class */ (function (_super) {
|
|
51401
|
+
__extends(InvalidTransactionResponseError, _super);
|
|
51402
|
+
function InvalidTransactionResponseError(transactionResponse) {
|
|
51403
|
+
var _this = _super.call(this, "Invalid transaction in response data: ".concat(JSON.stringify(transactionResponse))) || this;
|
|
51404
|
+
Object.setPrototypeOf(_this, InvalidTransactionResponseError.prototype);
|
|
51405
|
+
return _this;
|
|
51406
|
+
}
|
|
51407
|
+
return InvalidTransactionResponseError;
|
|
51408
|
+
}(Error));
|
|
51409
|
+
exports.InvalidTransactionResponseError = InvalidTransactionResponseError;
|
|
51410
|
+
var InvalidTransactionsResponseError = /** @class */ (function (_super) {
|
|
51411
|
+
__extends(InvalidTransactionsResponseError, _super);
|
|
51412
|
+
function InvalidTransactionsResponseError(transactionsResponse) {
|
|
51413
|
+
var _this = _super.call(this, "Invalid transactions in response data: ".concat(JSON.stringify(transactionsResponse))) || this;
|
|
51414
|
+
Object.setPrototypeOf(_this, InvalidTransactionsResponseError.prototype);
|
|
51415
|
+
return _this;
|
|
51416
|
+
}
|
|
51417
|
+
return InvalidTransactionsResponseError;
|
|
51418
|
+
}(Error));
|
|
51419
|
+
exports.InvalidTransactionsResponseError = InvalidTransactionsResponseError;
|
|
50131
51420
|
|
|
50132
51421
|
|
|
50133
51422
|
/***/ }),
|
|
@@ -50177,24 +51466,40 @@ var NETWORK_URLS;
|
|
|
50177
51466
|
/*!********************************!*\
|
|
50178
51467
|
!*** ./src/walletSdk/index.ts ***!
|
|
50179
51468
|
\********************************/
|
|
50180
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
51469
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
50181
51470
|
|
|
50182
51471
|
"use strict";
|
|
50183
51472
|
|
|
51473
|
+
var __assign = (this && this.__assign) || function () {
|
|
51474
|
+
__assign = Object.assign || function(t) {
|
|
51475
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
51476
|
+
s = arguments[i];
|
|
51477
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
51478
|
+
t[p] = s[p];
|
|
51479
|
+
}
|
|
51480
|
+
return t;
|
|
51481
|
+
};
|
|
51482
|
+
return __assign.apply(this, arguments);
|
|
51483
|
+
};
|
|
51484
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51485
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51486
|
+
};
|
|
50184
51487
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
50185
|
-
exports.ApplicationConfiguration = exports.StellarConfiguration = exports.Wallet = void 0;
|
|
51488
|
+
exports.ApplicationConfiguration = exports.StellarConfiguration = exports.Wallet = exports.Config = void 0;
|
|
50186
51489
|
var stellar_sdk_1 = __webpack_require__(/*! stellar-sdk */ "./node_modules/stellar-sdk/lib/index.js");
|
|
51490
|
+
var axios_1 = __importDefault(__webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs"));
|
|
50187
51491
|
var Anchor_1 = __webpack_require__(/*! ./Anchor */ "./src/walletSdk/Anchor/index.ts");
|
|
50188
51492
|
var WalletSigner_1 = __webpack_require__(/*! ./Auth/WalletSigner */ "./src/walletSdk/Auth/WalletSigner.ts");
|
|
50189
51493
|
var Stellar_1 = __webpack_require__(/*! ./horizon/Stellar */ "./src/walletSdk/horizon/Stellar.ts");
|
|
50190
51494
|
var constants_1 = __webpack_require__(/*! ./horizon/constants */ "./src/walletSdk/horizon/constants.ts");
|
|
50191
51495
|
var Recovery_1 = __webpack_require__(/*! ./recovery/Recovery */ "./src/walletSdk/recovery/Recovery.ts");
|
|
50192
51496
|
var url_1 = __webpack_require__(/*! ./util/url */ "./src/walletSdk/util/url.ts");
|
|
50193
|
-
var
|
|
50194
|
-
|
|
50195
|
-
|
|
50196
|
-
|
|
50197
|
-
|
|
51497
|
+
/* tslint:disable-next-line:no-var-requires */
|
|
51498
|
+
var version = (__webpack_require__(/*! ../../package.json */ "./package.json").version);
|
|
51499
|
+
var walletHeaders = {
|
|
51500
|
+
"X-Client-Name": "typescript-wallet-sdk",
|
|
51501
|
+
"X-Client-Version": version,
|
|
51502
|
+
};
|
|
50198
51503
|
var Config = /** @class */ (function () {
|
|
50199
51504
|
function Config(stellarCfg, appCfg) {
|
|
50200
51505
|
this.stellar = stellarCfg;
|
|
@@ -50202,30 +51507,37 @@ var Config = /** @class */ (function () {
|
|
|
50202
51507
|
}
|
|
50203
51508
|
return Config;
|
|
50204
51509
|
}());
|
|
51510
|
+
exports.Config = Config;
|
|
50205
51511
|
var Wallet = exports.Wallet = /** @class */ (function () {
|
|
50206
|
-
function Wallet(stellarConfiguration, applicationConfiguration
|
|
51512
|
+
function Wallet(stellarConfiguration, applicationConfiguration,
|
|
51513
|
+
// Defaults wallet language to "en", this will reflect in all Anchor API calls
|
|
51514
|
+
language) {
|
|
50207
51515
|
if (applicationConfiguration === void 0) { applicationConfiguration = new ApplicationConfiguration(); }
|
|
50208
|
-
|
|
51516
|
+
if (language === void 0) { language = "en"; }
|
|
50209
51517
|
this.cfg = new Config(stellarConfiguration, applicationConfiguration);
|
|
51518
|
+
this.language = language;
|
|
50210
51519
|
}
|
|
50211
|
-
Wallet.prototype.anchor = function (homeDomain, httpClientConfig) {
|
|
50212
|
-
if (httpClientConfig === void 0) { httpClientConfig =
|
|
51520
|
+
Wallet.prototype.anchor = function (homeDomain, httpClientConfig, language) {
|
|
51521
|
+
if (httpClientConfig === void 0) { httpClientConfig = {}; }
|
|
51522
|
+
if (language === void 0) { language = this.language; }
|
|
50213
51523
|
var url = homeDomain.indexOf("://") !== -1 ? homeDomain : "https://".concat(homeDomain);
|
|
50214
|
-
return new Anchor_1.Anchor(
|
|
51524
|
+
return new Anchor_1.Anchor({
|
|
51525
|
+
cfg: this.cfg,
|
|
51526
|
+
homeDomain: (0, url_1.getUrlDomain)(url),
|
|
51527
|
+
httpClient: this.getClient(httpClientConfig),
|
|
51528
|
+
language: language,
|
|
51529
|
+
});
|
|
50215
51530
|
};
|
|
50216
51531
|
Wallet.prototype.stellar = function () {
|
|
50217
51532
|
return new Stellar_1.Stellar(this.cfg);
|
|
50218
51533
|
};
|
|
50219
51534
|
Wallet.prototype.recover = function (servers, httpClientConfig) {
|
|
51535
|
+
if (httpClientConfig === void 0) { httpClientConfig = {}; }
|
|
50220
51536
|
return new Recovery_1.Recovery(this.cfg, this.stellar(), this.getClient(httpClientConfig), servers);
|
|
50221
51537
|
};
|
|
50222
51538
|
Wallet.prototype.getClient = function (httpClientConfig) {
|
|
50223
|
-
|
|
50224
|
-
|
|
50225
|
-
if (httpClient) {
|
|
50226
|
-
this.clients.push(httpClient);
|
|
50227
|
-
}
|
|
50228
|
-
return httpClient ? httpClient : this.cfg.app.defaultClient;
|
|
51539
|
+
if (httpClientConfig === void 0) { httpClientConfig = {}; }
|
|
51540
|
+
return axios_1.default.create(__assign({ headers: __assign(__assign({}, walletHeaders), httpClientConfig.headers) }, httpClientConfig));
|
|
50229
51541
|
};
|
|
50230
51542
|
Wallet.TestNet = function () {
|
|
50231
51543
|
return new Wallet(StellarConfiguration.TestNet());
|
|
@@ -50252,12 +51564,12 @@ var StellarConfiguration = exports.StellarConfiguration = /** @class */ (functio
|
|
|
50252
51564
|
return StellarConfiguration;
|
|
50253
51565
|
}());
|
|
50254
51566
|
var ApplicationConfiguration = /** @class */ (function () {
|
|
50255
|
-
function ApplicationConfiguration(defaultSigner
|
|
51567
|
+
function ApplicationConfiguration(defaultSigner) {
|
|
50256
51568
|
if (defaultSigner === void 0) { defaultSigner = WalletSigner_1.DefaultSigner; }
|
|
50257
|
-
if (defaultCliengConfig === void 0) { defaultCliengConfig = {}; }
|
|
50258
51569
|
this.defaultSigner = defaultSigner;
|
|
50259
|
-
|
|
50260
|
-
|
|
51570
|
+
this.defaultClient = axios_1.default.create({
|
|
51571
|
+
headers: __assign({}, walletHeaders),
|
|
51572
|
+
});
|
|
50261
51573
|
}
|
|
50262
51574
|
return ApplicationConfiguration;
|
|
50263
51575
|
}());
|
|
@@ -50321,12 +51633,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50321
51633
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50322
51634
|
}
|
|
50323
51635
|
};
|
|
50324
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50325
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50326
|
-
};
|
|
50327
51636
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
50328
51637
|
exports.Interactive = exports.FLOW_TYPE = void 0;
|
|
50329
|
-
var axios_1 = __importDefault(__webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs"));
|
|
50330
51638
|
var exception_1 = __webpack_require__(/*! ../exception */ "./src/walletSdk/exception/index.ts");
|
|
50331
51639
|
var FLOW_TYPE;
|
|
50332
51640
|
(function (FLOW_TYPE) {
|
|
@@ -50335,44 +51643,45 @@ var FLOW_TYPE;
|
|
|
50335
51643
|
})(FLOW_TYPE = exports.FLOW_TYPE || (exports.FLOW_TYPE = {}));
|
|
50336
51644
|
// Do not create this object directly, use the Wallet class.
|
|
50337
51645
|
var Interactive = /** @class */ (function () {
|
|
50338
|
-
function Interactive(homeDomain, anchor) {
|
|
50339
|
-
this.homeDomain = "";
|
|
50340
|
-
this.anchor = null;
|
|
51646
|
+
function Interactive(homeDomain, anchor, httpClient) {
|
|
50341
51647
|
this.homeDomain = homeDomain;
|
|
50342
51648
|
this.anchor = anchor;
|
|
51649
|
+
this.httpClient = httpClient;
|
|
50343
51650
|
}
|
|
50344
|
-
Interactive.prototype.deposit = function (
|
|
51651
|
+
Interactive.prototype.deposit = function (params) {
|
|
50345
51652
|
return __awaiter(this, void 0, void 0, function () {
|
|
50346
51653
|
return __generator(this, function (_a) {
|
|
50347
51654
|
switch (_a.label) {
|
|
50348
|
-
case 0: return [4 /*yield*/, this.flow(
|
|
51655
|
+
case 0: return [4 /*yield*/, this.flow(__assign(__assign({}, params), { type: FLOW_TYPE.DEPOSIT }))];
|
|
50349
51656
|
case 1: return [2 /*return*/, _a.sent()];
|
|
50350
51657
|
}
|
|
50351
51658
|
});
|
|
50352
51659
|
});
|
|
50353
51660
|
};
|
|
50354
|
-
Interactive.prototype.withdraw = function (
|
|
51661
|
+
Interactive.prototype.withdraw = function (params) {
|
|
50355
51662
|
return __awaiter(this, void 0, void 0, function () {
|
|
50356
51663
|
return __generator(this, function (_a) {
|
|
50357
51664
|
switch (_a.label) {
|
|
50358
|
-
case 0: return [4 /*yield*/, this.flow(
|
|
51665
|
+
case 0: return [4 /*yield*/, this.flow(__assign(__assign({}, params), { type: FLOW_TYPE.WITHDRAW }))];
|
|
50359
51666
|
case 1: return [2 /*return*/, _a.sent()];
|
|
50360
51667
|
}
|
|
50361
51668
|
});
|
|
50362
51669
|
});
|
|
50363
51670
|
};
|
|
50364
|
-
Interactive.prototype.flow = function (
|
|
51671
|
+
Interactive.prototype.flow = function (params) {
|
|
50365
51672
|
return __awaiter(this, void 0, void 0, function () {
|
|
50366
|
-
var toml, transferServerEndpoint, serviceInfo, assets, resp, e_1;
|
|
50367
|
-
return __generator(this, function (
|
|
50368
|
-
switch (
|
|
50369
|
-
case 0:
|
|
51673
|
+
var accountAddress, assetCode, authToken, _a, lang, extraFields, _b, fundsAccountAddress, type, toml, transferServerEndpoint, serviceInfo, assets, resp, e_1;
|
|
51674
|
+
return __generator(this, function (_c) {
|
|
51675
|
+
switch (_c.label) {
|
|
51676
|
+
case 0:
|
|
51677
|
+
accountAddress = params.accountAddress, assetCode = params.assetCode, authToken = params.authToken, _a = params.lang, lang = _a === void 0 ? this.anchor.language : _a, extraFields = params.extraFields, _b = params.fundsAccountAddress, fundsAccountAddress = _b === void 0 ? accountAddress : _b, type = params.type;
|
|
51678
|
+
return [4 /*yield*/, this.anchor.getInfo()];
|
|
50370
51679
|
case 1:
|
|
50371
|
-
toml =
|
|
51680
|
+
toml = _c.sent();
|
|
50372
51681
|
transferServerEndpoint = toml.transferServerSep24;
|
|
50373
51682
|
return [4 /*yield*/, this.anchor.getServicesInfo()];
|
|
50374
51683
|
case 2:
|
|
50375
|
-
serviceInfo =
|
|
51684
|
+
serviceInfo = _c.sent();
|
|
50376
51685
|
if (type === FLOW_TYPE.DEPOSIT) {
|
|
50377
51686
|
assets = Object.keys(serviceInfo.deposit);
|
|
50378
51687
|
}
|
|
@@ -50382,20 +51691,20 @@ var Interactive = /** @class */ (function () {
|
|
|
50382
51691
|
if (!assets.includes(assetCode)) {
|
|
50383
51692
|
throw new exception_1.AssetNotSupportedError(type, assetCode);
|
|
50384
51693
|
}
|
|
50385
|
-
|
|
51694
|
+
_c.label = 3;
|
|
50386
51695
|
case 3:
|
|
50387
|
-
|
|
50388
|
-
return [4 /*yield*/,
|
|
51696
|
+
_c.trys.push([3, 5, , 6]);
|
|
51697
|
+
return [4 /*yield*/, this.httpClient.post("".concat(transferServerEndpoint, "/transactions/").concat(type, "/interactive"), __assign({ asset_code: assetCode, lang: lang, account: fundsAccountAddress }, extraFields), {
|
|
50389
51698
|
headers: {
|
|
50390
51699
|
"Content-Type": "application/json",
|
|
50391
51700
|
Authorization: "Bearer ".concat(authToken),
|
|
50392
51701
|
},
|
|
50393
51702
|
})];
|
|
50394
51703
|
case 4:
|
|
50395
|
-
resp =
|
|
51704
|
+
resp = _c.sent();
|
|
50396
51705
|
return [2 /*return*/, resp.data];
|
|
50397
51706
|
case 5:
|
|
50398
|
-
e_1 =
|
|
51707
|
+
e_1 = _c.sent();
|
|
50399
51708
|
throw new exception_1.ServerRequestFailedError(e_1);
|
|
50400
51709
|
case 6: return [2 /*return*/];
|
|
50401
51710
|
}
|
|
@@ -50537,6 +51846,35 @@ var parseToml = function (toml) {
|
|
|
50537
51846
|
exports.parseToml = parseToml;
|
|
50538
51847
|
|
|
50539
51848
|
|
|
51849
|
+
/***/ }),
|
|
51850
|
+
|
|
51851
|
+
/***/ "./src/walletSdk/util/camelToSnakeCase.ts":
|
|
51852
|
+
/*!************************************************!*\
|
|
51853
|
+
!*** ./src/walletSdk/util/camelToSnakeCase.ts ***!
|
|
51854
|
+
\************************************************/
|
|
51855
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
51856
|
+
|
|
51857
|
+
"use strict";
|
|
51858
|
+
|
|
51859
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51860
|
+
exports.camelToSnakeCaseObject = exports.camelToSnakeCaseKey = void 0;
|
|
51861
|
+
var camelToSnakeCaseKey = function (key) {
|
|
51862
|
+
return key.replace(/[A-Z]/g, function (upperCaseLetter) { return "_".concat(upperCaseLetter.toLowerCase()); });
|
|
51863
|
+
};
|
|
51864
|
+
exports.camelToSnakeCaseKey = camelToSnakeCaseKey;
|
|
51865
|
+
var camelToSnakeCaseObject = function (obj) {
|
|
51866
|
+
var snakeCasedObj = {};
|
|
51867
|
+
for (var key in obj) {
|
|
51868
|
+
if (obj.hasOwnProperty(key)) {
|
|
51869
|
+
var snakeCaseKey = (0, exports.camelToSnakeCaseKey)(key);
|
|
51870
|
+
snakeCasedObj[snakeCaseKey] = obj[key];
|
|
51871
|
+
}
|
|
51872
|
+
}
|
|
51873
|
+
return snakeCasedObj;
|
|
51874
|
+
};
|
|
51875
|
+
exports.camelToSnakeCaseObject = camelToSnakeCaseObject;
|
|
51876
|
+
|
|
51877
|
+
|
|
50540
51878
|
/***/ }),
|
|
50541
51879
|
|
|
50542
51880
|
/***/ "./src/walletSdk/util/url.ts":
|
|
@@ -58960,7 +60298,7 @@ module.exports = function availableTypedArrays() {
|
|
|
58960
60298
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
58961
60299
|
|
|
58962
60300
|
"use strict";
|
|
58963
|
-
// Axios v1.
|
|
60301
|
+
// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
|
58964
60302
|
|
|
58965
60303
|
|
|
58966
60304
|
function bind(fn, thisArg) {
|
|
@@ -59155,12 +60493,16 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
|
59155
60493
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
59156
60494
|
*/
|
|
59157
60495
|
const isFormData = (thing) => {
|
|
59158
|
-
|
|
60496
|
+
let kind;
|
|
59159
60497
|
return thing && (
|
|
59160
|
-
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
59161
|
-
|
|
59162
|
-
|
|
59163
|
-
|
|
60498
|
+
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
60499
|
+
isFunction(thing.append) && (
|
|
60500
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
|
60501
|
+
// detect form-data instance
|
|
60502
|
+
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
60503
|
+
)
|
|
60504
|
+
)
|
|
60505
|
+
)
|
|
59164
60506
|
};
|
|
59165
60507
|
|
|
59166
60508
|
/**
|
|
@@ -59625,6 +60967,11 @@ const toJSONObject = (obj) => {
|
|
|
59625
60967
|
return visit(obj, 0);
|
|
59626
60968
|
};
|
|
59627
60969
|
|
|
60970
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
60971
|
+
|
|
60972
|
+
const isThenable = (thing) =>
|
|
60973
|
+
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
60974
|
+
|
|
59628
60975
|
var utils = {
|
|
59629
60976
|
isArray,
|
|
59630
60977
|
isArrayBuffer,
|
|
@@ -59674,7 +61021,9 @@ var utils = {
|
|
|
59674
61021
|
ALPHABET,
|
|
59675
61022
|
generateString,
|
|
59676
61023
|
isSpecCompliantForm,
|
|
59677
|
-
toJSONObject
|
|
61024
|
+
toJSONObject,
|
|
61025
|
+
isAsyncFn,
|
|
61026
|
+
isThenable
|
|
59678
61027
|
};
|
|
59679
61028
|
|
|
59680
61029
|
/**
|
|
@@ -60176,6 +61525,8 @@ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams
|
|
|
60176
61525
|
|
|
60177
61526
|
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
60178
61527
|
|
|
61528
|
+
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
61529
|
+
|
|
60179
61530
|
/**
|
|
60180
61531
|
* Determine if we're running in a standard browser environment
|
|
60181
61532
|
*
|
|
@@ -60230,7 +61581,7 @@ var platform = {
|
|
|
60230
61581
|
classes: {
|
|
60231
61582
|
URLSearchParams: URLSearchParams$1,
|
|
60232
61583
|
FormData: FormData$1,
|
|
60233
|
-
Blob
|
|
61584
|
+
Blob: Blob$1
|
|
60234
61585
|
},
|
|
60235
61586
|
isStandardBrowserEnv,
|
|
60236
61587
|
isStandardBrowserWebWorkerEnv,
|
|
@@ -60572,9 +61923,7 @@ function parseTokens(str) {
|
|
|
60572
61923
|
return tokens;
|
|
60573
61924
|
}
|
|
60574
61925
|
|
|
60575
|
-
|
|
60576
|
-
return /^[-_a-zA-Z]+$/.test(str.trim());
|
|
60577
|
-
}
|
|
61926
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
60578
61927
|
|
|
60579
61928
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
60580
61929
|
if (utils.isFunction(filter)) {
|
|
@@ -61162,8 +62511,12 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
61162
62511
|
}
|
|
61163
62512
|
}
|
|
61164
62513
|
|
|
61165
|
-
if (utils.isFormData(requestData)
|
|
61166
|
-
|
|
62514
|
+
if (utils.isFormData(requestData)) {
|
|
62515
|
+
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
|
62516
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
|
62517
|
+
} else {
|
|
62518
|
+
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
|
62519
|
+
}
|
|
61167
62520
|
}
|
|
61168
62521
|
|
|
61169
62522
|
let request = new XMLHttpRequest();
|
|
@@ -61569,7 +62922,7 @@ function mergeConfig(config1, config2) {
|
|
|
61569
62922
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
61570
62923
|
};
|
|
61571
62924
|
|
|
61572
|
-
utils.forEach(Object.keys(
|
|
62925
|
+
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
61573
62926
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
61574
62927
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
61575
62928
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -61578,7 +62931,7 @@ function mergeConfig(config1, config2) {
|
|
|
61578
62931
|
return config;
|
|
61579
62932
|
}
|
|
61580
62933
|
|
|
61581
|
-
const VERSION = "1.
|
|
62934
|
+
const VERSION = "1.4.0";
|
|
61582
62935
|
|
|
61583
62936
|
const validators$1 = {};
|
|
61584
62937
|
|
|
@@ -61715,11 +63068,17 @@ class Axios {
|
|
|
61715
63068
|
}, false);
|
|
61716
63069
|
}
|
|
61717
63070
|
|
|
61718
|
-
if (paramsSerializer
|
|
61719
|
-
|
|
61720
|
-
|
|
61721
|
-
|
|
61722
|
-
|
|
63071
|
+
if (paramsSerializer != null) {
|
|
63072
|
+
if (utils.isFunction(paramsSerializer)) {
|
|
63073
|
+
config.paramsSerializer = {
|
|
63074
|
+
serialize: paramsSerializer
|
|
63075
|
+
};
|
|
63076
|
+
} else {
|
|
63077
|
+
validator.assertOptions(paramsSerializer, {
|
|
63078
|
+
encode: validators.function,
|
|
63079
|
+
serialize: validators.function
|
|
63080
|
+
}, true);
|
|
63081
|
+
}
|
|
61723
63082
|
}
|
|
61724
63083
|
|
|
61725
63084
|
// Set config.method
|
|
@@ -62162,6 +63521,17 @@ module.exports = axios;
|
|
|
62162
63521
|
"use strict";
|
|
62163
63522
|
module.exports = JSON.parse('{"name":"stellar-sdk","version":"10.4.1","description":"stellar-sdk is a library for working with the Stellar Horizon server.","main":"./lib/index.js","types":"./lib/index.d.ts","files":["/types","/lib","/dist"],"scripts":{"prepare":"gulp build","test":"babel-node ./node_modules/.bin/gulp test","test:watch":"babel-node ./node_modules/.bin/gulp test:watch","build:docs":"gulp build:docs","docs":"yarn build:docs && jsdoc -c .jsdoc.json","preversion":"gulp test","version":"gulp build","postversion":"git push && git push --tags","prettier-all":"prettier --write **/*.{js,ts}"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"prettier":"@stellar/prettier-config","lint-staged":{"lib/*.{js,json}":["prettier --write","git add"],"lib/*.js":["eslint --fix --max-warnings 0","git add"],"**/*.ts":["prettier --write","tslint --fix","git add"]},"keywords":["stellar"],"repository":{"type":"git","url":"https://github.com/stellar/js-stellar-sdk.git"},"author":"Stellar Development Foundation <hello@stellar.org>","license":"Apache-2.0","bugs":{"url":"https://github.com/stellar/js-stellar-sdk/issues"},"homepage":"https://github.com/stellar/js-stellar-sdk","devDependencies":{"@kollavarsham/gulp-coveralls":"0.2.8","@stellar/prettier-config":"^1.0.1","@stellar/tsconfig":"^1.0.1","@stellar/tslint-config":"^1.0.3","@types/detect-node":"^2.0.0","@types/lodash":"^4.14.130","axios-mock-adapter":"^1.16.0","babel-cli":"^6.26.0","babel-core":"~6.26.3","babel-eslint":"^10.0.1","babel-istanbul":"^0.12.2","babel-loader":"^7.0.0","babel-plugin-transform-builtin-extend":"^1.1.2","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","body-parser":"^1.12.2","chai":"^2.2.0","chai-as-promised":"^5.2.0","chai-http":"^4.3.0","clear":"^0.1.0","coveralls":"3.0.2","del":"^5.1.0","eslint":"^5.12.1","eslint-config-airbnb-base":"^13.1.0","eslint-config-prettier":"^3.6.0","eslint-plugin-import":"^2.15.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prefer-import":"^0.0.1","eslint-plugin-prettier":"^3.0.1","ghooks":"^0.3.0","gulp":"^4.0.0","gulp-babel":"^6.1.3","gulp-eslint":"^5.0.0","gulp-insert":"^0.5.0","gulp-istanbul":"^1.1.3","gulp-load-plugins":"1.5.0","gulp-mocha":"^7.0.2","gulp-plumber":"^1.0.0","gulp-rename":"~1.2.0","gulp-tslint":"^8.1.4","husky":"^1.3.1","isparta":"^4.1.1","istanbul":"^0.4.5","jsdoc":"3.5.5","json-loader":"^0.5.1","karma":"^6.3.0","karma-chai":"^0.1.0","karma-chai-as-promised":"^0.1.2","karma-chrome-launcher":"^3.1.0","karma-commonjs":"^1.0.0","karma-firefox-launcher":"^2.1.2","karma-mocha":"^2.0.1","karma-phantomjs-launcher":"^1.0.4","karma-sauce-launcher":"2.0.2","karma-sinon":"^1.0.5","karma-sinon-chai":"2.0.2","karma-webpack":"5.0.0","lint-staged":"7.3.0","minami":"^1.1.1","mocha":"^9.1.4","prettier":"^1.17.1","sinon":"^1.14.1","sinon-chai":"^2.7.0","terser-webpack-plugin":"^1.3.0","ts-loader":"^5.0.0","tslint":"^5.16.0","typescript":"^3.4.5","webpack":"^4.33.0","webpack-cli":"^3.3.3","webpack-stream":"^5.2.1"},"dependencies":{"@types/eventsource":"^1.1.2","@types/node":">= 8","@types/randombytes":"^2.0.0","@types/urijs":"^1.19.6","axios":"0.25.0","bignumber.js":"^4.0.0","detect-node":"^2.0.4","es6-promise":"^4.2.4","eventsource":"^1.1.1","lodash":"^4.17.21","randombytes":"^2.1.0","stellar-base":"^8.2.2","toml":"^2.3.0","tslib":"^1.10.0","urijs":"^1.19.1","utility-types":"^3.7.0"}}');
|
|
62164
63523
|
|
|
63524
|
+
/***/ }),
|
|
63525
|
+
|
|
63526
|
+
/***/ "./package.json":
|
|
63527
|
+
/*!**********************!*\
|
|
63528
|
+
!*** ./package.json ***!
|
|
63529
|
+
\**********************/
|
|
63530
|
+
/***/ ((module) => {
|
|
63531
|
+
|
|
63532
|
+
"use strict";
|
|
63533
|
+
module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"1.1.0-alpha.0","engines":{"node":">=18"},"main":"./lib/bundle.js","types":"./lib/index.d.ts","license":"Apache-2.0","private":false,"devDependencies":{"@babel/preset-env":"^7.20.2","@stellar/eslint-config":"^2.1.2","@stellar/prettier-config":"^1.0.1","@stellar/tsconfig":"^1.0.2","@types/jest":"^29.4.0","@types/lodash":"^4.14.194","@types/sinon":"^10.0.15","babel-jest":"^29.4.1","eslint":"^8.33.0","jest":"^29.4.1","sinon":"^15.1.0","ts-jest":"^29.0.5","ts-loader":"^9.4.2","tslib":"^2.5.0","typescript":"^5.0.4","webpack":"^5.83.1","webpack-cli":"^5.1.1"},"dependencies":{"axios":"^1.4.0","https-browserify":"^1.0.0","lodash":"^4.17.21","query-string":"^7.1.3","stellar-sdk":"^10.4.1","stream-http":"^3.2.0","url":"^0.11.0","util":"^0.12.5"},"scripts":{"prepare":"yarn build","test":"jest --watchAll","build":"webpack --config webpack.config.js"}}');
|
|
63534
|
+
|
|
62165
63535
|
/***/ })
|
|
62166
63536
|
|
|
62167
63537
|
/******/ });
|