@xchainjs/xchain-dash 1.0.11 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.esm.js +131 -269
- package/lib/index.js +132 -270
- package/package.json +6 -7
- package/lib/index.esm.js.map +0 -1
- package/lib/index.js.map +0 -1
package/lib/index.esm.js
CHANGED
|
@@ -2,9 +2,9 @@ import { ExplorerProvider, Network, TxType, FeeOption, checkFeeBounds } from '@x
|
|
|
2
2
|
import { AssetType, baseAmount, assetToBase, assetAmount } from '@xchainjs/xchain-util';
|
|
3
3
|
import { BlockcypherProvider, BlockcypherNetwork, BitgoProvider } from '@xchainjs/xchain-utxo-providers';
|
|
4
4
|
import * as dashcore from '@dashevo/dashcore-lib';
|
|
5
|
-
import { Client as Client$1 } from '@xchainjs/xchain-utxo';
|
|
5
|
+
import { toBitcoinJS, Client as Client$1 } from '@xchainjs/xchain-utxo';
|
|
6
6
|
import * as Dash from 'bitcoinjs-lib';
|
|
7
|
-
import
|
|
7
|
+
import accumulative from 'coinselect/accumulative';
|
|
8
8
|
import { getSeed } from '@xchainjs/xchain-crypto';
|
|
9
9
|
import AppBtc from '@ledgerhq/hw-app-btc';
|
|
10
10
|
|
|
@@ -802,7 +802,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
802
802
|
|
|
803
803
|
// *********************
|
|
804
804
|
|
|
805
|
-
var utils$
|
|
805
|
+
var utils$1 = {
|
|
806
806
|
isArray,
|
|
807
807
|
isArrayBuffer,
|
|
808
808
|
isBuffer,
|
|
@@ -891,7 +891,7 @@ function AxiosError(message, code, config, request, response) {
|
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
893
|
|
|
894
|
-
utils$
|
|
894
|
+
utils$1.inherits(AxiosError, Error, {
|
|
895
895
|
toJSON: function toJSON() {
|
|
896
896
|
return {
|
|
897
897
|
// Standard
|
|
@@ -906,7 +906,7 @@ utils$2.inherits(AxiosError, Error, {
|
|
|
906
906
|
columnNumber: this.columnNumber,
|
|
907
907
|
stack: this.stack,
|
|
908
908
|
// Axios
|
|
909
|
-
config: utils$
|
|
909
|
+
config: utils$1.toJSONObject(this.config),
|
|
910
910
|
code: this.code,
|
|
911
911
|
status: this.status
|
|
912
912
|
};
|
|
@@ -941,7 +941,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
|
941
941
|
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
942
942
|
const axiosError = Object.create(prototype$1);
|
|
943
943
|
|
|
944
|
-
utils$
|
|
944
|
+
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
945
945
|
return obj !== Error.prototype;
|
|
946
946
|
}, prop => {
|
|
947
947
|
return prop !== 'isAxiosError';
|
|
@@ -969,7 +969,7 @@ var httpAdapter = null;
|
|
|
969
969
|
* @returns {boolean}
|
|
970
970
|
*/
|
|
971
971
|
function isVisitable(thing) {
|
|
972
|
-
return utils$
|
|
972
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
973
973
|
}
|
|
974
974
|
|
|
975
975
|
/**
|
|
@@ -980,7 +980,7 @@ function isVisitable(thing) {
|
|
|
980
980
|
* @returns {string} the key without the brackets.
|
|
981
981
|
*/
|
|
982
982
|
function removeBrackets(key) {
|
|
983
|
-
return utils$
|
|
983
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
984
984
|
}
|
|
985
985
|
|
|
986
986
|
/**
|
|
@@ -1009,10 +1009,10 @@ function renderKey(path, key, dots) {
|
|
|
1009
1009
|
* @returns {boolean}
|
|
1010
1010
|
*/
|
|
1011
1011
|
function isFlatArray(arr) {
|
|
1012
|
-
return utils$
|
|
1012
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
|
-
const predicates = utils$
|
|
1015
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
1016
1016
|
return /^is[A-Z]/.test(prop);
|
|
1017
1017
|
});
|
|
1018
1018
|
|
|
@@ -1040,7 +1040,7 @@ const predicates = utils$2.toFlatObject(utils$2, {}, null, function filter(prop)
|
|
|
1040
1040
|
* @returns
|
|
1041
1041
|
*/
|
|
1042
1042
|
function toFormData(obj, formData, options) {
|
|
1043
|
-
if (!utils$
|
|
1043
|
+
if (!utils$1.isObject(obj)) {
|
|
1044
1044
|
throw new TypeError('target must be an object');
|
|
1045
1045
|
}
|
|
1046
1046
|
|
|
@@ -1048,13 +1048,13 @@ function toFormData(obj, formData, options) {
|
|
|
1048
1048
|
formData = formData || new (FormData)();
|
|
1049
1049
|
|
|
1050
1050
|
// eslint-disable-next-line no-param-reassign
|
|
1051
|
-
options = utils$
|
|
1051
|
+
options = utils$1.toFlatObject(options, {
|
|
1052
1052
|
metaTokens: true,
|
|
1053
1053
|
dots: false,
|
|
1054
1054
|
indexes: false
|
|
1055
1055
|
}, false, function defined(option, source) {
|
|
1056
1056
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1057
|
-
return !utils$
|
|
1057
|
+
return !utils$1.isUndefined(source[option]);
|
|
1058
1058
|
});
|
|
1059
1059
|
|
|
1060
1060
|
const metaTokens = options.metaTokens;
|
|
@@ -1063,24 +1063,24 @@ function toFormData(obj, formData, options) {
|
|
|
1063
1063
|
const dots = options.dots;
|
|
1064
1064
|
const indexes = options.indexes;
|
|
1065
1065
|
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
1066
|
-
const useBlob = _Blob && utils$
|
|
1066
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1067
1067
|
|
|
1068
|
-
if (!utils$
|
|
1068
|
+
if (!utils$1.isFunction(visitor)) {
|
|
1069
1069
|
throw new TypeError('visitor must be a function');
|
|
1070
1070
|
}
|
|
1071
1071
|
|
|
1072
1072
|
function convertValue(value) {
|
|
1073
1073
|
if (value === null) return '';
|
|
1074
1074
|
|
|
1075
|
-
if (utils$
|
|
1075
|
+
if (utils$1.isDate(value)) {
|
|
1076
1076
|
return value.toISOString();
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
|
-
if (!useBlob && utils$
|
|
1079
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
1080
1080
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
|
-
if (utils$
|
|
1083
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1084
1084
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
1085
1085
|
}
|
|
1086
1086
|
|
|
@@ -1101,20 +1101,20 @@ function toFormData(obj, formData, options) {
|
|
|
1101
1101
|
let arr = value;
|
|
1102
1102
|
|
|
1103
1103
|
if (value && !path && typeof value === 'object') {
|
|
1104
|
-
if (utils$
|
|
1104
|
+
if (utils$1.endsWith(key, '{}')) {
|
|
1105
1105
|
// eslint-disable-next-line no-param-reassign
|
|
1106
1106
|
key = metaTokens ? key : key.slice(0, -2);
|
|
1107
1107
|
// eslint-disable-next-line no-param-reassign
|
|
1108
1108
|
value = JSON.stringify(value);
|
|
1109
1109
|
} else if (
|
|
1110
|
-
(utils$
|
|
1111
|
-
((utils$
|
|
1110
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1111
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
1112
1112
|
)) {
|
|
1113
1113
|
// eslint-disable-next-line no-param-reassign
|
|
1114
1114
|
key = removeBrackets(key);
|
|
1115
1115
|
|
|
1116
1116
|
arr.forEach(function each(el, index) {
|
|
1117
|
-
!(utils$
|
|
1117
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
1118
1118
|
// eslint-disable-next-line no-nested-ternary
|
|
1119
1119
|
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
1120
1120
|
convertValue(el)
|
|
@@ -1142,7 +1142,7 @@ function toFormData(obj, formData, options) {
|
|
|
1142
1142
|
});
|
|
1143
1143
|
|
|
1144
1144
|
function build(value, path) {
|
|
1145
|
-
if (utils$
|
|
1145
|
+
if (utils$1.isUndefined(value)) return;
|
|
1146
1146
|
|
|
1147
1147
|
if (stack.indexOf(value) !== -1) {
|
|
1148
1148
|
throw Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -1150,9 +1150,9 @@ function toFormData(obj, formData, options) {
|
|
|
1150
1150
|
|
|
1151
1151
|
stack.push(value);
|
|
1152
1152
|
|
|
1153
|
-
utils$
|
|
1154
|
-
const result = !(utils$
|
|
1155
|
-
formData, el, utils$
|
|
1153
|
+
utils$1.forEach(value, function each(el, key) {
|
|
1154
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
1155
|
+
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1156
1156
|
);
|
|
1157
1157
|
|
|
1158
1158
|
if (result === true) {
|
|
@@ -1163,7 +1163,7 @@ function toFormData(obj, formData, options) {
|
|
|
1163
1163
|
stack.pop();
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
1166
|
-
if (!utils$
|
|
1166
|
+
if (!utils$1.isObject(obj)) {
|
|
1167
1167
|
throw new TypeError('data must be an object');
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
@@ -1260,7 +1260,7 @@ function buildURL(url, params, options) {
|
|
|
1260
1260
|
|
|
1261
1261
|
const _encode = options && options.encode || encode;
|
|
1262
1262
|
|
|
1263
|
-
if (utils$
|
|
1263
|
+
if (utils$1.isFunction(options)) {
|
|
1264
1264
|
options = {
|
|
1265
1265
|
serialize: options
|
|
1266
1266
|
};
|
|
@@ -1273,7 +1273,7 @@ function buildURL(url, params, options) {
|
|
|
1273
1273
|
if (serializeFn) {
|
|
1274
1274
|
serializedParams = serializeFn(params, options);
|
|
1275
1275
|
} else {
|
|
1276
|
-
serializedParams = utils$
|
|
1276
|
+
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
1277
1277
|
params.toString() :
|
|
1278
1278
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
1279
1279
|
}
|
|
@@ -1348,7 +1348,7 @@ class InterceptorManager {
|
|
|
1348
1348
|
* @returns {void}
|
|
1349
1349
|
*/
|
|
1350
1350
|
forEach(fn) {
|
|
1351
|
-
utils$
|
|
1351
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1352
1352
|
if (h !== null) {
|
|
1353
1353
|
fn(h);
|
|
1354
1354
|
}
|
|
@@ -1422,7 +1422,7 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
1422
1422
|
|
|
1423
1423
|
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
1424
1424
|
|
|
1425
|
-
var utils
|
|
1425
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
1426
1426
|
__proto__: null,
|
|
1427
1427
|
hasBrowserEnv: hasBrowserEnv,
|
|
1428
1428
|
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
@@ -1432,14 +1432,14 @@ var utils$1 = /*#__PURE__*/Object.freeze({
|
|
|
1432
1432
|
});
|
|
1433
1433
|
|
|
1434
1434
|
var platform = {
|
|
1435
|
-
...utils
|
|
1435
|
+
...utils,
|
|
1436
1436
|
...platform$1
|
|
1437
1437
|
};
|
|
1438
1438
|
|
|
1439
1439
|
function toURLEncodedForm(data, options) {
|
|
1440
1440
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
1441
1441
|
visitor: function(value, key, path, helpers) {
|
|
1442
|
-
if (platform.isNode && utils$
|
|
1442
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1443
1443
|
this.append(key, value.toString('base64'));
|
|
1444
1444
|
return false;
|
|
1445
1445
|
}
|
|
@@ -1461,7 +1461,7 @@ function parsePropPath(name) {
|
|
|
1461
1461
|
// foo.x.y.z
|
|
1462
1462
|
// foo-x-y-z
|
|
1463
1463
|
// foo x y z
|
|
1464
|
-
return utils$
|
|
1464
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1465
1465
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1466
1466
|
});
|
|
1467
1467
|
}
|
|
@@ -1501,10 +1501,10 @@ function formDataToJSON(formData) {
|
|
|
1501
1501
|
|
|
1502
1502
|
const isNumericKey = Number.isFinite(+name);
|
|
1503
1503
|
const isLast = index >= path.length;
|
|
1504
|
-
name = !name && utils$
|
|
1504
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
1505
1505
|
|
|
1506
1506
|
if (isLast) {
|
|
1507
|
-
if (utils$
|
|
1507
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
1508
1508
|
target[name] = [target[name], value];
|
|
1509
1509
|
} else {
|
|
1510
1510
|
target[name] = value;
|
|
@@ -1513,23 +1513,23 @@ function formDataToJSON(formData) {
|
|
|
1513
1513
|
return !isNumericKey;
|
|
1514
1514
|
}
|
|
1515
1515
|
|
|
1516
|
-
if (!target[name] || !utils$
|
|
1516
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
1517
1517
|
target[name] = [];
|
|
1518
1518
|
}
|
|
1519
1519
|
|
|
1520
1520
|
const result = buildPath(path, value, target[name], index);
|
|
1521
1521
|
|
|
1522
|
-
if (result && utils$
|
|
1522
|
+
if (result && utils$1.isArray(target[name])) {
|
|
1523
1523
|
target[name] = arrayToObject(target[name]);
|
|
1524
1524
|
}
|
|
1525
1525
|
|
|
1526
1526
|
return !isNumericKey;
|
|
1527
1527
|
}
|
|
1528
1528
|
|
|
1529
|
-
if (utils$
|
|
1529
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
1530
1530
|
const obj = {};
|
|
1531
1531
|
|
|
1532
|
-
utils$
|
|
1532
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
1533
1533
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
1534
1534
|
});
|
|
1535
1535
|
|
|
@@ -1550,10 +1550,10 @@ function formDataToJSON(formData) {
|
|
|
1550
1550
|
* @returns {string} A stringified version of the rawValue.
|
|
1551
1551
|
*/
|
|
1552
1552
|
function stringifySafely(rawValue, parser, encoder) {
|
|
1553
|
-
if (utils$
|
|
1553
|
+
if (utils$1.isString(rawValue)) {
|
|
1554
1554
|
try {
|
|
1555
1555
|
(parser || JSON.parse)(rawValue);
|
|
1556
|
-
return utils$
|
|
1556
|
+
return utils$1.trim(rawValue);
|
|
1557
1557
|
} catch (e) {
|
|
1558
1558
|
if (e.name !== 'SyntaxError') {
|
|
1559
1559
|
throw e;
|
|
@@ -1573,31 +1573,31 @@ const defaults = {
|
|
|
1573
1573
|
transformRequest: [function transformRequest(data, headers) {
|
|
1574
1574
|
const contentType = headers.getContentType() || '';
|
|
1575
1575
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1576
|
-
const isObjectPayload = utils$
|
|
1576
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
1577
1577
|
|
|
1578
|
-
if (isObjectPayload && utils$
|
|
1578
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1579
1579
|
data = new FormData(data);
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
|
-
const isFormData = utils$
|
|
1582
|
+
const isFormData = utils$1.isFormData(data);
|
|
1583
1583
|
|
|
1584
1584
|
if (isFormData) {
|
|
1585
1585
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
|
-
if (utils$
|
|
1589
|
-
utils$
|
|
1590
|
-
utils$
|
|
1591
|
-
utils$
|
|
1592
|
-
utils$
|
|
1593
|
-
utils$
|
|
1588
|
+
if (utils$1.isArrayBuffer(data) ||
|
|
1589
|
+
utils$1.isBuffer(data) ||
|
|
1590
|
+
utils$1.isStream(data) ||
|
|
1591
|
+
utils$1.isFile(data) ||
|
|
1592
|
+
utils$1.isBlob(data) ||
|
|
1593
|
+
utils$1.isReadableStream(data)
|
|
1594
1594
|
) {
|
|
1595
1595
|
return data;
|
|
1596
1596
|
}
|
|
1597
|
-
if (utils$
|
|
1597
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
1598
1598
|
return data.buffer;
|
|
1599
1599
|
}
|
|
1600
|
-
if (utils$
|
|
1600
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
1601
1601
|
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1602
1602
|
return data.toString();
|
|
1603
1603
|
}
|
|
@@ -1609,7 +1609,7 @@ const defaults = {
|
|
|
1609
1609
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1610
1610
|
}
|
|
1611
1611
|
|
|
1612
|
-
if ((isFileList = utils$
|
|
1612
|
+
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
1613
1613
|
const _FormData = this.env && this.env.FormData;
|
|
1614
1614
|
|
|
1615
1615
|
return toFormData(
|
|
@@ -1633,11 +1633,11 @@ const defaults = {
|
|
|
1633
1633
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1634
1634
|
const JSONRequested = this.responseType === 'json';
|
|
1635
1635
|
|
|
1636
|
-
if (utils$
|
|
1636
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
1637
1637
|
return data;
|
|
1638
1638
|
}
|
|
1639
1639
|
|
|
1640
|
-
if (data && utils$
|
|
1640
|
+
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
1641
1641
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1642
1642
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1643
1643
|
|
|
@@ -1685,13 +1685,13 @@ const defaults = {
|
|
|
1685
1685
|
}
|
|
1686
1686
|
};
|
|
1687
1687
|
|
|
1688
|
-
utils$
|
|
1688
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
1689
1689
|
defaults.headers[method] = {};
|
|
1690
1690
|
});
|
|
1691
1691
|
|
|
1692
1692
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1693
1693
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1694
|
-
const ignoreDuplicateOf = utils$
|
|
1694
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1695
1695
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
1696
1696
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
1697
1697
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
@@ -1752,7 +1752,7 @@ function normalizeValue(value) {
|
|
|
1752
1752
|
return value;
|
|
1753
1753
|
}
|
|
1754
1754
|
|
|
1755
|
-
return utils$
|
|
1755
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
1756
1756
|
}
|
|
1757
1757
|
|
|
1758
1758
|
function parseTokens(str) {
|
|
@@ -1770,7 +1770,7 @@ function parseTokens(str) {
|
|
|
1770
1770
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1771
1771
|
|
|
1772
1772
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
1773
|
-
if (utils$
|
|
1773
|
+
if (utils$1.isFunction(filter)) {
|
|
1774
1774
|
return filter.call(this, value, header);
|
|
1775
1775
|
}
|
|
1776
1776
|
|
|
@@ -1778,13 +1778,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
1778
1778
|
value = header;
|
|
1779
1779
|
}
|
|
1780
1780
|
|
|
1781
|
-
if (!utils$
|
|
1781
|
+
if (!utils$1.isString(value)) return;
|
|
1782
1782
|
|
|
1783
|
-
if (utils$
|
|
1783
|
+
if (utils$1.isString(filter)) {
|
|
1784
1784
|
return value.indexOf(filter) !== -1;
|
|
1785
1785
|
}
|
|
1786
1786
|
|
|
1787
|
-
if (utils$
|
|
1787
|
+
if (utils$1.isRegExp(filter)) {
|
|
1788
1788
|
return filter.test(value);
|
|
1789
1789
|
}
|
|
1790
1790
|
}
|
|
@@ -1797,7 +1797,7 @@ function formatHeader(header) {
|
|
|
1797
1797
|
}
|
|
1798
1798
|
|
|
1799
1799
|
function buildAccessors(obj, header) {
|
|
1800
|
-
const accessorName = utils$
|
|
1800
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1801
1801
|
|
|
1802
1802
|
['get', 'set', 'has'].forEach(methodName => {
|
|
1803
1803
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
@@ -1824,7 +1824,7 @@ class AxiosHeaders {
|
|
|
1824
1824
|
throw new Error('header name must be a non-empty string');
|
|
1825
1825
|
}
|
|
1826
1826
|
|
|
1827
|
-
const key = utils$
|
|
1827
|
+
const key = utils$1.findKey(self, lHeader);
|
|
1828
1828
|
|
|
1829
1829
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
1830
1830
|
self[key || _header] = normalizeValue(_value);
|
|
@@ -1832,13 +1832,13 @@ class AxiosHeaders {
|
|
|
1832
1832
|
}
|
|
1833
1833
|
|
|
1834
1834
|
const setHeaders = (headers, _rewrite) =>
|
|
1835
|
-
utils$
|
|
1835
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1836
1836
|
|
|
1837
|
-
if (utils$
|
|
1837
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1838
1838
|
setHeaders(header, valueOrRewrite);
|
|
1839
|
-
} else if(utils$
|
|
1839
|
+
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1840
1840
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1841
|
-
} else if (utils$
|
|
1841
|
+
} else if (utils$1.isHeaders(header)) {
|
|
1842
1842
|
for (const [key, value] of header.entries()) {
|
|
1843
1843
|
setHeader(value, key, rewrite);
|
|
1844
1844
|
}
|
|
@@ -1853,7 +1853,7 @@ class AxiosHeaders {
|
|
|
1853
1853
|
header = normalizeHeader(header);
|
|
1854
1854
|
|
|
1855
1855
|
if (header) {
|
|
1856
|
-
const key = utils$
|
|
1856
|
+
const key = utils$1.findKey(this, header);
|
|
1857
1857
|
|
|
1858
1858
|
if (key) {
|
|
1859
1859
|
const value = this[key];
|
|
@@ -1866,11 +1866,11 @@ class AxiosHeaders {
|
|
|
1866
1866
|
return parseTokens(value);
|
|
1867
1867
|
}
|
|
1868
1868
|
|
|
1869
|
-
if (utils$
|
|
1869
|
+
if (utils$1.isFunction(parser)) {
|
|
1870
1870
|
return parser.call(this, value, key);
|
|
1871
1871
|
}
|
|
1872
1872
|
|
|
1873
|
-
if (utils$
|
|
1873
|
+
if (utils$1.isRegExp(parser)) {
|
|
1874
1874
|
return parser.exec(value);
|
|
1875
1875
|
}
|
|
1876
1876
|
|
|
@@ -1883,7 +1883,7 @@ class AxiosHeaders {
|
|
|
1883
1883
|
header = normalizeHeader(header);
|
|
1884
1884
|
|
|
1885
1885
|
if (header) {
|
|
1886
|
-
const key = utils$
|
|
1886
|
+
const key = utils$1.findKey(this, header);
|
|
1887
1887
|
|
|
1888
1888
|
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1889
1889
|
}
|
|
@@ -1899,7 +1899,7 @@ class AxiosHeaders {
|
|
|
1899
1899
|
_header = normalizeHeader(_header);
|
|
1900
1900
|
|
|
1901
1901
|
if (_header) {
|
|
1902
|
-
const key = utils$
|
|
1902
|
+
const key = utils$1.findKey(self, _header);
|
|
1903
1903
|
|
|
1904
1904
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
1905
1905
|
delete self[key];
|
|
@@ -1909,7 +1909,7 @@ class AxiosHeaders {
|
|
|
1909
1909
|
}
|
|
1910
1910
|
}
|
|
1911
1911
|
|
|
1912
|
-
if (utils$
|
|
1912
|
+
if (utils$1.isArray(header)) {
|
|
1913
1913
|
header.forEach(deleteHeader);
|
|
1914
1914
|
} else {
|
|
1915
1915
|
deleteHeader(header);
|
|
@@ -1938,8 +1938,8 @@ class AxiosHeaders {
|
|
|
1938
1938
|
const self = this;
|
|
1939
1939
|
const headers = {};
|
|
1940
1940
|
|
|
1941
|
-
utils$
|
|
1942
|
-
const key = utils$
|
|
1941
|
+
utils$1.forEach(this, (value, header) => {
|
|
1942
|
+
const key = utils$1.findKey(headers, header);
|
|
1943
1943
|
|
|
1944
1944
|
if (key) {
|
|
1945
1945
|
self[key] = normalizeValue(value);
|
|
@@ -1968,8 +1968,8 @@ class AxiosHeaders {
|
|
|
1968
1968
|
toJSON(asStrings) {
|
|
1969
1969
|
const obj = Object.create(null);
|
|
1970
1970
|
|
|
1971
|
-
utils$
|
|
1972
|
-
value != null && value !== false && (obj[header] = asStrings && utils$
|
|
1971
|
+
utils$1.forEach(this, (value, header) => {
|
|
1972
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
1973
1973
|
});
|
|
1974
1974
|
|
|
1975
1975
|
return obj;
|
|
@@ -2016,7 +2016,7 @@ class AxiosHeaders {
|
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
2018
2018
|
|
|
2019
|
-
utils$
|
|
2019
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
2020
2020
|
|
|
2021
2021
|
return this;
|
|
2022
2022
|
}
|
|
@@ -2025,7 +2025,7 @@ class AxiosHeaders {
|
|
|
2025
2025
|
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
2026
2026
|
|
|
2027
2027
|
// reserved names hotfix
|
|
2028
|
-
utils$
|
|
2028
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
2029
2029
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2030
2030
|
return {
|
|
2031
2031
|
get: () => value,
|
|
@@ -2035,7 +2035,7 @@ utils$2.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
|
2035
2035
|
}
|
|
2036
2036
|
});
|
|
2037
2037
|
|
|
2038
|
-
utils$
|
|
2038
|
+
utils$1.freezeMethods(AxiosHeaders);
|
|
2039
2039
|
|
|
2040
2040
|
/**
|
|
2041
2041
|
* Transform the data for a request or a response
|
|
@@ -2051,7 +2051,7 @@ function transformData(fns, response) {
|
|
|
2051
2051
|
const headers = AxiosHeaders.from(context.headers);
|
|
2052
2052
|
let data = context.data;
|
|
2053
2053
|
|
|
2054
|
-
utils$
|
|
2054
|
+
utils$1.forEach(fns, function transform(fn) {
|
|
2055
2055
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
2056
2056
|
});
|
|
2057
2057
|
|
|
@@ -2079,7 +2079,7 @@ function CanceledError(message, config, request) {
|
|
|
2079
2079
|
this.name = 'CanceledError';
|
|
2080
2080
|
}
|
|
2081
2081
|
|
|
2082
|
-
utils$
|
|
2082
|
+
utils$1.inherits(CanceledError, AxiosError, {
|
|
2083
2083
|
__CANCEL__: true
|
|
2084
2084
|
});
|
|
2085
2085
|
|
|
@@ -2246,7 +2246,7 @@ const progressEventDecorator = (total, throttled) => {
|
|
|
2246
2246
|
}), throttled[1]];
|
|
2247
2247
|
};
|
|
2248
2248
|
|
|
2249
|
-
const asyncDecorator = (fn) => (...args) => utils$
|
|
2249
|
+
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
2250
2250
|
|
|
2251
2251
|
var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
|
|
2252
2252
|
url = new URL(url, platform.origin);
|
|
@@ -2268,11 +2268,11 @@ var cookies = platform.hasStandardBrowserEnv ?
|
|
|
2268
2268
|
write(name, value, expires, path, domain, secure) {
|
|
2269
2269
|
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
2270
2270
|
|
|
2271
|
-
utils$
|
|
2271
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
2272
2272
|
|
|
2273
|
-
utils$
|
|
2273
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
|
2274
2274
|
|
|
2275
|
-
utils$
|
|
2275
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
2276
2276
|
|
|
2277
2277
|
secure === true && cookie.push('secure');
|
|
2278
2278
|
|
|
@@ -2363,11 +2363,11 @@ function mergeConfig(config1, config2) {
|
|
|
2363
2363
|
const config = {};
|
|
2364
2364
|
|
|
2365
2365
|
function getMergedValue(target, source, prop, caseless) {
|
|
2366
|
-
if (utils$
|
|
2367
|
-
return utils$
|
|
2368
|
-
} else if (utils$
|
|
2369
|
-
return utils$
|
|
2370
|
-
} else if (utils$
|
|
2366
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2367
|
+
return utils$1.merge.call({caseless}, target, source);
|
|
2368
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
2369
|
+
return utils$1.merge({}, source);
|
|
2370
|
+
} else if (utils$1.isArray(source)) {
|
|
2371
2371
|
return source.slice();
|
|
2372
2372
|
}
|
|
2373
2373
|
return source;
|
|
@@ -2375,25 +2375,25 @@ function mergeConfig(config1, config2) {
|
|
|
2375
2375
|
|
|
2376
2376
|
// eslint-disable-next-line consistent-return
|
|
2377
2377
|
function mergeDeepProperties(a, b, prop , caseless) {
|
|
2378
|
-
if (!utils$
|
|
2378
|
+
if (!utils$1.isUndefined(b)) {
|
|
2379
2379
|
return getMergedValue(a, b, prop , caseless);
|
|
2380
|
-
} else if (!utils$
|
|
2380
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2381
2381
|
return getMergedValue(undefined, a, prop , caseless);
|
|
2382
2382
|
}
|
|
2383
2383
|
}
|
|
2384
2384
|
|
|
2385
2385
|
// eslint-disable-next-line consistent-return
|
|
2386
2386
|
function valueFromConfig2(a, b) {
|
|
2387
|
-
if (!utils$
|
|
2387
|
+
if (!utils$1.isUndefined(b)) {
|
|
2388
2388
|
return getMergedValue(undefined, b);
|
|
2389
2389
|
}
|
|
2390
2390
|
}
|
|
2391
2391
|
|
|
2392
2392
|
// eslint-disable-next-line consistent-return
|
|
2393
2393
|
function defaultToConfig2(a, b) {
|
|
2394
|
-
if (!utils$
|
|
2394
|
+
if (!utils$1.isUndefined(b)) {
|
|
2395
2395
|
return getMergedValue(undefined, b);
|
|
2396
|
-
} else if (!utils$
|
|
2396
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2397
2397
|
return getMergedValue(undefined, a);
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
@@ -2439,10 +2439,10 @@ function mergeConfig(config1, config2) {
|
|
|
2439
2439
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
2440
2440
|
};
|
|
2441
2441
|
|
|
2442
|
-
utils$
|
|
2442
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2443
2443
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2444
2444
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2445
|
-
(utils$
|
|
2445
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2446
2446
|
});
|
|
2447
2447
|
|
|
2448
2448
|
return config;
|
|
@@ -2466,7 +2466,7 @@ var resolveConfig = (config) => {
|
|
|
2466
2466
|
|
|
2467
2467
|
let contentType;
|
|
2468
2468
|
|
|
2469
|
-
if (utils$
|
|
2469
|
+
if (utils$1.isFormData(data)) {
|
|
2470
2470
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2471
2471
|
headers.setContentType(undefined); // Let the browser set it
|
|
2472
2472
|
} else if ((contentType = headers.getContentType()) !== false) {
|
|
@@ -2481,7 +2481,7 @@ var resolveConfig = (config) => {
|
|
|
2481
2481
|
// Specifically not if we're in a web worker, or react-native.
|
|
2482
2482
|
|
|
2483
2483
|
if (platform.hasStandardBrowserEnv) {
|
|
2484
|
-
withXSRFToken && utils$
|
|
2484
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
2485
2485
|
|
|
2486
2486
|
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
2487
2487
|
// Add xsrf header
|
|
@@ -2622,13 +2622,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2622
2622
|
|
|
2623
2623
|
// Add headers to the request
|
|
2624
2624
|
if ('setRequestHeader' in request) {
|
|
2625
|
-
utils$
|
|
2625
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2626
2626
|
request.setRequestHeader(key, val);
|
|
2627
2627
|
});
|
|
2628
2628
|
}
|
|
2629
2629
|
|
|
2630
2630
|
// Add withCredentials to request if needed
|
|
2631
|
-
if (!utils$
|
|
2631
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
2632
2632
|
request.withCredentials = !!_config.withCredentials;
|
|
2633
2633
|
}
|
|
2634
2634
|
|
|
@@ -2720,7 +2720,7 @@ const composeSignals = (signals, timeout) => {
|
|
|
2720
2720
|
|
|
2721
2721
|
const {signal} = controller;
|
|
2722
2722
|
|
|
2723
|
-
signal.unsubscribe = () => utils$
|
|
2723
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
2724
2724
|
|
|
2725
2725
|
return signal;
|
|
2726
2726
|
}
|
|
@@ -2848,7 +2848,7 @@ const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
|
2848
2848
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2849
2849
|
|
|
2850
2850
|
const supportsResponseStream = isReadableStreamSupported &&
|
|
2851
|
-
test(() => utils$
|
|
2851
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
2852
2852
|
|
|
2853
2853
|
|
|
2854
2854
|
const resolvers = {
|
|
@@ -2857,7 +2857,7 @@ const resolvers = {
|
|
|
2857
2857
|
|
|
2858
2858
|
isFetchSupported && (((res) => {
|
|
2859
2859
|
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
2860
|
-
!resolvers[type] && (resolvers[type] = utils$
|
|
2860
|
+
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
2861
2861
|
(_, config) => {
|
|
2862
2862
|
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
2863
2863
|
});
|
|
@@ -2869,11 +2869,11 @@ const getBodyLength = async (body) => {
|
|
|
2869
2869
|
return 0;
|
|
2870
2870
|
}
|
|
2871
2871
|
|
|
2872
|
-
if(utils$
|
|
2872
|
+
if(utils$1.isBlob(body)) {
|
|
2873
2873
|
return body.size;
|
|
2874
2874
|
}
|
|
2875
2875
|
|
|
2876
|
-
if(utils$
|
|
2876
|
+
if(utils$1.isSpecCompliantForm(body)) {
|
|
2877
2877
|
const _request = new Request(platform.origin, {
|
|
2878
2878
|
method: 'POST',
|
|
2879
2879
|
body,
|
|
@@ -2881,21 +2881,21 @@ const getBodyLength = async (body) => {
|
|
|
2881
2881
|
return (await _request.arrayBuffer()).byteLength;
|
|
2882
2882
|
}
|
|
2883
2883
|
|
|
2884
|
-
if(utils$
|
|
2884
|
+
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
2885
2885
|
return body.byteLength;
|
|
2886
2886
|
}
|
|
2887
2887
|
|
|
2888
|
-
if(utils$
|
|
2888
|
+
if(utils$1.isURLSearchParams(body)) {
|
|
2889
2889
|
body = body + '';
|
|
2890
2890
|
}
|
|
2891
2891
|
|
|
2892
|
-
if(utils$
|
|
2892
|
+
if(utils$1.isString(body)) {
|
|
2893
2893
|
return (await encodeText(body)).byteLength;
|
|
2894
2894
|
}
|
|
2895
2895
|
};
|
|
2896
2896
|
|
|
2897
2897
|
const resolveBodyLength = async (headers, body) => {
|
|
2898
|
-
const length = utils$
|
|
2898
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
2899
2899
|
|
|
2900
2900
|
return length == null ? getBodyLength(body) : length;
|
|
2901
2901
|
};
|
|
@@ -2941,7 +2941,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
2941
2941
|
|
|
2942
2942
|
let contentTypeHeader;
|
|
2943
2943
|
|
|
2944
|
-
if (utils$
|
|
2944
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
2945
2945
|
headers.setContentType(contentTypeHeader);
|
|
2946
2946
|
}
|
|
2947
2947
|
|
|
@@ -2955,7 +2955,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
2955
2955
|
}
|
|
2956
2956
|
}
|
|
2957
2957
|
|
|
2958
|
-
if (!utils$
|
|
2958
|
+
if (!utils$1.isString(withCredentials)) {
|
|
2959
2959
|
withCredentials = withCredentials ? 'include' : 'omit';
|
|
2960
2960
|
}
|
|
2961
2961
|
|
|
@@ -2983,7 +2983,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
2983
2983
|
options[prop] = response[prop];
|
|
2984
2984
|
});
|
|
2985
2985
|
|
|
2986
|
-
const responseContentLength = utils$
|
|
2986
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
2987
2987
|
|
|
2988
2988
|
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
2989
2989
|
responseContentLength,
|
|
@@ -3001,7 +3001,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
3001
3001
|
|
|
3002
3002
|
responseType = responseType || 'text';
|
|
3003
3003
|
|
|
3004
|
-
let responseData = await resolvers[utils$
|
|
3004
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
3005
3005
|
|
|
3006
3006
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3007
3007
|
|
|
@@ -3037,7 +3037,7 @@ const knownAdapters = {
|
|
|
3037
3037
|
fetch: fetchAdapter
|
|
3038
3038
|
};
|
|
3039
3039
|
|
|
3040
|
-
utils$
|
|
3040
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
3041
3041
|
if (fn) {
|
|
3042
3042
|
try {
|
|
3043
3043
|
Object.defineProperty(fn, 'name', {value});
|
|
@@ -3050,11 +3050,11 @@ utils$2.forEach(knownAdapters, (fn, value) => {
|
|
|
3050
3050
|
|
|
3051
3051
|
const renderReason = (reason) => `- ${reason}`;
|
|
3052
3052
|
|
|
3053
|
-
const isResolvedHandle = (adapter) => utils$
|
|
3053
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3054
3054
|
|
|
3055
3055
|
var adapters = {
|
|
3056
3056
|
getAdapter: (adapters) => {
|
|
3057
|
-
adapters = utils$
|
|
3057
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
3058
3058
|
|
|
3059
3059
|
const {length} = adapters;
|
|
3060
3060
|
let nameOrAdapter;
|
|
@@ -3351,7 +3351,7 @@ class Axios {
|
|
|
3351
3351
|
}
|
|
3352
3352
|
|
|
3353
3353
|
if (paramsSerializer != null) {
|
|
3354
|
-
if (utils$
|
|
3354
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
3355
3355
|
config.paramsSerializer = {
|
|
3356
3356
|
serialize: paramsSerializer
|
|
3357
3357
|
};
|
|
@@ -3379,12 +3379,12 @@ class Axios {
|
|
|
3379
3379
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
3380
3380
|
|
|
3381
3381
|
// Flatten headers
|
|
3382
|
-
let contextHeaders = headers && utils$
|
|
3382
|
+
let contextHeaders = headers && utils$1.merge(
|
|
3383
3383
|
headers.common,
|
|
3384
3384
|
headers[config.method]
|
|
3385
3385
|
);
|
|
3386
3386
|
|
|
3387
|
-
headers && utils$
|
|
3387
|
+
headers && utils$1.forEach(
|
|
3388
3388
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
3389
3389
|
(method) => {
|
|
3390
3390
|
delete headers[method];
|
|
@@ -3471,7 +3471,7 @@ class Axios {
|
|
|
3471
3471
|
}
|
|
3472
3472
|
|
|
3473
3473
|
// Provide aliases for supported request methods
|
|
3474
|
-
utils$
|
|
3474
|
+
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
3475
3475
|
/*eslint func-names:0*/
|
|
3476
3476
|
Axios.prototype[method] = function(url, config) {
|
|
3477
3477
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -3482,7 +3482,7 @@ utils$2.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
3482
3482
|
};
|
|
3483
3483
|
});
|
|
3484
3484
|
|
|
3485
|
-
utils$
|
|
3485
|
+
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
3486
3486
|
/*eslint func-names:0*/
|
|
3487
3487
|
|
|
3488
3488
|
function generateHTTPMethod(isForm) {
|
|
@@ -3668,7 +3668,7 @@ function spread(callback) {
|
|
|
3668
3668
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
3669
3669
|
*/
|
|
3670
3670
|
function isAxiosError(payload) {
|
|
3671
|
-
return utils$
|
|
3671
|
+
return utils$1.isObject(payload) && (payload.isAxiosError === true);
|
|
3672
3672
|
}
|
|
3673
3673
|
|
|
3674
3674
|
const HttpStatusCode = {
|
|
@@ -3753,10 +3753,10 @@ function createInstance(defaultConfig) {
|
|
|
3753
3753
|
const instance = bind(Axios.prototype.request, context);
|
|
3754
3754
|
|
|
3755
3755
|
// Copy axios.prototype to instance
|
|
3756
|
-
utils$
|
|
3756
|
+
utils$1.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
|
3757
3757
|
|
|
3758
3758
|
// Copy context to instance
|
|
3759
|
-
utils$
|
|
3759
|
+
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
3760
3760
|
|
|
3761
3761
|
// Factory for creating new instances
|
|
3762
3762
|
instance.create = function create(instanceConfig) {
|
|
@@ -3800,7 +3800,7 @@ axios.mergeConfig = mergeConfig;
|
|
|
3800
3800
|
|
|
3801
3801
|
axios.AxiosHeaders = AxiosHeaders;
|
|
3802
3802
|
|
|
3803
|
-
axios.formToJSON = thing => formDataToJSON(utils$
|
|
3803
|
+
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3804
3804
|
|
|
3805
3805
|
axios.getAdapter = adapters.getAdapter;
|
|
3806
3806
|
|
|
@@ -3871,143 +3871,6 @@ const getRawTx = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
3871
3871
|
return (yield axios.get(`${urlForNetwork(p.network)}/rawtx/${p.txid}`)).data.rawtx;
|
|
3872
3872
|
});
|
|
3873
3873
|
|
|
3874
|
-
function getDefaultExportFromCjs (x) {
|
|
3875
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
3876
|
-
}
|
|
3877
|
-
|
|
3878
|
-
var utils;
|
|
3879
|
-
var hasRequiredUtils;
|
|
3880
|
-
|
|
3881
|
-
function requireUtils () {
|
|
3882
|
-
if (hasRequiredUtils) return utils;
|
|
3883
|
-
hasRequiredUtils = 1;
|
|
3884
|
-
// baseline estimates, used to improve performance
|
|
3885
|
-
var TX_EMPTY_SIZE = 4 + 1 + 1 + 4;
|
|
3886
|
-
var TX_INPUT_BASE = 32 + 4 + 1 + 4;
|
|
3887
|
-
var TX_INPUT_PUBKEYHASH = 107;
|
|
3888
|
-
var TX_OUTPUT_BASE = 8 + 1;
|
|
3889
|
-
var TX_OUTPUT_PUBKEYHASH = 25;
|
|
3890
|
-
|
|
3891
|
-
function inputBytes (input) {
|
|
3892
|
-
return TX_INPUT_BASE + (input.script ? input.script.length : TX_INPUT_PUBKEYHASH)
|
|
3893
|
-
}
|
|
3894
|
-
|
|
3895
|
-
function outputBytes (output) {
|
|
3896
|
-
return TX_OUTPUT_BASE + (output.script ? output.script.length : TX_OUTPUT_PUBKEYHASH)
|
|
3897
|
-
}
|
|
3898
|
-
|
|
3899
|
-
function dustThreshold (output, feeRate) {
|
|
3900
|
-
/* ... classify the output for input estimate */
|
|
3901
|
-
return inputBytes({}) * feeRate
|
|
3902
|
-
}
|
|
3903
|
-
|
|
3904
|
-
function transactionBytes (inputs, outputs) {
|
|
3905
|
-
return TX_EMPTY_SIZE +
|
|
3906
|
-
inputs.reduce(function (a, x) { return a + inputBytes(x) }, 0) +
|
|
3907
|
-
outputs.reduce(function (a, x) { return a + outputBytes(x) }, 0)
|
|
3908
|
-
}
|
|
3909
|
-
|
|
3910
|
-
function uintOrNaN (v) {
|
|
3911
|
-
if (typeof v !== 'number') return NaN
|
|
3912
|
-
if (!isFinite(v)) return NaN
|
|
3913
|
-
if (Math.floor(v) !== v) return NaN
|
|
3914
|
-
if (v < 0) return NaN
|
|
3915
|
-
return v
|
|
3916
|
-
}
|
|
3917
|
-
|
|
3918
|
-
function sumForgiving (range) {
|
|
3919
|
-
return range.reduce(function (a, x) { return a + (isFinite(x.value) ? x.value : 0) }, 0)
|
|
3920
|
-
}
|
|
3921
|
-
|
|
3922
|
-
function sumOrNaN (range) {
|
|
3923
|
-
return range.reduce(function (a, x) { return a + uintOrNaN(x.value) }, 0)
|
|
3924
|
-
}
|
|
3925
|
-
|
|
3926
|
-
var BLANK_OUTPUT = outputBytes({});
|
|
3927
|
-
|
|
3928
|
-
function finalize (inputs, outputs, feeRate) {
|
|
3929
|
-
var bytesAccum = transactionBytes(inputs, outputs);
|
|
3930
|
-
var feeAfterExtraOutput = feeRate * (bytesAccum + BLANK_OUTPUT);
|
|
3931
|
-
var remainderAfterExtraOutput = sumOrNaN(inputs) - (sumOrNaN(outputs) + feeAfterExtraOutput);
|
|
3932
|
-
|
|
3933
|
-
// is it worth a change output?
|
|
3934
|
-
if (remainderAfterExtraOutput > dustThreshold({}, feeRate)) {
|
|
3935
|
-
outputs = outputs.concat({ value: remainderAfterExtraOutput });
|
|
3936
|
-
}
|
|
3937
|
-
|
|
3938
|
-
var fee = sumOrNaN(inputs) - sumOrNaN(outputs);
|
|
3939
|
-
if (!isFinite(fee)) return { fee: feeRate * bytesAccum }
|
|
3940
|
-
|
|
3941
|
-
return {
|
|
3942
|
-
inputs: inputs,
|
|
3943
|
-
outputs: outputs,
|
|
3944
|
-
fee: fee
|
|
3945
|
-
}
|
|
3946
|
-
}
|
|
3947
|
-
|
|
3948
|
-
utils = {
|
|
3949
|
-
dustThreshold: dustThreshold,
|
|
3950
|
-
finalize: finalize,
|
|
3951
|
-
inputBytes: inputBytes,
|
|
3952
|
-
outputBytes: outputBytes,
|
|
3953
|
-
sumOrNaN: sumOrNaN,
|
|
3954
|
-
sumForgiving: sumForgiving,
|
|
3955
|
-
transactionBytes: transactionBytes,
|
|
3956
|
-
uintOrNaN: uintOrNaN
|
|
3957
|
-
};
|
|
3958
|
-
return utils;
|
|
3959
|
-
}
|
|
3960
|
-
|
|
3961
|
-
var accumulative$1;
|
|
3962
|
-
var hasRequiredAccumulative;
|
|
3963
|
-
|
|
3964
|
-
function requireAccumulative () {
|
|
3965
|
-
if (hasRequiredAccumulative) return accumulative$1;
|
|
3966
|
-
hasRequiredAccumulative = 1;
|
|
3967
|
-
var utils = requireUtils();
|
|
3968
|
-
|
|
3969
|
-
// add inputs until we reach or surpass the target value (or deplete)
|
|
3970
|
-
// worst-case: O(n)
|
|
3971
|
-
accumulative$1 = function accumulative (utxos, outputs, feeRate) {
|
|
3972
|
-
if (!isFinite(utils.uintOrNaN(feeRate))) return {}
|
|
3973
|
-
var bytesAccum = utils.transactionBytes([], outputs);
|
|
3974
|
-
|
|
3975
|
-
var inAccum = 0;
|
|
3976
|
-
var inputs = [];
|
|
3977
|
-
var outAccum = utils.sumOrNaN(outputs);
|
|
3978
|
-
|
|
3979
|
-
for (var i = 0; i < utxos.length; ++i) {
|
|
3980
|
-
var utxo = utxos[i];
|
|
3981
|
-
var utxoBytes = utils.inputBytes(utxo);
|
|
3982
|
-
var utxoFee = feeRate * utxoBytes;
|
|
3983
|
-
var utxoValue = utils.uintOrNaN(utxo.value);
|
|
3984
|
-
|
|
3985
|
-
// skip detrimental input
|
|
3986
|
-
if (utxoFee > utxo.value) {
|
|
3987
|
-
if (i === utxos.length - 1) return { fee: feeRate * (bytesAccum + utxoBytes) }
|
|
3988
|
-
continue
|
|
3989
|
-
}
|
|
3990
|
-
|
|
3991
|
-
bytesAccum += utxoBytes;
|
|
3992
|
-
inAccum += utxoValue;
|
|
3993
|
-
inputs.push(utxo);
|
|
3994
|
-
|
|
3995
|
-
var fee = feeRate * bytesAccum;
|
|
3996
|
-
|
|
3997
|
-
// go again?
|
|
3998
|
-
if (inAccum < outAccum + fee) continue
|
|
3999
|
-
|
|
4000
|
-
return utils.finalize(inputs, outputs, feeRate)
|
|
4001
|
-
}
|
|
4002
|
-
|
|
4003
|
-
return { fee: feeRate * bytesAccum }
|
|
4004
|
-
};
|
|
4005
|
-
return accumulative$1;
|
|
4006
|
-
}
|
|
4007
|
-
|
|
4008
|
-
var accumulativeExports = requireAccumulative();
|
|
4009
|
-
var accumulative = /*@__PURE__*/getDefaultExportFromCjs(accumulativeExports);
|
|
4010
|
-
|
|
4011
3874
|
/**
|
|
4012
3875
|
* Object containing the sizes (in bytes) of various components in a Dash transaction.
|
|
4013
3876
|
*/
|
|
@@ -4044,9 +3907,9 @@ const dashNetwork = (network) => {
|
|
|
4044
3907
|
switch (network) {
|
|
4045
3908
|
case Network.Mainnet:
|
|
4046
3909
|
case Network.Stagenet:
|
|
4047
|
-
return
|
|
3910
|
+
return toBitcoinJS('dash', 'main'); // Convert Dash mainnet to BitcoinJS format
|
|
4048
3911
|
case Network.Testnet:
|
|
4049
|
-
return
|
|
3912
|
+
return toBitcoinJS('dash', 'test'); // Convert Dash testnet to BitcoinJS format
|
|
4050
3913
|
}
|
|
4051
3914
|
};
|
|
4052
3915
|
/**
|
|
@@ -4604,4 +4467,3 @@ class ClientLedger extends Client {
|
|
|
4604
4467
|
}
|
|
4605
4468
|
|
|
4606
4469
|
export { AssetDASH, BitgoProviders, BlockcypherDataProviders, ClientKeystore as Client, ClientKeystore, ClientLedger, DASHChain, DASH_DECIMAL, DASH_SYMBOL, DEFAULT_FEE_RATE, LOWER_FEE_BOUND, MIN_TX_FEE, UPPER_FEE_BOUND, buildTx, defaultDashParams, explorerProviders, getPrefix, validateAddress };
|
|
4607
|
-
//# sourceMappingURL=index.esm.js.map
|