@sentio/runtime 2.62.2-rc.6 → 2.62.2-rc.8
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.
@@ -36097,12 +36097,14 @@ var require_eventemitter3 = __commonJS({
|
|
36097
36097
|
}
|
36098
36098
|
});
|
36099
36099
|
|
36100
|
-
// ../../node_modules/.pnpm/@sentio+chain@3.4.
|
36100
|
+
// ../../node_modules/.pnpm/@sentio+chain@3.4.8/node_modules/@sentio/chain/dist/chain-id.js
|
36101
36101
|
var require_chain_id = __commonJS({
|
36102
|
-
"../../node_modules/.pnpm/@sentio+chain@3.4.
|
36102
|
+
"../../node_modules/.pnpm/@sentio+chain@3.4.8/node_modules/@sentio/chain/dist/chain-id.js"(exports) {
|
36103
36103
|
"use strict";
|
36104
36104
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36105
|
-
exports.
|
36105
|
+
exports.ChainIdToType = exports.ChainTypeToChainId = exports.ChainId = exports.NonEthChainId = exports.BTCChainId = exports.StarknetChainId = exports.CosmosChainId = exports.FuelChainId = exports.SolanaChainId = exports.SuiChainId = exports.AptosChainId = exports.EthChainId = exports.ChainType = void 0;
|
36106
|
+
exports.getChainType = getChainType;
|
36107
|
+
exports.isChainType = isChainType;
|
36106
36108
|
var ChainType;
|
36107
36109
|
(function(ChainType2) {
|
36108
36110
|
ChainType2["SOLANA"] = "solana";
|
@@ -36156,6 +36158,8 @@ var require_chain_id = __commonJS({
|
|
36156
36158
|
EthChainId3["MANTLE"] = "5000";
|
36157
36159
|
EthChainId3["BASE"] = "8453";
|
36158
36160
|
EthChainId3["MEV_COMMIT"] = "8855";
|
36161
|
+
EthChainId3["PLASMA_MAINNET"] = "9745";
|
36162
|
+
EthChainId3["PLASMA_TESTNET"] = "9746";
|
36159
36163
|
EthChainId3["MONAD_TESTNET"] = "10143";
|
36160
36164
|
EthChainId3["HOLESKY"] = "17000";
|
36161
36165
|
EthChainId3["HOODI"] = "560048";
|
@@ -36261,7 +36265,6 @@ var require_chain_id = __commonJS({
|
|
36261
36265
|
}
|
36262
36266
|
return chainType;
|
36263
36267
|
}
|
36264
|
-
exports.getChainType = getChainType;
|
36265
36268
|
function isChainType(chainId, targetChainType) {
|
36266
36269
|
const id2 = String(chainId).toLowerCase();
|
36267
36270
|
const chainType = exports.ChainIdToType.get(id2);
|
@@ -36270,16 +36273,20 @@ var require_chain_id = __commonJS({
|
|
36270
36273
|
}
|
36271
36274
|
return chainType === targetChainType;
|
36272
36275
|
}
|
36273
|
-
exports.isChainType = isChainType;
|
36274
36276
|
}
|
36275
36277
|
});
|
36276
36278
|
|
36277
|
-
// ../../node_modules/.pnpm/@sentio+chain@3.4.
|
36279
|
+
// ../../node_modules/.pnpm/@sentio+chain@3.4.8/node_modules/@sentio/chain/dist/chain-info.js
|
36278
36280
|
var require_chain_info = __commonJS({
|
36279
|
-
"../../node_modules/.pnpm/@sentio+chain@3.4.
|
36281
|
+
"../../node_modules/.pnpm/@sentio+chain@3.4.8/node_modules/@sentio/chain/dist/chain-info.js"(exports) {
|
36280
36282
|
"use strict";
|
36281
36283
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36282
|
-
exports.
|
36284
|
+
exports.ChainInfo = exports.NonEthChainInfo = exports.CosmosChainInfo = exports.StarknetChainInfo = exports.FuelChainInfo = exports.SuiChainInfo = exports.SolanaChainInfo = exports.AptosChainInfo = exports.BTCChainInfo = exports.EthChainInfo = exports.EthVariation = exports.ExplorerApiType = void 0;
|
36285
|
+
exports.getChainExternalUrl = getChainExternalUrl;
|
36286
|
+
exports.getChainBlockscoutUrl = getChainBlockscoutUrl;
|
36287
|
+
exports.getSuiscanUrl = getSuiscanUrl;
|
36288
|
+
exports.getChainLogo = getChainLogo;
|
36289
|
+
exports.getMainnetChain = getMainnetChain;
|
36283
36290
|
var chain_id_1 = require_chain_id();
|
36284
36291
|
var ExplorerApiType;
|
36285
36292
|
(function(ExplorerApiType2) {
|
@@ -36425,8 +36432,10 @@ var require_chain_info = __commonJS({
|
|
36425
36432
|
chainId: chain_id_1.EthChainId.POLYGON,
|
36426
36433
|
variation: EthVariation.DEFAULT,
|
36427
36434
|
priceTokenAddress: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
|
36435
|
+
// WMATIC
|
36428
36436
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36429
36437
|
wrappedTokenAddress: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
|
36438
|
+
// WMATIC
|
36430
36439
|
tokenSymbol: "MATIC",
|
36431
36440
|
tokenDecimals: 18,
|
36432
36441
|
explorerApiType: ExplorerApiType.ETHERSCAN_V2,
|
@@ -36487,6 +36496,7 @@ var require_chain_info = __commonJS({
|
|
36487
36496
|
chainId: chain_id_1.EthChainId.MOONBEAM,
|
36488
36497
|
variation: EthVariation.SUBSTRATE,
|
36489
36498
|
priceTokenAddress: "0xacc15dc74880c9944775448304b263d191c6077f",
|
36499
|
+
// WGLMR
|
36490
36500
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36491
36501
|
wrappedTokenAddress: "0xacc15dc74880c9944775448304b263d191c6077f",
|
36492
36502
|
tokenSymbol: "GLMR",
|
@@ -36502,6 +36512,7 @@ var require_chain_info = __commonJS({
|
|
36502
36512
|
chainId: chain_id_1.EthChainId.ASTAR,
|
36503
36513
|
variation: EthVariation.SUBSTRATE,
|
36504
36514
|
priceTokenAddress: "0xaeaaf0e2c81af264101b9129c00f4440ccf0f720",
|
36515
|
+
// WASTR
|
36505
36516
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36506
36517
|
wrappedTokenAddress: "0xaeaaf0e2c81af264101b9129c00f4440ccf0f720",
|
36507
36518
|
tokenSymbol: "ASTR",
|
@@ -36517,6 +36528,7 @@ var require_chain_info = __commonJS({
|
|
36517
36528
|
chainId: chain_id_1.EthChainId.LINEA,
|
36518
36529
|
variation: EthVariation.DEFAULT,
|
36519
36530
|
priceTokenAddress: "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
|
36531
|
+
// WETH
|
36520
36532
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36521
36533
|
wrappedTokenAddress: "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
|
36522
36534
|
tokenSymbol: "ETH",
|
@@ -36535,6 +36547,7 @@ var require_chain_info = __commonJS({
|
|
36535
36547
|
priceTokenAddress: "0x0000000000000000000000000000000000000000",
|
36536
36548
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36537
36549
|
wrappedTokenAddress: "0x5300000000000000000000000000000000000004",
|
36550
|
+
// TODO questionable
|
36538
36551
|
tokenSymbol: "ETH",
|
36539
36552
|
tokenDecimals: 18,
|
36540
36553
|
explorerUrl: "https://scrollscan.com",
|
@@ -36761,11 +36774,12 @@ var require_chain_info = __commonJS({
|
|
36761
36774
|
chainId: chain_id_1.EthChainId.CRONOS,
|
36762
36775
|
variation: EthVariation.DEFAULT,
|
36763
36776
|
priceTokenAddress: "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23",
|
36777
|
+
// WCRO
|
36764
36778
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36765
36779
|
wrappedTokenAddress: "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23",
|
36766
36780
|
tokenSymbol: "CRO",
|
36767
36781
|
tokenDecimals: 18,
|
36768
|
-
explorerUrl: "https://
|
36782
|
+
explorerUrl: "https://explorer.cronos.org",
|
36769
36783
|
explorerApiType: ExplorerApiType.ETHERSCAN_V2,
|
36770
36784
|
explorerApi: "https://api.etherscan.io/v2",
|
36771
36785
|
lightIcon: "https://assets.sentio.xyz/chains/cronos.svg",
|
@@ -36778,6 +36792,7 @@ var require_chain_info = __commonJS({
|
|
36778
36792
|
mainnetChainId: chain_id_1.EthChainId.CRONOS,
|
36779
36793
|
variation: EthVariation.DEFAULT,
|
36780
36794
|
priceTokenAddress: "0x6a3173618859c7cd40faf6921b5e9eb6a76f1fd4",
|
36795
|
+
// WCRO
|
36781
36796
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36782
36797
|
wrappedTokenAddress: "0x6a3173618859c7cd40faf6921b5e9eb6a76f1fd4",
|
36783
36798
|
tokenSymbol: "CRO",
|
@@ -36794,6 +36809,7 @@ var require_chain_info = __commonJS({
|
|
36794
36809
|
chainId: chain_id_1.EthChainId.BITLAYER,
|
36795
36810
|
variation: EthVariation.DEFAULT,
|
36796
36811
|
priceTokenAddress: "0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f",
|
36812
|
+
// WBTC
|
36797
36813
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36798
36814
|
wrappedTokenAddress: "0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f",
|
36799
36815
|
tokenSymbol: "BTC",
|
@@ -36824,6 +36840,7 @@ var require_chain_info = __commonJS({
|
|
36824
36840
|
chainId: chain_id_1.EthChainId.MANTLE,
|
36825
36841
|
variation: EthVariation.OPTIMISM,
|
36826
36842
|
priceTokenAddress: "0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8",
|
36843
|
+
// WMNT
|
36827
36844
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36828
36845
|
wrappedTokenAddress: "0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8",
|
36829
36846
|
tokenSymbol: "MNT",
|
@@ -36840,6 +36857,7 @@ var require_chain_info = __commonJS({
|
|
36840
36857
|
chainId: chain_id_1.EthChainId.B2_MAINNET,
|
36841
36858
|
variation: EthVariation.OPTIMISM,
|
36842
36859
|
priceTokenAddress: "0x4200000000000000000000000000000000000006",
|
36860
|
+
// WBTC
|
36843
36861
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36844
36862
|
wrappedTokenAddress: "0x4200000000000000000000000000000000000006",
|
36845
36863
|
tokenSymbol: "BTC",
|
@@ -36886,6 +36904,7 @@ var require_chain_info = __commonJS({
|
|
36886
36904
|
chainId: chain_id_1.EthChainId.FRAXTAL,
|
36887
36905
|
variation: EthVariation.OPTIMISM,
|
36888
36906
|
priceTokenAddress: "0x0000000000000000000000000000000000000000",
|
36907
|
+
// wfrxETH
|
36889
36908
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36890
36909
|
wrappedTokenAddress: "0xFC00000000000000000000000000000000000006",
|
36891
36910
|
tokenSymbol: "ETH",
|
@@ -36901,6 +36920,7 @@ var require_chain_info = __commonJS({
|
|
36901
36920
|
chainId: chain_id_1.EthChainId.KUCOIN,
|
36902
36921
|
variation: EthVariation.DEFAULT,
|
36903
36922
|
priceTokenAddress: "0x4446Fc4eb47f2f6586f9fAAb68B3498F86C07521",
|
36923
|
+
// WCCS
|
36904
36924
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36905
36925
|
wrappedTokenAddress: "0x4446Fc4eb47f2f6586f9fAAb68B3498F86C07521",
|
36906
36926
|
tokenSymbol: "KCS",
|
@@ -36916,6 +36936,7 @@ var require_chain_info = __commonJS({
|
|
36916
36936
|
chainId: chain_id_1.EthChainId.CONFLUX,
|
36917
36937
|
variation: EthVariation.DEFAULT,
|
36918
36938
|
priceTokenAddress: "0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b",
|
36939
|
+
// WCFX
|
36919
36940
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36920
36941
|
wrappedTokenAddress: "0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b",
|
36921
36942
|
tokenSymbol: "CFX",
|
@@ -36932,6 +36953,7 @@ var require_chain_info = __commonJS({
|
|
36932
36953
|
chainId: chain_id_1.EthChainId.METIS,
|
36933
36954
|
variation: EthVariation.DEFAULT,
|
36934
36955
|
priceTokenAddress: "0x75cb093E4D61d2A2e65D8e0BBb01DE8d89b53481",
|
36956
|
+
// WMETIS
|
36935
36957
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36936
36958
|
wrappedTokenAddress: "0x75cb093E4D61d2A2e65D8e0BBb01DE8d89b53481",
|
36937
36959
|
tokenSymbol: "METIS",
|
@@ -36947,6 +36969,7 @@ var require_chain_info = __commonJS({
|
|
36947
36969
|
chainId: chain_id_1.EthChainId.BEVM,
|
36948
36970
|
variation: EthVariation.SUBSTRATE,
|
36949
36971
|
priceTokenAddress: "0xB5136FEba197f5fF4B765E5b50c74db717796dcD",
|
36972
|
+
// WBTC
|
36950
36973
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36951
36974
|
wrappedTokenAddress: "0xB5136FEba197f5fF4B765E5b50c74db717796dcD",
|
36952
36975
|
tokenSymbol: "BTC",
|
@@ -36962,6 +36985,7 @@ var require_chain_info = __commonJS({
|
|
36962
36985
|
chainId: chain_id_1.EthChainId.MERLIN_MAINNET,
|
36963
36986
|
variation: EthVariation.POLYGON_ZKEVM,
|
36964
36987
|
priceTokenAddress: "0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA",
|
36988
|
+
// WBTC
|
36965
36989
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36966
36990
|
wrappedTokenAddress: "0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA",
|
36967
36991
|
tokenSymbol: "BTC",
|
@@ -36979,6 +37003,7 @@ var require_chain_info = __commonJS({
|
|
36979
37003
|
priceTokenAddress: "0x721EF6871f1c4Efe730Dce047D40D1743B886946",
|
36980
37004
|
tokenAddress: "0x0000000000000000000000000000000000000000",
|
36981
37005
|
wrappedTokenAddress: "0x721EF6871f1c4Efe730Dce047D40D1743B886946",
|
37006
|
+
// WCHZ
|
36982
37007
|
tokenSymbol: "CHZ",
|
36983
37008
|
tokenDecimals: 18,
|
36984
37009
|
explorerUrl: "https://chiliscan.com",
|
@@ -36993,6 +37018,7 @@ var require_chain_info = __commonJS({
|
|
36993
37018
|
variation: EthVariation.ZKSYNC,
|
36994
37019
|
priceTokenAddress: "0x000000000000000000000000000000000000800A",
|
36995
37020
|
tokenAddress: "0x000000000000000000000000000000000000800A",
|
37021
|
+
//special
|
36996
37022
|
wrappedTokenAddress: "0x000000000000000000000000000000000000800A",
|
36997
37023
|
tokenSymbol: "ETH",
|
36998
37024
|
tokenDecimals: 18,
|
@@ -37271,7 +37297,7 @@ var require_chain_info = __commonJS({
|
|
37271
37297
|
wrappedTokenAddress: "0x0000000000000000000000000000000000000000",
|
37272
37298
|
tokenSymbol: "HYPE",
|
37273
37299
|
tokenDecimals: 18,
|
37274
|
-
explorerUrl: "https://hyperevmscan.io
|
37300
|
+
explorerUrl: "https://hyperevmscan.io",
|
37275
37301
|
explorerApi: "https://hyperevmscan.io/v2",
|
37276
37302
|
explorerApiType: ExplorerApiType.ETHERSCAN_V2,
|
37277
37303
|
lightIcon: "https://assets.sentio.xyz/chains/hype.svg",
|
@@ -37302,7 +37328,7 @@ var require_chain_info = __commonJS({
|
|
37302
37328
|
wrappedTokenAddress: "0x0000000000000000000000000000000000000000",
|
37303
37329
|
tokenSymbol: "ETH",
|
37304
37330
|
tokenDecimals: 18,
|
37305
|
-
explorerUrl: "https://www.mev-commit.xyz
|
37331
|
+
explorerUrl: "https://www.mev-commit.xyz",
|
37306
37332
|
lightIcon: "https://assets.sentio.xyz/chains/mev-commit-dark.svg",
|
37307
37333
|
darkIcon: "https://assets.sentio.xyz/chains/mev-commit.svg"
|
37308
37334
|
},
|
@@ -37336,6 +37362,37 @@ var require_chain_info = __commonJS({
|
|
37336
37362
|
lightIcon: "https://assets.sentio.xyz/chains/abstract.svg",
|
37337
37363
|
darkIcon: "https://assets.sentio.xyz/chains/abstract.svg"
|
37338
37364
|
},
|
37365
|
+
[chain_id_1.EthChainId.PLASMA_MAINNET]: {
|
37366
|
+
name: "Plasma Mainnet",
|
37367
|
+
slug: "plasma-mainnet",
|
37368
|
+
chainId: chain_id_1.EthChainId.PLASMA_MAINNET,
|
37369
|
+
variation: EthVariation.DEFAULT,
|
37370
|
+
priceTokenAddress: "0x0000000000000000000000000000000000000000",
|
37371
|
+
tokenAddress: "0x0000000000000000000000000000000000000000",
|
37372
|
+
wrappedTokenAddress: "0x6100E367285b01F48D07953803A2d8dCA5D19873",
|
37373
|
+
tokenSymbol: "XPL",
|
37374
|
+
tokenDecimals: 18,
|
37375
|
+
explorerUrl: "https://plasmascan.to",
|
37376
|
+
explorerApiType: ExplorerApiType.UNKNOWN,
|
37377
|
+
lightIcon: "https://assets.sentio.xyz/chains/plasma.svg",
|
37378
|
+
darkIcon: "https://assets.sentio.xyz/chains/plasma-dark.svg"
|
37379
|
+
},
|
37380
|
+
[chain_id_1.EthChainId.PLASMA_TESTNET]: {
|
37381
|
+
name: "Plasma Testnet",
|
37382
|
+
slug: "plasma-testnet",
|
37383
|
+
chainId: chain_id_1.EthChainId.PLASMA_TESTNET,
|
37384
|
+
mainnetChainId: chain_id_1.EthChainId.PLASMA_MAINNET,
|
37385
|
+
variation: EthVariation.DEFAULT,
|
37386
|
+
priceTokenAddress: "0x0000000000000000000000000000000000000000",
|
37387
|
+
tokenAddress: "0x0000000000000000000000000000000000000000",
|
37388
|
+
wrappedTokenAddress: "0x6100E367285b01F48D07953803A2d8dCA5D19873",
|
37389
|
+
tokenSymbol: "XPL",
|
37390
|
+
tokenDecimals: 18,
|
37391
|
+
explorerUrl: "https://testnet.plasmascan.to",
|
37392
|
+
explorerApiType: ExplorerApiType.UNKNOWN,
|
37393
|
+
lightIcon: "https://assets.sentio.xyz/chains/plasma.svg",
|
37394
|
+
darkIcon: "https://assets.sentio.xyz/chains/plasma-dark.svg"
|
37395
|
+
},
|
37339
37396
|
[chain_id_1.EthChainId.CUSTOM]: {
|
37340
37397
|
name: "Custom",
|
37341
37398
|
slug: "custom",
|
@@ -37676,7 +37733,6 @@ var require_chain_info = __commonJS({
|
|
37676
37733
|
}
|
37677
37734
|
return;
|
37678
37735
|
}
|
37679
|
-
exports.getChainExternalUrl = getChainExternalUrl;
|
37680
37736
|
function getChainBlockscoutUrl(chainId, hash2, subtype) {
|
37681
37737
|
if (!chainId || !hash2 || !subtype) {
|
37682
37738
|
return;
|
@@ -37690,14 +37746,12 @@ var require_chain_info = __commonJS({
|
|
37690
37746
|
}
|
37691
37747
|
return `${supportedChain.blockscoutUrl}/${subtype}/${hash2}`;
|
37692
37748
|
}
|
37693
|
-
exports.getChainBlockscoutUrl = getChainBlockscoutUrl;
|
37694
37749
|
function getSuiscanUrl(chainId, hash2, subtype) {
|
37695
37750
|
if (!chainId || !hash2 || !subtype) {
|
37696
37751
|
return;
|
37697
37752
|
}
|
37698
37753
|
return getSuiChainScanUrl(chainId, hash2, subtype);
|
37699
37754
|
}
|
37700
|
-
exports.getSuiscanUrl = getSuiscanUrl;
|
37701
37755
|
function getLogoUrl(info, dark) {
|
37702
37756
|
const defaultUrl = "https://assets.sentio.xyz/chains/chain-unknown.webp";
|
37703
37757
|
if (!info) {
|
@@ -37718,7 +37772,6 @@ var require_chain_info = __commonJS({
|
|
37718
37772
|
const chainInfo = exports.ChainInfo[chainId.toString()];
|
37719
37773
|
return getLogoUrl(chainInfo, dark);
|
37720
37774
|
}
|
37721
|
-
exports.getChainLogo = getChainLogo;
|
37722
37775
|
function getMainnetChain(chainId) {
|
37723
37776
|
const chainInfo = exports.ChainInfo[chainId.toString()];
|
37724
37777
|
if (!chainInfo) {
|
@@ -37726,16 +37779,15 @@ var require_chain_info = __commonJS({
|
|
37726
37779
|
}
|
37727
37780
|
return chainInfo.mainnetChainId || chainId;
|
37728
37781
|
}
|
37729
|
-
exports.getMainnetChain = getMainnetChain;
|
37730
37782
|
}
|
37731
37783
|
});
|
37732
37784
|
|
37733
|
-
// ../../node_modules/.pnpm/@sentio+chain@3.4.
|
37785
|
+
// ../../node_modules/.pnpm/@sentio+chain@3.4.8/node_modules/@sentio/chain/dist/chain-name.js
|
37734
37786
|
var require_chain_name = __commonJS({
|
37735
|
-
"../../node_modules/.pnpm/@sentio+chain@3.4.
|
37787
|
+
"../../node_modules/.pnpm/@sentio+chain@3.4.8/node_modules/@sentio/chain/dist/chain-name.js"(exports) {
|
37736
37788
|
"use strict";
|
37737
37789
|
Object.defineProperty(exports, "__esModule", { value: true });
|
37738
|
-
exports.getChainName =
|
37790
|
+
exports.getChainName = getChainName;
|
37739
37791
|
var chain_info_1 = require_chain_info();
|
37740
37792
|
function getChainName(chainId) {
|
37741
37793
|
if (typeof chainId === "number") {
|
@@ -37757,13 +37809,12 @@ var require_chain_name = __commonJS({
|
|
37757
37809
|
}
|
37758
37810
|
return chainId || "";
|
37759
37811
|
}
|
37760
|
-
exports.getChainName = getChainName;
|
37761
37812
|
}
|
37762
37813
|
});
|
37763
37814
|
|
37764
|
-
// ../../node_modules/.pnpm/@sentio+chain@3.4.
|
37815
|
+
// ../../node_modules/.pnpm/@sentio+chain@3.4.8/node_modules/@sentio/chain/dist/index.js
|
37765
37816
|
var require_dist = __commonJS({
|
37766
|
-
"../../node_modules/.pnpm/@sentio+chain@3.4.
|
37817
|
+
"../../node_modules/.pnpm/@sentio+chain@3.4.8/node_modules/@sentio/chain/dist/index.js"(exports) {
|
37767
37818
|
"use strict";
|
37768
37819
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
37769
37820
|
if (k2 === void 0) k2 = k;
|
@@ -55162,52 +55213,45 @@ function spelunkMessage(value) {
|
|
55162
55213
|
// ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
|
55163
55214
|
var import_index = __toESM(require_eventemitter3(), 1);
|
55164
55215
|
|
55165
|
-
// ../../node_modules/.pnpm/p-timeout@
|
55166
|
-
var TimeoutError = class extends Error {
|
55167
|
-
|
55168
|
-
|
55169
|
-
|
55170
|
-
|
55171
|
-
};
|
55172
|
-
var AbortError2 = class extends Error {
|
55173
|
-
constructor(message) {
|
55174
|
-
super();
|
55175
|
-
this.name = "AbortError";
|
55176
|
-
this.message = message;
|
55216
|
+
// ../../node_modules/.pnpm/p-timeout@7.0.0/node_modules/p-timeout/index.js
|
55217
|
+
var TimeoutError = class _TimeoutError extends Error {
|
55218
|
+
name = "TimeoutError";
|
55219
|
+
constructor(message, options) {
|
55220
|
+
super(message, options);
|
55221
|
+
Error.captureStackTrace?.(this, _TimeoutError);
|
55177
55222
|
}
|
55178
55223
|
};
|
55179
|
-
var
|
55180
|
-
var getAbortedReason = (signal) => {
|
55181
|
-
const reason = signal.reason === void 0 ? getDOMException("This operation was aborted.") : signal.reason;
|
55182
|
-
return reason instanceof Error ? reason : getDOMException(reason);
|
55183
|
-
};
|
55224
|
+
var getAbortedReason = (signal) => signal.reason ?? new DOMException("This operation was aborted.", "AbortError");
|
55184
55225
|
function pTimeout(promise, options) {
|
55185
55226
|
const {
|
55186
55227
|
milliseconds,
|
55187
55228
|
fallback,
|
55188
55229
|
message,
|
55189
|
-
customTimers = { setTimeout, clearTimeout }
|
55230
|
+
customTimers = { setTimeout, clearTimeout },
|
55231
|
+
signal
|
55190
55232
|
} = options;
|
55191
55233
|
let timer;
|
55234
|
+
let abortHandler;
|
55192
55235
|
const wrappedPromise = new Promise((resolve, reject) => {
|
55193
55236
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
55194
55237
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
55195
55238
|
}
|
55196
|
-
if (
|
55197
|
-
|
55198
|
-
|
55199
|
-
|
55200
|
-
|
55201
|
-
|
55239
|
+
if (signal?.aborted) {
|
55240
|
+
reject(getAbortedReason(signal));
|
55241
|
+
return;
|
55242
|
+
}
|
55243
|
+
if (signal) {
|
55244
|
+
abortHandler = () => {
|
55202
55245
|
reject(getAbortedReason(signal));
|
55203
|
-
}
|
55246
|
+
};
|
55247
|
+
signal.addEventListener("abort", abortHandler, { once: true });
|
55204
55248
|
}
|
55249
|
+
promise.then(resolve, reject);
|
55205
55250
|
if (milliseconds === Number.POSITIVE_INFINITY) {
|
55206
|
-
promise.then(resolve, reject);
|
55207
55251
|
return;
|
55208
55252
|
}
|
55209
55253
|
const timeoutError2 = new TimeoutError();
|
55210
|
-
timer = customTimers.setTimeout
|
55254
|
+
timer = customTimers.setTimeout(() => {
|
55211
55255
|
if (fallback) {
|
55212
55256
|
try {
|
55213
55257
|
resolve(fallback());
|
@@ -55228,25 +55272,21 @@ function pTimeout(promise, options) {
|
|
55228
55272
|
reject(timeoutError2);
|
55229
55273
|
}
|
55230
55274
|
}, milliseconds);
|
55231
|
-
(async () => {
|
55232
|
-
try {
|
55233
|
-
resolve(await promise);
|
55234
|
-
} catch (error) {
|
55235
|
-
reject(error);
|
55236
|
-
}
|
55237
|
-
})();
|
55238
55275
|
});
|
55239
55276
|
const cancelablePromise = wrappedPromise.finally(() => {
|
55240
55277
|
cancelablePromise.clear();
|
55278
|
+
if (abortHandler && signal) {
|
55279
|
+
signal.removeEventListener("abort", abortHandler);
|
55280
|
+
}
|
55241
55281
|
});
|
55242
55282
|
cancelablePromise.clear = () => {
|
55243
|
-
customTimers.clearTimeout
|
55283
|
+
customTimers.clearTimeout(timer);
|
55244
55284
|
timer = void 0;
|
55245
55285
|
};
|
55246
55286
|
return cancelablePromise;
|
55247
55287
|
}
|
55248
55288
|
|
55249
|
-
// ../../node_modules/.pnpm/p-queue@
|
55289
|
+
// ../../node_modules/.pnpm/p-queue@9.0.0/node_modules/p-queue/dist/lower-bound.js
|
55250
55290
|
function lowerBound(array, value, comparator) {
|
55251
55291
|
let first = 0;
|
55252
55292
|
let count = array.length;
|
@@ -55263,25 +55303,31 @@ function lowerBound(array, value, comparator) {
|
|
55263
55303
|
return first;
|
55264
55304
|
}
|
55265
55305
|
|
55266
|
-
// ../../node_modules/.pnpm/p-queue@
|
55306
|
+
// ../../node_modules/.pnpm/p-queue@9.0.0/node_modules/p-queue/dist/priority-queue.js
|
55267
55307
|
var PriorityQueue = class {
|
55268
55308
|
#queue = [];
|
55269
55309
|
enqueue(run2, options) {
|
55270
|
-
|
55271
|
-
priority: 0,
|
55272
|
-
...options
|
55273
|
-
};
|
55310
|
+
const { priority = 0, id: id2 } = options ?? {};
|
55274
55311
|
const element = {
|
55275
|
-
priority
|
55312
|
+
priority,
|
55313
|
+
id: id2,
|
55276
55314
|
run: run2
|
55277
55315
|
};
|
55278
|
-
if (this.size
|
55316
|
+
if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {
|
55279
55317
|
this.#queue.push(element);
|
55280
55318
|
return;
|
55281
55319
|
}
|
55282
55320
|
const index = lowerBound(this.#queue, element, (a, b2) => b2.priority - a.priority);
|
55283
55321
|
this.#queue.splice(index, 0, element);
|
55284
55322
|
}
|
55323
|
+
setPriority(id2, priority) {
|
55324
|
+
const index = this.#queue.findIndex((element) => element.id === id2);
|
55325
|
+
if (index === -1) {
|
55326
|
+
throw new ReferenceError(`No promise function with the id "${id2}" exists in the queue.`);
|
55327
|
+
}
|
55328
|
+
const [item] = this.#queue.splice(index, 1);
|
55329
|
+
this.enqueue(item.run, { priority, id: id2 });
|
55330
|
+
}
|
55285
55331
|
dequeue() {
|
55286
55332
|
const item = this.#queue.shift();
|
55287
55333
|
return item?.run;
|
@@ -55294,14 +55340,17 @@ var PriorityQueue = class {
|
|
55294
55340
|
}
|
55295
55341
|
};
|
55296
55342
|
|
55297
|
-
// ../../node_modules/.pnpm/p-queue@
|
55343
|
+
// ../../node_modules/.pnpm/p-queue@9.0.0/node_modules/p-queue/dist/index.js
|
55298
55344
|
var PQueue = class extends import_index.default {
|
55299
|
-
#
|
55345
|
+
#carryoverIntervalCount;
|
55300
55346
|
#isIntervalIgnored;
|
55301
55347
|
#intervalCount = 0;
|
55302
55348
|
#intervalCap;
|
55349
|
+
#rateLimitedInInterval = false;
|
55350
|
+
#rateLimitFlushScheduled = false;
|
55303
55351
|
#interval;
|
55304
55352
|
#intervalEnd = 0;
|
55353
|
+
#lastExecutionTime = 0;
|
55305
55354
|
#intervalId;
|
55306
55355
|
#timeoutId;
|
55307
55356
|
#queue;
|
@@ -55310,18 +55359,30 @@ var PQueue = class extends import_index.default {
|
|
55310
55359
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
55311
55360
|
#concurrency;
|
55312
55361
|
#isPaused;
|
55313
|
-
|
55362
|
+
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
55363
|
+
#idAssigner = 1n;
|
55364
|
+
// Track currently running tasks for debugging
|
55365
|
+
#runningTasks = /* @__PURE__ */ new Map();
|
55314
55366
|
/**
|
55315
|
-
|
55367
|
+
Get or set the default timeout for all tasks. Can be changed at runtime.
|
55368
|
+
|
55369
|
+
Operations will throw a `TimeoutError` if they don't complete within the specified time.
|
55370
|
+
|
55371
|
+
The timeout begins when the operation is dequeued and starts execution, not while it's waiting in the queue.
|
55316
55372
|
|
55317
|
-
|
55373
|
+
@example
|
55374
|
+
```
|
55375
|
+
const queue = new PQueue({timeout: 5000});
|
55376
|
+
|
55377
|
+
// Change timeout for all future tasks
|
55378
|
+
queue.timeout = 10000;
|
55379
|
+
```
|
55318
55380
|
*/
|
55319
55381
|
timeout;
|
55320
|
-
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
55321
55382
|
constructor(options) {
|
55322
55383
|
super();
|
55323
55384
|
options = {
|
55324
|
-
|
55385
|
+
carryoverIntervalCount: false,
|
55325
55386
|
intervalCap: Number.POSITIVE_INFINITY,
|
55326
55387
|
interval: 0,
|
55327
55388
|
concurrency: Number.POSITIVE_INFINITY,
|
@@ -55335,16 +55396,19 @@ var PQueue = class extends import_index.default {
|
|
55335
55396
|
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
55336
55397
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${options.interval?.toString() ?? ""}\` (${typeof options.interval})`);
|
55337
55398
|
}
|
55338
|
-
this.#
|
55399
|
+
this.#carryoverIntervalCount = options.carryoverIntervalCount ?? options.carryoverConcurrencyCount ?? false;
|
55339
55400
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
55340
55401
|
this.#intervalCap = options.intervalCap;
|
55341
55402
|
this.#interval = options.interval;
|
55342
55403
|
this.#queue = new options.queueClass();
|
55343
55404
|
this.#queueClass = options.queueClass;
|
55344
55405
|
this.concurrency = options.concurrency;
|
55406
|
+
if (options.timeout !== void 0 && !(Number.isFinite(options.timeout) && options.timeout > 0)) {
|
55407
|
+
throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${options.timeout}\` (${typeof options.timeout})`);
|
55408
|
+
}
|
55345
55409
|
this.timeout = options.timeout;
|
55346
|
-
this.#throwOnTimeout = options.throwOnTimeout === true;
|
55347
55410
|
this.#isPaused = options.autoStart === false;
|
55411
|
+
this.#setupRateLimitTracking();
|
55348
55412
|
}
|
55349
55413
|
get #doesIntervalAllowAnother() {
|
55350
55414
|
return this.#isIntervalIgnored || this.#intervalCount < this.#intervalCap;
|
@@ -55354,6 +55418,9 @@ var PQueue = class extends import_index.default {
|
|
55354
55418
|
}
|
55355
55419
|
#next() {
|
55356
55420
|
this.#pending--;
|
55421
|
+
if (this.#pending === 0) {
|
55422
|
+
this.emit("pendingZero");
|
55423
|
+
}
|
55357
55424
|
this.#tryToStartAnother();
|
55358
55425
|
this.emit("next");
|
55359
55426
|
}
|
@@ -55367,46 +55434,70 @@ var PQueue = class extends import_index.default {
|
|
55367
55434
|
if (this.#intervalId === void 0) {
|
55368
55435
|
const delay2 = this.#intervalEnd - now;
|
55369
55436
|
if (delay2 < 0) {
|
55370
|
-
|
55371
|
-
|
55372
|
-
|
55373
|
-
|
55374
|
-
|
55375
|
-
}
|
55437
|
+
if (this.#lastExecutionTime > 0) {
|
55438
|
+
const timeSinceLastExecution = now - this.#lastExecutionTime;
|
55439
|
+
if (timeSinceLastExecution < this.#interval) {
|
55440
|
+
this.#createIntervalTimeout(this.#interval - timeSinceLastExecution);
|
55441
|
+
return true;
|
55442
|
+
}
|
55376
55443
|
}
|
55444
|
+
this.#intervalCount = this.#carryoverIntervalCount ? this.#pending : 0;
|
55445
|
+
} else {
|
55446
|
+
this.#createIntervalTimeout(delay2);
|
55377
55447
|
return true;
|
55378
55448
|
}
|
55379
55449
|
}
|
55380
55450
|
return false;
|
55381
55451
|
}
|
55452
|
+
#createIntervalTimeout(delay2) {
|
55453
|
+
if (this.#timeoutId !== void 0) {
|
55454
|
+
return;
|
55455
|
+
}
|
55456
|
+
this.#timeoutId = setTimeout(() => {
|
55457
|
+
this.#onResumeInterval();
|
55458
|
+
}, delay2);
|
55459
|
+
}
|
55460
|
+
#clearIntervalTimer() {
|
55461
|
+
if (this.#intervalId) {
|
55462
|
+
clearInterval(this.#intervalId);
|
55463
|
+
this.#intervalId = void 0;
|
55464
|
+
}
|
55465
|
+
}
|
55466
|
+
#clearTimeoutTimer() {
|
55467
|
+
if (this.#timeoutId) {
|
55468
|
+
clearTimeout(this.#timeoutId);
|
55469
|
+
this.#timeoutId = void 0;
|
55470
|
+
}
|
55471
|
+
}
|
55382
55472
|
#tryToStartAnother() {
|
55383
55473
|
if (this.#queue.size === 0) {
|
55384
|
-
|
55385
|
-
clearInterval(this.#intervalId);
|
55386
|
-
}
|
55387
|
-
this.#intervalId = void 0;
|
55474
|
+
this.#clearIntervalTimer();
|
55388
55475
|
this.emit("empty");
|
55389
55476
|
if (this.#pending === 0) {
|
55477
|
+
this.#clearTimeoutTimer();
|
55390
55478
|
this.emit("idle");
|
55391
55479
|
}
|
55392
55480
|
return false;
|
55393
55481
|
}
|
55482
|
+
let taskStarted = false;
|
55394
55483
|
if (!this.#isPaused) {
|
55395
55484
|
const canInitializeInterval = !this.#isIntervalPaused;
|
55396
55485
|
if (this.#doesIntervalAllowAnother && this.#doesConcurrentAllowAnother) {
|
55397
55486
|
const job = this.#queue.dequeue();
|
55398
|
-
if (!
|
55399
|
-
|
55487
|
+
if (!this.#isIntervalIgnored) {
|
55488
|
+
this.#intervalCount++;
|
55489
|
+
this.#scheduleRateLimitUpdate();
|
55400
55490
|
}
|
55401
55491
|
this.emit("active");
|
55492
|
+
this.#lastExecutionTime = Date.now();
|
55402
55493
|
job();
|
55403
55494
|
if (canInitializeInterval) {
|
55404
55495
|
this.#initializeIntervalIfNeeded();
|
55405
55496
|
}
|
55406
|
-
|
55497
|
+
taskStarted = true;
|
55407
55498
|
}
|
55408
55499
|
}
|
55409
|
-
return
|
55500
|
+
return taskStarted;
|
55410
55501
|
}
|
55411
55502
|
#initializeIntervalIfNeeded() {
|
55412
55503
|
if (this.#isIntervalIgnored || this.#intervalId !== void 0) {
|
@@ -55419,11 +55510,11 @@ var PQueue = class extends import_index.default {
|
|
55419
55510
|
}
|
55420
55511
|
#onInterval() {
|
55421
55512
|
if (this.#intervalCount === 0 && this.#pending === 0 && this.#intervalId) {
|
55422
|
-
|
55423
|
-
this.#intervalId = void 0;
|
55513
|
+
this.#clearIntervalTimer();
|
55424
55514
|
}
|
55425
|
-
this.#intervalCount = this.#
|
55515
|
+
this.#intervalCount = this.#carryoverIntervalCount ? this.#pending : 0;
|
55426
55516
|
this.#processQueue();
|
55517
|
+
this.#scheduleRateLimitUpdate();
|
55427
55518
|
}
|
55428
55519
|
/**
|
55429
55520
|
Executes all queued functions until it reaches the limit.
|
@@ -55449,21 +55540,81 @@ var PQueue = class extends import_index.default {
|
|
55449
55540
|
}, { once: true });
|
55450
55541
|
});
|
55451
55542
|
}
|
55543
|
+
/**
|
55544
|
+
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
55545
|
+
|
55546
|
+
For example, this can be used to prioritize a promise function to run earlier.
|
55547
|
+
|
55548
|
+
```js
|
55549
|
+
import PQueue from 'p-queue';
|
55550
|
+
|
55551
|
+
const queue = new PQueue({concurrency: 1});
|
55552
|
+
|
55553
|
+
queue.add(async () => '🦄', {priority: 1});
|
55554
|
+
queue.add(async () => '🦀', {priority: 0, id: '🦀'});
|
55555
|
+
queue.add(async () => '🦄', {priority: 1});
|
55556
|
+
queue.add(async () => '🦄', {priority: 1});
|
55557
|
+
|
55558
|
+
queue.setPriority('🦀', 2);
|
55559
|
+
```
|
55560
|
+
|
55561
|
+
In this case, the promise function with `id: '🦀'` runs second.
|
55562
|
+
|
55563
|
+
You can also deprioritize a promise function to delay its execution:
|
55564
|
+
|
55565
|
+
```js
|
55566
|
+
import PQueue from 'p-queue';
|
55567
|
+
|
55568
|
+
const queue = new PQueue({concurrency: 1});
|
55569
|
+
|
55570
|
+
queue.add(async () => '🦄', {priority: 1});
|
55571
|
+
queue.add(async () => '🦀', {priority: 1, id: '🦀'});
|
55572
|
+
queue.add(async () => '🦄');
|
55573
|
+
queue.add(async () => '🦄', {priority: 0});
|
55574
|
+
|
55575
|
+
queue.setPriority('🦀', -1);
|
55576
|
+
```
|
55577
|
+
Here, the promise function with `id: '🦀'` executes last.
|
55578
|
+
*/
|
55579
|
+
setPriority(id2, priority) {
|
55580
|
+
if (typeof priority !== "number" || !Number.isFinite(priority)) {
|
55581
|
+
throw new TypeError(`Expected \`priority\` to be a finite number, got \`${priority}\` (${typeof priority})`);
|
55582
|
+
}
|
55583
|
+
this.#queue.setPriority(id2, priority);
|
55584
|
+
}
|
55452
55585
|
async add(function_, options = {}) {
|
55586
|
+
options.id ??= (this.#idAssigner++).toString();
|
55453
55587
|
options = {
|
55454
55588
|
timeout: this.timeout,
|
55455
|
-
throwOnTimeout: this.#throwOnTimeout,
|
55456
55589
|
...options
|
55457
55590
|
};
|
55458
55591
|
return new Promise((resolve, reject) => {
|
55592
|
+
const taskSymbol = Symbol(`task-${options.id}`);
|
55459
55593
|
this.#queue.enqueue(async () => {
|
55460
55594
|
this.#pending++;
|
55461
|
-
this.#
|
55595
|
+
this.#runningTasks.set(taskSymbol, {
|
55596
|
+
id: options.id,
|
55597
|
+
priority: options.priority ?? 0,
|
55598
|
+
// Match priority-queue default
|
55599
|
+
startTime: Date.now(),
|
55600
|
+
timeout: options.timeout
|
55601
|
+
});
|
55462
55602
|
try {
|
55463
|
-
|
55603
|
+
try {
|
55604
|
+
options.signal?.throwIfAborted();
|
55605
|
+
} catch (error) {
|
55606
|
+
if (!this.#isIntervalIgnored) {
|
55607
|
+
this.#intervalCount--;
|
55608
|
+
}
|
55609
|
+
this.#runningTasks.delete(taskSymbol);
|
55610
|
+
throw error;
|
55611
|
+
}
|
55464
55612
|
let operation = function_({ signal: options.signal });
|
55465
55613
|
if (options.timeout) {
|
55466
|
-
operation = pTimeout(Promise.resolve(operation), {
|
55614
|
+
operation = pTimeout(Promise.resolve(operation), {
|
55615
|
+
milliseconds: options.timeout,
|
55616
|
+
message: `Task timed out after ${options.timeout}ms (queue has ${this.#pending} running, ${this.#queue.size} waiting)`
|
55617
|
+
});
|
55467
55618
|
}
|
55468
55619
|
if (options.signal) {
|
55469
55620
|
operation = Promise.race([operation, this.#throwOnAbort(options.signal)]);
|
@@ -55472,14 +55623,13 @@ var PQueue = class extends import_index.default {
|
|
55472
55623
|
resolve(result);
|
55473
55624
|
this.emit("completed", result);
|
55474
55625
|
} catch (error) {
|
55475
|
-
if (error instanceof TimeoutError && !options.throwOnTimeout) {
|
55476
|
-
resolve();
|
55477
|
-
return;
|
55478
|
-
}
|
55479
55626
|
reject(error);
|
55480
55627
|
this.emit("error", error);
|
55481
55628
|
} finally {
|
55482
|
-
this.#
|
55629
|
+
this.#runningTasks.delete(taskSymbol);
|
55630
|
+
queueMicrotask(() => {
|
55631
|
+
this.#next();
|
55632
|
+
});
|
55483
55633
|
}
|
55484
55634
|
}, options);
|
55485
55635
|
this.emit("add");
|
@@ -55511,6 +55661,7 @@ var PQueue = class extends import_index.default {
|
|
55511
55661
|
*/
|
55512
55662
|
clear() {
|
55513
55663
|
this.#queue = new this.#queueClass();
|
55664
|
+
this.#updateRateLimitState();
|
55514
55665
|
}
|
55515
55666
|
/**
|
55516
55667
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
@@ -55547,6 +55698,74 @@ var PQueue = class extends import_index.default {
|
|
55547
55698
|
}
|
55548
55699
|
await this.#onEvent("idle");
|
55549
55700
|
}
|
55701
|
+
/**
|
55702
|
+
The difference with `.onIdle` is that `.onPendingZero` only waits for currently running tasks to finish, ignoring queued tasks.
|
55703
|
+
|
55704
|
+
@returns A promise that settles when all currently running tasks have completed; `queue.pending === 0`.
|
55705
|
+
*/
|
55706
|
+
async onPendingZero() {
|
55707
|
+
if (this.#pending === 0) {
|
55708
|
+
return;
|
55709
|
+
}
|
55710
|
+
await this.#onEvent("pendingZero");
|
55711
|
+
}
|
55712
|
+
/**
|
55713
|
+
@returns A promise that settles when the queue becomes rate-limited due to intervalCap.
|
55714
|
+
*/
|
55715
|
+
async onRateLimit() {
|
55716
|
+
if (this.isRateLimited) {
|
55717
|
+
return;
|
55718
|
+
}
|
55719
|
+
await this.#onEvent("rateLimit");
|
55720
|
+
}
|
55721
|
+
/**
|
55722
|
+
@returns A promise that settles when the queue is no longer rate-limited.
|
55723
|
+
*/
|
55724
|
+
async onRateLimitCleared() {
|
55725
|
+
if (!this.isRateLimited) {
|
55726
|
+
return;
|
55727
|
+
}
|
55728
|
+
await this.#onEvent("rateLimitCleared");
|
55729
|
+
}
|
55730
|
+
/**
|
55731
|
+
@returns A promise that rejects when any task in the queue errors.
|
55732
|
+
|
55733
|
+
Use with `Promise.race([queue.onError(), queue.onIdle()])` to fail fast on the first error while still resolving normally when the queue goes idle.
|
55734
|
+
|
55735
|
+
Important: The promise returned by `add()` still rejects. You must handle each `add()` promise (for example, `.catch(() => {})`) to avoid unhandled rejections.
|
55736
|
+
|
55737
|
+
@example
|
55738
|
+
```
|
55739
|
+
import PQueue from 'p-queue';
|
55740
|
+
|
55741
|
+
const queue = new PQueue({concurrency: 2});
|
55742
|
+
|
55743
|
+
queue.add(() => fetchData(1)).catch(() => {});
|
55744
|
+
queue.add(() => fetchData(2)).catch(() => {});
|
55745
|
+
queue.add(() => fetchData(3)).catch(() => {});
|
55746
|
+
|
55747
|
+
// Stop processing on first error
|
55748
|
+
try {
|
55749
|
+
await Promise.race([
|
55750
|
+
queue.onError(),
|
55751
|
+
queue.onIdle()
|
55752
|
+
]);
|
55753
|
+
} catch (error) {
|
55754
|
+
queue.pause(); // Stop processing remaining tasks
|
55755
|
+
console.error('Queue failed:', error);
|
55756
|
+
}
|
55757
|
+
```
|
55758
|
+
*/
|
55759
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
55760
|
+
async onError() {
|
55761
|
+
return new Promise((_resolve, reject) => {
|
55762
|
+
const handleError = (error) => {
|
55763
|
+
this.off("error", handleError);
|
55764
|
+
reject(error);
|
55765
|
+
};
|
55766
|
+
this.on("error", handleError);
|
55767
|
+
});
|
55768
|
+
}
|
55550
55769
|
async #onEvent(event, filter) {
|
55551
55770
|
return new Promise((resolve) => {
|
55552
55771
|
const listener = () => {
|
@@ -55585,6 +55804,104 @@ var PQueue = class extends import_index.default {
|
|
55585
55804
|
get isPaused() {
|
55586
55805
|
return this.#isPaused;
|
55587
55806
|
}
|
55807
|
+
#setupRateLimitTracking() {
|
55808
|
+
if (this.#isIntervalIgnored) {
|
55809
|
+
return;
|
55810
|
+
}
|
55811
|
+
this.on("add", () => {
|
55812
|
+
if (this.#queue.size > 0) {
|
55813
|
+
this.#scheduleRateLimitUpdate();
|
55814
|
+
}
|
55815
|
+
});
|
55816
|
+
this.on("next", () => {
|
55817
|
+
this.#scheduleRateLimitUpdate();
|
55818
|
+
});
|
55819
|
+
}
|
55820
|
+
#scheduleRateLimitUpdate() {
|
55821
|
+
if (this.#isIntervalIgnored || this.#rateLimitFlushScheduled) {
|
55822
|
+
return;
|
55823
|
+
}
|
55824
|
+
this.#rateLimitFlushScheduled = true;
|
55825
|
+
queueMicrotask(() => {
|
55826
|
+
this.#rateLimitFlushScheduled = false;
|
55827
|
+
this.#updateRateLimitState();
|
55828
|
+
});
|
55829
|
+
}
|
55830
|
+
#updateRateLimitState() {
|
55831
|
+
const previous = this.#rateLimitedInInterval;
|
55832
|
+
const shouldBeRateLimited = !this.#isIntervalIgnored && this.#intervalCount >= this.#intervalCap && this.#queue.size > 0;
|
55833
|
+
if (shouldBeRateLimited !== previous) {
|
55834
|
+
this.#rateLimitedInInterval = shouldBeRateLimited;
|
55835
|
+
this.emit(shouldBeRateLimited ? "rateLimit" : "rateLimitCleared");
|
55836
|
+
}
|
55837
|
+
}
|
55838
|
+
/**
|
55839
|
+
Whether the queue is currently rate-limited due to intervalCap.
|
55840
|
+
*/
|
55841
|
+
get isRateLimited() {
|
55842
|
+
return this.#rateLimitedInInterval;
|
55843
|
+
}
|
55844
|
+
/**
|
55845
|
+
Whether the queue is saturated. Returns `true` when:
|
55846
|
+
- All concurrency slots are occupied and tasks are waiting, OR
|
55847
|
+
- The queue is rate-limited and tasks are waiting
|
55848
|
+
|
55849
|
+
Useful for detecting backpressure and potential hanging tasks.
|
55850
|
+
|
55851
|
+
```js
|
55852
|
+
import PQueue from 'p-queue';
|
55853
|
+
|
55854
|
+
const queue = new PQueue({concurrency: 2});
|
55855
|
+
|
55856
|
+
// Backpressure handling
|
55857
|
+
if (queue.isSaturated) {
|
55858
|
+
console.log('Queue is saturated, waiting for capacity...');
|
55859
|
+
await queue.onSizeLessThan(queue.concurrency);
|
55860
|
+
}
|
55861
|
+
|
55862
|
+
// Monitoring for stuck tasks
|
55863
|
+
setInterval(() => {
|
55864
|
+
if (queue.isSaturated) {
|
55865
|
+
console.warn(`Queue saturated: ${queue.pending} running, ${queue.size} waiting`);
|
55866
|
+
}
|
55867
|
+
}, 60000);
|
55868
|
+
```
|
55869
|
+
*/
|
55870
|
+
get isSaturated() {
|
55871
|
+
return this.#pending === this.#concurrency && this.#queue.size > 0 || this.isRateLimited && this.#queue.size > 0;
|
55872
|
+
}
|
55873
|
+
/**
|
55874
|
+
The tasks currently being executed. Each task includes its `id`, `priority`, `startTime`, and `timeout` (if set).
|
55875
|
+
|
55876
|
+
Returns an array of task info objects.
|
55877
|
+
|
55878
|
+
```js
|
55879
|
+
import PQueue from 'p-queue';
|
55880
|
+
|
55881
|
+
const queue = new PQueue({concurrency: 2});
|
55882
|
+
|
55883
|
+
// Add tasks with IDs for better debugging
|
55884
|
+
queue.add(() => fetchUser(123), {id: 'user-123'});
|
55885
|
+
queue.add(() => fetchPosts(456), {id: 'posts-456', priority: 1});
|
55886
|
+
|
55887
|
+
// Check what's running
|
55888
|
+
console.log(queue.runningTasks);
|
55889
|
+
// => [{
|
55890
|
+
// id: 'user-123',
|
55891
|
+
// priority: 0,
|
55892
|
+
// startTime: 1759253001716,
|
55893
|
+
// timeout: undefined
|
55894
|
+
// }, {
|
55895
|
+
// id: 'posts-456',
|
55896
|
+
// priority: 1,
|
55897
|
+
// startTime: 1759253001916,
|
55898
|
+
// timeout: undefined
|
55899
|
+
// }]
|
55900
|
+
```
|
55901
|
+
*/
|
55902
|
+
get runningTasks() {
|
55903
|
+
return [...this.#runningTasks.values()].map((task) => ({ ...task }));
|
55904
|
+
}
|
55588
55905
|
};
|
55589
55906
|
|
55590
55907
|
// src/provider.ts
|
@@ -57329,7 +57646,7 @@ function toLength(value) {
|
|
57329
57646
|
}
|
57330
57647
|
|
57331
57648
|
// ../../node_modules/.pnpm/ix@7.0.0/node_modules/ix/aborterror.mjs
|
57332
|
-
var
|
57649
|
+
var AbortError2 = class _AbortError extends Error {
|
57333
57650
|
constructor(message = "The operation has been aborted") {
|
57334
57651
|
super(message);
|
57335
57652
|
Object.setPrototypeOf(this, _AbortError.prototype);
|
@@ -57342,10 +57659,10 @@ var AbortError3 = class _AbortError extends Error {
|
|
57342
57659
|
};
|
57343
57660
|
function throwIfAborted2(signal) {
|
57344
57661
|
if (signal && signal.aborted) {
|
57345
|
-
throw new
|
57662
|
+
throw new AbortError2();
|
57346
57663
|
}
|
57347
57664
|
}
|
57348
|
-
Object.defineProperty(
|
57665
|
+
Object.defineProperty(AbortError2, Symbol.hasInstance, {
|
57349
57666
|
writable: true,
|
57350
57667
|
configurable: true,
|
57351
57668
|
value(x) {
|
@@ -57603,7 +57920,7 @@ var FromObservableAsyncIterable = class extends AsyncIterableX {
|
|
57603
57920
|
}
|
57604
57921
|
});
|
57605
57922
|
function onAbort() {
|
57606
|
-
sink.error(new
|
57923
|
+
sink.error(new AbortError2());
|
57607
57924
|
}
|
57608
57925
|
if (signal) {
|
57609
57926
|
signal.addEventListener("abort", onAbort);
|
@@ -59780,4 +60097,4 @@ long/umd/index.js:
|
|
59780
60097
|
@noble/curves/esm/secp256k1.js:
|
59781
60098
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
59782
60099
|
*/
|
59783
|
-
//# sourceMappingURL=chunk-
|
60100
|
+
//# sourceMappingURL=chunk-FQYIWDRC.js.map
|