@imtbl/sdk 0.39.0 → 0.39.1-alpha.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/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +6 -6
- package/dist/browser/checkout/widgets.js +61 -58
- package/dist/checkout.d.ts +30 -14
- package/dist/checkout.js +790 -1040
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +1003 -1226
- package/dist/index.d.ts +30 -14
- package/dist/index.js +1033 -1256
- package/dist/passport.js +235 -208
- package/package.json +2 -2
package/dist/checkout.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import globalAxios, { HttpStatusCode as HttpStatusCode$2 } from 'axios';
|
|
2
|
-
import { ethers, ContractFactory, utils as utils$
|
|
2
|
+
import { ethers, ContractFactory, utils as utils$2, Contract as Contract$1, BigNumber as BigNumber$1, providers, constants as constants$1 } from 'ethers';
|
|
3
3
|
import { Web3Provider, JsonRpcProvider } from '@ethersproject/providers';
|
|
4
4
|
import detectEthereumProvider from '@metamask/detect-provider';
|
|
5
5
|
import * as Uniswap from '@uniswap/sdk-core';
|
|
@@ -570,8 +570,9 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
570
570
|
const reducedDescriptors = {};
|
|
571
571
|
|
|
572
572
|
forEach(descriptors, (descriptor, name) => {
|
|
573
|
-
|
|
574
|
-
|
|
573
|
+
let ret;
|
|
574
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
575
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
575
576
|
}
|
|
576
577
|
});
|
|
577
578
|
|
|
@@ -697,7 +698,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
|
|
|
697
698
|
const isThenable = (thing) =>
|
|
698
699
|
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
699
700
|
|
|
700
|
-
var utils = {
|
|
701
|
+
var utils$1 = {
|
|
701
702
|
isArray,
|
|
702
703
|
isArrayBuffer,
|
|
703
704
|
isBuffer,
|
|
@@ -779,7 +780,7 @@ function AxiosError(message, code, config, request, response) {
|
|
|
779
780
|
response && (this.response = response);
|
|
780
781
|
}
|
|
781
782
|
|
|
782
|
-
utils.inherits(AxiosError, Error, {
|
|
783
|
+
utils$1.inherits(AxiosError, Error, {
|
|
783
784
|
toJSON: function toJSON() {
|
|
784
785
|
return {
|
|
785
786
|
// Standard
|
|
@@ -794,7 +795,7 @@ utils.inherits(AxiosError, Error, {
|
|
|
794
795
|
columnNumber: this.columnNumber,
|
|
795
796
|
stack: this.stack,
|
|
796
797
|
// Axios
|
|
797
|
-
config: utils.toJSONObject(this.config),
|
|
798
|
+
config: utils$1.toJSONObject(this.config),
|
|
798
799
|
code: this.code,
|
|
799
800
|
status: this.response && this.response.status ? this.response.status : null
|
|
800
801
|
};
|
|
@@ -829,7 +830,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
|
829
830
|
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
830
831
|
const axiosError = Object.create(prototype$1);
|
|
831
832
|
|
|
832
|
-
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
833
|
+
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
833
834
|
return obj !== Error.prototype;
|
|
834
835
|
}, prop => {
|
|
835
836
|
return prop !== 'isAxiosError';
|
|
@@ -857,7 +858,7 @@ var httpAdapter = null;
|
|
|
857
858
|
* @returns {boolean}
|
|
858
859
|
*/
|
|
859
860
|
function isVisitable(thing) {
|
|
860
|
-
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
861
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
861
862
|
}
|
|
862
863
|
|
|
863
864
|
/**
|
|
@@ -868,7 +869,7 @@ function isVisitable(thing) {
|
|
|
868
869
|
* @returns {string} the key without the brackets.
|
|
869
870
|
*/
|
|
870
871
|
function removeBrackets(key) {
|
|
871
|
-
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
872
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
872
873
|
}
|
|
873
874
|
|
|
874
875
|
/**
|
|
@@ -897,10 +898,10 @@ function renderKey(path, key, dots) {
|
|
|
897
898
|
* @returns {boolean}
|
|
898
899
|
*/
|
|
899
900
|
function isFlatArray(arr) {
|
|
900
|
-
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
901
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
901
902
|
}
|
|
902
903
|
|
|
903
|
-
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
904
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
904
905
|
return /^is[A-Z]/.test(prop);
|
|
905
906
|
});
|
|
906
907
|
|
|
@@ -928,7 +929,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
|
928
929
|
* @returns
|
|
929
930
|
*/
|
|
930
931
|
function toFormData(obj, formData, options) {
|
|
931
|
-
if (!utils.isObject(obj)) {
|
|
932
|
+
if (!utils$1.isObject(obj)) {
|
|
932
933
|
throw new TypeError('target must be an object');
|
|
933
934
|
}
|
|
934
935
|
|
|
@@ -936,13 +937,13 @@ function toFormData(obj, formData, options) {
|
|
|
936
937
|
formData = formData || new (FormData)();
|
|
937
938
|
|
|
938
939
|
// eslint-disable-next-line no-param-reassign
|
|
939
|
-
options = utils.toFlatObject(options, {
|
|
940
|
+
options = utils$1.toFlatObject(options, {
|
|
940
941
|
metaTokens: true,
|
|
941
942
|
dots: false,
|
|
942
943
|
indexes: false
|
|
943
944
|
}, false, function defined(option, source) {
|
|
944
945
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
945
|
-
return !utils.isUndefined(source[option]);
|
|
946
|
+
return !utils$1.isUndefined(source[option]);
|
|
946
947
|
});
|
|
947
948
|
|
|
948
949
|
const metaTokens = options.metaTokens;
|
|
@@ -951,24 +952,24 @@ function toFormData(obj, formData, options) {
|
|
|
951
952
|
const dots = options.dots;
|
|
952
953
|
const indexes = options.indexes;
|
|
953
954
|
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
954
|
-
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
|
955
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
955
956
|
|
|
956
|
-
if (!utils.isFunction(visitor)) {
|
|
957
|
+
if (!utils$1.isFunction(visitor)) {
|
|
957
958
|
throw new TypeError('visitor must be a function');
|
|
958
959
|
}
|
|
959
960
|
|
|
960
961
|
function convertValue(value) {
|
|
961
962
|
if (value === null) return '';
|
|
962
963
|
|
|
963
|
-
if (utils.isDate(value)) {
|
|
964
|
+
if (utils$1.isDate(value)) {
|
|
964
965
|
return value.toISOString();
|
|
965
966
|
}
|
|
966
967
|
|
|
967
|
-
if (!useBlob && utils.isBlob(value)) {
|
|
968
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
968
969
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
969
970
|
}
|
|
970
971
|
|
|
971
|
-
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
972
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
972
973
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
973
974
|
}
|
|
974
975
|
|
|
@@ -989,20 +990,20 @@ function toFormData(obj, formData, options) {
|
|
|
989
990
|
let arr = value;
|
|
990
991
|
|
|
991
992
|
if (value && !path && typeof value === 'object') {
|
|
992
|
-
if (utils.endsWith(key, '{}')) {
|
|
993
|
+
if (utils$1.endsWith(key, '{}')) {
|
|
993
994
|
// eslint-disable-next-line no-param-reassign
|
|
994
995
|
key = metaTokens ? key : key.slice(0, -2);
|
|
995
996
|
// eslint-disable-next-line no-param-reassign
|
|
996
997
|
value = JSON.stringify(value);
|
|
997
998
|
} else if (
|
|
998
|
-
(utils.isArray(value) && isFlatArray(value)) ||
|
|
999
|
-
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
|
|
999
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1000
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
1000
1001
|
)) {
|
|
1001
1002
|
// eslint-disable-next-line no-param-reassign
|
|
1002
1003
|
key = removeBrackets(key);
|
|
1003
1004
|
|
|
1004
1005
|
arr.forEach(function each(el, index) {
|
|
1005
|
-
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
1006
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
1006
1007
|
// eslint-disable-next-line no-nested-ternary
|
|
1007
1008
|
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
1008
1009
|
convertValue(el)
|
|
@@ -1030,7 +1031,7 @@ function toFormData(obj, formData, options) {
|
|
|
1030
1031
|
});
|
|
1031
1032
|
|
|
1032
1033
|
function build(value, path) {
|
|
1033
|
-
if (utils.isUndefined(value)) return;
|
|
1034
|
+
if (utils$1.isUndefined(value)) return;
|
|
1034
1035
|
|
|
1035
1036
|
if (stack.indexOf(value) !== -1) {
|
|
1036
1037
|
throw Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -1038,9 +1039,9 @@ function toFormData(obj, formData, options) {
|
|
|
1038
1039
|
|
|
1039
1040
|
stack.push(value);
|
|
1040
1041
|
|
|
1041
|
-
utils.forEach(value, function each(el, key) {
|
|
1042
|
-
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
1043
|
-
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1042
|
+
utils$1.forEach(value, function each(el, key) {
|
|
1043
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
1044
|
+
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1044
1045
|
);
|
|
1045
1046
|
|
|
1046
1047
|
if (result === true) {
|
|
@@ -1051,7 +1052,7 @@ function toFormData(obj, formData, options) {
|
|
|
1051
1052
|
stack.pop();
|
|
1052
1053
|
}
|
|
1053
1054
|
|
|
1054
|
-
if (!utils.isObject(obj)) {
|
|
1055
|
+
if (!utils$1.isObject(obj)) {
|
|
1055
1056
|
throw new TypeError('data must be an object');
|
|
1056
1057
|
}
|
|
1057
1058
|
|
|
@@ -1155,7 +1156,7 @@ function buildURL(url, params, options) {
|
|
|
1155
1156
|
if (serializeFn) {
|
|
1156
1157
|
serializedParams = serializeFn(params, options);
|
|
1157
1158
|
} else {
|
|
1158
|
-
serializedParams = utils.isURLSearchParams(params) ?
|
|
1159
|
+
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
1159
1160
|
params.toString() :
|
|
1160
1161
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
1161
1162
|
}
|
|
@@ -1230,7 +1231,7 @@ class InterceptorManager {
|
|
|
1230
1231
|
* @returns {void}
|
|
1231
1232
|
*/
|
|
1232
1233
|
forEach(fn) {
|
|
1233
|
-
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
1234
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1234
1235
|
if (h !== null) {
|
|
1235
1236
|
fn(h);
|
|
1236
1237
|
}
|
|
@@ -1252,6 +1253,18 @@ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
|
1252
1253
|
|
|
1253
1254
|
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
1254
1255
|
|
|
1256
|
+
var platform$1 = {
|
|
1257
|
+
isBrowser: true,
|
|
1258
|
+
classes: {
|
|
1259
|
+
URLSearchParams: URLSearchParams$1,
|
|
1260
|
+
FormData: FormData$1,
|
|
1261
|
+
Blob: Blob$1
|
|
1262
|
+
},
|
|
1263
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1264
|
+
};
|
|
1265
|
+
|
|
1266
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1267
|
+
|
|
1255
1268
|
/**
|
|
1256
1269
|
* Determine if we're running in a standard browser environment
|
|
1257
1270
|
*
|
|
@@ -1269,18 +1282,10 @@ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
|
1269
1282
|
*
|
|
1270
1283
|
* @returns {boolean}
|
|
1271
1284
|
*/
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
product === 'NativeScript' ||
|
|
1277
|
-
product === 'NS')
|
|
1278
|
-
) {
|
|
1279
|
-
return false;
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1283
|
-
})();
|
|
1285
|
+
const hasStandardBrowserEnv = (
|
|
1286
|
+
(product) => {
|
|
1287
|
+
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
|
|
1288
|
+
})(typeof navigator !== 'undefined' && navigator.product);
|
|
1284
1289
|
|
|
1285
1290
|
/**
|
|
1286
1291
|
* Determine if we're running in a standard browser webWorker environment
|
|
@@ -1291,7 +1296,7 @@ const isStandardBrowserEnv = (() => {
|
|
|
1291
1296
|
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
1292
1297
|
* This leads to a problem when axios post `FormData` in webWorker
|
|
1293
1298
|
*/
|
|
1294
|
-
|
|
1299
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
1295
1300
|
return (
|
|
1296
1301
|
typeof WorkerGlobalScope !== 'undefined' &&
|
|
1297
1302
|
// eslint-disable-next-line no-undef
|
|
@@ -1300,23 +1305,22 @@ const isStandardBrowserEnv = (() => {
|
|
|
1300
1305
|
);
|
|
1301
1306
|
})();
|
|
1302
1307
|
|
|
1308
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
1309
|
+
__proto__: null,
|
|
1310
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
1311
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
1312
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv
|
|
1313
|
+
});
|
|
1303
1314
|
|
|
1304
1315
|
var platform = {
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
URLSearchParams: URLSearchParams$1,
|
|
1308
|
-
FormData: FormData$1,
|
|
1309
|
-
Blob: Blob$1
|
|
1310
|
-
},
|
|
1311
|
-
isStandardBrowserEnv,
|
|
1312
|
-
isStandardBrowserWebWorkerEnv,
|
|
1313
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1316
|
+
...utils,
|
|
1317
|
+
...platform$1
|
|
1314
1318
|
};
|
|
1315
1319
|
|
|
1316
1320
|
function toURLEncodedForm(data, options) {
|
|
1317
1321
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
1318
1322
|
visitor: function(value, key, path, helpers) {
|
|
1319
|
-
if (platform.isNode && utils.isBuffer(value)) {
|
|
1323
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1320
1324
|
this.append(key, value.toString('base64'));
|
|
1321
1325
|
return false;
|
|
1322
1326
|
}
|
|
@@ -1338,7 +1342,7 @@ function parsePropPath(name) {
|
|
|
1338
1342
|
// foo.x.y.z
|
|
1339
1343
|
// foo-x-y-z
|
|
1340
1344
|
// foo x y z
|
|
1341
|
-
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1345
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1342
1346
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1343
1347
|
});
|
|
1344
1348
|
}
|
|
@@ -1373,12 +1377,15 @@ function arrayToObject(arr) {
|
|
|
1373
1377
|
function formDataToJSON(formData) {
|
|
1374
1378
|
function buildPath(path, value, target, index) {
|
|
1375
1379
|
let name = path[index++];
|
|
1380
|
+
|
|
1381
|
+
if (name === '__proto__') return true;
|
|
1382
|
+
|
|
1376
1383
|
const isNumericKey = Number.isFinite(+name);
|
|
1377
1384
|
const isLast = index >= path.length;
|
|
1378
|
-
name = !name && utils.isArray(target) ? target.length : name;
|
|
1385
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
1379
1386
|
|
|
1380
1387
|
if (isLast) {
|
|
1381
|
-
if (utils.hasOwnProp(target, name)) {
|
|
1388
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
1382
1389
|
target[name] = [target[name], value];
|
|
1383
1390
|
} else {
|
|
1384
1391
|
target[name] = value;
|
|
@@ -1387,23 +1394,23 @@ function formDataToJSON(formData) {
|
|
|
1387
1394
|
return !isNumericKey;
|
|
1388
1395
|
}
|
|
1389
1396
|
|
|
1390
|
-
if (!target[name] || !utils.isObject(target[name])) {
|
|
1397
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
1391
1398
|
target[name] = [];
|
|
1392
1399
|
}
|
|
1393
1400
|
|
|
1394
1401
|
const result = buildPath(path, value, target[name], index);
|
|
1395
1402
|
|
|
1396
|
-
if (result && utils.isArray(target[name])) {
|
|
1403
|
+
if (result && utils$1.isArray(target[name])) {
|
|
1397
1404
|
target[name] = arrayToObject(target[name]);
|
|
1398
1405
|
}
|
|
1399
1406
|
|
|
1400
1407
|
return !isNumericKey;
|
|
1401
1408
|
}
|
|
1402
1409
|
|
|
1403
|
-
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
1410
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
1404
1411
|
const obj = {};
|
|
1405
1412
|
|
|
1406
|
-
utils.forEachEntry(formData, (name, value) => {
|
|
1413
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
1407
1414
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
1408
1415
|
});
|
|
1409
1416
|
|
|
@@ -1413,10 +1420,6 @@ function formDataToJSON(formData) {
|
|
|
1413
1420
|
return null;
|
|
1414
1421
|
}
|
|
1415
1422
|
|
|
1416
|
-
const DEFAULT_CONTENT_TYPE = {
|
|
1417
|
-
'Content-Type': undefined
|
|
1418
|
-
};
|
|
1419
|
-
|
|
1420
1423
|
/**
|
|
1421
1424
|
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
1422
1425
|
* of the input
|
|
@@ -1428,10 +1431,10 @@ const DEFAULT_CONTENT_TYPE = {
|
|
|
1428
1431
|
* @returns {string} A stringified version of the rawValue.
|
|
1429
1432
|
*/
|
|
1430
1433
|
function stringifySafely(rawValue, parser, encoder) {
|
|
1431
|
-
if (utils.isString(rawValue)) {
|
|
1434
|
+
if (utils$1.isString(rawValue)) {
|
|
1432
1435
|
try {
|
|
1433
1436
|
(parser || JSON.parse)(rawValue);
|
|
1434
|
-
return utils.trim(rawValue);
|
|
1437
|
+
return utils$1.trim(rawValue);
|
|
1435
1438
|
} catch (e) {
|
|
1436
1439
|
if (e.name !== 'SyntaxError') {
|
|
1437
1440
|
throw e;
|
|
@@ -1451,13 +1454,13 @@ const defaults = {
|
|
|
1451
1454
|
transformRequest: [function transformRequest(data, headers) {
|
|
1452
1455
|
const contentType = headers.getContentType() || '';
|
|
1453
1456
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1454
|
-
const isObjectPayload = utils.isObject(data);
|
|
1457
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
1455
1458
|
|
|
1456
|
-
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
1459
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1457
1460
|
data = new FormData(data);
|
|
1458
1461
|
}
|
|
1459
1462
|
|
|
1460
|
-
const isFormData = utils.isFormData(data);
|
|
1463
|
+
const isFormData = utils$1.isFormData(data);
|
|
1461
1464
|
|
|
1462
1465
|
if (isFormData) {
|
|
1463
1466
|
if (!hasJSONContentType) {
|
|
@@ -1466,18 +1469,18 @@ const defaults = {
|
|
|
1466
1469
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1467
1470
|
}
|
|
1468
1471
|
|
|
1469
|
-
if (utils.isArrayBuffer(data) ||
|
|
1470
|
-
utils.isBuffer(data) ||
|
|
1471
|
-
utils.isStream(data) ||
|
|
1472
|
-
utils.isFile(data) ||
|
|
1473
|
-
utils.isBlob(data)
|
|
1472
|
+
if (utils$1.isArrayBuffer(data) ||
|
|
1473
|
+
utils$1.isBuffer(data) ||
|
|
1474
|
+
utils$1.isStream(data) ||
|
|
1475
|
+
utils$1.isFile(data) ||
|
|
1476
|
+
utils$1.isBlob(data)
|
|
1474
1477
|
) {
|
|
1475
1478
|
return data;
|
|
1476
1479
|
}
|
|
1477
|
-
if (utils.isArrayBufferView(data)) {
|
|
1480
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
1478
1481
|
return data.buffer;
|
|
1479
1482
|
}
|
|
1480
|
-
if (utils.isURLSearchParams(data)) {
|
|
1483
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
1481
1484
|
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1482
1485
|
return data.toString();
|
|
1483
1486
|
}
|
|
@@ -1489,7 +1492,7 @@ const defaults = {
|
|
|
1489
1492
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1490
1493
|
}
|
|
1491
1494
|
|
|
1492
|
-
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
1495
|
+
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
1493
1496
|
const _FormData = this.env && this.env.FormData;
|
|
1494
1497
|
|
|
1495
1498
|
return toFormData(
|
|
@@ -1513,7 +1516,7 @@ const defaults = {
|
|
|
1513
1516
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1514
1517
|
const JSONRequested = this.responseType === 'json';
|
|
1515
1518
|
|
|
1516
|
-
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
1519
|
+
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
1517
1520
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1518
1521
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1519
1522
|
|
|
@@ -1555,24 +1558,21 @@ const defaults = {
|
|
|
1555
1558
|
|
|
1556
1559
|
headers: {
|
|
1557
1560
|
common: {
|
|
1558
|
-
'Accept': 'application/json, text/plain, */*'
|
|
1561
|
+
'Accept': 'application/json, text/plain, */*',
|
|
1562
|
+
'Content-Type': undefined
|
|
1559
1563
|
}
|
|
1560
1564
|
}
|
|
1561
1565
|
};
|
|
1562
1566
|
|
|
1563
|
-
utils.forEach(['delete', 'get', 'head'],
|
|
1567
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
1564
1568
|
defaults.headers[method] = {};
|
|
1565
1569
|
});
|
|
1566
1570
|
|
|
1567
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
1568
|
-
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
1569
|
-
});
|
|
1570
|
-
|
|
1571
1571
|
var defaults$1 = defaults;
|
|
1572
1572
|
|
|
1573
1573
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1574
1574
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1575
|
-
const ignoreDuplicateOf = utils.toObjectSet([
|
|
1575
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1576
1576
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
1577
1577
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
1578
1578
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
@@ -1633,7 +1633,7 @@ function normalizeValue(value) {
|
|
|
1633
1633
|
return value;
|
|
1634
1634
|
}
|
|
1635
1635
|
|
|
1636
|
-
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
1636
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
1637
1637
|
}
|
|
1638
1638
|
|
|
1639
1639
|
function parseTokens(str) {
|
|
@@ -1651,7 +1651,7 @@ function parseTokens(str) {
|
|
|
1651
1651
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1652
1652
|
|
|
1653
1653
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
1654
|
-
if (utils.isFunction(filter)) {
|
|
1654
|
+
if (utils$1.isFunction(filter)) {
|
|
1655
1655
|
return filter.call(this, value, header);
|
|
1656
1656
|
}
|
|
1657
1657
|
|
|
@@ -1659,13 +1659,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
1659
1659
|
value = header;
|
|
1660
1660
|
}
|
|
1661
1661
|
|
|
1662
|
-
if (!utils.isString(value)) return;
|
|
1662
|
+
if (!utils$1.isString(value)) return;
|
|
1663
1663
|
|
|
1664
|
-
if (utils.isString(filter)) {
|
|
1664
|
+
if (utils$1.isString(filter)) {
|
|
1665
1665
|
return value.indexOf(filter) !== -1;
|
|
1666
1666
|
}
|
|
1667
1667
|
|
|
1668
|
-
if (utils.isRegExp(filter)) {
|
|
1668
|
+
if (utils$1.isRegExp(filter)) {
|
|
1669
1669
|
return filter.test(value);
|
|
1670
1670
|
}
|
|
1671
1671
|
}
|
|
@@ -1678,7 +1678,7 @@ function formatHeader(header) {
|
|
|
1678
1678
|
}
|
|
1679
1679
|
|
|
1680
1680
|
function buildAccessors(obj, header) {
|
|
1681
|
-
const accessorName = utils.toCamelCase(' ' + header);
|
|
1681
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1682
1682
|
|
|
1683
1683
|
['get', 'set', 'has'].forEach(methodName => {
|
|
1684
1684
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
@@ -1705,7 +1705,7 @@ class AxiosHeaders {
|
|
|
1705
1705
|
throw new Error('header name must be a non-empty string');
|
|
1706
1706
|
}
|
|
1707
1707
|
|
|
1708
|
-
const key = utils.findKey(self, lHeader);
|
|
1708
|
+
const key = utils$1.findKey(self, lHeader);
|
|
1709
1709
|
|
|
1710
1710
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
1711
1711
|
self[key || _header] = normalizeValue(_value);
|
|
@@ -1713,11 +1713,11 @@ class AxiosHeaders {
|
|
|
1713
1713
|
}
|
|
1714
1714
|
|
|
1715
1715
|
const setHeaders = (headers, _rewrite) =>
|
|
1716
|
-
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1716
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1717
1717
|
|
|
1718
|
-
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
1718
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1719
1719
|
setHeaders(header, valueOrRewrite);
|
|
1720
|
-
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1720
|
+
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1721
1721
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1722
1722
|
} else {
|
|
1723
1723
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
@@ -1730,7 +1730,7 @@ class AxiosHeaders {
|
|
|
1730
1730
|
header = normalizeHeader(header);
|
|
1731
1731
|
|
|
1732
1732
|
if (header) {
|
|
1733
|
-
const key = utils.findKey(this, header);
|
|
1733
|
+
const key = utils$1.findKey(this, header);
|
|
1734
1734
|
|
|
1735
1735
|
if (key) {
|
|
1736
1736
|
const value = this[key];
|
|
@@ -1743,11 +1743,11 @@ class AxiosHeaders {
|
|
|
1743
1743
|
return parseTokens(value);
|
|
1744
1744
|
}
|
|
1745
1745
|
|
|
1746
|
-
if (utils.isFunction(parser)) {
|
|
1746
|
+
if (utils$1.isFunction(parser)) {
|
|
1747
1747
|
return parser.call(this, value, key);
|
|
1748
1748
|
}
|
|
1749
1749
|
|
|
1750
|
-
if (utils.isRegExp(parser)) {
|
|
1750
|
+
if (utils$1.isRegExp(parser)) {
|
|
1751
1751
|
return parser.exec(value);
|
|
1752
1752
|
}
|
|
1753
1753
|
|
|
@@ -1760,7 +1760,7 @@ class AxiosHeaders {
|
|
|
1760
1760
|
header = normalizeHeader(header);
|
|
1761
1761
|
|
|
1762
1762
|
if (header) {
|
|
1763
|
-
const key = utils.findKey(this, header);
|
|
1763
|
+
const key = utils$1.findKey(this, header);
|
|
1764
1764
|
|
|
1765
1765
|
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1766
1766
|
}
|
|
@@ -1776,7 +1776,7 @@ class AxiosHeaders {
|
|
|
1776
1776
|
_header = normalizeHeader(_header);
|
|
1777
1777
|
|
|
1778
1778
|
if (_header) {
|
|
1779
|
-
const key = utils.findKey(self, _header);
|
|
1779
|
+
const key = utils$1.findKey(self, _header);
|
|
1780
1780
|
|
|
1781
1781
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
1782
1782
|
delete self[key];
|
|
@@ -1786,7 +1786,7 @@ class AxiosHeaders {
|
|
|
1786
1786
|
}
|
|
1787
1787
|
}
|
|
1788
1788
|
|
|
1789
|
-
if (utils.isArray(header)) {
|
|
1789
|
+
if (utils$1.isArray(header)) {
|
|
1790
1790
|
header.forEach(deleteHeader);
|
|
1791
1791
|
} else {
|
|
1792
1792
|
deleteHeader(header);
|
|
@@ -1815,8 +1815,8 @@ class AxiosHeaders {
|
|
|
1815
1815
|
const self = this;
|
|
1816
1816
|
const headers = {};
|
|
1817
1817
|
|
|
1818
|
-
utils.forEach(this, (value, header) => {
|
|
1819
|
-
const key = utils.findKey(headers, header);
|
|
1818
|
+
utils$1.forEach(this, (value, header) => {
|
|
1819
|
+
const key = utils$1.findKey(headers, header);
|
|
1820
1820
|
|
|
1821
1821
|
if (key) {
|
|
1822
1822
|
self[key] = normalizeValue(value);
|
|
@@ -1845,8 +1845,8 @@ class AxiosHeaders {
|
|
|
1845
1845
|
toJSON(asStrings) {
|
|
1846
1846
|
const obj = Object.create(null);
|
|
1847
1847
|
|
|
1848
|
-
utils.forEach(this, (value, header) => {
|
|
1849
|
-
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
|
1848
|
+
utils$1.forEach(this, (value, header) => {
|
|
1849
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
1850
1850
|
});
|
|
1851
1851
|
|
|
1852
1852
|
return obj;
|
|
@@ -1893,7 +1893,7 @@ class AxiosHeaders {
|
|
|
1893
1893
|
}
|
|
1894
1894
|
}
|
|
1895
1895
|
|
|
1896
|
-
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1896
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1897
1897
|
|
|
1898
1898
|
return this;
|
|
1899
1899
|
}
|
|
@@ -1901,8 +1901,18 @@ class AxiosHeaders {
|
|
|
1901
1901
|
|
|
1902
1902
|
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
1903
1903
|
|
|
1904
|
-
|
|
1905
|
-
utils.
|
|
1904
|
+
// reserved names hotfix
|
|
1905
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
1906
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
1907
|
+
return {
|
|
1908
|
+
get: () => value,
|
|
1909
|
+
set(headerValue) {
|
|
1910
|
+
this[mapped] = headerValue;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
});
|
|
1914
|
+
|
|
1915
|
+
utils$1.freezeMethods(AxiosHeaders);
|
|
1906
1916
|
|
|
1907
1917
|
var AxiosHeaders$1 = AxiosHeaders;
|
|
1908
1918
|
|
|
@@ -1920,7 +1930,7 @@ function transformData(fns, response) {
|
|
|
1920
1930
|
const headers = AxiosHeaders$1.from(context.headers);
|
|
1921
1931
|
let data = context.data;
|
|
1922
1932
|
|
|
1923
|
-
utils.forEach(fns, function transform(fn) {
|
|
1933
|
+
utils$1.forEach(fns, function transform(fn) {
|
|
1924
1934
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
1925
1935
|
});
|
|
1926
1936
|
|
|
@@ -1948,7 +1958,7 @@ function CanceledError(message, config, request) {
|
|
|
1948
1958
|
this.name = 'CanceledError';
|
|
1949
1959
|
}
|
|
1950
1960
|
|
|
1951
|
-
utils.inherits(CanceledError, AxiosError, {
|
|
1961
|
+
utils$1.inherits(CanceledError, AxiosError, {
|
|
1952
1962
|
__CANCEL__: true
|
|
1953
1963
|
});
|
|
1954
1964
|
|
|
@@ -1976,53 +1986,44 @@ function settle(resolve, reject, response) {
|
|
|
1976
1986
|
}
|
|
1977
1987
|
}
|
|
1978
1988
|
|
|
1979
|
-
var cookies = platform.
|
|
1989
|
+
var cookies = platform.hasStandardBrowserEnv ?
|
|
1980
1990
|
|
|
1981
|
-
// Standard browser envs support document.cookie
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
const cookie = [];
|
|
1986
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
|
1991
|
+
// Standard browser envs support document.cookie
|
|
1992
|
+
{
|
|
1993
|
+
write(name, value, expires, path, domain, secure) {
|
|
1994
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
1987
1995
|
|
|
1988
|
-
|
|
1989
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
1990
|
-
}
|
|
1996
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
1991
1997
|
|
|
1992
|
-
|
|
1993
|
-
cookie.push('path=' + path);
|
|
1994
|
-
}
|
|
1998
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
|
1995
1999
|
|
|
1996
|
-
|
|
1997
|
-
cookie.push('domain=' + domain);
|
|
1998
|
-
}
|
|
2000
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
1999
2001
|
|
|
2000
|
-
|
|
2001
|
-
cookie.push('secure');
|
|
2002
|
-
}
|
|
2002
|
+
secure === true && cookie.push('secure');
|
|
2003
2003
|
|
|
2004
|
-
|
|
2005
|
-
|
|
2004
|
+
document.cookie = cookie.join('; ');
|
|
2005
|
+
},
|
|
2006
2006
|
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2007
|
+
read(name) {
|
|
2008
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
2009
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
2010
|
+
},
|
|
2011
2011
|
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
})() :
|
|
2012
|
+
remove(name) {
|
|
2013
|
+
this.write(name, '', Date.now() - 86400000);
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2017
2016
|
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2017
|
+
:
|
|
2018
|
+
|
|
2019
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
2020
|
+
{
|
|
2021
|
+
write() {},
|
|
2022
|
+
read() {
|
|
2023
|
+
return null;
|
|
2024
|
+
},
|
|
2025
|
+
remove() {}
|
|
2026
|
+
};
|
|
2026
2027
|
|
|
2027
2028
|
/**
|
|
2028
2029
|
* Determines whether the specified URL is absolute
|
|
@@ -2048,7 +2049,7 @@ function isAbsoluteURL(url) {
|
|
|
2048
2049
|
*/
|
|
2049
2050
|
function combineURLs(baseURL, relativeURL) {
|
|
2050
2051
|
return relativeURL
|
|
2051
|
-
? baseURL.replace(
|
|
2052
|
+
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
2052
2053
|
: baseURL;
|
|
2053
2054
|
}
|
|
2054
2055
|
|
|
@@ -2069,7 +2070,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
|
2069
2070
|
return requestedURL;
|
|
2070
2071
|
}
|
|
2071
2072
|
|
|
2072
|
-
var isURLSameOrigin = platform.
|
|
2073
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
2073
2074
|
|
|
2074
2075
|
// Standard browser envs have full support of the APIs needed to test
|
|
2075
2076
|
// whether the request URL is of the same origin as current location.
|
|
@@ -2079,7 +2080,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
|
2079
2080
|
let originURL;
|
|
2080
2081
|
|
|
2081
2082
|
/**
|
|
2082
|
-
* Parse a URL to discover
|
|
2083
|
+
* Parse a URL to discover its components
|
|
2083
2084
|
*
|
|
2084
2085
|
* @param {String} url The URL to be parsed
|
|
2085
2086
|
* @returns {Object}
|
|
@@ -2119,7 +2120,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
|
2119
2120
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
2120
2121
|
*/
|
|
2121
2122
|
return function isURLSameOrigin(requestURL) {
|
|
2122
|
-
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
2123
|
+
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
2123
2124
|
return (parsed.protocol === originURL.protocol &&
|
|
2124
2125
|
parsed.host === originURL.host);
|
|
2125
2126
|
};
|
|
@@ -2224,7 +2225,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2224
2225
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2225
2226
|
let requestData = config.data;
|
|
2226
2227
|
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
|
2227
|
-
|
|
2228
|
+
let {responseType, withXSRFToken} = config;
|
|
2228
2229
|
let onCanceled;
|
|
2229
2230
|
function done() {
|
|
2230
2231
|
if (config.cancelToken) {
|
|
@@ -2236,11 +2237,15 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2236
2237
|
}
|
|
2237
2238
|
}
|
|
2238
2239
|
|
|
2239
|
-
|
|
2240
|
-
|
|
2240
|
+
let contentType;
|
|
2241
|
+
|
|
2242
|
+
if (utils$1.isFormData(requestData)) {
|
|
2243
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2241
2244
|
requestHeaders.setContentType(false); // Let the browser set it
|
|
2242
|
-
} else {
|
|
2243
|
-
|
|
2245
|
+
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
|
2246
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
2247
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
2248
|
+
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
2244
2249
|
}
|
|
2245
2250
|
}
|
|
2246
2251
|
|
|
@@ -2356,13 +2361,16 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2356
2361
|
// Add xsrf header
|
|
2357
2362
|
// This is only done if running in a standard browser environment.
|
|
2358
2363
|
// Specifically not if we're in a web worker, or react-native.
|
|
2359
|
-
if
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2364
|
+
if(platform.hasStandardBrowserEnv) {
|
|
2365
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
|
2366
|
+
|
|
2367
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
|
2368
|
+
// Add xsrf header
|
|
2369
|
+
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
2363
2370
|
|
|
2364
|
-
|
|
2365
|
-
|
|
2371
|
+
if (xsrfValue) {
|
|
2372
|
+
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
2373
|
+
}
|
|
2366
2374
|
}
|
|
2367
2375
|
}
|
|
2368
2376
|
|
|
@@ -2371,13 +2379,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2371
2379
|
|
|
2372
2380
|
// Add headers to the request
|
|
2373
2381
|
if ('setRequestHeader' in request) {
|
|
2374
|
-
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2382
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2375
2383
|
request.setRequestHeader(key, val);
|
|
2376
2384
|
});
|
|
2377
2385
|
}
|
|
2378
2386
|
|
|
2379
2387
|
// Add withCredentials to request if needed
|
|
2380
|
-
if (!utils.isUndefined(config.withCredentials)) {
|
|
2388
|
+
if (!utils$1.isUndefined(config.withCredentials)) {
|
|
2381
2389
|
request.withCredentials = !!config.withCredentials;
|
|
2382
2390
|
}
|
|
2383
2391
|
|
|
@@ -2432,8 +2440,8 @@ const knownAdapters = {
|
|
|
2432
2440
|
xhr: xhrAdapter
|
|
2433
2441
|
};
|
|
2434
2442
|
|
|
2435
|
-
utils.forEach(knownAdapters, (fn, value) => {
|
|
2436
|
-
if(fn) {
|
|
2443
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
2444
|
+
if (fn) {
|
|
2437
2445
|
try {
|
|
2438
2446
|
Object.defineProperty(fn, 'name', {value});
|
|
2439
2447
|
} catch (e) {
|
|
@@ -2443,38 +2451,56 @@ utils.forEach(knownAdapters, (fn, value) => {
|
|
|
2443
2451
|
}
|
|
2444
2452
|
});
|
|
2445
2453
|
|
|
2454
|
+
const renderReason = (reason) => `- ${reason}`;
|
|
2455
|
+
|
|
2456
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
2457
|
+
|
|
2446
2458
|
var adapters = {
|
|
2447
2459
|
getAdapter: (adapters) => {
|
|
2448
|
-
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
2460
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
2449
2461
|
|
|
2450
2462
|
const {length} = adapters;
|
|
2451
2463
|
let nameOrAdapter;
|
|
2452
2464
|
let adapter;
|
|
2453
2465
|
|
|
2466
|
+
const rejectedReasons = {};
|
|
2467
|
+
|
|
2454
2468
|
for (let i = 0; i < length; i++) {
|
|
2455
2469
|
nameOrAdapter = adapters[i];
|
|
2456
|
-
|
|
2470
|
+
let id;
|
|
2471
|
+
|
|
2472
|
+
adapter = nameOrAdapter;
|
|
2473
|
+
|
|
2474
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
2475
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
2476
|
+
|
|
2477
|
+
if (adapter === undefined) {
|
|
2478
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
if (adapter) {
|
|
2457
2483
|
break;
|
|
2458
2484
|
}
|
|
2485
|
+
|
|
2486
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
2459
2487
|
}
|
|
2460
2488
|
|
|
2461
2489
|
if (!adapter) {
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
'
|
|
2490
|
+
|
|
2491
|
+
const reasons = Object.entries(rejectedReasons)
|
|
2492
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
2493
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
2466
2494
|
);
|
|
2467
|
-
}
|
|
2468
2495
|
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
`Unknown adapter '${nameOrAdapter}'`
|
|
2473
|
-
);
|
|
2474
|
-
}
|
|
2496
|
+
let s = length ?
|
|
2497
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
2498
|
+
'as no adapter specified';
|
|
2475
2499
|
|
|
2476
|
-
|
|
2477
|
-
|
|
2500
|
+
throw new AxiosError(
|
|
2501
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
2502
|
+
'ERR_NOT_SUPPORT'
|
|
2503
|
+
);
|
|
2478
2504
|
}
|
|
2479
2505
|
|
|
2480
2506
|
return adapter;
|
|
@@ -2572,11 +2598,11 @@ function mergeConfig(config1, config2) {
|
|
|
2572
2598
|
const config = {};
|
|
2573
2599
|
|
|
2574
2600
|
function getMergedValue(target, source, caseless) {
|
|
2575
|
-
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
2576
|
-
return utils.merge.call({caseless}, target, source);
|
|
2577
|
-
} else if (utils.isPlainObject(source)) {
|
|
2578
|
-
return utils.merge({}, source);
|
|
2579
|
-
} else if (utils.isArray(source)) {
|
|
2601
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2602
|
+
return utils$1.merge.call({caseless}, target, source);
|
|
2603
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
2604
|
+
return utils$1.merge({}, source);
|
|
2605
|
+
} else if (utils$1.isArray(source)) {
|
|
2580
2606
|
return source.slice();
|
|
2581
2607
|
}
|
|
2582
2608
|
return source;
|
|
@@ -2584,25 +2610,25 @@ function mergeConfig(config1, config2) {
|
|
|
2584
2610
|
|
|
2585
2611
|
// eslint-disable-next-line consistent-return
|
|
2586
2612
|
function mergeDeepProperties(a, b, caseless) {
|
|
2587
|
-
if (!utils.isUndefined(b)) {
|
|
2613
|
+
if (!utils$1.isUndefined(b)) {
|
|
2588
2614
|
return getMergedValue(a, b, caseless);
|
|
2589
|
-
} else if (!utils.isUndefined(a)) {
|
|
2615
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2590
2616
|
return getMergedValue(undefined, a, caseless);
|
|
2591
2617
|
}
|
|
2592
2618
|
}
|
|
2593
2619
|
|
|
2594
2620
|
// eslint-disable-next-line consistent-return
|
|
2595
2621
|
function valueFromConfig2(a, b) {
|
|
2596
|
-
if (!utils.isUndefined(b)) {
|
|
2622
|
+
if (!utils$1.isUndefined(b)) {
|
|
2597
2623
|
return getMergedValue(undefined, b);
|
|
2598
2624
|
}
|
|
2599
2625
|
}
|
|
2600
2626
|
|
|
2601
2627
|
// eslint-disable-next-line consistent-return
|
|
2602
2628
|
function defaultToConfig2(a, b) {
|
|
2603
|
-
if (!utils.isUndefined(b)) {
|
|
2629
|
+
if (!utils$1.isUndefined(b)) {
|
|
2604
2630
|
return getMergedValue(undefined, b);
|
|
2605
|
-
} else if (!utils.isUndefined(a)) {
|
|
2631
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2606
2632
|
return getMergedValue(undefined, a);
|
|
2607
2633
|
}
|
|
2608
2634
|
}
|
|
@@ -2627,6 +2653,7 @@ function mergeConfig(config1, config2) {
|
|
|
2627
2653
|
timeout: defaultToConfig2,
|
|
2628
2654
|
timeoutMessage: defaultToConfig2,
|
|
2629
2655
|
withCredentials: defaultToConfig2,
|
|
2656
|
+
withXSRFToken: defaultToConfig2,
|
|
2630
2657
|
adapter: defaultToConfig2,
|
|
2631
2658
|
responseType: defaultToConfig2,
|
|
2632
2659
|
xsrfCookieName: defaultToConfig2,
|
|
@@ -2647,16 +2674,16 @@ function mergeConfig(config1, config2) {
|
|
|
2647
2674
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
2648
2675
|
};
|
|
2649
2676
|
|
|
2650
|
-
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2677
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2651
2678
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2652
2679
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2653
|
-
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2680
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2654
2681
|
});
|
|
2655
2682
|
|
|
2656
2683
|
return config;
|
|
2657
2684
|
}
|
|
2658
2685
|
|
|
2659
|
-
const VERSION = "1.
|
|
2686
|
+
const VERSION = "1.6.5";
|
|
2660
2687
|
|
|
2661
2688
|
const validators$1 = {};
|
|
2662
2689
|
|
|
@@ -2794,7 +2821,7 @@ class Axios {
|
|
|
2794
2821
|
}
|
|
2795
2822
|
|
|
2796
2823
|
if (paramsSerializer != null) {
|
|
2797
|
-
if (utils.isFunction(paramsSerializer)) {
|
|
2824
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
2798
2825
|
config.paramsSerializer = {
|
|
2799
2826
|
serialize: paramsSerializer
|
|
2800
2827
|
};
|
|
@@ -2809,15 +2836,13 @@ class Axios {
|
|
|
2809
2836
|
// Set config.method
|
|
2810
2837
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
2811
2838
|
|
|
2812
|
-
let contextHeaders;
|
|
2813
|
-
|
|
2814
2839
|
// Flatten headers
|
|
2815
|
-
contextHeaders = headers && utils.merge(
|
|
2840
|
+
let contextHeaders = headers && utils$1.merge(
|
|
2816
2841
|
headers.common,
|
|
2817
2842
|
headers[config.method]
|
|
2818
2843
|
);
|
|
2819
2844
|
|
|
2820
|
-
|
|
2845
|
+
headers && utils$1.forEach(
|
|
2821
2846
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
2822
2847
|
(method) => {
|
|
2823
2848
|
delete headers[method];
|
|
@@ -2904,7 +2929,7 @@ class Axios {
|
|
|
2904
2929
|
}
|
|
2905
2930
|
|
|
2906
2931
|
// Provide aliases for supported request methods
|
|
2907
|
-
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
2932
|
+
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
2908
2933
|
/*eslint func-names:0*/
|
|
2909
2934
|
Axios.prototype[method] = function(url, config) {
|
|
2910
2935
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -2915,7 +2940,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
|
2915
2940
|
};
|
|
2916
2941
|
});
|
|
2917
2942
|
|
|
2918
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2943
|
+
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2919
2944
|
/*eslint func-names:0*/
|
|
2920
2945
|
|
|
2921
2946
|
function generateHTTPMethod(isForm) {
|
|
@@ -3091,7 +3116,7 @@ function spread(callback) {
|
|
|
3091
3116
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
3092
3117
|
*/
|
|
3093
3118
|
function isAxiosError(payload) {
|
|
3094
|
-
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
3119
|
+
return utils$1.isObject(payload) && (payload.isAxiosError === true);
|
|
3095
3120
|
}
|
|
3096
3121
|
|
|
3097
3122
|
const HttpStatusCode = {
|
|
@@ -3178,10 +3203,10 @@ function createInstance(defaultConfig) {
|
|
|
3178
3203
|
const instance = bind(Axios$1.prototype.request, context);
|
|
3179
3204
|
|
|
3180
3205
|
// Copy axios.prototype to instance
|
|
3181
|
-
utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
3206
|
+
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
3182
3207
|
|
|
3183
3208
|
// Copy context to instance
|
|
3184
|
-
utils.extend(instance, context, null, {allOwnKeys: true});
|
|
3209
|
+
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
3185
3210
|
|
|
3186
3211
|
// Factory for creating new instances
|
|
3187
3212
|
instance.create = function create(instanceConfig) {
|
|
@@ -3225,7 +3250,9 @@ axios.mergeConfig = mergeConfig;
|
|
|
3225
3250
|
|
|
3226
3251
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
3227
3252
|
|
|
3228
|
-
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3253
|
+
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3254
|
+
|
|
3255
|
+
axios.getAdapter = adapters.getAdapter;
|
|
3229
3256
|
|
|
3230
3257
|
axios.HttpStatusCode = HttpStatusCode$1;
|
|
3231
3258
|
|
|
@@ -6633,7 +6660,7 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
|
|
|
6633
6660
|
var bnExports = bn.exports;
|
|
6634
6661
|
var BN$1 = /*@__PURE__*/getDefaultExportFromCjs(bnExports);
|
|
6635
6662
|
|
|
6636
|
-
const version$
|
|
6663
|
+
const version$b = "logger/5.7.0";
|
|
6637
6664
|
|
|
6638
6665
|
let _permanentCensorErrors = false;
|
|
6639
6666
|
let _censorErrors = false;
|
|
@@ -6948,7 +6975,7 @@ class Logger {
|
|
|
6948
6975
|
}
|
|
6949
6976
|
static globalLogger() {
|
|
6950
6977
|
if (!_globalLogger) {
|
|
6951
|
-
_globalLogger = new Logger(version$
|
|
6978
|
+
_globalLogger = new Logger(version$b);
|
|
6952
6979
|
}
|
|
6953
6980
|
return _globalLogger;
|
|
6954
6981
|
}
|
|
@@ -6984,9 +7011,9 @@ class Logger {
|
|
|
6984
7011
|
Logger.errors = ErrorCode;
|
|
6985
7012
|
Logger.levels = LogLevel;
|
|
6986
7013
|
|
|
6987
|
-
const version$
|
|
7014
|
+
const version$a = "bytes/5.7.0";
|
|
6988
7015
|
|
|
6989
|
-
const logger$
|
|
7016
|
+
const logger$e = new Logger(version$a);
|
|
6990
7017
|
///////////////////////////////
|
|
6991
7018
|
function isHexable(value) {
|
|
6992
7019
|
return !!(value.toHexString);
|
|
@@ -7033,7 +7060,7 @@ function arrayify(value, options) {
|
|
|
7033
7060
|
options = {};
|
|
7034
7061
|
}
|
|
7035
7062
|
if (typeof (value) === "number") {
|
|
7036
|
-
logger$
|
|
7063
|
+
logger$e.checkSafeUint53(value, "invalid arrayify value");
|
|
7037
7064
|
const result = [];
|
|
7038
7065
|
while (value) {
|
|
7039
7066
|
result.unshift(value & 0xff);
|
|
@@ -7060,7 +7087,7 @@ function arrayify(value, options) {
|
|
|
7060
7087
|
hex += "0";
|
|
7061
7088
|
}
|
|
7062
7089
|
else {
|
|
7063
|
-
logger$
|
|
7090
|
+
logger$e.throwArgumentError("hex data is odd-length", "value", value);
|
|
7064
7091
|
}
|
|
7065
7092
|
}
|
|
7066
7093
|
const result = [];
|
|
@@ -7072,7 +7099,7 @@ function arrayify(value, options) {
|
|
|
7072
7099
|
if (isBytes(value)) {
|
|
7073
7100
|
return addSlice(new Uint8Array(value));
|
|
7074
7101
|
}
|
|
7075
|
-
return logger$
|
|
7102
|
+
return logger$e.throwArgumentError("invalid arrayify value", "value", value);
|
|
7076
7103
|
}
|
|
7077
7104
|
function concat(items) {
|
|
7078
7105
|
const objects = items.map(item => arrayify(item));
|
|
@@ -7115,7 +7142,7 @@ function hexlify(value, options) {
|
|
|
7115
7142
|
options = {};
|
|
7116
7143
|
}
|
|
7117
7144
|
if (typeof (value) === "number") {
|
|
7118
|
-
logger$
|
|
7145
|
+
logger$e.checkSafeUint53(value, "invalid hexlify value");
|
|
7119
7146
|
let hex = "";
|
|
7120
7147
|
while (value) {
|
|
7121
7148
|
hex = HexCharacters[value & 0xf] + hex;
|
|
@@ -7151,7 +7178,7 @@ function hexlify(value, options) {
|
|
|
7151
7178
|
value += "0";
|
|
7152
7179
|
}
|
|
7153
7180
|
else {
|
|
7154
|
-
logger$
|
|
7181
|
+
logger$e.throwArgumentError("hex data is odd-length", "value", value);
|
|
7155
7182
|
}
|
|
7156
7183
|
}
|
|
7157
7184
|
return value.toLowerCase();
|
|
@@ -7164,7 +7191,7 @@ function hexlify(value, options) {
|
|
|
7164
7191
|
}
|
|
7165
7192
|
return result;
|
|
7166
7193
|
}
|
|
7167
|
-
return logger$
|
|
7194
|
+
return logger$e.throwArgumentError("invalid hexlify value", "value", value);
|
|
7168
7195
|
}
|
|
7169
7196
|
/*
|
|
7170
7197
|
function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {
|
|
@@ -7188,7 +7215,7 @@ function hexDataSlice(data, offset, endOffset) {
|
|
|
7188
7215
|
data = hexlify(data);
|
|
7189
7216
|
}
|
|
7190
7217
|
else if (!isHexString(data) || (data.length % 2)) {
|
|
7191
|
-
logger$
|
|
7218
|
+
logger$e.throwArgumentError("invalid hexData", "value", data);
|
|
7192
7219
|
}
|
|
7193
7220
|
offset = 2 + 2 * offset;
|
|
7194
7221
|
if (endOffset != null) {
|
|
@@ -7208,10 +7235,10 @@ function hexZeroPad(value, length) {
|
|
|
7208
7235
|
value = hexlify(value);
|
|
7209
7236
|
}
|
|
7210
7237
|
else if (!isHexString(value)) {
|
|
7211
|
-
logger$
|
|
7238
|
+
logger$e.throwArgumentError("invalid hex string", "value", value);
|
|
7212
7239
|
}
|
|
7213
7240
|
if (value.length > 2 * length + 2) {
|
|
7214
|
-
logger$
|
|
7241
|
+
logger$e.throwArgumentError("value out of range", "value", arguments[1]);
|
|
7215
7242
|
}
|
|
7216
7243
|
while (value.length < 2 * length + 2) {
|
|
7217
7244
|
value = "0x0" + value.substring(2);
|
|
@@ -7219,26 +7246,18 @@ function hexZeroPad(value, length) {
|
|
|
7219
7246
|
return value;
|
|
7220
7247
|
}
|
|
7221
7248
|
|
|
7222
|
-
const version$
|
|
7249
|
+
const version$9 = "bignumber/5.7.0";
|
|
7223
7250
|
|
|
7224
7251
|
var BN = BN$1.BN;
|
|
7225
|
-
const logger$
|
|
7226
|
-
const _constructorGuard$
|
|
7252
|
+
const logger$d = new Logger(version$9);
|
|
7253
|
+
const _constructorGuard$1 = {};
|
|
7227
7254
|
const MAX_SAFE = 0x1fffffffffffff;
|
|
7228
|
-
function isBigNumberish(value) {
|
|
7229
|
-
return (value != null) && (BigNumber.isBigNumber(value) ||
|
|
7230
|
-
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
7231
|
-
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
7232
|
-
isHexString(value) ||
|
|
7233
|
-
(typeof (value) === "bigint") ||
|
|
7234
|
-
isBytes(value));
|
|
7235
|
-
}
|
|
7236
7255
|
// Only warn about passing 10 into radix once
|
|
7237
7256
|
let _warnedToStringRadix = false;
|
|
7238
7257
|
class BigNumber {
|
|
7239
7258
|
constructor(constructorGuard, hex) {
|
|
7240
|
-
if (constructorGuard !== _constructorGuard$
|
|
7241
|
-
logger$
|
|
7259
|
+
if (constructorGuard !== _constructorGuard$1) {
|
|
7260
|
+
logger$d.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
7242
7261
|
operation: "new (BigNumber)"
|
|
7243
7262
|
});
|
|
7244
7263
|
}
|
|
@@ -7267,7 +7286,7 @@ class BigNumber {
|
|
|
7267
7286
|
div(other) {
|
|
7268
7287
|
const o = BigNumber.from(other);
|
|
7269
7288
|
if (o.isZero()) {
|
|
7270
|
-
throwFault
|
|
7289
|
+
throwFault("division-by-zero", "div");
|
|
7271
7290
|
}
|
|
7272
7291
|
return toBigNumber(toBN(this).div(toBN(other)));
|
|
7273
7292
|
}
|
|
@@ -7277,53 +7296,53 @@ class BigNumber {
|
|
|
7277
7296
|
mod(other) {
|
|
7278
7297
|
const value = toBN(other);
|
|
7279
7298
|
if (value.isNeg()) {
|
|
7280
|
-
throwFault
|
|
7299
|
+
throwFault("division-by-zero", "mod");
|
|
7281
7300
|
}
|
|
7282
7301
|
return toBigNumber(toBN(this).umod(value));
|
|
7283
7302
|
}
|
|
7284
7303
|
pow(other) {
|
|
7285
7304
|
const value = toBN(other);
|
|
7286
7305
|
if (value.isNeg()) {
|
|
7287
|
-
throwFault
|
|
7306
|
+
throwFault("negative-power", "pow");
|
|
7288
7307
|
}
|
|
7289
7308
|
return toBigNumber(toBN(this).pow(value));
|
|
7290
7309
|
}
|
|
7291
7310
|
and(other) {
|
|
7292
7311
|
const value = toBN(other);
|
|
7293
7312
|
if (this.isNegative() || value.isNeg()) {
|
|
7294
|
-
throwFault
|
|
7313
|
+
throwFault("unbound-bitwise-result", "and");
|
|
7295
7314
|
}
|
|
7296
7315
|
return toBigNumber(toBN(this).and(value));
|
|
7297
7316
|
}
|
|
7298
7317
|
or(other) {
|
|
7299
7318
|
const value = toBN(other);
|
|
7300
7319
|
if (this.isNegative() || value.isNeg()) {
|
|
7301
|
-
throwFault
|
|
7320
|
+
throwFault("unbound-bitwise-result", "or");
|
|
7302
7321
|
}
|
|
7303
7322
|
return toBigNumber(toBN(this).or(value));
|
|
7304
7323
|
}
|
|
7305
7324
|
xor(other) {
|
|
7306
7325
|
const value = toBN(other);
|
|
7307
7326
|
if (this.isNegative() || value.isNeg()) {
|
|
7308
|
-
throwFault
|
|
7327
|
+
throwFault("unbound-bitwise-result", "xor");
|
|
7309
7328
|
}
|
|
7310
7329
|
return toBigNumber(toBN(this).xor(value));
|
|
7311
7330
|
}
|
|
7312
7331
|
mask(value) {
|
|
7313
7332
|
if (this.isNegative() || value < 0) {
|
|
7314
|
-
throwFault
|
|
7333
|
+
throwFault("negative-width", "mask");
|
|
7315
7334
|
}
|
|
7316
7335
|
return toBigNumber(toBN(this).maskn(value));
|
|
7317
7336
|
}
|
|
7318
7337
|
shl(value) {
|
|
7319
7338
|
if (this.isNegative() || value < 0) {
|
|
7320
|
-
throwFault
|
|
7339
|
+
throwFault("negative-width", "shl");
|
|
7321
7340
|
}
|
|
7322
7341
|
return toBigNumber(toBN(this).shln(value));
|
|
7323
7342
|
}
|
|
7324
7343
|
shr(value) {
|
|
7325
7344
|
if (this.isNegative() || value < 0) {
|
|
7326
|
-
throwFault
|
|
7345
|
+
throwFault("negative-width", "shr");
|
|
7327
7346
|
}
|
|
7328
7347
|
return toBigNumber(toBN(this).shrn(value));
|
|
7329
7348
|
}
|
|
@@ -7353,7 +7372,7 @@ class BigNumber {
|
|
|
7353
7372
|
return toBN(this).toNumber();
|
|
7354
7373
|
}
|
|
7355
7374
|
catch (error) {
|
|
7356
|
-
throwFault
|
|
7375
|
+
throwFault("overflow", "toNumber", this.toString());
|
|
7357
7376
|
}
|
|
7358
7377
|
return null;
|
|
7359
7378
|
}
|
|
@@ -7362,7 +7381,7 @@ class BigNumber {
|
|
|
7362
7381
|
return BigInt(this.toString());
|
|
7363
7382
|
}
|
|
7364
7383
|
catch (e) { }
|
|
7365
|
-
return logger$
|
|
7384
|
+
return logger$d.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
7366
7385
|
value: this.toString()
|
|
7367
7386
|
});
|
|
7368
7387
|
}
|
|
@@ -7372,14 +7391,14 @@ class BigNumber {
|
|
|
7372
7391
|
if (arguments[0] === 10) {
|
|
7373
7392
|
if (!_warnedToStringRadix) {
|
|
7374
7393
|
_warnedToStringRadix = true;
|
|
7375
|
-
logger$
|
|
7394
|
+
logger$d.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
7376
7395
|
}
|
|
7377
7396
|
}
|
|
7378
7397
|
else if (arguments[0] === 16) {
|
|
7379
|
-
logger$
|
|
7398
|
+
logger$d.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
7380
7399
|
}
|
|
7381
7400
|
else {
|
|
7382
|
-
logger$
|
|
7401
|
+
logger$d.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
7383
7402
|
}
|
|
7384
7403
|
}
|
|
7385
7404
|
return toBN(this).toString(10);
|
|
@@ -7396,19 +7415,19 @@ class BigNumber {
|
|
|
7396
7415
|
}
|
|
7397
7416
|
if (typeof (value) === "string") {
|
|
7398
7417
|
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
7399
|
-
return new BigNumber(_constructorGuard$
|
|
7418
|
+
return new BigNumber(_constructorGuard$1, toHex(value));
|
|
7400
7419
|
}
|
|
7401
7420
|
if (value.match(/^-?[0-9]+$/)) {
|
|
7402
|
-
return new BigNumber(_constructorGuard$
|
|
7421
|
+
return new BigNumber(_constructorGuard$1, toHex(new BN(value)));
|
|
7403
7422
|
}
|
|
7404
|
-
return logger$
|
|
7423
|
+
return logger$d.throwArgumentError("invalid BigNumber string", "value", value);
|
|
7405
7424
|
}
|
|
7406
7425
|
if (typeof (value) === "number") {
|
|
7407
7426
|
if (value % 1) {
|
|
7408
|
-
throwFault
|
|
7427
|
+
throwFault("underflow", "BigNumber.from", value);
|
|
7409
7428
|
}
|
|
7410
7429
|
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
|
|
7411
|
-
throwFault
|
|
7430
|
+
throwFault("overflow", "BigNumber.from", value);
|
|
7412
7431
|
}
|
|
7413
7432
|
return BigNumber.from(String(value));
|
|
7414
7433
|
}
|
|
@@ -7441,7 +7460,7 @@ class BigNumber {
|
|
|
7441
7460
|
}
|
|
7442
7461
|
}
|
|
7443
7462
|
}
|
|
7444
|
-
return logger$
|
|
7463
|
+
return logger$d.throwArgumentError("invalid BigNumber value", "value", value);
|
|
7445
7464
|
}
|
|
7446
7465
|
static isBigNumber(value) {
|
|
7447
7466
|
return !!(value && value._isBigNumber);
|
|
@@ -7459,7 +7478,7 @@ function toHex(value) {
|
|
|
7459
7478
|
value = value.substring(1);
|
|
7460
7479
|
// Cannot have multiple negative signs (e.g. "--0x04")
|
|
7461
7480
|
if (value[0] === "-") {
|
|
7462
|
-
logger$
|
|
7481
|
+
logger$d.throwArgumentError("invalid hex", "value", value);
|
|
7463
7482
|
}
|
|
7464
7483
|
// Call toHex on the positive component
|
|
7465
7484
|
value = toHex(value);
|
|
@@ -7498,373 +7517,19 @@ function toBN(value) {
|
|
|
7498
7517
|
}
|
|
7499
7518
|
return new BN(hex.substring(2), 16);
|
|
7500
7519
|
}
|
|
7501
|
-
function throwFault
|
|
7520
|
+
function throwFault(fault, operation, value) {
|
|
7502
7521
|
const params = { fault: fault, operation: operation };
|
|
7503
7522
|
if (value != null) {
|
|
7504
7523
|
params.value = value;
|
|
7505
7524
|
}
|
|
7506
|
-
return logger$
|
|
7525
|
+
return logger$d.throwError(fault, Logger.errors.NUMERIC_FAULT, params);
|
|
7507
7526
|
}
|
|
7508
7527
|
// value should have no prefix
|
|
7509
7528
|
function _base36To16(value) {
|
|
7510
7529
|
return (new BN(value, 36)).toString(16);
|
|
7511
7530
|
}
|
|
7512
7531
|
|
|
7513
|
-
const
|
|
7514
|
-
const _constructorGuard$1 = {};
|
|
7515
|
-
const Zero$1 = BigNumber.from(0);
|
|
7516
|
-
const NegativeOne$1 = BigNumber.from(-1);
|
|
7517
|
-
function throwFault(message, fault, operation, value) {
|
|
7518
|
-
const params = { fault: fault, operation: operation };
|
|
7519
|
-
if (value !== undefined) {
|
|
7520
|
-
params.value = value;
|
|
7521
|
-
}
|
|
7522
|
-
return logger$e.throwError(message, Logger.errors.NUMERIC_FAULT, params);
|
|
7523
|
-
}
|
|
7524
|
-
// Constant to pull zeros from for multipliers
|
|
7525
|
-
let zeros = "0";
|
|
7526
|
-
while (zeros.length < 256) {
|
|
7527
|
-
zeros += zeros;
|
|
7528
|
-
}
|
|
7529
|
-
// Returns a string "1" followed by decimal "0"s
|
|
7530
|
-
function getMultiplier(decimals) {
|
|
7531
|
-
if (typeof (decimals) !== "number") {
|
|
7532
|
-
try {
|
|
7533
|
-
decimals = BigNumber.from(decimals).toNumber();
|
|
7534
|
-
}
|
|
7535
|
-
catch (e) { }
|
|
7536
|
-
}
|
|
7537
|
-
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
7538
|
-
return ("1" + zeros.substring(0, decimals));
|
|
7539
|
-
}
|
|
7540
|
-
return logger$e.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
7541
|
-
}
|
|
7542
|
-
function formatFixed(value, decimals) {
|
|
7543
|
-
if (decimals == null) {
|
|
7544
|
-
decimals = 0;
|
|
7545
|
-
}
|
|
7546
|
-
const multiplier = getMultiplier(decimals);
|
|
7547
|
-
// Make sure wei is a big number (convert as necessary)
|
|
7548
|
-
value = BigNumber.from(value);
|
|
7549
|
-
const negative = value.lt(Zero$1);
|
|
7550
|
-
if (negative) {
|
|
7551
|
-
value = value.mul(NegativeOne$1);
|
|
7552
|
-
}
|
|
7553
|
-
let fraction = value.mod(multiplier).toString();
|
|
7554
|
-
while (fraction.length < multiplier.length - 1) {
|
|
7555
|
-
fraction = "0" + fraction;
|
|
7556
|
-
}
|
|
7557
|
-
// Strip training 0
|
|
7558
|
-
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
|
7559
|
-
const whole = value.div(multiplier).toString();
|
|
7560
|
-
if (multiplier.length === 1) {
|
|
7561
|
-
value = whole;
|
|
7562
|
-
}
|
|
7563
|
-
else {
|
|
7564
|
-
value = whole + "." + fraction;
|
|
7565
|
-
}
|
|
7566
|
-
if (negative) {
|
|
7567
|
-
value = "-" + value;
|
|
7568
|
-
}
|
|
7569
|
-
return value;
|
|
7570
|
-
}
|
|
7571
|
-
function parseFixed(value, decimals) {
|
|
7572
|
-
if (decimals == null) {
|
|
7573
|
-
decimals = 0;
|
|
7574
|
-
}
|
|
7575
|
-
const multiplier = getMultiplier(decimals);
|
|
7576
|
-
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
7577
|
-
logger$e.throwArgumentError("invalid decimal value", "value", value);
|
|
7578
|
-
}
|
|
7579
|
-
// Is it negative?
|
|
7580
|
-
const negative = (value.substring(0, 1) === "-");
|
|
7581
|
-
if (negative) {
|
|
7582
|
-
value = value.substring(1);
|
|
7583
|
-
}
|
|
7584
|
-
if (value === ".") {
|
|
7585
|
-
logger$e.throwArgumentError("missing value", "value", value);
|
|
7586
|
-
}
|
|
7587
|
-
// Split it into a whole and fractional part
|
|
7588
|
-
const comps = value.split(".");
|
|
7589
|
-
if (comps.length > 2) {
|
|
7590
|
-
logger$e.throwArgumentError("too many decimal points", "value", value);
|
|
7591
|
-
}
|
|
7592
|
-
let whole = comps[0], fraction = comps[1];
|
|
7593
|
-
if (!whole) {
|
|
7594
|
-
whole = "0";
|
|
7595
|
-
}
|
|
7596
|
-
if (!fraction) {
|
|
7597
|
-
fraction = "0";
|
|
7598
|
-
}
|
|
7599
|
-
// Trim trailing zeros
|
|
7600
|
-
while (fraction[fraction.length - 1] === "0") {
|
|
7601
|
-
fraction = fraction.substring(0, fraction.length - 1);
|
|
7602
|
-
}
|
|
7603
|
-
// Check the fraction doesn't exceed our decimals size
|
|
7604
|
-
if (fraction.length > multiplier.length - 1) {
|
|
7605
|
-
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
7606
|
-
}
|
|
7607
|
-
// If decimals is 0, we have an empty string for fraction
|
|
7608
|
-
if (fraction === "") {
|
|
7609
|
-
fraction = "0";
|
|
7610
|
-
}
|
|
7611
|
-
// Fully pad the string with zeros to get to wei
|
|
7612
|
-
while (fraction.length < multiplier.length - 1) {
|
|
7613
|
-
fraction += "0";
|
|
7614
|
-
}
|
|
7615
|
-
const wholeValue = BigNumber.from(whole);
|
|
7616
|
-
const fractionValue = BigNumber.from(fraction);
|
|
7617
|
-
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
7618
|
-
if (negative) {
|
|
7619
|
-
wei = wei.mul(NegativeOne$1);
|
|
7620
|
-
}
|
|
7621
|
-
return wei;
|
|
7622
|
-
}
|
|
7623
|
-
class FixedFormat {
|
|
7624
|
-
constructor(constructorGuard, signed, width, decimals) {
|
|
7625
|
-
if (constructorGuard !== _constructorGuard$1) {
|
|
7626
|
-
logger$e.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
7627
|
-
operation: "new FixedFormat"
|
|
7628
|
-
});
|
|
7629
|
-
}
|
|
7630
|
-
this.signed = signed;
|
|
7631
|
-
this.width = width;
|
|
7632
|
-
this.decimals = decimals;
|
|
7633
|
-
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
7634
|
-
this._multiplier = getMultiplier(decimals);
|
|
7635
|
-
Object.freeze(this);
|
|
7636
|
-
}
|
|
7637
|
-
static from(value) {
|
|
7638
|
-
if (value instanceof FixedFormat) {
|
|
7639
|
-
return value;
|
|
7640
|
-
}
|
|
7641
|
-
if (typeof (value) === "number") {
|
|
7642
|
-
value = `fixed128x${value}`;
|
|
7643
|
-
}
|
|
7644
|
-
let signed = true;
|
|
7645
|
-
let width = 128;
|
|
7646
|
-
let decimals = 18;
|
|
7647
|
-
if (typeof (value) === "string") {
|
|
7648
|
-
if (value === "fixed") ;
|
|
7649
|
-
else if (value === "ufixed") {
|
|
7650
|
-
signed = false;
|
|
7651
|
-
}
|
|
7652
|
-
else {
|
|
7653
|
-
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
7654
|
-
if (!match) {
|
|
7655
|
-
logger$e.throwArgumentError("invalid fixed format", "format", value);
|
|
7656
|
-
}
|
|
7657
|
-
signed = (match[1] !== "u");
|
|
7658
|
-
width = parseInt(match[2]);
|
|
7659
|
-
decimals = parseInt(match[3]);
|
|
7660
|
-
}
|
|
7661
|
-
}
|
|
7662
|
-
else if (value) {
|
|
7663
|
-
const check = (key, type, defaultValue) => {
|
|
7664
|
-
if (value[key] == null) {
|
|
7665
|
-
return defaultValue;
|
|
7666
|
-
}
|
|
7667
|
-
if (typeof (value[key]) !== type) {
|
|
7668
|
-
logger$e.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
7669
|
-
}
|
|
7670
|
-
return value[key];
|
|
7671
|
-
};
|
|
7672
|
-
signed = check("signed", "boolean", signed);
|
|
7673
|
-
width = check("width", "number", width);
|
|
7674
|
-
decimals = check("decimals", "number", decimals);
|
|
7675
|
-
}
|
|
7676
|
-
if (width % 8) {
|
|
7677
|
-
logger$e.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
7678
|
-
}
|
|
7679
|
-
if (decimals > 80) {
|
|
7680
|
-
logger$e.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
7681
|
-
}
|
|
7682
|
-
return new FixedFormat(_constructorGuard$1, signed, width, decimals);
|
|
7683
|
-
}
|
|
7684
|
-
}
|
|
7685
|
-
class FixedNumber {
|
|
7686
|
-
constructor(constructorGuard, hex, value, format) {
|
|
7687
|
-
if (constructorGuard !== _constructorGuard$1) {
|
|
7688
|
-
logger$e.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
7689
|
-
operation: "new FixedFormat"
|
|
7690
|
-
});
|
|
7691
|
-
}
|
|
7692
|
-
this.format = format;
|
|
7693
|
-
this._hex = hex;
|
|
7694
|
-
this._value = value;
|
|
7695
|
-
this._isFixedNumber = true;
|
|
7696
|
-
Object.freeze(this);
|
|
7697
|
-
}
|
|
7698
|
-
_checkFormat(other) {
|
|
7699
|
-
if (this.format.name !== other.format.name) {
|
|
7700
|
-
logger$e.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
7701
|
-
}
|
|
7702
|
-
}
|
|
7703
|
-
addUnsafe(other) {
|
|
7704
|
-
this._checkFormat(other);
|
|
7705
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
7706
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
7707
|
-
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
|
|
7708
|
-
}
|
|
7709
|
-
subUnsafe(other) {
|
|
7710
|
-
this._checkFormat(other);
|
|
7711
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
7712
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
7713
|
-
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
7714
|
-
}
|
|
7715
|
-
mulUnsafe(other) {
|
|
7716
|
-
this._checkFormat(other);
|
|
7717
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
7718
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
7719
|
-
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
7720
|
-
}
|
|
7721
|
-
divUnsafe(other) {
|
|
7722
|
-
this._checkFormat(other);
|
|
7723
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
7724
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
7725
|
-
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
7726
|
-
}
|
|
7727
|
-
floor() {
|
|
7728
|
-
const comps = this.toString().split(".");
|
|
7729
|
-
if (comps.length === 1) {
|
|
7730
|
-
comps.push("0");
|
|
7731
|
-
}
|
|
7732
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
7733
|
-
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
7734
|
-
if (this.isNegative() && hasFraction) {
|
|
7735
|
-
result = result.subUnsafe(ONE.toFormat(result.format));
|
|
7736
|
-
}
|
|
7737
|
-
return result;
|
|
7738
|
-
}
|
|
7739
|
-
ceiling() {
|
|
7740
|
-
const comps = this.toString().split(".");
|
|
7741
|
-
if (comps.length === 1) {
|
|
7742
|
-
comps.push("0");
|
|
7743
|
-
}
|
|
7744
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
7745
|
-
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
7746
|
-
if (!this.isNegative() && hasFraction) {
|
|
7747
|
-
result = result.addUnsafe(ONE.toFormat(result.format));
|
|
7748
|
-
}
|
|
7749
|
-
return result;
|
|
7750
|
-
}
|
|
7751
|
-
// @TODO: Support other rounding algorithms
|
|
7752
|
-
round(decimals) {
|
|
7753
|
-
if (decimals == null) {
|
|
7754
|
-
decimals = 0;
|
|
7755
|
-
}
|
|
7756
|
-
// If we are already in range, we're done
|
|
7757
|
-
const comps = this.toString().split(".");
|
|
7758
|
-
if (comps.length === 1) {
|
|
7759
|
-
comps.push("0");
|
|
7760
|
-
}
|
|
7761
|
-
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
7762
|
-
logger$e.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
7763
|
-
}
|
|
7764
|
-
if (comps[1].length <= decimals) {
|
|
7765
|
-
return this;
|
|
7766
|
-
}
|
|
7767
|
-
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
|
7768
|
-
const bump = BUMP.toFormat(this.format);
|
|
7769
|
-
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
7770
|
-
}
|
|
7771
|
-
isZero() {
|
|
7772
|
-
return (this._value === "0.0" || this._value === "0");
|
|
7773
|
-
}
|
|
7774
|
-
isNegative() {
|
|
7775
|
-
return (this._value[0] === "-");
|
|
7776
|
-
}
|
|
7777
|
-
toString() { return this._value; }
|
|
7778
|
-
toHexString(width) {
|
|
7779
|
-
if (width == null) {
|
|
7780
|
-
return this._hex;
|
|
7781
|
-
}
|
|
7782
|
-
if (width % 8) {
|
|
7783
|
-
logger$e.throwArgumentError("invalid byte width", "width", width);
|
|
7784
|
-
}
|
|
7785
|
-
const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
7786
|
-
return hexZeroPad(hex, width / 8);
|
|
7787
|
-
}
|
|
7788
|
-
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
7789
|
-
toFormat(format) {
|
|
7790
|
-
return FixedNumber.fromString(this._value, format);
|
|
7791
|
-
}
|
|
7792
|
-
static fromValue(value, decimals, format) {
|
|
7793
|
-
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
7794
|
-
if (format == null && decimals != null && !isBigNumberish(decimals)) {
|
|
7795
|
-
format = decimals;
|
|
7796
|
-
decimals = null;
|
|
7797
|
-
}
|
|
7798
|
-
if (decimals == null) {
|
|
7799
|
-
decimals = 0;
|
|
7800
|
-
}
|
|
7801
|
-
if (format == null) {
|
|
7802
|
-
format = "fixed";
|
|
7803
|
-
}
|
|
7804
|
-
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
7805
|
-
}
|
|
7806
|
-
static fromString(value, format) {
|
|
7807
|
-
if (format == null) {
|
|
7808
|
-
format = "fixed";
|
|
7809
|
-
}
|
|
7810
|
-
const fixedFormat = FixedFormat.from(format);
|
|
7811
|
-
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
7812
|
-
if (!fixedFormat.signed && numeric.lt(Zero$1)) {
|
|
7813
|
-
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
|
7814
|
-
}
|
|
7815
|
-
let hex = null;
|
|
7816
|
-
if (fixedFormat.signed) {
|
|
7817
|
-
hex = numeric.toTwos(fixedFormat.width).toHexString();
|
|
7818
|
-
}
|
|
7819
|
-
else {
|
|
7820
|
-
hex = numeric.toHexString();
|
|
7821
|
-
hex = hexZeroPad(hex, fixedFormat.width / 8);
|
|
7822
|
-
}
|
|
7823
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
7824
|
-
return new FixedNumber(_constructorGuard$1, hex, decimal, fixedFormat);
|
|
7825
|
-
}
|
|
7826
|
-
static fromBytes(value, format) {
|
|
7827
|
-
if (format == null) {
|
|
7828
|
-
format = "fixed";
|
|
7829
|
-
}
|
|
7830
|
-
const fixedFormat = FixedFormat.from(format);
|
|
7831
|
-
if (arrayify(value).length > fixedFormat.width / 8) {
|
|
7832
|
-
throw new Error("overflow");
|
|
7833
|
-
}
|
|
7834
|
-
let numeric = BigNumber.from(value);
|
|
7835
|
-
if (fixedFormat.signed) {
|
|
7836
|
-
numeric = numeric.fromTwos(fixedFormat.width);
|
|
7837
|
-
}
|
|
7838
|
-
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
7839
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
7840
|
-
return new FixedNumber(_constructorGuard$1, hex, decimal, fixedFormat);
|
|
7841
|
-
}
|
|
7842
|
-
static from(value, format) {
|
|
7843
|
-
if (typeof (value) === "string") {
|
|
7844
|
-
return FixedNumber.fromString(value, format);
|
|
7845
|
-
}
|
|
7846
|
-
if (isBytes(value)) {
|
|
7847
|
-
return FixedNumber.fromBytes(value, format);
|
|
7848
|
-
}
|
|
7849
|
-
try {
|
|
7850
|
-
return FixedNumber.fromValue(value, 0, format);
|
|
7851
|
-
}
|
|
7852
|
-
catch (error) {
|
|
7853
|
-
// Allow NUMERIC_FAULT to bubble up
|
|
7854
|
-
if (error.code !== Logger.errors.INVALID_ARGUMENT) {
|
|
7855
|
-
throw error;
|
|
7856
|
-
}
|
|
7857
|
-
}
|
|
7858
|
-
return logger$e.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
7859
|
-
}
|
|
7860
|
-
static isFixedNumber(value) {
|
|
7861
|
-
return !!(value && value._isFixedNumber);
|
|
7862
|
-
}
|
|
7863
|
-
}
|
|
7864
|
-
const ONE = FixedNumber.from(1);
|
|
7865
|
-
const BUMP = FixedNumber.from("0.5");
|
|
7866
|
-
|
|
7867
|
-
const version$9 = "properties/5.7.0";
|
|
7532
|
+
const version$8 = "properties/5.7.0";
|
|
7868
7533
|
|
|
7869
7534
|
var __awaiter$3 = function (thisArg, _arguments, P, generator) {
|
|
7870
7535
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -7875,7 +7540,7 @@ var __awaiter$3 = function (thisArg, _arguments, P, generator) {
|
|
|
7875
7540
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7876
7541
|
});
|
|
7877
7542
|
};
|
|
7878
|
-
const logger$
|
|
7543
|
+
const logger$c = new Logger(version$8);
|
|
7879
7544
|
function defineReadOnly(object, name, value) {
|
|
7880
7545
|
Object.defineProperty(object, name, {
|
|
7881
7546
|
enumerable: true,
|
|
@@ -7943,7 +7608,7 @@ function _isFrozen(object) {
|
|
|
7943
7608
|
}
|
|
7944
7609
|
return true;
|
|
7945
7610
|
}
|
|
7946
|
-
return logger$
|
|
7611
|
+
return logger$c.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object);
|
|
7947
7612
|
}
|
|
7948
7613
|
// Returns a new copy of object, such that no properties may be replaced.
|
|
7949
7614
|
// New properties may be added only to objects.
|
|
@@ -7966,7 +7631,7 @@ function _deepCopy(object) {
|
|
|
7966
7631
|
}
|
|
7967
7632
|
return result;
|
|
7968
7633
|
}
|
|
7969
|
-
return logger$
|
|
7634
|
+
return logger$c.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object);
|
|
7970
7635
|
}
|
|
7971
7636
|
function deepCopy(object) {
|
|
7972
7637
|
return _deepCopy(object);
|
|
@@ -7979,9 +7644,9 @@ class Description {
|
|
|
7979
7644
|
}
|
|
7980
7645
|
}
|
|
7981
7646
|
|
|
7982
|
-
const version$
|
|
7647
|
+
const version$7 = "abi/5.7.0";
|
|
7983
7648
|
|
|
7984
|
-
const logger$
|
|
7649
|
+
const logger$b = new Logger(version$7);
|
|
7985
7650
|
const _constructorGuard = {};
|
|
7986
7651
|
let ModifiersBytes = { calldata: true, memory: true, storage: true };
|
|
7987
7652
|
let ModifiersNest = { calldata: true, memory: true };
|
|
@@ -8002,7 +7667,7 @@ function checkModifier(type, name) {
|
|
|
8002
7667
|
}
|
|
8003
7668
|
}
|
|
8004
7669
|
if (ModifiersBytes[name] || name === "payable") {
|
|
8005
|
-
logger$
|
|
7670
|
+
logger$b.throwArgumentError("invalid modifier", "name", name);
|
|
8006
7671
|
}
|
|
8007
7672
|
return false;
|
|
8008
7673
|
}
|
|
@@ -8010,7 +7675,7 @@ function checkModifier(type, name) {
|
|
|
8010
7675
|
function parseParamType(param, allowIndexed) {
|
|
8011
7676
|
let originalParam = param;
|
|
8012
7677
|
function throwError(i) {
|
|
8013
|
-
logger$
|
|
7678
|
+
logger$b.throwArgumentError(`unexpected character at position ${i}`, "param", param);
|
|
8014
7679
|
}
|
|
8015
7680
|
param = param.replace(/\s/g, " ");
|
|
8016
7681
|
function newNode(parent) {
|
|
@@ -8149,7 +7814,7 @@ function parseParamType(param, allowIndexed) {
|
|
|
8149
7814
|
}
|
|
8150
7815
|
}
|
|
8151
7816
|
if (node.parent) {
|
|
8152
|
-
logger$
|
|
7817
|
+
logger$b.throwArgumentError("unexpected eof", "param", param);
|
|
8153
7818
|
}
|
|
8154
7819
|
delete parent.state;
|
|
8155
7820
|
if (node.name === "indexed") {
|
|
@@ -8187,7 +7852,7 @@ const paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/);
|
|
|
8187
7852
|
class ParamType {
|
|
8188
7853
|
constructor(constructorGuard, params) {
|
|
8189
7854
|
if (constructorGuard !== _constructorGuard) {
|
|
8190
|
-
logger$
|
|
7855
|
+
logger$b.throwError("use fromString", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
8191
7856
|
operation: "new ParamType()"
|
|
8192
7857
|
});
|
|
8193
7858
|
}
|
|
@@ -8222,7 +7887,7 @@ class ParamType {
|
|
|
8222
7887
|
format = FormatTypes.sighash;
|
|
8223
7888
|
}
|
|
8224
7889
|
if (!FormatTypes[format]) {
|
|
8225
|
-
logger$
|
|
7890
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
8226
7891
|
}
|
|
8227
7892
|
if (format === FormatTypes.json) {
|
|
8228
7893
|
let result = {
|
|
@@ -8302,7 +7967,7 @@ function parseParams(value, allowIndex) {
|
|
|
8302
7967
|
class Fragment {
|
|
8303
7968
|
constructor(constructorGuard, params) {
|
|
8304
7969
|
if (constructorGuard !== _constructorGuard) {
|
|
8305
|
-
logger$
|
|
7970
|
+
logger$b.throwError("use a static from method", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
8306
7971
|
operation: "new Fragment()"
|
|
8307
7972
|
});
|
|
8308
7973
|
}
|
|
@@ -8337,7 +8002,7 @@ class Fragment {
|
|
|
8337
8002
|
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
|
|
8338
8003
|
return null;
|
|
8339
8004
|
}
|
|
8340
|
-
return logger$
|
|
8005
|
+
return logger$b.throwArgumentError("invalid fragment object", "value", value);
|
|
8341
8006
|
}
|
|
8342
8007
|
static fromString(value) {
|
|
8343
8008
|
// Make sure the "returns" is surrounded by a space and all whitespace is exactly one space
|
|
@@ -8356,7 +8021,7 @@ class Fragment {
|
|
|
8356
8021
|
else if (value.split(" ")[0] === "error") {
|
|
8357
8022
|
return ErrorFragment.fromString(value.substring(5).trim());
|
|
8358
8023
|
}
|
|
8359
|
-
return logger$
|
|
8024
|
+
return logger$b.throwArgumentError("unsupported fragment", "value", value);
|
|
8360
8025
|
}
|
|
8361
8026
|
static isFragment(value) {
|
|
8362
8027
|
return !!(value && value._isFragment);
|
|
@@ -8368,7 +8033,7 @@ class EventFragment extends Fragment {
|
|
|
8368
8033
|
format = FormatTypes.sighash;
|
|
8369
8034
|
}
|
|
8370
8035
|
if (!FormatTypes[format]) {
|
|
8371
|
-
logger$
|
|
8036
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
8372
8037
|
}
|
|
8373
8038
|
if (format === FormatTypes.json) {
|
|
8374
8039
|
return JSON.stringify({
|
|
@@ -8401,7 +8066,7 @@ class EventFragment extends Fragment {
|
|
|
8401
8066
|
return value;
|
|
8402
8067
|
}
|
|
8403
8068
|
if (value.type !== "event") {
|
|
8404
|
-
logger$
|
|
8069
|
+
logger$b.throwArgumentError("invalid event object", "value", value);
|
|
8405
8070
|
}
|
|
8406
8071
|
const params = {
|
|
8407
8072
|
name: verifyIdentifier(value.name),
|
|
@@ -8414,7 +8079,7 @@ class EventFragment extends Fragment {
|
|
|
8414
8079
|
static fromString(value) {
|
|
8415
8080
|
let match = value.match(regexParen);
|
|
8416
8081
|
if (!match) {
|
|
8417
|
-
logger$
|
|
8082
|
+
logger$b.throwArgumentError("invalid event string", "value", value);
|
|
8418
8083
|
}
|
|
8419
8084
|
let anonymous = false;
|
|
8420
8085
|
match[3].split(" ").forEach((modifier) => {
|
|
@@ -8425,7 +8090,7 @@ class EventFragment extends Fragment {
|
|
|
8425
8090
|
case "":
|
|
8426
8091
|
break;
|
|
8427
8092
|
default:
|
|
8428
|
-
logger$
|
|
8093
|
+
logger$b.warn("unknown modifier: " + modifier);
|
|
8429
8094
|
}
|
|
8430
8095
|
});
|
|
8431
8096
|
return EventFragment.fromObject({
|
|
@@ -8444,10 +8109,10 @@ function parseGas(value, params) {
|
|
|
8444
8109
|
let comps = value.split("@");
|
|
8445
8110
|
if (comps.length !== 1) {
|
|
8446
8111
|
if (comps.length > 2) {
|
|
8447
|
-
logger$
|
|
8112
|
+
logger$b.throwArgumentError("invalid human-readable ABI signature", "value", value);
|
|
8448
8113
|
}
|
|
8449
8114
|
if (!comps[1].match(/^[0-9]+$/)) {
|
|
8450
|
-
logger$
|
|
8115
|
+
logger$b.throwArgumentError("invalid human-readable ABI signature gas", "value", value);
|
|
8451
8116
|
}
|
|
8452
8117
|
params.gas = BigNumber.from(comps[1]);
|
|
8453
8118
|
return comps[0];
|
|
@@ -8500,14 +8165,14 @@ function verifyState(value) {
|
|
|
8500
8165
|
result.constant = (result.stateMutability === "view" || result.stateMutability === "pure");
|
|
8501
8166
|
if (value.constant != null) {
|
|
8502
8167
|
if ((!!value.constant) !== result.constant) {
|
|
8503
|
-
logger$
|
|
8168
|
+
logger$b.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value);
|
|
8504
8169
|
}
|
|
8505
8170
|
}
|
|
8506
8171
|
// Set (and check things are consistent) the payable property
|
|
8507
8172
|
result.payable = (result.stateMutability === "payable");
|
|
8508
8173
|
if (value.payable != null) {
|
|
8509
8174
|
if ((!!value.payable) !== result.payable) {
|
|
8510
|
-
logger$
|
|
8175
|
+
logger$b.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value);
|
|
8511
8176
|
}
|
|
8512
8177
|
}
|
|
8513
8178
|
}
|
|
@@ -8515,7 +8180,7 @@ function verifyState(value) {
|
|
|
8515
8180
|
result.payable = !!value.payable;
|
|
8516
8181
|
// If payable we can assume non-constant; otherwise we can't assume
|
|
8517
8182
|
if (value.constant == null && !result.payable && value.type !== "constructor") {
|
|
8518
|
-
logger$
|
|
8183
|
+
logger$b.throwArgumentError("unable to determine stateMutability", "value", value);
|
|
8519
8184
|
}
|
|
8520
8185
|
result.constant = !!value.constant;
|
|
8521
8186
|
if (result.constant) {
|
|
@@ -8525,7 +8190,7 @@ function verifyState(value) {
|
|
|
8525
8190
|
result.stateMutability = (result.payable ? "payable" : "nonpayable");
|
|
8526
8191
|
}
|
|
8527
8192
|
if (result.payable && result.constant) {
|
|
8528
|
-
logger$
|
|
8193
|
+
logger$b.throwArgumentError("cannot have constant payable function", "value", value);
|
|
8529
8194
|
}
|
|
8530
8195
|
}
|
|
8531
8196
|
else if (value.constant != null) {
|
|
@@ -8534,7 +8199,7 @@ function verifyState(value) {
|
|
|
8534
8199
|
result.stateMutability = (result.constant ? "view" : "payable");
|
|
8535
8200
|
}
|
|
8536
8201
|
else if (value.type !== "constructor") {
|
|
8537
|
-
logger$
|
|
8202
|
+
logger$b.throwArgumentError("unable to determine stateMutability", "value", value);
|
|
8538
8203
|
}
|
|
8539
8204
|
return result;
|
|
8540
8205
|
}
|
|
@@ -8544,7 +8209,7 @@ class ConstructorFragment extends Fragment {
|
|
|
8544
8209
|
format = FormatTypes.sighash;
|
|
8545
8210
|
}
|
|
8546
8211
|
if (!FormatTypes[format]) {
|
|
8547
|
-
logger$
|
|
8212
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
8548
8213
|
}
|
|
8549
8214
|
if (format === FormatTypes.json) {
|
|
8550
8215
|
return JSON.stringify({
|
|
@@ -8556,7 +8221,7 @@ class ConstructorFragment extends Fragment {
|
|
|
8556
8221
|
});
|
|
8557
8222
|
}
|
|
8558
8223
|
if (format === FormatTypes.sighash) {
|
|
8559
|
-
logger$
|
|
8224
|
+
logger$b.throwError("cannot format a constructor for sighash", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
8560
8225
|
operation: "format(sighash)"
|
|
8561
8226
|
});
|
|
8562
8227
|
}
|
|
@@ -8577,11 +8242,11 @@ class ConstructorFragment extends Fragment {
|
|
|
8577
8242
|
return value;
|
|
8578
8243
|
}
|
|
8579
8244
|
if (value.type !== "constructor") {
|
|
8580
|
-
logger$
|
|
8245
|
+
logger$b.throwArgumentError("invalid constructor object", "value", value);
|
|
8581
8246
|
}
|
|
8582
8247
|
let state = verifyState(value);
|
|
8583
8248
|
if (state.constant) {
|
|
8584
|
-
logger$
|
|
8249
|
+
logger$b.throwArgumentError("constructor cannot be constant", "value", value);
|
|
8585
8250
|
}
|
|
8586
8251
|
const params = {
|
|
8587
8252
|
name: null,
|
|
@@ -8598,7 +8263,7 @@ class ConstructorFragment extends Fragment {
|
|
|
8598
8263
|
value = parseGas(value, params);
|
|
8599
8264
|
let parens = value.match(regexParen);
|
|
8600
8265
|
if (!parens || parens[1].trim() !== "constructor") {
|
|
8601
|
-
logger$
|
|
8266
|
+
logger$b.throwArgumentError("invalid constructor string", "value", value);
|
|
8602
8267
|
}
|
|
8603
8268
|
params.inputs = parseParams(parens[2].trim(), false);
|
|
8604
8269
|
parseModifiers(parens[3].trim(), params);
|
|
@@ -8614,7 +8279,7 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
8614
8279
|
format = FormatTypes.sighash;
|
|
8615
8280
|
}
|
|
8616
8281
|
if (!FormatTypes[format]) {
|
|
8617
|
-
logger$
|
|
8282
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
8618
8283
|
}
|
|
8619
8284
|
if (format === FormatTypes.json) {
|
|
8620
8285
|
return JSON.stringify({
|
|
@@ -8662,7 +8327,7 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
8662
8327
|
return value;
|
|
8663
8328
|
}
|
|
8664
8329
|
if (value.type !== "function") {
|
|
8665
|
-
logger$
|
|
8330
|
+
logger$b.throwArgumentError("invalid function object", "value", value);
|
|
8666
8331
|
}
|
|
8667
8332
|
let state = verifyState(value);
|
|
8668
8333
|
const params = {
|
|
@@ -8682,11 +8347,11 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
8682
8347
|
value = parseGas(value, params);
|
|
8683
8348
|
let comps = value.split(" returns ");
|
|
8684
8349
|
if (comps.length > 2) {
|
|
8685
|
-
logger$
|
|
8350
|
+
logger$b.throwArgumentError("invalid function string", "value", value);
|
|
8686
8351
|
}
|
|
8687
8352
|
let parens = comps[0].match(regexParen);
|
|
8688
8353
|
if (!parens) {
|
|
8689
|
-
logger$
|
|
8354
|
+
logger$b.throwArgumentError("invalid function signature", "value", value);
|
|
8690
8355
|
}
|
|
8691
8356
|
params.name = parens[1].trim();
|
|
8692
8357
|
if (params.name) {
|
|
@@ -8698,7 +8363,7 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
8698
8363
|
if (comps.length > 1) {
|
|
8699
8364
|
let returns = comps[1].match(regexParen);
|
|
8700
8365
|
if (returns[1].trim() != "" || returns[3].trim() != "") {
|
|
8701
|
-
logger$
|
|
8366
|
+
logger$b.throwArgumentError("unexpected tokens", "value", value);
|
|
8702
8367
|
}
|
|
8703
8368
|
params.outputs = parseParams(returns[2], false);
|
|
8704
8369
|
}
|
|
@@ -8716,7 +8381,7 @@ class FunctionFragment extends ConstructorFragment {
|
|
|
8716
8381
|
function checkForbidden(fragment) {
|
|
8717
8382
|
const sig = fragment.format();
|
|
8718
8383
|
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
|
8719
|
-
logger$
|
|
8384
|
+
logger$b.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment);
|
|
8720
8385
|
}
|
|
8721
8386
|
return fragment;
|
|
8722
8387
|
}
|
|
@@ -8726,7 +8391,7 @@ class ErrorFragment extends Fragment {
|
|
|
8726
8391
|
format = FormatTypes.sighash;
|
|
8727
8392
|
}
|
|
8728
8393
|
if (!FormatTypes[format]) {
|
|
8729
|
-
logger$
|
|
8394
|
+
logger$b.throwArgumentError("invalid format type", "format", format);
|
|
8730
8395
|
}
|
|
8731
8396
|
if (format === FormatTypes.json) {
|
|
8732
8397
|
return JSON.stringify({
|
|
@@ -8753,7 +8418,7 @@ class ErrorFragment extends Fragment {
|
|
|
8753
8418
|
return value;
|
|
8754
8419
|
}
|
|
8755
8420
|
if (value.type !== "error") {
|
|
8756
|
-
logger$
|
|
8421
|
+
logger$b.throwArgumentError("invalid error object", "value", value);
|
|
8757
8422
|
}
|
|
8758
8423
|
const params = {
|
|
8759
8424
|
type: value.type,
|
|
@@ -8766,7 +8431,7 @@ class ErrorFragment extends Fragment {
|
|
|
8766
8431
|
let params = { type: "error" };
|
|
8767
8432
|
let parens = value.match(regexParen);
|
|
8768
8433
|
if (!parens) {
|
|
8769
|
-
logger$
|
|
8434
|
+
logger$b.throwArgumentError("invalid error signature", "value", value);
|
|
8770
8435
|
}
|
|
8771
8436
|
params.name = parens[1].trim();
|
|
8772
8437
|
if (params.name) {
|
|
@@ -8794,7 +8459,7 @@ function verifyType(type) {
|
|
|
8794
8459
|
const regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");
|
|
8795
8460
|
function verifyIdentifier(value) {
|
|
8796
8461
|
if (!value || !value.match(regexIdentifier)) {
|
|
8797
|
-
logger$
|
|
8462
|
+
logger$b.throwArgumentError(`invalid identifier "${value}"`, "value", value);
|
|
8798
8463
|
}
|
|
8799
8464
|
return value;
|
|
8800
8465
|
}
|
|
@@ -8818,7 +8483,7 @@ function splitNesting(value) {
|
|
|
8818
8483
|
else if (c === ")") {
|
|
8819
8484
|
depth--;
|
|
8820
8485
|
if (depth === -1) {
|
|
8821
|
-
logger$
|
|
8486
|
+
logger$b.throwArgumentError("unbalanced parenthesis", "value", value);
|
|
8822
8487
|
}
|
|
8823
8488
|
}
|
|
8824
8489
|
}
|
|
@@ -8829,7 +8494,7 @@ function splitNesting(value) {
|
|
|
8829
8494
|
return result;
|
|
8830
8495
|
}
|
|
8831
8496
|
|
|
8832
|
-
const logger$
|
|
8497
|
+
const logger$a = new Logger(version$7);
|
|
8833
8498
|
function checkResultErrors(result) {
|
|
8834
8499
|
// Find the first error (if any)
|
|
8835
8500
|
const errors = [];
|
|
@@ -8860,7 +8525,7 @@ class Coder {
|
|
|
8860
8525
|
this.dynamic = dynamic;
|
|
8861
8526
|
}
|
|
8862
8527
|
_throwError(message, value) {
|
|
8863
|
-
logger$
|
|
8528
|
+
logger$a.throwArgumentError(message, this.localName, value);
|
|
8864
8529
|
}
|
|
8865
8530
|
}
|
|
8866
8531
|
class Writer {
|
|
@@ -8894,7 +8559,7 @@ class Writer {
|
|
|
8894
8559
|
_getValue(value) {
|
|
8895
8560
|
let bytes = arrayify(BigNumber.from(value));
|
|
8896
8561
|
if (bytes.length > this.wordSize) {
|
|
8897
|
-
logger$
|
|
8562
|
+
logger$a.throwError("value out-of-bounds", Logger.errors.BUFFER_OVERRUN, {
|
|
8898
8563
|
length: this.wordSize,
|
|
8899
8564
|
offset: bytes.length
|
|
8900
8565
|
});
|
|
@@ -8948,7 +8613,7 @@ class Reader {
|
|
|
8948
8613
|
alignedLength = length;
|
|
8949
8614
|
}
|
|
8950
8615
|
else {
|
|
8951
|
-
logger$
|
|
8616
|
+
logger$a.throwError("data out-of-bounds", Logger.errors.BUFFER_OVERRUN, {
|
|
8952
8617
|
length: this._data.length,
|
|
8953
8618
|
offset: this._offset + alignedLength
|
|
8954
8619
|
});
|
|
@@ -9632,9 +9297,9 @@ function keccak256(data) {
|
|
|
9632
9297
|
return '0x' + sha3.keccak_256(arrayify(data));
|
|
9633
9298
|
}
|
|
9634
9299
|
|
|
9635
|
-
const version$
|
|
9300
|
+
const version$6 = "rlp/5.7.0";
|
|
9636
9301
|
|
|
9637
|
-
const logger$
|
|
9302
|
+
const logger$9 = new Logger(version$6);
|
|
9638
9303
|
function arrayifyInteger(value) {
|
|
9639
9304
|
const result = [];
|
|
9640
9305
|
while (value) {
|
|
@@ -9658,7 +9323,7 @@ function _encode(object) {
|
|
|
9658
9323
|
return length.concat(payload);
|
|
9659
9324
|
}
|
|
9660
9325
|
if (!isBytesLike(object)) {
|
|
9661
|
-
logger$
|
|
9326
|
+
logger$9.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
9662
9327
|
}
|
|
9663
9328
|
const data = Array.prototype.slice.call(arrayify(object));
|
|
9664
9329
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
@@ -9676,12 +9341,12 @@ function encode(object) {
|
|
|
9676
9341
|
return hexlify(_encode(object));
|
|
9677
9342
|
}
|
|
9678
9343
|
|
|
9679
|
-
const version$
|
|
9344
|
+
const version$5 = "address/5.7.0";
|
|
9680
9345
|
|
|
9681
|
-
const logger$
|
|
9346
|
+
const logger$8 = new Logger(version$5);
|
|
9682
9347
|
function getChecksumAddress(address) {
|
|
9683
9348
|
if (!isHexString(address, 20)) {
|
|
9684
|
-
logger$
|
|
9349
|
+
logger$8.throwArgumentError("invalid address", "address", address);
|
|
9685
9350
|
}
|
|
9686
9351
|
address = address.toLowerCase();
|
|
9687
9352
|
const chars = address.substring(2).split("");
|
|
@@ -9737,7 +9402,7 @@ function ibanChecksum(address) {
|
|
|
9737
9402
|
function getAddress(address) {
|
|
9738
9403
|
let result = null;
|
|
9739
9404
|
if (typeof (address) !== "string") {
|
|
9740
|
-
logger$
|
|
9405
|
+
logger$8.throwArgumentError("invalid address", "address", address);
|
|
9741
9406
|
}
|
|
9742
9407
|
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
|
9743
9408
|
// Missing the 0x prefix
|
|
@@ -9747,14 +9412,14 @@ function getAddress(address) {
|
|
|
9747
9412
|
result = getChecksumAddress(address);
|
|
9748
9413
|
// It is a checksummed address with a bad checksum
|
|
9749
9414
|
if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
|
|
9750
|
-
logger$
|
|
9415
|
+
logger$8.throwArgumentError("bad address checksum", "address", address);
|
|
9751
9416
|
}
|
|
9752
9417
|
// Maybe ICAP? (we only support direct mode)
|
|
9753
9418
|
}
|
|
9754
9419
|
else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
9755
9420
|
// It is an ICAP address with a bad checksum
|
|
9756
9421
|
if (address.substring(2, 4) !== ibanChecksum(address)) {
|
|
9757
|
-
logger$
|
|
9422
|
+
logger$8.throwArgumentError("bad icap checksum", "address", address);
|
|
9758
9423
|
}
|
|
9759
9424
|
result = _base36To16(address.substring(4));
|
|
9760
9425
|
while (result.length < 40) {
|
|
@@ -9763,7 +9428,7 @@ function getAddress(address) {
|
|
|
9763
9428
|
result = getChecksumAddress("0x" + result);
|
|
9764
9429
|
}
|
|
9765
9430
|
else {
|
|
9766
|
-
logger$
|
|
9431
|
+
logger$8.throwArgumentError("invalid address", "address", address);
|
|
9767
9432
|
}
|
|
9768
9433
|
return result;
|
|
9769
9434
|
}
|
|
@@ -9782,7 +9447,7 @@ function getContractAddress(transaction) {
|
|
|
9782
9447
|
from = getAddress(transaction.from);
|
|
9783
9448
|
}
|
|
9784
9449
|
catch (error) {
|
|
9785
|
-
logger$
|
|
9450
|
+
logger$8.throwArgumentError("missing from address", "transaction", transaction);
|
|
9786
9451
|
}
|
|
9787
9452
|
const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString()));
|
|
9788
9453
|
return getAddress(hexDataSlice(keccak256(encode([from, nonce])), 12));
|
|
@@ -9826,7 +9491,7 @@ class AnonymousCoder extends Coder {
|
|
|
9826
9491
|
}
|
|
9827
9492
|
}
|
|
9828
9493
|
|
|
9829
|
-
const logger$
|
|
9494
|
+
const logger$7 = new Logger(version$7);
|
|
9830
9495
|
function pack(writer, coders, values) {
|
|
9831
9496
|
let arrayValues = null;
|
|
9832
9497
|
if (Array.isArray(values)) {
|
|
@@ -9837,14 +9502,14 @@ function pack(writer, coders, values) {
|
|
|
9837
9502
|
arrayValues = coders.map((coder) => {
|
|
9838
9503
|
const name = coder.localName;
|
|
9839
9504
|
if (!name) {
|
|
9840
|
-
logger$
|
|
9505
|
+
logger$7.throwError("cannot encode object for signature with missing names", Logger.errors.INVALID_ARGUMENT, {
|
|
9841
9506
|
argument: "values",
|
|
9842
9507
|
coder: coder,
|
|
9843
9508
|
value: values
|
|
9844
9509
|
});
|
|
9845
9510
|
}
|
|
9846
9511
|
if (unique[name]) {
|
|
9847
|
-
logger$
|
|
9512
|
+
logger$7.throwError("cannot encode object for signature with duplicate names", Logger.errors.INVALID_ARGUMENT, {
|
|
9848
9513
|
argument: "values",
|
|
9849
9514
|
coder: coder,
|
|
9850
9515
|
value: values
|
|
@@ -9855,10 +9520,10 @@ function pack(writer, coders, values) {
|
|
|
9855
9520
|
});
|
|
9856
9521
|
}
|
|
9857
9522
|
else {
|
|
9858
|
-
logger$
|
|
9523
|
+
logger$7.throwArgumentError("invalid tuple value", "tuple", values);
|
|
9859
9524
|
}
|
|
9860
9525
|
if (coders.length !== arrayValues.length) {
|
|
9861
|
-
logger$
|
|
9526
|
+
logger$7.throwArgumentError("types/value length mismatch", "tuple", values);
|
|
9862
9527
|
}
|
|
9863
9528
|
let staticWriter = new Writer(writer.wordSize);
|
|
9864
9529
|
let dynamicWriter = new Writer(writer.wordSize);
|
|
@@ -9999,7 +9664,7 @@ class ArrayCoder extends Coder {
|
|
|
9999
9664
|
count = value.length;
|
|
10000
9665
|
writer.writeValue(value.length);
|
|
10001
9666
|
}
|
|
10002
|
-
logger$
|
|
9667
|
+
logger$7.checkArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : ""));
|
|
10003
9668
|
let coders = [];
|
|
10004
9669
|
for (let i = 0; i < value.length; i++) {
|
|
10005
9670
|
coders.push(this.coder);
|
|
@@ -10016,7 +9681,7 @@ class ArrayCoder extends Coder {
|
|
|
10016
9681
|
// bytes as a link to the data). This could use a much
|
|
10017
9682
|
// tighter bound, but we are erroring on the side of safety.
|
|
10018
9683
|
if (count * 32 > reader._data.length) {
|
|
10019
|
-
logger$
|
|
9684
|
+
logger$7.throwError("insufficient data length", Logger.errors.BUFFER_OVERRUN, {
|
|
10020
9685
|
length: reader._data.length,
|
|
10021
9686
|
count: count
|
|
10022
9687
|
});
|
|
@@ -10112,6 +9777,8 @@ class NullCoder extends Coder {
|
|
|
10112
9777
|
}
|
|
10113
9778
|
}
|
|
10114
9779
|
|
|
9780
|
+
const AddressZero = "0x0000000000000000000000000000000000000000";
|
|
9781
|
+
|
|
10115
9782
|
const NegativeOne = ( /*#__PURE__*/BigNumber.from(-1));
|
|
10116
9783
|
const Zero = ( /*#__PURE__*/BigNumber.from(0));
|
|
10117
9784
|
const One = ( /*#__PURE__*/BigNumber.from(1));
|
|
@@ -10155,9 +9822,9 @@ class NumberCoder extends Coder {
|
|
|
10155
9822
|
}
|
|
10156
9823
|
}
|
|
10157
9824
|
|
|
10158
|
-
const version$
|
|
9825
|
+
const version$4 = "strings/5.7.0";
|
|
10159
9826
|
|
|
10160
|
-
const logger$
|
|
9827
|
+
const logger$6 = new Logger(version$4);
|
|
10161
9828
|
///////////////////////////////
|
|
10162
9829
|
var UnicodeNormalizationForm;
|
|
10163
9830
|
(function (UnicodeNormalizationForm) {
|
|
@@ -10195,7 +9862,7 @@ var Utf8ErrorReason;
|
|
|
10195
9862
|
Utf8ErrorReason["OVERLONG"] = "overlong representation";
|
|
10196
9863
|
})(Utf8ErrorReason || (Utf8ErrorReason = {}));
|
|
10197
9864
|
function errorFunc(reason, offset, bytes, output, badCodepoint) {
|
|
10198
|
-
return logger$
|
|
9865
|
+
return logger$6.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes);
|
|
10199
9866
|
}
|
|
10200
9867
|
function ignoreFunc(reason, offset, bytes, output, badCodepoint) {
|
|
10201
9868
|
// If there is an invalid prefix (including stray continuation), skip any additional continuation bytes
|
|
@@ -10321,7 +9988,7 @@ function getUtf8CodePoints(bytes, onError) {
|
|
|
10321
9988
|
// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
|
|
10322
9989
|
function toUtf8Bytes(str, form = UnicodeNormalizationForm.current) {
|
|
10323
9990
|
if (form != UnicodeNormalizationForm.current) {
|
|
10324
|
-
logger$
|
|
9991
|
+
logger$6.checkNormalize();
|
|
10325
9992
|
str = str.normalize(form);
|
|
10326
9993
|
}
|
|
10327
9994
|
let result = [];
|
|
@@ -10437,7 +10104,7 @@ class TupleCoder extends Coder {
|
|
|
10437
10104
|
}
|
|
10438
10105
|
}
|
|
10439
10106
|
|
|
10440
|
-
const logger$
|
|
10107
|
+
const logger$5 = new Logger(version$7);
|
|
10441
10108
|
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
|
|
10442
10109
|
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
|
|
10443
10110
|
class AbiCoder {
|
|
@@ -10468,7 +10135,7 @@ class AbiCoder {
|
|
|
10468
10135
|
if (match) {
|
|
10469
10136
|
let size = parseInt(match[2] || "256");
|
|
10470
10137
|
if (size === 0 || size > 256 || (size % 8) !== 0) {
|
|
10471
|
-
logger$
|
|
10138
|
+
logger$5.throwArgumentError("invalid " + match[1] + " bit length", "param", param);
|
|
10472
10139
|
}
|
|
10473
10140
|
return new NumberCoder(size / 8, (match[1] === "int"), param.name);
|
|
10474
10141
|
}
|
|
@@ -10477,11 +10144,11 @@ class AbiCoder {
|
|
|
10477
10144
|
if (match) {
|
|
10478
10145
|
let size = parseInt(match[1]);
|
|
10479
10146
|
if (size === 0 || size > 32) {
|
|
10480
|
-
logger$
|
|
10147
|
+
logger$5.throwArgumentError("invalid bytes length", "param", param);
|
|
10481
10148
|
}
|
|
10482
10149
|
return new FixedBytesCoder(size, param.name);
|
|
10483
10150
|
}
|
|
10484
|
-
return logger$
|
|
10151
|
+
return logger$5.throwArgumentError("invalid type", "type", param.type);
|
|
10485
10152
|
}
|
|
10486
10153
|
_getWordSize() { return 32; }
|
|
10487
10154
|
_getReader(data, allowLoose) {
|
|
@@ -10497,7 +10164,7 @@ class AbiCoder {
|
|
|
10497
10164
|
}
|
|
10498
10165
|
encode(types, values) {
|
|
10499
10166
|
if (types.length !== values.length) {
|
|
10500
|
-
logger$
|
|
10167
|
+
logger$5.throwError("types/values length mismatch", Logger.errors.INVALID_ARGUMENT, {
|
|
10501
10168
|
count: { types: types.length, values: values.length },
|
|
10502
10169
|
value: { types: types, values: values }
|
|
10503
10170
|
});
|
|
@@ -10520,7 +10187,7 @@ function id(text) {
|
|
|
10520
10187
|
return keccak256(toUtf8Bytes(text));
|
|
10521
10188
|
}
|
|
10522
10189
|
|
|
10523
|
-
const logger$
|
|
10190
|
+
const logger$4 = new Logger(version$7);
|
|
10524
10191
|
class LogDescription extends Description {
|
|
10525
10192
|
}
|
|
10526
10193
|
class TransactionDescription extends Description {
|
|
@@ -10577,7 +10244,7 @@ class Interface {
|
|
|
10577
10244
|
switch (fragment.type) {
|
|
10578
10245
|
case "constructor":
|
|
10579
10246
|
if (this.deploy) {
|
|
10580
|
-
logger$
|
|
10247
|
+
logger$4.warn("duplicate definition - constructor");
|
|
10581
10248
|
return;
|
|
10582
10249
|
}
|
|
10583
10250
|
//checkNames(fragment, "input", fragment.inputs);
|
|
@@ -10600,7 +10267,7 @@ class Interface {
|
|
|
10600
10267
|
}
|
|
10601
10268
|
let signature = fragment.format();
|
|
10602
10269
|
if (bucket[signature]) {
|
|
10603
|
-
logger$
|
|
10270
|
+
logger$4.warn("duplicate definition - " + signature);
|
|
10604
10271
|
return;
|
|
10605
10272
|
}
|
|
10606
10273
|
bucket[signature] = fragment;
|
|
@@ -10619,7 +10286,7 @@ class Interface {
|
|
|
10619
10286
|
format = FormatTypes.full;
|
|
10620
10287
|
}
|
|
10621
10288
|
if (format === FormatTypes.sighash) {
|
|
10622
|
-
logger$
|
|
10289
|
+
logger$4.throwArgumentError("interface does not support formatting sighash", "format", format);
|
|
10623
10290
|
}
|
|
10624
10291
|
const abi = this.fragments.map((fragment) => fragment.format(format));
|
|
10625
10292
|
// We need to re-bundle the JSON fragments a bit
|
|
@@ -10649,24 +10316,24 @@ class Interface {
|
|
|
10649
10316
|
return this.functions[name];
|
|
10650
10317
|
}
|
|
10651
10318
|
}
|
|
10652
|
-
logger$
|
|
10319
|
+
logger$4.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash);
|
|
10653
10320
|
}
|
|
10654
10321
|
// It is a bare name, look up the function (will return null if ambiguous)
|
|
10655
10322
|
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
|
10656
10323
|
const name = nameOrSignatureOrSighash.trim();
|
|
10657
10324
|
const matching = Object.keys(this.functions).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
|
10658
10325
|
if (matching.length === 0) {
|
|
10659
|
-
logger$
|
|
10326
|
+
logger$4.throwArgumentError("no matching function", "name", name);
|
|
10660
10327
|
}
|
|
10661
10328
|
else if (matching.length > 1) {
|
|
10662
|
-
logger$
|
|
10329
|
+
logger$4.throwArgumentError("multiple matching functions", "name", name);
|
|
10663
10330
|
}
|
|
10664
10331
|
return this.functions[matching[0]];
|
|
10665
10332
|
}
|
|
10666
10333
|
// Normalize the signature and lookup the function
|
|
10667
10334
|
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
|
10668
10335
|
if (!result) {
|
|
10669
|
-
logger$
|
|
10336
|
+
logger$4.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
|
|
10670
10337
|
}
|
|
10671
10338
|
return result;
|
|
10672
10339
|
}
|
|
@@ -10679,24 +10346,24 @@ class Interface {
|
|
|
10679
10346
|
return this.events[name];
|
|
10680
10347
|
}
|
|
10681
10348
|
}
|
|
10682
|
-
logger$
|
|
10349
|
+
logger$4.throwArgumentError("no matching event", "topichash", topichash);
|
|
10683
10350
|
}
|
|
10684
10351
|
// It is a bare name, look up the function (will return null if ambiguous)
|
|
10685
10352
|
if (nameOrSignatureOrTopic.indexOf("(") === -1) {
|
|
10686
10353
|
const name = nameOrSignatureOrTopic.trim();
|
|
10687
10354
|
const matching = Object.keys(this.events).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
|
10688
10355
|
if (matching.length === 0) {
|
|
10689
|
-
logger$
|
|
10356
|
+
logger$4.throwArgumentError("no matching event", "name", name);
|
|
10690
10357
|
}
|
|
10691
10358
|
else if (matching.length > 1) {
|
|
10692
|
-
logger$
|
|
10359
|
+
logger$4.throwArgumentError("multiple matching events", "name", name);
|
|
10693
10360
|
}
|
|
10694
10361
|
return this.events[matching[0]];
|
|
10695
10362
|
}
|
|
10696
10363
|
// Normalize the signature and lookup the function
|
|
10697
10364
|
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
|
10698
10365
|
if (!result) {
|
|
10699
|
-
logger$
|
|
10366
|
+
logger$4.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
|
|
10700
10367
|
}
|
|
10701
10368
|
return result;
|
|
10702
10369
|
}
|
|
@@ -10710,24 +10377,24 @@ class Interface {
|
|
|
10710
10377
|
return this.errors[name];
|
|
10711
10378
|
}
|
|
10712
10379
|
}
|
|
10713
|
-
logger$
|
|
10380
|
+
logger$4.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
|
10714
10381
|
}
|
|
10715
10382
|
// It is a bare name, look up the function (will return null if ambiguous)
|
|
10716
10383
|
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
|
10717
10384
|
const name = nameOrSignatureOrSighash.trim();
|
|
10718
10385
|
const matching = Object.keys(this.errors).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
|
10719
10386
|
if (matching.length === 0) {
|
|
10720
|
-
logger$
|
|
10387
|
+
logger$4.throwArgumentError("no matching error", "name", name);
|
|
10721
10388
|
}
|
|
10722
10389
|
else if (matching.length > 1) {
|
|
10723
|
-
logger$
|
|
10390
|
+
logger$4.throwArgumentError("multiple matching errors", "name", name);
|
|
10724
10391
|
}
|
|
10725
10392
|
return this.errors[matching[0]];
|
|
10726
10393
|
}
|
|
10727
10394
|
// Normalize the signature and lookup the function
|
|
10728
10395
|
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
|
10729
10396
|
if (!result) {
|
|
10730
|
-
logger$
|
|
10397
|
+
logger$4.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
|
10731
10398
|
}
|
|
10732
10399
|
return result;
|
|
10733
10400
|
}
|
|
@@ -10770,7 +10437,7 @@ class Interface {
|
|
|
10770
10437
|
}
|
|
10771
10438
|
const bytes = arrayify(data);
|
|
10772
10439
|
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(fragment)) {
|
|
10773
|
-
logger$
|
|
10440
|
+
logger$4.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify(bytes));
|
|
10774
10441
|
}
|
|
10775
10442
|
return this._decodeParams(fragment.inputs, bytes.slice(4));
|
|
10776
10443
|
}
|
|
@@ -10790,7 +10457,7 @@ class Interface {
|
|
|
10790
10457
|
}
|
|
10791
10458
|
const bytes = arrayify(data);
|
|
10792
10459
|
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
|
|
10793
|
-
logger$
|
|
10460
|
+
logger$4.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify(bytes));
|
|
10794
10461
|
}
|
|
10795
10462
|
return this._decodeParams(functionFragment.inputs, bytes.slice(4));
|
|
10796
10463
|
}
|
|
@@ -10851,7 +10518,7 @@ class Interface {
|
|
|
10851
10518
|
break;
|
|
10852
10519
|
}
|
|
10853
10520
|
}
|
|
10854
|
-
return logger$
|
|
10521
|
+
return logger$4.throwError("call revert exception" + message, Logger.errors.CALL_EXCEPTION, {
|
|
10855
10522
|
method: functionFragment.format(),
|
|
10856
10523
|
data: hexlify(data), errorArgs, errorName, errorSignature, reason
|
|
10857
10524
|
});
|
|
@@ -10869,7 +10536,7 @@ class Interface {
|
|
|
10869
10536
|
eventFragment = this.getEvent(eventFragment);
|
|
10870
10537
|
}
|
|
10871
10538
|
if (values.length > eventFragment.inputs.length) {
|
|
10872
|
-
logger$
|
|
10539
|
+
logger$4.throwError("too many arguments for " + eventFragment.format(), Logger.errors.UNEXPECTED_ARGUMENT, {
|
|
10873
10540
|
argument: "values",
|
|
10874
10541
|
value: values
|
|
10875
10542
|
});
|
|
@@ -10901,7 +10568,7 @@ class Interface {
|
|
|
10901
10568
|
let param = eventFragment.inputs[index];
|
|
10902
10569
|
if (!param.indexed) {
|
|
10903
10570
|
if (value != null) {
|
|
10904
|
-
logger$
|
|
10571
|
+
logger$4.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value);
|
|
10905
10572
|
}
|
|
10906
10573
|
return;
|
|
10907
10574
|
}
|
|
@@ -10909,7 +10576,7 @@ class Interface {
|
|
|
10909
10576
|
topics.push(null);
|
|
10910
10577
|
}
|
|
10911
10578
|
else if (param.baseType === "array" || param.baseType === "tuple") {
|
|
10912
|
-
logger$
|
|
10579
|
+
logger$4.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
|
|
10913
10580
|
}
|
|
10914
10581
|
else if (Array.isArray(value)) {
|
|
10915
10582
|
topics.push(value.map((value) => encodeTopic(param, value)));
|
|
@@ -10935,7 +10602,7 @@ class Interface {
|
|
|
10935
10602
|
topics.push(this.getEventTopic(eventFragment));
|
|
10936
10603
|
}
|
|
10937
10604
|
if (values.length !== eventFragment.inputs.length) {
|
|
10938
|
-
logger$
|
|
10605
|
+
logger$4.throwArgumentError("event arguments/values mismatch", "values", values);
|
|
10939
10606
|
}
|
|
10940
10607
|
eventFragment.inputs.forEach((param, index) => {
|
|
10941
10608
|
const value = values[index];
|
|
@@ -10972,7 +10639,7 @@ class Interface {
|
|
|
10972
10639
|
if (topics != null && !eventFragment.anonymous) {
|
|
10973
10640
|
let topicHash = this.getEventTopic(eventFragment);
|
|
10974
10641
|
if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
|
|
10975
|
-
logger$
|
|
10642
|
+
logger$4.throwError("fragment/topic mismatch", Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
|
|
10976
10643
|
}
|
|
10977
10644
|
topics = topics.slice(1);
|
|
10978
10645
|
}
|
|
@@ -11117,7 +10784,7 @@ class Interface {
|
|
|
11117
10784
|
}
|
|
11118
10785
|
}
|
|
11119
10786
|
|
|
11120
|
-
const version$
|
|
10787
|
+
const version$3 = "abstract-provider/5.7.0";
|
|
11121
10788
|
|
|
11122
10789
|
var __awaiter$2 = function (thisArg, _arguments, P, generator) {
|
|
11123
10790
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -11128,12 +10795,12 @@ var __awaiter$2 = function (thisArg, _arguments, P, generator) {
|
|
|
11128
10795
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11129
10796
|
});
|
|
11130
10797
|
};
|
|
11131
|
-
const logger$
|
|
10798
|
+
const logger$3 = new Logger(version$3);
|
|
11132
10799
|
///////////////////////////////
|
|
11133
10800
|
// Exported Abstracts
|
|
11134
10801
|
class Provider {
|
|
11135
10802
|
constructor() {
|
|
11136
|
-
logger$
|
|
10803
|
+
logger$3.checkAbstract(new.target, Provider);
|
|
11137
10804
|
defineReadOnly(this, "_isProvider", true);
|
|
11138
10805
|
}
|
|
11139
10806
|
getFeeData() {
|
|
@@ -11171,7 +10838,7 @@ class Provider {
|
|
|
11171
10838
|
}
|
|
11172
10839
|
}
|
|
11173
10840
|
|
|
11174
|
-
const version$
|
|
10841
|
+
const version$2 = "abstract-signer/5.7.0";
|
|
11175
10842
|
|
|
11176
10843
|
var __awaiter$1 = function (thisArg, _arguments, P, generator) {
|
|
11177
10844
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -11182,7 +10849,7 @@ var __awaiter$1 = function (thisArg, _arguments, P, generator) {
|
|
|
11182
10849
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11183
10850
|
});
|
|
11184
10851
|
};
|
|
11185
|
-
const logger$
|
|
10852
|
+
const logger$2 = new Logger(version$2);
|
|
11186
10853
|
const allowedTransactionKeys = [
|
|
11187
10854
|
"accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value"
|
|
11188
10855
|
];
|
|
@@ -11195,7 +10862,7 @@ class Signer {
|
|
|
11195
10862
|
///////////////////
|
|
11196
10863
|
// Sub-classes MUST call super
|
|
11197
10864
|
constructor() {
|
|
11198
|
-
logger$
|
|
10865
|
+
logger$2.checkAbstract(new.target, Signer);
|
|
11199
10866
|
defineReadOnly(this, "_isSigner", true);
|
|
11200
10867
|
}
|
|
11201
10868
|
///////////////////
|
|
@@ -11274,7 +10941,7 @@ class Signer {
|
|
|
11274
10941
|
checkTransaction(transaction) {
|
|
11275
10942
|
for (const key in transaction) {
|
|
11276
10943
|
if (allowedTransactionKeys.indexOf(key) === -1) {
|
|
11277
|
-
logger$
|
|
10944
|
+
logger$2.throwArgumentError("invalid transaction key: " + key, "transaction", transaction);
|
|
11278
10945
|
}
|
|
11279
10946
|
}
|
|
11280
10947
|
const tx = shallowCopy(transaction);
|
|
@@ -11288,7 +10955,7 @@ class Signer {
|
|
|
11288
10955
|
this.getAddress()
|
|
11289
10956
|
]).then((result) => {
|
|
11290
10957
|
if (result[0].toLowerCase() !== result[1].toLowerCase()) {
|
|
11291
|
-
logger$
|
|
10958
|
+
logger$2.throwArgumentError("from address mismatch", "transaction", transaction);
|
|
11292
10959
|
}
|
|
11293
10960
|
return result[0];
|
|
11294
10961
|
});
|
|
@@ -11312,7 +10979,7 @@ class Signer {
|
|
|
11312
10979
|
}
|
|
11313
10980
|
const address = yield this.resolveName(to);
|
|
11314
10981
|
if (address == null) {
|
|
11315
|
-
logger$
|
|
10982
|
+
logger$2.throwArgumentError("provided ENS name resolves to null", "tx.to", to);
|
|
11316
10983
|
}
|
|
11317
10984
|
return address;
|
|
11318
10985
|
}));
|
|
@@ -11322,10 +10989,10 @@ class Signer {
|
|
|
11322
10989
|
// Do not allow mixing pre-eip-1559 and eip-1559 properties
|
|
11323
10990
|
const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null);
|
|
11324
10991
|
if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) {
|
|
11325
|
-
logger$
|
|
10992
|
+
logger$2.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction);
|
|
11326
10993
|
}
|
|
11327
10994
|
else if ((tx.type === 0 || tx.type === 1) && hasEip1559) {
|
|
11328
|
-
logger$
|
|
10995
|
+
logger$2.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction);
|
|
11329
10996
|
}
|
|
11330
10997
|
if ((tx.type === 2 || tx.type == null) && (tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) {
|
|
11331
10998
|
// Fully-formed EIP-1559 transaction (skip getFeeData)
|
|
@@ -11369,7 +11036,7 @@ class Signer {
|
|
|
11369
11036
|
// Network doesn't support EIP-1559...
|
|
11370
11037
|
// ...but they are trying to use EIP-1559 properties
|
|
11371
11038
|
if (hasEip1559) {
|
|
11372
|
-
logger$
|
|
11039
|
+
logger$2.throwError("network does not support EIP-1559", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11373
11040
|
operation: "populateTransaction"
|
|
11374
11041
|
});
|
|
11375
11042
|
}
|
|
@@ -11382,7 +11049,7 @@ class Signer {
|
|
|
11382
11049
|
}
|
|
11383
11050
|
else {
|
|
11384
11051
|
// getFeeData has failed us.
|
|
11385
|
-
logger$
|
|
11052
|
+
logger$2.throwError("failed to get consistent fee data", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11386
11053
|
operation: "signer.getFeeData"
|
|
11387
11054
|
});
|
|
11388
11055
|
}
|
|
@@ -11406,7 +11073,7 @@ class Signer {
|
|
|
11406
11073
|
if (forwardErrors.indexOf(error.code) >= 0) {
|
|
11407
11074
|
throw error;
|
|
11408
11075
|
}
|
|
11409
|
-
return logger$
|
|
11076
|
+
return logger$2.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
|
|
11410
11077
|
error: error,
|
|
11411
11078
|
tx: tx
|
|
11412
11079
|
});
|
|
@@ -11421,7 +11088,7 @@ class Signer {
|
|
|
11421
11088
|
this.getChainId()
|
|
11422
11089
|
]).then((results) => {
|
|
11423
11090
|
if (results[1] !== 0 && results[0] !== results[1]) {
|
|
11424
|
-
logger$
|
|
11091
|
+
logger$2.throwArgumentError("chainId address mismatch", "transaction", transaction);
|
|
11425
11092
|
}
|
|
11426
11093
|
return results[0];
|
|
11427
11094
|
});
|
|
@@ -11433,7 +11100,7 @@ class Signer {
|
|
|
11433
11100
|
// Sub-classes SHOULD leave these alone
|
|
11434
11101
|
_checkProvider(operation) {
|
|
11435
11102
|
if (!this.provider) {
|
|
11436
|
-
logger$
|
|
11103
|
+
logger$2.throwError("missing provider", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11437
11104
|
operation: (operation || "_checkProvider")
|
|
11438
11105
|
});
|
|
11439
11106
|
}
|
|
@@ -11453,7 +11120,7 @@ class VoidSigner extends Signer {
|
|
|
11453
11120
|
}
|
|
11454
11121
|
_fail(message, operation) {
|
|
11455
11122
|
return Promise.resolve().then(() => {
|
|
11456
|
-
logger$
|
|
11123
|
+
logger$2.throwError(message, Logger.errors.UNSUPPORTED_OPERATION, { operation: operation });
|
|
11457
11124
|
});
|
|
11458
11125
|
}
|
|
11459
11126
|
signMessage(message) {
|
|
@@ -11470,9 +11137,9 @@ class VoidSigner extends Signer {
|
|
|
11470
11137
|
}
|
|
11471
11138
|
}
|
|
11472
11139
|
|
|
11473
|
-
const version$
|
|
11140
|
+
const version$1 = "transactions/5.7.0";
|
|
11474
11141
|
|
|
11475
|
-
const logger$
|
|
11142
|
+
const logger$1 = new Logger(version$1);
|
|
11476
11143
|
var TransactionTypes;
|
|
11477
11144
|
(function (TransactionTypes) {
|
|
11478
11145
|
TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy";
|
|
@@ -11484,7 +11151,7 @@ function accessSetify(addr, storageKeys) {
|
|
|
11484
11151
|
address: getAddress(addr),
|
|
11485
11152
|
storageKeys: (storageKeys || []).map((storageKey, index) => {
|
|
11486
11153
|
if (hexDataLength(storageKey) !== 32) {
|
|
11487
|
-
logger$
|
|
11154
|
+
logger$1.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey);
|
|
11488
11155
|
}
|
|
11489
11156
|
return storageKey.toLowerCase();
|
|
11490
11157
|
})
|
|
@@ -11495,7 +11162,7 @@ function accessListify(value) {
|
|
|
11495
11162
|
return value.map((set, index) => {
|
|
11496
11163
|
if (Array.isArray(set)) {
|
|
11497
11164
|
if (set.length > 2) {
|
|
11498
|
-
logger$
|
|
11165
|
+
logger$1.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set);
|
|
11499
11166
|
}
|
|
11500
11167
|
return accessSetify(set[0], set[1]);
|
|
11501
11168
|
}
|
|
@@ -11513,7 +11180,7 @@ function accessListify(value) {
|
|
|
11513
11180
|
return result;
|
|
11514
11181
|
}
|
|
11515
11182
|
|
|
11516
|
-
const version
|
|
11183
|
+
const version = "contracts/5.7.0";
|
|
11517
11184
|
|
|
11518
11185
|
var __awaiter = function (thisArg, _arguments, P, generator) {
|
|
11519
11186
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -11524,12 +11191,12 @@ var __awaiter = function (thisArg, _arguments, P, generator) {
|
|
|
11524
11191
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11525
11192
|
});
|
|
11526
11193
|
};
|
|
11527
|
-
const logger
|
|
11194
|
+
const logger = new Logger(version);
|
|
11528
11195
|
function resolveName(resolver, nameOrPromise) {
|
|
11529
11196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11530
11197
|
const name = yield nameOrPromise;
|
|
11531
11198
|
if (typeof (name) !== "string") {
|
|
11532
|
-
logger
|
|
11199
|
+
logger.throwArgumentError("invalid address or ENS name", "name", name);
|
|
11533
11200
|
}
|
|
11534
11201
|
// If it is already an address, just use it (after adding checksum)
|
|
11535
11202
|
try {
|
|
@@ -11537,13 +11204,13 @@ function resolveName(resolver, nameOrPromise) {
|
|
|
11537
11204
|
}
|
|
11538
11205
|
catch (error) { }
|
|
11539
11206
|
if (!resolver) {
|
|
11540
|
-
logger
|
|
11207
|
+
logger.throwError("a provider or signer is needed to resolve ENS names", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11541
11208
|
operation: "resolveName"
|
|
11542
11209
|
});
|
|
11543
11210
|
}
|
|
11544
11211
|
const address = yield resolver.resolveName(name);
|
|
11545
11212
|
if (address == null) {
|
|
11546
|
-
logger
|
|
11213
|
+
logger.throwArgumentError("resolver or addr is not configured for ENS name", "name", name);
|
|
11547
11214
|
}
|
|
11548
11215
|
return address;
|
|
11549
11216
|
});
|
|
@@ -11564,7 +11231,7 @@ function resolveAddresses(resolver, value, paramType) {
|
|
|
11564
11231
|
}
|
|
11565
11232
|
if (paramType.baseType === "array") {
|
|
11566
11233
|
if (!Array.isArray(value)) {
|
|
11567
|
-
return Promise.reject(logger
|
|
11234
|
+
return Promise.reject(logger.makeError("invalid value for array", Logger.errors.INVALID_ARGUMENT, {
|
|
11568
11235
|
argument: "value",
|
|
11569
11236
|
value
|
|
11570
11237
|
}));
|
|
@@ -11582,7 +11249,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
11582
11249
|
overrides = shallowCopy(args.pop());
|
|
11583
11250
|
}
|
|
11584
11251
|
// Make sure the parameter count matches
|
|
11585
|
-
logger
|
|
11252
|
+
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
|
|
11586
11253
|
// Populate "from" override (allow promises)
|
|
11587
11254
|
if (contract.signer) {
|
|
11588
11255
|
if (overrides.from) {
|
|
@@ -11593,7 +11260,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
11593
11260
|
signer: contract.signer.getAddress()
|
|
11594
11261
|
}).then((check) => __awaiter(this, void 0, void 0, function* () {
|
|
11595
11262
|
if (getAddress(check.signer) !== check.override) {
|
|
11596
|
-
logger
|
|
11263
|
+
logger.throwError("Contract with a Signer cannot override from", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11597
11264
|
operation: "overrides.from"
|
|
11598
11265
|
});
|
|
11599
11266
|
}
|
|
@@ -11671,7 +11338,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
11671
11338
|
if (ro.value) {
|
|
11672
11339
|
const roValue = BigNumber.from(ro.value);
|
|
11673
11340
|
if (!roValue.isZero() && !fragment.payable) {
|
|
11674
|
-
logger
|
|
11341
|
+
logger.throwError("non-payable method cannot override value", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11675
11342
|
operation: "overrides.value",
|
|
11676
11343
|
value: overrides.value
|
|
11677
11344
|
});
|
|
@@ -11700,7 +11367,7 @@ function populateTransaction(contract, fragment, args) {
|
|
|
11700
11367
|
// typo or using an unsupported key.
|
|
11701
11368
|
const leftovers = Object.keys(overrides).filter((key) => (overrides[key] != null));
|
|
11702
11369
|
if (leftovers.length) {
|
|
11703
|
-
logger
|
|
11370
|
+
logger.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11704
11371
|
operation: "overrides",
|
|
11705
11372
|
overrides: leftovers
|
|
11706
11373
|
});
|
|
@@ -11718,7 +11385,7 @@ function buildEstimate(contract, fragment) {
|
|
|
11718
11385
|
return function (...args) {
|
|
11719
11386
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11720
11387
|
if (!signerOrProvider) {
|
|
11721
|
-
logger
|
|
11388
|
+
logger.throwError("estimate require a provider or signer", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11722
11389
|
operation: "estimateGas"
|
|
11723
11390
|
});
|
|
11724
11391
|
}
|
|
@@ -11807,7 +11474,7 @@ function buildSend(contract, fragment) {
|
|
|
11807
11474
|
return function (...args) {
|
|
11808
11475
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11809
11476
|
if (!contract.signer) {
|
|
11810
|
-
logger
|
|
11477
|
+
logger.throwError("sending a transaction requires a signer", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
11811
11478
|
operation: "sendTransaction"
|
|
11812
11479
|
});
|
|
11813
11480
|
}
|
|
@@ -11906,7 +11573,7 @@ class FragmentRunningEvent extends RunningEvent {
|
|
|
11906
11573
|
let topic = contractInterface.getEventTopic(fragment);
|
|
11907
11574
|
if (topics) {
|
|
11908
11575
|
if (topic !== topics[0]) {
|
|
11909
|
-
logger
|
|
11576
|
+
logger.throwArgumentError("topic mismatch", "topics", topics);
|
|
11910
11577
|
}
|
|
11911
11578
|
filter.topics = topics.slice();
|
|
11912
11579
|
}
|
|
@@ -11988,7 +11655,7 @@ class BaseContract {
|
|
|
11988
11655
|
defineReadOnly(this, "signer", null);
|
|
11989
11656
|
}
|
|
11990
11657
|
else {
|
|
11991
|
-
logger
|
|
11658
|
+
logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider);
|
|
11992
11659
|
}
|
|
11993
11660
|
defineReadOnly(this, "callStatic", {});
|
|
11994
11661
|
defineReadOnly(this, "estimateGas", {});
|
|
@@ -12016,14 +11683,14 @@ class BaseContract {
|
|
|
12016
11683
|
defineReadOnly(this.filters, name, this.filters[filters[0]]);
|
|
12017
11684
|
}
|
|
12018
11685
|
else {
|
|
12019
|
-
logger
|
|
11686
|
+
logger.warn(`Duplicate definition of ${name} (${filters.join(", ")})`);
|
|
12020
11687
|
}
|
|
12021
11688
|
});
|
|
12022
11689
|
}
|
|
12023
11690
|
defineReadOnly(this, "_runningEvents", {});
|
|
12024
11691
|
defineReadOnly(this, "_wrappedEmits", {});
|
|
12025
11692
|
if (addressOrName == null) {
|
|
12026
|
-
logger
|
|
11693
|
+
logger.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName);
|
|
12027
11694
|
}
|
|
12028
11695
|
defineReadOnly(this, "address", addressOrName);
|
|
12029
11696
|
if (this.provider) {
|
|
@@ -12035,7 +11702,7 @@ class BaseContract {
|
|
|
12035
11702
|
}
|
|
12036
11703
|
catch (error) {
|
|
12037
11704
|
// Without a provider, we cannot use ENS names
|
|
12038
|
-
logger
|
|
11705
|
+
logger.throwError("provider is required to use ENS name as contract address", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
12039
11706
|
operation: "new Contract"
|
|
12040
11707
|
});
|
|
12041
11708
|
}
|
|
@@ -12049,7 +11716,7 @@ class BaseContract {
|
|
|
12049
11716
|
// Check that the signature is unique; if not the ABI generation has
|
|
12050
11717
|
// not been cleaned or may be incorrectly generated
|
|
12051
11718
|
if (uniqueSignatures[signature]) {
|
|
12052
|
-
logger
|
|
11719
|
+
logger.warn(`Duplicate ABI entry for ${JSON.stringify(signature)}`);
|
|
12053
11720
|
return;
|
|
12054
11721
|
}
|
|
12055
11722
|
uniqueSignatures[signature] = true;
|
|
@@ -12138,7 +11805,7 @@ class BaseContract {
|
|
|
12138
11805
|
// Otherwise, poll for our code to be deployed
|
|
12139
11806
|
this._deployedPromise = this.provider.getCode(this.address, blockTag).then((code) => {
|
|
12140
11807
|
if (code === "0x") {
|
|
12141
|
-
logger
|
|
11808
|
+
logger.throwError("contract not deployed", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
12142
11809
|
contractAddress: this.address,
|
|
12143
11810
|
operation: "getDeployed"
|
|
12144
11811
|
});
|
|
@@ -12155,14 +11822,14 @@ class BaseContract {
|
|
|
12155
11822
|
// estimateDeploy(bytecode: string, ...args): Promise<BigNumber>
|
|
12156
11823
|
fallback(overrides) {
|
|
12157
11824
|
if (!this.signer) {
|
|
12158
|
-
logger
|
|
11825
|
+
logger.throwError("sending a transactions require a signer", Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" });
|
|
12159
11826
|
}
|
|
12160
11827
|
const tx = shallowCopy(overrides || {});
|
|
12161
11828
|
["from", "to"].forEach(function (key) {
|
|
12162
11829
|
if (tx[key] == null) {
|
|
12163
11830
|
return;
|
|
12164
11831
|
}
|
|
12165
|
-
logger
|
|
11832
|
+
logger.throwError("cannot override " + key, Logger.errors.UNSUPPORTED_OPERATION, { operation: key });
|
|
12166
11833
|
});
|
|
12167
11834
|
tx.to = this.resolvedAddress;
|
|
12168
11835
|
return this.deployed().then(() => {
|
|
@@ -12265,7 +11932,7 @@ class BaseContract {
|
|
|
12265
11932
|
}
|
|
12266
11933
|
_addEventListener(runningEvent, listener, once) {
|
|
12267
11934
|
if (!this.provider) {
|
|
12268
|
-
logger
|
|
11935
|
+
logger.throwError("events require a provider or a signer with a provider", Logger.errors.UNSUPPORTED_OPERATION, { operation: "once" });
|
|
12269
11936
|
}
|
|
12270
11937
|
runningEvent.addListener(listener, once);
|
|
12271
11938
|
// Track this running event and its listeners (may already be there; but no hard in updating)
|
|
@@ -12305,7 +11972,7 @@ class BaseContract {
|
|
|
12305
11972
|
const filter = shallowCopy(runningEvent.filter);
|
|
12306
11973
|
if (typeof (fromBlockOrBlockhash) === "string" && isHexString(fromBlockOrBlockhash, 32)) {
|
|
12307
11974
|
if (toBlock != null) {
|
|
12308
|
-
logger
|
|
11975
|
+
logger.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock);
|
|
12309
11976
|
}
|
|
12310
11977
|
filter.blockHash = fromBlockOrBlockhash;
|
|
12311
11978
|
}
|
|
@@ -12395,31 +12062,6 @@ class BaseContract {
|
|
|
12395
12062
|
class Contract extends BaseContract {
|
|
12396
12063
|
}
|
|
12397
12064
|
|
|
12398
|
-
const version = "units/5.7.0";
|
|
12399
|
-
|
|
12400
|
-
const logger = new Logger(version);
|
|
12401
|
-
const names = [
|
|
12402
|
-
"wei",
|
|
12403
|
-
"kwei",
|
|
12404
|
-
"mwei",
|
|
12405
|
-
"gwei",
|
|
12406
|
-
"szabo",
|
|
12407
|
-
"finney",
|
|
12408
|
-
"ether",
|
|
12409
|
-
];
|
|
12410
|
-
function parseUnits(value, unitName) {
|
|
12411
|
-
if (typeof (value) !== "string") {
|
|
12412
|
-
logger.throwArgumentError("value must be a string", "value", value);
|
|
12413
|
-
}
|
|
12414
|
-
if (typeof (unitName) === "string") {
|
|
12415
|
-
const index = names.indexOf(unitName);
|
|
12416
|
-
if (index !== -1) {
|
|
12417
|
-
unitName = 3 * index;
|
|
12418
|
-
}
|
|
12419
|
-
}
|
|
12420
|
-
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
12421
|
-
}
|
|
12422
|
-
|
|
12423
12065
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
12424
12066
|
/**
|
|
12425
12067
|
* @constant {string} ETH_SEPOLIA_CHAIN_ID - The chain ID for the Ethereum Sepolia testnet (EIP-155 compatible format).
|
|
@@ -12441,6 +12083,10 @@ const ZKEVM_TESTNET_CHAIN_ID = '13473';
|
|
|
12441
12083
|
* @constant {string} ZKEVM_MAINNET_CHAIN_ID - The chain ID for the zkEVM mainnet (EIP-155 compatible format).
|
|
12442
12084
|
*/
|
|
12443
12085
|
const ZKEVM_MAINNET_CHAIN_ID = '13371'; // @TODO confirm this is still correct
|
|
12086
|
+
/**
|
|
12087
|
+
* @constant {string} CHILD_CHAIN_NATIVE_TOKEN_ADDRESS - Address of the native token on the child chain.
|
|
12088
|
+
*/
|
|
12089
|
+
const ETHEREUM_NATIVE_TOKEN_ADDRESS = '0x0000000000000000000000000000000000000eee';
|
|
12444
12090
|
/**
|
|
12445
12091
|
* @constant {BridgeInstance} ETH_SEPOLIA_TO_ZKEVM_DEVNET - A bridge instance configuration for bridging between
|
|
12446
12092
|
* the Ethereum Sepolia testnet and the zkEVM devnet.
|
|
@@ -14780,6 +14426,7 @@ var BridgeErrorType;
|
|
|
14780
14426
|
BridgeErrorType["AXELAR_GAS_ESTIMATE_FAILED"] = "AXELAR_GAS_ESTIMATE_FAILED";
|
|
14781
14427
|
BridgeErrorType["INVALID_RECIPIENT"] = "INVALID_RECIPIENT";
|
|
14782
14428
|
BridgeErrorType["FLOW_RATE_ERROR"] = "FLOW_RATE_ERROR";
|
|
14429
|
+
BridgeErrorType["INVALID_FLOWRATE_INDEX"] = "INVALID_FLOWRATE_INDEX";
|
|
14783
14430
|
})(BridgeErrorType || (BridgeErrorType = {}));
|
|
14784
14431
|
/**
|
|
14785
14432
|
* Represents a custom error for bridge operations.
|
|
@@ -16719,6 +16366,7 @@ class TokenBridge {
|
|
|
16719
16366
|
}, BridgeErrorType.INTERNAL_ERROR);
|
|
16720
16367
|
}
|
|
16721
16368
|
const flowRatePromises = [];
|
|
16369
|
+
const flowRateLengthPromises = [];
|
|
16722
16370
|
const flowRatePromisesReceivers = [];
|
|
16723
16371
|
for (let i = 0, l = statusResponses.length; i < l; i++) {
|
|
16724
16372
|
let metaStatus;
|
|
@@ -16766,26 +16414,40 @@ class TokenBridge {
|
|
|
16766
16414
|
...txItem,
|
|
16767
16415
|
token: decodedData[1],
|
|
16768
16416
|
sender: decodedData[2],
|
|
16769
|
-
|
|
16417
|
+
recipient: decodedData[3],
|
|
16770
16418
|
amount: decodedData[4],
|
|
16771
16419
|
};
|
|
16772
16420
|
}
|
|
16773
|
-
let flowRatePromiseIndex;
|
|
16421
|
+
let flowRatePromiseIndex = flowRatePromisesReceivers.findIndex((el) => el === txItem.recipient);
|
|
16774
16422
|
if (metaStatus === StatusResponse.COMPLETE
|
|
16775
|
-
&& isWithdraw && txItem.
|
|
16423
|
+
&& isWithdraw && txItem.recipient) {
|
|
16776
16424
|
// consolidate the calls we have to make to the flow rate by receiver
|
|
16777
|
-
if (
|
|
16778
|
-
|
|
16779
|
-
flowRatePromisesReceivers.push(txItem.receiver);
|
|
16425
|
+
if (flowRatePromiseIndex === -1) {
|
|
16426
|
+
flowRatePromisesReceivers.push(txItem.recipient);
|
|
16780
16427
|
flowRatePromiseIndex = flowRatePromisesReceivers.length - 1;
|
|
16781
16428
|
}
|
|
16782
|
-
else {
|
|
16783
|
-
flowRatePromiseIndex = flowRatePromisesReceivers.findIndex((el) => el === txItem.receiver);
|
|
16784
|
-
}
|
|
16785
16429
|
txItem.data.flowRatePromiseIndex = flowRatePromiseIndex;
|
|
16786
16430
|
}
|
|
16787
16431
|
txStatusResponse.transactions.push(txItem);
|
|
16788
16432
|
} // for
|
|
16433
|
+
for (const flowRateReceiver of flowRatePromisesReceivers) {
|
|
16434
|
+
flowRateLengthPromises.push(rootBridge.getPendingWithdrawalsLength(flowRateReceiver));
|
|
16435
|
+
}
|
|
16436
|
+
let flowRateLengthResponses = [];
|
|
16437
|
+
try {
|
|
16438
|
+
flowRateLengthResponses = await Promise.all(flowRateLengthPromises);
|
|
16439
|
+
}
|
|
16440
|
+
catch (err) {
|
|
16441
|
+
throw new BridgeError(`Failed to fetch the Flow Rate pending lengths with the reason: ${err}`, BridgeErrorType.FLOW_RATE_ERROR);
|
|
16442
|
+
}
|
|
16443
|
+
for (let i = 0, l = flowRatePromisesReceivers.length; i < l; i++) {
|
|
16444
|
+
const indices = [];
|
|
16445
|
+
const indicesLength = flowRateLengthResponses[i].toNumber();
|
|
16446
|
+
for (let j = 0; j < indicesLength; j++) {
|
|
16447
|
+
indices.push(j);
|
|
16448
|
+
}
|
|
16449
|
+
flowRatePromises.push(rootBridge.getPendingWithdrawals(flowRatePromisesReceivers[i], indices));
|
|
16450
|
+
}
|
|
16789
16451
|
let flowRateResponses = [];
|
|
16790
16452
|
if (flowRatePromises.length > 0) {
|
|
16791
16453
|
try {
|
|
@@ -16820,33 +16482,49 @@ class TokenBridge {
|
|
|
16820
16482
|
* @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type.
|
|
16821
16483
|
* @dev this SDK method is currently stubbed
|
|
16822
16484
|
*/
|
|
16823
|
-
async getFlowRateInfo(req
|
|
16824
|
-
|
|
16825
|
-
|
|
16485
|
+
async getFlowRateInfo(req) {
|
|
16486
|
+
if (!req.tokens || req.tokens.length === 0) {
|
|
16487
|
+
throw new BridgeError(`invalid tokens array ${req.tokens}`, BridgeErrorType.INVALID_TOKEN);
|
|
16488
|
+
}
|
|
16489
|
+
const rootBridge = await withBridgeError(async () => {
|
|
16490
|
+
const contract = new Contract(this.config.bridgeContracts.rootERC20BridgeFlowRate, ROOT_ERC20_BRIDGE_FLOW_RATE, this.config.rootProvider);
|
|
16491
|
+
return contract;
|
|
16492
|
+
}, BridgeErrorType.INTERNAL_ERROR);
|
|
16493
|
+
const contractPromises = [];
|
|
16494
|
+
contractPromises.push(rootBridge.withdrawalQueueActivated());
|
|
16495
|
+
contractPromises.push(rootBridge.withdrawalDelay());
|
|
16496
|
+
for (let token of req.tokens) {
|
|
16497
|
+
if (token.toUpperCase() === 'NATIVE') {
|
|
16498
|
+
token = ETHEREUM_NATIVE_TOKEN_ADDRESS;
|
|
16499
|
+
}
|
|
16500
|
+
contractPromises.push(rootBridge.flowRateBuckets(token));
|
|
16501
|
+
}
|
|
16502
|
+
let contractPromisesRes;
|
|
16503
|
+
try {
|
|
16504
|
+
contractPromisesRes = await Promise.all(contractPromises);
|
|
16505
|
+
}
|
|
16506
|
+
catch (err) {
|
|
16507
|
+
throw new BridgeError('unable to query contract for flowrate info', BridgeErrorType.INTERNAL_ERROR);
|
|
16508
|
+
}
|
|
16509
|
+
const tokensRes = {};
|
|
16510
|
+
// @note it's i + 2 because the first 2 promises are not token buckets
|
|
16511
|
+
for (let i = 0, l = req.tokens.length; i < l; i++) {
|
|
16512
|
+
tokensRes[req.tokens[i]] = {
|
|
16513
|
+
capacity: contractPromisesRes[i + 2].capacity,
|
|
16514
|
+
depth: contractPromisesRes[i + 2].depth,
|
|
16515
|
+
refillTime: contractPromisesRes[i + 2].refillTime.toNumber(),
|
|
16516
|
+
refillRate: contractPromisesRes[i + 2].refillRate,
|
|
16517
|
+
};
|
|
16518
|
+
}
|
|
16826
16519
|
// Return the token mappings
|
|
16827
16520
|
return {
|
|
16828
|
-
withdrawalQueueActivated:
|
|
16829
|
-
withdrawalDelay:
|
|
16830
|
-
tokens:
|
|
16831
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16832
|
-
NATIVE: {
|
|
16833
|
-
capacity: parseUnits('10', 18).toString(),
|
|
16834
|
-
depth: parseUnits('10', 18).toString(),
|
|
16835
|
-
refillTime: 1701227629,
|
|
16836
|
-
refillRate: parseUnits('10', 18).toString(),
|
|
16837
|
-
},
|
|
16838
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16839
|
-
'0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF': {
|
|
16840
|
-
capacity: parseUnits('10', 18).toString(),
|
|
16841
|
-
depth: parseUnits('10', 18).toString(),
|
|
16842
|
-
refillTime: 1701227629,
|
|
16843
|
-
refillRate: parseUnits('10', 18).toString(),
|
|
16844
|
-
},
|
|
16845
|
-
},
|
|
16521
|
+
withdrawalQueueActivated: contractPromisesRes[0],
|
|
16522
|
+
withdrawalDelay: contractPromisesRes[1].toNumber(),
|
|
16523
|
+
tokens: tokensRes,
|
|
16846
16524
|
};
|
|
16847
16525
|
}
|
|
16848
16526
|
/**
|
|
16849
|
-
*
|
|
16527
|
+
* Fetches the pending withdrawals for a given address.
|
|
16850
16528
|
*
|
|
16851
16529
|
* @param {PendingWithdrawalsRequest} req - The request object containing the reciever address.
|
|
16852
16530
|
* @returns {Promise<PendingWithdrawalsResponse>} - A promise that resolves to an object containing the child token address.
|
|
@@ -16855,25 +16533,46 @@ class TokenBridge {
|
|
|
16855
16533
|
*/
|
|
16856
16534
|
async getPendingWithdrawals(req) {
|
|
16857
16535
|
// eslint-disable-next-line no-console
|
|
16858
|
-
|
|
16859
|
-
|
|
16860
|
-
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
|
|
16865
|
-
|
|
16866
|
-
|
|
16867
|
-
|
|
16868
|
-
{
|
|
16869
|
-
canWithdraw: false,
|
|
16870
|
-
withdrawer: '0xEac347177DbA4a190B632C7d9b8da2AbfF57c772',
|
|
16871
|
-
token: '0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF',
|
|
16872
|
-
amount: parseUnits('2', 18).toString(),
|
|
16873
|
-
timeoutStart: 1698416029,
|
|
16874
|
-
timeoutEnd: 1698502429,
|
|
16875
|
-
}],
|
|
16536
|
+
if (!req.recipient) {
|
|
16537
|
+
throw new BridgeError(`invalid recipient ${req.recipient}`, BridgeErrorType.INVALID_RECIPIENT);
|
|
16538
|
+
}
|
|
16539
|
+
const rootBridge = await withBridgeError(async () => {
|
|
16540
|
+
const contract = new Contract(this.config.bridgeContracts.rootERC20BridgeFlowRate, ROOT_ERC20_BRIDGE_FLOW_RATE, this.config.rootProvider);
|
|
16541
|
+
return contract;
|
|
16542
|
+
}, BridgeErrorType.INTERNAL_ERROR);
|
|
16543
|
+
const pendingLength = await rootBridge.getPendingWithdrawalsLength(req.recipient);
|
|
16544
|
+
const pendingWithdrawals = {
|
|
16545
|
+
pending: [],
|
|
16876
16546
|
};
|
|
16547
|
+
if (pendingLength.toNumber() === 0) {
|
|
16548
|
+
return pendingWithdrawals;
|
|
16549
|
+
}
|
|
16550
|
+
const indices = [];
|
|
16551
|
+
for (let i = 0; i < pendingLength.toNumber(); i++) {
|
|
16552
|
+
indices.push(i);
|
|
16553
|
+
}
|
|
16554
|
+
const pending = await rootBridge.getPendingWithdrawals(req.recipient, indices);
|
|
16555
|
+
const timestampNow = Math.floor(Date.now() / 1000);
|
|
16556
|
+
const withdrawalDelay = await rootBridge.withdrawalDelay();
|
|
16557
|
+
for (let i = 0, l = pending.length; i < l; i++) {
|
|
16558
|
+
const timeoutEnd = pending[i].timestamp.add(withdrawalDelay).toNumber();
|
|
16559
|
+
if (timeoutEnd > timestampNow) {
|
|
16560
|
+
pendingWithdrawals.pending[i] = {
|
|
16561
|
+
canWithdraw: false,
|
|
16562
|
+
};
|
|
16563
|
+
}
|
|
16564
|
+
else {
|
|
16565
|
+
pendingWithdrawals.pending[i] = {
|
|
16566
|
+
canWithdraw: true,
|
|
16567
|
+
};
|
|
16568
|
+
}
|
|
16569
|
+
pendingWithdrawals.pending[i].withdrawer = pending[i].withdrawer;
|
|
16570
|
+
pendingWithdrawals.pending[i].token = pending[i].token;
|
|
16571
|
+
pendingWithdrawals.pending[i].amount = pending[i].amount;
|
|
16572
|
+
pendingWithdrawals.pending[i].timeoutStart = pending[i].timestamp.toNumber();
|
|
16573
|
+
pendingWithdrawals.pending[i].timeoutEnd = timeoutEnd;
|
|
16574
|
+
}
|
|
16575
|
+
return pendingWithdrawals;
|
|
16877
16576
|
}
|
|
16878
16577
|
/**
|
|
16879
16578
|
* Retrieves the unsigned flow rate withdrawal transaction
|
|
@@ -16885,12 +16584,54 @@ class TokenBridge {
|
|
|
16885
16584
|
*/
|
|
16886
16585
|
async getFlowRateWithdrawTx(req) {
|
|
16887
16586
|
// eslint-disable-next-line no-console
|
|
16888
|
-
|
|
16587
|
+
if (!req.recipient) {
|
|
16588
|
+
throw new BridgeError(`invalid recipient ${req.recipient}`, BridgeErrorType.INVALID_RECIPIENT);
|
|
16589
|
+
}
|
|
16590
|
+
if (req.index < 0) {
|
|
16591
|
+
throw new BridgeError(`invalid index ${req.index}`, BridgeErrorType.INVALID_FLOWRATE_INDEX);
|
|
16592
|
+
}
|
|
16593
|
+
const rootBridge = await withBridgeError(async () => {
|
|
16594
|
+
const contract = new Contract(this.config.bridgeContracts.rootERC20BridgeFlowRate, ROOT_ERC20_BRIDGE_FLOW_RATE, this.config.rootProvider);
|
|
16595
|
+
return contract;
|
|
16596
|
+
}, BridgeErrorType.INTERNAL_ERROR);
|
|
16597
|
+
const pending = await rootBridge.getPendingWithdrawals(req.recipient, [req.index]);
|
|
16598
|
+
if (pending[0].withdrawer === AddressZero
|
|
16599
|
+
|| pending[0].token === AddressZero
|
|
16600
|
+
|| pending[0].amount === BigNumber.from(0)
|
|
16601
|
+
|| pending[0].timestamp === BigNumber.from(0)) {
|
|
16602
|
+
throw new BridgeError(`pending withdrawal not found for ${req.recipient} at index ${req.index}`, BridgeErrorType.FLOW_RATE_ERROR);
|
|
16603
|
+
}
|
|
16604
|
+
const withdrawalDelay = await rootBridge.withdrawalDelay();
|
|
16605
|
+
const timeoutEnd = pending[0].timestamp.add(withdrawalDelay).toNumber();
|
|
16606
|
+
const timestampNow = Math.floor(Date.now() / 1000);
|
|
16607
|
+
if (timeoutEnd > timestampNow) {
|
|
16608
|
+
return {
|
|
16609
|
+
pendingWithdrawal: {
|
|
16610
|
+
canWithdraw: false,
|
|
16611
|
+
withdrawer: pending[0].withdrawer,
|
|
16612
|
+
token: pending[0].token,
|
|
16613
|
+
amount: pending[0].amount,
|
|
16614
|
+
timeoutStart: pending[0].timestamp.toNumber(),
|
|
16615
|
+
timeoutEnd,
|
|
16616
|
+
},
|
|
16617
|
+
unsignedTx: null,
|
|
16618
|
+
};
|
|
16619
|
+
}
|
|
16620
|
+
const data = await withBridgeError(async () => rootBridge.interface.encodeFunctionData('finaliseQueuedWithdrawal', [req.recipient, req.index]), BridgeErrorType.INTERNAL_ERROR);
|
|
16889
16621
|
return {
|
|
16622
|
+
pendingWithdrawal: {
|
|
16623
|
+
canWithdraw: true,
|
|
16624
|
+
withdrawer: pending[0].withdrawer,
|
|
16625
|
+
token: pending[0].token,
|
|
16626
|
+
amount: pending[0].amount,
|
|
16627
|
+
timeoutStart: pending[0].timestamp.toNumber(),
|
|
16628
|
+
timeoutEnd,
|
|
16629
|
+
},
|
|
16890
16630
|
unsignedTx: {
|
|
16891
|
-
data
|
|
16892
|
-
to:
|
|
16631
|
+
data,
|
|
16632
|
+
to: this.config.bridgeContracts.rootERC20BridgeFlowRate,
|
|
16893
16633
|
value: 0,
|
|
16634
|
+
chainId: parseInt(this.config.bridgeInstance.rootChainID, 10),
|
|
16894
16635
|
},
|
|
16895
16636
|
};
|
|
16896
16637
|
}
|
|
@@ -16944,17 +16685,26 @@ const CONTRACTS_FOR_BRIDGE = new Map()
|
|
|
16944
16685
|
.set(ETH_SEPOLIA_TO_ZKEVM_DEVNET, {
|
|
16945
16686
|
rootERC20BridgeFlowRate: '0x0',
|
|
16946
16687
|
childERC20Bridge: '0x0',
|
|
16947
|
-
|
|
16688
|
+
rootChainIMX: '0x0',
|
|
16689
|
+
rootChainWrappedETH: '0x0',
|
|
16690
|
+
childChainWrappedETH: '0x0',
|
|
16691
|
+
childChainWrappedIMX: '0x0',
|
|
16948
16692
|
})
|
|
16949
16693
|
.set(ETH_SEPOLIA_TO_ZKEVM_TESTNET, {
|
|
16950
16694
|
rootERC20BridgeFlowRate: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
|
|
16951
16695
|
childERC20Bridge: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
|
|
16952
|
-
|
|
16696
|
+
rootChainIMX: '0xe2629e08f4125d14e446660028bD98ee60EE69F2',
|
|
16697
|
+
rootChainWrappedETH: '0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9',
|
|
16698
|
+
childChainWrappedETH: '0xe9E96d1aad82562b7588F03f49aD34186f996478',
|
|
16699
|
+
childChainWrappedIMX: '0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439',
|
|
16953
16700
|
})
|
|
16954
16701
|
.set(ETH_MAINNET_TO_ZKEVM_MAINNET, {
|
|
16955
|
-
rootERC20BridgeFlowRate: '
|
|
16956
|
-
childERC20Bridge: '
|
|
16957
|
-
|
|
16702
|
+
rootERC20BridgeFlowRate: '0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6',
|
|
16703
|
+
childERC20Bridge: '0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6',
|
|
16704
|
+
rootChainIMX: '0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF',
|
|
16705
|
+
rootChainWrappedETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
16706
|
+
childChainWrappedETH: '0x52a6c53869ce09a731cd772f245b97a4401d3348',
|
|
16707
|
+
childChainWrappedIMX: '0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d',
|
|
16958
16708
|
});
|
|
16959
16709
|
/**
|
|
16960
16710
|
* Represents the configuration for a bridge between two chains.
|
|
@@ -17306,7 +17056,7 @@ const _abi$3 = [
|
|
|
17306
17056
|
class ERC20__factory {
|
|
17307
17057
|
static abi = _abi$3;
|
|
17308
17058
|
static createInterface() {
|
|
17309
|
-
return new utils$
|
|
17059
|
+
return new utils$2.Interface(_abi$3);
|
|
17310
17060
|
}
|
|
17311
17061
|
static connect(address, signerOrProvider) {
|
|
17312
17062
|
return new Contract$1(address, _abi$3, signerOrProvider);
|
|
@@ -17317,134 +17067,6 @@ class ERC20__factory {
|
|
|
17317
17067
|
/* tslint:disable */
|
|
17318
17068
|
/* eslint-disable */
|
|
17319
17069
|
const _abi$2 = [
|
|
17320
|
-
{
|
|
17321
|
-
inputs: [],
|
|
17322
|
-
name: "getCurrentBlockTimestamp",
|
|
17323
|
-
outputs: [
|
|
17324
|
-
{
|
|
17325
|
-
internalType: "uint256",
|
|
17326
|
-
name: "timestamp",
|
|
17327
|
-
type: "uint256",
|
|
17328
|
-
},
|
|
17329
|
-
],
|
|
17330
|
-
stateMutability: "view",
|
|
17331
|
-
type: "function",
|
|
17332
|
-
},
|
|
17333
|
-
{
|
|
17334
|
-
inputs: [
|
|
17335
|
-
{
|
|
17336
|
-
internalType: "address",
|
|
17337
|
-
name: "addr",
|
|
17338
|
-
type: "address",
|
|
17339
|
-
},
|
|
17340
|
-
],
|
|
17341
|
-
name: "getEthBalance",
|
|
17342
|
-
outputs: [
|
|
17343
|
-
{
|
|
17344
|
-
internalType: "uint256",
|
|
17345
|
-
name: "balance",
|
|
17346
|
-
type: "uint256",
|
|
17347
|
-
},
|
|
17348
|
-
],
|
|
17349
|
-
stateMutability: "view",
|
|
17350
|
-
type: "function",
|
|
17351
|
-
},
|
|
17352
|
-
{
|
|
17353
|
-
inputs: [
|
|
17354
|
-
{
|
|
17355
|
-
components: [
|
|
17356
|
-
{
|
|
17357
|
-
internalType: "address",
|
|
17358
|
-
name: "target",
|
|
17359
|
-
type: "address",
|
|
17360
|
-
},
|
|
17361
|
-
{
|
|
17362
|
-
internalType: "uint256",
|
|
17363
|
-
name: "gasLimit",
|
|
17364
|
-
type: "uint256",
|
|
17365
|
-
},
|
|
17366
|
-
{
|
|
17367
|
-
internalType: "bytes",
|
|
17368
|
-
name: "callData",
|
|
17369
|
-
type: "bytes",
|
|
17370
|
-
},
|
|
17371
|
-
],
|
|
17372
|
-
internalType: "struct UniswapInterfaceMulticall.Call[]",
|
|
17373
|
-
name: "calls",
|
|
17374
|
-
type: "tuple[]",
|
|
17375
|
-
},
|
|
17376
|
-
],
|
|
17377
|
-
name: "multicall",
|
|
17378
|
-
outputs: [
|
|
17379
|
-
{
|
|
17380
|
-
internalType: "uint256",
|
|
17381
|
-
name: "blockNumber",
|
|
17382
|
-
type: "uint256",
|
|
17383
|
-
},
|
|
17384
|
-
{
|
|
17385
|
-
components: [
|
|
17386
|
-
{
|
|
17387
|
-
internalType: "bool",
|
|
17388
|
-
name: "success",
|
|
17389
|
-
type: "bool",
|
|
17390
|
-
},
|
|
17391
|
-
{
|
|
17392
|
-
internalType: "uint256",
|
|
17393
|
-
name: "gasUsed",
|
|
17394
|
-
type: "uint256",
|
|
17395
|
-
},
|
|
17396
|
-
{
|
|
17397
|
-
internalType: "bytes",
|
|
17398
|
-
name: "returnData",
|
|
17399
|
-
type: "bytes",
|
|
17400
|
-
},
|
|
17401
|
-
],
|
|
17402
|
-
internalType: "struct UniswapInterfaceMulticall.Result[]",
|
|
17403
|
-
name: "returnData",
|
|
17404
|
-
type: "tuple[]",
|
|
17405
|
-
},
|
|
17406
|
-
],
|
|
17407
|
-
stateMutability: "nonpayable",
|
|
17408
|
-
type: "function",
|
|
17409
|
-
},
|
|
17410
|
-
];
|
|
17411
|
-
const _bytecode$2 = "0x608060405234801561001057600080fd5b50610567806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630f28c97d146100465780631749e1e3146100645780634d2301cc14610085575b600080fd5b61004e610098565b60405161005b919061041f565b60405180910390f35b6100776100723660046102a7565b61009c565b60405161005b929190610428565b61004e610093366004610286565b610220565b4290565b8051439060609067ffffffffffffffff811180156100b957600080fd5b506040519080825280602002602001820160405280156100f357816020015b6100e061023a565b8152602001906001900390816100d85790505b50905060005b835181101561021a57600080600086848151811061011357fe5b60200260200101516000015187858151811061012b57fe5b60200260200101516020015188868151811061014357fe5b60200260200101516040015192509250925060005a90506000808573ffffffffffffffffffffffffffffffffffffffff1685856040516101839190610403565b60006040518083038160008787f1925050503d80600081146101c1576040519150601f19603f3d011682016040523d82523d6000602084013e6101c6565b606091505b509150915060005a8403905060405180606001604052808415158152602001828152602001838152508989815181106101fb57fe5b60200260200101819052505050505050505080806001019150506100f9565b50915091565b73ffffffffffffffffffffffffffffffffffffffff163190565b604051806060016040528060001515815260200160008152602001606081525090565b803573ffffffffffffffffffffffffffffffffffffffff8116811461028157600080fd5b919050565b600060208284031215610297578081fd5b6102a08261025d565b9392505050565b600060208083850312156102b9578182fd5b823567ffffffffffffffff808211156102d0578384fd5b818501915085601f8301126102e3578384fd5b8135818111156102ef57fe5b6102fc8485830201610506565b81815284810190848601875b848110156103f457813587017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0606081838f03011215610346578a8bfd5b60408051606081018181108b8211171561035c57fe5b8252610369848d0161025d565b8152818401358c82015260608401358a811115610384578d8efd5b8085019450508e603f850112610398578c8dfd5b8b8401358a8111156103a657fe5b6103b68d85601f84011601610506565b93508084528f838287010111156103cb578d8efd5b808386018e86013783018c018d9052908101919091528552509287019290870190600101610308565b50909998505050505050505050565b6000825161041581846020870161052a565b9190910192915050565b90815260200190565b600060408083018584526020828186015281865180845260609350838701915083838202880101838901875b838110156104f6578983037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa001855281518051151584528681015187850152880151888401889052805188850181905260806104b582828801858c0161052a565b96880196601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01694909401909301925090850190600101610454565b50909a9950505050505050505050565b60405181810167ffffffffffffffff8111828210171561052257fe5b604052919050565b60005b8381101561054557818101518382015260200161052d565b83811115610554576000848401525b5050505056fea164736f6c6343000706000a";
|
|
17412
|
-
const isSuperArgs$2 = (xs) => xs.length > 1;
|
|
17413
|
-
class Multicall__factory extends ContractFactory {
|
|
17414
|
-
constructor(...args) {
|
|
17415
|
-
if (isSuperArgs$2(args)) {
|
|
17416
|
-
super(...args);
|
|
17417
|
-
}
|
|
17418
|
-
else {
|
|
17419
|
-
super(_abi$2, _bytecode$2, args[0]);
|
|
17420
|
-
}
|
|
17421
|
-
}
|
|
17422
|
-
deploy(overrides) {
|
|
17423
|
-
return super.deploy(overrides || {});
|
|
17424
|
-
}
|
|
17425
|
-
getDeployTransaction(overrides) {
|
|
17426
|
-
return super.getDeployTransaction(overrides || {});
|
|
17427
|
-
}
|
|
17428
|
-
attach(address) {
|
|
17429
|
-
return super.attach(address);
|
|
17430
|
-
}
|
|
17431
|
-
connect(signer) {
|
|
17432
|
-
return super.connect(signer);
|
|
17433
|
-
}
|
|
17434
|
-
static bytecode = _bytecode$2;
|
|
17435
|
-
static abi = _abi$2;
|
|
17436
|
-
static createInterface() {
|
|
17437
|
-
return new utils$1.Interface(_abi$2);
|
|
17438
|
-
}
|
|
17439
|
-
static connect(address, signerOrProvider) {
|
|
17440
|
-
return new Contract$1(address, _abi$2, signerOrProvider);
|
|
17441
|
-
}
|
|
17442
|
-
}
|
|
17443
|
-
|
|
17444
|
-
/* Autogenerated file. Do not edit manually. */
|
|
17445
|
-
/* tslint:disable */
|
|
17446
|
-
/* eslint-disable */
|
|
17447
|
-
const _abi$1 = [
|
|
17448
17070
|
{
|
|
17449
17071
|
inputs: [
|
|
17450
17072
|
{
|
|
@@ -17728,7 +17350,7 @@ const _abi$1 = [
|
|
|
17728
17350
|
type: "uint256",
|
|
17729
17351
|
},
|
|
17730
17352
|
],
|
|
17731
|
-
internalType: "struct
|
|
17353
|
+
internalType: "struct IImmutableSwapProxy.SecondaryFeeParams[]",
|
|
17732
17354
|
name: "secondaryFees",
|
|
17733
17355
|
type: "tuple[]",
|
|
17734
17356
|
},
|
|
@@ -17801,7 +17423,7 @@ const _abi$1 = [
|
|
|
17801
17423
|
type: "uint256",
|
|
17802
17424
|
},
|
|
17803
17425
|
],
|
|
17804
|
-
internalType: "struct
|
|
17426
|
+
internalType: "struct IImmutableSwapProxy.SecondaryFeeParams[]",
|
|
17805
17427
|
name: "secondaryFees",
|
|
17806
17428
|
type: "tuple[]",
|
|
17807
17429
|
},
|
|
@@ -17859,7 +17481,7 @@ const _abi$1 = [
|
|
|
17859
17481
|
type: "uint256",
|
|
17860
17482
|
},
|
|
17861
17483
|
],
|
|
17862
|
-
internalType: "struct
|
|
17484
|
+
internalType: "struct IImmutableSwapProxy.SecondaryFeeParams[]",
|
|
17863
17485
|
name: "secondaryFees",
|
|
17864
17486
|
type: "tuple[]",
|
|
17865
17487
|
},
|
|
@@ -17910,7 +17532,7 @@ const _abi$1 = [
|
|
|
17910
17532
|
outputs: [
|
|
17911
17533
|
{
|
|
17912
17534
|
internalType: "uint256",
|
|
17913
|
-
name: "",
|
|
17535
|
+
name: "amountIn",
|
|
17914
17536
|
type: "uint256",
|
|
17915
17537
|
},
|
|
17916
17538
|
],
|
|
@@ -17932,7 +17554,7 @@ const _abi$1 = [
|
|
|
17932
17554
|
type: "uint256",
|
|
17933
17555
|
},
|
|
17934
17556
|
],
|
|
17935
|
-
internalType: "struct
|
|
17557
|
+
internalType: "struct IImmutableSwapProxy.SecondaryFeeParams[]",
|
|
17936
17558
|
name: "secondaryFees",
|
|
17937
17559
|
type: "tuple[]",
|
|
17938
17560
|
},
|
|
@@ -17968,7 +17590,7 @@ const _abi$1 = [
|
|
|
17968
17590
|
outputs: [
|
|
17969
17591
|
{
|
|
17970
17592
|
internalType: "uint256",
|
|
17971
|
-
name: "",
|
|
17593
|
+
name: "amountIn",
|
|
17972
17594
|
type: "uint256",
|
|
17973
17595
|
},
|
|
17974
17596
|
],
|
|
@@ -18210,15 +17832,15 @@ const _abi$1 = [
|
|
|
18210
17832
|
type: "receive",
|
|
18211
17833
|
},
|
|
18212
17834
|
];
|
|
18213
|
-
const _bytecode$1 = "0x60806040523480156200001157600080fd5b50604051620031e1380380620031e183398101604081905262000034916200015c565b6001805460ff191690556200004b6000846200009e565b600180546001600160a01b039384166101008102610100600160a81b03199092169190911790915560038054929093166001600160a01b03199283161790925560028054909116909117905550620001a6565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200013b576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000fa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200015757600080fd5b919050565b6000806000606084860312156200017257600080fd5b6200017d846200013f565b92506200018d602085016200013f565b91506200019d604085016200013f565b90509250925092565b61302b80620001b66000396000f3fe6080604052600436106101175760003560e01c806358e81a50116100a05780638456cb59116100645780638456cb59146102c457806391d14854146102d9578063a217fddf146102f9578063ac9650d81461030e578063d547741f1461032e57600080fd5b806358e81a50146102465780635ae401dc146102595780635c975abb146102795780635ebca7991461029157806368742da6146102a457600080fd5b80632f2ff15d116100e75780632f2ff15d146101cb57806336568abe146101eb578063383ebb0b1461020b5780633f4ba83a1461021e5780635640f6591461023357600080fd5b80620fa9fb1461012357806301ffc9a714610145578063116944b21461017a578063248a9ca31461019b57600080fd5b3661011e57005b600080fd5b34801561012f57600080fd5b5061014361013e3660046127c3565b61034e565b005b34801561015157600080fd5b506101656101603660046127fc565b61041a565b60405190151581526020015b60405180910390f35b61018d61018836600461298d565b610451565b604051908152602001610171565b3480156101a757600080fd5b5061018d6101b63660046129e2565b60009081526020819052604090206001015490565b3480156101d757600080fd5b506101436101e63660046129fb565b6106d3565b3480156101f757600080fd5b506101436102063660046129fb565b6106f8565b61018d610219366004612ae3565b61077b565b34801561022a57600080fd5b50610143610ae7565b61018d610241366004612ae3565b610b37565b61018d61025436600461298d565b610db2565b61026c610267366004612b8f565b6110e4565b6040516101719190612c2a565b34801561028557600080fd5b5060015460ff16610165565b61014361029f3660046129e2565b611119565b3480156102b057600080fd5b506101436102bf366004612c8c565b611266565b3480156102d057600080fd5b506101436112e1565b3480156102e557600080fd5b506101656102f43660046129fb565b61132f565b34801561030557600080fd5b5061018d600081565b34801561031a57600080fd5b5061026c610329366004612ca9565b611358565b34801561033a57600080fd5b506101436103493660046129fb565b61144c565b6103787f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e9828693361132f565b610394576040516282b42960e81b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190612cea565b90506104156001600160a01b0383168483611471565b505050565b60006001600160e01b03198216637965db0b60e01b148061044b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061045f60015460ff1690565b1561047d5760405163ab35696f60e01b815260040160405180910390fd5b61048a82606001516114d4565b6104a75760405163519bdea760e01b815260040160405180910390fd5b4780156105e757826080015181146104d2576040516342f7487960e11b815260040160405180910390fd5b60035483516001600160a01b03908116911614610502576040516324d0121760e01b815260040160405180910390fd5b61056283608001518686808060200260200160405190810160405280939291908181526020016000905b828210156105585761054960408302860136819003810190612d03565b8152602001906001019061052c565b50505050506114fa565b608084018190526001546040516304e45aaf60e01b81526101009091046001600160a01b0316916304e45aaf9161059d908790600401612d5a565b60206040518083038185885af11580156105bb573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906105e09190612cea565b91506106cb565b61064c836000015184608001518787808060200260200160405190810160405280939291908181526020016000905b828210156106425761063360408302860136819003810190612d03565b81526020019060010190610616565b505050505061154c565b60808401526001546040516304e45aaf60e01b81526101009091046001600160a01b0316906304e45aaf90610685908690600401612d5a565b6020604051808303816000875af11580156106a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c89190612cea565b91505b509392505050565b6000828152602081905260409020600101546106ee816115a9565b61041583836115b3565b6001600160a01b038116331461076d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6107778282611637565b5050565b600061078960015460ff1690565b156107a75760405163ab35696f60e01b815260040160405180910390fd5b6107b482602001516114d4565b6107d15760405163519bdea760e01b815260040160405180910390fd5b60006107e0836000015161169c565b9050478015610992576003546001600160a01b03838116911614610817576040516324d0121760e01b815260040160405180910390fd5b8360600151811461083b576040516342f7487960e11b815260040160405180910390fd5b60008061089e86606001518989808060200260200160405190810160405280939291908181526020016000905b828210156108945761088560408302860136819003810190612d03565b81526020019060010190610868565b50505050506116ca565b606088018190526001546040516304dc09a360e11b81529294509092506000916101009091046001600160a01b0316906309b813469084906108e4908b90600401612e00565b60206040518083038185885af1158015610902573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109279190612cea565b905061098681848b8b808060200260200160405190810160405280939291908181526020016000905b8282101561097c5761096d60408302860136819003810190612d03565b81526020019060010190610950565b505050505061171d565b95505050505050610ae0565b6000806109f68487606001518a8a808060200260200160405190810160405280939291908181526020016000905b828210156109ec576109dd60408302860136819003810190612d03565b815260200190600101906109c0565b5050505050611811565b606088018190526001546040516304dc09a360e11b81529294509092506000916101009091046001600160a01b0316906309b8134690610a3a908a90600401612e00565b6020604051808303816000875af1158015610a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7d9190612cea565b90506109868582858c8c808060200260200160405190810160405280939291908181526020016000905b82821015610ad357610ac460408302860136819003810190612d03565b81526020019060010190610aa7565b505050505061186b565b50505b9392505050565b610b117fe7276a2a84d8de556657ec9cf93a55a7d66f096e529d0582ed08e9e2208b92b53361132f565b610b2d576040516282b42960e81b815260040160405180910390fd5b610b356118c7565b565b6000610b4560015460ff1690565b15610b635760405163ab35696f60e01b815260040160405180910390fd5b610b7082602001516114d4565b610b8d5760405163519bdea760e01b815260040160405180910390fd5b6000610b9c8360000151611919565b9050478015610cd25783604001518114610bc9576040516342f7487960e11b815260040160405180910390fd5b6003546001600160a01b03838116911614610bf7576040516324d0121760e01b815260040160405180910390fd5b610c4d84604001518787808060200260200160405190810160405280939291908181526020016000905b8282101561055857610c3e60408302860136819003810190612d03565b81526020019060010190610c21565b6040858101829052600154905163b858183f60e01b81526101009091046001600160a01b03169163b858183f91610c88908890600401612e00565b60206040518083038185885af1158015610ca6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ccb9190612cea565b9250610add565b610d298285604001518888808060200260200160405190810160405280939291908181526020016000905b8282101561064257610d1a60408302860136819003810190612d03565b81526020019060010190610cfd565b604085810191909152600154905163b858183f60e01b81526101009091046001600160a01b03169063b858183f90610d65908790600401612e00565b6020604051808303816000875af1158015610d84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da89190612cea565b9695505050505050565b6000610dc060015460ff1690565b15610dde5760405163ab35696f60e01b815260040160405180910390fd5b610deb82606001516114d4565b610e085760405163519bdea760e01b815260040160405180910390fd5b478015610fa55760035483516001600160a01b03908116911614610e3f576040516324d0121760e01b815260040160405180910390fd5b8260a001518114610e63576040516342f7487960e11b815260040160405180910390fd5b600080610ebc8560a001518888808060200260200160405190810160405280939291908181526020016000905b8282101561089457610ead60408302860136819003810190612d03565b81526020019060010190610e90565b60a08701819052600154604051635023b4df60e01b81529294509092506000916101009091046001600160a01b031690635023b4df908490610f02908a90600401612d5a565b60206040518083038185885af1158015610f20573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f459190612cea565b9050610f9a81848a8a808060200260200160405190810160405280939291908181526020016000905b8282101561097c57610f8b60408302860136819003810190612d03565b81526020019060010190610f6e565b945050505050610ae0565b60008061100385600001518660a001518989808060200260200160405190810160405280939291908181526020016000905b828210156109ec57610ff460408302860136819003810190612d03565b81526020019060010190610fd7565b60a08701819052600154604051635023b4df60e01b81529294509092506000916101009091046001600160a01b031690635023b4df90611047908990600401612d5a565b6020604051808303816000875af1158015611066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108a9190612cea565b9050610f9a866000015182858b8b808060200260200160405190810160405280939291908181526020016000905b82821015610ad3576110d560408302860136819003810190612d03565b815260200190600101906110b8565b6060834211156111075760405163387b2e5560e11b815260040160405180910390fd5b6111118383611358565b949350505050565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611162573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111869190612cea565b9050818110156111cc5760405162461bcd60e51b8152602060048201526011602482015270092dce6eaccccd2c6d2cadce840ae929ab607b1b6044820152606401610764565b801561077757600354604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561121857600080fd5b505af115801561122c573d6000803e3d6000fd5b50505050600061123c3383611925565b905080610415576040516342fb4ceb60e11b81526004810184905260248101839052604401610764565b6112907f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e9828693361132f565b6112ac576040516282b42960e81b815260040160405180910390fd5b47156112de5760006112be8247611925565b90508061077757604051633398652560e11b815260040160405180910390fd5b50565b61130b7ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f63361132f565b611327576040516282b42960e81b815260040160405180910390fd5b610b356119cf565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060816001600160401b038111156113725761137261286a565b6040519080825280602002602001820160405280156113a557816020015b60608152602001906001900390816113905790505b50905060005b8281101561144557611415308585848181106113c9576113c9612e13565b90506020028101906113db9190612e29565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a0a92505050565b82828151811061142757611427612e13565b6020026020010181905250808061143d90612e85565b9150506113ab565b5092915050565b600082815260208190526040902060010154611467816115a9565b6104158383611637565b6040516001600160a01b03831660248201526044810182905261041590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a2f565b60006001600160a01b03821633148061044b57506001600160a01b038216301492915050565b600061150582611b04565b506000806115138585611b77565b90925090506115228286612e9e565b945061152d81611ca0565b600354611543906001600160a01b031686611d7f565b50929392505050565b600061155782611b04565b506000806115658585611b77565b90925090506115748286612e9e565b94506115808682611e7c565b6115956001600160a01b038716333088611f85565b61159f8686611d7f565b5092949350505050565b6112de8133611fc3565b6115bd828261132f565b610777576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556115f33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611641828261132f565b15610777576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080601483516116ad9190612e9e565b905060006116bd8483601461201c565b9050611111816000612129565b60008060006116d884611b04565b905060006116e882612710612eb1565b90506116f7866127108361218e565b600354909350611710906001600160a01b031684611d7f565b85935050505b9250929050565b600080600061172c8685611b77565b9150915061173981611ca0565b600260009054906101000a90046001600160a01b03166001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561178957600080fd5b505af115801561179d573d6000803e3d6000fd5b5050505060008287876117b09190612e9e565b6117ba9190612e9e565b604051909150600090339083156108fc0290849084818181858888f193505050509050806117fb576040516382e4f46960e01b815260040160405180910390fd5b6118058489612eb1565b98975050505050505050565b600080600061181f84611b04565b9050600061182f82612710612eb1565b905061183e866127108361218e565b925061184a8784611d7f565b61185f6001600160a01b038816333089611f85565b50939590945092505050565b600080600061187a8685611b77565b9150915061188887826121ce565b6118b233836118978989612e9e565b6118a19190612e9e565b6001600160a01b038a169190611471565b6118bc8287612eb1565b979650505050505050565b6118cf6122d5565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061044b8282612129565b6000814710156119775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610764565b6040516001600160a01b038416908390600081818185875af1925050503d80600081146119c0576040519150601f19603f3d011682016040523d82523d6000602084013e6119c5565b606091505b5090949350505050565b6119d761231e565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336118fc565b6060610ae08383604051806060016040528060278152602001612fcf60279139612364565b6000611a84826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123d29092919063ffffffff16565b9050805160001480611aa5575080806020019051810190611aa59190612ec4565b6104155760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610764565b6000805b8251811015611b4e57828181518110611b2357611b23612e13565b60200260200101516020015182611b3a9190612eb1565b915080611b4681612e85565b915050611b08565b506103e8811115611b725760405163cd4e616760e01b815260040160405180910390fd5b919050565b6000606082516001600160401b03811115611b9457611b9461286a565b604051908082528060200260200182016040528015611bd957816020015b6040805180820190915260008082526020820152815260200190600190039081611bb25790505b50905060005b8351811015611c98576000611c1e858381518110611bff57611bff612e13565b602002602001015160200151612710886123e19092919063ffffffff16565b90506040518060400160405280868481518110611c3d57611c3d612e13565b6020026020010151600001516001600160a01b0316815260200182815250838381518110611c6d57611c6d612e13565b6020908102919091010152611c828185612eb1565b9350508080611c9090612e85565b915050611bdf565b509250929050565b60005b8151811015610777576000828281518110611cc057611cc0612e13565b602002602001015190506000611cde82600001518360200151611925565b905080611d1557815160208301516040516208c3b360e61b81526001600160a01b0390921660048301526024820152604401610764565b81600001516001600160a01b0316336001600160a01b03167fe0e765ab26c1caf691c510426951246128b96830e49cc81d8c093fd551abac358460200151604051611d6291815260200190565b60405180910390a350508080611d7790612e85565b915050611ca3565b600154604051636eb1769f60e11b81523060048201526001600160a01b0361010090920482166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611dd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df99190612cea565b10156107775760015460405163095ea7b360e01b81526101009091046001600160a01b039081166004830152600019602483015283169063095ea7b3906044016020604051808303816000875af1158015611e58573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104159190612ec4565b60005b815181101561041557611ee233838381518110611e9e57611e9e612e13565b602002602001015160000151848481518110611ebc57611ebc612e13565b602002602001015160200151866001600160a01b0316611f85909392919063ffffffff16565b818181518110611ef457611ef4612e13565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e858581518110611f5057611f50612e13565b602002602001015160200151604051611f6b91815260200190565b60405180910390a480611f7d81612e85565b915050611e7f565b6040516001600160a01b0380851660248301528316604482015260648101829052611fbd9085906323b872dd60e01b9060840161149d565b50505050565b611fcd828261132f565b61077757611fda81612483565b611fe5836020612495565b604051602001611ff6929190612ee6565b60408051601f198184030181529082905262461bcd60e51b825261076491600401612f5b565b60608161202a81601f612eb1565b10156120695760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610764565b6120738284612eb1565b845110156120b75760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610764565b6060821580156120d65760405191506000825260208201604052612120565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561210f5780518352602092830192016120f7565b5050858452601f01601f1916604052505b50949350505050565b6000612136826014612eb1565b8351101561217e5760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610764565b500160200151600160601b900490565b600061219b8484846123e1565b9050600082806121ad576121ad612f6e565b8486091115610ae05760001981106121c457600080fd5b6001019392505050565b60005b8151811015610415576122328282815181106121ef576121ef612e13565b60200260200101516000015183838151811061220d5761220d612e13565b602002602001015160200151856001600160a01b03166114719092919063ffffffff16565b81818151811061224457612244612e13565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106122a0576122a0612e13565b6020026020010151602001516040516122bb91815260200190565b60405180910390a4806122cd81612e85565b9150506121d1565b60015460ff16610b355760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610764565b60015460ff1615610b355760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610764565b6060600080856001600160a01b0316856040516123819190612f84565b600060405180830381855af49150503d80600081146123bc576040519150601f19603f3d011682016040523d82523d6000602084013e6123c1565b606091505b5091509150610da886838387612630565b606061111184846000856126a9565b6000838302816000198587098281108382030391505080841161240357600080fd5b8060000361241657508290049050610ae0565b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b606061044b6001600160a01b03831660145b606060006124a4836002612fa0565b6124af906002612eb1565b6001600160401b038111156124c6576124c661286a565b6040519080825280601f01601f1916602001820160405280156124f0576020820181803683370190505b509050600360fc1b8160008151811061250b5761250b612e13565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061253a5761253a612e13565b60200101906001600160f81b031916908160001a905350600061255e846002612fa0565b612569906001612eb1565b90505b60018111156125e1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061259d5761259d612e13565b1a60f81b8282815181106125b3576125b3612e13565b60200101906001600160f81b031916908160001a90535060049490941c936125da81612fb7565b905061256c565b508315610ae05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610764565b6060831561269f578251600003612698576001600160a01b0385163b6126985760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610764565b5081611111565b6111118383612779565b60608247101561270a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610764565b600080866001600160a01b031685876040516127269190612f84565b60006040518083038185875af1925050503d8060008114612763576040519150601f19603f3d011682016040523d82523d6000602084013e612768565b606091505b50915091506118bc87838387612630565b8151156127895781518083602001fd5b8060405162461bcd60e51b81526004016107649190612f5b565b6001600160a01b03811681146112de57600080fd5b8035611b72816127a3565b600080604083850312156127d657600080fd5b82356127e1816127a3565b915060208301356127f1816127a3565b809150509250929050565b60006020828403121561280e57600080fd5b81356001600160e01b031981168114610ae057600080fd5b60008083601f84011261283857600080fd5b5081356001600160401b0381111561284f57600080fd5b6020830191508360208260061b850101111561171657600080fd5b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b03811182821017156128a2576128a261286a565b60405290565b604051608081016001600160401b03811182821017156128a2576128a261286a565b604051601f8201601f191681016001600160401b03811182821017156128f2576128f261286a565b604052919050565b600060e0828403121561290c57600080fd5b612914612880565b90508135612921816127a3565b81526020820135612931816127a3565b6020820152604082013562ffffff8116811461294c57600080fd5b604082015261295d606083016127b8565b60608201526080820135608082015260a082013560a082015261298260c083016127b8565b60c082015292915050565b600080600061010084860312156129a357600080fd5b83356001600160401b038111156129b957600080fd5b6129c586828701612826565b90945092506129d9905085602086016128fa565b90509250925092565b6000602082840312156129f457600080fd5b5035919050565b60008060408385031215612a0e57600080fd5b8235915060208301356127f1816127a3565b600060808284031215612a3257600080fd5b612a3a6128a8565b905081356001600160401b0380821115612a5357600080fd5b818401915084601f830112612a6757600080fd5b8135602082821115612a7b57612a7b61286a565b612a8d601f8301601f191682016128ca565b92508183528681838601011115612aa357600080fd5b81818501828501376000818385010152828552612ac18187016127b8565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215612af857600080fd5b83356001600160401b0380821115612b0f57600080fd5b612b1b87838801612826565b90955093506020860135915080821115612b3457600080fd5b50612b4186828701612a20565b9150509250925092565b60008083601f840112612b5d57600080fd5b5081356001600160401b03811115612b7457600080fd5b6020830191508360208260051b850101111561171657600080fd5b600080600060408486031215612ba457600080fd5b8335925060208401356001600160401b03811115612bc157600080fd5b612bcd86828701612b4b565b9497909650939450505050565b60005b83811015612bf5578181015183820152602001612bdd565b50506000910152565b60008151808452612c16816020860160208601612bda565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612c7f57603f19888603018452612c6d858351612bfe565b94509285019290850190600101612c51565b5092979650505050505050565b600060208284031215612c9e57600080fd5b8135610ae0816127a3565b60008060208385031215612cbc57600080fd5b82356001600160401b03811115612cd257600080fd5b612cde85828601612b4b565b90969095509350505050565b600060208284031215612cfc57600080fd5b5051919050565b600060408284031215612d1557600080fd5b604051604081018181106001600160401b0382111715612d3757612d3761286a565b6040528235612d45816127a3565b81526020928301359281019290925250919050565b60e0810161044b828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b6000815160808452612dce6080850182612bfe565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b602081526000610ae06020830184612db9565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612e4057600080fd5b8301803591506001600160401b03821115612e5a57600080fd5b60200191503681900382131561171657600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612e9757612e97612e6f565b5060010190565b8181038181111561044b5761044b612e6f565b8082018082111561044b5761044b612e6f565b600060208284031215612ed657600080fd5b81518015158114610ae057600080fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612f1e816017850160208801612bda565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612f4f816028840160208801612bda565b01602801949350505050565b602081526000610ae06020830184612bfe565b634e487b7160e01b600052601260045260246000fd5b60008251612f96818460208701612bda565b9190910192915050565b808202811582820484141761044b5761044b612e6f565b600081612fc657612fc6612e6f565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122060463b8c42f8b619093981b0f594938e67042d40ad9d5eadd4922e9bc3000dde64736f6c63430008130033";
|
|
18214
|
-
const isSuperArgs$
|
|
18215
|
-
class
|
|
17835
|
+
const _bytecode$2 = "0x60806040523480156200001157600080fd5b50604051620034dd380380620034dd83398101604081905262000034916200015c565b6001805460ff191690556200004b6000846200009e565b600180546001600160a01b039384166101008102610100600160a81b03199092169190911790915560038054929093166001600160a01b03199283161790925560028054909116909117905550620001a6565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200013b576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000fa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200015757600080fd5b919050565b6000806000606084860312156200017257600080fd5b6200017d846200013f565b92506200018d602085016200013f565b91506200019d604085016200013f565b90509250925092565b61332780620001b66000396000f3fe6080604052600436106101175760003560e01c806358e81a50116100a05780638456cb59116100645780638456cb59146102c457806391d14854146102d9578063a217fddf146102f9578063ac9650d81461030e578063d547741f1461032e57600080fd5b806358e81a50146102465780635ae401dc146102595780635c975abb146102795780635ebca7991461029157806368742da6146102a457600080fd5b80632f2ff15d116100e75780632f2ff15d146101cb57806336568abe146101eb578063383ebb0b1461020b5780633f4ba83a1461021e5780635640f6591461023357600080fd5b80620fa9fb1461012357806301ffc9a714610145578063116944b21461017a578063248a9ca31461019b57600080fd5b3661011e57005b600080fd5b34801561012f57600080fd5b5061014361013e366004612ab8565b61034e565b005b34801561015157600080fd5b50610165610160366004612af1565b61041a565b60405190151581526020015b60405180910390f35b61018d610188366004612c89565b610451565b604051908152602001610171565b3480156101a757600080fd5b5061018d6101b6366004612cde565b60009081526020819052604090206001015490565b3480156101d757600080fd5b506101436101e6366004612cf7565b610771565b3480156101f757600080fd5b50610143610206366004612cf7565b610796565b61018d610219366004612ddf565b610819565b34801561022a57600080fd5b50610143610b86565b61018d610241366004612ddf565b610bd6565b61018d610254366004612c89565b610ee4565b61026c610267366004612e8b565b61121e565b6040516101719190612f26565b34801561028557600080fd5b5060015460ff16610165565b61014361029f366004612cde565b611255565b3480156102b057600080fd5b506101436102bf366004612f88565b6113ad565b3480156102d057600080fd5b50610143611428565b3480156102e557600080fd5b506101656102f4366004612cf7565b611476565b34801561030557600080fd5b5061018d600081565b34801561031a57600080fd5b5061026c610329366004612fa5565b61149f565b34801561033a57600080fd5b50610143610349366004612cf7565b611593565b6103787f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e98286933611476565b610394576040516282b42960e81b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190612fe6565b90506104156001600160a01b03831684836115b8565b505050565b60006001600160e01b03198216637965db0b60e01b148061044b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061045f60015460ff1690565b1561047d5760405163ab35696f60e01b815260040160405180910390fd5b61048a826060015161161b565b6104a75760405163519bdea760e01b815260040160405180910390fd5b608082015134801561065a57836080015181146104d7576040516342f7487960e11b815260040160405180910390fd5b60035484516001600160a01b03908116911614610507576040516324d0121760e01b815260040160405180910390fd5b60008061056f866000015187608001518a8a808060200260200160405190810160405280939291908181526020016000905b828210156105655761055660408302860136819003810190612fff565b81526020019060010190610539565b5050505050611641565b608088018290526001546040516304e45aaf60e01b815292945090925061010090046001600160a01b0316906304e45aaf9084906105b1908a90600401613056565b60206040518083038185885af11580156105cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906105f49190612fe6565b945061065384828a8a808060200260200160405190810160405280939291908181526020016000905b828210156106495761063a60408302860136819003810190612fff565b8152602001906001019061061d565b5050505050611679565b5050610768565b6000806106b8866000015187608001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610565576106a960408302860136819003810190612fff565b8152602001906001019061068c565b60808801829052875191935091506106db906001600160a01b031633308561170c565b6001546040516304e45aaf60e01b81526101009091046001600160a01b0316906304e45aaf9061070f908990600401613056565b6020604051808303816000875af115801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107529190612fe6565b9450610765866000015185838b8b61174a565b50505b50509392505050565b60008281526020819052604090206001015461078c8161184b565b6104158383611855565b6001600160a01b038116331461080b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61081582826118d9565b5050565b600061082760015460ff1690565b156108455760405163ab35696f60e01b815260040160405180910390fd5b610852826020015161161b565b61086f5760405163519bdea760e01b815260040160405180910390fd5b600061087e836000015161193e565b606084015190915034908115610a30576003546001600160a01b038481169116146108bc576040516324d0121760e01b815260040160405180910390fd5b846060015182146108e0576040516342f7487960e11b815260040160405180910390fd5b600061094286606001518989808060200260200160405190810160405280939291908181526020016000905b828210156109385761092960408302860136819003810190612fff565b8152602001906001019061090c565b5050505050611974565b606087018190526001546040516304dc09a360e11b81529192506000916101009091046001600160a01b0316906309b81346908490610985908b906004016130fc565b60206040518083038185885af11580156109a3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109c89190612fe6565b9050610a2781848b8b808060200260200160405190810160405280939291908181526020016000905b82821015610a1d57610a0e60408302860136819003810190612fff565b815260200190600101906109f1565b50505050506119c3565b95505050610b7c565b6000610a938487606001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610a8957610a7a60408302860136819003810190612fff565b81526020019060010190610a5d565b5050505050611aab565b606087018190526001546040516304dc09a360e11b81529192506000916101009091046001600160a01b0316906309b8134690610ad4908a906004016130fc565b6020604051808303816000875af1158015610af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b179190612fe6565b9050610b778582858c8c808060200260200160405190810160405280939291908181526020016000905b82821015610b6d57610b5e60408302860136819003810190612fff565b81526020019060010190610b41565b5050505050611b03565b955050505b5050509392505050565b610bb07fe7276a2a84d8de556657ec9cf93a55a7d66f096e529d0582ed08e9e2208b92b533611476565b610bcc576040516282b42960e81b815260040160405180910390fd5b610bd4611b57565b565b6000610be460015460ff1690565b15610c025760405163ab35696f60e01b815260040160405180910390fd5b610c0f826020015161161b565b610c2c5760405163519bdea760e01b815260040160405180910390fd5b6000610c3b8360000151611ba9565b6040840151909150348015610dd75784604001518114610c6e576040516342f7487960e11b815260040160405180910390fd5b6003546001600160a01b03848116911614610c9c576040516324d0121760e01b815260040160405180910390fd5b600080610cf68588604001518b8b808060200260200160405190810160405280939291908181526020016000905b8282101561056557610ce760408302860136819003810190612fff565b81526020019060010190610cca565b6040898101839052600154905163b858183f60e01b815292945090925061010090046001600160a01b03169063b858183f908490610d38908b906004016130fc565b60206040518083038185885af1158015610d56573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d7b9190612fe6565b9550610dd084828b8b808060200260200160405190810160405280939291908181526020016000905b8282101561064957610dc160408302860136819003810190612fff565b81526020019060010190610da4565b5050610b7c565b600080610e318588604001518b8b808060200260200160405190810160405280939291908181526020016000905b8282101561056557610e2260408302860136819003810190612fff565b81526020019060010190610e05565b604089018290529092509050610e526001600160a01b03861633308561170c565b60015460405163b858183f60e01b81526101009091046001600160a01b03169063b858183f90610e86908a906004016130fc565b6020604051808303816000875af1158015610ea5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec99190612fe6565b9550610ed88585838c8c61174a565b50505050509392505050565b6000610ef260015460ff1690565b15610f105760405163ab35696f60e01b815260040160405180910390fd5b610f1d826060015161161b565b610f3a5760405163519bdea760e01b815260040160405180910390fd5b60a0820151349081156110d75760035484516001600160a01b03908116911614610f77576040516324d0121760e01b815260040160405180910390fd5b8360a001518214610f9b576040516342f7487960e11b815260040160405180910390fd5b6000610ff38560a001518888808060200260200160405190810160405280939291908181526020016000905b8282101561093857610fe460408302860136819003810190612fff565b81526020019060010190610fc7565b60a08601819052600154604051635023b4df60e01b81529192506000916101009091046001600160a01b031690635023b4df908490611036908a90600401613056565b60206040518083038185885af1158015611054573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110799190612fe6565b90506110ce81848a8a808060200260200160405190810160405280939291908181526020016000905b82821015610a1d576110bf60408302860136819003810190612fff565b815260200190600101906110a2565b94505050610768565b600061113485600001518660a001518989808060200260200160405190810160405280939291908181526020016000905b82821015610a895761112560408302860136819003810190612fff565b81526020019060010190611108565b60a08601819052600154604051635023b4df60e01b81529192506000916101009091046001600160a01b031690635023b4df90611175908990600401613056565b6020604051808303816000875af1158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b89190612fe6565b9050611212866000015182858b8b808060200260200160405190810160405280939291908181526020016000905b82821015610b6d5761120360408302860136819003810190612fff565b815260200190600101906111e6565b98975050505050505050565b6060834211156112415760405163387b2e5560e11b815260040160405180910390fd5b61124b838361149f565b90505b9392505050565b60015460ff16156112795760405163ab35696f60e01b815260040160405180910390fd5b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156112c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e69190612fe6565b905081811015611313576040516342fb4ceb60e11b81526004810183905260248101829052604401610802565b801561081557600354604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561135f57600080fd5b505af1158015611373573d6000803e3d6000fd5b5050505060006113833383611bb5565b905080610415576040516342fb4ceb60e11b81526004810184905260248101839052604401610802565b6113d77f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e98286933611476565b6113f3576040516282b42960e81b815260040160405180910390fd5b47156114255760006114058247611bb5565b90508061081557604051633398652560e11b815260040160405180910390fd5b50565b6114527ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f633611476565b61146e576040516282b42960e81b815260040160405180910390fd5b610bd4611c5f565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060816001600160401b038111156114b9576114b9612b66565b6040519080825280602002602001820160405280156114ec57816020015b60608152602001906001900390816114d75790505b50905060005b8281101561158c5761155c308585848181106115105761151061310f565b90506020028101906115229190613125565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611c9a92505050565b82828151811061156e5761156e61310f565b6020026020010181905250808061158490613181565b9150506114f2565b5092915050565b6000828152602081905260409020600101546115ae8161184b565b61041583836118d9565b6040516001600160a01b03831660248201526044810182905261041590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611cbf565b60006001600160a01b03821633148061044b57506001600160a01b038216301492915050565b60008061164d83611d94565b506116588484611e07565b509050611665818561319a565b91506116718583611f30565b935093915050565b600061168361202d565b905060006116928583866120a4565b90506000806116a18386611e07565b915091506116ae816120d0565b8315611703576000826116c1858a61319a565b6116cb919061319a565b905080156117015760006116df3383611bb5565b9050806116ff576040516382e4f46960e01b815260040160405180910390fd5b505b505b50505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526117449085906323b872dd60e01b906084016115e4565b50505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa158015611791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b59190612fe6565b905060006117c48683876120a4565b90506000611824828686808060200260200160405190810160405280939291908181526020016000905b8282101561181a5761180b60408302860136819003810190612fff565b815260200190600101906117ee565b5050505050611e07565b91505061183188826121af565b8215611701576117016001600160a01b03891633856115b8565b61142581336122b8565b61185f8282611476565b610815576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556118953390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6118e38282611476565b15610815576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000806014835161194f919061319a565b9050600061195f84836014612311565b905061196c81600061241e565b949350505050565b60008061198083611d94565b90506000611990826127106131ad565b905060006119a18661271084612483565b6003549091506119ba906001600160a01b031682611f30565b95945050505050565b60008060006119d28685611e07565b915091506119df816120d0565b600260009054906101000a90046001600160a01b03166001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611a2f57600080fd5b505af1158015611a43573d6000803e3d6000fd5b505050506000828787611a56919061319a565b611a60919061319a565b90508015611a96576000611a743383611bb5565b905080611a94576040516382e4f46960e01b815260040160405180910390fd5b505b611aa083886131ad565b979650505050505050565b600080611ab783611d94565b90506000611ac7826127106131ad565b90506000611ad88661271084612483565b9050611ae48782611f30565b611af96001600160a01b03881633308961170c565b9695505050505050565b6000806000611b128685611e07565b91509150611b2087826124c3565b600082611b2d888861319a565b611b37919061319a565b9050611b4d6001600160a01b03891633836115b8565b61121283886131ad565b611b5f6125ca565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061044b828261241e565b600081471015611c075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610802565b6040516001600160a01b038416908390600081818185875af1925050503d8060008114611c50576040519150601f19603f3d011682016040523d82523d6000602084013e611c55565b606091505b5090949350505050565b611c67612613565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611b8c565b606061124e83836040518060600160405280602781526020016132cb60279139612659565b6000611d14826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126c79092919063ffffffff16565b9050805160001480611d35575080806020019051810190611d3591906131c0565b6104155760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610802565b6000805b8251811015611dde57828181518110611db357611db361310f565b60200260200101516020015182611dca91906131ad565b915080611dd681613181565b915050611d98565b506103e8811115611e025760405163cd4e616760e01b815260040160405180910390fd5b919050565b6000606082516001600160401b03811115611e2457611e24612b66565b604051908082528060200260200182016040528015611e6957816020015b6040805180820190915260008082526020820152815260200190600190039081611e425790505b50905060005b8351811015611f28576000611eae858381518110611e8f57611e8f61310f565b602002602001015160200151612710886126d69092919063ffffffff16565b90506040518060400160405280868481518110611ecd57611ecd61310f565b6020026020010151600001516001600160a01b0316815260200182815250838381518110611efd57611efd61310f565b6020908102919091010152611f1281856131ad565b9350508080611f2090613181565b915050611e6f565b509250929050565b600154604051636eb1769f60e11b81523060048201526001600160a01b0361010090920482166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611faa9190612fe6565b10156108155760015460405163095ea7b360e01b81526101009091046001600160a01b039081166004830152600019602483015283169063095ea7b3906044016020604051808303816000875af1158015612009573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041591906131c0565b60025460408051630910874560e11b8152905160009247926001600160a01b03909116916312210e8a91600480820192879290919082900301818387803b15801561207757600080fd5b505af115801561208b573d6000803e3d6000fd5b5047925061209d91508390508261319a565b9250505090565b600082156120c857816120b7848661319a565b6120c1919061319a565b905061124e565b509192915050565b60005b81518110156108155760008282815181106120f0576120f061310f565b60200260200101519050600061210e82600001518360200151611bb5565b90508061214557815160208301516040516208c3b360e61b81526001600160a01b0390921660048301526024820152604401610802565b81600001516001600160a01b0316336001600160a01b03167fe0e765ab26c1caf691c510426951246128b96830e49cc81d8c093fd551abac35846020015160405161219291815260200190565b60405180910390a3505080806121a790613181565b9150506120d3565b60005b815181101561041557612215338383815181106121d1576121d161310f565b6020026020010151600001518484815181106121ef576121ef61310f565b602002602001015160200151866001600160a01b031661170c909392919063ffffffff16565b8181815181106122275761222761310f565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106122835761228361310f565b60200260200101516020015160405161229e91815260200190565b60405180910390a4806122b081613181565b9150506121b2565b6122c28282611476565b610815576122cf81612778565b6122da83602061278a565b6040516020016122eb9291906131e2565b60408051601f198184030181529082905262461bcd60e51b825261080291600401613257565b60608161231f81601f6131ad565b101561235e5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610802565b61236882846131ad565b845110156123ac5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610802565b6060821580156123cb5760405191506000825260208201604052612415565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156124045780518352602092830192016123ec565b5050858452601f01601f1916604052505b50949350505050565b600061242b8260146131ad565b835110156124735760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610802565b500160200151600160601b900490565b60006124908484846126d6565b9050600082806124a2576124a261326a565b848609111561124e5760001981106124b957600080fd5b6001019392505050565b60005b8151811015610415576125278282815181106124e4576124e461310f565b6020026020010151600001518383815181106125025761250261310f565b602002602001015160200151856001600160a01b03166115b89092919063ffffffff16565b8181815181106125395761253961310f565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106125955761259561310f565b6020026020010151602001516040516125b091815260200190565b60405180910390a4806125c281613181565b9150506124c6565b60015460ff16610bd45760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610802565b60015460ff1615610bd45760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610802565b6060600080856001600160a01b0316856040516126769190613280565b600060405180830381855af49150503d80600081146126b1576040519150601f19603f3d011682016040523d82523d6000602084013e6126b6565b606091505b5091509150611af986838387612925565b606061124b848460008561299e565b600083830281600019858709828110838203039150508084116126f857600080fd5b8060000361270b5750829004905061124e565b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b606061044b6001600160a01b03831660145b6060600061279983600261329c565b6127a49060026131ad565b6001600160401b038111156127bb576127bb612b66565b6040519080825280601f01601f1916602001820160405280156127e5576020820181803683370190505b509050600360fc1b816000815181106128005761280061310f565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061282f5761282f61310f565b60200101906001600160f81b031916908160001a905350600061285384600261329c565b61285e9060016131ad565b90505b60018111156128d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106128925761289261310f565b1a60f81b8282815181106128a8576128a861310f565b60200101906001600160f81b031916908160001a90535060049490941c936128cf816132b3565b9050612861565b50831561124e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610802565b6060831561299457825160000361298d576001600160a01b0385163b61298d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610802565b508161196c565b61196c8383612a6e565b6060824710156129ff5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610802565b600080866001600160a01b03168587604051612a1b9190613280565b60006040518083038185875af1925050503d8060008114612a58576040519150601f19603f3d011682016040523d82523d6000602084013e612a5d565b606091505b5091509150611aa087838387612925565b815115612a7e5781518083602001fd5b8060405162461bcd60e51b81526004016108029190613257565b6001600160a01b038116811461142557600080fd5b8035611e0281612a98565b60008060408385031215612acb57600080fd5b8235612ad681612a98565b91506020830135612ae681612a98565b809150509250929050565b600060208284031215612b0357600080fd5b81356001600160e01b03198116811461124e57600080fd5b60008083601f840112612b2d57600080fd5b5081356001600160401b03811115612b4457600080fd5b6020830191508360208260061b8501011115612b5f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715612b9e57612b9e612b66565b60405290565b604051608081016001600160401b0381118282101715612b9e57612b9e612b66565b604051601f8201601f191681016001600160401b0381118282101715612bee57612bee612b66565b604052919050565b600060e08284031215612c0857600080fd5b612c10612b7c565b90508135612c1d81612a98565b81526020820135612c2d81612a98565b6020820152604082013562ffffff81168114612c4857600080fd5b6040820152612c5960608301612aad565b60608201526080820135608082015260a082013560a0820152612c7e60c08301612aad565b60c082015292915050565b60008060006101008486031215612c9f57600080fd5b83356001600160401b03811115612cb557600080fd5b612cc186828701612b1b565b9094509250612cd590508560208601612bf6565b90509250925092565b600060208284031215612cf057600080fd5b5035919050565b60008060408385031215612d0a57600080fd5b823591506020830135612ae681612a98565b600060808284031215612d2e57600080fd5b612d36612ba4565b905081356001600160401b0380821115612d4f57600080fd5b818401915084601f830112612d6357600080fd5b8135602082821115612d7757612d77612b66565b612d89601f8301601f19168201612bc6565b92508183528681838601011115612d9f57600080fd5b81818501828501376000818385010152828552612dbd818701612aad565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215612df457600080fd5b83356001600160401b0380821115612e0b57600080fd5b612e1787838801612b1b565b90955093506020860135915080821115612e3057600080fd5b50612e3d86828701612d1c565b9150509250925092565b60008083601f840112612e5957600080fd5b5081356001600160401b03811115612e7057600080fd5b6020830191508360208260051b8501011115612b5f57600080fd5b600080600060408486031215612ea057600080fd5b8335925060208401356001600160401b03811115612ebd57600080fd5b612ec986828701612e47565b9497909650939450505050565b60005b83811015612ef1578181015183820152602001612ed9565b50506000910152565b60008151808452612f12816020860160208601612ed6565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612f7b57603f19888603018452612f69858351612efa565b94509285019290850190600101612f4d565b5092979650505050505050565b600060208284031215612f9a57600080fd5b813561124e81612a98565b60008060208385031215612fb857600080fd5b82356001600160401b03811115612fce57600080fd5b612fda85828601612e47565b90969095509350505050565b600060208284031215612ff857600080fd5b5051919050565b60006040828403121561301157600080fd5b604051604081018181106001600160401b038211171561303357613033612b66565b604052823561304181612a98565b81526020928301359281019290925250919050565b60e0810161044b828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b60008151608084526130ca6080850182612efa565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b60208152600061124e60208301846130b5565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261313c57600080fd5b8301803591506001600160401b0382111561315657600080fd5b602001915036819003821315612b5f57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016131935761319361316b565b5060010190565b8181038181111561044b5761044b61316b565b8082018082111561044b5761044b61316b565b6000602082840312156131d257600080fd5b8151801515811461124e57600080fd5b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161321a816017850160208801612ed6565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161324b816028840160208801612ed6565b01602801949350505050565b60208152600061124e6020830184612efa565b634e487b7160e01b600052601260045260246000fd5b60008251613292818460208701612ed6565b9190910192915050565b808202811582820484141761044b5761044b61316b565b6000816132c2576132c261316b565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220162c0f9d1b47c666f486fc65c7c7502bb0e7378e3166be6f93d98943154831c364736f6c63430008130033";
|
|
17836
|
+
const isSuperArgs$2 = (xs) => xs.length > 1;
|
|
17837
|
+
class ImmutableSwapProxy__factory extends ContractFactory {
|
|
18216
17838
|
constructor(...args) {
|
|
18217
|
-
if (isSuperArgs$
|
|
17839
|
+
if (isSuperArgs$2(args)) {
|
|
18218
17840
|
super(...args);
|
|
18219
17841
|
}
|
|
18220
17842
|
else {
|
|
18221
|
-
super(_abi$
|
|
17843
|
+
super(_abi$2, _bytecode$2, args[0]);
|
|
18222
17844
|
}
|
|
18223
17845
|
}
|
|
18224
17846
|
deploy(_admin, _uniRouter, _wimx, overrides) {
|
|
@@ -18233,10 +17855,138 @@ class SecondaryFee__factory extends ContractFactory {
|
|
|
18233
17855
|
connect(signer) {
|
|
18234
17856
|
return super.connect(signer);
|
|
18235
17857
|
}
|
|
17858
|
+
static bytecode = _bytecode$2;
|
|
17859
|
+
static abi = _abi$2;
|
|
17860
|
+
static createInterface() {
|
|
17861
|
+
return new utils$2.Interface(_abi$2);
|
|
17862
|
+
}
|
|
17863
|
+
static connect(address, signerOrProvider) {
|
|
17864
|
+
return new Contract$1(address, _abi$2, signerOrProvider);
|
|
17865
|
+
}
|
|
17866
|
+
}
|
|
17867
|
+
|
|
17868
|
+
/* Autogenerated file. Do not edit manually. */
|
|
17869
|
+
/* tslint:disable */
|
|
17870
|
+
/* eslint-disable */
|
|
17871
|
+
const _abi$1 = [
|
|
17872
|
+
{
|
|
17873
|
+
inputs: [],
|
|
17874
|
+
name: "getCurrentBlockTimestamp",
|
|
17875
|
+
outputs: [
|
|
17876
|
+
{
|
|
17877
|
+
internalType: "uint256",
|
|
17878
|
+
name: "timestamp",
|
|
17879
|
+
type: "uint256",
|
|
17880
|
+
},
|
|
17881
|
+
],
|
|
17882
|
+
stateMutability: "view",
|
|
17883
|
+
type: "function",
|
|
17884
|
+
},
|
|
17885
|
+
{
|
|
17886
|
+
inputs: [
|
|
17887
|
+
{
|
|
17888
|
+
internalType: "address",
|
|
17889
|
+
name: "addr",
|
|
17890
|
+
type: "address",
|
|
17891
|
+
},
|
|
17892
|
+
],
|
|
17893
|
+
name: "getEthBalance",
|
|
17894
|
+
outputs: [
|
|
17895
|
+
{
|
|
17896
|
+
internalType: "uint256",
|
|
17897
|
+
name: "balance",
|
|
17898
|
+
type: "uint256",
|
|
17899
|
+
},
|
|
17900
|
+
],
|
|
17901
|
+
stateMutability: "view",
|
|
17902
|
+
type: "function",
|
|
17903
|
+
},
|
|
17904
|
+
{
|
|
17905
|
+
inputs: [
|
|
17906
|
+
{
|
|
17907
|
+
components: [
|
|
17908
|
+
{
|
|
17909
|
+
internalType: "address",
|
|
17910
|
+
name: "target",
|
|
17911
|
+
type: "address",
|
|
17912
|
+
},
|
|
17913
|
+
{
|
|
17914
|
+
internalType: "uint256",
|
|
17915
|
+
name: "gasLimit",
|
|
17916
|
+
type: "uint256",
|
|
17917
|
+
},
|
|
17918
|
+
{
|
|
17919
|
+
internalType: "bytes",
|
|
17920
|
+
name: "callData",
|
|
17921
|
+
type: "bytes",
|
|
17922
|
+
},
|
|
17923
|
+
],
|
|
17924
|
+
internalType: "struct UniswapInterfaceMulticall.Call[]",
|
|
17925
|
+
name: "calls",
|
|
17926
|
+
type: "tuple[]",
|
|
17927
|
+
},
|
|
17928
|
+
],
|
|
17929
|
+
name: "multicall",
|
|
17930
|
+
outputs: [
|
|
17931
|
+
{
|
|
17932
|
+
internalType: "uint256",
|
|
17933
|
+
name: "blockNumber",
|
|
17934
|
+
type: "uint256",
|
|
17935
|
+
},
|
|
17936
|
+
{
|
|
17937
|
+
components: [
|
|
17938
|
+
{
|
|
17939
|
+
internalType: "bool",
|
|
17940
|
+
name: "success",
|
|
17941
|
+
type: "bool",
|
|
17942
|
+
},
|
|
17943
|
+
{
|
|
17944
|
+
internalType: "uint256",
|
|
17945
|
+
name: "gasUsed",
|
|
17946
|
+
type: "uint256",
|
|
17947
|
+
},
|
|
17948
|
+
{
|
|
17949
|
+
internalType: "bytes",
|
|
17950
|
+
name: "returnData",
|
|
17951
|
+
type: "bytes",
|
|
17952
|
+
},
|
|
17953
|
+
],
|
|
17954
|
+
internalType: "struct UniswapInterfaceMulticall.Result[]",
|
|
17955
|
+
name: "returnData",
|
|
17956
|
+
type: "tuple[]",
|
|
17957
|
+
},
|
|
17958
|
+
],
|
|
17959
|
+
stateMutability: "nonpayable",
|
|
17960
|
+
type: "function",
|
|
17961
|
+
},
|
|
17962
|
+
];
|
|
17963
|
+
const _bytecode$1 = "0x608060405234801561001057600080fd5b50610567806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630f28c97d146100465780631749e1e3146100645780634d2301cc14610085575b600080fd5b61004e610098565b60405161005b919061041f565b60405180910390f35b6100776100723660046102a7565b61009c565b60405161005b929190610428565b61004e610093366004610286565b610220565b4290565b8051439060609067ffffffffffffffff811180156100b957600080fd5b506040519080825280602002602001820160405280156100f357816020015b6100e061023a565b8152602001906001900390816100d85790505b50905060005b835181101561021a57600080600086848151811061011357fe5b60200260200101516000015187858151811061012b57fe5b60200260200101516020015188868151811061014357fe5b60200260200101516040015192509250925060005a90506000808573ffffffffffffffffffffffffffffffffffffffff1685856040516101839190610403565b60006040518083038160008787f1925050503d80600081146101c1576040519150601f19603f3d011682016040523d82523d6000602084013e6101c6565b606091505b509150915060005a8403905060405180606001604052808415158152602001828152602001838152508989815181106101fb57fe5b60200260200101819052505050505050505080806001019150506100f9565b50915091565b73ffffffffffffffffffffffffffffffffffffffff163190565b604051806060016040528060001515815260200160008152602001606081525090565b803573ffffffffffffffffffffffffffffffffffffffff8116811461028157600080fd5b919050565b600060208284031215610297578081fd5b6102a08261025d565b9392505050565b600060208083850312156102b9578182fd5b823567ffffffffffffffff808211156102d0578384fd5b818501915085601f8301126102e3578384fd5b8135818111156102ef57fe5b6102fc8485830201610506565b81815284810190848601875b848110156103f457813587017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0606081838f03011215610346578a8bfd5b60408051606081018181108b8211171561035c57fe5b8252610369848d0161025d565b8152818401358c82015260608401358a811115610384578d8efd5b8085019450508e603f850112610398578c8dfd5b8b8401358a8111156103a657fe5b6103b68d85601f84011601610506565b93508084528f838287010111156103cb578d8efd5b808386018e86013783018c018d9052908101919091528552509287019290870190600101610308565b50909998505050505050505050565b6000825161041581846020870161052a565b9190910192915050565b90815260200190565b600060408083018584526020828186015281865180845260609350838701915083838202880101838901875b838110156104f6578983037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa001855281518051151584528681015187850152880151888401889052805188850181905260806104b582828801858c0161052a565b96880196601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01694909401909301925090850190600101610454565b50909a9950505050505050505050565b60405181810167ffffffffffffffff8111828210171561052257fe5b604052919050565b60005b8381101561054557818101518382015260200161052d565b83811115610554576000848401525b5050505056fea164736f6c6343000706000a";
|
|
17964
|
+
const isSuperArgs$1 = (xs) => xs.length > 1;
|
|
17965
|
+
class Multicall__factory extends ContractFactory {
|
|
17966
|
+
constructor(...args) {
|
|
17967
|
+
if (isSuperArgs$1(args)) {
|
|
17968
|
+
super(...args);
|
|
17969
|
+
}
|
|
17970
|
+
else {
|
|
17971
|
+
super(_abi$1, _bytecode$1, args[0]);
|
|
17972
|
+
}
|
|
17973
|
+
}
|
|
17974
|
+
deploy(overrides) {
|
|
17975
|
+
return super.deploy(overrides || {});
|
|
17976
|
+
}
|
|
17977
|
+
getDeployTransaction(overrides) {
|
|
17978
|
+
return super.getDeployTransaction(overrides || {});
|
|
17979
|
+
}
|
|
17980
|
+
attach(address) {
|
|
17981
|
+
return super.attach(address);
|
|
17982
|
+
}
|
|
17983
|
+
connect(signer) {
|
|
17984
|
+
return super.connect(signer);
|
|
17985
|
+
}
|
|
18236
17986
|
static bytecode = _bytecode$1;
|
|
18237
17987
|
static abi = _abi$1;
|
|
18238
17988
|
static createInterface() {
|
|
18239
|
-
return new utils$
|
|
17989
|
+
return new utils$2.Interface(_abi$1);
|
|
18240
17990
|
}
|
|
18241
17991
|
static connect(address, signerOrProvider) {
|
|
18242
17992
|
return new Contract$1(address, _abi$1, signerOrProvider);
|
|
@@ -19260,7 +19010,7 @@ class UniswapV3Pool__factory extends ContractFactory {
|
|
|
19260
19010
|
static bytecode = _bytecode;
|
|
19261
19011
|
static abi = _abi;
|
|
19262
19012
|
static createInterface() {
|
|
19263
|
-
return new utils$
|
|
19013
|
+
return new utils$2.Interface(_abi);
|
|
19264
19014
|
}
|
|
19265
19015
|
static connect(address, signerOrProvider) {
|
|
19266
19016
|
return new Contract$1(address, _abi, signerOrProvider);
|
|
@@ -19467,7 +19217,7 @@ async function getQuotesForRoutes(provider, quoterContractAddress, routes, amoun
|
|
|
19467
19217
|
return quoteResults;
|
|
19468
19218
|
}
|
|
19469
19219
|
try {
|
|
19470
|
-
const decodedQuoteResult = utils$
|
|
19220
|
+
const decodedQuoteResult = utils$2.defaultAbiCoder.decode(returnTypes, promiseResult.value);
|
|
19471
19221
|
if (decodedQuoteResult) {
|
|
19472
19222
|
// The 0th element in each decoded data is going to be the amountOut or amountIn.
|
|
19473
19223
|
const quoteAmount = decodedQuoteResult[amountIndex];
|
|
@@ -20051,14 +19801,14 @@ function buildSinglePoolSwap(tokenIn, tokenOut, recipient, trade, route, amountI
|
|
|
20051
19801
|
}
|
|
20052
19802
|
return calldatas;
|
|
20053
19803
|
}
|
|
20054
|
-
function buildSinglePoolSwapWithFees(recipient, trade, route, amountIn, amountOut, secondaryFees,
|
|
19804
|
+
function buildSinglePoolSwapWithFees(recipient, trade, route, amountIn, amountOut, secondaryFees, swapProxyContract, tokenOut) {
|
|
20055
19805
|
const secondaryFeeValues = secondaryFees.map((fee) => ({
|
|
20056
19806
|
feeBasisPoints: fee.basisPoints,
|
|
20057
19807
|
recipient: fee.recipient,
|
|
20058
19808
|
}));
|
|
20059
19809
|
const calldatas = [];
|
|
20060
19810
|
if (trade.tradeType === Uniswap.TradeType.EXACT_INPUT) {
|
|
20061
|
-
calldatas.push(
|
|
19811
|
+
calldatas.push(swapProxyContract.encodeFunctionData('exactInputSingleWithSecondaryFee', [
|
|
20062
19812
|
secondaryFeeValues,
|
|
20063
19813
|
{
|
|
20064
19814
|
tokenIn: route.tokenPath[0].address,
|
|
@@ -20072,7 +19822,7 @@ function buildSinglePoolSwapWithFees(recipient, trade, route, amountIn, amountOu
|
|
|
20072
19822
|
]));
|
|
20073
19823
|
}
|
|
20074
19824
|
if (trade.tradeType === Uniswap.TradeType.EXACT_OUTPUT) {
|
|
20075
|
-
calldatas.push(
|
|
19825
|
+
calldatas.push(swapProxyContract.encodeFunctionData('exactOutputSingleWithSecondaryFee', [
|
|
20076
19826
|
secondaryFeeValues,
|
|
20077
19827
|
{
|
|
20078
19828
|
tokenIn: route.tokenPath[0].address,
|
|
@@ -20088,7 +19838,7 @@ function buildSinglePoolSwapWithFees(recipient, trade, route, amountIn, amountOu
|
|
|
20088
19838
|
const shouldUnwrapTokens = isNative(tokenOut);
|
|
20089
19839
|
if (shouldUnwrapTokens) {
|
|
20090
19840
|
// Unwrap the output token if the user specified a native token as the output
|
|
20091
|
-
calldatas.push(
|
|
19841
|
+
calldatas.push(swapProxyContract.encodeFunctionData('unwrapNativeToken', [amountOut]));
|
|
20092
19842
|
}
|
|
20093
19843
|
return calldatas;
|
|
20094
19844
|
}
|
|
@@ -20130,7 +19880,7 @@ function buildMultiPoolSwap(tokenIn, tokenOut, recipient, trade, route, amountIn
|
|
|
20130
19880
|
}
|
|
20131
19881
|
return calldatas;
|
|
20132
19882
|
}
|
|
20133
|
-
function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut, secondaryFees,
|
|
19883
|
+
function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut, secondaryFees, swapProxyContract, tokenOut) {
|
|
20134
19884
|
const path = encodeRouteToPath(route, trade.tradeType === Uniswap.TradeType.EXACT_OUTPUT);
|
|
20135
19885
|
const secondaryFeeValues = secondaryFees.map((fee) => ({
|
|
20136
19886
|
feeBasisPoints: fee.basisPoints,
|
|
@@ -20138,7 +19888,7 @@ function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut
|
|
|
20138
19888
|
}));
|
|
20139
19889
|
const calldatas = [];
|
|
20140
19890
|
if (trade.tradeType === Uniswap.TradeType.EXACT_INPUT) {
|
|
20141
|
-
calldatas.push(
|
|
19891
|
+
calldatas.push(swapProxyContract.encodeFunctionData('exactInputWithSecondaryFee', [
|
|
20142
19892
|
secondaryFeeValues,
|
|
20143
19893
|
{
|
|
20144
19894
|
path,
|
|
@@ -20149,7 +19899,7 @@ function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut
|
|
|
20149
19899
|
]));
|
|
20150
19900
|
}
|
|
20151
19901
|
if (trade.tradeType === Uniswap.TradeType.EXACT_OUTPUT) {
|
|
20152
|
-
calldatas.push(
|
|
19902
|
+
calldatas.push(swapProxyContract.encodeFunctionData('exactOutputWithSecondaryFee', [
|
|
20153
19903
|
secondaryFeeValues,
|
|
20154
19904
|
{
|
|
20155
19905
|
path,
|
|
@@ -20162,7 +19912,7 @@ function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut
|
|
|
20162
19912
|
const shouldUnwrapTokens = isNative(tokenOut);
|
|
20163
19913
|
if (shouldUnwrapTokens) {
|
|
20164
19914
|
// Unwrap the output token if the user specified a native token as the output
|
|
20165
|
-
calldatas.push(
|
|
19915
|
+
calldatas.push(swapProxyContract.encodeFunctionData('unwrapNativeToken', [amountOut]));
|
|
20166
19916
|
}
|
|
20167
19917
|
return calldatas;
|
|
20168
19918
|
}
|
|
@@ -20173,14 +19923,14 @@ function buildMultiPoolSwapWithFees(recipient, trade, route, amountIn, amountOut
|
|
|
20173
19923
|
* @param fromAddress The address of the user
|
|
20174
19924
|
* @param trade The trade to be executed
|
|
20175
19925
|
* @param secondaryFees Secondary fees to be applied to the swap
|
|
20176
|
-
* @param
|
|
19926
|
+
* @param swapProxyContract The SecondaryFee contract interface
|
|
20177
19927
|
* @param routerContract The SwapRouter02 contract interface
|
|
20178
19928
|
* @param paymentsContract The PaymentsExtended contract interface
|
|
20179
19929
|
* @param maximumAmountIn The maximum amount of tokenIn to be swapped
|
|
20180
19930
|
* @param minimumAmountOut The minimum amount of tokenOut to be received
|
|
20181
19931
|
* @returns calldatas that make up the swap transaction
|
|
20182
19932
|
*/
|
|
20183
|
-
function buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees,
|
|
19933
|
+
function buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees, swapProxyContract, routerContract, paymentsContract, maximumAmountIn, minimumAmountOut) {
|
|
20184
19934
|
// @dev we don't support multiple swaps in a single transaction
|
|
20185
19935
|
// there will always be only one swap in the trade regardless of the trade type
|
|
20186
19936
|
const { route } = trade.swaps[0];
|
|
@@ -20188,22 +19938,22 @@ function buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees,
|
|
|
20188
19938
|
const hasSecondaryFees = secondaryFees.length > 0;
|
|
20189
19939
|
if (isSinglePoolSwap) {
|
|
20190
19940
|
if (hasSecondaryFees) {
|
|
20191
|
-
return buildSinglePoolSwapWithFees(recipient, trade, route, maximumAmountIn, minimumAmountOut, secondaryFees,
|
|
19941
|
+
return buildSinglePoolSwapWithFees(recipient, trade, route, maximumAmountIn, minimumAmountOut, secondaryFees, swapProxyContract, tokenOut);
|
|
20192
19942
|
}
|
|
20193
19943
|
return buildSinglePoolSwap(tokenIn, tokenOut, recipient, trade, route, maximumAmountIn, minimumAmountOut, routerContract, paymentsContract);
|
|
20194
19944
|
}
|
|
20195
19945
|
if (hasSecondaryFees) {
|
|
20196
|
-
return buildMultiPoolSwapWithFees(recipient, trade, route, maximumAmountIn, minimumAmountOut, secondaryFees,
|
|
19946
|
+
return buildMultiPoolSwapWithFees(recipient, trade, route, maximumAmountIn, minimumAmountOut, secondaryFees, swapProxyContract, tokenOut);
|
|
20197
19947
|
}
|
|
20198
19948
|
return buildMultiPoolSwap(tokenIn, tokenOut, recipient, trade, route, maximumAmountIn, minimumAmountOut, routerContract, paymentsContract);
|
|
20199
19949
|
}
|
|
20200
19950
|
function createSwapCallParameters(tokenIn, tokenOut, trade, recipient, swapOptions, secondaryFees, maximumAmountIn, minimumAmountOut) {
|
|
20201
|
-
const
|
|
19951
|
+
const swapProxyContract = ImmutableSwapProxy__factory.createInterface();
|
|
20202
19952
|
const routerContract = SwapRouter.INTERFACE;
|
|
20203
19953
|
const paymentsContract = PaymentsExtended.INTERFACE;
|
|
20204
|
-
const calldatas = buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees,
|
|
19954
|
+
const calldatas = buildSwapParameters(tokenIn, tokenOut, recipient, trade, secondaryFees, swapProxyContract, routerContract, paymentsContract, maximumAmountIn, minimumAmountOut);
|
|
20205
19955
|
// Create the multicall transaction using the calldatas generated above
|
|
20206
|
-
return
|
|
19956
|
+
return swapProxyContract.encodeFunctionData(multicallWithDeadlineFunctionSignature, [
|
|
20207
19957
|
swapOptions.deadlineOrPreviousBlockhash,
|
|
20208
19958
|
calldatas,
|
|
20209
19959
|
]);
|
|
@@ -20297,7 +20047,7 @@ const CONTRACTS_FOR_CHAIN_ID = {
|
|
|
20297
20047
|
coreFactory: '0xb18c44b211065E69844FbA9AE146DA362104AfBf',
|
|
20298
20048
|
quoterV2: '0x87854A7D4b9BaC3D37f4516A1Ac7F36fB5ad539f',
|
|
20299
20049
|
peripheryRouter: '0x786ec643F231960D4C1A4E336990F8E7bF8f1277',
|
|
20300
|
-
|
|
20050
|
+
immutableSwapProxy: '0xDdBDa144cEbe1cCd68E746CDff8a6e4Be51A9e98',
|
|
20301
20051
|
},
|
|
20302
20052
|
};
|
|
20303
20053
|
const SUPPORTED_SANDBOX_CHAINS = {
|
|
@@ -20396,7 +20146,7 @@ class Exchange {
|
|
|
20396
20146
|
wrappedNativeToken;
|
|
20397
20147
|
secondaryFees;
|
|
20398
20148
|
nativeTokenService;
|
|
20399
|
-
|
|
20149
|
+
swapProxyContractAddress;
|
|
20400
20150
|
routerContractAddress;
|
|
20401
20151
|
constructor(configuration) {
|
|
20402
20152
|
const config = new ExchangeConfiguration(configuration);
|
|
@@ -20406,7 +20156,7 @@ class Exchange {
|
|
|
20406
20156
|
this.nativeTokenService = new NativeTokenService(this.nativeToken, this.wrappedNativeToken);
|
|
20407
20157
|
this.secondaryFees = config.secondaryFees;
|
|
20408
20158
|
this.routerContractAddress = config.chain.contracts.peripheryRouter;
|
|
20409
|
-
this.
|
|
20159
|
+
this.swapProxyContractAddress = config.chain.contracts.immutableSwapProxy;
|
|
20410
20160
|
this.provider = new ethers.providers.StaticJsonRpcProvider({
|
|
20411
20161
|
url: config.chain.rpcUrl,
|
|
20412
20162
|
skipFetchSetup: true,
|
|
@@ -20432,8 +20182,8 @@ class Exchange {
|
|
|
20432
20182
|
if (this.secondaryFees.length === 0) {
|
|
20433
20183
|
return [];
|
|
20434
20184
|
}
|
|
20435
|
-
const
|
|
20436
|
-
if (await
|
|
20185
|
+
const swapProxyContract = ImmutableSwapProxy__factory.connect(this.swapProxyContractAddress, provider);
|
|
20186
|
+
if (await swapProxyContract.paused()) {
|
|
20437
20187
|
// Do not use secondary fees if the contract is paused
|
|
20438
20188
|
return [];
|
|
20439
20189
|
}
|
|
@@ -20470,11 +20220,11 @@ class Exchange {
|
|
|
20470
20220
|
// Quotes will always use ERC20s. If the user-specified token is Native, we use the Wrapped Native Token pool
|
|
20471
20221
|
const ourQuote = await this.router.findOptimalRoute(ourQuoteReqAmount, this.nativeTokenService.maybeWrapToken(otherToken), tradeType, maxHops);
|
|
20472
20222
|
const adjustedQuote = adjustQuoteWithFees(ourQuote, amountSpecified, fees, this.nativeTokenService);
|
|
20473
|
-
const swap = getSwap(tokenIn, tokenOut, adjustedQuote, fromAddress, slippagePercent, deadline, this.routerContractAddress, this.
|
|
20223
|
+
const swap = getSwap(tokenIn, tokenOut, adjustedQuote, fromAddress, slippagePercent, deadline, this.routerContractAddress, this.swapProxyContractAddress, gasPrice, secondaryFees);
|
|
20474
20224
|
const { quotedAmount, quotedAmountWithMaxSlippage } = prepareUserQuote(this.nativeTokenService, adjustedQuote, slippagePercent, otherToken);
|
|
20475
20225
|
const preparedApproval = prepareApproval(tradeType, amountSpecified, quotedAmountWithMaxSlippage, {
|
|
20476
20226
|
routerAddress: this.routerContractAddress,
|
|
20477
|
-
secondaryFeeAddress: this.
|
|
20227
|
+
secondaryFeeAddress: this.swapProxyContractAddress,
|
|
20478
20228
|
}, secondaryFees);
|
|
20479
20229
|
// preparedApproval always uses the tokenIn address because we are always selling the tokenIn
|
|
20480
20230
|
const approval = preparedApproval
|
|
@@ -26051,7 +25801,7 @@ class APIError extends Error {
|
|
|
26051
25801
|
|
|
26052
25802
|
/* eslint-disable implicit-arrow-linebreak */
|
|
26053
25803
|
const defaultHeaders = {
|
|
26054
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.
|
|
25804
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.1-alpha.1',
|
|
26055
25805
|
};
|
|
26056
25806
|
/**
|
|
26057
25807
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -27400,7 +27150,7 @@ const GAS_OVERRIDES = {
|
|
|
27400
27150
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
27401
27151
|
};
|
|
27402
27152
|
|
|
27403
|
-
const SDK_VERSION_MARKER = '0.39.
|
|
27153
|
+
const SDK_VERSION_MARKER = '0.39.1-alpha.1';
|
|
27404
27154
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
27405
27155
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
27406
27156
|
|
|
@@ -27538,6 +27288,8 @@ class CheckoutConfiguration {
|
|
|
27538
27288
|
const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId, exclude, }) => {
|
|
27539
27289
|
let tokens = [];
|
|
27540
27290
|
let onRampConfig;
|
|
27291
|
+
let onBridgeConfig;
|
|
27292
|
+
const targetChainId = chainId ?? getL1ChainId(config);
|
|
27541
27293
|
switch (type) {
|
|
27542
27294
|
case TokenFilterTypes.SWAP:
|
|
27543
27295
|
// Fetch tokens from dex-tokens config because
|
|
@@ -27548,16 +27300,19 @@ const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId,
|
|
|
27548
27300
|
break;
|
|
27549
27301
|
case TokenFilterTypes.ONRAMP:
|
|
27550
27302
|
onRampConfig = (await config.remote.getConfig('onramp'));
|
|
27551
|
-
|
|
27552
|
-
if (!onRampConfig) {
|
|
27303
|
+
if (!onRampConfig)
|
|
27553
27304
|
tokens = [];
|
|
27554
|
-
}
|
|
27555
27305
|
tokens = onRampConfig[OnRampProvider.TRANSAK]?.tokens || [];
|
|
27556
27306
|
break;
|
|
27557
27307
|
case TokenFilterTypes.BRIDGE:
|
|
27308
|
+
onBridgeConfig = (await config.remote.getConfig('bridge'));
|
|
27309
|
+
if (!onBridgeConfig)
|
|
27310
|
+
tokens = [];
|
|
27311
|
+
tokens = onBridgeConfig[targetChainId]?.tokens || [];
|
|
27312
|
+
break;
|
|
27558
27313
|
case TokenFilterTypes.ALL:
|
|
27559
27314
|
default:
|
|
27560
|
-
tokens = (await config.remote.getTokensConfig(
|
|
27315
|
+
tokens = (await config.remote.getTokensConfig(targetChainId)).allowed;
|
|
27561
27316
|
}
|
|
27562
27317
|
if (!exclude || exclude?.length === 0)
|
|
27563
27318
|
return { tokens };
|
|
@@ -27744,7 +27499,7 @@ const getBalance = async (config, web3Provider, walletAddress) => await withChec
|
|
|
27744
27499
|
const balance = await web3Provider.getBalance(walletAddress);
|
|
27745
27500
|
return {
|
|
27746
27501
|
balance,
|
|
27747
|
-
formattedBalance: utils$
|
|
27502
|
+
formattedBalance: utils$2.formatUnits(balance, networkInfo.nativeCurrency.decimals),
|
|
27748
27503
|
token: networkInfo.nativeCurrency,
|
|
27749
27504
|
};
|
|
27750
27505
|
}, { type: CheckoutErrorType.GET_BALANCE_ERROR });
|
|
@@ -27756,7 +27511,7 @@ async function getERC20Balance(web3Provider, walletAddress, tokenAddress) {
|
|
|
27756
27511
|
contract.balanceOf(walletAddress),
|
|
27757
27512
|
])
|
|
27758
27513
|
.then(([tokenInfo, balance]) => {
|
|
27759
|
-
const formattedBalance = utils$
|
|
27514
|
+
const formattedBalance = utils$2.formatUnits(balance, tokenInfo.decimals);
|
|
27760
27515
|
return {
|
|
27761
27516
|
balance,
|
|
27762
27517
|
formattedBalance,
|
|
@@ -27855,7 +27610,7 @@ const getIndexerBalance = async (config, walletAddress, chainId, filterTokens) =
|
|
|
27855
27610
|
...tokenData,
|
|
27856
27611
|
decimals,
|
|
27857
27612
|
};
|
|
27858
|
-
const formattedBalance = utils$
|
|
27613
|
+
const formattedBalance = utils$2.formatUnits(item.value, token.decimals);
|
|
27859
27614
|
balances.push({ balance, formattedBalance, token });
|
|
27860
27615
|
});
|
|
27861
27616
|
return { balances };
|
|
@@ -28205,7 +27960,7 @@ async function swapGasEstimator(config) {
|
|
|
28205
27960
|
try {
|
|
28206
27961
|
const exchange = await createExchangeInstance(chainId, config);
|
|
28207
27962
|
// Create a fake transaction to get the gas from the quote
|
|
28208
|
-
const { swap } = await exchange.getUnsignedSwapTxFromAmountIn(DUMMY_WALLET_ADDRESS, inAddress, outAddress, BigNumber$1.from(utils$
|
|
27963
|
+
const { swap } = await exchange.getUnsignedSwapTxFromAmountIn(DUMMY_WALLET_ADDRESS, inAddress, outAddress, BigNumber$1.from(utils$2.parseUnits('1', DEFAULT_TOKEN_DECIMALS)));
|
|
28209
27964
|
if (!swap.gasFeeEstimate) {
|
|
28210
27965
|
return {
|
|
28211
27966
|
gasEstimateType: GasEstimateType.SWAP,
|
|
@@ -28724,7 +28479,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
28724
28479
|
type: ItemType.NATIVE,
|
|
28725
28480
|
delta: {
|
|
28726
28481
|
balance: delta,
|
|
28727
|
-
formattedBalance: utils$
|
|
28482
|
+
formattedBalance: utils$2.formatUnits(delta, decimals),
|
|
28728
28483
|
},
|
|
28729
28484
|
current: {
|
|
28730
28485
|
...tokenBalanceResult,
|
|
@@ -28734,7 +28489,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
28734
28489
|
...tokenBalanceResult,
|
|
28735
28490
|
type: ItemType.NATIVE,
|
|
28736
28491
|
balance: BigNumber$1.from(itemRequirement.amount),
|
|
28737
|
-
formattedBalance: utils$
|
|
28492
|
+
formattedBalance: utils$2.formatUnits(itemRequirement.amount, decimals),
|
|
28738
28493
|
},
|
|
28739
28494
|
};
|
|
28740
28495
|
}
|
|
@@ -28757,13 +28512,13 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
28757
28512
|
type: ItemType.ERC20,
|
|
28758
28513
|
delta: {
|
|
28759
28514
|
balance: delta,
|
|
28760
|
-
formattedBalance: utils$
|
|
28515
|
+
formattedBalance: utils$2.formatUnits(delta, decimals),
|
|
28761
28516
|
},
|
|
28762
28517
|
current: tokenBalanceResult,
|
|
28763
28518
|
required: {
|
|
28764
28519
|
...tokenBalanceResult,
|
|
28765
28520
|
balance: BigNumber$1.from(itemRequirement.amount),
|
|
28766
|
-
formattedBalance: utils$
|
|
28521
|
+
formattedBalance: utils$2.formatUnits(itemRequirement.amount, decimals),
|
|
28767
28522
|
},
|
|
28768
28523
|
};
|
|
28769
28524
|
};
|
|
@@ -29135,7 +28890,7 @@ const constructFees$1 = (approvalGasFee, swapGasFee, swapFees) => {
|
|
|
29135
28890
|
let approvalToken;
|
|
29136
28891
|
if (approvalGasFee) {
|
|
29137
28892
|
approvalGasFeeAmount = approvalGasFee.value;
|
|
29138
|
-
approvalGasFeeFormatted = utils$
|
|
28893
|
+
approvalGasFeeFormatted = utils$2.formatUnits(approvalGasFee.value, approvalGasFee.token.decimals);
|
|
29139
28894
|
approvalToken = {
|
|
29140
28895
|
name: approvalGasFee.token.name ?? '',
|
|
29141
28896
|
symbol: approvalGasFee.token.symbol ?? '',
|
|
@@ -29148,7 +28903,7 @@ const constructFees$1 = (approvalGasFee, swapGasFee, swapFees) => {
|
|
|
29148
28903
|
let swapGasToken;
|
|
29149
28904
|
if (swapGasFee) {
|
|
29150
28905
|
swapGasFeeAmount = swapGasFee.value;
|
|
29151
|
-
swapGasFeeFormatted = utils$
|
|
28906
|
+
swapGasFeeFormatted = utils$2.formatUnits(swapGasFee.value, swapGasFee.token.decimals);
|
|
29152
28907
|
swapGasToken = {
|
|
29153
28908
|
name: swapGasFee.token.name ?? '',
|
|
29154
28909
|
symbol: swapGasFee.token.symbol ?? '',
|
|
@@ -29161,7 +28916,7 @@ const constructFees$1 = (approvalGasFee, swapGasFee, swapFees) => {
|
|
|
29161
28916
|
fees.push({
|
|
29162
28917
|
type: FeeType.SWAP_FEE,
|
|
29163
28918
|
amount: swapFee.amount.value,
|
|
29164
|
-
formattedAmount: utils$
|
|
28919
|
+
formattedAmount: utils$2.formatUnits(swapFee.amount.value, swapFee.amount.token.decimals),
|
|
29165
28920
|
token: {
|
|
29166
28921
|
name: swapFee.amount.token.name ?? '',
|
|
29167
28922
|
symbol: swapFee.amount.token.symbol ?? '',
|
|
@@ -29199,7 +28954,7 @@ const constructSwapRoute = (chainId, fundsRequired, userBalance, fees) => {
|
|
|
29199
28954
|
type,
|
|
29200
28955
|
fundsRequired: {
|
|
29201
28956
|
amount: fundsRequired,
|
|
29202
|
-
formattedAmount: utils$
|
|
28957
|
+
formattedAmount: utils$2.formatUnits(fundsRequired, userBalance.token.decimals),
|
|
29203
28958
|
},
|
|
29204
28959
|
userBalance: {
|
|
29205
28960
|
balance: userBalance.balance,
|
|
@@ -29415,28 +29170,23 @@ const filterTokens = (allowedTokens, balances) => {
|
|
|
29415
29170
|
};
|
|
29416
29171
|
const allowListCheckForOnRamp = async (config, availableRoutingOptions) => {
|
|
29417
29172
|
if (availableRoutingOptions.onRamp) {
|
|
29418
|
-
const onRampOptions = await config.
|
|
29419
|
-
|
|
29420
|
-
Object.entries(onRampOptions)
|
|
29421
|
-
.forEach(([onRampProvider, onRampProviderConfig]) => {
|
|
29422
|
-
// Allowed list per onRamp provider
|
|
29423
|
-
onRampAllowList[onRampProvider] = onRampProviderConfig.tokens ?? [];
|
|
29424
|
-
});
|
|
29425
|
-
return onRampAllowList;
|
|
29173
|
+
const onRampOptions = (await getTokenAllowList(config, { type: TokenFilterTypes.ONRAMP }));
|
|
29174
|
+
return onRampOptions.tokens;
|
|
29426
29175
|
}
|
|
29427
|
-
return
|
|
29176
|
+
return [];
|
|
29428
29177
|
};
|
|
29429
29178
|
const allowListCheckForBridge = async (config, tokenBalances, availableRoutingOptions) => {
|
|
29430
29179
|
if (availableRoutingOptions.bridge) {
|
|
29431
|
-
const
|
|
29432
|
-
const
|
|
29180
|
+
const chainId = getL1ChainId(config);
|
|
29181
|
+
const allowedTokens = (await getTokenAllowList(config, { type: TokenFilterTypes.BRIDGE, chainId })).tokens;
|
|
29182
|
+
const balances = tokenBalances.get(chainId);
|
|
29433
29183
|
return filterTokens(allowedTokens, balances);
|
|
29434
29184
|
}
|
|
29435
29185
|
return [];
|
|
29436
29186
|
};
|
|
29437
29187
|
const allowListCheckForSwap = async (config, tokenBalances, availableRoutingOptions) => {
|
|
29438
29188
|
if (availableRoutingOptions.swap) {
|
|
29439
|
-
const allowedTokens = (await config.
|
|
29189
|
+
const allowedTokens = (await getTokenAllowList(config, { type: TokenFilterTypes.SWAP })).tokens;
|
|
29440
29190
|
const balances = tokenBalances.get(getL2ChainId(config));
|
|
29441
29191
|
return filterTokens(allowedTokens, balances);
|
|
29442
29192
|
}
|
|
@@ -29538,7 +29288,7 @@ const constructFees = (bridgeGasFee, bridgeFee, imtblFee, approvalGasFee, token)
|
|
|
29538
29288
|
bridgeFees.push({
|
|
29539
29289
|
type: FeeType.BRIDGE_FEE,
|
|
29540
29290
|
amount: bridgeFee,
|
|
29541
|
-
formattedAmount: utils$
|
|
29291
|
+
formattedAmount: utils$2.formatUnits(bridgeFee, bridgeFeeDecimals),
|
|
29542
29292
|
token,
|
|
29543
29293
|
});
|
|
29544
29294
|
}
|
|
@@ -29546,7 +29296,7 @@ const constructFees = (bridgeGasFee, bridgeFee, imtblFee, approvalGasFee, token)
|
|
|
29546
29296
|
bridgeFees.push({
|
|
29547
29297
|
type: FeeType.IMMUTABLE_FEE,
|
|
29548
29298
|
amount: imtblFee,
|
|
29549
|
-
formattedAmount: utils$
|
|
29299
|
+
formattedAmount: utils$2.formatUnits(imtblFee, bridgeFeeDecimals),
|
|
29550
29300
|
token,
|
|
29551
29301
|
});
|
|
29552
29302
|
}
|
|
@@ -29554,13 +29304,13 @@ const constructFees = (bridgeGasFee, bridgeFee, imtblFee, approvalGasFee, token)
|
|
|
29554
29304
|
approvalGasFee: {
|
|
29555
29305
|
type: FeeType.GAS,
|
|
29556
29306
|
amount: approvalGasFee,
|
|
29557
|
-
formattedAmount: utils$
|
|
29307
|
+
formattedAmount: utils$2.formatUnits(approvalGasFee, DEFAULT_TOKEN_DECIMALS$1),
|
|
29558
29308
|
token,
|
|
29559
29309
|
},
|
|
29560
29310
|
bridgeGasFee: {
|
|
29561
29311
|
type: FeeType.GAS,
|
|
29562
29312
|
amount: bridgeGasFee,
|
|
29563
|
-
formattedAmount: utils$
|
|
29313
|
+
formattedAmount: utils$2.formatUnits(bridgeGasFee, DEFAULT_TOKEN_DECIMALS$1),
|
|
29564
29314
|
token,
|
|
29565
29315
|
},
|
|
29566
29316
|
bridgeFees,
|
|
@@ -29765,7 +29515,7 @@ const constructBridgeRequirements = (dexQuotes, l1balances, l2balances, l1tol2ad
|
|
|
29765
29515
|
}
|
|
29766
29516
|
bridgeRequirements.push({
|
|
29767
29517
|
amount: amountToBridge,
|
|
29768
|
-
formattedAmount: utils$
|
|
29518
|
+
formattedAmount: utils$2.formatUnits(amountToBridge, l1balance.token.decimals),
|
|
29769
29519
|
// L2 address is used for the bridge requirement as the bridge route uses the indexer to find L1 address
|
|
29770
29520
|
l2address,
|
|
29771
29521
|
});
|
|
@@ -29863,7 +29613,7 @@ const modifyTokenBalancesWithBridgedAmount = (config, tokenBalances, l2balances,
|
|
|
29863
29613
|
const tokenInfo = swappableTokens.find((token) => token.address === l2address);
|
|
29864
29614
|
balanceMap.set(l2address, {
|
|
29865
29615
|
balance: newBalance,
|
|
29866
|
-
formattedBalance: utils$
|
|
29616
|
+
formattedBalance: utils$2.formatUnits(newBalance, tokenInfo.decimals),
|
|
29867
29617
|
token: tokenInfo,
|
|
29868
29618
|
});
|
|
29869
29619
|
}
|
|
@@ -29994,10 +29744,10 @@ const onRampRoute = async (config, availableRoutingOptions, balanceRequirement)
|
|
|
29994
29744
|
return undefined;
|
|
29995
29745
|
const { required, current, delta } = balanceRequirement;
|
|
29996
29746
|
let hasAllowList = false;
|
|
29997
|
-
const
|
|
29998
|
-
|
|
29999
|
-
if (
|
|
30000
|
-
hasAllowList =
|
|
29747
|
+
const onRampAllowList = await allowListCheckForOnRamp(config, availableRoutingOptions);
|
|
29748
|
+
onRampAllowList.forEach((token) => {
|
|
29749
|
+
if (token.address === required.token?.address) {
|
|
29750
|
+
hasAllowList = true;
|
|
30001
29751
|
}
|
|
30002
29752
|
});
|
|
30003
29753
|
if (!hasAllowList)
|
|
@@ -30385,7 +30135,7 @@ const calculateFeesPercent = (orderFee, amountBn) => {
|
|
|
30385
30135
|
};
|
|
30386
30136
|
const calculateFeesToken = (orderFee, decimals) => {
|
|
30387
30137
|
const feeToken = orderFee.amount;
|
|
30388
|
-
const bnFeeAmount = utils$
|
|
30138
|
+
const bnFeeAmount = utils$2.parseUnits(feeToken.token, decimals);
|
|
30389
30139
|
return bnFeeAmount;
|
|
30390
30140
|
};
|
|
30391
30141
|
const calculateFees = (orderFees, weiAmount, decimals = 18) => {
|
|
@@ -30641,7 +30391,7 @@ const getERC721Requirement = (id, contractAddress, spenderAddress) => ({
|
|
|
30641
30391
|
spenderAddress,
|
|
30642
30392
|
});
|
|
30643
30393
|
const getBuyToken = (buyToken, decimals = 18) => {
|
|
30644
|
-
const bnAmount = utils$
|
|
30394
|
+
const bnAmount = utils$2.parseUnits(buyToken.amount, decimals);
|
|
30645
30395
|
if (buyToken.type === ItemType.NATIVE) {
|
|
30646
30396
|
return {
|
|
30647
30397
|
type: ItemType.NATIVE,
|
|
@@ -30827,13 +30577,13 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
30827
30577
|
if (itemRequirementParam.type === ItemType.NATIVE) {
|
|
30828
30578
|
return {
|
|
30829
30579
|
...itemRequirementParam,
|
|
30830
|
-
amount: utils$
|
|
30580
|
+
amount: utils$2.parseUnits(itemRequirementParam.amount, 18),
|
|
30831
30581
|
};
|
|
30832
30582
|
}
|
|
30833
30583
|
if (itemRequirementParam.type === ItemType.ERC20) {
|
|
30834
30584
|
return {
|
|
30835
30585
|
...itemRequirementParam,
|
|
30836
|
-
amount: utils$
|
|
30586
|
+
amount: utils$2.parseUnits(itemRequirementParam.amount, decimals[index]),
|
|
30837
30587
|
};
|
|
30838
30588
|
}
|
|
30839
30589
|
return itemRequirementParam;
|