@fileverse-dev/formulajs 4.4.11-mod-68 → 4.4.11-mod-69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/formula.js +83 -39
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +33 -20
- package/lib/esm/crypto-constants.mjs +2 -2
- package/lib/esm/index.mjs +33 -20
- package/package.json +1 -1
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-69 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -11240,7 +11240,7 @@ function _typeof(o) {
|
|
|
11240
11240
|
}
|
|
11241
11241
|
function _handleScanRequest() {
|
|
11242
11242
|
_handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(_ref2) {
|
|
11243
|
-
var type, address, startDate, endDate, _ref2$page, page, _ref2$offset, offset, apiKey, functionName, chainId, network, API_INFO_MAP, ensName, apiInfo, baseUrl, ACTION_MAP, action, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, res, json;
|
|
11243
|
+
var type, address, startDate, endDate, _ref2$page, page, _ref2$offset, offset, apiKey, functionName, chainId, network, API_INFO_MAP, ensName, apiInfo, baseUrl, ACTION_MAP, action, module, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, res, json;
|
|
11244
11244
|
return _regeneratorRuntime().wrap((function _callee10$(_context10) {
|
|
11245
11245
|
while (1) switch (_context10.prev = _context10.next) {
|
|
11246
11246
|
case 0:
|
|
@@ -11292,7 +11292,7 @@ function _typeof(o) {
|
|
|
11292
11292
|
"all-txns": "txlist",
|
|
11293
11293
|
"token-txns": "tokentx",
|
|
11294
11294
|
"nft-txns": "tokennfttx",
|
|
11295
|
-
gas: "
|
|
11295
|
+
gas: "gasoracle"
|
|
11296
11296
|
};
|
|
11297
11297
|
action = ACTION_MAP[type];
|
|
11298
11298
|
if (action) {
|
|
@@ -11302,68 +11302,69 @@ function _typeof(o) {
|
|
|
11302
11302
|
throw new ValidationError("Invalid type: ".concat(type));
|
|
11303
11303
|
|
|
11304
11304
|
case 17:
|
|
11305
|
-
|
|
11305
|
+
module = action === "gasoracle" ? "gastracker" : "account";
|
|
11306
|
+
url = "".concat(baseUrl, "?chainid=").concat(chainId, "&module=").concat(module, "&action=").concat(action, "&apikey=").concat(apiKey);
|
|
11306
11307
|
if (![ "all-txns", "token-txns", "nft-txns" ].includes(type)) {
|
|
11307
|
-
_context10.next =
|
|
11308
|
+
_context10.next = 30;
|
|
11308
11309
|
break;
|
|
11309
11310
|
}
|
|
11310
11311
|
url += "&address=".concat(address, "&startblock=0&endblock=99999999&sort=asc");
|
|
11311
11312
|
if (!(!isNaN(startDate) && !isNaN(endDate))) {
|
|
11312
|
-
_context10.next =
|
|
11313
|
+
_context10.next = 29;
|
|
11313
11314
|
break;
|
|
11314
11315
|
}
|
|
11315
|
-
_context10.next =
|
|
11316
|
+
_context10.next = 24;
|
|
11316
11317
|
return Promise.all([ fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startDate), network, apiKey), fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endDate), network, apiKey) ]);
|
|
11317
11318
|
|
|
11318
|
-
case
|
|
11319
|
+
case 24:
|
|
11319
11320
|
_yield$Promise$all = _context10.sent;
|
|
11320
11321
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
11321
11322
|
startBlock = _yield$Promise$all2[0];
|
|
11322
11323
|
endBlock = _yield$Promise$all2[1];
|
|
11323
11324
|
url += "&startblock=".concat(startBlock || "0", "&endblock=").concat(endBlock || "99999999");
|
|
11324
11325
|
|
|
11325
|
-
case
|
|
11326
|
+
case 29:
|
|
11326
11327
|
url += "&page=".concat(page, "&offset=").concat(offset);
|
|
11327
11328
|
|
|
11328
|
-
case
|
|
11329
|
-
_context10.next =
|
|
11329
|
+
case 30:
|
|
11330
|
+
_context10.next = 32;
|
|
11330
11331
|
return fetch(url);
|
|
11331
11332
|
|
|
11332
|
-
case
|
|
11333
|
+
case 32:
|
|
11333
11334
|
res = _context10.sent;
|
|
11334
11335
|
if (res.ok) {
|
|
11335
|
-
_context10.next =
|
|
11336
|
+
_context10.next = 35;
|
|
11336
11337
|
break;
|
|
11337
11338
|
}
|
|
11338
11339
|
throw new NetworkError(apiInfo.apiKeyName, res.status);
|
|
11339
11340
|
|
|
11340
|
-
case
|
|
11341
|
-
_context10.next =
|
|
11341
|
+
case 35:
|
|
11342
|
+
_context10.next = 37;
|
|
11342
11343
|
return res.json();
|
|
11343
11344
|
|
|
11344
|
-
case
|
|
11345
|
+
case 37:
|
|
11345
11346
|
json = _context10.sent;
|
|
11346
11347
|
if (!(typeof json.result === "string")) {
|
|
11347
|
-
_context10.next =
|
|
11348
|
+
_context10.next = 43;
|
|
11348
11349
|
break;
|
|
11349
11350
|
}
|
|
11350
11351
|
if (!json.result.includes("Invalid API Key")) {
|
|
11351
|
-
_context10.next =
|
|
11352
|
+
_context10.next = 41;
|
|
11352
11353
|
break;
|
|
11353
11354
|
}
|
|
11354
11355
|
throw new InvalidApiKeyError(apiInfo.apiKeyName);
|
|
11355
11356
|
|
|
11356
|
-
case
|
|
11357
|
+
case 41:
|
|
11357
11358
|
if (!json.result.includes("Max rate limit reached")) {
|
|
11358
|
-
_context10.next =
|
|
11359
|
+
_context10.next = 43;
|
|
11359
11360
|
break;
|
|
11360
11361
|
}
|
|
11361
11362
|
throw new RateLimitError(apiInfo.apiKeyName);
|
|
11362
11363
|
|
|
11363
|
-
case
|
|
11364
|
+
case 43:
|
|
11364
11365
|
return _context10.abrupt("return", json.result);
|
|
11365
11366
|
|
|
11366
|
-
case
|
|
11367
|
+
case 44:
|
|
11367
11368
|
case "end":
|
|
11368
11369
|
return _context10.stop();
|
|
11369
11370
|
}
|
|
@@ -16475,14 +16476,18 @@ function _typeof(o) {
|
|
|
16475
16476
|
contentType: enumType([ "posts", "replies", "channels" ]),
|
|
16476
16477
|
identifier: stringType().nonempty(),
|
|
16477
16478
|
start: numberType()["int"]().nonnegative()["default"](0),
|
|
16478
|
-
end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16479
|
+
end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16480
|
+
message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16481
|
+
})["default"](10)
|
|
16479
16482
|
});
|
|
16480
16483
|
var lensSchema = objectType({
|
|
16481
16484
|
platform: literalType("lens"),
|
|
16482
16485
|
contentType: enumType([ "posts", "replies" ]),
|
|
16483
16486
|
identifier: stringType().nonempty(),
|
|
16484
16487
|
start: numberType()["int"]().nonnegative()["default"](0),
|
|
16485
|
-
end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16488
|
+
end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16489
|
+
message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16490
|
+
})["default"](10)
|
|
16486
16491
|
});
|
|
16487
16492
|
var fireflyParamsSchema = discriminatedUnionType("platform", [ farcasterSchema, lensSchema ]);
|
|
16488
16493
|
var fireFlyPlaformType = {
|
|
@@ -16500,21 +16505,33 @@ function _typeof(o) {
|
|
|
16500
16505
|
contentType: enumType([ "posts", "replies" ]),
|
|
16501
16506
|
identifier: stringType().nonempty(),
|
|
16502
16507
|
start: numberType()["int"]().nonnegative()["default"](0),
|
|
16503
|
-
end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16508
|
+
end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16509
|
+
message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16510
|
+
})["default"](10)
|
|
16504
16511
|
});
|
|
16505
16512
|
var farcasterParamsSchema = objectType({
|
|
16506
16513
|
contentType: enumType([ "posts", "replies", "channels" ]),
|
|
16507
16514
|
identifier: stringType().nonempty(),
|
|
16508
16515
|
start: numberType()["int"]().nonnegative()["default"](0),
|
|
16509
|
-
end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16516
|
+
end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16517
|
+
message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16518
|
+
})["default"](10)
|
|
16510
16519
|
});
|
|
16511
16520
|
var dateStringToTimestamp = function dateStringToTimestamp(val) {
|
|
16512
|
-
var _val$split = val.split("/"), _val$split2 = _slicedToArray(_val$split, 3),
|
|
16513
|
-
|
|
16521
|
+
var _val$split = val.split("/"), _val$split2 = _slicedToArray(_val$split, 3), dd = _val$split2[0], mm = _val$split2[1], yyyy = _val$split2[2];
|
|
16522
|
+
var date = new Date("".concat(yyyy, "-").concat(mm.padStart(2, "0"), "-").concat(dd.padStart(2, "0")));
|
|
16523
|
+
var timestamp = date.getTime();
|
|
16524
|
+
return isNaN(timestamp) ? NaN : Math.floor(timestamp / 1e3);
|
|
16514
16525
|
};
|
|
16515
16526
|
var dateOrTimestamp = preprocessType((function(val) {
|
|
16516
|
-
return typeof val === "string" && /^\d{2}\/\d{2}\/\d{4}$/.test(val) ? dateStringToTimestamp(val) : val;
|
|
16517
|
-
}), numberType(
|
|
16527
|
+
return typeof val === "string" && /^\d{1,2}\/\d{1,2}\/\d{4}$/.test(val) ? dateStringToTimestamp(val) : val;
|
|
16528
|
+
}), numberType({
|
|
16529
|
+
invalid_type_error: "Date must be a valid DD/MM/YYYY or timestamp"
|
|
16530
|
+
})["int"]("Date must be an integer timestamp").nonnegative("Date must be a nonnegative timestamp").refine((function(n) {
|
|
16531
|
+
return !isNaN(n);
|
|
16532
|
+
}), {
|
|
16533
|
+
message: "Invalid date format or value: expected DD/MM/YYYY"
|
|
16534
|
+
}));
|
|
16518
16535
|
var blockscoutParamsSchema = objectType({
|
|
16519
16536
|
address: stringType().nonempty(),
|
|
16520
16537
|
type: enumType([ "stat", "txns", "tokens" ]),
|
|
@@ -16522,14 +16539,18 @@ function _typeof(o) {
|
|
|
16522
16539
|
startTimestamp: dateOrTimestamp.optional(),
|
|
16523
16540
|
endTimestamp: dateOrTimestamp.optional(),
|
|
16524
16541
|
page: numberType()["int"]().nonnegative()["default"](1),
|
|
16525
|
-
offset: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16542
|
+
offset: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16543
|
+
message: '"offset" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16544
|
+
})["default"](10)
|
|
16526
16545
|
});
|
|
16527
16546
|
var gasSchema$1 = objectType({
|
|
16528
16547
|
type: literalType("gas"),
|
|
16529
16548
|
startDate: dateOrTimestamp.optional(),
|
|
16530
16549
|
endDate: dateOrTimestamp.optional(),
|
|
16531
16550
|
page: numberType()["int"]().nonnegative()["default"](1),
|
|
16532
|
-
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16551
|
+
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16552
|
+
message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16553
|
+
})["default"](10)
|
|
16533
16554
|
});
|
|
16534
16555
|
var txnSchema$1 = objectType({
|
|
16535
16556
|
type: enumType([ "all-txns", "token-txns", "nft-txns" ]),
|
|
@@ -16537,7 +16558,9 @@ function _typeof(o) {
|
|
|
16537
16558
|
startDate: dateOrTimestamp.optional(),
|
|
16538
16559
|
endDate: dateOrTimestamp.optional(),
|
|
16539
16560
|
page: numberType()["int"]().nonnegative()["default"](1),
|
|
16540
|
-
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16561
|
+
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16562
|
+
message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16563
|
+
})["default"](10)
|
|
16541
16564
|
});
|
|
16542
16565
|
var baseParamsSchema = discriminatedUnionType("type", [ gasSchema$1, txnSchema$1 ]);
|
|
16543
16566
|
var gasSchema = objectType({
|
|
@@ -16545,7 +16568,9 @@ function _typeof(o) {
|
|
|
16545
16568
|
startDate: dateOrTimestamp.optional(),
|
|
16546
16569
|
endDate: dateOrTimestamp.optional(),
|
|
16547
16570
|
page: numberType()["int"]().nonnegative()["default"](1),
|
|
16548
|
-
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16571
|
+
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16572
|
+
message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16573
|
+
})["default"](10)
|
|
16549
16574
|
});
|
|
16550
16575
|
var txnSchema = objectType({
|
|
16551
16576
|
type: enumType([ "all-txns", "token-txns", "nft-txns" ]),
|
|
@@ -16554,9 +16579,24 @@ function _typeof(o) {
|
|
|
16554
16579
|
endDate: dateOrTimestamp.optional(),
|
|
16555
16580
|
chain: enumType([ "ethereum", "base", "gnosis" ]),
|
|
16556
16581
|
page: numberType()["int"]().nonnegative()["default"](1),
|
|
16557
|
-
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16582
|
+
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16583
|
+
message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16584
|
+
})["default"](10)
|
|
16558
16585
|
});
|
|
16559
16586
|
var etherscanParamsSchema = discriminatedUnionType("type", [ gasSchema, txnSchema ]);
|
|
16587
|
+
var allowedValues = [ "1h", "24h", "7d" ];
|
|
16588
|
+
var param2Schema = stringType().refine((function(val) {
|
|
16589
|
+
var tokens = val.split(",").map((function(t) {
|
|
16590
|
+
return t.trim().toLowerCase();
|
|
16591
|
+
}));
|
|
16592
|
+
return tokens.some((function(token) {
|
|
16593
|
+
return allowedValues.some((function(allowed) {
|
|
16594
|
+
return token.includes(allowed);
|
|
16595
|
+
}));
|
|
16596
|
+
}));
|
|
16597
|
+
}), {
|
|
16598
|
+
message: "param2 must contain at least one of: '1h', '24h', '7d'"
|
|
16599
|
+
}).optional();
|
|
16560
16600
|
var priceSchema = objectType({
|
|
16561
16601
|
category: literalType("price"),
|
|
16562
16602
|
param1: stringType().nonempty(),
|
|
@@ -16566,13 +16606,13 @@ function _typeof(o) {
|
|
|
16566
16606
|
var marketSchema = objectType({
|
|
16567
16607
|
category: literalType("market"),
|
|
16568
16608
|
param1: enumType(marketEcosystems),
|
|
16569
|
-
param2:
|
|
16609
|
+
param2: param2Schema
|
|
16570
16610
|
});
|
|
16571
16611
|
var stablecoinsTypes = [ "all", "yield-bearing-stablecoins", "crypto-backed-stablecoin" ];
|
|
16572
16612
|
var stablecoinsSchema = objectType({
|
|
16573
16613
|
category: literalType("stablecoins"),
|
|
16574
16614
|
param1: enumType(stablecoinsTypes),
|
|
16575
|
-
param2:
|
|
16615
|
+
param2: param2Schema
|
|
16576
16616
|
});
|
|
16577
16617
|
var derivativesSchema = objectType({
|
|
16578
16618
|
category: literalType("derivatives"),
|
|
@@ -16591,7 +16631,9 @@ function _typeof(o) {
|
|
|
16591
16631
|
startTime: dateOrTimestamp.optional(),
|
|
16592
16632
|
endTime: dateOrTimestamp.optional(),
|
|
16593
16633
|
page: numberType()["int"]().nonnegative()["default"](1),
|
|
16594
|
-
offset: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16634
|
+
offset: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16635
|
+
message: '"offset" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16636
|
+
})["default"](10)
|
|
16595
16637
|
});
|
|
16596
16638
|
var eoaParamsSchema = preprocessType((function(val) {
|
|
16597
16639
|
var obj = _objectSpread({}, val || {});
|
|
@@ -16613,7 +16655,9 @@ function _typeof(o) {
|
|
|
16613
16655
|
address: stringType().nonempty(),
|
|
16614
16656
|
utility: literalType("txns"),
|
|
16615
16657
|
chain: enumType([ "ethereum", "gnosis" ]),
|
|
16616
|
-
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT
|
|
16658
|
+
limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
|
|
16659
|
+
message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
|
|
16660
|
+
})["default"](10),
|
|
16617
16661
|
offset: numberType()["int"]().nonnegative()["default"](0)
|
|
16618
16662
|
});
|
|
16619
16663
|
var categories = [ "protocols", "yields", "dex", "fees" ];
|