@rabbitio/ui-kit 1.0.0-beta.39 → 1.0.0-beta.40
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/index.cjs +79 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +69 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +78 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +79 -0
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/common/external-apis/apiGroups.js +55 -0
- package/src/index.js +3 -0
package/dist/index.cjs
CHANGED
|
@@ -4639,6 +4639,83 @@ var ExternalApiProvider = /*#__PURE__*/function () {
|
|
|
4639
4639
|
return ExternalApiProvider;
|
|
4640
4640
|
}();
|
|
4641
4641
|
|
|
4642
|
+
/**
|
|
4643
|
+
* Models a group of APIs provided by the same owner and used for different services in our app.
|
|
4644
|
+
* It means we need to mention RPS several times for each usage and also have some holder of last call timestamp per
|
|
4645
|
+
* api group. So this concept allows to use it for exact ExternalApiProvider and make sure that you use the same
|
|
4646
|
+
* RPS value and make decisions on base of the same timestamp of last call to the API group owner.
|
|
4647
|
+
*/
|
|
4648
|
+
var ApiGroup = /*#__PURE__*/function () {
|
|
4649
|
+
function ApiGroup(id, rps, backendProxyIdGenerator) {
|
|
4650
|
+
if (backendProxyIdGenerator === void 0) {
|
|
4651
|
+
backendProxyIdGenerator = null;
|
|
4652
|
+
}
|
|
4653
|
+
this.id = id;
|
|
4654
|
+
this.rps = rps;
|
|
4655
|
+
this.lastCalledTimestamp = null;
|
|
4656
|
+
this.backendProxyIdGenerator = backendProxyIdGenerator;
|
|
4657
|
+
}
|
|
4658
|
+
var _proto = ApiGroup.prototype;
|
|
4659
|
+
_proto.isRpsExceeded = function isRpsExceeded() {
|
|
4660
|
+
var _this$lastCalledTimes;
|
|
4661
|
+
return ((_this$lastCalledTimes = this.lastCalledTimestamp) != null ? _this$lastCalledTimes : 0) + Math.floor(1000 / this.rps) > Date.now();
|
|
4662
|
+
};
|
|
4663
|
+
_proto.actualizeLastCalledTimestamp = function actualizeLastCalledTimestamp() {
|
|
4664
|
+
this.lastCalledTimestamp = Date.now();
|
|
4665
|
+
};
|
|
4666
|
+
return ApiGroup;
|
|
4667
|
+
}();
|
|
4668
|
+
var ApiGroups = {
|
|
4669
|
+
/**
|
|
4670
|
+
* Currently we use free version of etherscan provider with 0.2 RPS. But we have API key with 100k requests free
|
|
4671
|
+
* per month. So we can add it if not enough current RPS.
|
|
4672
|
+
*/
|
|
4673
|
+
ETHERSCAN: new ApiGroup("etherscan", 0.17),
|
|
4674
|
+
// Actually 0.2 but fails sometime, so we use smaller
|
|
4675
|
+
ALCHEMY: new ApiGroup("alchemy", 0.3, function (networkKey) {
|
|
4676
|
+
return "alchemy-" + networkKey;
|
|
4677
|
+
}),
|
|
4678
|
+
BLOCKSTREAM: new ApiGroup("blockstream", 0.2),
|
|
4679
|
+
BLOCKCHAIN_INFO: new ApiGroup("blockchain.info", 1),
|
|
4680
|
+
BLOCKNATIVE: new ApiGroup("blocknative", 0.5),
|
|
4681
|
+
ETHGASSTATION: new ApiGroup("ethgasstation", 0.5),
|
|
4682
|
+
TRONGRID: new ApiGroup("trongrid", 0.3, function (networkKey) {
|
|
4683
|
+
return "trongrid-" + networkKey;
|
|
4684
|
+
}),
|
|
4685
|
+
TRONSCAN: new ApiGroup("tronscan", 0.3),
|
|
4686
|
+
GETBLOCK: new ApiGroup("getblock", 0.3),
|
|
4687
|
+
COINCAP: new ApiGroup("coincap", 0.5),
|
|
4688
|
+
// 200 per minute without API key
|
|
4689
|
+
COINGECKO: new ApiGroup("coingecko", 0.9),
|
|
4690
|
+
// actually 0.13-0.5 according to the docs but we use smaller due to expirienced frequent abuses
|
|
4691
|
+
MESSARI: new ApiGroup("messari", 0.2),
|
|
4692
|
+
BTCCOM: new ApiGroup("btccom", 0.2),
|
|
4693
|
+
BITAPS: new ApiGroup("bitaps", 0.25),
|
|
4694
|
+
// Docs say that RPS is 3 but using it causes frequent 429 HTTP errors
|
|
4695
|
+
CEX: new ApiGroup("cex", 0.5),
|
|
4696
|
+
// Just assumption for RPS
|
|
4697
|
+
BIGDATACLOUD: new ApiGroup("bigdatacloud", 1),
|
|
4698
|
+
// Just assumption for RPS
|
|
4699
|
+
TRACKIP: new ApiGroup("trackip", 1),
|
|
4700
|
+
// Just assumption for RPS
|
|
4701
|
+
IPIFY: new ApiGroup("ipify", 1),
|
|
4702
|
+
// Just assumption for RPS
|
|
4703
|
+
WHATISMYIPADDRESS: new ApiGroup("whatismyipaddress", 1),
|
|
4704
|
+
// Just assumption for RPS
|
|
4705
|
+
EXCHANGERATE: new ApiGroup("exchangerate", 1),
|
|
4706
|
+
// Just assumption for RPS
|
|
4707
|
+
FRANKFURTER: new ApiGroup("frankfurter", 1),
|
|
4708
|
+
// Just assumption for RPS
|
|
4709
|
+
BITGO: new ApiGroup("bitgo", 1),
|
|
4710
|
+
// Just assumption for RPS
|
|
4711
|
+
BITCOINER: new ApiGroup("bitcoiner", 1),
|
|
4712
|
+
// Just assumption for RPS
|
|
4713
|
+
BITCORE: new ApiGroup("bitcore", 1),
|
|
4714
|
+
// Just assumption for RPS
|
|
4715
|
+
// BLOCKCHAIR: new ApiGroup("blockchair", 0.04), // this provider require API key for commercial use (10usd 10000 reqs), we will add it later
|
|
4716
|
+
MEMPOOL: new ApiGroup("mempool", 0.2) // Just assumption for RPS
|
|
4717
|
+
};
|
|
4718
|
+
|
|
4642
4719
|
var ExistingSwap =
|
|
4643
4720
|
/**
|
|
4644
4721
|
* @param swapId {string}
|
|
@@ -6612,6 +6689,8 @@ PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS = {
|
|
|
6612
6689
|
PublicSwapService._fiatDecimalsCount = FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
|
|
6613
6690
|
|
|
6614
6691
|
exports.AmountUtils = AmountUtils;
|
|
6692
|
+
exports.ApiGroup = ApiGroup;
|
|
6693
|
+
exports.ApiGroups = ApiGroups;
|
|
6615
6694
|
exports.AssetIcon = AssetIcon;
|
|
6616
6695
|
exports.AxiosAdapter = AxiosAdapter;
|
|
6617
6696
|
exports.BaseSwapCreationInfo = BaseSwapCreationInfo;
|