@dodoex/api 3.5.0 → 3.6.0
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.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arbsepolia as e,plume as t,plumeTestnet as n,neox as r,morph as i,riseTestnet as s,nero as o,bitlayer as a,zircuitMainnet as l,xLayer as c,zeroMainnet as u,hashkey as d,hemi as h,pharosTestnet as f,pharosAtlanticTestnet as p,stableTestnet as m,stable as g,fetchUniswapV2PairTotalSupply as y,fetchUniswapV2PairBalanceOf as A,fetchUniswapV2PairGetReserves as E,getUniswapV2Router02ContractAddressByChainId as b,getUniswapV2FactoryContractAddressByChainId as v,fetchUniswapV2PairFeeRate as w}from"@dodoex/dodo-contract-request";export{setContractRequests}from"@dodoex/dodo-contract-request";import O from"js-sha3";import D from"bn.js";import T from"hash.js";import P from"bech32";import{chunk as _,merge as R}from"lodash";import I,{BigNumber as C}from"bignumber.js";import*as B from"cross-fetch";import k from"cross-fetch";import N from"qs";import{formatUnits as x}from"@dodoex/contract-request";var S;!function(e){e[e.MAINNET=1]="MAINNET",e[e.GOERLI=5]="GOERLI",e[e.SEPOLIA=11155111]="SEPOLIA",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.ARBITRUM_ONE=42161]="ARBITRUM_ONE",e[e.ARBITRUM_SEPOLIA=421614]="ARBITRUM_SEPOLIA",e[e.AURORA=1313161554]="AURORA",e[e.OKCHAIN=66]="OKCHAIN",e[e.OPTIMISM=10]="OPTIMISM",e[e.AVALANCHE=43114]="AVALANCHE",e[e.CONFLUX=1030]="CONFLUX",e[e.BASE=8453]="BASE",e[e.LINEA=59144]="LINEA",e[e.SCROLL=534352]="SCROLL",e[e.MANTA=169]="MANTA",e[e.MANTLE=5e3]="MANTLE",e[e.DODO_CHAIN_TESTNET=53457]="DODO_CHAIN_TESTNET",e[e.TAIKO=167e3]="TAIKO",e[e.PLUME=98866]="PLUME",e[e.PLUME_TESTNET=98864]="PLUME_TESTNET",e[e.NEOX=47763]="NEOX",e[e.MORPH=2818]="MORPH",e[e.RISE_TESTNET=11155931]="RISE_TESTNET",e[e.NEROCHAIN=1689]="NEROCHAIN",e[e.BITLAYER=200901]="BITLAYER",e[e.ZIRCUIT=48900]="ZIRCUIT",e[e.X_LAYER=196]="X_LAYER",e[e.ZERO=543210]="ZERO",e[e.HASHKEY=177]="HASHKEY",e[e.HEMI=43111]="HEMI",e[e.PHAROS_TESTNET=688688]="PHAROS_TESTNET",e[e.PHAROS_ATLANTIC_TESTNET=688689]="PHAROS_ATLANTIC_TESTNET",e[e.STABLE_TESTNET=2201]="STABLE_TESTNET",e[e.STABLE=988]="STABLE"}(S||(S={}));const L="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",F={symbol:"ETH",address:L,name:"Ether",decimals:18,showDecimals:4,wrappedTokenSymbol:"WETH"},M={[S.MAINNET]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}),[S.GOERLI]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6"}),[S.SEPOLIA]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x7B07164ecFaF0F0D85DFC062Bc205a4674c75Aa0"}),[S.OPTIMISM]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.CONFLUX]:Object.assign(Object.assign({},F),{symbol:"CFX",name:"CFX",wrappedTokenSymbol:"WCFX",wrappedTokenAddress:"0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b"}),[S.BSC]:Object.assign(Object.assign({},F),{symbol:"BNB",name:"BNB",wrappedTokenSymbol:"WBNB",wrappedTokenAddress:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}),[S.OKCHAIN]:Object.assign(Object.assign({},F),{symbol:"OKT",name:"OKT",wrappedTokenSymbol:"WOKT",wrappedTokenAddress:"0x8F8526dbfd6E38E3D8307702cA8469Bae6C56C15"}),[S.POLYGON]:Object.assign(Object.assign({},F),{symbol:"MATIC",name:"MATIC",showDecimals:6,wrappedTokenSymbol:"WMATIC",wrappedTokenAddress:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"}),[S.ARBITRUM_ONE]:Object.assign(Object.assign({},F),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"}),[S.ARBITRUM_SEPOLIA]:Object.assign(Object.assign({},F),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0xfd6fFee92D25158b29315C71b0Bb4dE727530FaF"}),[S.AURORA]:Object.assign(Object.assign({},F),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB"}),[S.AVALANCHE]:Object.assign(Object.assign({},F),{symbol:"AVAX",name:"Avalanche",showDecimals:6,wrappedTokenSymbol:"WAVAX",wrappedTokenAddress:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"}),[S.BASE]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.LINEA]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f"}),[S.SCROLL]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x5300000000000000000000000000000000000004"}),[S.MANTA]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x0Dc808adcE2099A9F62AA87D9670745AbA741746"}),[S.MANTLE]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WMNT",wrappedTokenAddress:"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8"}),[S.DODO_CHAIN_TESTNET]:Object.assign(Object.assign({},F),{symbol:"dodo",name:"Wrapped Berd",wrappedTokenSymbol:"WBERD",wrappedTokenAddress:"0x3a64Ec3606FF7310E8fAd6FcC008e39705fB496d"}),[S.TAIKO]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xA51894664A773981C6C112C43ce576f315d5b1B6"}),[S.PLUME]:Object.assign(Object.assign({},F),{symbol:"PLUME",name:"PLUME",wrappedTokenSymbol:"WPLUME",wrappedTokenAddress:"0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1"}),[S.PLUME_TESTNET]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xaA6210015fbf0855F0D9fDA3C415c1B12776Ae74"}),[S.NEOX]:Object.assign(Object.assign({},F),{symbol:"GAS",name:"GAS",showDecimals:6,wrappedTokenSymbol:"WGAS10",wrappedTokenAddress:"0xdE41591ED1f8ED1484aC2CD8ca0876428de60EfF"}),[S.MORPH]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x5300000000000000000000000000000000000011"}),[S.RISE_TESTNET]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.NEROCHAIN]:Object.assign(Object.assign({},F),{symbol:"NERO",name:"NERO",wrappedTokenSymbol:"WNERO",wrappedTokenAddress:"0x252ba4a6efb0d91bd7108d91a067c14592a56f17"}),[S.BITLAYER]:Object.assign(Object.assign({},F),{symbol:"BTC",name:"BTC",wrappedTokenSymbol:"WBTC",wrappedTokenAddress:"0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f"}),[S.ZIRCUIT]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.X_LAYER]:Object.assign(Object.assign({},F),{symbol:"OKB",name:"OKB",wrappedTokenSymbol:"WOKB",wrappedTokenAddress:"0xe538905cf8410324e03a5a23c1c177a474d59b2b"}),[S.ZERO]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xAc98B49576B1C892ba6BFae08fE1BB0d80Cf599c"}),[S.HASHKEY]:Object.assign(Object.assign({},F),{symbol:"HSK",name:"HSK",wrappedTokenSymbol:"WHSK",wrappedTokenAddress:"0xB210D2120d57b758EE163cFfb43e73728c471Cf1"}),[S.HEMI]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.PHAROS_TESTNET]:Object.assign(Object.assign({},F),{symbol:"PHRS",name:"PHRS",wrappedTokenSymbol:"WPHRS",wrappedTokenAddress:"0x3019b247381c850ab53dc0ee53bce7a07ea9155f"}),[S.PHAROS_ATLANTIC_TESTNET]:Object.assign(Object.assign({},F),{symbol:"PHRS",name:"PHRS",wrappedTokenSymbol:"WPHRS",wrappedTokenAddress:"0x838800b758277cc111b2d48ab01e5e164f8e9471"}),[S.STABLE_TESTNET]:Object.assign(Object.assign({},F),{symbol:"gUSDT",name:"gUSDT",wrappedTokenSymbol:"wgUSDT",wrappedTokenAddress:"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb"}),[S.STABLE]:{address:L,decimals:18,showDecimals:4,symbol:"gUSDT",name:"gUSDT",wrappedTokenSymbol:"USDT0",wrappedTokenAddress:"0x779Ded0c9e1022225f8E0630b35a9b54bE713736"}},q={[S.MAINNET]:{MULTI_CALL:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",DODO_APPROVE:"0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149",ERC20_HELPER:"0x4F99cba8aAEad26fc970dc6CC4ea435779Fa9016",ROUTE_V2_DATA_FETCH:"0x9337cA090c390667984869193e10c3D4f9a17da8",ROUTE_V1_DATA_FETCH:"0x6373ceB657C83C91088d328622573FB766064Ac4",CALLEE_HELPER:"0x45a7E2E9D780613E047f7e78a9d3902ff854B522",DODO_PROXY:"0xa356867fDCEa8e71AEaF87805808803806231FdC",DODO_DSP_PROXY:"0x4599ed18F34cFE06820E3684bF0aACB8D75c644d",DODO_DPP_PROXY:"0xfF7C8F518e6f1435957ed3d3E0692C94676dAE7a",DODO_V1_PAIR_PROXY:"0x8dD0Fea5FA2f7df535F87f312641Cc15d8B151BA",DODO_MINEV3_PROXY:"0x0d9685D4037580F68D9F77B08971f17E1000bBdc"},[S.GOERLI]:{MULTI_CALL:"0x696E25A5e2AEd1C55E6d6Cfa0532Bbda9020165d",DODO_APPROVE:"0xC9143e54021f4a6d33b9b89DBB9F458AaEdd56FB",ERC20_HELPER:"0x24549FC74B3076A962624A26370ed556c467F74C",ROUTE_V2_DATA_FETCH:"0x7E9c460d0A10bd0605B15F0d0388e307d34a62E6",ROUTE_V1_DATA_FETCH:"0xAC716E87b0853C0712674e8E3a8435a489F276b4",CALLEE_HELPER:"0x5B2fd46E6E3Ff1E479d651ec0b210882Aa9871dF",DODO_PROXY:"0xbce44767af0a53A108b3B7ba4F740E03D228Ec0A",DODO_DSP_PROXY:"0x8d9ccc26CbF3D49bbA76E9920C3E6ed29e06b5cc",DODO_DPP_PROXY:"0xc4A1a152812dE96b2B1861E433f42290CDD7f113",DODO_MINEV3_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b"},[S.SEPOLIA]:{MULTI_CALL:"0x0fcB5237A1997C4700Ffa2BB4522EA38d4F851Fc",DODO_APPROVE:"0x66c45FF040e86DC613F239123A5E21FFdC3A3fEC",ERC20_HELPER:"0x297da061D1dE0132D241Fafed224288B34d81005",ROUTE_V2_DATA_FETCH:"0x03e89fC55A5ad0531576E5a502c4CA52c8bf391B",ROUTE_V1_DATA_FETCH:"0x3dD629473A2eD7f3C6299FFD9F3e0C283d073f11",CALLEE_HELPER:"0xCD536b4DECFD2fa0443666B6becD145F8aDe2E48",DODO_PROXY:"0x6292e8f7647b3b9dDf5795b1Fb77D0187e30E0F9",DODO_DSP_PROXY:"0x987bFBE33c9cF18cAA665B792Db66339a9c16D32",DODO_DPP_PROXY:"0x5e1251f4873248a030e1c92FFEB133AF1513277f",DODO_MINEV3_PROXY:"0xBbD59b9316eE65526DbBdEc2A748Cc05A285d54C"},[S.BSC]:{MULTI_CALL:"0x1Ee38d535d541c55C9dae27B12edf090C608E6Fb",DODO_APPROVE:"0xa128Ba44B2738A558A1fdC06d6303d52D3Cef8c1",ERC20_HELPER:"0x5B9E4c3056227C316a3da3296031DdC7a8d6a867",ROUTE_V2_DATA_FETCH:"0x35b8F92AcFE368afb90d37555f6d075Fc569a6BA",ROUTE_V1_DATA_FETCH:"0x2BBD66fC4898242BDBD2583BBe1d76E8b8f71445",CALLEE_HELPER:"0x2673E5333620bb22BD1bFB3af9Fc7012008E3b4B",DODO_PROXY:"0x8F8Dd7DB1bDA5eD3da8C9daf3bfa471c12d58486",DODO_DSP_PROXY:"0x2442A8B5cdf1E659F3F949A7E454Caa554D4E65a",DODO_DPP_PROXY:"0x624FC8368fE11BE00D8B2F3fE0B9D0053BEc21b9",DODO_V1_PAIR_PROXY:"0x4Fc222194862081866FC636893DDeCB3E4341A10",DODO_MINEV3_PROXY:"0x8f3fB1f9148dC473453163bF31de1d830Eb5c590"},[S.POLYGON]:{MULTI_CALL:"0xc9eD9B18e447e600238fe50e944B9062B664DEa4",DODO_APPROVE:"0x6D310348d5c12009854DFCf72e0DF9027e8cb4f4",ERC20_HELPER:"0xfd24312Ec7871A6D1a31e454D5AbB16c6c25a9b3",ROUTE_V2_DATA_FETCH:"0x1870854754d1E76C58B0a56a153E12Ff868eE3C6",ROUTE_V1_DATA_FETCH:"0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2",CALLEE_HELPER:"0x261F6cF4dF0e5c1432739cDAFD9299150FEd3dFc",DODO_PROXY:"0xa222e6a71D1A1Dd5F279805fbe38d5329C1d0e70",DODO_DSP_PROXY:"0xA3dfF6ae0F73f0970E31Da63B3736F7D3CEF683e",DODO_DPP_PROXY:"0xF6f1A1Ef2f5b56bb289993F75C12Eb41e4abC2f7",DODO_V1_PAIR_PROXY:"0x58E27C46c162F2a781d750BbE1119E1b2DfE82e0",DODO_MINEV3_PROXY:"0x47a65e74dd6b6B5E3243dBb01EDEd9D55ba234Ad"},[S.ARBITRUM_ONE]:{MULTI_CALL:"0xF718F2bd590E5621e53f7b89398e52f7Acced8ca",DODO_APPROVE:"0xA867241cDC8d3b0C07C85cC06F25a0cD3b5474d8",ERC20_HELPER:"0x7C062B9C584fA6eC2504270790D38240A2c5fE72",ROUTE_V2_DATA_FETCH:"0x0C420970b2e5efcBB6e833601772D6E707155eA6",ROUTE_V1_DATA_FETCH:"0x4EE6398898F7FC3e648b3f6bA458310ac29cD352",CALLEE_HELPER:"0xe3B40F8D8346d428EAB28d9Fd672b784d921cfBD",DODO_PROXY:"0x88CBf433471A0CD8240D2a12354362988b4593E5",DODO_DSP_PROXY:"0x36E5238B4479d1ba0bFE47550B0B8e4f4f500EAA",DODO_DPP_PROXY:"0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",DODO_V1_PAIR_PROXY:"0x49186E32fEd50fd6B5604A2618c7B0b03Cd41414",DODO_MINEV3_PROXY:"0x7E820457780Ac99B9A042Cd5f875b274855A1eE9"},[S.ARBITRUM_SEPOLIA]:{MULTI_CALL:e.MulticallWithValid,DODO_APPROVE:e.DODOApprove,ERC20_HELPER:e.ERC20Helper,ROUTE_V2_DATA_FETCH:e.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:e.DODOV1PmmHelper,CALLEE_HELPER:e.DODOCalleeHelper,DODO_PROXY:e.DODOV2Proxy02,DODO_DSP_PROXY:e.DODODspProxy,DODO_DPP_PROXY:e.DODODppProxy,DODO_MINEV3_PROXY:e.DODOMineV3ProxyWithoutPlatform},[S.AURORA]:{MULTI_CALL:"0x989DcAA95801C527C5B73AA65d3962dF9aCe1b0C",DODO_APPROVE:"0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619",ERC20_HELPER:"0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",ROUTE_V2_DATA_FETCH:"0x49eAB58AAE044F31d3b136212058a00b282b2845",ROUTE_V1_DATA_FETCH:"0xbAb9F4ff4A19a0e8EEBC56b06750253228ffAc6E",CALLEE_HELPER:"0x738Ebf387A0CE0eb46b0eF8Fa5DEa2EaE6B1Df51",DODO_PROXY:"0xd9deC7c3C06e62a4c1BeEB07CadF568f496b14c2",DODO_DSP_PROXY:"0x53233ABD9108761258a4B6B7822abFD6716B129B",DODO_DPP_PROXY:"0x357c5E9cfA8B834EDcef7C7aAbD8F9Db09119d11",DODO_MINEV3_PROXY:"0x4775b1858f1e417C9609D455C3Ad8751ec01daC4"},[S.OKCHAIN]:{MULTI_CALL:"0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01",DODO_APPROVE:"0x7737fd30535c69545deeEa54AB8Dd590ccaEBD3c",ERC20_HELPER:"0x4775b1858f1e417C9609D455C3Ad8751ec01daC4",ROUTE_V2_DATA_FETCH:"0x10Dd6d8A29D489BEDE472CC1b22dc695c144c5c7",ROUTE_V1_DATA_FETCH:"0xDfaf9584F5d229A9DBE5978523317820A8897C5A",CALLEE_HELPER:"0x3CD6D7F5fF977bf8069548eA1F9441b061162b42",DODO_PROXY:"0x6B4Fa0bc61Eddc928e0Df9c7f01e407BfcD3e5EF",DODO_DSP_PROXY:"0x5515363c0412AdD5c72d3E302fE1bD7dCBCF93Fe",DODO_DPP_PROXY:"0xa222e6a71D1A1Dd5F279805fbe38d5329C1d0e70",DODO_MINEV3_PROXY:"0x958f79e2998DFe417208b9A07D799265B0298e58"},[S.OPTIMISM]:{MULTI_CALL:"0xb98Ac2fEFc8b73aeAE33D02BB00c26E12afCa9Df",DODO_APPROVE:"0xa492d6eABcdc3E204676f15B950bBdD448080364",ERC20_HELPER:"0x42E456ea0dd7538ea103fBb1d0388D14C97bB5b2",ROUTE_V2_DATA_FETCH:"0xC48A8e689a644de96F80786ACb69E6F76D057F25",ROUTE_V1_DATA_FETCH:"0x6281E0628eb2B37fE9943279EA39725D5f0E0dBe",CALLEE_HELPER:"0x0BD7426f008737FeeD575ED8e2aA1bd4Fc49112D",DODO_PROXY:"0xfD9D2827AD469B72B69329dAA325ba7AfbDb3C98",DODO_DSP_PROXY:"0x61721e89a498dADa7aD579482BDC2aE60a9C5D54",DODO_DPP_PROXY:"0x51A70a33655FE1c5fae3286890DcE3bE332E85dD",DODO_MINEV3_PROXY:"0xaEdbD08D92ECccaA9A93b1A8D66D1d356e470c78"},[S.AVALANCHE]:{MULTI_CALL:"0x97f0153E7F5749640aDF3Ff9CFC518b79D6Fe53b",DODO_APPROVE:"0xCFea63e3DE31De53D68780Dd65675F169439e470",ERC20_HELPER:"0xC3528D128CC227fd60793007b5e3FdF7c2945282",ROUTE_V2_DATA_FETCH:"0x686984f0aa37585504f51DEbA0Eb45B0f0CB7e4a",ROUTE_V1_DATA_FETCH:"0x790B4A80Fb1094589A3c0eFC8740aA9b0C1733fB",CALLEE_HELPER:"0x4EfF1D851366b8cc51d553a87e2d12dA8Da46F2a",DODO_PROXY:"0x2cD18557E14aF72DAA8090BcAA95b231ffC9ea26",DODO_DSP_PROXY:"0xeCEaDe494FD5F913Fd937C5CAc4577236395Dc32",DODO_DPP_PROXY:"0xe44F14BFDe673B7339734a28152cCd6b821753C9",DODO_MINEV3_PROXY:"0x5D6e6A0BFB2176AFCc4FB809822D8e009216b245"},[S.CONFLUX]:{MULTI_CALL:"0x696e25a5e2aed1c55e6d6cfa0532bbda9020165d",DODO_APPROVE:"0x5BaF16d57620Cb361F622232F3cb4090e35F3da2",ERC20_HELPER:"0x24549FC74B3076A962624A26370ed556c467F74C",ROUTE_V2_DATA_FETCH:"0x7E9c460d0A10bd0605B15F0d0388e307d34a62E6",ROUTE_V1_DATA_FETCH:"0xAC716E87b0853C0712674e8E3a8435a489F276b4",CALLEE_HELPER:"0x5B2fd46E6E3Ff1E479d651ec0b210882Aa9871dF",DODO_PROXY:"0xbce44767af0a53A108b3B7ba4F740E03D228Ec0A",DODO_DSP_PROXY:"0x8d9ccc26cbf3d49bba76e9920c3e6ed29e06b5cc",DODO_DPP_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b",DODO_MINEV3_PROXY:"0x14F7B8Fb0c1447DdE7bcf92a8d9BB058c8A5FE64"},[S.BASE]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x89872650fA1A391f58B4E144222bB02e44db7e3B",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",DODO_DSP_PROXY:"0x49186E32fEd50fd6B5604A2618c7B0b03Cd41414",DODO_DPP_PROXY:"0x0B1467f71c082D8d410aF4376C685D9A6893cF36",DODO_MINEV3_PROXY:"0x2F66C5aAF006Bd9c51615D617589C16c0ed35fD3"},[S.LINEA]:{MULTI_CALL:"0xa7b9C3a116b20bEDDdBE4d90ff97157f67F0bD97",DODO_APPROVE:"0x6de4d882a84A98f4CCD5D33ea6b3C99A07BAbeB1",ERC20_HELPER:"0xbcd2FDC3B884Cf0dfD932f55Ec2Fe1fB7e8c62Da",ROUTE_V2_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",ROUTE_V1_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",CALLEE_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",DODO_PROXY:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",DODO_DSP_PROXY:"0x6D3bd005A8a75d6522C9cFE7d309BB1Cf9650e03",DODO_DPP_PROXY:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",DODO_MINEV3_PROXY:"0xA6d0066328Edbcf3220cf8F61e8527e589DD9719"},[S.SCROLL]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x20E77aD760eC9E922Fd2dA8847ABFbB2471B92CD",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xf5048d8F9163AF17Db522Abe9FaF37735C911320",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0xe49781e6186214d88aACFd9eBc8cE40E3CDc066D",DODO_DSP_PROXY:"0x7Dd8c909E1F48a68FfEF03492761AF17B1496EDc",DODO_DPP_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b",DODO_MINEV3_PROXY:"0x14F7B8Fb0c1447DdE7bcf92a8d9BB058c8A5FE64"},[S.MANTA]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x0226fCE8c969604C3A0AD19c37d1FAFac73e13c2",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0x2F86652dAEF5f1728c54191C955F065Ec3C188c7",DODO_DSP_PROXY:"0x0B1467f71c082D8d410aF4376C685D9A6893cF36",DODO_DPP_PROXY:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",DODO_MINEV3_PROXY:"0xA6d0066328Edbcf3220cf8F61e8527e589DD9719"},[S.MANTLE]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0xa71415675F68f29259ddD63215E5518d2735bf0a",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",ROUTE_V1_DATA_FETCH:"0xa1609A1fa7DC16c025feA194c02b2822441b8c10",CALLEE_HELPER:"0x4aAe1d041C01078725dB016BA4D4F72455CaF931",DODO_PROXY:"0xe7979E2F3e77196Bb2AB206eaa67Ea278A3E33A2",DODO_DSP_PROXY:"0x2933c0374089D7D98BA0C71c5E02E1A0e09deBEE",DODO_DPP_PROXY:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",DODO_MINEV3_PROXY:"0x6D3bd005A8a75d6522C9cFE7d309BB1Cf9650e03"},[S.DODO_CHAIN_TESTNET]:{MULTI_CALL:"0xD0CF7dfbF09CAfaB8AEf00e0Ce19a4638004a364",DODO_APPROVE:"0x82B26eb18382f7532015248078AB1f6030413396",ERC20_HELPER:"0xE6cecb7460c9E52aA483cb1f0E87d78D7085686F",ROUTE_V2_DATA_FETCH:"0xA3148a1765897EC0A9bCA57f855C0B4718060b78",ROUTE_V1_DATA_FETCH:"0x2e50e3e18c19C7d80B81888a961A13aEE49b962E",CALLEE_HELPER:"0x2Ba2696c63fA8b67b395de6D12F849b17C3515F9",DODO_PROXY:"0x464518e33F7Bd5E61a92b98b4332782915442580",DODO_DSP_PROXY:"0x886F677605512351e554AA53BA77eA493058b460",DODO_DPP_PROXY:"0xB4f2E70DE64F94116A6e93ff4dF2D020E91e7a63",DODO_MINEV3_PROXY:"0x391f8D754E4BaC453d059BA7D2137C4905bF48d4"},[S.TAIKO]:{MULTI_CALL:"0x388371233439cF57bB8C9f2e4835954841cfCb15",DODO_APPROVE:"0x2629E610dB4AC081c108cCDf8b19ED39D702df43",ERC20_HELPER:"0x0c76F95a2952DC171B26b152f2b30cA8968e79D5",ROUTE_V2_DATA_FETCH:"0xC7EaBEc77Be175432DC20c0056Cce4c2C78B84F3",ROUTE_V1_DATA_FETCH:"0x187210CE04F5B3179F0e483FCf292c34BA7568Dd",CALLEE_HELPER:"0x94B66F3156353a12A6004d098A16F2fCfF9E8348",DODO_PROXY:"0xfcd8EF54A4dA96dE6B2DDF67C6265C7405a3A9c6",DODO_DSP_PROXY:"0x928e9762B5223d5A2ac1F5b13E8A61907aCaa9Bd",DODO_DPP_PROXY:"0x38886EDE1Fc92886F9a11C37a1f5e75474858eaa",DODO_MINEV3_PROXY:"0x1dFd36964e21a2eb633991f0B95b4241c20e1db3"},[S.PLUME]:{MULTI_CALL:t.MulticallWithValid,DODO_APPROVE:t.DODOApprove,ERC20_HELPER:t.ERC20Helper,ROUTE_V2_DATA_FETCH:t.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:t.DODOV1PmmHelper,CALLEE_HELPER:t.DODOCalleeHelper,DODO_PROXY:t.DODOV2Proxy02,DODO_DSP_PROXY:t.DODODspProxy,DODO_DPP_PROXY:t.DODODppProxy,DODO_MINEV3_PROXY:t.DODOMineV3Proxy},[S.PLUME_TESTNET]:{MULTI_CALL:n.MulticallWithValid,DODO_APPROVE:n.DODOApprove,ERC20_HELPER:n.ERC20Helper,ROUTE_V2_DATA_FETCH:n.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:n.DODOV1PmmHelper,CALLEE_HELPER:n.DODOCalleeHelper,DODO_PROXY:n.DODOV2Proxy02,DODO_DSP_PROXY:n.DODODspProxy,DODO_DPP_PROXY:n.DODODppProxy,DODO_MINEV3_PROXY:n.DODOMineV3Proxy},[S.NEOX]:{MULTI_CALL:r.MulticallWithValid,DODO_APPROVE:r.DODOApprove,ERC20_HELPER:r.ERC20Helper,ROUTE_V2_DATA_FETCH:r.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:r.DODOV1PmmHelper,CALLEE_HELPER:r.DODOCalleeHelper,DODO_PROXY:r.DODOV2Proxy02,DODO_DSP_PROXY:r.DODODspProxy,DODO_DPP_PROXY:r.DODODppProxy,DODO_MINEV3_PROXY:r.DODOMineV3Proxy},[S.MORPH]:{MULTI_CALL:i.MulticallWithValid,DODO_APPROVE:i.DODOApprove,ERC20_HELPER:i.ERC20Helper,ROUTE_V2_DATA_FETCH:i.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:i.DODOV1PmmHelper,CALLEE_HELPER:i.DODOCalleeHelper,DODO_PROXY:i.DODOV2Proxy02,DODO_DSP_PROXY:i.DODODspProxy,DODO_DPP_PROXY:i.DODODppProxy,DODO_MINEV3_PROXY:i.DODOMineV3Proxy},[S.RISE_TESTNET]:{MULTI_CALL:s.MulticallWithValid,DODO_APPROVE:s.DODOApprove,ERC20_HELPER:s.ERC20Helper,ROUTE_V2_DATA_FETCH:s.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:s.DODOV1PmmHelper,CALLEE_HELPER:s.DODOCalleeHelper,DODO_PROXY:s.DODOV2Proxy02,DODO_DSP_PROXY:s.DODODspProxy,DODO_DPP_PROXY:s.DODODppProxy,DODO_MINEV3_PROXY:s.DODOMineV3Proxy},[S.NEROCHAIN]:{MULTI_CALL:o.MulticallWithValid,DODO_APPROVE:o.DODOApprove,ERC20_HELPER:o.ERC20Helper,ROUTE_V2_DATA_FETCH:o.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:o.DODOV1PmmHelper,CALLEE_HELPER:o.DODOCalleeHelper,DODO_PROXY:o.DODOV2Proxy02,DODO_DSP_PROXY:o.DODODspProxy,DODO_DPP_PROXY:o.DODODppProxy,DODO_MINEV3_PROXY:o.DODOMineV3Proxy},[S.BITLAYER]:{MULTI_CALL:a.MulticallWithValid,DODO_APPROVE:a.DODOApprove,ERC20_HELPER:a.ERC20Helper,ROUTE_V2_DATA_FETCH:a.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:a.DODOV1PmmHelper,CALLEE_HELPER:a.DODOCalleeHelper,DODO_PROXY:a.DODOV2Proxy02,DODO_DSP_PROXY:a.DODODspProxyWithoutGSP,DODO_DPP_PROXY:a.DODODppProxy,DODO_MINEV3_PROXY:a.DODOMineV3Proxy},[S.ZIRCUIT]:{MULTI_CALL:l.MulticallWithValid,DODO_APPROVE:l.DODOApprove,ERC20_HELPER:l.ERC20Helper,ROUTE_V2_DATA_FETCH:l.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:l.DODOV1PmmHelper,CALLEE_HELPER:l.DODOCalleeHelper,DODO_PROXY:l.DODOV2Proxy02,DODO_DSP_PROXY:l.DODODspProxyWithoutGSP,DODO_DPP_PROXY:l.DODODppProxy,DODO_MINEV3_PROXY:l.DODOMineV3Proxy},[S.X_LAYER]:{MULTI_CALL:c.MulticallWithValid,DODO_APPROVE:c.DODOApprove,ERC20_HELPER:c.ERC20Helper,ROUTE_V2_DATA_FETCH:c.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:c.DODOV1PmmHelper,CALLEE_HELPER:c.DODOCalleeHelper,DODO_PROXY:c.DODOV2Proxy02,DODO_DSP_PROXY:c.DODODspProxy,DODO_DPP_PROXY:c.DODODppProxy,DODO_MINEV3_PROXY:c.DODOMineV3Proxy},[S.ZERO]:{MULTI_CALL:u.MulticallWithValid,DODO_APPROVE:u.DODOApprove,ERC20_HELPER:u.ERC20Helper,ROUTE_V2_DATA_FETCH:u.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:u.DODOV1PmmHelper,CALLEE_HELPER:u.DODOCalleeHelper,DODO_PROXY:u.DODOV2Proxy02,DODO_DSP_PROXY:u.DODODspProxy,DODO_DPP_PROXY:u.DODODppProxy,DODO_MINEV3_PROXY:u.DODOMineV3Proxy},[S.HASHKEY]:{MULTI_CALL:d.MulticallWithValid,DODO_APPROVE:d.DODOApprove,ERC20_HELPER:d.ERC20Helper,ROUTE_V2_DATA_FETCH:d.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:d.DODOV1PmmHelper,CALLEE_HELPER:d.DODOCalleeHelper,DODO_PROXY:d.DODOV2Proxy02,DODO_DSP_PROXY:d.DODODspProxyWithoutGSP,DODO_DPP_PROXY:d.DODODppProxy,DODO_MINEV3_PROXY:d.DODOMineV3Proxy},[S.HEMI]:{MULTI_CALL:h.MulticallWithValid,DODO_APPROVE:h.DODOApprove,ERC20_HELPER:h.ERC20Helper,ROUTE_V2_DATA_FETCH:h.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:h.DODOV1PmmHelper,CALLEE_HELPER:h.DODOCalleeHelper,DODO_PROXY:h.DODOV2Proxy02,DODO_DSP_PROXY:h.DODODspProxyWithoutGSP,DODO_DPP_PROXY:h.DODODppProxy,DODO_MINEV3_PROXY:h.DODOMineV3Proxy},[S.PHAROS_TESTNET]:{MULTI_CALL:f.MulticallWithValid,DODO_APPROVE:f.DODOApprove,ERC20_HELPER:f.ERC20Helper,ROUTE_V2_DATA_FETCH:f.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:f.DODOV1PmmHelper,CALLEE_HELPER:f.DODOCalleeHelper,DODO_PROXY:f.DODOV2Proxy02,DODO_DSP_PROXY:f.DODODspProxy,DODO_DPP_PROXY:f.DODODppProxy,DODO_MINEV3_PROXY:f.DODOMineV3Proxy},[S.PHAROS_ATLANTIC_TESTNET]:{MULTI_CALL:p.MulticallWithValid,DODO_APPROVE:p.DODOApprove,ERC20_HELPER:p.ERC20Helper,ROUTE_V2_DATA_FETCH:p.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:p.DODOV1PmmHelper,CALLEE_HELPER:p.DODOCalleeHelper,DODO_PROXY:p.DODOV2Proxy02,DODO_DSP_PROXY:p.DODODspProxy,DODO_DPP_PROXY:p.DODODppProxy,DODO_MINEV3_PROXY:p.DODOMineV3Proxy},[S.STABLE_TESTNET]:{MULTI_CALL:m.MulticallWithValid,DODO_APPROVE:m.DODOApprove,ERC20_HELPER:m.ERC20Helper,ROUTE_V2_DATA_FETCH:m.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:m.DODOV1PmmHelper,CALLEE_HELPER:m.DODOCalleeHelper,DODO_PROXY:m.DODOV2Proxy02,DODO_DSP_PROXY:m.DODODspProxy,DODO_DPP_PROXY:m.DODODppProxy,DODO_MINEV3_PROXY:m.DODOMineV3Proxy},[S.STABLE]:{MULTI_CALL:g.MulticallWithValid,DODO_APPROVE:g.DODOApprove,ERC20_HELPER:g.ERC20Helper,ROUTE_V2_DATA_FETCH:g.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:g.DODOV1PmmHelper,CALLEE_HELPER:g.DODOCalleeHelper,DODO_PROXY:g.DODOV2Proxy02,DODO_DSP_PROXY:g.DODODspProxy,DODO_DPP_PROXY:g.DODODppProxy,DODO_MINEV3_PROXY:g.DODOMineV3Proxy}},U={[S.MAINNET]:"ethereum",[S.GOERLI]:"goerli",[S.OPTIMISM]:"optimism",[S.CONFLUX]:"cfx",[S.BSC]:"bsc",[S.OKCHAIN]:"okex-chain",[S.POLYGON]:"polygon",[S.ARBITRUM_ONE]:"arbitrum",[S.ARBITRUM_SEPOLIA]:"arb-sep",[S.AURORA]:"aurora",[S.AVALANCHE]:"avalanche",[S.BASE]:"base",[S.LINEA]:"linea",[S.SCROLL]:"scr",[S.MANTA]:"manta",[S.MANTLE]:"mantle",[S.SEPOLIA]:"sepolia",[S.DODO_CHAIN_TESTNET]:"dodochain-testnet",[S.TAIKO]:"taiko",[S.PLUME]:"plume",[S.PLUME_TESTNET]:"plume-testnet",[S.NEOX]:"neox",[S.MORPH]:"morph",[S.RISE_TESTNET]:"rise-testnet",[S.NEROCHAIN]:"nero",[S.BITLAYER]:"btr",[S.ZIRCUIT]:"zircuit-mainnet",[S.X_LAYER]:"okb",[S.ZERO]:"zero-mainnet",[S.HASHKEY]:"hashkey",[S.HEMI]:"hemi",[S.PHAROS_TESTNET]:"pharos-testnet",[S.PHAROS_ATLANTIC_TESTNET]:"pharos-atlantic-testnet",[S.STABLE_TESTNET]:"stable-testnet",[S.STABLE]:"stable"};function V(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}let H=!1,j=!1;const Q={debug:1,default:2,info:2,warning:3,error:4,off:5};let Y=Q.default,G=null;const X=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var $,K;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}($||($={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(K||(K={}));const z="0123456789abcdef";class J{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==Q[n]&&this.throwArgumentError("invalid log level name","logLevel",e),Y>Q[n]||console.log.apply(console,t)}debug(...e){this._log(J.levels.DEBUG,e)}info(...e){this._log(J.levels.INFO,e)}warn(...e){this._log(J.levels.WARNING,e)}makeError(e,t,n){if(j)return this.makeError("censored error",t,{});t||(t=J.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=z[t[e]>>4],n+=z[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(t){r.push(e+"="+JSON.stringify(n[e].toString()))}})),r.push(`code=${t}`),r.push(`version=${this.version}`);const i=e;let s="";switch(t){case K.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case K.CALL_EXCEPTION:case K.INSUFFICIENT_FUNDS:case K.MISSING_NEW:case K.NONCE_EXPIRED:case K.REPLACEMENT_UNDERPRICED:case K.TRANSACTION_REPLACED:case K.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const o=new Error(e);return o.reason=i,o.code=t,Object.keys(n).forEach((function(e){o[e]=n[e]})),o}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,J.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){X&&this.throwError("platform missing String.prototype.normalize",J.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:X})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,J.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,J.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",e<t&&this.throwError("missing argument"+n,J.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,J.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",J.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",J.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",J.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return G||(G=new J("logger/5.7.0")),G}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",J.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),H){if(!e)return;this.globalLogger().throwError("error censorship permanent",J.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}j=!!e,H=!!t}static setLogLevel(e){const t=Q[e.toLowerCase()];null!=t?Y=t:J.globalLogger().warn("invalid log level - "+e)}static from(e){return new J(e)}}J.errors=K,J.levels=$;const W=new J("bytes/5.7.0");function Z(e){return!!e.toHexString}function ee(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return ee(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function te(e){return ae(e)&&!(e.length%2)||re(e)}function ne(e){return"number"==typeof e&&e==e&&e%1==0}function re(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!ne(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!ne(n)||n<0||n>=256)return!1}return!0}function ie(e,t){if(t||(t={}),"number"==typeof e){W.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),ee(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Z(e)&&(e=e.toHexString()),ae(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":W.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return ee(new Uint8Array(r))}return re(e)?ee(new Uint8Array(e)):W.throwArgumentError("invalid arrayify value","value",e)}function se(e){const t=e.map((e=>ie(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),ee(r)}function oe(e){let t=ie(e);if(0===t.length)return t;let n=0;for(;n<t.length&&0===t[n];)n++;return n&&(t=t.slice(n)),t}function ae(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const le="0123456789abcdef";function ce(e,t){if(t||(t={}),"number"==typeof e){W.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=le[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Z(e))return e.toHexString();if(ae(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":W.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(re(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=le[(240&r)>>4]+le[15&r]}return t}return W.throwArgumentError("invalid hexlify value","value",e)}function ue(e){if("string"!=typeof e)e=ce(e);else if(!ae(e)||e.length%2)return null;return(e.length-2)/2}function de(e,t,n){return"string"!=typeof e?e=ce(e):(!ae(e)||e.length%2)&&W.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function he(e){let t="0x";return e.forEach((e=>{t+=ce(e).substring(2)})),t}function fe(e){const t=function(e){"string"!=typeof e&&(e=ce(e));ae(e)||W.throwArgumentError("invalid hex string","value",e);e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}(ce(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function pe(e,t){for("string"!=typeof e?e=ce(e):ae(e)||W.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&W.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function me(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(te(e)){let n=ie(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=ce(n.slice(0,32)),t.s=ce(n.slice(32,64))):65===n.length?(t.r=ce(n.slice(0,32)),t.s=ce(n.slice(32,64)),t.v=n[64]):W.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:W.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=ce(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=function(e,t){(e=ie(e)).length>t&&W.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),ee(n)}(ie(t._vs),32);t._vs=ce(n);const r=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=r:t.recoveryParam!==r&&W.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const i=ce(n);null==t.s?t.s=i:t.s!==i&&W.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?W.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&W.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&ae(t.r)?t.r=pe(t.r,32):W.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&ae(t.s)?t.s=pe(t.s,32):W.throwArgumentError("signature missing or invalid s","signature",e);const n=ie(t.s);n[0]>=128&&W.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const r=ce(n);t._vs&&(ae(t._vs)||W.throwArgumentError("signature invalid _vs","signature",e),t._vs=pe(t._vs,32)),null==t._vs?t._vs=r:t._vs!==r&&W.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}const ge="bignumber/5.7.0";var ye=D.BN;const Ae=new J(ge),Ee={},be=9007199254740991;let ve=!1;class we{constructor(e,t){e!==Ee&&Ae.throwError("cannot call constructor directly; use BigNumber.from",J.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return De(Te(this).fromTwos(e))}toTwos(e){return De(Te(this).toTwos(e))}abs(){return"-"===this._hex[0]?we.from(this._hex.substring(1)):this}add(e){return De(Te(this).add(Te(e)))}sub(e){return De(Te(this).sub(Te(e)))}div(e){return we.from(e).isZero()&&Pe("division-by-zero","div"),De(Te(this).div(Te(e)))}mul(e){return De(Te(this).mul(Te(e)))}mod(e){const t=Te(e);return t.isNeg()&&Pe("division-by-zero","mod"),De(Te(this).umod(t))}pow(e){const t=Te(e);return t.isNeg()&&Pe("negative-power","pow"),De(Te(this).pow(t))}and(e){const t=Te(e);return(this.isNegative()||t.isNeg())&&Pe("unbound-bitwise-result","and"),De(Te(this).and(t))}or(e){const t=Te(e);return(this.isNegative()||t.isNeg())&&Pe("unbound-bitwise-result","or"),De(Te(this).or(t))}xor(e){const t=Te(e);return(this.isNegative()||t.isNeg())&&Pe("unbound-bitwise-result","xor"),De(Te(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Pe("negative-width","mask"),De(Te(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Pe("negative-width","shl"),De(Te(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Pe("negative-width","shr"),De(Te(this).shrn(e))}eq(e){return Te(this).eq(Te(e))}lt(e){return Te(this).lt(Te(e))}lte(e){return Te(this).lte(Te(e))}gt(e){return Te(this).gt(Te(e))}gte(e){return Te(this).gte(Te(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Te(this).isZero()}toNumber(){try{return Te(this).toNumber()}catch(e){Pe("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ae.throwError("this platform does not support BigInt",J.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ve||(ve=!0,Ae.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ae.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",J.errors.UNEXPECTED_ARGUMENT,{}):Ae.throwError("BigNumber.toString does not accept parameters",J.errors.UNEXPECTED_ARGUMENT,{})),Te(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof we)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new we(Ee,Oe(e)):e.match(/^-?[0-9]+$/)?new we(Ee,Oe(new ye(e))):Ae.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Pe("underflow","BigNumber.from",e),(e>=be||e<=-be)&&Pe("overflow","BigNumber.from",e),we.from(String(e));const t=e;if("bigint"==typeof t)return we.from(t.toString());if(re(t))return we.from(ce(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return we.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(ae(e)||"-"===e[0]&&ae(e.substring(1))))return we.from(e)}return Ae.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Oe(e){if("string"!=typeof e)return Oe(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Ae.throwArgumentError("invalid hex","value",e),"0x00"===(e=Oe(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function De(e){return we.from(Oe(e))}function Te(e){const t=we.from(e).toHexString();return"-"===t[0]?new ye("-"+t.substring(3),16):new ye(t.substring(2),16)}function Pe(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),Ae.throwError(e,J.errors.NUMERIC_FAULT,r)}const _e=new J(ge),Re={},Ie=we.from(0),Ce=we.from(-1);function Be(e,t,n,r){const i={fault:t,operation:n};return void 0!==r&&(i.value=r),_e.throwError(e,J.errors.NUMERIC_FAULT,i)}let ke="0";for(;ke.length<256;)ke+=ke;function Ne(e){if("number"!=typeof e)try{e=we.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+ke.substring(0,e):_e.throwArgumentError("invalid decimal size","decimals",e)}function xe(e,t){null==t&&(t=0);const n=Ne(t),r=(e=we.from(e)).lt(Ie);r&&(e=e.mul(Ce));let i=e.mod(n).toString();for(;i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(n).toString();return e=1===n.length?s:s+"."+i,r&&(e="-"+e),e}function Se(e,t){null==t&&(t=0);const n=Ne(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||_e.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&_e.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&_e.throwArgumentError("too many decimal points","value",e);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>n.length-1&&Be("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<n.length-1;)o+="0";const a=we.from(s),l=we.from(o);let c=a.mul(n).add(l);return r&&(c=c.mul(Ce)),c}class Le{constructor(e,t,n,r){e!==Re&&_e.throwError("cannot use FixedFormat constructor; use FixedFormat.from",J.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=n,this.decimals=r,this.name=(t?"":"u")+"fixed"+String(n)+"x"+String(r),this._multiplier=Ne(r),Object.freeze(this)}static from(e){if(e instanceof Le)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||_e.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],n=parseInt(i[2]),r=parseInt(i[3])}else if(e){const i=(t,n,r)=>null==e[t]?r:(typeof e[t]!==n&&_e.throwArgumentError("invalid fixed format ("+t+" not "+n+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&_e.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&_e.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new Le(Re,t,n,r)}}class Fe{constructor(e,t,n,r){e!==Re&&_e.throwError("cannot use FixedNumber constructor; use FixedNumber.from",J.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=t,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&_e.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=Se(this._value,this.format.decimals),n=Se(e._value,e.format.decimals);return Fe.fromValue(t.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=Se(this._value,this.format.decimals),n=Se(e._value,e.format.decimals);return Fe.fromValue(t.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=Se(this._value,this.format.decimals),n=Se(e._value,e.format.decimals);return Fe.fromValue(t.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=Se(this._value,this.format.decimals),n=Se(e._value,e.format.decimals);return Fe.fromValue(t.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Fe.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(t=t.subUnsafe(Me.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Fe.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(t=t.addUnsafe(Me.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&_e.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const n=Fe.from("1"+ke.substring(0,e),this.format),r=qe.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&_e.throwArgumentError("invalid byte width","width",e);return pe(we.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Fe.fromString(this._value,e)}static fromValue(e,t,n){return null!=n||null==t||function(e){return null!=e&&(we.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||ae(e)||"bigint"==typeof e||re(e))}(t)||(n=t,t=null),null==t&&(t=0),null==n&&(n="fixed"),Fe.fromString(xe(e,t),Le.from(n))}static fromString(e,t){null==t&&(t="fixed");const n=Le.from(t),r=Se(e,n.decimals);!n.signed&&r.lt(Ie)&&Be("unsigned value cannot be negative","overflow","value",e);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=pe(i,n.width/8));const s=xe(r,n.decimals);return new Fe(Re,i,s,n)}static fromBytes(e,t){null==t&&(t="fixed");const n=Le.from(t);if(ie(e).length>n.width/8)throw new Error("overflow");let r=we.from(e);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),s=xe(r,n.decimals);return new Fe(Re,i,s,n)}static from(e,t){if("string"==typeof e)return Fe.fromString(e,t);if(re(e))return Fe.fromBytes(e,t);try{return Fe.fromValue(e,0,t)}catch(e){if(e.code!==J.errors.INVALID_ARGUMENT)throw e}return _e.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const Me=Fe.from(1),qe=Fe.from("0.5");var Ue=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ve=new J("properties/5.7.0");function He(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function je(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function Qe(e){return Ue(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const n=e[t];return Promise.resolve(n).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function Ye(e){const t={};for(const n in e)t[n]=e[n];return t}const Ge={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Xe(e){if(null==e||Ge[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let n=0;n<t.length;n++){let r=null;try{r=e[t[n]]}catch(e){continue}if(!Xe(r))return!1}return!0}return Ve.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function $e(e){if(Xe(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>Ke(e))));if("object"==typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&He(t,n,Ke(r))}return t}return Ve.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Ke(e){return $e(e)}class ze{constructor(e){for(const t in e)this[t]=Ke(e[t])}}var Je=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const We=new J("abstract-provider/5.7.0");class Ze extends ze{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class et{constructor(){We.checkAbstract(new.target,et),He(this,"_isProvider",!0)}getFeeData(){return Je(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield Qe({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let n=null,r=null,i=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,i=we.from("1500000000"),r=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}const tt=new J("networks/5.7.1");function nt(e){const t=function(t,n){null==n&&(n={});const r=[];if(t.InfuraProvider&&"-"!==n.infura)try{r.push(new t.InfuraProvider(e,n.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==n.etherscan)try{r.push(new t.EtherscanProvider(e,n.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==n.alchemy)try{r.push(new t.AlchemyProvider(e,n.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==n.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const s=new t.PocketProvider(e,n.pocket);s.network&&-1===i.indexOf(s.network.name)&&r.push(s)}catch(e){}}if(t.CloudflareProvider&&"-"!==n.cloudflare)try{r.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==n.ankr)try{const i=["ropsten"],s=new t.AnkrProvider(e,n.ankr);s.network&&-1===i.indexOf(s.network.name)&&r.push(s)}catch(e){}if(0===r.length)return null;if(t.FallbackProvider){let i=1;return null!=n.quorum?i=n.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(r,i)}return r[0]};return t.renetwork=function(e){return nt(e)},t}function rt(e,t){const n=function(n,r){return n.JsonRpcProvider?new n.JsonRpcProvider(e,t):null};return n.renetwork=function(t){return rt(e,t)},n}const it={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:nt("homestead")},st={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:nt("ropsten")},ot={chainId:63,name:"classicMordor",_defaultProvider:rt("https://www.ethercluster.com/mordor","classicMordor")},at={unspecified:{chainId:0,name:"unspecified"},homestead:it,mainnet:it,morden:{chainId:2,name:"morden"},ropsten:st,testnet:st,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:nt("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:nt("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:nt("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:nt("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:rt("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:ot,classicTestnet:ot,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:rt("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:nt("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:nt("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function lt(e){e=atob(e);const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return ie(t)}function ct(e){e=ie(e);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}class ut{constructor(e){He(this,"alphabet",e),He(this,"base",e.length),He(this,"_alphabetMap",{}),He(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=ie(e);if(0===t.length)return"";let n=[0];for(let e=0;e<t.length;++e){let r=t[e];for(let e=0;e<n.length;++e)r+=n[e]<<8,n[e]=r%this.base,r=r/this.base|0;for(;r>0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let e=0;0===t[e]&&e<t.length-1;++e)r+=this._leader;for(let e=n.length-1;e>=0;--e)r+=this.alphabet[n[e]];return r}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let n=0;n<e.length;n++){let r=this._alphabetMap[e[n]];if(void 0===r)throw new Error("Non-base"+this.base+" character");let i=r;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let n=0;e[n]===this._leader&&n<e.length-1;++n)t.push(0);return ie(new Uint8Array(t.reverse()))}}new ut("abcdefghijklmnopqrstuvwxyz234567");const dt=new ut("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ht=we.from(-1),ft=we.from(0),pt=we.from(1),mt=we.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function gt(e){return"0x"+O.keccak_256(ie(e))}const yt=new J("strings/5.7.0");var At,Et;function bt(e,t,n,r,i){if(e===Et.BAD_PREFIX||e===Et.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return e===Et.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(At||(At={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(Et||(Et={}));const vt=Object.freeze({error:function(e,t,n,r,i){return yt.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)},ignore:bt,replace:function(e,t,n,r,i){return e===Et.OVERLONG?(r.push(i),0):(r.push(65533),bt(e,t,n))}});function wt(e,t){null==t&&(t=vt.error),e=ie(e);const n=[];let r=0;for(;r<e.length;){const i=e[r++];if(!(i>>7)){n.push(i);continue}let s=null,o=null;if(192==(224&i))s=1,o=127;else if(224==(240&i))s=2,o=2047;else{if(240!=(248&i)){r+=t(128==(192&i)?Et.UNEXPECTED_CONTINUE:Et.BAD_PREFIX,r-1,e,n);continue}s=3,o=65535}if(r-1+s>=e.length){r+=t(Et.OVERRUN,r-1,e,n);continue}let a=i&(1<<8-s-1)-1;for(let i=0;i<s;i++){let i=e[r];if(128!=(192&i)){r+=t(Et.MISSING_CONTINUE,r,e,n),a=null;break}a=a<<6|63&i,r++}null!==a&&(a>1114111?r+=t(Et.OUT_OF_RANGE,r-1-s,e,n,a):a>=55296&&a<=57343?r+=t(Et.UTF16_SURROGATE,r-1-s,e,n,a):a<=o?r+=t(Et.OVERLONG,r-1-s,e,n,a):n.push(a))}return n}function Ot(e,t=At.current){t!=At.current&&(yt.checkNormalize(),e=e.normalize(t));let n=[];for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const s=65536+((1023&r)<<10)+(1023&i);n.push(s>>18|240),n.push(s>>12&63|128),n.push(s>>6&63|128),n.push(63&s|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return ie(n)}function Dt(e,t){return wt(e,t).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function Tt(e){return gt(Ot(e))}const Pt="hash/5.7.0";function _t(e,t){null==t&&(t=1);const n=[],r=n.forEach,i=function(e,t){r.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):n.push(e)}))};return i(e,t),n}function Rt(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function n(){return e[t++]<<8|e[t++]}let r=n(),i=1,s=[0,1];for(let e=1;e<r;e++)s.push(i+=n());let o=n(),a=t;t+=o;let l=0,c=0;function u(){return 0==l&&(c=c<<8|e[t++],l=8),c>>--l&1}const d=Math.pow(2,31),h=d>>>1,f=h>>1,p=d-1;let m=0;for(let e=0;e<31;e++)m=m<<1|u();let g=[],y=0,A=d;for(;;){let e=Math.floor(((m-y+1)*i-1)/A),t=0,n=r;for(;n-t>1;){let r=t+n>>>1;e<s[r]?n=r:t=r}if(0==t)break;g.push(t);let o=y+Math.floor(A*s[t]/i),a=y+Math.floor(A*s[t+1]/i)-1;for(;!((o^a)&h);)m=m<<1&p|u(),o=o<<1&p,a=a<<1&p|1;for(;o&~a&f;)m=m&h|m<<1&p>>>1|u(),o=o<<1^h,a=(a^h)<<1|h|1;y=o,A=1+a-o}let E=r-4;return g.map((t=>{switch(t-E){case 3:return E+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return E+256+(e[a++]<<8|e[a++]);case 1:return E+e[a++];default:return t-1}}))}(e))}function It(e){return 1&e?~e>>1:e>>1}function Ct(e,t){let n=Array(e);for(let r=0,i=-1;r<e;r++)n[r]=i+=1+t();return n}function Bt(e,t){let n=Array(e);for(let r=0,i=0;r<e;r++)n[r]=i+=It(t());return n}function kt(e,t){let n=Ct(e(),e),r=e(),i=Ct(r,e),s=function(e,t){let n=Array(e);for(let r=0;r<e;r++)n[r]=1+t();return n}(r,e);for(let e=0;e<r;e++)for(let t=0;t<s[e];t++)n.push(i[e]+t);return t?n.map((e=>t[e])):n}function Nt(e,t,n){let r=Array(e).fill(void 0).map((()=>[]));for(let i=0;i<t;i++)Bt(e,n).forEach(((e,t)=>r[t].push(e)));return r}function xt(e,t){let n=1+t(),r=t(),i=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(n)}return t}(t);return _t(Nt(i.length,1+e,t).map(((e,t)=>{const s=e[0],o=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*r;return[s+t*n,o.map((e=>e+i))]}))})))}function St(e,t){return Nt(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const Lt=Rt(lt("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")),Ft=new Set(kt(Lt)),Mt=new Set(kt(Lt)),qt=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(xt(n,e))}for(;;){let n=e()-1;if(n<0)break;t.push(St(n,e))}return function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[r[0]]=r[1]}return t}(_t(t))}(Lt),Ut=function(e){let t=kt(e).sort(((e,t)=>e-t));return function n(){let r=[];for(;;){let i=kt(e,t);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((e,t)=>t.set.size-e.set.size));let i=e(),s=i%3;i=i/3|0;let o=!!(1&i);return i>>=1,{branches:r,valid:s,fe0f:o,save:1==i,check:2==i}}()}(Lt),Vt=45,Ht=95;function jt(e){return function(e,t=At.current){return wt(Ot(e,t))}(e)}function Qt(e){return e.filter((e=>65039!=e))}function Yt(e){for(let t of e.split(".")){let e=jt(t);try{for(let t=e.lastIndexOf(Ht)-1;t>=0;t--)if(e[t]!==Ht)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===Vt&&e[3]===Vt)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function Gt(e){return Yt(function(e,t){let n=jt(e).reverse(),r=[];for(;n.length;){let e=Xt(n);if(e){r.push(...t(e));continue}let i=n.pop();if(Ft.has(i)){r.push(i);continue}if(Mt.has(i))continue;let s=qt[i];if(!s)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...s)}return Yt((i=String.fromCodePoint(...r),i.normalize("NFC")));var i}(e,Qt))}function Xt(e,t){var n;let r,i,s=Ut,o=[],a=e.length;for(;a;){let t=e[--a];if(s=null===(n=s.branches.find((e=>e.set.has(t))))||void 0===n?void 0:n.node,!s)break;if(s.save)i=t;else if(s.check&&t===i)break;o.push(t),s.fe0f&&(o.push(65039),a>0&&65039==e[a-1]&&a--),s.valid&&(r=o.slice(),2==s.valid&&r.splice(1,1),e.length=a)}return r}const $t=new J(Pt),Kt=new Uint8Array(32);function zt(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function Jt(e){const t=Ot(Gt(e)),n=[];if(0===e.length)return n;let r=0;for(let e=0;e<t.length;e++){46===t[e]&&(n.push(zt(t.slice(r,e))),r=e+1)}if(r>=t.length)throw new Error("invalid ENS name; empty component");return n.push(zt(t.slice(r))),n}function Wt(e){"string"!=typeof e&&$t.throwArgumentError("invalid ENS name; not a string","name",e);let t=Kt;const n=Jt(e);for(;n.length;)t=gt(se([t,gt(n.pop())]));return ce(t)}Kt.fill(0);const Zt=new J("rlp/5.7.0");function en(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function tn(e,t,n){let r=0;for(let i=0;i<n;i++)r=256*r+e[t+i];return r}function nn(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(nn(e))})),t.length<=55)return t.unshift(192+t.length),t;const n=en(t.length);return n.unshift(247+n.length),n.concat(t)}te(e)||Zt.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(ie(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=en(t.length);return n.unshift(183+n.length),n.concat(t)}function rn(e){return ce(nn(e))}function sn(e,t,n,r){const i=[];for(;n<t+1+r;){const s=on(e,n);i.push(s.result),(n+=s.consumed)>t+1+r&&Zt.throwError("child data too short",J.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function on(e,t){if(0===e.length&&Zt.throwError("data too short",J.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&Zt.throwError("data short segment too short",J.errors.BUFFER_OVERRUN,{});const r=tn(e,t+1,n);return t+1+n+r>e.length&&Zt.throwError("data long segment too short",J.errors.BUFFER_OVERRUN,{}),sn(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&Zt.throwError("data array too short",J.errors.BUFFER_OVERRUN,{}),sn(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&Zt.throwError("data array too short",J.errors.BUFFER_OVERRUN,{});const r=tn(e,t+1,n);t+1+n+r>e.length&&Zt.throwError("data array too short",J.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:ce(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&Zt.throwError("data too short",J.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:ce(e.slice(t+1,t+1+n))}}return{consumed:1,result:ce(e[t])}}function an(e){const t=ie(e),n=on(t,0);return n.consumed!==t.length&&Zt.throwArgumentError("invalid rlp data","data",e),n.result}const ln=new J("address/5.7.0");function cn(e){ae(e,20)||ln.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=ie(gt(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const un={};for(let e=0;e<10;e++)un[String(e)]=String(e);for(let e=0;e<26;e++)un[String.fromCharCode(65+e)]=String(10+e);const dn=Math.floor((hn=9007199254740991,Math.log10?Math.log10(hn):Math.log(hn)/Math.LN10));var hn;function fn(e){let t=null;if("string"!=typeof e&&ln.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=cn(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&ln.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>un[e])).join("");for(;t.length>=dn;){let e=t.substring(0,dn);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}(e)&&ln.throwArgumentError("bad icap checksum","address",e),n=e.substring(4),t=new ye(n,36).toString(16);t.length<40;)t="0"+t;t=cn("0x"+t)}else ln.throwArgumentError("invalid address","address",e);var n;return t}function pn(e){let t=null;try{t=fn(e.from)}catch(t){ln.throwArgumentError("missing from address","transaction",e)}return fn(de(gt(rn([t,oe(ie(we.from(e.nonce).toHexString()))])),12))}var mn=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const gn=new J(Pt),yn=new Uint8Array(32);yn.fill(0);const An=we.from(-1),En=we.from(0),bn=we.from(1),vn=we.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const wn=pe(bn.toHexString(),32),On=pe(En.toHexString(),32),Dn={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Tn=["name","version","chainId","verifyingContract","salt"];function Pn(e){return function(t){return"string"!=typeof t&&gn.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const _n={name:Pn("name"),version:Pn("version"),chainId:function(e){try{return we.from(e).toString()}catch(e){}return gn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return fn(e).toLowerCase()}catch(e){}return gn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=ie(e);if(32!==t.length)throw new Error("bad length");return ce(t)}catch(e){}return gn.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Rn(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],r=parseInt(t[2]||"256");(r%8!=0||r>256||t[2]&&t[2]!==String(r))&&gn.throwArgumentError("invalid numeric width","type",e);const i=vn.mask(n?r-1:r),s=n?i.add(bn).mul(An):En;return function(t){const n=we.from(t);return(n.lt(s)||n.gt(i))&&gn.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),pe(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const n=parseInt(t[1]);return(0===n||n>32||t[1]!==String(n))&&gn.throwArgumentError("invalid bytes width","type",e),function(t){return ie(t).length!==n&&gn.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=ie(e),n=t.length%32;return n?he([t,yn.slice(n)]):ce(t)}(t)}}}switch(e){case"address":return function(e){return pe(fn(e),32)};case"bool":return function(e){return e?wn:On};case"bytes":return function(e){return gt(e)};case"string":return function(e){return Tt(e)}}return null}function In(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class Cn{constructor(e){He(this,"types",Object.freeze(Ke(e))),He(this,"_encoderCache",{}),He(this,"_types",{});const t={},n={},r={};Object.keys(e).forEach((e=>{t[e]={},n[e]=[],r[e]={}}));for(const r in e){const i={};e[r].forEach((s=>{i[s.name]&&gn.throwArgumentError(`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(r)}`,"types",e),i[s.name]=!0;const o=s.type.match(/^([^\x5b]*)(\x5b|$)/)[1];o===r&&gn.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e);Rn(o)||(n[o]||gn.throwArgumentError(`unknown type ${JSON.stringify(o)}`,"types",e),n[o].push(r),t[r][o]=!0)}))}const i=Object.keys(n).filter((e=>0===n[e].length));0===i.length?gn.throwArgumentError("missing primary type","types",e):i.length>1&&gn.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),He(this,"primaryType",i[0]),function i(s,o){o[s]&&gn.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e),o[s]=!0,Object.keys(t[s]).forEach((e=>{n[e]&&(i(e,o),Object.keys(o).forEach((t=>{r[t][e]=!0})))})),delete o[s]}(this.primaryType,{});for(const t in r){const n=Object.keys(r[t]);n.sort(),this._types[t]=In(t,e[t])+n.map((t=>In(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=Rn(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],n=this.getEncoder(e),r=parseInt(t[3]);return t=>{r>=0&&t.length!==r&&gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(n);return this._types[e]&&(i=i.map(gt)),gt(he(i))}}const n=this.types[e];if(n){const t=Tt(this._types[e]);return e=>{const r=n.map((({name:t,type:n})=>{const r=this.getEncoder(n)(e[t]);return this._types[n]?gt(r):r}));return r.unshift(t),he(r)}}return gn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||gn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return gt(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,n){if(Rn(e))return n(e,t);const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const e=r[1],i=parseInt(r[3]);return i>=0&&t.length!==i&&gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,n)))}const i=this.types[e];return i?i.reduce(((e,{name:r,type:i})=>(e[r]=this._visit(i,t[r],n),e)),{}):gn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Cn(e)}static getPrimaryType(e){return Cn.from(e).primaryType}static hashStruct(e,t,n){return Cn.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){const r=Dn[n];r||gn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:r})}return t.sort(((e,t)=>Tn.indexOf(e.name)-Tn.indexOf(t.name))),Cn.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return he(["0x1901",Cn.hashDomain(e),Cn.from(t).hash(n)])}static hash(e,t,n){return gt(Cn.encode(e,t,n))}static resolveNames(e,t,n,r){return mn(this,void 0,void 0,(function*(){e=Ye(e);const i={};e.verifyingContract&&!ae(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=Cn.from(t);s.visit(n,((e,t)=>("address"!==e||ae(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield r(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=s.visit(n,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:n}}))}static getPayload(e,t,n){Cn.hashDomain(e);const r={},i=[];Tn.forEach((t=>{const n=e[t];null!=n&&(r[t]=_n[t](n),i.push({name:t,type:Dn[t]}))}));const s=Cn.from(t),o=Ye(t);return o.EIP712Domain?gn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):o.EIP712Domain=i,s.encode(n),{types:o,domain:r,primaryType:s.primaryType,message:s.visit(n,((e,t)=>{if(e.match(/^bytes(\d*)/))return ce(ie(t));if(e.match(/^u?int/))return we.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&gn.throwArgumentError("invalid string","value",t),t}return gn.throwArgumentError("unsupported type","type",e)}))}}}function Bn(e){return"0x"+T.sha256().update(ie(e)).digest("hex")}var kn=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};function Nn(e,t){return kn(this,void 0,void 0,(function*(){null==t&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(n.mode=e.mode),e.cache&&(n.cache=e.cache),e.credentials&&(n.credentials=e.credentials),e.redirect&&(n.redirect=e.redirect),e.referrer&&(n.referrer=e.referrer)}const r=yield fetch(e,n),i=yield r.arrayBuffer(),s={};return r.headers.forEach?r.headers.forEach(((e,t)=>{s[t.toLowerCase()]=e})):r.headers.keys().forEach((e=>{s[e.toLowerCase()]=r.headers.get(e)})),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:ie(new Uint8Array(i))}}))}var xn=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Sn=new J("web/5.7.1");function Ln(e){return new Promise((t=>{setTimeout(t,e)}))}function Fn(e,t){if(null==e)return null;if("string"==typeof e)return e;if(te(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return Dt(e)}catch(e){}return ce(e)}return e}function Mn(e,t,n){let r=null;if(null!=t){r=Ot(t);const n="string"==typeof e?{url:e}:Ye(e);if(n.headers){0!==Object.keys(n.headers).filter((e=>"content-type"===e.toLowerCase())).length||(n.headers=Ye(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return function(e,t,n){const r="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;Sn.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof e?e.throttleCallback:null,s="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;Sn.assertArgument(s>0&&s%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o="object"==typeof e&&!!e.errorPassThrough,a={};let l=null;const c={method:"GET"};let u=!1,d=12e4;if("string"==typeof e)l=e;else if("object"==typeof e){if(null!=e&&null!=e.url||Sn.throwArgumentError("missing URL","connection.url",e),l=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(const t in e.headers)a[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(u=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==l.substring(0,6)&&!0!==e.allowInsecureAuthentication&&Sn.throwError("basic authentication requires a secure https url",J.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;a.authorization={key:"Authorization",value:"Basic "+ct(Ot(t))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=Ye(e.fetchOptions))}const h=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=l?l.match(h):null;if(f)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?lt(f[3]):(p=f[3],Ot(p.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return n&&(t=n(e.body,e)),Promise.resolve(t)}catch(e){Sn.throwError("processing response error",J.errors.SERVER_ERROR,{body:Fn(f[1],f[2]),error:e,requestBody:null,requestMethod:"GET",url:l})}var p;t&&(c.method="POST",c.body=t,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(t.length)}));const m={};Object.keys(a).forEach((e=>{const t=a[e];m[t.key]=t.value})),c.headers=m;const g=function(){let e=null;return{promise:new Promise((function(t,n){d&&(e=setTimeout((()=>{null!=e&&(e=null,n(Sn.makeError("timeout",J.errors.TIMEOUT,{requestBody:Fn(c.body,m["content-type"]),requestMethod:c.method,timeout:d,url:l})))}),d))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),y=function(){return xn(this,void 0,void 0,(function*(){for(let e=0;e<r;e++){let t=null;try{if(t=yield Nn(l,c),e<r)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===c.method&&e.match(/^https:/)){l=t.headers.location;continue}}else if(429===t.statusCode){let n=!0;if(i&&(n=yield i(e,l)),n){let n=0;const r=t.headers["retry-after"];n="string"==typeof r&&r.match(/^[1-9][0-9]*$/)?1e3*parseInt(r):s*parseInt(String(Math.random()*Math.pow(2,e))),yield Ln(n);continue}}}catch(e){t=e.response,null==t&&(g.cancel(),Sn.throwError("missing response",J.errors.SERVER_ERROR,{requestBody:Fn(c.body,m["content-type"]),requestMethod:c.method,serverError:e,url:l}))}let a=t.body;if(u&&304===t.statusCode?a=null:!o&&(t.statusCode<200||t.statusCode>=300)&&(g.cancel(),Sn.throwError("bad response",J.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:Fn(a,t.headers?t.headers["content-type"]:null),requestBody:Fn(c.body,m["content-type"]),requestMethod:c.method,url:l})),n)try{const e=yield n(a,t);return g.cancel(),e}catch(n){if(n.throttleRetry&&e<r){let t=!0;if(i&&(t=yield i(e,l)),t){const t=s*parseInt(String(Math.random()*Math.pow(2,e)));yield Ln(t);continue}}g.cancel(),Sn.throwError("processing response error",J.errors.SERVER_ERROR,{body:Fn(a,t.headers?t.headers["content-type"]:null),error:n,requestBody:Fn(c.body,m["content-type"]),requestMethod:c.method,url:l})}return g.cancel(),a}return Sn.throwError("failed response",J.errors.SERVER_ERROR,{requestBody:Fn(c.body,m["content-type"]),requestMethod:c.method,url:l})}))}();return Promise.race([g.promise,y])}(e,r,((e,t)=>{let r=null;if(null!=e)try{r=JSON.parse(Dt(e))}catch(t){Sn.throwError("invalid JSON",J.errors.SERVER_ERROR,{body:e,error:t})}return n&&(r=n(r,t)),r}))}function qn(e,t){return t||(t={}),null==(t=Ye(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(n,r){let i=null,s=!1;const o=()=>!s&&(s=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{o()&&r(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let l=0;!function i(){return e().then((function(e){if(void 0!==e)o()&&n(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!s){if(l++,l>a)return void(o()&&r(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,l)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){o()&&r(e)}))}()}))}const Un="providers/5.7.2";function Vn(e,t,n){return n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},e(n,n.exports),n.exports}var Hn=jn;function jn(e,t){if(!e)throw new Error(t||"Assertion failed")}jn.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Qn=Vn((function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),s=i>>8,o=255&i;s?n.push(s,o):n.push(o)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}})),Yn=Vn((function(e,t){var n=t;n.assert=Hn,n.toArray=Qn.toArray,n.zero2=Qn.zero2,n.toHex=Qn.toHex,n.encode=Qn.encode,n.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<<t+1,s=e.clone(),o=0;o<r.length;o++){var a,l=s.andln(i-1);s.isOdd()?(a=l>(i>>1)-1?(i>>1)-l:l,s.isubn(a)):a=0,r[o]=a,s.iushrn(1)}return r},n.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,s=0;e.cmpn(-i)>0||t.cmpn(-s)>0;){var o,a,l=e.andln(3)+i&3,c=t.andln(3)+s&3;3===l&&(l=-1),3===c&&(c=-1),o=1&l?3!==(r=e.andln(7)+i&7)&&5!==r||2!==c?l:-l:0,n[0].push(o),a=1&c?3!==(r=t.andln(7)+s&7)&&5!==r||2!==l?c:-c:0,n[1].push(a),2*i===o+1&&(i=1-i),2*s===a+1&&(s=1-s),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new D(e,"hex","le")}})),Gn=Yn.getNAF,Xn=Yn.getJSF,$n=Yn.assert;function Kn(e,t){this.type=e,this.p=new D(t.p,16),this.red=t.prime?D.red(t.prime):D.mont(this.p),this.zero=new D(0).toRed(this.red),this.one=new D(1).toRed(this.red),this.two=new D(2).toRed(this.red),this.n=t.n&&new D(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zn=Kn;function Jn(e,t){this.curve=e,this.type=t,this.precomputed=null}Kn.prototype.point=function(){throw new Error("Not implemented")},Kn.prototype.validate=function(){throw new Error("Not implemented")},Kn.prototype._fixedNafMul=function(e,t){$n(e.precomputed);var n=e._getDoubles(),r=Gn(t,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var s,o,a=[];for(s=0;s<r.length;s+=n.step){o=0;for(var l=s+n.step-1;l>=s;l--)o=(o<<1)+r[l];a.push(o)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<a.length;s++)(o=a[s])===d?u=u.mixedAdd(n.points[s]):o===-d&&(u=u.mixedAdd(n.points[s].neg()));c=c.add(u)}return c.toP()},Kn.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,s=Gn(t,n,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var l=0;a>=0&&0===s[a];a--)l++;if(a>=0&&l++,o=o.dblp(l),a<0)break;var c=s[a];$n(0!==c),o="affine"===e.type?c>0?o.mixedAdd(i[c-1>>1]):o.mixedAdd(i[-c-1>>1].neg()):c>0?o.add(i[c-1>>1]):o.add(i[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},Kn.prototype._wnafMulAdd=function(e,t,n,r,i){var s,o,a,l=this._wnafT1,c=this._wnafT2,u=this._wnafT3,d=0;for(s=0;s<r;s++){var h=(a=t[s])._getNAFPoints(e);l[s]=h.wnd,c[s]=h.points}for(s=r-1;s>=1;s-=2){var f=s-1,p=s;if(1===l[f]&&1===l[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Xn(n[f],n[p]);for(d=Math.max(y[0].length,d),u[f]=new Array(d),u[p]=new Array(d),o=0;o<d;o++){var A=0|y[0][o],E=0|y[1][o];u[f][o]=g[3*(A+1)+(E+1)],u[p][o]=0,c[f]=m}}else u[f]=Gn(n[f],l[f],this._bitLength),u[p]=Gn(n[p],l[p],this._bitLength),d=Math.max(u[f].length,d),d=Math.max(u[p].length,d)}var b=this.jpoint(null,null,null),v=this._wnafT4;for(s=d;s>=0;s--){for(var w=0;s>=0;){var O=!0;for(o=0;o<r;o++)v[o]=0|u[o][s],0!==v[o]&&(O=!1);if(!O)break;w++,s--}if(s>=0&&w++,b=b.dblp(w),s<0)break;for(o=0;o<r;o++){var D=v[o];0!==D&&(D>0?a=c[o][D-1>>1]:D<0&&(a=c[o][-D-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(s=0;s<r;s++)c[s]=null;return i?b:b.toP()},Kn.BasePoint=Jn,Jn.prototype.eq=function(){throw new Error("Not implemented")},Jn.prototype.validate=function(){return this.curve.validate(this)},Kn.prototype.decodePoint=function(e,t){e=Yn.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?$n(e[e.length-1]%2==0):7===e[0]&&$n(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},Jn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Jn.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},Jn.prototype.encode=function(e,t){return Yn.encode(this._encode(t),e)},Jn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Jn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Jn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var s=0;s<e;s++)r=r.dbl();n.push(r)}return{step:e,points:n}},Jn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},Jn.prototype._getBeta=function(){return null},Jn.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var Wn=Vn((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),Zn=Yn.assert;function er(e){zn.call(this,"short",e),this.a=new D(e.a,16).toRed(this.red),this.b=new D(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Wn(er,zn);var tr=er;function nr(e,t,n,r){zn.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new D(t,16),this.y=new D(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function rr(e,t,n,r){zn.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new D(0)):(this.x=new D(t,16),this.y=new D(n,16),this.z=new D(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}er.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new D(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new D(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],Zn(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new D(e.a,16),b:new D(e.b,16)}})):this._getEndoBasis(n)}}},er.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:D.mont(e),n=new D(2).toRed(t).redInvm(),r=n.redNeg(),i=new D(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},er.prototype._getEndoBasis=function(e){for(var t,n,r,i,s,o,a,l,c,u=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),f=new D(1),p=new D(0),m=new D(0),g=new D(1),y=0;0!==d.cmpn(0);){var A=h.div(d);l=h.sub(A.mul(d)),c=m.sub(A.mul(f));var E=g.sub(A.mul(p));if(!r&&l.cmp(u)<0)t=a.neg(),n=f,r=l.neg(),i=c;else if(r&&2==++y)break;a=l,h=d,d=l,m=f,f=c,g=p,p=E}s=l.neg(),o=c;var b=r.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(b)>=0&&(s=t,o=n),r.negative&&(r=r.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:r,b:i},{a:s,b:o}]},er.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),o=i.mul(n.a),a=s.mul(r.a),l=i.mul(n.b),c=s.mul(r.b);return{k1:e.sub(o).sub(a),k2:l.add(c).neg()}},er.prototype.pointFromX=function(e,t){(e=new D(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},er.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},er.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],l=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),l=l.neg(!0)),r[2*s]=a,r[2*s+1]=l,i[2*s]=o.k1,i[2*s+1]=o.k2}for(var c=this._wnafMulAdd(1,r,i,2*s,n),u=0;u<2*s;u++)r[u]=null,i[u]=null;return c},Wn(nr,zn.BasePoint),er.prototype.point=function(e,t,n){return new nr(this,e,t,n)},er.prototype.pointFromJSON=function(e,t){return nr.fromJSON(this,e,t)},nr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},nr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},nr.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var s=t[2];return r.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[r].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[r].concat(s.naf.points.map(i))}},r},nr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},nr.prototype.isInfinity=function(){return this.inf},nr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},nr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},nr.prototype.getX=function(){return this.x.fromRed()},nr.prototype.getY=function(){return this.y.fromRed()},nr.prototype.mul=function(e){return e=new D(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},nr.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},nr.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},nr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},nr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},nr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Wn(rr,zn.BasePoint),er.prototype.jpoint=function(e,t,n){return new rr(this,e,t,n)},rr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},rr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},rr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),l=s.redSub(o);if(0===a.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),d=r.redMul(c),h=l.redSqr().redIAdd(u).redISub(d).redISub(d),f=l.redMul(d.redISub(h)).redISub(s.redMul(u)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,f,p)},rr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,s=e.y.redMul(t).redMul(this.z),o=n.redSub(r),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=o.redSqr(),c=l.redMul(o),u=n.redMul(l),d=a.redSqr().redIAdd(c).redISub(u).redISub(u),h=a.redMul(u.redISub(d)).redISub(i.redMul(c)),f=this.z.redMul(o);return this.curve.jpoint(d,h,f)},rr.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,l=a.redSqr().redSqr(),c=o.redAdd(o);for(t=0;t<e;t++){var u=s.redSqr(),d=c.redSqr(),h=d.redSqr(),f=u.redAdd(u).redIAdd(u).redIAdd(r.redMul(l)),p=s.redMul(d),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=f.redMul(g);y=y.redIAdd(y).redISub(h);var A=c.redMul(a);t+1<e&&(l=l.redMul(h)),s=m,a=A,c=y}return this.curve.jpoint(s,c.redMul(i),a)},rr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},rr.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(s);o=o.redIAdd(o);var a=r.redAdd(r).redIAdd(r),l=a.redSqr().redISub(o).redISub(o),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=l,t=a.redMul(o.redISub(l)).redISub(c),n=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),f=this.x.redAdd(d).redSqr().redISub(u).redISub(h);f=f.redIAdd(f);var p=u.redAdd(u).redIAdd(u),m=p.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},rr.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(s);o=o.redIAdd(o);var a=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),l=a.redSqr().redISub(o).redISub(o);e=l;var c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(o.redISub(l)).redISub(c),n=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),f=this.x.redSub(u).redMul(this.x.redAdd(u));f=f.redAdd(f).redIAdd(f);var p=h.redIAdd(h),m=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(u);var g=d.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=f.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},rr.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),s=t.redSqr(),o=n.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(i)),l=t.redAdd(t),c=(l=l.redIAdd(l)).redMul(o),u=a.redSqr().redISub(c.redAdd(c)),d=c.redISub(u),h=o.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=a.redMul(d).redISub(h),p=n.redAdd(n).redMul(r);return this.curve.jpoint(u,f,p)},rr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),s=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(r),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),l=r.redIAdd(r);l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var c=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(l),u=t.redMul(c);u=(u=u.redIAdd(u)).redIAdd(u);var d=this.x.redMul(a).redISub(u);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(c.redMul(l.redISub(c)).redISub(o.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=this.z.redAdd(o).redSqr().redISub(n).redISub(a);return this.curve.jpoint(d,h,f)},rr.prototype.mul=function(e,t){return e=new D(e,t),this.curve._wnafMul(this,e)},rr.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},rr.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},rr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},rr.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ir=Vn((function(e,t){var n=t;n.base=zn,n.short=tr,n.mont=null,n.edwards=null})),sr=Vn((function(e,t){var n,r=t,i=Yn.assert;function s(e){"short"===e.type?this.curve=new ir.short(e):"edwards"===e.type?this.curve=new ir.edwards(e):this.curve=new ir.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new s(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=s,o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:T.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:T.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:T.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:T.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:T.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:T.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:T.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(e){n=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:T.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function or(e){if(!(this instanceof or))return new or(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Qn.toArray(e.entropy,e.entropyEnc||"hex"),n=Qn.toArray(e.nonce,e.nonceEnc||"hex"),r=Qn.toArray(e.pers,e.persEnc||"hex");Hn(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var ar=or;or.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},or.prototype._hmac=function(){return new T.hmac(this.hash,this.K)},or.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},or.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=Qn.toArray(e,t),n=Qn.toArray(n,r),Hn(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},or.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=Qn.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,e);return this._update(n),this._reseed++,Qn.encode(s,t)};var lr=Yn.assert;function cr(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var ur=cr;cr.fromPublic=function(e,t,n){return t instanceof cr?t:new cr(e,{pub:t,pubEnc:n})},cr.fromPrivate=function(e,t,n){return t instanceof cr?t:new cr(e,{priv:t,privEnc:n})},cr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},cr.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},cr.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},cr.prototype._importPrivate=function(e,t){this.priv=new D(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},cr.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?lr(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||lr(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},cr.prototype.derive=function(e){return e.validate()||lr(e.validate(),"public point not validated"),e.mul(this.priv).getX()},cr.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},cr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},cr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var dr=Yn.assert;function hr(e,t){if(e instanceof hr)return e;this._importDER(e,t)||(dr(e.r&&e.s,"Signature without r or s"),this.r=new D(e.r,16),this.s=new D(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var fr=hr;function pr(){this.place=0}function mr(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,s=0,o=t.place;s<r;s++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function gr(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function yr(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}hr.prototype._importDER=function(e,t){e=Yn.toArray(e,t);var n=new pr;if(48!==e[n.place++])return!1;var r=mr(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=mr(e,n);if(!1===i)return!1;var s=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var o=mr(e,n);if(!1===o)return!1;if(e.length!==o+n.place)return!1;var a=e.slice(n.place,o+n.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new D(s),this.s=new D(a),this.recoveryParam=null,!0},hr.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=gr(t),n=gr(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];yr(r,t.length),(r=r.concat(t)).push(2),yr(r,n.length);var i=r.concat(n),s=[48];return yr(s,i.length),s=s.concat(i),Yn.encode(s,e)};var Ar=function(){throw new Error("unsupported")},Er=Yn.assert;function br(e){if(!(this instanceof br))return new br(e);"string"==typeof e&&(Er(Object.prototype.hasOwnProperty.call(sr,e),"Unknown curve "+e),e=sr[e]),e instanceof sr.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var vr=br;br.prototype.keyPair=function(e){return new ur(this,e)},br.prototype.keyFromPrivate=function(e,t){return ur.fromPrivate(this,e,t)},br.prototype.keyFromPublic=function(e,t){return ur.fromPublic(this,e,t)},br.prototype.genKeyPair=function(e){e||(e={});for(var t=new ar({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Ar(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new D(2));;){var i=new D(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},br.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},br.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new D(e,16));for(var i=this.n.byteLength(),s=t.getPrivate().toArray("be",i),o=e.toArray("be",i),a=new ar({hash:this.hash,entropy:s,nonce:o,pers:r.pers,persEnc:r.persEnc||"utf8"}),l=this.n.sub(new D(1)),c=0;;c++){var u=r.k?r.k(c):new D(a.generate(this.n.byteLength()));if(!((u=this._truncateToN(u,!0)).cmpn(1)<=0||u.cmp(l)>=0)){var d=this.g.mul(u);if(!d.isInfinity()){var h=d.getX(),f=h.umod(this.n);if(0!==f.cmpn(0)){var p=u.invm(this.n).mul(f.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==h.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new fr({r:f,s:p,recoveryParam:m})}}}}}},br.prototype.verify=function(e,t,n,r){e=this._truncateToN(new D(e,16)),n=this.keyFromPublic(n,r);var i=(t=new fr(t,"hex")).r,s=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o,a=s.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(o=this.g.jmulAdd(l,n.getPublic(),c)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(l,n.getPublic(),c)).isInfinity()&&0===o.getX().umod(this.n).cmp(i)},br.prototype.recoverPubKey=function(e,t,n,r){Er((3&n)===n,"The recovery param is more than two bits"),t=new fr(t,r);var i=this.n,s=new D(e),o=t.r,a=t.s,l=1&n,c=n>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),l):this.curve.pointFromX(o,l);var u=t.r.invm(i),d=i.sub(s).mul(u).umod(i),h=a.mul(u).umod(i);return this.g.mulAdd(d,o,h)},br.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new fr(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var wr=Vn((function(e,t){var n=t;n.version="6.5.4",n.utils=Yn,n.rand=function(){throw new Error("unsupported")},n.curve=ir,n.curves=sr,n.ec=vr,n.eddsa=null})).ec;const Or=new J("signing-key/5.7.0");let Dr=null;function Tr(){return Dr||(Dr=new wr("secp256k1")),Dr}class Pr{constructor(e){He(this,"curve","secp256k1"),He(this,"privateKey",ce(e)),32!==ue(this.privateKey)&&Or.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Tr().keyFromPrivate(ie(this.privateKey));He(this,"publicKey","0x"+t.getPublic(!1,"hex")),He(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),He(this,"_isSigningKey",!0)}_addPoint(e){const t=Tr().keyFromPublic(ie(this.publicKey)),n=Tr().keyFromPublic(ie(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const t=Tr().keyFromPrivate(ie(this.privateKey)),n=ie(e);32!==n.length&&Or.throwArgumentError("bad digest length","digest",e);const r=t.sign(n,{canonical:!0});return me({recoveryParam:r.recoveryParam,r:pe("0x"+r.r.toString(16),32),s:pe("0x"+r.s.toString(16),32)})}computeSharedSecret(e){const t=Tr().keyFromPrivate(ie(this.privateKey)),n=Tr().keyFromPublic(ie(_r(e)));return pe("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function _r(e,t){const n=ie(e);if(32===n.length){return new Pr(n).publicKey}return 33===n.length?"0x"+Tr().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?ce(n):Or.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Rr=new J("transactions/5.7.0");var Ir;function Cr(e){return"0x"===e?null:fn(e)}function Br(e){return"0x"===e?ft:we.from(e)}function kr(e,t){return function(e){return fn(de(gt(de(_r(e),1)),12))}(function(e,t){const n=me(t),r={r:ie(n.r),s:ie(n.s)};return"0x"+Tr().recoverPubKey(ie(e),r,n.recoveryParam).encode("hex",!1)}(ie(e),t))}function Nr(e,t){const n=oe(we.from(e).toHexString());return n.length>32&&Rr.throwArgumentError("invalid length for "+t,"transaction:"+t,e),n}function xr(e,t){return{address:fn(e),storageKeys:(t||[]).map(((t,n)=>(32!==ue(t)&&Rr.throwArgumentError("invalid access list storageKey",`accessList[${e}:${n}]`,t),t.toLowerCase())))}}function Sr(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&Rr.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),xr(e[0],e[1])):xr(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const n=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return xr(t,Object.keys(n).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function Lr(e){return Sr(e).map((e=>[e.address,e.storageKeys]))}function Fr(e,t){if(null!=e.gasPrice){const t=we.from(e.gasPrice),n=we.from(e.maxFeePerGas||0);t.eq(n)||Rr.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:n})}const n=[Nr(e.chainId||0,"chainId"),Nr(e.nonce||0,"nonce"),Nr(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Nr(e.maxFeePerGas||0,"maxFeePerGas"),Nr(e.gasLimit||0,"gasLimit"),null!=e.to?fn(e.to):"0x",Nr(e.value||0,"value"),e.data||"0x",Lr(e.accessList||[])];if(t){const e=me(t);n.push(Nr(e.recoveryParam,"recoveryParam")),n.push(oe(e.r)),n.push(oe(e.s))}return he(["0x02",rn(n)])}function Mr(e,t){const n=[Nr(e.chainId||0,"chainId"),Nr(e.nonce||0,"nonce"),Nr(e.gasPrice||0,"gasPrice"),Nr(e.gasLimit||0,"gasLimit"),null!=e.to?fn(e.to):"0x",Nr(e.value||0,"value"),e.data||"0x",Lr(e.accessList||[])];if(t){const e=me(t);n.push(Nr(e.recoveryParam,"recoveryParam")),n.push(oe(e.r)),n.push(oe(e.s))}return he(["0x01",rn(n)])}function qr(e,t,n){try{const n=Br(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(e){Rr.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=pe(t[1],32),e.s=pe(t[2],32);try{const t=gt(n(e));e.from=kr(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function Ur(e){const t=ie(e);if(t[0]>127)return function(e){const t=an(e);9!==t.length&&6!==t.length&&Rr.throwArgumentError("invalid raw transaction","rawTransaction",e);const n={nonce:Br(t[0]).toNumber(),gasPrice:Br(t[1]),gasLimit:Br(t[2]),to:Cr(t[3]),value:Br(t[4]),data:t[5],chainId:0};if(6===t.length)return n;try{n.v=we.from(t[6]).toNumber()}catch(e){return n}if(n.r=pe(t[7],32),n.s=pe(t[8],32),we.from(n.r).isZero()&&we.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let r=n.v-27;const i=t.slice(0,6);0!==n.chainId&&(i.push(ce(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const s=gt(rn(i));try{n.from=kr(s,{r:ce(n.r),s:ce(n.s),recoveryParam:r})}catch(e){}n.hash=gt(e)}return n.type=null,n}(t);switch(t[0]){case 1:return function(e){const t=an(e.slice(1));8!==t.length&&11!==t.length&&Rr.throwArgumentError("invalid component count for transaction type: 1","payload",ce(e));const n={type:1,chainId:Br(t[0]).toNumber(),nonce:Br(t[1]).toNumber(),gasPrice:Br(t[2]),gasLimit:Br(t[3]),to:Cr(t[4]),value:Br(t[5]),data:t[6],accessList:Sr(t[7])};return 8===t.length||(n.hash=gt(e),qr(n,t.slice(8),Mr)),n}(t);case 2:return function(e){const t=an(e.slice(1));9!==t.length&&12!==t.length&&Rr.throwArgumentError("invalid component count for transaction type: 2","payload",ce(e));const n=Br(t[2]),r=Br(t[3]),i={type:2,chainId:Br(t[0]).toNumber(),nonce:Br(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:Br(t[4]),to:Cr(t[5]),value:Br(t[6]),data:t[7],accessList:Sr(t[8])};return 9===t.length||(i.hash=gt(e),qr(i,t.slice(9),Fr)),i}(t)}return Rr.throwError(`unsupported transaction type: ${t[0]}`,J.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(Ir||(Ir={}));const Vr=new J(Un);class Hr{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),s=this.hash.bind(this),o=this.hex.bind(this),a=this.number.bind(this),l=this.type.bind(this);return e.transaction={hash:s,type:l,accessList:Hr.allowNull(this.accessList.bind(this),null),blockHash:Hr.allowNull(s,null),blockNumber:Hr.allowNull(a,null),transactionIndex:Hr.allowNull(a,null),confirmations:Hr.allowNull(a,null),from:t,gasPrice:Hr.allowNull(n),maxPriorityFeePerGas:Hr.allowNull(n),maxFeePerGas:Hr.allowNull(n),gasLimit:n,to:Hr.allowNull(t,null),value:n,nonce:a,data:i,r:Hr.allowNull(this.uint256),s:Hr.allowNull(this.uint256),v:Hr.allowNull(a),creates:Hr.allowNull(t,null),raw:Hr.allowNull(i)},e.transactionRequest={from:Hr.allowNull(t),nonce:Hr.allowNull(a),gasLimit:Hr.allowNull(n),gasPrice:Hr.allowNull(n),maxPriorityFeePerGas:Hr.allowNull(n),maxFeePerGas:Hr.allowNull(n),to:Hr.allowNull(t),value:Hr.allowNull(n),data:Hr.allowNull((e=>this.data(e,!0))),type:Hr.allowNull(a),accessList:Hr.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:t,topics:Hr.arrayOf(s),data:i,logIndex:a,blockHash:s},e.receipt={to:Hr.allowNull(this.address,null),from:Hr.allowNull(this.address,null),contractAddress:Hr.allowNull(t,null),transactionIndex:a,root:Hr.allowNull(o),gasUsed:n,logsBloom:Hr.allowNull(i),blockHash:s,transactionHash:s,logs:Hr.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Hr.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:Hr.allowNull(n),status:Hr.allowNull(a),type:l},e.block={hash:Hr.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:Hr.allowNull(o),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:Hr.allowNull(t),extraData:i,transactions:Hr.allowNull(Hr.arrayOf(s)),baseFeePerGas:Hr.allowNull(n)},e.blockWithTransactions=Ye(e.block),e.blockWithTransactions.transactions=Hr.allowNull(Hr.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Hr.allowNull(r,void 0),toBlock:Hr.allowNull(r,void 0),blockHash:Hr.allowNull(s,void 0),address:Hr.allowNull(t,void 0),topics:Hr.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Hr.allowNull(a),blockHash:Hr.allowNull(s),transactionIndex:a,removed:Hr.allowNull(this.boolean.bind(this)),address:t,data:Hr.allowFalsish(i,"0x"),topics:Hr.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return Sr(e||[])}number(e){return"0x"===e?0:we.from(e).toNumber()}type(e){return"0x"===e||null==e?0:we.from(e).toNumber()}bigNumber(e){return we.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),ae(e))?e.toLowerCase():Vr.throwArgumentError("invalid hash","value",e)}data(e,t){const n=this.hex(e,t);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return fn(e)}callAddress(e){if(!ae(e,32))return null;const t=fn(de(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return pn(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||ae(e))return fe(e);throw new Error("invalid blockTag")}hash(e,t){const n=this.hex(e,t);return 32!==ue(n)?Vr.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(null==e)return null;const t=we.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!ae(e))throw new Error("invalid uint256");return pe(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const n=null!=e._difficulty?e._difficulty:e.difficulty,r=Hr.check(t,e);return r._difficulty=null==n?null:we.from(n),r}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Hr.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&we.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=Hr.check(this.formats.transaction,e);if(null!=e.chainId){let n=e.chainId;ae(n)&&(n=we.from(n).toNumber()),t.chainId=n}else{let n=e.networkId;null==n&&null==t.v&&(n=e.chainId),ae(n)&&(n=we.from(n).toNumber()),"number"!=typeof n&&null!=t.v&&(n=(t.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),t.chainId=n}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return Ur(e)}receiptLog(e){return Hr.check(this.formats.receiptLog,e)}receipt(e){const t=Hr.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=we.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&Vr.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):Vr.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&Vr.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return Hr.check(this.formats.filter,e)}filterLog(e){return Hr.check(this.formats.filterLog,e)}static check(e,t){const n={};for(const r in e)try{const i=e[r](t[r]);void 0!==i&&(n[r]=i)}catch(e){throw e.checkKey=r,e.checkValue=t[r],e}return n}static allowNull(e,t){return function(n){return null==n?t:e(n)}}static allowFalsish(e,t){return function(n){return n?e(n):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const n=[];return t.forEach((function(t){n.push(e(t))})),n}}}var jr=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Qr=new J(Un);function Yr(e){return null==e?"null":(32!==ue(e)&&Qr.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function Gr(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[Yr(e)]=!0}));const n=Object.keys(t);return n.sort(),n.join("|")}return Yr(e)})).join("&")}function Xr(e){if("string"==typeof e){if(32===ue(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+Gr(e);if(Ze.isForkEvent(e))throw Qr.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+Gr(e.topics||[])}throw new Error("invalid event - "+e)}function $r(){return(new Date).getTime()}function Kr(e){return new Promise((t=>{setTimeout(t,e)}))}const zr=["block","network","pending","poll"];class Jr{constructor(e,t,n){He(this,"tag",e),He(this,"listener",t),He(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],n=""===(r=e[2])?[]:r.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var r;const i={};return n.length>0&&(i.topics=n),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||zr.indexOf(this.tag)>=0}}const Wr={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Zr(e){return pe(we.from(e).toHexString(),32)}function ei(e){return dt.encode(se([e,de(Bn(Bn(e)),0,4)]))}const ti=new RegExp("^(ipfs)://(.*)$","i"),ni=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),ti,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function ri(e,t){try{return Dt(ii(e,t))}catch(e){}return null}function ii(e,t){if("0x"===e)return null;const n=we.from(de(e,t,t+32)).toNumber(),r=we.from(de(e,n,n+32)).toNumber();return de(e,n+32,n+32+r)}function si(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):Qr.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function oi(e){const t=ie(e);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function ai(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function li(e){const t=[];let n=0;for(let r=0;r<e.length;r++)t.push(null),n+=32;for(let r=0;r<e.length;r++){const i=ie(e[r]);t[r]=oi(n),t.push(oi(i.length)),t.push(ai(i)),n+=32+32*Math.ceil(i.length/32)}return he(t)}class ci{constructor(e,t,n,r){He(this,"provider",e),He(this,"name",n),He(this,"address",e.formatter.address(t)),He(this,"_resolvedAddress",r)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((e=>we.from(e).eq(1))).catch((e=>{if(e.code===J.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return jr(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:he([e,Wt(this.name),t||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=he(["0x9061b923",li([(i=this.name,ce(se(Jt(i).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"),n.data])]));try{let e=yield this.provider.call(n);return ie(e).length%32==4&&Qr.throwError("resolver threw error",J.errors.CALL_EXCEPTION,{transaction:n,data:e}),r&&(e=ii(e,0)),e}catch(e){if(e.code===J.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return jr(this,void 0,void 0,(function*(){const n=yield this._fetch(e,t);return null!=n?ii(n,0):null}))}_getAddress(e,t){const n=Wr[String(e)];if(null==n&&Qr.throwError(`unsupported coin type: ${e}`,J.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===n.ilk)return this.provider.formatter.address(t);const r=ie(t);if(null!=n.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return ei(se([[n.p2pkh],"0x"+e[2]]))}}if(null!=n.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return ei(se([[n.p2sh],"0x"+e[2]]))}}if(null!=n.prefix){const e=r[1];let t=r[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&r.length===2+e&&e>=1&&e<=75){const e=P.toWords(r.slice(2));return e.unshift(t),P.encode(n.prefix,e)}}return null}getAddress(e){return jr(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===J.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",Zr(e));if(null==t||"0x"===t)return null;const n=this._getAddress(e,t);return null==n&&Qr.throwError("invalid or unsupported coin data",J.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),n}))}getAvatar(){return jr(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let n=0;n<ni.length;n++){const r=t.match(ni[n]);if(null==r)continue;const i=r[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:si(t)};case"erc721":case"erc1155":{const n="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});const s=this._resolvedAddress||(yield this.getAddress()),o=(r[2]||"").split("/");if(2!==o.length)return null;const a=yield this.provider.formatter.address(o[0]),l=pe(we.from(o[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:he(["0x6352211e",l])}));if(s!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=we.from(yield this.provider.call({to:a,data:he(["0x00fdd58e",pe(s,32),l])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const c={to:this.provider.formatter.address(o[0]),data:he([n,l])};let u=ri(yield this.provider.call(c),0);if(null==u)return null;e.push({type:"metadata-url-base",content:u}),"erc1155"===i&&(u=u.replace("{id}",l.substring(2)),e.push({type:"metadata-url-expanded",content:u})),u.match(/^ipfs:/i)&&(u=si(u)),e.push({type:"metadata-url",content:u});const d=yield Mn(u);if(!d)return null;e.push({type:"metadata",content:JSON.stringify(d)});let h=d.image;if("string"!=typeof h)return null;if(h.match(/^(https:\/\/|data:)/i));else{if(null==h.match(ti))return null;e.push({type:"url-ipfs",content:h}),h=si(h)}return e.push({type:"url",content:h}),{linkage:e,url:h}}}}}catch(e){}return null}))}getContentHash(){return jr(this,void 0,void 0,(function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+dt.encode("0x"+t[1])}const n=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const e=parseInt(n[3],16);if(n[4].length===2*e)return"ipns://"+dt.encode("0x"+n[1])}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&64===r[1].length)return"bzz://"+r[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"};return"sia://"+ct("0x"+i[1]).replace(/[=+\/]/g,(t=>e[t]))}return Qr.throwError("invalid or unsupported content hash data",J.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return jr(this,void 0,void 0,(function*(){let t=Ot(e);t=se([Zr(64),Zr(t.length),t]),t.length%32!=0&&(t=se([t,pe("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",ce(t));return null==n||"0x"===n?null:Dt(n)}))}}let ui=null,di=1;class hi extends et{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),He(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=je(new.target,"getNetwork")(e);t?(He(this,"_network",t),this.emit("network",t,null)):Qr.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return jr(this,void 0,void 0,(function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||Qr.throwError("no network detected",J.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:He(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return qn((()=>this._ready().then((e=>e),(e=>{if(e.code!==J.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==ui&&(ui=new Hr),ui}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in at){const n=at[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=at[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=at[e.name];if(!t)return"number"!=typeof e.chainId&&tt.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&tt.throwArgumentError("network chainId mismatch","network",e);let n=e._defaultProvider||null;var r;return null==n&&t._defaultProvider&&(n=(r=t._defaultProvider)&&"function"==typeof r.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:n}}(null==e?"homestead":e)}ccipReadFetch(e,t,n){return jr(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=e.to.toLowerCase(),i=t.toLowerCase(),s=[];for(let e=0;e<n.length;e++){const t=n[e],o=t.replace("{sender}",r).replace("{data}",i),a=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:r}),l=yield Mn({url:o,errorPassThrough:!0},a,((e,t)=>(e.status=t.statusCode,e)));if(l.data)return l.data;const c=l.message||"unknown error";if(l.status>=400&&l.status<500)return Qr.throwError(`response not found during CCIP fetch: ${c}`,J.errors.SERVER_ERROR,{url:t,errorMessage:c});s.push(c)}return Qr.throwError(`error encountered during CCIP fetch: ${s.map((e=>JSON.stringify(e))).join(", ")}`,J.errors.SERVER_ERROR,{urls:n,errorMessages:s})}))}_getInternalBlockNumber(e){return jr(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const n=yield t;if($r()-n.respTime<=e)return n.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=$r(),n=Qe({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=$r();return(e=we.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}}));return this._internalBlockNumber=n,n.catch((e=>{this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return jr(this,void 0,void 0,(function*(){const e=di++,t=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)Qr.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",Qr.makeError("network block skew detected",J.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let e=this._emitted.block+1;e<=n;e++)this.emit("block",e);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&n-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((e=>{switch(e.type){case"tx":{const n=e.hash;let r=this.getTransactionReceipt(n).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+n]=e.blockNumber,this.emit(n,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(r);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);const r=e.filter;r.fromBlock=e._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const s=this.getLogs(r).then((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(r,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(s)}}})),this._lastBlockNumber=n,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return jr(this,void 0,void 0,(function*(){return Qr.throwError("provider does not support network detection",J.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return jr(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield Kr(0),this._network;const n=Qr.makeError("underlying network changed",J.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",n),n}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=$r();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=$r(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,n){return jr(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,n||0,null)}))}_waitForTransaction(e,t,n,r){return jr(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,s)=>{const o=[];let a=!1;const l=function(){return!!a||(a=!0,o.forEach((e=>{e()})),!1)},c=e=>{e.confirmations<t||l()||i(e)};if(this.on(e,c),o.push((()=>{this.removeListener(e,c)})),r){let n=r.startBlock,i=null;const c=o=>jr(this,void 0,void 0,(function*(){a||(yield Kr(1e3),this.getTransactionCount(r.from).then((u=>jr(this,void 0,void 0,(function*(){if(!a){if(u<=r.nonce)n=o;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=n-3,i<r.startBlock&&(i=r.startBlock));i<=o;){if(a)return;const n=yield this.getBlockWithTransactions(i);for(let i=0;i<n.transactions.length;i++){const o=n.transactions[i];if(o.hash===e)return;if(o.from===r.from&&o.nonce===r.nonce){if(a)return;const n=yield this.waitForTransaction(o.hash,t);if(l())return;let i="replaced";return o.data===r.data&&o.to===r.to&&o.value.eq(r.value)?i="repriced":"0x"===o.data&&o.from===o.to&&o.value.isZero()&&(i="cancelled"),void s(Qr.makeError("transaction was replaced",J.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(o),hash:e,receipt:n}))}}i++}}a||this.once("block",c)}}))),(e=>{a||this.once("block",c)})))}));if(a)return;this.once("block",c),o.push((()=>{this.removeListener("block",c)}))}if("number"==typeof n&&n>0){const e=setTimeout((()=>{l()||s(Qr.makeError("timeout exceeded",J.errors.TIMEOUT,{timeout:n}))}),n);e.unref&&e.unref(),o.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return jr(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return we.from(e)}catch(t){return Qr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Qe({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getBalance",n);try{return we.from(r)}catch(e){return Qr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:e})}}))}getTransactionCount(e,t){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Qe({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getTransactionCount",n);try{return we.from(r).toNumber()}catch(e){return Qr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:e})}}))}getCode(e,t){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Qe({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getCode",n);try{return ce(r)}catch(e){return Qr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:e})}}))}getStorageAt(e,t,n){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qe({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(t).then((e=>fe(e)))}),i=yield this.perform("getStorageAt",r);try{return ce(i)}catch(e){return Qr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:e})}}))}_wrapTransaction(e,t,n){if(null!=t&&32!==ue(t))throw new Error("invalid response - sendTransaction");const r=e;return null!=t&&e.hash!==t&&Qr.throwError("Transaction hash mismatch from Provider.sendTransaction.",J.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),r.wait=(t,r)=>jr(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==r&&(r=0),0!==t&&null!=n&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const s=yield this._waitForTransaction(e.hash,t,r,i);return null==s&&0===t?null:(this._emitted["t:"+e.hash]=s.blockNumber,0===s.status&&Qr.throwError("transaction failed",J.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:s}),s)})),r}sendTransaction(e){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>ce(e))),n=this.formatter.transaction(e);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(n,e,r)}catch(e){throw e.transaction=n,e.transactionHash=n.hash,e}}))}_getTransactionRequest(e){return jr(this,void 0,void 0,(function*(){const t=yield e,n={};return["from","to"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?we.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(n.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?ce(e):null)))})),this.formatter.transactionRequest(yield Qe(n))}))}_getFilter(e){return jr(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((n=>{null!=e[n]&&(t[n]=e[n])})),["fromBlock","toBlock"].forEach((n=>{null!=e[n]&&(t[n]=this._getBlockTag(e[n]))})),this.formatter.filter(yield Qe(t))}))}_call(e,t,n){return jr(this,void 0,void 0,(function*(){n>=10&&Qr.throwError("CCIP read exceeded maximum redirections",J.errors.SERVER_ERROR,{redirects:n,transaction:e});const r=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(n>=0&&"latest"===t&&null!=r&&"0x556f1830"===i.substring(0,10)&&ue(i)%32==4)try{const s=de(i,4),o=de(s,0,32);we.from(o).eq(r)||Qr.throwError("CCIP Read sender did not match",J.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],l=we.from(de(s,32,64)).toNumber(),c=we.from(de(s,l,l+32)).toNumber(),u=de(s,l+32);for(let t=0;t<c;t++){const n=ri(u,32*t);null==n&&Qr.throwError("CCIP Read contained corrupt URL string",J.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),a.push(n)}const d=ii(s,64);we.from(de(s,100,128)).isZero()||Qr.throwError("CCIP Read callback selector included junk",J.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const h=de(s,96,100),f=ii(s,128),p=yield this.ccipReadFetch(e,d,a);null==p&&Qr.throwError("CCIP Read disabled or provided no URLs",J.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const m={to:r,data:he([h,li([p,f])])};return this._call(m,t,n+1)}catch(e){if(e.code===J.errors.SERVER_ERROR)throw e}try{return ce(i)}catch(n){return Qr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:n})}}))}call(e,t){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Qe({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(n.transaction,n.blockTag,n.ccipReadEnabled?0:-1)}))}estimateGas(e){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Qe({transaction:this._getTransactionRequest(e)}),n=yield this.perform("estimateGas",t);try{return we.from(n)}catch(e){return Qr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:n,error:e})}}))}_getAddress(e){return jr(this,void 0,void 0,(function*(){"string"!=typeof(e=yield e)&&Qr.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&Qr.throwError("ENS name not configured",J.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t}))}_getBlock(e,t){return jr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;let n=-128;const r={includeTransactions:!!t};if(ae(e,32))r.blockHash=e;else try{r.blockTag=yield this._getBlockTag(e),ae(r.blockTag)&&(n=parseInt(r.blockTag.substring(2),16))}catch(t){Qr.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return qn((()=>jr(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",r);if(null==e)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(t){let t=null;for(let n=0;n<e.transactions.length;n++){const r=e.transactions[n];if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}}const n=this.formatter.blockWithTransactions(e);return n.transactions=n.transactions.map((e=>this._wrapTransaction(e))),n}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return jr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return qn((()=>jr(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(e){return jr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return qn((()=>jr(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return r}))),{oncePoll:this})}))}getLogs(e){return jr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Qe({filter:this._getFilter(e)}),n=yield this.perform("getLogs",t);return n.forEach((e=>{null==e.removed&&(e.removed=!1)})),Hr.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return jr(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return jr(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&Qr.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return jr(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const n=yield this._getResolver(t,"getResolver");if(null!=n){const r=new ci(this,n,e);return t===e||(yield r.supportsWildcard())?r:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return jr(this,void 0,void 0,(function*(){null==t&&(t="ENS");const n=yield this.getNetwork();n.ensAddress||Qr.throwError("network does not support ENS",J.errors.UNSUPPORTED_OPERATION,{operation:t,network:n.name});try{const t=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+Wt(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return jr(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(ae(e))throw t}"string"!=typeof e&&Qr.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return jr(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(t,"lookupAddress");if(null==n)return null;const r=ri(yield this.call({to:n,data:"0x691f3431"+Wt(t).substring(2)}),0);return(yield this.resolveName(r))!=e?null:r}))}getAvatar(e){return jr(this,void 0,void 0,(function*(){let t=null;if(ae(e)){const n=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;t=new ci(this,r,n);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==J.errors.CALL_EXCEPTION)throw e}try{const e=ri(yield this.call({to:r,data:"0x691f3431"+Wt(n).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==J.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const n=yield t.getAvatar();return null==n?null:n.url}))}perform(e,t){return Qr.throwError(e+" not implemented",J.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,n){const r=new Jr(Xr(e),t,n);return this._events.push(r),this._startEvent(r),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let n=!1,r=[],i=Xr(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),n=!0,!e.once||(r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),n}listenerCount(e){if(!e)return this._events.length;let t=Xr(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=Xr(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const n=[];let r=!1,i=Xr(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!r||(r=!0,n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const n=Xr(e);this._events=this._events.filter((e=>e.tag!==n||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var fi=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const pi=new J("abstract-signer/5.7.0"),mi=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],gi=[J.errors.INSUFFICIENT_FUNDS,J.errors.NONCE_EXPIRED,J.errors.REPLACEMENT_UNDERPRICED];class yi{constructor(){pi.checkAbstract(new.target,yi),He(this,"_isSigner",!0)}getBalance(e){return fi(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return fi(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return fi(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield Qe(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return fi(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield Qe(this.checkTransaction(e));return yield this.provider.call(n,t)}))}sendTransaction(e){return fi(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),n=yield this.signTransaction(t);return yield this.provider.sendTransaction(n)}))}getChainId(){return fi(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return fi(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return fi(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return fi(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===mi.indexOf(t)&&pi.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=Ye(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&pi.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return fi(this,void 0,void 0,(function*(){const t=yield Qe(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>fi(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&pi.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const n=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!n?0!==t.type&&1!==t.type||!n||pi.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):pi.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(n&&pi.throwError("network does not support EIP-1559",J.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):pi.throwError("failed to get consistent fee data",J.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(gi.indexOf(e.code)>=0)throw e;return pi.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",J.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&pi.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield Qe(t)}))}_checkProvider(e){this.provider||pi.throwError("missing provider",J.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class Ai extends yi{constructor(e,t){super(),He(this,"address",e),He(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{pi.throwError(e,J.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ai(this.address,e)}}var Ei=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const bi=new J(Un),vi=["call","estimateGas"];function wi(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const n=ae(e.data)?e.data:null;if(!t||n)return{message:e.message,data:n}}if("object"==typeof e){for(const n in e){const r=wi(e[n],t);if(r)return r}return null}if("string"==typeof e)try{return wi(JSON.parse(e),t)}catch(e){}return null}function Oi(e,t,n){const r=n.transaction||n.signedTransaction;if("call"===e){const e=wi(t,!0);if(e)return e.data;bi.throwError("missing revert data in call exception; Transaction reverted without a reason string",J.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:t})}if("estimateGas"===e){let n=wi(t.body,!1);null==n&&(n=wi(t,!1)),n&&bi.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",J.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:e,transaction:r,error:t})}let i=t.message;throw t.code===J.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&bi.throwError("insufficient funds for intrinsic transaction cost",J.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/nonce (is )?too low/i)&&bi.throwError("nonce has already been used",J.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&bi.throwError("replacement fee too low",J.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/only replay-protected/i)&&bi.throwError("legacy pre-eip-155 transactions not supported",J.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:r}),vi.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&bi.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",J.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}function Di(e){return new Promise((function(t){setTimeout(t,e)}))}function Ti(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function Pi(e){return e?e.toLowerCase():e}const _i={};class Ri extends yi{constructor(e,t,n){if(super(),e!==_i)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");He(this,"provider",t),null==n&&(n=0),"string"==typeof n?(He(this,"_address",this.provider.formatter.address(n)),He(this,"_index",null)):"number"==typeof n?(He(this,"_index",n),He(this,"_address",null)):bi.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return bi.throwError("cannot alter JSON-RPC Signer connection",J.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Ii(_i,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&bi.throwError("unknown account #"+this._index,J.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=Ye(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const n=Ye(e);n.from=t,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>Ei(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&bi.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),Qe({tx:Qe(e),sender:t}).then((({tx:t,sender:n})=>{null!=t.from?t.from.toLowerCase()!==n&&bi.throwArgumentError("from address mismatch","transaction",e):t.from=n;const r=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((e=>e),(e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&bi.throwError("user rejected transaction",J.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),Oi("sendTransaction",e,r))))}))}signTransaction(e){return bi.throwError("signing transactions is unsupported",J.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Ei(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield qn((()=>Ei(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(n);if(null!==e)return this.provider._wrapTransaction(e,n,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=n,e}}))}signMessage(e){return Ei(this,void 0,void 0,(function*(){const t="string"==typeof e?Ot(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[ce(t),n.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&bi.throwError("user rejected signing",J.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),t}}))}_legacySignMessage(e){return Ei(this,void 0,void 0,(function*(){const t="string"==typeof e?Ot(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),ce(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&bi.throwError("user rejected signing",J.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),t}}))}_signTypedData(e,t,n){return Ei(this,void 0,void 0,(function*(){const r=yield Cn.resolveNames(e,t,n,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Cn.getPayload(r.domain,t,r.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&bi.throwError("user rejected signing",J.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:t,value:r.value}}),e}}))}unlock(e){return Ei(this,void 0,void 0,(function*(){const t=this.provider,n=yield this.getAddress();return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])}))}}class Ii extends Ri{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const Ci={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Bi extends hi{constructor(e,t){let n=t;null==n&&(n=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(n),e||(e=je(this.constructor,"defaultUrl")()),He(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(Ye(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Ei(this,void 0,void 0,(function*(){yield Di(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=je(this.constructor,"getNetwork");try{return t(we.from(e).toNumber())}catch(t){return bi.throwError("could not detect network",J.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return bi.throwError("could not detect network",J.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new Ri(_i,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Ke(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const i=Mn(this.connection,JSON.stringify(n),Ti).then((e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e}));return r&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Pi(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Pi(t.address),t.blockTag]];case"getCode":return["eth_getCode",[Pi(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Pi(t.address),pe(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[je(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[je(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=Pi(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Ei(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&we.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((t=Ye(t)).transaction=Ye(e),delete t.transaction.type)}}const n=this.prepareRequest(e,t);null==n&&bi.throwError(e+" not implemented",J.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(n){return Oi(e,n,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function r(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;let r=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",r=r.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),r.then((function(){return Di(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){r()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((e=>{}))}(),n})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const n=Ye(Ci);if(t)for(const e in t)t[e]&&(n[e]=!0);var r,i;i=n,(r=e)&&"object"==typeof r||Ve.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((e=>{i[e]||Ve.throwArgumentError("invalid object key - "+e,"transaction:"+e,r)}));const s={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const n=fe(we.from(e[t]));"gasLimit"===t&&(t="gas"),s[t]=n})),["from","to","data"].forEach((function(t){null!=e[t]&&(s[t]=ce(e[t]))})),e.accessList&&(s.accessList=Sr(e.accessList)),s}}var ki=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ni=new J(Un);class xi extends Bi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return ki(this,void 0,void 0,(function*(){let t=this.network;return null==t&&(t=yield e.detectNetwork.call(this),t||Ni.throwError("no network detected",J.errors.UNKNOWN_ERROR,{}),null==this._network&&(He(this,"_network",t),this.emit("network",t,null))),t}))}}const Si="abi/5.7.0",Li=new J(Si),Fi={};let Mi={calldata:!0,memory:!0,storage:!0},qi={calldata:!0,memory:!0};function Ui(e,t){if("bytes"===e||"string"===e){if(Mi[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&qi[t])return!0;return(Mi[t]||"payable"===t)&&Li.throwArgumentError("invalid modifier","name",t),!1}function Vi(e,t){for(let n in t)He(e,n,t[n])}const Hi=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),ji=new RegExp(/^(.*)\[([0-9]*)\]$/);class Qi{constructor(e,t){e!==Fi&&Li.throwError("use fromString",J.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Vi(this,t);let n=this.type.match(ji);Vi(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:Qi.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=Hi.sighash),Hi[e]||Li.throwArgumentError("invalid format type","format",e),e===Hi.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Hi.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Hi.full?", ":",")+")"):t+=this.type,e!==Hi.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Hi.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?Qi.fromString(e,t):Qi.fromObject(e)}static fromObject(e){return Qi.isParamType(e)?e:new Qi(Fi,{name:e.name||null,type:ts(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(Qi.fromObject):null})}static fromString(e,t){return n=function(e,t){let n=e;function r(t){Li.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let s={type:"",name:"",state:{allowType:!0}},o=s;for(let n=0;n<e.length;n++){let s=e[n];switch(s){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||r(n),o.state.allowType=!1,o.type=ts(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),Ui(o.type,o.name)&&(o.name=""),o.type=ts(o.type);let e=o;o=o.parent,o||r(n),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),Ui(o.type,o.name)&&(o.name=""),o.type=ts(o.type);let a=i(o.parent);o.parent.components.push(a),delete o.parent,o=a;break;case" ":o.state.allowType&&""!==o.type&&(o.type=ts(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||r(n),o.indexed&&r(n),o.indexed=!0,o.name=""):Ui(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||r(n),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||r(n),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:r(n)}}return o.parent&&Li.throwArgumentError("unexpected eof","param",e),delete s.state,"indexed"===o.name?(t||r(n.length-7),o.indexed&&r(n.length-7),o.indexed=!0,o.name=""):Ui(o.type,o.name)&&(o.name=""),s.type=ts(s.type),s}(e,!!t),Qi.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}}function Yi(e,t){return function(e){e=e.trim();let t=[],n="",r=0;for(let i=0;i<e.length;i++){let s=e[i];","===s&&0===r?(t.push(n),n=""):(n+=s,"("===s?r++:")"===s&&(r--,-1===r&&Li.throwArgumentError("unbalanced parenthesis","value",e)))}n&&t.push(n);return t}(e).map((e=>Qi.fromString(e,t)))}class Gi{constructor(e,t){e!==Fi&&Li.throwError("use a static from method",J.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Vi(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Gi.isFragment(e)?e:"string"==typeof e?Gi.fromString(e):Gi.fromObject(e)}static fromObject(e){if(Gi.isFragment(e))return e;switch(e.type){case"function":return Wi.fromObject(e);case"event":return Xi.fromObject(e);case"constructor":return Ji.fromObject(e);case"error":return es.fromObject(e);case"fallback":case"receive":return null}return Li.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Xi.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Wi.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Ji.fromString(e.trim()):"error"===e.split(" ")[0]?es.fromString(e.substring(5).trim()):Li.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Xi extends Gi{format(e){if(e||(e=Hi.sighash),Hi[e]||Li.throwArgumentError("invalid format type","format",e),e===Hi.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Hi.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Hi.full?", ":",")+") ",e!==Hi.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Xi.fromString(e):Xi.fromObject(e)}static fromObject(e){if(Xi.isEventFragment(e))return e;"event"!==e.type&&Li.throwArgumentError("invalid event object","value",e);const t={name:rs(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Qi.fromObject):[],type:"event"};return new Xi(Fi,t)}static fromString(e){let t=e.match(is);t||Li.throwArgumentError("invalid event string","value",e);let n=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:Li.warn("unknown modifier: "+e)}})),Xi.fromObject({name:t[1].trim(),anonymous:n,inputs:Yi(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function $i(e,t){t.gas=null;let n=e.split("@");return 1!==n.length?(n.length>2&&Li.throwArgumentError("invalid human-readable ABI signature","value",e),n[1].match(/^[0-9]+$/)||Li.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=we.from(n[1]),n[0]):e}function Ki(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function zi(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&Li.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Li.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||Li.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&Li.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&Li.throwArgumentError("unable to determine stateMutability","value",e),t}class Ji extends Gi{format(e){if(e||(e=Hi.sighash),Hi[e]||Li.throwArgumentError("invalid format type","format",e),e===Hi.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===Hi.sighash&&Li.throwError("cannot format a constructor for sighash",J.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Hi.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?Ji.fromString(e):Ji.fromObject(e)}static fromObject(e){if(Ji.isConstructorFragment(e))return e;"constructor"!==e.type&&Li.throwArgumentError("invalid constructor object","value",e);let t=zi(e);t.constant&&Li.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Qi.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?we.from(e.gas):null};return new Ji(Fi,n)}static fromString(e){let t={type:"constructor"},n=(e=$i(e,t)).match(is);return n&&"constructor"===n[1].trim()||Li.throwArgumentError("invalid constructor string","value",e),t.inputs=Yi(n[2].trim(),!1),Ki(n[3].trim(),t),Ji.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Wi extends Ji{format(e){if(e||(e=Hi.sighash),Hi[e]||Li.throwArgumentError("invalid format type","format",e),e===Hi.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Hi.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Hi.full?", ":",")+") ",e!==Hi.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?Wi.fromString(e):Wi.fromObject(e)}static fromObject(e){if(Wi.isFunctionFragment(e))return e;"function"!==e.type&&Li.throwArgumentError("invalid function object","value",e);let t=zi(e);const n={type:e.type,name:rs(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Qi.fromObject):[],outputs:e.outputs?e.outputs.map(Qi.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?we.from(e.gas):null};return new Wi(Fi,n)}static fromString(e){let t={type:"function"},n=(e=$i(e,t)).split(" returns ");n.length>2&&Li.throwArgumentError("invalid function string","value",e);let r=n[0].match(is);if(r||Li.throwArgumentError("invalid function signature","value",e),t.name=r[1].trim(),t.name&&rs(t.name),t.inputs=Yi(r[2],!1),Ki(r[3].trim(),t),n.length>1){let r=n[1].match(is);""==r[1].trim()&&""==r[3].trim()||Li.throwArgumentError("unexpected tokens","value",e),t.outputs=Yi(r[2],!1)}else t.outputs=[];return Wi.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function Zi(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Li.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class es extends Gi{format(e){if(e||(e=Hi.sighash),Hi[e]||Li.throwArgumentError("invalid format type","format",e),e===Hi.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Hi.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Hi.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?es.fromString(e):es.fromObject(e)}static fromObject(e){if(es.isErrorFragment(e))return e;"error"!==e.type&&Li.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:rs(e.name),inputs:e.inputs?e.inputs.map(Qi.fromObject):[]};return Zi(new es(Fi,t))}static fromString(e){let t={type:"error"},n=e.match(is);return n||Li.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&rs(t.name),t.inputs=Yi(n[2],!1),Zi(es.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function ts(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const ns=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function rs(e){return e&&e.match(ns)||Li.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const is=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const ss=new J(Si);class os{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){ss.throwArgumentError(e,this.localName,t)}}class as{constructor(e){He(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return he(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(se(e._data))}writeBytes(e){let t=ie(e);const n=t.length%this.wordSize;return n&&(t=se([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=ie(we.from(e));return t.length>this.wordSize&&ss.throwError("value out-of-bounds",J.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=se([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class ls{constructor(e,t,n,r){He(this,"_data",ie(e)),He(this,"wordSize",t||32),He(this,"_coerceFunc",n),He(this,"allowLoose",r),this._offset=0}get data(){return ce(this._data)}get consumed(){return this._offset}static coerce(e,t){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):ls.coerce(e,t)}_peekBytes(e,t,n){let r=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+t<=this._data.length?r=t:ss.throwError("data out-of-bounds",J.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(e){return new ls(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let n=this._peekBytes(0,e,!!t);return this._offset+=n.length,n.slice(0,e)}readValue(){return we.from(this.readBytes(this.wordSize))}}class cs extends os{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=fn(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return fn(pe(e.readValue().toHexString(),20))}}class us extends os{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const ds=new J(Si);function hs(e,t,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map((t=>{const r=t.localName;return r||ds.throwError("cannot encode object for signature with missing names",J.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]&&ds.throwError("cannot encode object for signature with duplicate names",J.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]=!0,n[r]}))}else ds.throwArgumentError("invalid tuple value","tuple",n);t.length!==r.length&&ds.throwArgumentError("types/value length mismatch","tuple",n);let i=new as(e.wordSize),s=new as(e.wordSize),o=[];t.forEach(((e,t)=>{let n=r[t];if(e.dynamic){let t=s.length;e.encode(s,n);let r=i.writeUpdatableValue();o.push((e=>{r(e+t)}))}else e.encode(i,n)})),o.forEach((e=>{e(i.length)}));let a=e.appendWriter(i);return a+=e.appendWriter(s),a}function fs(e,t){let n=[],r=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let n=e.readValue(),s=r.subReader(n.toNumber());try{i=t.decode(s)}catch(e){if(e.code===J.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===J.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&n.push(i)}));const i=t.reduce(((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e}),{});t.forEach(((e,t)=>{let r=e.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const s=n[t];s instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw s}}):n[r]=s}));for(let e=0;e<n.length;e++){const t=n[e];t instanceof Error&&Object.defineProperty(n,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(n)}class ps extends os{constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let n=this.length;-1===n&&(n=t.length,e.writeValue(t.length)),ds.checkArgumentCount(t.length,n,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let e=0;e<t.length;e++)r.push(this.coder);return hs(e,r,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&ds.throwError("insufficient data length",J.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let n=[];for(let e=0;e<t;e++)n.push(new us(this.coder));return e.coerce(this.name,fs(e,n))}}class ms extends os{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class gs extends os{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=ie(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class ys extends gs{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,ce(super.decode(e)))}}class As extends os{constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=ie(t);return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return e.coerce(this.name,ce(e.readBytes(this.size)))}}class Es extends os{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}class bs extends os{constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let n=we.from(t),r=mt.mask(8*e.wordSize);if(this.signed){let e=r.mask(8*this.size-1);(n.gt(e)||n.lt(e.add(pt).mul(ht)))&&this._throwError("value out-of-bounds",t)}else(n.lt(ft)||n.gt(r.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(n)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}class vs extends gs{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Ot(t))}decode(e){return Dt(super.decode(e))}}class ws extends os{constructor(e,t){let n=!1;const r=[];e.forEach((e=>{e.dynamic&&(n=!0),r.push(e.type)}));super("tuple","tuple("+r.join(",")+")",t,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[r]))})),Object.freeze(e)}encode(e,t){return hs(e,this.coders,t)}decode(e){return e.coerce(this.name,fs(e,this.coders))}}const Os=new J(Si),Ds=new RegExp(/^bytes([0-9]*)$/),Ts=new RegExp(/^(u?int)([0-9]*)$/);const Ps=new class{constructor(e){He(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new cs(e.name);case"bool":return new ms(e.name);case"string":return new vs(e.name);case"bytes":return new ys(e.name);case"array":return new ps(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new ws((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new Es(e.name)}let t=e.type.match(Ts);if(t){let n=parseInt(t[2]||"256");return(0===n||n>256||n%8!=0)&&Os.throwArgumentError("invalid "+t[1]+" bit length","param",e),new bs(n/8,"int"===t[1],e.name)}if(t=e.type.match(Ds),t){let n=parseInt(t[1]);return(0===n||n>32)&&Os.throwArgumentError("invalid bytes length","param",e),new As(n,e.name)}return Os.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new ls(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new as(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(Qi.from(e))));return new ws(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Os.throwError("types/values length mismatch",J.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const n=e.map((e=>this._getCoder(Qi.from(e)))),r=new ws(n,"_"),i=this._getWriter();return r.encode(i,t),i.data}decode(e,t,n){const r=e.map((e=>this._getCoder(Qi.from(e))));return new ws(r,"_").decode(this._getReader(ie(t),n))}},_s=new J(Si);class Rs extends ze{}class Is extends ze{}class Cs extends ze{}class Bs extends ze{static isIndexed(e){return!(!e||!e._isIndexed)}}const ks={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Ns(e,t){const n=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return n.error=t,n}class xs{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,He(this,"fragments",t.map((e=>Gi.from(e))).filter((e=>null!=e))),He(this,"_abiCoder",je(new.target,"getAbiCoder")()),He(this,"functions",{}),He(this,"errors",{}),He(this,"events",{}),He(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void _s.warn("duplicate definition - constructor"):void He(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let n=e.format();t[n]?_s.warn("duplicate definition - "+n):t[n]=e})),this.deploy||He(this,"deploy",Ji.from({payable:!1,type:"constructor"})),He(this,"_isInterface",!0)}format(e){e||(e=Hi.full),e===Hi.sighash&&_s.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===Hi.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return Ps}static getAddress(e){return fn(e)}static getSighash(e){return de(Tt(e.format()),0,4)}static getEventTopic(e){return Tt(e.format())}getFunction(e){if(ae(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];_s.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===n.length?_s.throwArgumentError("no matching function","name",t):n.length>1&&_s.throwArgumentError("multiple matching functions","name",t),this.functions[n[0]]}const t=this.functions[Wi.fromString(e).format()];return t||_s.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(ae(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];_s.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===n.length?_s.throwArgumentError("no matching event","name",t):n.length>1&&_s.throwArgumentError("multiple matching events","name",t),this.events[n[0]]}const t=this.events[Xi.fromString(e).format()];return t||_s.throwArgumentError("no matching event","signature",e),t}getError(e){if(ae(e)){const t=je(this.constructor,"getSighash");for(const n in this.errors){if(e===t(this.errors[n]))return this.errors[n]}_s.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===n.length?_s.throwArgumentError("no matching error","name",t):n.length>1&&_s.throwArgumentError("multiple matching errors","name",t),this.errors[n[0]]}const t=this.errors[Wi.fromString(e).format()];return t||_s.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return je(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),je(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const n=ie(t);return ce(n.slice(0,4))!==this.getSighash(e)&&_s.throwArgumentError(`data signature does not match error ${e.name}.`,"data",ce(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),ce(se([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const n=ie(t);return ce(n.slice(0,4))!==this.getSighash(e)&&_s.throwArgumentError(`data signature does not match function ${e.name}.`,"data",ce(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),ce(se([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let n=ie(t),r=null,i="",s=null,o=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch(e){}break;case 4:{const e=ce(n.slice(0,4)),t=ks[e];if(t)s=this._abiCoder.decode(t.inputs,n.slice(4)),o=t.name,a=t.signature,t.reason&&(r=s[0]),"Error"===o?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:"Panic"===o&&(i=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const t=this.getError(e);s=this._abiCoder.decode(t.inputs,n.slice(4)),o=t.name,a=t.format()}catch(e){}break}}return _s.throwError("call revert exception"+i,J.errors.CALL_EXCEPTION,{method:e.format(),data:ce(t),errorArgs:s,errorName:o,errorSignature:a,reason:r})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),ce(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&_s.throwError("too many arguments for "+e.format(),J.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let n=[];e.anonymous||n.push(this.getEventTopic(e));const r=(e,t)=>"string"===e.type?Tt(t):"bytes"===e.type?gt(ce(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=we.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),pe(ce(t),32));for(t.forEach(((t,i)=>{let s=e.inputs[i];s.indexed?null==t?n.push(null):"array"===s.baseType||"tuple"===s.baseType?_s.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,t):Array.isArray(t)?n.push(t.map((e=>r(s,e)))):n.push(r(s,t)):null!=t&&_s.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const n=[],r=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&_s.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,s)=>{const o=t[s];if(e.indexed)if("string"===e.type)n.push(Tt(o));else if("bytes"===e.type)n.push(gt(o));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([e.type],[o]))}else r.push(e),i.push(o)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(e,t,n){if("string"==typeof e&&(e=this.getEvent(e)),null!=n&&!e.anonymous){let t=this.getEventTopic(e);ae(n[0],32)&&n[0].toLowerCase()===t||_s.throwError("fragment/topic mismatch",J.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:n[0]}),n=n.slice(1)}let r=[],i=[],s=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(r.push(Qi.fromObject({type:"bytes32",name:e.name})),s.push(!0)):(r.push(e),s.push(!1)):(i.push(e),s.push(!1))}));let o=null!=n?this._abiCoder.decode(r,se(n)):null,a=this._abiCoder.decode(i,t,!0),l=[],c=0,u=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==o)l[t]=new Bs({_isIndexed:!0,hash:null});else if(s[t])l[t]=new Bs({_isIndexed:!0,hash:o[u++]});else try{l[t]=o[u++]}catch(e){l[t]=e}else try{l[t]=a[c++]}catch(e){l[t]=e}if(e.name&&null==l[e.name]){const n=l[t];n instanceof Error?Object.defineProperty(l,e.name,{enumerable:!0,get:()=>{throw Ns(`property ${JSON.stringify(e.name)}`,n)}}):l[e.name]=n}}));for(let e=0;e<l.length;e++){const t=l[e];t instanceof Error&&Object.defineProperty(l,e,{enumerable:!0,get:()=>{throw Ns(`index ${e}`,t)}})}return Object.freeze(l)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new Is({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:we.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Rs({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=ce(e);let n=this.getError(t.substring(0,10).toLowerCase());return n?new Cs({args:this._abiCoder.decode(n.inputs,"0x"+t.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!(!e||!e._isInterface)}}var Ss=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ls=new J("contracts/5.7.0");function Fs(e,t){return Ss(this,void 0,void 0,(function*(){const n=yield t;"string"!=typeof n&&Ls.throwArgumentError("invalid address or ENS name","name",n);try{return fn(n)}catch(e){}e||Ls.throwError("a provider or signer is needed to resolve ENS names",J.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield e.resolveName(n);return null==r&&Ls.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function Ms(e,t,n){return Ss(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>Ms(e,Array.isArray(t)?t[r]:t[n.name],n)))):"address"===n.type?yield Fs(e,t):"tuple"===n.type?yield Ms(e,t,n.components):"array"===n.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>Ms(e,t,n.arrayChildren)))):Promise.reject(Ls.makeError("invalid value for array",J.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function qs(e,t,n){return Ss(this,void 0,void 0,(function*(){let r={};n.length===t.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=Ye(n.pop())),Ls.checkArgumentCount(n.length,t.inputs.length,"passed to contract"),e.signer?r.from?r.from=Qe({override:Fs(e.signer,r.from),signer:e.signer.getAddress()}).then((e=>Ss(this,void 0,void 0,(function*(){return fn(e.signer)!==e.override&&Ls.throwError("Contract with a Signer cannot override from",J.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):r.from=e.signer.getAddress():r.from&&(r.from=Fs(e.provider,r.from));const i=yield Qe({args:Ms(e.signer||e.provider,n,t.inputs),address:e.resolvedAddress,overrides:Qe(r)||{}}),s=e.interface.encodeFunctionData(t,i.args),o={data:s,to:i.address},a=i.overrides;if(null!=a.nonce&&(o.nonce=we.from(a.nonce).toNumber()),null!=a.gasLimit&&(o.gasLimit=we.from(a.gasLimit)),null!=a.gasPrice&&(o.gasPrice=we.from(a.gasPrice)),null!=a.maxFeePerGas&&(o.maxFeePerGas=we.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(o.maxPriorityFeePerGas=we.from(a.maxPriorityFeePerGas)),null!=a.from&&(o.from=a.from),null!=a.type&&(o.type=a.type),null!=a.accessList&&(o.accessList=Sr(a.accessList)),null==o.gasLimit&&null!=t.gas){let e=21e3;const n=ie(s);for(let t=0;t<n.length;t++)e+=4,n[t]&&(e+=64);o.gasLimit=we.from(t.gas).add(e)}if(a.value){const e=we.from(a.value);e.isZero()||t.payable||Ls.throwError("non-payable method cannot override value",J.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),o.value=e}a.customData&&(o.customData=Ye(a.customData)),a.ccipReadEnabled&&(o.ccipReadEnabled=!!a.ccipReadEnabled),delete r.nonce,delete r.gasLimit,delete r.gasPrice,delete r.from,delete r.value,delete r.type,delete r.accessList,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.customData,delete r.ccipReadEnabled;const l=Object.keys(r).filter((e=>null!=r[e]));return l.length&&Ls.throwError(`cannot override ${l.map((e=>JSON.stringify(e))).join(",")}`,J.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o}))}function Us(e,t,n){const r=e.signer||e.provider;return function(...i){return Ss(this,void 0,void 0,(function*(){let s;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=Ye(i.pop());null!=e.blockTag&&(s=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(s));const o=yield qs(e,t,i),a=yield r.call(o,s);try{let r=e.interface.decodeFunctionResult(t,a);return n&&1===t.outputs.length&&(r=r[0]),r}catch(t){throw t.code===J.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=o),t}}))}}function Vs(e,t){return function(...n){return Ss(this,void 0,void 0,(function*(){e.signer||Ls.throwError("sending a transaction requires a signer",J.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const r=yield qs(e,t,n),i=yield e.signer.sendTransaction(r);return function(e,t){const n=t.wait.bind(t);t.wait=t=>n(t).then((t=>(t.events=t.logs.map((n=>{let r=Ke(n),i=null;try{i=e.interface.parseLog(n)}catch(e){}return i&&(r.args=i.args,r.decode=(t,n)=>e.interface.decodeEventLog(i.eventFragment,t,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>e.provider,r.getBlock=()=>e.provider.getBlock(t.blockHash),r.getTransaction=()=>e.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(t),r})),t)))}(e,i),i}))}}function Hs(e,t,n){return t.constant?Us(e,t,n):Vs(e,t)}function js(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map((e=>Array.isArray(e)?e.join("|"):e)).join(":"):""):"*"}class Qs{constructor(e,t){He(this,"tag",e),He(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter((n=>!(!t&&n.listener===e)||(t=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((e=>e.listener))}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter((t=>{const n=e.slice();return setTimeout((()=>{t.listener.apply(this,n)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class Ys extends Qs{constructor(){super("error",null)}}class Gs extends Qs{constructor(e,t,n,r){const i={address:e};let s=t.getEventTopic(n);r?(s!==r[0]&&Ls.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[s],super(js(i),i),He(this,"address",e),He(this,"interface",t),He(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=function(e){const t=[],n=function(e,r){if(Array.isArray(r))for(let i in r){const s=e.slice();s.push(i);try{n(s,r[i])}catch(e){t.push({path:s,error:e})}}};return n([],e),t}(e.args);if(t.length)throw t[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Xs extends Qs{constructor(e,t){super("*",{address:e}),He(this,"address",e),He(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,n)=>this.interface.decodeEventLog(t.eventFragment,e,n),e.args=t.args}catch(e){}}}class $s{constructor(e,t,n){He(this,"interface",je(new.target,"getInterface")(t)),null==n?(He(this,"provider",null),He(this,"signer",null)):yi.isSigner(n)?(He(this,"provider",n.provider||null),He(this,"signer",n)):et.isProvider(n)?(He(this,"provider",n),He(this,"signer",null)):Ls.throwArgumentError("invalid signer or provider","signerOrProvider",n),He(this,"callStatic",{}),He(this,"estimateGas",{}),He(this,"functions",{}),He(this,"populateTransaction",{}),He(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const n=this.interface.events[t];He(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,e)}))),e[n.name]||(e[n.name]=[]),e[n.name].push(t)})),Object.keys(e).forEach((t=>{const n=e[t];1===n.length?He(this.filters,t,this.filters[n[0]]):Ls.warn(`Duplicate definition of ${t} (${n.join(", ")})`)}))}if(He(this,"_runningEvents",{}),He(this,"_wrappedEmits",{}),null==e&&Ls.throwArgumentError("invalid contract address or ENS name","addressOrName",e),He(this,"address",e),this.provider)He(this,"resolvedAddress",Fs(this.provider,e));else try{He(this,"resolvedAddress",Promise.resolve(fn(e)))}catch(e){Ls.throwError("provider is required to use ENS name as contract address",J.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((e=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(i[e])Ls.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const n=t.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(e)}null==this[e]&&He(this,e,Hs(this,t,!0)),null==this.functions[e]&&He(this.functions,e,Hs(this,t,!1)),null==this.callStatic[e]&&He(this.callStatic,e,Us(this,t,!0)),null==this.populateTransaction[e]&&He(this.populateTransaction,e,function(e,t){return function(...n){return qs(e,t,n)}}(this,t)),null==this.estimateGas[e]&&He(this.estimateGas,e,function(e,t){const n=e.signer||e.provider;return function(...r){return Ss(this,void 0,void 0,(function*(){n||Ls.throwError("estimate require a provider or signer",J.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield qs(e,t,r);return yield n.estimateGas(i)}))}}(this,t))}})),Object.keys(r).forEach((e=>{const t=r[e];if(t.length>1)return;e=e.substring(1);const n=t[0];try{null==this[e]&&He(this,e,this[n])}catch(e){}null==this.functions[e]&&He(this.functions,e,this.functions[n]),null==this.callStatic[e]&&He(this.callStatic,e,this.callStatic[n]),null==this.populateTransaction[e]&&He(this.populateTransaction,e,this.populateTransaction[n]),null==this.estimateGas[e]&&He(this.estimateGas,e,this.estimateGas[n])}))}static getContractAddress(e){return pn(e)}static getInterface(e){return xs.isInterface(e)?e:new xs(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,e).then((e=>("0x"===e&&Ls.throwError("contract not deployed",J.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||Ls.throwError("sending a transactions require a signer",J.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=Ye(e||{});return["from","to"].forEach((function(e){null!=t[e]&&Ls.throwError("cannot override "+e,J.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new Ai(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&He(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Bs.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new Ys);if("event"===e)return this._normalizeRunningEvent(new Qs("event",null));if("*"===e)return this._normalizeRunningEvent(new Xs(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new Gs(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const n=this.interface.getEvent(t);return this._normalizeRunningEvent(new Gs(this.address,this.interface,n,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Qs(js(t),t))}return this._normalizeRunningEvent(new Xs(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,n){const r=Ke(t);return r.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},r.getBlock=()=>this.provider.getBlock(t.blockHash),r.getTransaction=()=>this.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(r),r}_addEventListener(e,t,n){if(this.provider||Ls.throwError("events require a provider or a signer with a provider",J.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const n=n=>{let r=this._wrapEvent(e,n,t);if(null==r.decodeError)try{const t=e.getEmit(r);this.emit(e.filter,...t)}catch(e){r.decodeError=e.error}null!=e.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[e.tag]=n,null!=e.filter&&this.provider.on(e.filter,n)}}queryFilter(e,t,n){const r=this._getRunningEvent(e),i=Ye(r.filter);return"string"==typeof t&&ae(t,32)?(null!=n&&Ls.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((e=>e.map((e=>this._wrapEvent(r,e,null)))))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const n=this._getRunningEvent(e),r=n.run(t)>0;return this._checkRunningEvents(n),r}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce(((e,t)=>e+this._runningEvents[t].listenerCount()),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach((t=>{e.push(t)}));return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(t),this._checkRunningEvents(n),this}removeListener(e,t){return this.off(e,t)}}class Ks extends $s{}function zs(e,t,...n){return V(this,void 0,void 0,(function*(){const r=[];for(const e of n)for(const t of e)t.callData&&r.push(t.callData);const i=yield function(e,t,n){return V(this,void 0,void 0,(function*(){const r=yield Js(e,t,n),i=new Map;for(const{req:e,resp:t}of r)i.set(e,t);return e.map((e=>({req:e,resp:i.get(e)})))}))}(r,e,t),s=new Map;for(const{req:e,resp:t}of i)s.set(e,null==t?void 0:t.result);return n.map((e=>e.filter((e=>!e.callData||s.get(e.callData))).map(((e,t)=>e.processor(e.callData?s.get(e.callData):null,t)))))}))}function Js(e,t,n){return V(this,void 0,void 0,(function*(){let r=[e];e.length>800&&(r=_(e,800));let i=[];const s=r.map((e=>V(this,void 0,void 0,(function*(){const r=e.map((e=>[e.to,e.data])),s={data:t.interface.encodeFunctionData("aggregate",[r]),to:n};let o;try{o=yield t.provider.call(s)}catch(r){const s=e.length;if(s>20){const r=Math.floor(s/2),[o,a]=yield Promise.all([Js(e.slice(0,r),t,n),Js(e.slice(r,s),t,n)]);i=[...i,...o,...a]}else{const e="[sendCallReqs] error";console.error(e,r)}}if(void 0===o)throw new Error("Unexpected batch result");const[a,l]=Ps.decode(["uint256","bytes[]"],o);if(e.length!==l.length)throw new Error("Unexpected length mismatch");return l.map(((t,n)=>({resp:{result:t},req:e[n]})))}))));return(yield Promise.allSettled(s)).filter((e=>"fulfilled"===e.status)).forEach((({value:e})=>{i=[...i,...e]})),i}))}var Ws;function Zs(e){return V(this,void 0,void 0,(function*(){switch(e){case Ws.customERC20IsMintable:return[{inputs:[],name:"isMintable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];case Ws.customMultiCallAggregate:return[{constant:!1,inputs:[{components:[{name:"target",type:"address"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{name:"blockNumber",type:"uint256"},{name:"returnData",type:"bytes[]"}],payable:!1,stateMutability:"nonpayable",type:"function"}];default:return(yield function(e){switch(e){case"./ABIs/AaveLendingPoolABI.ts":return import("./AaveLendingPoolABI-CdLq16uB.js");case"./ABIs/AaveLendingPoolAddressesProvider.ts":return import("./AaveLendingPoolAddressesProvider-EOSAznLK.js");case"./ABIs/AavePriceOracleABI.ts":return import("./AavePriceOracleABI-C2UEpXR4.js");case"./ABIs/AaveProtocolDataProviderABI.ts":return import("./AaveProtocolDataProviderABI-0JclmmLX.js");case"./ABIs/BaseDrops.ts":return import("./BaseDrops-BrQZPqKk.js");case"./ABIs/D3MM_READ_ABI.ts":return import("./D3MM_READ_ABI-B5536S-z.js");case"./ABIs/D3Proxy.ts":return import("./D3Proxy-CKIzLOhI.js");case"./ABIs/DODO1155.ts":return import("./DODO1155-DDY5Jxhf.js");case"./ABIs/DODO721.ts":return import("./DODO721-Kl5REiwU.js");case"./ABIs/DODOCirculationHelperABI.ts":return import("./DODOCirculationHelperABI-gu1sCqZ2.js");case"./ABIs/DODORouteProxy.ts":return import("./DODORouteProxy-51kl6QgI.js");case"./ABIs/DODOV1PmmHelperABI.ts":return import("./DODOV1PmmHelperABI-DQqthyaE.js");case"./ABIs/DVM.ts":return import("./DVM-DjtWbqiJ.js");case"./ABIs/DropsERC721.ts":return import("./DropsERC721-7Bckjcar.js");case"./ABIs/FilterAdmin.ts":return import("./FilterAdmin-jm_-DS1l.js");case"./ABIs/FilterERC1155V1.ts":return import("./FilterERC1155V1-VIUlIHdF.js");case"./ABIs/FilterERC721V1.ts":return import("./FilterERC721V1-CWDEPGmH.js");case"./ABIs/Fragment.ts":return import("./Fragment-Bd_AXeVx.js");case"./ABIs/FundingABI.ts":return import("./FundingABI-WqQDGVVa.js");case"./ABIs/IdodoV2.ts":return import("./IdodoV2-DlW8pwaE.js");case"./ABIs/LockedTokenVaultABI.ts":return import("./LockedTokenVaultABI-CfBj0wEX.js");case"./ABIs/MarginTrading.ts":return import("./MarginTrading-CQ5odvHB.js");case"./ABIs/MarginTradingFactory.ts":return import("./MarginTradingFactory-2RKqvCSO.js");case"./ABIs/MerkleDistributorABI.ts":return import("./MerkleDistributorABI-Ctn26fnA.js");case"./ABIs/NonfungiblePositionManager.ts":return import("./NonfungiblePositionManager-c8Yw_9-Q.js");case"./ABIs/PancakePairABI.ts":return import("./PancakePairABI-Cc9LuXnX.js");case"./ABIs/UniswapV3Pool.ts":return import("./UniswapV3Pool-Da11VKXE.js");case"./ABIs/baseFilterV1.ts":return import("./baseFilterV1-BPjWXMKw.js");case"./ABIs/classicalPoolABI.ts":return import("./classicalPoolABI-D5LxySAJ.js");case"./ABIs/dodoABI.ts":return import("./dodoABI-CLkEBJ8P.js");case"./ABIs/dodoBuyoutModel.ts":return import("./dodoBuyoutModel-BtQv3C3q.js");case"./ABIs/dodoCP.ts":return import("./dodoCP-N8KA8JwJ.js");case"./ABIs/dodoCPABI.ts":return import("./dodoCPABI-CdAN0KhU.js");case"./ABIs/dodoCPABIV2.ts":return import("./dodoCPABIV2-yzF6FlEg.js");case"./ABIs/dodoCPFactory.ts":return import("./dodoCPFactory-CD0SxXT6.js");case"./ABIs/dodoCpProxy.ts":return import("./dodoCpProxy-D2AI9-4r.js");case"./ABIs/dodoCpProxyV2.ts":return import("./dodoCpProxyV2-CGZRqk2H.js");case"./ABIs/dodoCpProxyV202.ts":return import("./dodoCpProxyV202-CoZaEf_6.js");case"./ABIs/dodoCustomMintableERC20.ts":return import("./dodoCustomMintableERC20-CPpNoX1v.js");case"./ABIs/dodoDPPAdmin.ts":return import("./dodoDPPAdmin-B-fmpTbV.js");case"./ABIs/dodoDPPFactory.ts":return import("./dodoDPPFactory-DwAkVskt.js");case"./ABIs/dodoDSP.ts":return import("./dodoDSP-B6KYm-Cn.js");case"./ABIs/dodoDSPFactory.ts":return import("./dodoDSPFactory-j1eg7Ez-.js");case"./ABIs/dodoDVM.ts":return import("./dodoDVM-DDYx1JAy.js");case"./ABIs/dodoDVMFactory.ts":return import("./dodoDVMFactory-FpnJdZb2.js");case"./ABIs/dodoDppProxy.ts":return import("./dodoDppProxy-A7PPYsqp.js");case"./ABIs/dodoDropsProxy.ts":return import("./dodoDropsProxy-vHUWsRNO.js");case"./ABIs/dodoDspProxy.ts":return import("./dodoDspProxy-CU7OAvJG.js");case"./ABIs/dodoERC20V3Factory.ts":return import("./dodoERC20V3Factory-Cz4XKDrU.js");case"./ABIs/dodoEthProxyABI.ts":return import("./dodoEthProxyABI-CoX95QJI.js");case"./ABIs/dodoFeeImpl.ts":return import("./dodoFeeImpl-zR9Qv4Tq.js");case"./ABIs/dodoFragment.ts":return import("./dodoFragment-4lxmE2XJ.js");case"./ABIs/dodoMineV3Proxy.ts":return import("./dodoMineV3Proxy-xOGM7Jnv.js");case"./ABIs/dodoMineV3ProxyOld.ts":return import("./dodoMineV3ProxyOld-BqsZxJRU.js");case"./ABIs/dodoMiningABI.ts":return import("./dodoMiningABI-9J5C_6kN.js");case"./ABIs/dodoMiningReaderABI.ts":return import("./dodoMiningReaderABI-DmUXA9Gv.js");case"./ABIs/dodoNftERC1155.ts":return import("./dodoNftERC1155-Bw6ID2NE.js");case"./ABIs/dodoNftERC721.ts":return import("./dodoNftERC721-CI1l0ip9.js");case"./ABIs/dodoNftPoolProxy.ts":return import("./dodoNftPoolProxy-DQkcZHUV.js");case"./ABIs/dodoNftProxy.ts":return import("./dodoNftProxy-Di-aoLYM.js");case"./ABIs/dodoNftVault.ts":return import("./dodoNftVault-B4NZaXcd.js");case"./ABIs/dodoOracleABI.ts":return import("./dodoOracleABI-BxwZofBV.js");case"./ABIs/dodoPair.ts":return import("./dodoPair-VN1aEVFz.js");case"./ABIs/dodoPreminingABI.ts":return import("./dodoPreminingABI-DU7ocR7L.js");case"./ABIs/dodoProxyV2.ts":return import("./dodoProxyV2-9ED9HqK5.js");case"./ABIs/dodoStarterProxy.ts":return import("./dodoStarterProxy-B1TdMOvw.js");case"./ABIs/dodoTokenABI.ts":return import("./dodoTokenABI-Dd2DVUbK.js");case"./ABIs/dodoUpCPFactoryABI.ts":return import("./dodoUpCPFactoryABI-C1W0Q4Ft.js");case"./ABIs/dodoUpCpFactory.ts":return import("./dodoUpCpFactory-D8ifQyp-.js");case"./ABIs/dodoV1PairProxy.ts":return import("./dodoV1PairProxy-DyRTqyPe.js");case"./ABIs/dodoZooABI.ts":return import("./dodoZooABI-D9Uc4iLK.js");case"./ABIs/dppPoolABI.ts":return import("./dppPoolABI-BvoeLJgK.js");case"./ABIs/erc20ABI.ts":return import("./erc20ABI-v08X4jmE.js");case"./ABIs/erc20Helper.ts":return import("./erc20Helper-CG659oLz.js");case"./ABIs/feeABI.ts":return import("./feeABI-DnQdJUpQ.js");case"./ABIs/multicallABI.ts":return import("./multicallABI-D9E1EeQD.js");case"./ABIs/nftContract.ts":return import("./nftContract-d4b6ObxG.js");case"./ABIs/nftFilterAdmin.ts":return import("./nftFilterAdmin-DMr_jrK_.js");case"./ABIs/oneBitSettlement.ts":return import("./oneBitSettlement-DMzQ-0t_.js");case"./ABIs/setApprovalForAll.ts":return import("./setApprovalForAll-BvnCORJI.js");case"./ABIs/spaceIdABI.ts":return import("./spaceIdABI-BS4XGAT1.js");case"./ABIs/spaceIdResolverABI.ts":return import("./spaceIdResolverABI-sYDT8GfP.js");case"./ABIs/v3MiningABI.ts":return import("./v3MiningABI-ZjGBkolS.js");case"./ABIs/vdodo.ts":return import("./vdodo-ttc2RVOs.js");case"./ABIs/vdodoTokenABI.ts":return import("./vdodoTokenABI-PldrbOSo.js");case"./ABIs/weth.ts":return import("./weth-Dz5DGEIF.js");default:return Promise.reject(new Error("Unknown variable dynamic import: "+e))}}(`./ABIs/${e}.ts`)).default}}))}!function(e){e.customERC20IsMintable="customERC20IsMintable",e.customMultiCallAggregate="customMultiCallAggregate",e.erc20Helper="erc20Helper",e.erc20ABI="erc20ABI",e.erc20Mock="erc20Mock",e.dodoERC20V3Factory="dodoERC20V3Factory",e.dodoCustomMintableERC20="dodoCustomMintableERC20",e.multicallABI="multicallABI",e.dppPoolABI="dppPoolABI",e.dvmPoolABI="DVM",e.classicalPoolABI="classicalPoolABI",e.v3MiningABI="v3MiningABI",e.dodoMiningABI="dodoMiningABI",e.dodoCP="dodoCP",e.dodoCPABI="dodoCPABI",e.dodoCPABIV2="dodoCPABIV2",e.dodoCpProxyV2="dodoCpProxyV2",e.dodoCpProxyV202="dodoCpProxyV202",e.dodoFeeImpl="dodoFeeImpl",e.feeABI="feeABI",e.vdodo="vdodo",e.vdodoTokenABI="vdodoTokenABI",e.dodoPreminingABI="dodoPreminingABI",e.MerkleDistributorABI="MerkleDistributorABI",e.DODOCirculationHelperABI="DODOCirculationHelperABI",e.FundingABI="FundingABI",e.dodoStarterProxy="dodoStarterProxy",e.MarginTrading="MarginTrading",e.MarginTradingFactory="MarginTradingFactory",e.DODORouteProxy="DODORouteProxy",e.dodoProxyV2="dodoProxyV2",e.AaveLendingPoolABI="AaveLendingPoolABI",e.AaveProtocolDataProviderABI="AaveProtocolDataProviderABI",e.AaveLendingPoolAddressesProvider="AaveLendingPoolAddressesProvider",e.AavePriceOracleABI="AavePriceOracleABI",e.spaceIdABI="spaceIdABI",e.spaceIdResolverABI="spaceIdResolverABI",e.dodoABI="dodoABI",e.PancakePairABI="PancakePairABI",e.NonfungiblePositionManager="NonfungiblePositionManager",e.UniswapV3Pool="UniswapV3Pool",e.dodoDspProxy="dodoDspProxy",e.dodoDppProxy="dodoDppProxy",e.IdodoV2="IdodoV2",e.dodoDPPAdmin="dodoDPPAdmin",e.dodoDSP="dodoDSP",e.dodoDVM="dodoDVM",e.dodoDSPFactory="dodoDSPFactory",e.dodoDVMFactory="dodoDVMFactory",e.D3Proxy="D3Proxy",e.dodoNftERC721="dodoNftERC721",e.dodoNftERC1155="dodoNftERC1155",e.dodoDropsProxy="dodoDropsProxy",e.dodoNftVault="dodoNftVault",e.dodoNftProxy="dodoNftProxy",e.dodoFragment="dodoFragment",e.dodoBuyoutModel="dodoBuyoutModel",e.dodoNftPoolProxy="dodoNftPoolProxy",e.nftFilterAdmin="nftFilterAdmin",e.baseFilterV1="baseFilterV1",e.FilterERC721V1="FilterERC721V1",e.FilterERC1155V1="FilterERC1155V1",e.dodoV1PairProxy="dodoV1PairProxy",e.dodoPair="dodoPair",e.dodoMineV3Proxy="dodoMineV3Proxy",e.dodoMineV3ProxyOld="dodoMineV3ProxyOld",e.LockedTokenVaultABI="LockedTokenVaultABI",e.DODOV1PmmHelperABI="DODOV1PmmHelperABI",e.D3MM_READ_ABI="D3MM_READ_ABI"}(Ws||(Ws={}));const eo=(e,t,n)=>V(void 0,void 0,void 0,(function*(){const r=yield Zs(e);return new xs(r).encodeFunctionData(t,n)})),to=(e,t,n)=>new xs(e).encodeFunctionData(t,n);class no extends xi{constructor(){super(...arguments),this._pendingBatchAggregator=null,this._pendingBatch=null,this._provider=null}setProvider(e){this._provider=e}send(e,t){const n=Object.create(null,{send:{get:()=>super.send}});return V(this,void 0,void 0,(function*(){if("eth_call"!==e||2!==t.length||"object"!=typeof t[0]||!t[0].to||!t[0].data||"string"!=typeof t[1])return this._provider?this._provider.send(e,t):n.send.call(this,e,t);const r={request:{method:e,params:t},resolve:null,reject:null},i=new Promise(((e,t)=>{r.resolve=e,r.reject=t}));this._pendingBatch||(this._pendingBatch=[]),this._pendingBatch.push(r);const s=()=>V(this,void 0,void 0,(function*(){const t=this._pendingBatch||[];let n;this._pendingBatch=null,this._pendingBatchAggregator=null;const i=yield this.detectNetwork();n="object"!=typeof i?parseInt(i,i.startsWith("0x")?16:10):i.chainId;const s=yield function(e,t){return V(this,void 0,void 0,(function*(){let n="";const r=t.map((e=>{const[t]=e;return n=e[1],[t.to,t.data]})),i=yield eo(Ws.customMultiCallAggregate,"aggregate",[r]);return[{to:q[e].MULTI_CALL,data:i},n]}))}(n,t.map((e=>e.request.params))),o={method:e,params:s,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"requestBatch",request:Ke(t.map((e=>e.request))),provider:this,id:o.id});const a=e=>{if(e.error||!e.result)t.forEach((t=>{try{const n=new Error(e.error.message);n.code=e.error.code,n.data=e.error.data,t.reject(n)}catch(n){t.reject(e.error)}})),this.emit("debug",{action:"responseBatch.error",request:o,response:e,provider:this,id:o.id});else{const[n,i]=Ps.decode(["uint256","bytes[]"],e.result),s=n.toNumber();if(this._setFastBlockNumber(s),this.emit("blockNumberChanged",s),t.length!==i.length)return void r.reject("Unexpected length mismatch");t.forEach(((e,t)=>{const n=i[t];e.resolve(n)})),this.emit("debug",{action:"responseBatch",request:o,response:e,provider:this,decodeList:i,id:o.id})}},l=e=>{this.emit("debug",{action:"responseBatch.error",error:e,request:o,provider:this,id:o.id}),t.forEach((t=>{t.reject(e)}))};if(!this._provider)return Mn(this.connection,JSON.stringify(o)).then(a,l);try{const e=yield this._provider.send(o.method,o.params);a({id:o.id,jsonrpc:o.jsonrpc,result:e})}catch(e){l(e)}}));return this._pendingBatchAggregator?this._pendingBatch.length>800&&(clearTimeout(this._pendingBatchAggregator),s()):this._pendingBatchAggregator=setTimeout(s,10),i}))}}const ro="contract-query";class io{constructor(e){this.subContractRequestsList=[],this.debugQuery=null==e?void 0:e.debugQuery,this.debugProvider=null==e?void 0:e.debugProvider,this.rpc=null==e?void 0:e.rpc,this.getConfigProvider=null==e?void 0:e.getProvider,this.staticJsonRpcProviderMap=new Map,this.batchStaticJsonRpcProviderMap=new Map,this.batchContractMap=new Map}setRpc(e){this.rpc=e,this.subContractRequestsList.forEach((t=>{t.setRpc(e)}))}setGetConfigProvider(e){this.getConfigProvider=e,this.subContractRequestsList.forEach((t=>{t.setGetConfigProvider(e)})),this.batchContractMap=new Map,this.staticJsonRpcProviderMap=new Map,this.batchStaticJsonRpcProviderMap=new Map}getProvider(e){var t,n;const r=null===(t=this.getConfigProvider)||void 0===t?void 0:t.call(this,e);if(r)return r;const i=null===(n=this.rpc)||void 0===n?void 0:n[e];if(!i)throw new Error(`ChainId ${e} not found`);if(this.staticJsonRpcProviderMap.has(e))return this.staticJsonRpcProviderMap.get(e);const s=new xi(i,e);return this.debugProvider&&s.on("debug",console.log),this.staticJsonRpcProviderMap.set(e,s),s}getBatchProvider(e){var t,n;const r=null===(t=this.getConfigProvider)||void 0===t?void 0:t.call(this,e),i=null===(n=this.rpc)||void 0===n?void 0:n[e];if(!i&&!r)throw new Error(`ChainId ${e} not found`);if(this.batchStaticJsonRpcProviderMap.has(e))return this.batchStaticJsonRpcProviderMap.get(e);const s=new no(i,e);return s.setProvider(r||null),this.debugProvider&&s.on("debug",console.log),this.batchStaticJsonRpcProviderMap.set(e,s),s}createContractRequests(){const e=new io({rpc:this.rpc,getProvider:this.getConfigProvider,debugQuery:this.debugQuery,debugProvider:this.debugProvider});return this.subContractRequestsList.push(e),e}getContract(e,t,n){const r=this.getProvider(e);return new Ks(t,n,r)}getBatchContract(e,t,n){var r;const i=this.batchContractMap.get(e);if(i){if(i.has(t))return i.get(t)}else this.batchContractMap.set(e,new Map);const s=this.getBatchProvider(e),o=new Ks(t,n,s);return null===(r=this.batchContractMap.get(e))||void 0===r||r.set(t,o),o}getBatchContractByAbiName(e,t,n){return V(this,void 0,void 0,(function*(){const r=yield this.getContractInterface(n);return this.getBatchContract(e,t,r)}))}getContractInterface(e){return Zs(e)}callMultiQuery(e,t){return V(this,void 0,void 0,(function*(){const n=q[e],{MULTI_CALL:r}=n,i=yield this.getContractInterface(Ws.customMultiCallAggregate),s=this.getContract(e,r,i),o=[],a=new Map,l=new Map,c={};for(let n=0;n<t.length;n++){const{contractAddress:r,method:i,params:s,abiName:u,callback:d}=t[n];let h=l.get(u);if(!h){const t=yield this.getContractInterface(u);a.set(u,t),h=this.getContract(e,r,t),l.set(u,h)}const f={to:r,data:h.interface.encodeFunctionData(i,s)};o.push({callData:f,processor:e=>{const t=new xs(a.get(u)).decodeFunctionResult(i,e);d&&d(t);const r=d?d(t):void 0;return c[n]=r||t,c[n]}})}const[u]=yield zs(s,r,o);return u}))}callQuery(e,t){return V(this,void 0,void 0,(function*(){const n=yield this.getContractInterface(t.abiName),r=this.getContract(e,t.contractAddress,n),i=yield r.callStatic[t.method](...t.params),s=t.callback?t.callback(i):void 0;return s||i}))}batchCallQuery(e,t){return V(this,void 0,void 0,(function*(){this.debugQuery&&console.log({action:"batchCallQuery.request",chainId:e,query:t});const n=yield this.getBatchProvider(e),r=yield eo(t.abiName,t.method,t.params),i=yield n.call({to:t.contractAddress,data:r}),s=yield((e,t,n)=>V(void 0,void 0,void 0,(function*(){const r=yield Zs(e);return new xs(r).decodeFunctionResult(t,n)})))(t.abiName,t.method,i),o=t.callback?t.callback(s):void 0;return this.debugQuery&&console.log({action:"batchCallQuery.response",chainId:e,query:t,response:s}),o||s}))}getBlockNumber(e){return V(this,void 0,void 0,(function*(){const t=this.getBatchProvider(e),n=yield t.getBlockNumber();return t.emit("blockNumberChanged",n),n}))}getETHBalance(e,t){return V(this,void 0,void 0,(function*(){const n=this.getProvider(e),r=yield n.getBalance(t);return new I(r.toString()).div(1e18)}))}}const so=JSON;function oo(e,t){if(!Boolean(e))throw new Error(t)}function ao(e,t){if(!Boolean(e))throw new Error("Unexpected invariant triggered.")}const lo=/\r\n|[\n\r]/g;function co(e,t){let n=0,r=1;for(const i of e.body.matchAll(lo)){if("number"==typeof i.index||ao(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function uo(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=1===t.line?n:0,l=t.column+a,c=`${e.name}:${o}:${l}\n`,u=r.split(/\r\n|[\n\r]/g),d=u[i];if(d.length>120){const e=Math.floor(l/80),t=l%80,n=[];for(let e=0;e<d.length;e+=80)n.push(d.slice(e,e+80));return c+ho([[`${o} |`,n[0]],...n.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return c+ho([[o-1+" |",u[i-1]],[`${o} |`,d],["|","^".padStart(l)],[`${o+1} |`,u[i+1]]])}function ho(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class fo extends Error{constructor(e,...t){var n,r,i;const{nodes:s,source:o,positions:a,path:l,originalError:c,extensions:u}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=l?l:void 0,this.originalError=null!=c?c:void 0,this.nodes=po(Array.isArray(s)?s:s?[s]:void 0);const d=po(null===(n=this.nodes)||void 0===n?void 0:n.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=o?o:null==d||null===(r=d[0])||void 0===r?void 0:r.source,this.positions=null!=a?a:null==d?void 0:d.map((e=>e.start)),this.locations=a&&o?a.map((e=>co(o,e))):null==d?void 0:d.map((e=>co(e.source,e.start)));const h="object"==typeof(f=null==c?void 0:c.extensions)&&null!==f?null==c?void 0:c.extensions:void 0;var f;this.extensions=null!==(i=null!=u?u:h)&&void 0!==i?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=c&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,fo):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+="\n\n"+uo((t=n.loc).source,co(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+uo(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function po(e){return void 0===e||0===e.length?void 0:e}function mo(e,t,n){return new fo(`Syntax Error: ${n}`,{source:e,positions:[t]})}class go{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class yo{constructor(e,t,n,r,i,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const Ao={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Eo=new Set(Object.keys(Ao));function bo(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Eo.has(t)}var vo,wo,Oo,Do;function To(e){return 9===e||32===e}function Po(e){return e>=48&&e<=57}function _o(e){return e>=97&&e<=122||e>=65&&e<=90}function Ro(e){return _o(e)||95===e}function Io(e){return _o(e)||Po(e)||95===e}function Co(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let t=0;t<e.length;++t){var s;const o=e[t],a=Bo(o);a!==o.length&&(r=null!==(s=r)&&void 0!==s?s:t,i=t,0!==t&&a<n&&(n=a))}return e.map(((e,t)=>0===t?e:e.slice(n))).slice(null!==(t=r)&&void 0!==t?t:0,i+1)}function Bo(e){let t=0;for(;t<e.length&&To(e.charCodeAt(t));)++t;return t}!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(vo||(vo={})),function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(wo||(wo={})),function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(Oo||(Oo={})),function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(Do||(Do={}));class ko{constructor(e){const t=new yo(Do.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==Do.EOF)do{if(e.next)e=e.next;else{const t=qo(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===Do.COMMENT);return e}}function No(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function xo(e,t){return So(e.charCodeAt(t))&&Lo(e.charCodeAt(t+1))}function So(e){return e>=55296&&e<=56319}function Lo(e){return e>=56320&&e<=57343}function Fo(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return Do.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function Mo(e,t,n,r,i){const s=e.line,o=1+n-e.lineStart;return new yo(t,n,r,s,o,i)}function qo(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const t=n.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===n.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Uo(e,i);case 33:return Mo(e,Do.BANG,i,i+1);case 36:return Mo(e,Do.DOLLAR,i,i+1);case 38:return Mo(e,Do.AMP,i,i+1);case 40:return Mo(e,Do.PAREN_L,i,i+1);case 41:return Mo(e,Do.PAREN_R,i,i+1);case 46:if(46===n.charCodeAt(i+1)&&46===n.charCodeAt(i+2))return Mo(e,Do.SPREAD,i,i+3);break;case 58:return Mo(e,Do.COLON,i,i+1);case 61:return Mo(e,Do.EQUALS,i,i+1);case 64:return Mo(e,Do.AT,i,i+1);case 91:return Mo(e,Do.BRACKET_L,i,i+1);case 93:return Mo(e,Do.BRACKET_R,i,i+1);case 123:return Mo(e,Do.BRACE_L,i,i+1);case 124:return Mo(e,Do.PIPE,i,i+1);case 125:return Mo(e,Do.BRACE_R,i,i+1);case 34:return 34===n.charCodeAt(i+1)&&34===n.charCodeAt(i+2)?Ko(e,i):jo(e,i)}if(Po(t)||45===t)return Vo(e,i,t);if(Ro(t))return zo(e,i);throw mo(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":No(t)||xo(n,i)?`Unexpected character: ${Fo(e,i)}.`:`Invalid character: ${Fo(e,i)}.`)}return Mo(e,Do.EOF,r,r)}function Uo(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const e=n.charCodeAt(i);if(10===e||13===e)break;if(No(e))++i;else{if(!xo(n,i))break;i+=2}}return Mo(e,Do.COMMENT,t,i,n.slice(t+1,i))}function Vo(e,t,n){const r=e.source.body;let i=t,s=n,o=!1;if(45===s&&(s=r.charCodeAt(++i)),48===s){if(s=r.charCodeAt(++i),Po(s))throw mo(e.source,i,`Invalid number, unexpected digit after 0: ${Fo(e,i)}.`)}else i=Ho(e,i,s),s=r.charCodeAt(i);if(46===s&&(o=!0,s=r.charCodeAt(++i),i=Ho(e,i,s),s=r.charCodeAt(i)),69!==s&&101!==s||(o=!0,s=r.charCodeAt(++i),43!==s&&45!==s||(s=r.charCodeAt(++i)),i=Ho(e,i,s),s=r.charCodeAt(i)),46===s||Ro(s))throw mo(e.source,i,`Invalid number, expected digit but got: ${Fo(e,i)}.`);return Mo(e,o?Do.FLOAT:Do.INT,t,i,r.slice(t,i))}function Ho(e,t,n){if(!Po(n))throw mo(e.source,t,`Invalid number, expected digit but got: ${Fo(e,t)}.`);const r=e.source.body;let i=t+1;for(;Po(r.charCodeAt(i));)++i;return i}function jo(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,o="";for(;i<r;){const r=n.charCodeAt(i);if(34===r)return o+=n.slice(s,i),Mo(e,Do.STRING,t,i+1,o);if(92!==r){if(10===r||13===r)break;if(No(r))++i;else{if(!xo(n,i))throw mo(e.source,i,`Invalid character within String: ${Fo(e,i)}.`);i+=2}}else{o+=n.slice(s,i);const t=117===n.charCodeAt(i+1)?123===n.charCodeAt(i+2)?Qo(e,i):Yo(e,i):$o(e,i);o+=t.value,i+=t.size,s=i}}throw mo(e.source,i,"Unterminated string.")}function Qo(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const e=n.charCodeAt(t+i++);if(125===e){if(i<5||!No(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Xo(e),r<0)break}throw mo(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Yo(e,t){const n=e.source.body,r=Go(n,t+2);if(No(r))return{value:String.fromCodePoint(r),size:6};if(So(r)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=Go(n,t+8);if(Lo(e))return{value:String.fromCodePoint(r,e),size:12}}throw mo(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Go(e,t){return Xo(e.charCodeAt(t))<<12|Xo(e.charCodeAt(t+1))<<8|Xo(e.charCodeAt(t+2))<<4|Xo(e.charCodeAt(t+3))}function Xo(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function $o(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw mo(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function Ko(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,o=s,a="";const l=[];for(;s<r;){const r=n.charCodeAt(s);if(34===r&&34===n.charCodeAt(s+1)&&34===n.charCodeAt(s+2)){a+=n.slice(o,s),l.push(a);const r=Mo(e,Do.BLOCK_STRING,t,s+3,Co(l).join("\n"));return e.line+=l.length-1,e.lineStart=i,r}if(92!==r||34!==n.charCodeAt(s+1)||34!==n.charCodeAt(s+2)||34!==n.charCodeAt(s+3))if(10!==r&&13!==r)if(No(r))++s;else{if(!xo(n,s))throw mo(e.source,s,`Invalid character within String: ${Fo(e,s)}.`);s+=2}else a+=n.slice(o,s),l.push(a),13===r&&10===n.charCodeAt(s+1)?s+=2:++s,a="",o=s,i=s;else a+=n.slice(o,s),o=s+1,s+=4}throw mo(e.source,s,"Unterminated string.")}function zo(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){if(!Io(n.charCodeAt(i)))break;++i}return Mo(e,Do.NAME,t,i,n.slice(t,i))}const Jo=10,Wo=2;function Zo(e){return ea(e,[])}function ea(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:ea(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Wo)return"[Array]";const n=Math.min(Jo,e.length),r=e.length-n,i=[];for(let r=0;r<n;++r)i.push(ea(e[r],t));1===r?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`);return"["+i.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>Wo)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const r=n.map((([e,n])=>e+": "+ea(n,t)));return"{ "+r.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const ta=globalThis.process&&"production"===globalThis.process.env.NODE_ENV?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var n;const r=t.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(n=e.constructor)||void 0===n?void 0:n.name)){const t=Zo(e);throw new Error(`Cannot use ${r} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class na{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||oo(!1,`Body must be a string. Received: ${Zo(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||oo(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||oo(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class ra{constructor(e,t={}){const n=function(e){return ta(e,na)}(e)?e:new na(e);this._lexer=new ko(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(Do.NAME);return this.node(e,{kind:Oo.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Oo.DOCUMENT,definitions:this.many(Do.SOF,this.parseDefinition,Do.EOF)})}parseDefinition(){if(this.peek(Do.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===Do.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw mo(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(Do.BRACE_L))return this.node(e,{kind:Oo.OPERATION_DEFINITION,operation:vo.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(Do.NAME)&&(n=this.parseName()),this.node(e,{kind:Oo.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Do.NAME);switch(e.value){case"query":return vo.QUERY;case"mutation":return vo.MUTATION;case"subscription":return vo.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Do.PAREN_L,this.parseVariableDefinition,Do.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Oo.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Do.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Do.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Do.DOLLAR),this.node(e,{kind:Oo.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Oo.SELECTION_SET,selections:this.many(Do.BRACE_L,this.parseSelection,Do.BRACE_R)})}parseSelection(){return this.peek(Do.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,r;return this.expectOptionalToken(Do.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:Oo.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Do.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Do.PAREN_L,t,Do.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(Do.COLON),this.node(t,{kind:Oo.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Do.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Do.NAME)?this.node(e,{kind:Oo.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Oo.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:Oo.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Oo.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case Do.BRACKET_L:return this.parseList(e);case Do.BRACE_L:return this.parseObject(e);case Do.INT:return this.advanceLexer(),this.node(t,{kind:Oo.INT,value:t.value});case Do.FLOAT:return this.advanceLexer(),this.node(t,{kind:Oo.FLOAT,value:t.value});case Do.STRING:case Do.BLOCK_STRING:return this.parseStringLiteral();case Do.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Oo.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Oo.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Oo.NULL});default:return this.node(t,{kind:Oo.ENUM,value:t.value})}case Do.DOLLAR:if(e){if(this.expectToken(Do.DOLLAR),this._lexer.token.kind===Do.NAME){const e=this._lexer.token.value;throw mo(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Oo.STRING,value:e.value,block:e.kind===Do.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:Oo.LIST,values:this.any(Do.BRACKET_L,(()=>this.parseValueLiteral(e)),Do.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:Oo.OBJECT,fields:this.any(Do.BRACE_L,(()=>this.parseObjectField(e)),Do.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(Do.COLON),this.node(t,{kind:Oo.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Do.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Do.AT),this.node(t,{kind:Oo.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Do.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(Do.BRACKET_R),t=this.node(e,{kind:Oo.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(Do.BANG)?this.node(e,{kind:Oo.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Oo.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Do.STRING)||this.peek(Do.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.many(Do.BRACE_L,this.parseOperationTypeDefinition,Do.BRACE_R);return this.node(e,{kind:Oo.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Do.COLON);const n=this.parseNamedType();return this.node(e,{kind:Oo.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:Oo.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:Oo.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Do.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Do.BRACE_L,this.parseFieldDefinition,Do.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(Do.COLON);const i=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:Oo.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:s})}parseArgumentDefs(){return this.optionalMany(Do.PAREN_L,this.parseInputValueDef,Do.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Do.COLON);const r=this.parseTypeReference();let i;this.expectOptionalToken(Do.EQUALS)&&(i=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:Oo.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:Oo.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:Oo.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(Do.EQUALS)?this.delimitedMany(Do.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:Oo.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(Do.BRACE_L,this.parseEnumValueDefinition,Do.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:Oo.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw mo(this._lexer.source,this._lexer.token.start,`${ia(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:Oo.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(Do.BRACE_L,this.parseInputValueDef,Do.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Do.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(Do.BRACE_L,this.parseOperationTypeDefinition,Do.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:Oo.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:Oo.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:Oo.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:Oo.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Oo.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Oo.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Oo.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Do.AT);const n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:Oo.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:s})}parseDirectiveLocations(){return this.delimitedMany(Do.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(wo,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new go(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw mo(this._lexer.source,t.start,`Expected ${sa(e)}, found ${ia(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==Do.NAME||t.value!==e)throw mo(this._lexer.source,t.start,`Expected "${e}", found ${ia(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Do.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return mo(this._lexer.source,t.start,`Unexpected ${ia(t)}.`)}any(e,t,n){this.expectToken(e);const r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==Do.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw mo(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function ia(e){const t=e.value;return sa(e.kind)+(null!=t?` "${t}"`:"")}function sa(e){return function(e){return e===Do.BANG||e===Do.DOLLAR||e===Do.AMP||e===Do.PAREN_L||e===Do.PAREN_R||e===Do.SPREAD||e===Do.COLON||e===Do.EQUALS||e===Do.AT||e===Do.BRACKET_L||e===Do.BRACKET_R||e===Do.BRACE_L||e===Do.PIPE||e===Do.BRACE_R}(e)?`"${e}"`:e}const oa=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function aa(e){return la[e.charCodeAt(0)]}const la=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],ca=Object.freeze({});function ua(e,t){const n=e[t];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function da(e){return function(e,t,n=Ao){const r=new Map;for(const e of Object.values(Oo))r.set(e,ua(t,e));let i,s,o,a=Array.isArray(e),l=[e],c=-1,u=[],d=e;const h=[],f=[];do{c++;const e=c===l.length,y=e&&0!==u.length;if(e){if(s=0===f.length?void 0:h[h.length-1],d=o,o=f.pop(),y)if(a){d=d.slice();let e=0;for(const[t,n]of u){const r=t-e;null===n?(d.splice(r,1),e++):d[r]=n}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[e,t]of u)d[e]=t}c=i.index,l=i.keys,u=i.edits,a=i.inArray,i=i.prev}else if(o){if(s=a?c:l[c],d=o[s],null==d)continue;h.push(s)}let A;if(!Array.isArray(d)){var p,m;bo(d)||oo(!1,`Invalid AST Node: ${Zo(d)}.`);const n=e?null===(p=r.get(d.kind))||void 0===p?void 0:p.leave:null===(m=r.get(d.kind))||void 0===m?void 0:m.enter;if(A=null==n?void 0:n.call(t,d,s,o,h,f),A===ca)break;if(!1===A){if(!e){h.pop();continue}}else if(void 0!==A&&(u.push([s,A]),!e)){if(!bo(A)){h.pop();continue}d=A}}var g;void 0===A&&y&&u.push([s,d]),e?h.pop():(i={inArray:a,index:c,keys:l,edits:u,prev:i},a=Array.isArray(d),l=a?d:null!==(g=n[d.kind])&&void 0!==g?g:[],c=-1,u=[],o&&f.push(o),o=d)}while(void 0!==i);return 0!==u.length?u[u.length-1][1]:e}(e,ha)}const ha={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>fa(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=ma("(",fa(e.variableDefinitions,", "),")"),n=fa([e.operation,fa([e.name,t]),fa(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+ma(" = ",n)+ma(" ",fa(r," "))},SelectionSet:{leave:({selections:e})=>pa(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=ma("",e,": ")+t;let o=s+ma("(",fa(n,", "),")");return o.length>80&&(o=s+ma("(\n",ga(fa(n,"\n")),"\n)")),fa([o,fa(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+ma(" ",fa(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>fa(["...",ma("on ",e),fa(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${ma("(",fa(n,", "),")")} on ${t} ${ma("",fa(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=1===r.length,s=r.length>1&&r.slice(1).every((e=>0===e.length||To(e.charCodeAt(0)))),o=n.endsWith('\\"""'),a=e.endsWith('"')&&!o,l=e.endsWith("\\"),c=a||l,u=!i||e.length>70||c||s||o;let d="";const h=i&&To(e.charCodeAt(0));return(u&&!h||s)&&(d+="\n"),d+=n,(u||c)&&(d+="\n"),'"""'+d+'"""'}(e):`"${e.replace(oa,aa)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+fa(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+fa(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+ma("(",fa(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>ma("",e,"\n")+fa(["schema",fa(t," "),pa(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>ma("",e,"\n")+fa(["scalar",t,fa(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>ma("",e,"\n")+fa(["type",t,ma("implements ",fa(n," & ")),fa(r," "),pa(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>ma("",e,"\n")+t+(ya(n)?ma("(\n",ga(fa(n,"\n")),"\n)"):ma("(",fa(n,", "),")"))+": "+r+ma(" ",fa(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>ma("",e,"\n")+fa([t+": "+n,ma("= ",r),fa(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>ma("",e,"\n")+fa(["interface",t,ma("implements ",fa(n," & ")),fa(r," "),pa(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>ma("",e,"\n")+fa(["union",t,fa(n," "),ma("= ",fa(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>ma("",e,"\n")+fa(["enum",t,fa(n," "),pa(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>ma("",e,"\n")+fa([t,fa(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>ma("",e,"\n")+fa(["input",t,fa(n," "),pa(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>ma("",e,"\n")+"directive @"+t+(ya(n)?ma("(\n",ga(fa(n,"\n")),"\n)"):ma("(",fa(n,", "),")"))+(r?" repeatable":"")+" on "+fa(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>fa(["extend schema",fa(e," "),pa(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>fa(["extend scalar",e,fa(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>fa(["extend type",e,ma("implements ",fa(t," & ")),fa(n," "),pa(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>fa(["extend interface",e,ma("implements ",fa(t," & ")),fa(n," "),pa(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>fa(["extend union",e,fa(t," "),ma("= ",fa(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>fa(["extend enum",e,fa(t," "),pa(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>fa(["extend input",e,fa(t," "),pa(n)]," ")}};function fa(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function pa(e){return ma("{\n",ga(fa(e,"\n")),"\n}")}function ma(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ga(e){return ma(" ",e.replace(/\n/g,"\n "))}function ya(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}const Aa=e=>{let t;const n=e.definitions.filter((e=>"OperationDefinition"===e.kind));return 1===n.length&&(t=n[0]?.name?.value),t},Ea=e=>{if("string"==typeof e){let n;try{const r=new ra(e,t).parseDocument();n=Aa(r)}catch(e){}return{query:e,operationName:n}}var t;const n=Aa(e);return{query:da(e),operationName:n}};class ba extends Error{constructor(e,t){super(`${ba.extractMessage(e)}: ${JSON.stringify({response:e,request:t})}`),Object.setPrototypeOf(this,ba.prototype),this.response=e,this.request=t,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ba)}static extractMessage(e){return e.errors?.[0]?.message??`GraphQL Error (Code: ${e.status})`}}const va=e=>{let t={};return e&&("undefined"!=typeof Headers&&e instanceof Headers||B&&B.Headers&&e instanceof B.Headers?t=(e=>{const t={};return e.forEach(((e,n)=>{t[n]=e})),t})(e):Array.isArray(e)?e.forEach((([e,n])=>{e&&void 0!==n&&(t[e]=n)})):t=e),t},wa=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Oa=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:o,fetchOptions:a,middleware:l}=t,c={...t.headers};let u,d="";"POST"===e?(u=Pa(r,i,s,a.jsonSerializer),"string"==typeof u&&(c["Content-Type"]="application/json")):d=(e=>{if(!Array.isArray(e.query)){const t=e,n=[`query=${encodeURIComponent(wa(t.query))}`];return e.variables&&n.push(`variables=${encodeURIComponent(t.jsonSerializer.stringify(t.variables))}`),t.operationName&&n.push(`operationName=${encodeURIComponent(t.operationName)}`),n.join("&")}if(void 0!==e.variables&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce(((e,n,r)=>(e.push({query:wa(n),variables:t.variables?t.jsonSerializer.stringify(t.variables[r]):void 0}),e)),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`})({query:r,variables:i,operationName:s,jsonSerializer:a.jsonSerializer??so});const h={method:e,headers:c,body:u,...a};let f=n,p=h;if(l){const e=await Promise.resolve(l({...h,url:n,operationName:s,variables:i})),{url:t,...r}=e;f=t,p=r}return d&&(f=`${f}?${d}`),await o(f,p)};class Da{constructor(e,t={}){this.url=e,this.requestConfig=t,this.rawRequest=async(...e)=>{const[t,n,r]=e,i=((e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0})(t,n,r),{headers:s,fetch:o=k,method:a="POST",requestMiddleware:l,responseMiddleware:c,...u}=this.requestConfig,{url:d}=this;void 0!==i.signal&&(u.signal=i.signal);const{operationName:h}=Ea(i.query);return Ta({url:d,query:i.query,variables:i.variables,headers:{...va(Ra(s)),...va(i.requestHeaders)},operationName:h,fetch:o,method:a,fetchOptions:u,middleware:l}).then((e=>(c&&c(e),e))).catch((e=>{throw c&&c(e),e}))}}async request(e,...t){const[n,r]=t,i=((e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0})(e,n,r),{headers:s,fetch:o=k,method:a="POST",requestMiddleware:l,responseMiddleware:c,...u}=this.requestConfig,{url:d}=this;void 0!==i.signal&&(u.signal=i.signal);const{query:h,operationName:f}=Ea(i.document);return Ta({url:d,query:h,variables:i.variables,headers:{...va(Ra(s)),...va(i.requestHeaders)},operationName:f,fetch:o,method:a,fetchOptions:u,middleware:l}).then((e=>(c&&c(e),e.data))).catch((e=>{throw c&&c(e),e}))}batchRequests(e,t){const n=((e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0})(e,t),{headers:r,...i}=this.requestConfig;void 0!==n.signal&&(i.signal=n.signal);const s=n.documents.map((({document:e})=>Ea(e).query)),o=n.documents.map((({variables:e})=>e));return Ta({url:this.url,query:s,variables:o,headers:{...va(Ra(r)),...va(n.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??k,method:this.requestConfig.method||"POST",fetchOptions:i,middleware:this.requestConfig.requestMiddleware}).then((e=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(e),e.data))).catch((e=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(e),e}))}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,t){const{headers:n}=this.requestConfig;return n?n[e]=t:this.requestConfig.headers={[e]:t},this}setEndpoint(e){return this.url=e,this}}const Ta=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=Oa((e.method??"post").toUpperCase());const s=Array.isArray(e.query),o=await i(e),a=await _a(o,r.jsonSerializer??so),l=Array.isArray(a)?!a.some((({data:e})=>!e)):Boolean(a.data),c=Array.isArray(a)||!a.errors||Array.isArray(a.errors)&&!a.errors.length||"all"===r.errorPolicy||"ignore"===r.errorPolicy;if(o.ok&&c&&l){const{errors:e,...t}=(Array.isArray(a),a),n="ignore"===r.errorPolicy?t:a;return{...s?{data:n}:n,headers:o.headers,status:o.status}}throw new ba({..."string"==typeof a?{error:a}:a,status:o.status,headers:o.headers},{query:t,variables:n})},Pa=(e,t,n,r)=>{const i=r??so;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(void 0!==t&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce(((e,n,r)=>(e.push({query:n,variables:t?t[r]:void 0}),e)),[]);return i.stringify(s)},_a=async(e,t)=>{let n;return e.headers.forEach(((e,t)=>{"content-type"===t.toLowerCase()&&(n=e)})),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Ra=e=>"function"==typeof e?e():e,Ia={url:"https://api.dodoex.io/frontend-graphql"};class Ca{constructor(e){const t=Object.assign(Object.assign({},Ia),e);this.url=t.url,this.getHeaders=t.getHeaders;const n=new Da(this.url,{fetch:t.fetch,requestMiddleware:e=>{const t=new URL(e.url);return e.operationName&&t.searchParams.append("opname",e.operationName),Object.assign(Object.assign({},e),{url:t.toString()})}});this.client=n,this.setHeaders()}setHeaders(){return V(this,void 0,void 0,(function*(){var e;const t=yield null===(e=this.getHeaders)||void 0===e?void 0:e.call(this);t&&this.client.setHeaders(t)}))}getData(e,t){return V(this,void 0,void 0,(function*(){yield this.setHeaders();return this.client.request(e,t)}))}getQuery(e,...[t]){return{queryKey:["graphql","getQuery",e,t],queryFn:()=>V(this,void 0,void 0,(function*(){return yield this.getData(e.toString(),t)}))}}getInfiniteQuery(e,t,...[n]){return{queryKey:["graphql","getInfiniteQuery",t,e,n],queryFn:r=>V(this,[r],void 0,(function*({pageParam:r}){return yield this.getData(e.toString(),Object.assign(Object.assign({},n),{where:Object.assign(Object.assign({},null==n?void 0:n.where),{[t]:r})}))}))}}}const Ba={host:"https://api.dodoex.io",fetch:k};class ka{constructor(e){const t=Object.assign(Object.assign({},Ba),e);this.host=t.host,this._getFetch=()=>t.fetch}getUrl(e,t){let n=`${this.host}/${e}`;return t&&(n=`${n}?${N.stringify(t)}`),n}responseProcessor(e){return V(this,void 0,void 0,(function*(){if(e.ok){const t=yield e.json();return{response:e,result:t}}throw new Error(`Response ${JSON.stringify(e)} failed`)}))}getJson(e,t,n){return V(this,void 0,void 0,(function*(){const r=this.getUrl(e,t),i=this._getFetch(),s=yield i(r,R({method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}},n));return this.responseProcessor(s)}))}postJson(e,t,n,r){return V(this,void 0,void 0,(function*(){const i=this.getUrl(e,n),s=this._getFetch(),o=yield s(i,R({method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:t?JSON.stringify(t):void 0},r));return this.responseProcessor(o)}))}}const Na={getIsV3Mining:e=>["DSP","GSP","LPTOKEN","V3CLASSICAL"].includes(e),singleSideLp:e=>["CLASSICAL","V3CLASSICAL","DPP"].includes(e),canOperateLiquidity(e,t,n,r){const i=null!=t?t:n;return!!(e&&i&&r)&&("DPP"!==e||i.toLocaleLowerCase()===r.toLocaleLowerCase())}};class xa extends String{constructor(e,t){super(e),this.value=e,this.__meta__=t}toString(){return this.value}}const Sa={"\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n }\n ":new xa("\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n}\n "),"\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n }\n ":new xa("\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n}\n "),"\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n }\n":new xa("\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n}\n "),"\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new xa("\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new xa("\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new xa("\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query FetchPoolList(\n $first: Int\n $where: Pair_filter\n $orderBy: Pair_orderBy\n ) {\n pairs(\n first: $first\n where: $where\n orderBy: $orderBy\n orderDirection: desc\n ) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n }\n ":new xa("\n query FetchPoolList($first: Int, $where: Pair_filter, $orderBy: Pair_orderBy) {\n pairs(first: $first, where: $where, orderBy: $orderBy, orderDirection: desc) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n}\n "),"\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n ":new xa("\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n}\n "),"\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n ":new xa("\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n}\n "),"\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n }\n ":new xa("\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n}\n "),"\n query FetchPool(\n $id: ID!\n $where: Pair_filter\n $liquidityWhere: Liquiditylist_filter\n ) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n }\n ":new xa("\n query FetchPool($id: ID!, $where: Pair_filter, $liquidityWhere: Liquiditylist_filter) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n}\n "),"\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n }\n ":new xa("\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n}\n "),"\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n }\n ":new xa("\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n}\n "),"\n query FetchPoolSwapList(\n $first: Int\n $skip: Int\n $where: Swap_filter\n $orderBy: Swap_orderBy\n $orderDirection: OrderDirection\n ) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n }\n ":new xa("\n query FetchPoolSwapList($first: Int, $skip: Int, $where: Swap_filter, $orderBy: Swap_orderBy, $orderDirection: OrderDirection) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n}\n "),"\n query FetchLiquidityPositions(\n $id: ID!\n $first: Int\n $skip: Int\n $where: LiquidityPosition_filter\n $miningWhere: LiquidityPosition_filter\n $orderBy: LiquidityPosition_orderBy\n $orderDirection: OrderDirection\n ) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n }\n ":new xa("\n query FetchLiquidityPositions($id: ID!, $first: Int, $skip: Int, $where: LiquidityPosition_filter, $miningWhere: LiquidityPosition_filter, $orderBy: LiquidityPosition_orderBy, $orderDirection: OrderDirection) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n}\n "),"\n query FetchPoolPairList(\n $first: Int\n $baseWhere: Pair_filter\n $quoteWhere: Pair_filter\n $orderBy: Pair_orderBy\n $orderDirection: OrderDirection\n ) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n }\n ":new xa("\n query FetchPoolPairList($first: Int, $baseWhere: Pair_filter, $quoteWhere: Pair_filter, $orderBy: Pair_orderBy, $orderDirection: OrderDirection) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n}\n "),"\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ":new xa("\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n}\n "),"\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n ":new xa("\n query FetchNoticeCenterTransactionList($where: Notice_centertransactionListFilter) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n}\n "),"\n query FetchLiquidityLpPartnerRewards(\n $where: LiquidityLpPartnerRewardsInput\n ) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n }\n ":new xa("\n query FetchLiquidityLpPartnerRewards($where: LiquidityLpPartnerRewardsInput) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n}\n "),"\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n }\n ":new xa("\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n}\n ")};function La(e){var t;return null!==(t=Sa[e])&&void 0!==t?t:{}}const Fa=La("\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n }\n");class Ma{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("AMMV3Api does not initialize the contractRequests");this.contractRequests=new io(e.contractRequestsConfig)}}getPositions(e,t,n){return{queryKey:[ro,"ammv3","getPositions",...arguments],enabled:!!e&&!!t,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.callMultiQuery(e,n.map((e=>({abiName:Ws.NonfungiblePositionManager,contractAddress:t,method:"positions",params:e}))))}))}}getOwner(e,t,n){return{queryKey:[ro,"ammv3","getOwner",...arguments],enabled:!!e&&!!t,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Ws.NonfungiblePositionManager,contractAddress:t,method:"ownerOf",params:[n]})}))}}getBalanceOf(e,t,n){return{queryKey:[ro,"ammv3","getBalanceOf",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t||!n)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.NonfungiblePositionManager,contractAddress:t,method:"balanceOf",params:[n]});return new I(r.toString())}))}}getTokenOfOwnerByIndex(e,t,n){return{queryKey:[ro,"ammv3","getTokenOfOwnerByIndex",...arguments],enabled:!!e&&!!t,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.callMultiQuery(e,n.map((e=>({abiName:Ws.NonfungiblePositionManager,contractAddress:t,method:"tokenOfOwnerByIndex",params:e.map((e=>e.toString()))}))))}))}}getV3PoolSlot0(e,t){return{queryKey:[ro,"ammv3","getSlot0",...arguments],enabled:!!e||!!t,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Ws.UniswapV3Pool,contractAddress:t,method:"slot0",params:[]})}))}}getV3PoolLiquidity(e,t){return{queryKey:[ro,"ammv3","getV3PoolLiquidity",...arguments],enabled:!!e||!!t,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Ws.UniswapV3Pool,contractAddress:t,method:"liquidity",params:[]})}))}}getCollect(e,t,n,r){return{queryKey:[ro,"ammv3","getCollect",...arguments],enabled:!!e||!!t,queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&r))return null;const i=we.from(2).pow(128).sub(1);return yield this.contractRequests.callQuery(e,{abiName:Ws.NonfungiblePositionManager,contractAddress:t,method:"collect",params:[{tokenId:n,recipient:r,amount0Max:i,amount1Max:i},{from:r}]})}))}}}Ma.graphql={AllV3TicksDocument:Fa},Ma.utils=Na,Ma.encode={};const qa=(e,t)=>new C(we.isBigNumber(e)?e.toString():e).div(10**t),Ua={fetchPoolList:La("\n query FetchPoolList(\n $first: Int\n $where: Pair_filter\n $orderBy: Pair_orderBy\n ) {\n pairs(\n first: $first\n where: $where\n orderBy: $orderBy\n orderDirection: desc\n ) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n }\n "),fetchLiquidityList:La("\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n "),fetchMyLiquidityList:La("\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n "),fetchDashboardPairList:La("\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n }\n "),fetchPool:La("\n query FetchPool(\n $id: ID!\n $where: Pair_filter\n $liquidityWhere: Liquiditylist_filter\n ) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n }\n "),fetchPoolDayData:La("\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n }\n "),fetchPoolDashboard:La("\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n }\n "),fetchPoolSwapList:La("\n query FetchPoolSwapList(\n $first: Int\n $skip: Int\n $where: Swap_filter\n $orderBy: Swap_orderBy\n $orderDirection: OrderDirection\n ) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n }\n "),fetchLiquidityPositions:La("\n query FetchLiquidityPositions(\n $id: ID!\n $first: Int\n $skip: Int\n $where: LiquidityPosition_filter\n $miningWhere: LiquidityPosition_filter\n $orderBy: LiquidityPosition_orderBy\n $orderDirection: OrderDirection\n ) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n }\n "),fetchPoolPairList:La("\n query FetchPoolPairList(\n $first: Int\n $baseWhere: Pair_filter\n $quoteWhere: Pair_filter\n $orderBy: Pair_orderBy\n $orderDirection: OrderDirection\n ) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n }\n ")};class Va{QuerySellBase(e,t){try{let n;if(0===t.RStatus)n=this.ROneSellBase(e,t);else if(1===t.RStatus){const r=t.B0.minus(t.B),i=t.Q.minus(t.Q0);e.lt(r)?(n=this.RAboveSellBase(e,t),n.gt(i)&&(n=i)):n=e.eq(r)?i:i.plus(this.ROneSellBase(e.minus(r),t))}else n=this.RBelowSellBase(e,t);const r=n.multipliedBy(t.mtFeeRate),i=n.multipliedBy(t.lpFeeRate);return n.minus(r).minus(i)}catch(e){return new I(0)}}QuerySellQuote(e,t){try{let n;if(0===t.RStatus)n=this.ROneSellQuote(e,t);else if(1===t.RStatus)n=this.RAboveSellQuote(e,t);else{const r=t.B.minus(t.B0),i=t.Q0.minus(t.Q);e.lt(i)?(n=this.RBelowSellQuote(e,t),n.gt(r)&&(n=r)):n=e.eq(i)?r:r.plus(this.ROneSellQuote(e.minus(i),t))}const r=n.multipliedBy(t.mtFeeRate),i=n.multipliedBy(t.lpFeeRate);return n.minus(r).minus(i)}catch(e){return new I(0)}}GetMidPrice(e){if(2==e.RStatus){let t=e.Q0.multipliedBy(e.Q0).div(e.Q).div(e.Q);return t=new I(1).minus(e.k).plus(e.k.multipliedBy(t)),e.OraclePrice.div(t)}if(1==e.RStatus){let t=e.B0.multipliedBy(e.B0).div(e.B).div(e.B);return t=new I(1).minus(e.k).plus(e.k.multipliedBy(t)),e.OraclePrice.multipliedBy(t)}return e.OraclePrice}ROneSellBase(e,t){return ja(t.Q0,t.Q0,e,t.OraclePrice,t.k)}ROneSellQuote(e,t){return ja(t.B0,t.B0,e,new I(1).div(t.OraclePrice),t.k)}RAboveSellBase(e,t){return Ha(t.B0,t.B.plus(e),t.B,t.OraclePrice,t.k)}RAboveSellQuote(e,t){return ja(t.B0,t.B,e,new I(1).div(t.OraclePrice),t.k)}RBelowSellQuote(e,t){return Ha(t.Q0,t.Q.plus(e),t.Q,new I(1).div(t.OraclePrice),t.k)}RBelowSellBase(e,t){return ja(t.Q0,t.Q,e,t.OraclePrice,t.k)}}const Ha=(e,t,n,r,i)=>{if(e.lte(0))throw new Error("TARGET_IS_ZERO");const s=r.multipliedBy(t.minus(n));if(i.eq(0))return s;const o=e.multipliedBy(e).div(t).div(n).multipliedBy(i);return s.multipliedBy(new I(1).minus(i).plus(o))},ja=(e,t,n,r,i)=>{if(e.lte(0))throw new Error("TARGET_IS_ZERO");if(n.eq(0))return n;if(i.eq(0))return n.multipliedBy(r).gt(t)?t:n.multipliedBy(r);if(i.eq(1)){const i=r.multipliedBy(n).multipliedBy(t).div(e.multipliedBy(e));return t.multipliedBy(i).div(i.plus(1))}const s=i.multipliedBy(e).div(t).multipliedBy(e).plus(r.multipliedBy(n));let o,a=new I(1).minus(i).multipliedBy(t);a.gte(s)?(a=a.minus(s),o=!1):(a=s.minus(a),o=!0);let l=new I(4).multipliedBy(new I(1).minus(i)).multipliedBy(i).multipliedBy(e).multipliedBy(e);l=a.multipliedBy(a).plus(l).sqrt();const c=new I(2).multipliedBy(new I(1).minus(i));let u;return u=o?l.minus(a):a.plus(l),t.minus(u.div(c))},Qa=(e,t,n,r)=>{if(e.eq(0))return new I(0);if(r.eq(0))return e.plus(n.multipliedBy(t));const i=r.multipliedBy(4).multipliedBy(n).multipliedBy(t).div(e).plus(1).sqrt().minus(1).div(r.multipliedBy(2)).plus(1);return e.multipliedBy(i)};class Ya{constructor(e){this.B=e.B,this.Q=e.Q,this.B0=e.B0,this.Q0=e.Q0,this.RStatus=e.R,this.OraclePrice=e.i,this.k=e.K,this.mtFeeRate=e.mtFeeRate,this.lpFeeRate=e.lpFeeRate}}function Ga(e,t){let n=new I(e.toString());return t&&(n=n.div(new I(10**t))),n.dp(t)}const Xa={DVM:Ws.dvmPoolABI,DSP:Ws.dvmPoolABI,GSP:Ws.dvmPoolABI,LPTOKEN:Ws.dvmPoolABI,CLASSICAL:Ws.classicalPoolABI,V3CLASSICAL:Ws.classicalPoolABI,DPP:Ws.dppPoolABI};function $a({poolAddress:e,type:t,typeMethodObject:n,params:r=[]}){const i=n[t];if(!i)return null;const s=Xa[t];return s?{abiName:s,contractAddress:e,method:i,params:r}:null}class Ka{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequestsConfig)throw new Error("PoolApi does not initialize the contractRequests");this.contractRequests=new io(e.contractRequestsConfig)}}getTotalBaseLpQuery(e,t,n,r){return{queryKey:[ro,"pool","getTotalBaseLpQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t||!n||void 0===r)return null;if("AMMV2"===n){const n=yield y(e,t);return new I(x(n,r))}const i=$a({poolAddress:t,type:n,typeMethodObject:{DVM:"totalSupply",DSP:"totalSupply",GSP:"totalSupply",LPTOKEN:"totalSupply",CLASSICAL:"getTotalBaseCapital",V3CLASSICAL:"getTotalBaseCapital",DPP:null}});if(!i)return null;const s=yield this.contractRequests.batchCallQuery(e,i);return qa(s,r)}))}}getTotalQuoteLpQuery(e,t,n,r){return{queryKey:[ro,"pool","getTotalQuoteLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t||!n||void 0===r)return null;const i=$a({poolAddress:t,type:n,typeMethodObject:{DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getTotalQuoteCapital",V3CLASSICAL:"getTotalQuoteCapital",DPP:null}});if(!i)return null;const s=yield this.contractRequests.batchCallQuery(e,i);return qa(s,r)}))}}getUserBaseLpQuery(e,t,n,r,i){return{queryKey:[ro,"pool","getUserBaseLp",...arguments],enabled:!!(e&&t&&n&&void 0!==r&&i),queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==r&&i))return null;if("AMMV2"===n){const n=yield A(e,t,i);return new I(x(n,r))}const s=$a({poolAddress:t,type:n,typeMethodObject:{DVM:"balanceOf",DSP:"balanceOf",GSP:"balanceOf",LPTOKEN:"balanceOf",CLASSICAL:"getBaseCapitalBalanceOf",V3CLASSICAL:"getBaseCapitalBalanceOf",DPP:null},params:[i]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return qa(o,r)}))}}getUserQuoteLpQuery(e,t,n,r,i){return{queryKey:[ro,"pool","getUserQuoteLp",...arguments],enabled:!!(e&&t&&n&&void 0!==r&&i),queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==r&&i))return null;const s=$a({poolAddress:t,type:n,typeMethodObject:{DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getQuoteCapitalBalanceOf",V3CLASSICAL:"getQuoteCapitalBalanceOf",DPP:null},params:[i]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return qa(o,r)}))}}getReserveLpQuery(e,t,n,r,i){return"CLASSICAL"===n?this.getPMMStateQuery(e,t,n,r,i):{queryKey:[ro,"pool","getReserveLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==r&&void 0!==i))return null;if("AMMV2"===n){const n=yield E(e,t);return{baseReserve:qa(n._reserve0.toString(),r),quoteReserve:qa(n._reserve1.toString(),i)}}const s=$a({poolAddress:t,type:n,typeMethodObject:{DVM:"getVaultReserve",DSP:"getVaultReserve",GSP:"getVaultReserve",LPTOKEN:"getVaultReserve",CLASSICAL:null,V3CLASSICAL:null,DPP:"getVaultReserve"},params:[]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return{baseReserve:qa(o.baseReserve,r),quoteReserve:qa(o.quoteReserve,i)}}))}}getClassicalTargetQuery(e,t,n,r,i){return{queryKey:[ro,"pool","getClassicalTargetQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==r&&void 0!==i&&["CLASSICAL","V3CLASSICAL"].includes(n)))return null;const s=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.classicalPoolABI,contractAddress:t,method:"getExpectedTarget",params:[]});return{baseTarget:qa(s.baseTarget,r),quoteTarget:qa(s.quoteTarget,i)}}))}}getTotalBaseMiningLpQuery(e,t,n,r,i){const s=!!n&&Ka.utils.getIsV3Mining(n);return{queryKey:[ro,"pool","getTotalBaseMiningLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==i&&(s||!!r),queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==i&&(s||r)))return null;let o;const a={DVM:"balanceOf",DSP:"totalSupply",GSP:"totalSupply",LPTOKEN:"totalSupply",CLASSICAL:"balanceOf",V3CLASSICAL:"totalSupply",DPP:null}[n];if(!a)return null;if(s)o={abiName:Ws.v3MiningABI,contractAddress:t,method:a,params:[]};else{if(!r)return null;o={abiName:Ws.dodoMiningABI,contractAddress:r,method:a,params:[t]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return qa(l,i)}))}}getTotalQuoteMiningLpQuery(e,t,n,r,i){const s=!!n&&Ka.utils.getIsV3Mining(n);return{queryKey:[ro,"pool","getTotalQuoteMiningLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==i&&(s||!!r),queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t||!n||void 0===i)return null;let o;const a={DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"balanceOf",V3CLASSICAL:"totalSupply",DPP:null}[n];if(!a)return null;if(s)o={abiName:Ws.v3MiningABI,contractAddress:t,method:a,params:[]};else{if(!r)return null;o={abiName:Ws.dodoMiningABI,contractAddress:r,method:a,params:[t]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return qa(l,i)}))}}getUserBaseMiningLpQuery(e,t,n,r,i,s){const o=!!n&&Ka.utils.getIsV3Mining(n);return{queryKey:[ro,"pool","getUserBaseMiningLp",...arguments],enabled:!!e&&!!s&&!!t&&!!n&&void 0!==i&&(o||!!r),queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&s&&t&&n&&void 0!==i))return null;let o;const a={DVM:"getUserLpBalance",DSP:"balanceOf",GSP:"balanceOf",LPTOKEN:"balanceOf",CLASSICAL:"getUserLpBalance",V3CLASSICAL:"balanceOf",DPP:null}[n];if(!a)return null;if(Ka.utils.getIsV3Mining(n))o={abiName:Ws.v3MiningABI,contractAddress:t,method:a,params:[s]};else{if(!r)return null;o={abiName:Ws.dodoMiningABI,contractAddress:t,method:a,params:[r,s]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return qa(l,i)}))}}getUserQuoteMiningLpQuery(e,t,n,r,i,s){const o=!!n&&Ka.utils.getIsV3Mining(n);return{queryKey:[ro,"pool","getUserQuoteMiningLp",...arguments],enabled:!!e&&!!s&&!!t&&!!n&&void 0!==i&&(o||!!r),queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&s&&t&&n&&void 0!==i))return null;let o;const a={DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getUserLpBalance",V3CLASSICAL:"balanceOf",DPP:null}[n];if(!a)return null;if(Ka.utils.getIsV3Mining(n))o={abiName:Ws.v3MiningABI,contractAddress:t,method:a,params:[s]};else{if(!r)return null;o={abiName:Ws.dodoMiningABI,contractAddress:t,method:a,params:[r,s]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return qa(l,i)}))}}getLPFeeRateQuery(e,t,n){return{queryKey:[ro,"pool","getLpFeeRateQuery",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t||!n)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.dvmPoolABI,contractAddress:t,method:"_LP_FEE_RATE_",params:[]});return new I(r.toString()).div(10**18)}))}}getFeeRateQuery(e,t,n,r){return{queryKey:[ro,"pool","getFeeRateQuery",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>V(this,void 0,void 0,(function*(){var i;if(!e||!t||!n)return null;let s=new I(0),o=new I(0);if("CLASSICAL"===n){const{ROUTE_V1_DATA_FETCH:n}=q[e],r=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.DODOV1PmmHelperABI,contractAddress:n,method:"getPairDetail",params:[t]}),a=null===(i=null==r?void 0:r.res)||void 0===i?void 0:i[0];s=new I(a.lpFeeRate.toString()).div(10**18),o=new I(a.mtFeeRate.toString()).div(10**18)}else if("AMMV2"===n)if(b(e)&&v(e)){const n=yield w(e,t),r=qa(n.toString(),4);s=r.times(.8),o=r.times(.2)}else s=new I(.003),o=new I(0);else{const n=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.dvmPoolABI,contractAddress:t,method:"getUserFeeRate",params:[null!=r?r:t]});s=new I(n.lpFeeRate.toString()).div(10**18),o=new I(n.mtFeeRate.toString()).div(10**18)}return{lpFeeRate:s,mtFeeRate:o}}))}}getPMMStateQuery(e,t,n,r,i){return{queryKey:[ro,"pool","getPMMStateQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>V(this,void 0,void 0,(function*(){var s;if(!e||!t||!n||void 0===r||void 0===i)return null;if("AMMV2"===n||"AMMV3"===n)return null;let o=null,a=null;if("CLASSICAL"===n){const{ROUTE_V1_DATA_FETCH:n}=q[e],r=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.DODOV1PmmHelperABI,contractAddress:n,method:"getPairDetail",params:[t]});o=null===(s=null==r?void 0:r.res)||void 0===s?void 0:s[0]}else{if(!["DVM","DPP","LPTOKEN","DSP","GSP"].includes(n))throw new Error(`type: ${n} not supported`);o=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.dvmPoolABI,contractAddress:t,method:"getPMMStateForCall",params:[]}),a=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.dvmPoolABI,contractAddress:t,method:"totalSupply",params:[]})}if(!Array.isArray(o)||!o.length)throw new Error("queryResult is not valid.");const l=function(e,t,n){const r=Ga(e.i,18-t+n),i=Ga(e.K,18),s=Ga(e.B,t),o=Ga(e.Q,n),a=Ga(e.B0,t),l=Ga(e.Q0,n),c=parseInt(e.R.toString());let u,d;return e.lpFeeRate&&(u=Ga(e.lpFeeRate,18)),e.mtFeeRate&&(d=Ga(e.mtFeeRate,18)),{q:o,b:s,k:i,i:r,b0:a,q0:l,R:c,lpFeeRate:u,mtFeeRate:d}}(o,r,i);let c,u;if(Array.isArray(a)&&(c=new I(a[0].toString())),l.q.isEqualTo(0)&&2===l.R||l.b.isEqualTo(0)&&(1===l.R||0===l.R));else{const e=new Va,t=new Ya({Q:l.q,B:l.b,K:l.k,i:l.i,B0:l.b0,Q0:l.q0,R:l.R,mtFeeRate:new I(0),lpFeeRate:new I(0)});u=e.GetMidPrice(t),u.isNaN()&&(u=void 0)}return{midPrice:u,pmmParamsBG:l,baseReserve:l.b,quoteReserve:l.q,totalSupplyBG:c}}))}}getDPPOwnerProxyAddressQuery(e,t){return{queryKey:[...arguments],enabled:!!e&&!!t,queryFn:()=>e&&t?this.contractRequests.batchCallQuery(e,{abiName:Ws.IdodoV2,contractAddress:t,method:"_OWNER_",params:[]}):null}}getWithdrawBasePenaltyQuery(e,t,n,r){return{queryKey:[...arguments],enabled:!!(e&&t&&n&&r),queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&r))return null;const i=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.dodoPair,contractAddress:t,method:"getWithdrawBasePenalty",params:[n]});return qa(i,r)}))}}}Ka.graphql=Ua,Ka.utils=Na,Ka.encode={createDSPPoolABI(e,t,n,r,i,s,o,a,l){return V(this,arguments,void 0,(function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_DSP_PROXY:u}=q[e];return{to:u,data:yield eo(Ws.dodoDspProxy,"createDODOStablePair",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),Se(new I(o).toString(),18-t.decimals+n.decimals).toString(),Se(new I(a).toString(),18).toString(),c,l])}}))},createGSPPoolABI(e,t,n,r,i,s,o,a,l,c){return V(this,void 0,void 0,(function*(){const{DODO_DSP_PROXY:u}=q[e];return{to:u,data:yield eo(Ws.dodoDspProxy,"createDODOGasSavingPair",[t,n.address,r.address,i,s,new I(o).div(1e4).multipliedBy(10**18).toString(),"0",Se(new I(a).toString(),18-n.decimals+r.decimals).toString(),Se(new I(l).toString(),18).toString(),"1000",c])}}))},createDVMPoolABI(e,t,n,r,i,s,o,a,l){return V(this,arguments,void 0,(function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_PROXY:u}=q[e];return{to:u,data:yield eo(Ws.dodoProxyV2,"createDODOVendingMachine",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),Se(new I(o).toString(),18-t.decimals+n.decimals).toString(),Se(new I(a).toString(),18).toString(),c,l])}}))},createDPPPoolABI(e,t,n,r,i,s,o,a,l){return V(this,arguments,void 0,(function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_DPP_PROXY:u}=q[e];return{to:u,data:yield eo(Ws.dodoDppProxy,"createDODOPrivatePool",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),Se(new I(o).toString(),18-t.decimals+n.decimals).toString(),Se(new I(a).toString(),18).toString(),c,l])}}))},removeDPPPoolABI(e,t,n,r,i,s,o,a,l,c){return V(this,void 0,void 0,(function*(){const u=new I(t).div(1e4).multipliedBy(10**18).toString(),d=Se(new I(n).toString(),18-l+c).toString(),h=Se(new I(r).toString(),18).toString(),f=yield eo(Ws.dodoDPPAdmin,"reset",["0x0000000000000000000000000000000000000000",u,d,h,i,s,o,a]);return{to:e,data:f}}))},resetDPPPoolABI(e,t,n,r,i,s,o,a,l,c,u,d,h,f,p){return V(this,void 0,void 0,(function*(){const{DODO_DPP_PROXY:m}=q[e],g=new I(n).div(1e4).multipliedBy(10**18).toString(),y=Se(new I(r).toString(),18-h+f).toString(),A=Se(new I(i).toString(),18).toString();return{to:m,data:yield eo(Ws.dodoDppProxy,"resetDODOPrivatePool",[t,[g,y,A],[s,o,a,l],d,c,u,p])}}))},addDSPLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,(function*(){if(!i||"0"===i)throw new Error("Invalid baseMinAmount");const{DODO_DSP_PROXY:l}=q[e];return{to:l,data:yield eo(Ws.dodoDspProxy,"addDSPLiquidity",[t,n,r,i,s,o,a])}}))},addDVMLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,(function*(){if(!i||"0"===i)throw new Error("Invalid baseMinAmount");const{DODO_PROXY:l}=q[e];return{to:l,data:yield eo(Ws.dodoProxyV2,"addDVMLiquidity",[t,n,r,i,s,o,a])}}))},removeDSPLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,(function*(){if(28!=e&&69!=e){const{CALLEE_HELPER:t}=q[e];o&&(n=t)}const l=yield eo(Ws.dodoDSP,"sellShares",[r,n,i,s,o?"0x00":"0x",a]);return{to:t,data:l}}))},removeDVMLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,(function*(){if(28!=e&&69!=e){const{CALLEE_HELPER:t}=q[e];o&&(n=t)}const l=yield eo(Ws.dodoDVM,"sellShares",[r,n,i,s,o?"0x00":"0x",a]);return{to:t,data:l}}))},addClassicalLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,(function*(){const{DODO_PROXY:l}=q[e];return{to:l,data:yield eo(Ws.dodoProxyV2,"addLiquidityToV1",[t,n,r,i,s,o,a])}}))},removeClassicalBaseABI(e,t,n,r){return V(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:i}=q[e];let s="",o="";return i?(o=i,s=yield eo(Ws.dodoV1PairProxy,"withdrawBase",[t,n,r])):(o=t,s=yield eo(Ws.dodoPair,"withdrawBase",[n])),{to:o,data:s}}))},removeMaxClassicalBaseABI(e,t,n){return V(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:r}=q[e];let i="",s="";return r?(s=r,i=yield eo(Ws.dodoV1PairProxy,"withdrawAllBase",[t,n])):(s=t,i=yield eo(Ws.dodoPair,"withdrawAllBase",[])),{to:s,data:i}}))},removeClassicalQuoteABI(e,t,n,r){return V(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:i}=q[e];let s="",o="";return i?(o=i,s=yield eo(Ws.dodoV1PairProxy,"withdrawQuote",[t,n,r])):(o=t,s=yield eo(Ws.dodoPair,"withdrawQuote",[n])),{to:o,data:s}}))},removeMaxClassicalQuoteABI(e,t,n){return V(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:r}=q[e];let i="",s="";return r?(s=r,i=yield eo(Ws.dodoV1PairProxy,"withdrawAllQuote",[t,n])):(s=t,i=yield eo(Ws.dodoPair,"withdrawAllQuote",[])),{to:s,data:i}}))}};const za=(e,t,n,r,i)=>{const s=r.multipliedBy(t.minus(n)),o=e.multipliedBy(e).div(t).div(n).multipliedBy(i);return s.multipliedBy(new C(1).minus(i).plus(o))},Ja=(e,t,n,r,i)=>{let s=new C(1).minus(i).multipliedBy(t);s=s.minus(i.multipliedBy(e).multipliedBy(e).div(t)),s=s.plus(n.multipliedBy(r));let o=new C(4).multipliedBy(new C(1).minus(i)).multipliedBy(i).multipliedBy(e).multipliedBy(e);o=s.multipliedBy(s).plus(o).sqrt();const a=new C(2).multipliedBy(new C(1).minus(i));return s.plus(o).div(a)},Wa=(e,t,n)=>{let r=new C(4).multipliedBy(t).multipliedBy(n).div(e);r=new C(1).plus(r).sqrt();const i=r.minus(new C(1)).div(t.multipliedBy(new C(2)));return e.multipliedBy(new C(1).plus(i))};C.config({EXPONENTIAL_AT:1e3,DECIMAL_PLACES:80});class Za{getMidPrice(){if(0===this.RStatus)return this.i;const e=this.getExpectedTarget();if(1===this.RStatus){let t=e.base.div(this.B);return t=t.multipliedBy(t).multipliedBy(this.k).minus(this.k).plus(new C(1)),this.i.multipliedBy(t)}if(2===this.RStatus){let t=e.quote.div(this.Q);return t=t.multipliedBy(t).multipliedBy(this.k).minus(this.k).plus(new C(1)),this.i.div(t)}return this.i}getQuoteByMidPrice(e){if(1!==this.RStatus)throw new Error("No support is needed at the moment");const t=e.div(this.k.times(this.i)).plus(1).minus(new C(1).div(this.k)).times(this.B).times(this.B).sqrt();return this.i.times(this.k.div(this.B).times(t).times(t).plus(new C(1).minus(this.k.times(2)).times(t)).minus(new C(1).minus(this.k).times(this.B)))}getExpectedTarget(){let e,t;return e=this.B0,t=this.Q0,0===this.RStatus&&(e=this.B0,t=this.Q0),1===this.RStatus&&(t=this.Q0,e=Wa(this.B,this.k,this.Q.minus(this.Q0).div(this.i))),2===this.RStatus&&(e=this.B0,t=Wa(this.Q,this.k,this.B.minus(this.B0).multipliedBy(this.i))),{base:e,quote:t}}queryBuyBase(e){const t=e.multipliedBy(this.mtFeeRate),n=e.multipliedBy(this.lpFeeRate);e=e.plus(t).plus(n);const r=this.getExpectedTarget();let i=new C(0);if(0===this.RStatus)i=this.ROneBuyBase(e,r.base);else if(1===this.RStatus)i=this.RAboveBuyBase(e,r.base);else{const t=this.B.minus(r.base),n=r.quote.minus(this.Q);i=e.isLessThanOrEqualTo(t)?this.RBelowBuyBase(e,r.quote):n.plus(this.ROneBuyBase(e.minus(t),r.base))}return i}querySellBase(e){let t;const n=this.getExpectedTarget();if(0===this.RStatus)t=this.ROneSellBase(e,n.quote);else if(2===this.RStatus)t=this.RBelowSellBase(e,n.quote);else{const r=n.base.minus(this.B),i=this.Q.minus(n.quote);t=e.isLessThanOrEqualTo(r)?this.RAboveSellBase(e,n.base):i.plus(this.ROneSellBase(e.minus(r),n.quote))}const r=t.multipliedBy(this.mtFeeRate),i=t.multipliedBy(this.lpFeeRate);return t.minus(r).minus(i)}queryBuyQuote(e){const t=e.multipliedBy(this.mtFeeRate),n=e.multipliedBy(this.lpFeeRate);e=e.plus(t).plus(n);const r=this.getExpectedTarget();if(0===this.RStatus)return this.ROneBuyQuote(e,r.quote);if(2===this.RStatus)return this.RBelowBuyQuote(e,r.quote);const i=r.base.minus(this.B),s=this.Q.minus(r.quote);return e.isLessThanOrEqualTo(s)?this.RAboveBuyQuote(e,r.base):i.plus(this.ROneBuyQuote(e.minus(s),r.quote))}querySellQuote(e){let t;const n=this.getExpectedTarget();if(0===this.RStatus)t=this.ROneSellQuote(e,n.base);else if(1===this.RStatus)t=this.RAboveSellQuote(e,n.base);else{const r=this.B.minus(n.base),i=n.quote.minus(this.Q);t=e.isLessThanOrEqualTo(i)?this.RBelowSellQuote(e,n.quote):r.plus(this.ROneSellQuote(e.minus(i),n.base))}const r=t.multipliedBy(this.mtFeeRate),i=t.multipliedBy(this.lpFeeRate);return t.minus(r).minus(i)}getPriceDepth(e){const t=this.getExpectedTarget();let n,r;if(e.gt(this.i)){const i=e.div(this.i);n=t.base.div(i.minus(1).plus(this.k).div(this.k).sqrt()),r=this.ROneBuyBase(t.base.minus(n),t.base).plus(t.quote)}else{const i=this.i.div(e);r=t.quote.div(i.minus(1).plus(this.k).div(this.k).sqrt()),n=this.ROneBuyQuote(t.quote.minus(r),t.quote).plus(t.base)}return{baseAmount:this.B.minus(n).abs(),quoteAmount:this.Q.minus(r).abs(),isBuy:this.B.gt(n)}}getWithdrawBasePenalty(e){if(1===this.RStatus){const t=Wa(this.B,this.k,this.Q.minus(this.Q0).div(this.i)),n=Wa(this.B.minus(e),this.k,this.Q.minus(this.Q0).div(this.i));return t.minus(n).minus(e)}return new C(0)}getWithdrawQuotePenalty(e){if(2===this.RStatus){const t=Wa(this.Q,this.k,this.B.minus(this.B0).multipliedBy(this.i)),n=Wa(this.Q.minus(e),this.k,this.B.minus(this.B0).multipliedBy(this.i));return t.minus(n).minus(e)}return new C(0)}ROneBuyBase(e,t){return e.isGreaterThanOrEqualTo(t),za(t,t,t.minus(e),this.i,this.k)}ROneBuyQuote(e,t){return e.isGreaterThanOrEqualTo(t),za(t,t,t.minus(e),new C(1).div(this.i),this.k)}ROneSellBase(e,t){const n=Ja(t,t,this.i,e.negated(),this.k);return t.minus(n)}ROneSellQuote(e,t){const n=Ja(t,t,new C(1).div(this.i),e.negated(),this.k);return t.minus(n)}RAboveBuyBase(e,t){if(e.isGreaterThanOrEqualTo(this.B))throw new Error("RAbove Buy Base Amount Exceed Limitation");return za(t,this.B,this.B.minus(e),this.i,this.k)}RAboveSellBase(e,t){if(e.plus(this.B).isGreaterThan(t))throw new Error("RAbove Sell Base Amount Exceed Limitation");return za(t,this.B.plus(e),this.B,this.i,this.k)}RAboveBuyQuote(e,t){return Ja(t,this.B,new C(1).div(this.i),e,this.k).minus(this.B)}RAboveSellQuote(e,t){const n=Ja(t,this.B,new C(1).div(this.i),e.negated(),this.k);return this.B.minus(n)}RBelowBuyQuote(e,t){if(e.isGreaterThanOrEqualTo(this.Q))throw new Error("RBelow Buy Quote Amount Exceed Limitation");return za(t,this.Q,this.Q.minus(e),new C(1).div(this.i),this.k)}RBelowSellQuote(e,t){if(e.plus(this.Q).isGreaterThan(t))throw new Error("RBelow Sell Quote Amount Exceed Limitation");return za(t,this.Q.plus(e),this.Q,new C(1).div(this.i),this.k)}RBelowBuyBase(e,t){return Ja(t,this.Q,this.i,e,this.k).minus(this.Q)}RBelowSellBase(e,t){const n=Ja(t,this.Q,this.i,e.negated(),this.k);return this.Q.minus(n)}}function el({q:e,b:t,k:n,i:r,q0:i,b0:s,R:o}){const a=new Za;return a.B0=new I(s),a.Q0=new I(i),a.B=new I(t),a.Q=new I(e),a.i=new I(r),a.k=new I(n),a.RStatus=o,a.mtFeeRate=new I(0),a.lpFeeRate=new I(0),a}function tl(e){return e&&/^#[a-f\d]{3,6}\s*[0-9]{1,3}%/i.test(e)?(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})\s*([0-9]{1,3})*%?$/i.exec(e),(t=n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:n[4]?Number(n[4])/100:1}:void 0)?`rgba(${t.r}, ${t.g}, ${t.b}, ${t.a})`:t):e;var t,n}var nl;!function(e){e.All="all"}(nl||(nl={}));class rl{constructor(e){this.restApiRequest=(null==e?void 0:e.restApiRequest)||new ka}getWidgetTokenListConfig(e,t){return this.restApiRequest.getJson("/config-center/user/tokenlist/v2",{project:e,apikey:t})}convertConfigToSwapWidgetProps(e){var t,n,r,i,s,o,a,l;const c=[];let u,d=!0,h=!0;if(e.chains.forEach((e=>{e.fromTokens&&(d=!1),e.toTokens&&(h=!1)})),e.chains.forEach((({chainId:e,fromTokens:t,toTokens:n,tokens:r})=>{if(null==r?void 0:r.length){const i=Number(e);[{isAllChain:d,selectTokens:t,side:"from"},{isAllChain:h,selectTokens:n,side:"to"}].forEach((({isAllChain:e,selectTokens:t,side:n})=>{(e||t)&&((null==t?void 0:t.length)?r.forEach((e=>{var r;t.some((t=>t.toLocaleLowerCase()===e.address.toLocaleLowerCase()))&&c.push(Object.assign(Object.assign({logoURI:e.logoImg},e),{chainId:null!==(r=e.chainId)&&void 0!==r?r:i,side:n}))})):r.forEach((e=>{var t;c.push(Object.assign(Object.assign({logoURI:e.logoImg},e),{chainId:null!==(t=e.chainId)&&void 0!==t?t:i,side:n}))})))}))}})),(null==e?void 0:e.style)&&Object.keys(e.style).length){const n=null===(t=null==e?void 0:e.basis)||void 0===t?void 0:t.fontSizeModify;u={palette:{mode:"light",primary:{main:tl(e.style.primary)},secondary:{main:tl(e.style.secondary),contrastText:tl(e.style.secondaryContrast)},error:{main:tl(e.style.error),contrastText:tl(e.style.errorContrast)},warning:{main:tl(e.style.warning)},success:{main:tl(e.style.success)},background:{paper:tl(e.style.background1),paperContrast:tl(e.style.background2),backdrop:tl(e.style.mask),input:tl(e.style.input),tag:tl(e.style.card)},text:{primary:tl(e.style.text1),secondary:tl(e.style.text2),disabled:tl(e.style.textDisable),placeholder:tl(e.style.textPlaceholder)},border:{main:tl(e.style.borderSolid),light:tl(e.style.borderDash),disabled:tl(e.style.borderSolid)}},typography:n?{fontSize:16+n,ht:{fontSize:36+n},h2:{fontSize:32+n},h3:{fontSize:28+n},caption:{fontSize:20+n},h5:{fontSize:18+n},body1:{fontSize:16+n},body2:{fontSize:14+n},h6:{fontSize:12+n},button:{fontSize:16+n}}:void 0}}const f=e.rebateAddress,p=e.rebateRatio,m=e.swapSlippage,g=e.crossChainSlippage,y=null===(n=e.basis)||void 0===n?void 0:n.width,A=null===(r=e.basis)||void 0===r?void 0:r.height,E=null===(i=e.basis)||void 0===i?void 0:i.locale,b=null===(o=null===(s=e.basis)||void 0===s?void 0:s.crossChainSupport)||void 0===o||o,v=null===(a=e.basis)||void 0===a?void 0:a.rpcMap,w=null===(l=e.basis)||void 0===l?void 0:l.noPowerBy;return{tokenList:c,theme:u,rebateAddress:f,rebateRatio:p,swapSlippage:m,bridgeSlippage:g,width:y,height:A,locale:E,crossChain:b,jsonRpcUrlMap:v,noPowerBy:w}}getConfigSwapWidgetProps(e,t){return V(this,void 0,void 0,(function*(){var n;const{result:r}=yield this.getWidgetTokenListConfig(e,t),i=r.data;if(!i)throw new Error(null!==(n=r.msg)&&void 0!==n?n:"Error");return{swapWidgetProps:this.convertConfigToSwapWidgetProps(i),configTokenList:i}}))}}const il={fetchMiningList:La("\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n "),fetchMiningListV1:La("\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n "),fetchMyCreatedMiningList:La("\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ")};var sl;!function(e){e[e.upcoming=0]="upcoming",e[e.active=1]="active",e[e.ended=2]="ended"}(sl||(sl={}));const ol={getMiningStatusByTimestamp:({startTime:e,endTime:t,rewardTokenInfoList:n})=>{let r,i;for(const s of n){const n=s.startTime||e,o=s.endTime||t;n&&(r=r?I.min(n,r):I.isBigNumber(n)?n:new I(n)),o&&(i=i?I.max(o,i):I.isBigNumber(o)?o:new I(o))}const s=new I(Math.floor(Date.now()/1e3));let o=sl.ended;return r&&s.lt(r)&&(o=sl.upcoming),r&&i&&s.gte(r)&&s.lte(i)&&(o=sl.active),{status:o,firstStartTime:r,lastEndTime:i,currentTime:s}}},al=[{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimAllRewards",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"isLpToken",type:"bool"},{internalType:"uint256",name:"platform",type:"uint256"},{internalType:"address[]",name:"rewardTokens",type:"address[]"},{internalType:"uint256[]",name:"rewardPerBlock",type:"uint256[]"},{internalType:"uint256[]",name:"startBlock",type:"uint256[]"},{internalType:"uint256[]",name:"endBlock",type:"uint256[]"}],name:"createDODOMineV3",outputs:[{internalType:"address",name:"newMineV3",type:"address"}],stateMutability:"nonpayable",type:"function"}],ll=[{inputs:[{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"isLpToken",type:"bool"},{internalType:"address[]",name:"rewardTokens",type:"address[]"},{internalType:"uint256[]",name:"rewardPerBlock",type:"uint256[]"},{internalType:"uint256[]",name:"startBlock",type:"uint256[]"},{internalType:"uint256[]",name:"endBlock",type:"uint256[]"}],name:"createDODOMineV3",outputs:[{internalType:"address",name:"newMineV3",type:"address"}],stateMutability:"nonpayable",type:"function"}];class cl{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("MiningApi does not initialize the contractRequests");this.contractRequests=new io(e.contractRequestsConfig)}}getPendingRewardQuery(e,t,n,r,i,s){return{queryKey:[ro,"mining","getPendingRewardQuery",...arguments],enabled:!!(e&&t&&n&&r&&void 0!==i),queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&r&&void 0!==i))return null;let o;if("3"===s)o=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.v3MiningABI,contractAddress:t,method:"getPendingRewardByToken",params:[n,r]});else o=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.dodoMiningABI,contractAddress:t,method:"getPendingReward",params:[r,n]});return qa(o,i)}))}}getLpStakedBalance(e,t,n,r,i,s){return{queryKey:[ro,"mining","getLpStakedBalance",...arguments],enabled:!(!e||!t||!n||void 0===i||"3"!==s&&!r),queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==i)||"3"!==s&&!r)return null;let o;if("3"===s)o=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.v3MiningABI,contractAddress:t,method:"balanceOf",params:[n]});else o=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.dodoMiningABI,contractAddress:t,method:"getUserLpBalance",params:[n,r]});return qa(o,i)}))}}getRewardTokenInfos(e,t,n,r){return{queryKey:[ro,"mining","getRewardTokenInfos",...arguments],enabled:null!=e&&null!=t&&null!=n&&!r,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.v3MiningABI,contractAddress:t,method:"rewardTokenInfos",params:[n]});if(!r)return null;const{rewardVault:i,rewardPerBlock:s,workThroughReward:o,lastFlagBlock:a,startBlock:l,endBlock:c}=r;return{rewardVault:i,rewardPerBlock:qa(s,0),workThroughReward:o?qa(o,0):void 0,lastFlagBlock:a?qa(a,0):void 0,startBlock:qa(l,0),endBlock:qa(c,0)}}))}}}cl.utils=ol,cl.graphql=il,cl.encode={depositMining(e,t,n){return V(this,void 0,void 0,(function*(){const r=to(al,"deposit",[Se(t.dp(n,I.ROUND_FLOOR).toString(),n).toString()]);return{to:e,data:r}}))},withdrawMining(e,t,n){return V(this,void 0,void 0,(function*(){const r=to(al,"withdraw",[Se(t.dp(n,I.ROUND_FLOOR).toString(),n).toString()]);return{to:e,data:r}}))},claimAllMining(e){return V(this,void 0,void 0,(function*(){const t=to(al,"claimAllRewards",[]);return{to:e,data:t}}))},createDODOMineV3(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,(function*(){const{DODO_MINEV3_PROXY:l}=q[e];if(!l)return null;let c;return c=[1,10,288,66,128,137,1285,42161,1313161554,43114].includes(e)?to(ll,"createDODOMineV3",[t,n,i,s,o,a]):to(al,"createDODOMineV3",[t,n,r,i,s,o,a]),{to:l,data:c}}))}};const ul={fetchErc20SwapCrossList:La("\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n }\n "),fetchErc20ForecastSlippage:La("\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n }\n ")},dl=new I(2).pow(256).minus(1);function hl(e){return e?e.replaceAll("\0",""):e}class fl{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("TokenApi does not initialize the contractRequests");this.contractRequests=new io(e.contractRequestsConfig)}this.restApiRequest=(null==e?void 0:e.restApiRequest)||new ka}getTokenDecimals(e,t){return{queryKey:["token","getTokenDecimals",null!=e?e:"",null==t?void 0:t.toLocaleLowerCase()],enabled:!!e&&!!t,queryFn:()=>V(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Ws.erc20ABI,contractAddress:t,method:"decimals",params:[]})}))}}getFiatPriceBatch(e,t){return this.restApiRequest.postJson("/frontend-v2-price-api/current/batch",{networks:e.map((e=>U[e.chainId])),addresses:e.map((e=>e.address)),symbols:e.map((e=>e.symbol)),isCache:!0},void 0,{headers:{"pass-key":t}})}getFetchTokenQuery(e,t,n,r){let i=r,s="";if(void 0!==e){const t=q[e];i||(i=null==t?void 0:t.DODO_APPROVE),s=null==t?void 0:t.ERC20_HELPER}return{queryKey:[ro,"token","getFetchTokenQuery",null!=e?e:"",null==n?void 0:n.toLocaleLowerCase(),null==i?void 0:i.toLocaleLowerCase(),null==t?void 0:t.toLocaleLowerCase()],enabled:!!e&&!!t&&!!n,queryFn:()=>V(this,void 0,void 0,(function*(){if(!(e&&t&&n&&i))return null;const o=yield(e=>V(void 0,void 0,void 0,(function*(){let t=[];if(!t.length)switch(e){case S.MAINNET:t=(yield import("./eth-B9cviUl5.js")).default;break;case S.BSC:t=(yield import("./bsc-3D5wcqPq.js")).default}return t})))(e);if(o.includes(t))return null;const a=M[e];if(fl.utils.isSameAddress(t,a.address)){const t=yield this.contractRequests.getETHBalance(e,n);return{symbol:a.symbol,address:a.address,name:a.name,decimals:a.decimals,balance:t,allowance:dl,account:n,spender:r,chainId:e}}const l=yield this.contractRequests.batchCallQuery(e,{abiName:Ws.erc20Helper,contractAddress:s,method:"isERC20",params:[t,n,i]}),{name:c,isOk:u}=l;if(u&&c){const n=parseInt(l.decimals,10),i=new I(10).pow(n),s=new I(l.allownance.toString()).div(i),o=new I(l.balance.toString()).div(i);return{address:t,decimals:n,symbol:hl(l.symbol),name:hl(c),balance:o,spender:r,allowance:s,chainId:e}}return null}))}}}fl.graphql=ul,fl.utils={isSameAddress:(e,t)=>{const n=e.length,r=t.length;if(0===n||0===r)return!1;if(n===r)return e.toLowerCase()===t.toLowerCase();const i=e.substring(2,n).toLowerCase(),s=t.substring(2,n).toLowerCase();return i.length>s.length?i.endsWith(s):s.endsWith(i)}},fl.encode={approveABI:(e,t)=>eo(Ws.erc20ABI,"approve",[e,t.toFixed()]),transferEncodeABI(e,t){return V(this,void 0,void 0,(function*(){return yield eo(Ws.erc20ABI,"transfer",[e,t])}))}};const pl={fetchUserSwapOrderHistories:La("\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ")};class ml{constructor(){}}ml.graphql=pl;const gl={fetchNoticeCenterTransactionList:La("\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n "),fetchLiquidityLpPartnerRewards:La("\n query FetchLiquidityLpPartnerRewards(\n $where: LiquidityLpPartnerRewardsInput\n ) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n }\n "),fetchUserprofileReward:La("\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n }\n ")};class yl{constructor(){}}yl.graphql=gl;export{Ws as ABIName,Ma as AMMV3Api,ro as CONTRACT_QUERY_KEY,S as ChainId,io as ContractRequests,Ca as GraphQLRequests,cl as MiningApi,sl as MiningStatusE,Va as PMMHelper,Za as PMMModel,Ya as PMMState,Ka as PoolApi,ka as RestApiRequests,ml as SwapApi,rl as SwapWidgetApi,yl as SystemApi,fl as TokenApi,M as basicTokenMap,q as contractConfig,L as etherTokenAddress,el as getPmmModel,U as platformIdMap,Qa as solveQuadraticFunctionForTarget};
|
|
1
|
+
import{stable as e,stableTestnet as t,pharosAtlanticTestnet as n,pharosTestnet as r,hemi as i,hashkey as s,zeroMainnet as o,xLayer as a,zircuitMainnet as l,bitlayer as c,nero as u,riseTestnet as d,morph as h,neox as f,plumeTestnet as p,plume as m,arbsepolia as g,fetchUniswapV2PairTotalSupply as y,fetchUniswapV2PairBalanceOf as A,fetchUniswapV2PairGetReserves as E,getUniswapV2Router02ContractAddressByChainId as b,getUniswapV2FactoryContractAddressByChainId as v,fetchUniswapV2PairFeeRate as w}from"@dodoex/dodo-contract-request";export{setContractRequests}from"@dodoex/dodo-contract-request";import O from"js-sha3";import D from"bn.js";import T from"hash.js";import _ from"bech32";import{chunk as P,merge as R}from"lodash";import I,{BigNumber as C}from"bignumber.js";import*as k from"cross-fetch";import B from"cross-fetch";import N from"qs";import{formatUnits as x}from"@dodoex/contract-request";var S;!function(e){e[e.MAINNET=1]="MAINNET",e[e.GOERLI=5]="GOERLI",e[e.SEPOLIA=11155111]="SEPOLIA",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.ARBITRUM_ONE=42161]="ARBITRUM_ONE",e[e.ARBITRUM_SEPOLIA=421614]="ARBITRUM_SEPOLIA",e[e.AURORA=1313161554]="AURORA",e[e.OKCHAIN=66]="OKCHAIN",e[e.OPTIMISM=10]="OPTIMISM",e[e.AVALANCHE=43114]="AVALANCHE",e[e.CONFLUX=1030]="CONFLUX",e[e.BASE=8453]="BASE",e[e.LINEA=59144]="LINEA",e[e.SCROLL=534352]="SCROLL",e[e.MANTA=169]="MANTA",e[e.MANTLE=5e3]="MANTLE",e[e.DODO_CHAIN_TESTNET=53457]="DODO_CHAIN_TESTNET",e[e.TAIKO=167e3]="TAIKO",e[e.PLUME=98866]="PLUME",e[e.PLUME_TESTNET=98864]="PLUME_TESTNET",e[e.NEOX=47763]="NEOX",e[e.MORPH=2818]="MORPH",e[e.RISE_TESTNET=11155931]="RISE_TESTNET",e[e.NEROCHAIN=1689]="NEROCHAIN",e[e.BITLAYER=200901]="BITLAYER",e[e.ZIRCUIT=48900]="ZIRCUIT",e[e.X_LAYER=196]="X_LAYER",e[e.ZERO=543210]="ZERO",e[e.HASHKEY=177]="HASHKEY",e[e.HEMI=43111]="HEMI",e[e.PHAROS_TESTNET=688688]="PHAROS_TESTNET",e[e.PHAROS_ATLANTIC_TESTNET=688689]="PHAROS_ATLANTIC_TESTNET",e[e.STABLE_TESTNET=2201]="STABLE_TESTNET",e[e.STABLE=988]="STABLE"}(S||(S={}));const L="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",F={symbol:"ETH",address:L,name:"Ether",decimals:18,showDecimals:4,wrappedTokenSymbol:"WETH"},M={[S.MAINNET]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}),[S.GOERLI]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6"}),[S.SEPOLIA]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x7B07164ecFaF0F0D85DFC062Bc205a4674c75Aa0"}),[S.OPTIMISM]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.CONFLUX]:Object.assign(Object.assign({},F),{symbol:"CFX",name:"CFX",wrappedTokenSymbol:"WCFX",wrappedTokenAddress:"0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b"}),[S.BSC]:Object.assign(Object.assign({},F),{symbol:"BNB",name:"BNB",wrappedTokenSymbol:"WBNB",wrappedTokenAddress:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}),[S.OKCHAIN]:Object.assign(Object.assign({},F),{symbol:"OKT",name:"OKT",wrappedTokenSymbol:"WOKT",wrappedTokenAddress:"0x8F8526dbfd6E38E3D8307702cA8469Bae6C56C15"}),[S.POLYGON]:Object.assign(Object.assign({},F),{symbol:"MATIC",name:"MATIC",showDecimals:6,wrappedTokenSymbol:"WMATIC",wrappedTokenAddress:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"}),[S.ARBITRUM_ONE]:Object.assign(Object.assign({},F),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"}),[S.ARBITRUM_SEPOLIA]:Object.assign(Object.assign({},F),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0xfd6fFee92D25158b29315C71b0Bb4dE727530FaF"}),[S.AURORA]:Object.assign(Object.assign({},F),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB"}),[S.AVALANCHE]:Object.assign(Object.assign({},F),{symbol:"AVAX",name:"Avalanche",showDecimals:6,wrappedTokenSymbol:"WAVAX",wrappedTokenAddress:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"}),[S.BASE]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.LINEA]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f"}),[S.SCROLL]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x5300000000000000000000000000000000000004"}),[S.MANTA]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x0Dc808adcE2099A9F62AA87D9670745AbA741746"}),[S.MANTLE]:Object.assign(Object.assign({},F),{wrappedTokenSymbol:"WMNT",wrappedTokenAddress:"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8"}),[S.DODO_CHAIN_TESTNET]:Object.assign(Object.assign({},F),{symbol:"dodo",name:"Wrapped Berd",wrappedTokenSymbol:"WBERD",wrappedTokenAddress:"0x3a64Ec3606FF7310E8fAd6FcC008e39705fB496d"}),[S.TAIKO]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xA51894664A773981C6C112C43ce576f315d5b1B6"}),[S.PLUME]:Object.assign(Object.assign({},F),{symbol:"PLUME",name:"PLUME",wrappedTokenSymbol:"WPLUME",wrappedTokenAddress:"0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1"}),[S.PLUME_TESTNET]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xaA6210015fbf0855F0D9fDA3C415c1B12776Ae74"}),[S.NEOX]:Object.assign(Object.assign({},F),{symbol:"GAS",name:"GAS",showDecimals:6,wrappedTokenSymbol:"WGAS10",wrappedTokenAddress:"0xdE41591ED1f8ED1484aC2CD8ca0876428de60EfF"}),[S.MORPH]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x5300000000000000000000000000000000000011"}),[S.RISE_TESTNET]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.NEROCHAIN]:Object.assign(Object.assign({},F),{symbol:"NERO",name:"NERO",wrappedTokenSymbol:"WNERO",wrappedTokenAddress:"0x252ba4a6efb0d91bd7108d91a067c14592a56f17"}),[S.BITLAYER]:Object.assign(Object.assign({},F),{symbol:"BTC",name:"BTC",wrappedTokenSymbol:"WBTC",wrappedTokenAddress:"0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f"}),[S.ZIRCUIT]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.X_LAYER]:Object.assign(Object.assign({},F),{symbol:"OKB",name:"OKB",wrappedTokenSymbol:"WOKB",wrappedTokenAddress:"0xe538905cf8410324e03a5a23c1c177a474d59b2b"}),[S.ZERO]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0xAc98B49576B1C892ba6BFae08fE1BB0d80Cf599c"}),[S.HASHKEY]:Object.assign(Object.assign({},F),{symbol:"HSK",name:"HSK",wrappedTokenSymbol:"WHSK",wrappedTokenAddress:"0xB210D2120d57b758EE163cFfb43e73728c471Cf1"}),[S.HEMI]:Object.assign(Object.assign({},F),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[S.PHAROS_TESTNET]:Object.assign(Object.assign({},F),{symbol:"PHRS",name:"PHRS",wrappedTokenSymbol:"WPHRS",wrappedTokenAddress:"0x3019b247381c850ab53dc0ee53bce7a07ea9155f"}),[S.PHAROS_ATLANTIC_TESTNET]:Object.assign(Object.assign({},F),{symbol:"PHRS",name:"PHRS",wrappedTokenSymbol:"WPHRS",wrappedTokenAddress:"0x838800b758277cc111b2d48ab01e5e164f8e9471"}),[S.STABLE_TESTNET]:Object.assign(Object.assign({},F),{symbol:"gUSDT",name:"gUSDT",wrappedTokenSymbol:"wgUSDT",wrappedTokenAddress:"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb"}),[S.STABLE]:{address:L,decimals:18,showDecimals:4,symbol:"gUSDT",name:"gUSDT",wrappedTokenSymbol:"USDT0",wrappedTokenAddress:"0x779Ded0c9e1022225f8E0630b35a9b54bE713736"}},q={[S.MAINNET]:{MULTI_CALL:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",DODO_APPROVE:"0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149",ERC20_HELPER:"0x4F99cba8aAEad26fc970dc6CC4ea435779Fa9016",ROUTE_V2_DATA_FETCH:"0x9337cA090c390667984869193e10c3D4f9a17da8",ROUTE_V1_DATA_FETCH:"0x6373ceB657C83C91088d328622573FB766064Ac4",CALLEE_HELPER:"0x45a7E2E9D780613E047f7e78a9d3902ff854B522",DODO_PROXY:"0xa356867fDCEa8e71AEaF87805808803806231FdC",DODO_DSP_PROXY:"0x4599ed18F34cFE06820E3684bF0aACB8D75c644d",DODO_DPP_PROXY:"0xfF7C8F518e6f1435957ed3d3E0692C94676dAE7a",DODO_V1_PAIR_PROXY:"0x8dD0Fea5FA2f7df535F87f312641Cc15d8B151BA",DODO_MINEV3_PROXY:"0x0d9685D4037580F68D9F77B08971f17E1000bBdc"},[S.GOERLI]:{MULTI_CALL:"0x696E25A5e2AEd1C55E6d6Cfa0532Bbda9020165d",DODO_APPROVE:"0xC9143e54021f4a6d33b9b89DBB9F458AaEdd56FB",ERC20_HELPER:"0x24549FC74B3076A962624A26370ed556c467F74C",ROUTE_V2_DATA_FETCH:"0x7E9c460d0A10bd0605B15F0d0388e307d34a62E6",ROUTE_V1_DATA_FETCH:"0xAC716E87b0853C0712674e8E3a8435a489F276b4",CALLEE_HELPER:"0x5B2fd46E6E3Ff1E479d651ec0b210882Aa9871dF",DODO_PROXY:"0xbce44767af0a53A108b3B7ba4F740E03D228Ec0A",DODO_DSP_PROXY:"0x8d9ccc26CbF3D49bbA76E9920C3E6ed29e06b5cc",DODO_DPP_PROXY:"0xc4A1a152812dE96b2B1861E433f42290CDD7f113",DODO_MINEV3_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b"},[S.SEPOLIA]:{MULTI_CALL:"0x0fcB5237A1997C4700Ffa2BB4522EA38d4F851Fc",DODO_APPROVE:"0x66c45FF040e86DC613F239123A5E21FFdC3A3fEC",ERC20_HELPER:"0x297da061D1dE0132D241Fafed224288B34d81005",ROUTE_V2_DATA_FETCH:"0x03e89fC55A5ad0531576E5a502c4CA52c8bf391B",ROUTE_V1_DATA_FETCH:"0x3dD629473A2eD7f3C6299FFD9F3e0C283d073f11",CALLEE_HELPER:"0xCD536b4DECFD2fa0443666B6becD145F8aDe2E48",DODO_PROXY:"0x6292e8f7647b3b9dDf5795b1Fb77D0187e30E0F9",DODO_DSP_PROXY:"0x987bFBE33c9cF18cAA665B792Db66339a9c16D32",DODO_DPP_PROXY:"0x5e1251f4873248a030e1c92FFEB133AF1513277f",DODO_MINEV3_PROXY:"0xBbD59b9316eE65526DbBdEc2A748Cc05A285d54C"},[S.BSC]:{MULTI_CALL:"0x1Ee38d535d541c55C9dae27B12edf090C608E6Fb",DODO_APPROVE:"0xa128Ba44B2738A558A1fdC06d6303d52D3Cef8c1",ERC20_HELPER:"0x5B9E4c3056227C316a3da3296031DdC7a8d6a867",ROUTE_V2_DATA_FETCH:"0x35b8F92AcFE368afb90d37555f6d075Fc569a6BA",ROUTE_V1_DATA_FETCH:"0x2BBD66fC4898242BDBD2583BBe1d76E8b8f71445",CALLEE_HELPER:"0x2673E5333620bb22BD1bFB3af9Fc7012008E3b4B",DODO_PROXY:"0x8F8Dd7DB1bDA5eD3da8C9daf3bfa471c12d58486",DODO_DSP_PROXY:"0x2442A8B5cdf1E659F3F949A7E454Caa554D4E65a",DODO_DPP_PROXY:"0x624FC8368fE11BE00D8B2F3fE0B9D0053BEc21b9",DODO_V1_PAIR_PROXY:"0x4Fc222194862081866FC636893DDeCB3E4341A10",DODO_MINEV3_PROXY:"0x8f3fB1f9148dC473453163bF31de1d830Eb5c590"},[S.POLYGON]:{MULTI_CALL:"0xc9eD9B18e447e600238fe50e944B9062B664DEa4",DODO_APPROVE:"0x6D310348d5c12009854DFCf72e0DF9027e8cb4f4",ERC20_HELPER:"0xfd24312Ec7871A6D1a31e454D5AbB16c6c25a9b3",ROUTE_V2_DATA_FETCH:"0x1870854754d1E76C58B0a56a153E12Ff868eE3C6",ROUTE_V1_DATA_FETCH:"0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2",CALLEE_HELPER:"0x261F6cF4dF0e5c1432739cDAFD9299150FEd3dFc",DODO_PROXY:"0xa222e6a71D1A1Dd5F279805fbe38d5329C1d0e70",DODO_DSP_PROXY:"0xA3dfF6ae0F73f0970E31Da63B3736F7D3CEF683e",DODO_DPP_PROXY:"0xF6f1A1Ef2f5b56bb289993F75C12Eb41e4abC2f7",DODO_V1_PAIR_PROXY:"0x58E27C46c162F2a781d750BbE1119E1b2DfE82e0",DODO_MINEV3_PROXY:"0x47a65e74dd6b6B5E3243dBb01EDEd9D55ba234Ad"},[S.ARBITRUM_ONE]:{MULTI_CALL:"0xF718F2bd590E5621e53f7b89398e52f7Acced8ca",DODO_APPROVE:"0xA867241cDC8d3b0C07C85cC06F25a0cD3b5474d8",ERC20_HELPER:"0x7C062B9C584fA6eC2504270790D38240A2c5fE72",ROUTE_V2_DATA_FETCH:"0x0C420970b2e5efcBB6e833601772D6E707155eA6",ROUTE_V1_DATA_FETCH:"0x4EE6398898F7FC3e648b3f6bA458310ac29cD352",CALLEE_HELPER:"0xe3B40F8D8346d428EAB28d9Fd672b784d921cfBD",DODO_PROXY:"0x88CBf433471A0CD8240D2a12354362988b4593E5",DODO_DSP_PROXY:"0x36E5238B4479d1ba0bFE47550B0B8e4f4f500EAA",DODO_DPP_PROXY:"0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",DODO_V1_PAIR_PROXY:"0x49186E32fEd50fd6B5604A2618c7B0b03Cd41414",DODO_MINEV3_PROXY:"0x7E820457780Ac99B9A042Cd5f875b274855A1eE9"},[S.ARBITRUM_SEPOLIA]:{MULTI_CALL:g.MulticallWithValid,DODO_APPROVE:g.DODOApprove,ERC20_HELPER:g.ERC20Helper,ROUTE_V2_DATA_FETCH:g.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:g.DODOV1PmmHelper,CALLEE_HELPER:g.DODOCalleeHelper,DODO_PROXY:g.DODOV2Proxy02,DODO_DSP_PROXY:g.DODODspProxy,DODO_DPP_PROXY:g.DODODppProxy,DODO_MINEV3_PROXY:g.DODOMineV3ProxyWithoutPlatform},[S.AURORA]:{MULTI_CALL:"0x989DcAA95801C527C5B73AA65d3962dF9aCe1b0C",DODO_APPROVE:"0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619",ERC20_HELPER:"0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",ROUTE_V2_DATA_FETCH:"0x49eAB58AAE044F31d3b136212058a00b282b2845",ROUTE_V1_DATA_FETCH:"0xbAb9F4ff4A19a0e8EEBC56b06750253228ffAc6E",CALLEE_HELPER:"0x738Ebf387A0CE0eb46b0eF8Fa5DEa2EaE6B1Df51",DODO_PROXY:"0xd9deC7c3C06e62a4c1BeEB07CadF568f496b14c2",DODO_DSP_PROXY:"0x53233ABD9108761258a4B6B7822abFD6716B129B",DODO_DPP_PROXY:"0x357c5E9cfA8B834EDcef7C7aAbD8F9Db09119d11",DODO_MINEV3_PROXY:"0x4775b1858f1e417C9609D455C3Ad8751ec01daC4"},[S.OKCHAIN]:{MULTI_CALL:"0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01",DODO_APPROVE:"0x7737fd30535c69545deeEa54AB8Dd590ccaEBD3c",ERC20_HELPER:"0x4775b1858f1e417C9609D455C3Ad8751ec01daC4",ROUTE_V2_DATA_FETCH:"0x10Dd6d8A29D489BEDE472CC1b22dc695c144c5c7",ROUTE_V1_DATA_FETCH:"0xDfaf9584F5d229A9DBE5978523317820A8897C5A",CALLEE_HELPER:"0x3CD6D7F5fF977bf8069548eA1F9441b061162b42",DODO_PROXY:"0x6B4Fa0bc61Eddc928e0Df9c7f01e407BfcD3e5EF",DODO_DSP_PROXY:"0x5515363c0412AdD5c72d3E302fE1bD7dCBCF93Fe",DODO_DPP_PROXY:"0xa222e6a71D1A1Dd5F279805fbe38d5329C1d0e70",DODO_MINEV3_PROXY:"0x958f79e2998DFe417208b9A07D799265B0298e58"},[S.OPTIMISM]:{MULTI_CALL:"0xb98Ac2fEFc8b73aeAE33D02BB00c26E12afCa9Df",DODO_APPROVE:"0xa492d6eABcdc3E204676f15B950bBdD448080364",ERC20_HELPER:"0x42E456ea0dd7538ea103fBb1d0388D14C97bB5b2",ROUTE_V2_DATA_FETCH:"0xC48A8e689a644de96F80786ACb69E6F76D057F25",ROUTE_V1_DATA_FETCH:"0x6281E0628eb2B37fE9943279EA39725D5f0E0dBe",CALLEE_HELPER:"0x0BD7426f008737FeeD575ED8e2aA1bd4Fc49112D",DODO_PROXY:"0xfD9D2827AD469B72B69329dAA325ba7AfbDb3C98",DODO_DSP_PROXY:"0x61721e89a498dADa7aD579482BDC2aE60a9C5D54",DODO_DPP_PROXY:"0x51A70a33655FE1c5fae3286890DcE3bE332E85dD",DODO_MINEV3_PROXY:"0xaEdbD08D92ECccaA9A93b1A8D66D1d356e470c78"},[S.AVALANCHE]:{MULTI_CALL:"0x97f0153E7F5749640aDF3Ff9CFC518b79D6Fe53b",DODO_APPROVE:"0xCFea63e3DE31De53D68780Dd65675F169439e470",ERC20_HELPER:"0xC3528D128CC227fd60793007b5e3FdF7c2945282",ROUTE_V2_DATA_FETCH:"0x686984f0aa37585504f51DEbA0Eb45B0f0CB7e4a",ROUTE_V1_DATA_FETCH:"0x790B4A80Fb1094589A3c0eFC8740aA9b0C1733fB",CALLEE_HELPER:"0x4EfF1D851366b8cc51d553a87e2d12dA8Da46F2a",DODO_PROXY:"0x2cD18557E14aF72DAA8090BcAA95b231ffC9ea26",DODO_DSP_PROXY:"0xeCEaDe494FD5F913Fd937C5CAc4577236395Dc32",DODO_DPP_PROXY:"0xe44F14BFDe673B7339734a28152cCd6b821753C9",DODO_MINEV3_PROXY:"0x5D6e6A0BFB2176AFCc4FB809822D8e009216b245"},[S.CONFLUX]:{MULTI_CALL:"0x696e25a5e2aed1c55e6d6cfa0532bbda9020165d",DODO_APPROVE:"0x5BaF16d57620Cb361F622232F3cb4090e35F3da2",ERC20_HELPER:"0x24549FC74B3076A962624A26370ed556c467F74C",ROUTE_V2_DATA_FETCH:"0x7E9c460d0A10bd0605B15F0d0388e307d34a62E6",ROUTE_V1_DATA_FETCH:"0xAC716E87b0853C0712674e8E3a8435a489F276b4",CALLEE_HELPER:"0x5B2fd46E6E3Ff1E479d651ec0b210882Aa9871dF",DODO_PROXY:"0xbce44767af0a53A108b3B7ba4F740E03D228Ec0A",DODO_DSP_PROXY:"0x8d9ccc26cbf3d49bba76e9920c3e6ed29e06b5cc",DODO_DPP_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b",DODO_MINEV3_PROXY:"0x14F7B8Fb0c1447DdE7bcf92a8d9BB058c8A5FE64"},[S.BASE]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x89872650fA1A391f58B4E144222bB02e44db7e3B",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",DODO_DSP_PROXY:"0x49186E32fEd50fd6B5604A2618c7B0b03Cd41414",DODO_DPP_PROXY:"0x0B1467f71c082D8d410aF4376C685D9A6893cF36",DODO_MINEV3_PROXY:"0x2F66C5aAF006Bd9c51615D617589C16c0ed35fD3"},[S.LINEA]:{MULTI_CALL:"0xa7b9C3a116b20bEDDdBE4d90ff97157f67F0bD97",DODO_APPROVE:"0x6de4d882a84A98f4CCD5D33ea6b3C99A07BAbeB1",ERC20_HELPER:"0xbcd2FDC3B884Cf0dfD932f55Ec2Fe1fB7e8c62Da",ROUTE_V2_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",ROUTE_V1_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",CALLEE_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",DODO_PROXY:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",DODO_DSP_PROXY:"0x6D3bd005A8a75d6522C9cFE7d309BB1Cf9650e03",DODO_DPP_PROXY:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",DODO_MINEV3_PROXY:"0xA6d0066328Edbcf3220cf8F61e8527e589DD9719"},[S.SCROLL]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x20E77aD760eC9E922Fd2dA8847ABFbB2471B92CD",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xf5048d8F9163AF17Db522Abe9FaF37735C911320",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0xe49781e6186214d88aACFd9eBc8cE40E3CDc066D",DODO_DSP_PROXY:"0x7Dd8c909E1F48a68FfEF03492761AF17B1496EDc",DODO_DPP_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b",DODO_MINEV3_PROXY:"0x14F7B8Fb0c1447DdE7bcf92a8d9BB058c8A5FE64"},[S.MANTA]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x0226fCE8c969604C3A0AD19c37d1FAFac73e13c2",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0x2F86652dAEF5f1728c54191C955F065Ec3C188c7",DODO_DSP_PROXY:"0x0B1467f71c082D8d410aF4376C685D9A6893cF36",DODO_DPP_PROXY:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",DODO_MINEV3_PROXY:"0xA6d0066328Edbcf3220cf8F61e8527e589DD9719"},[S.MANTLE]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0xa71415675F68f29259ddD63215E5518d2735bf0a",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",ROUTE_V1_DATA_FETCH:"0xa1609A1fa7DC16c025feA194c02b2822441b8c10",CALLEE_HELPER:"0x4aAe1d041C01078725dB016BA4D4F72455CaF931",DODO_PROXY:"0xe7979E2F3e77196Bb2AB206eaa67Ea278A3E33A2",DODO_DSP_PROXY:"0x2933c0374089D7D98BA0C71c5E02E1A0e09deBEE",DODO_DPP_PROXY:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",DODO_MINEV3_PROXY:"0x6D3bd005A8a75d6522C9cFE7d309BB1Cf9650e03"},[S.DODO_CHAIN_TESTNET]:{MULTI_CALL:"0xD0CF7dfbF09CAfaB8AEf00e0Ce19a4638004a364",DODO_APPROVE:"0x82B26eb18382f7532015248078AB1f6030413396",ERC20_HELPER:"0xE6cecb7460c9E52aA483cb1f0E87d78D7085686F",ROUTE_V2_DATA_FETCH:"0xA3148a1765897EC0A9bCA57f855C0B4718060b78",ROUTE_V1_DATA_FETCH:"0x2e50e3e18c19C7d80B81888a961A13aEE49b962E",CALLEE_HELPER:"0x2Ba2696c63fA8b67b395de6D12F849b17C3515F9",DODO_PROXY:"0x464518e33F7Bd5E61a92b98b4332782915442580",DODO_DSP_PROXY:"0x886F677605512351e554AA53BA77eA493058b460",DODO_DPP_PROXY:"0xB4f2E70DE64F94116A6e93ff4dF2D020E91e7a63",DODO_MINEV3_PROXY:"0x391f8D754E4BaC453d059BA7D2137C4905bF48d4"},[S.TAIKO]:{MULTI_CALL:"0x388371233439cF57bB8C9f2e4835954841cfCb15",DODO_APPROVE:"0x2629E610dB4AC081c108cCDf8b19ED39D702df43",ERC20_HELPER:"0x0c76F95a2952DC171B26b152f2b30cA8968e79D5",ROUTE_V2_DATA_FETCH:"0xC7EaBEc77Be175432DC20c0056Cce4c2C78B84F3",ROUTE_V1_DATA_FETCH:"0x187210CE04F5B3179F0e483FCf292c34BA7568Dd",CALLEE_HELPER:"0x94B66F3156353a12A6004d098A16F2fCfF9E8348",DODO_PROXY:"0xfcd8EF54A4dA96dE6B2DDF67C6265C7405a3A9c6",DODO_DSP_PROXY:"0x928e9762B5223d5A2ac1F5b13E8A61907aCaa9Bd",DODO_DPP_PROXY:"0x38886EDE1Fc92886F9a11C37a1f5e75474858eaa",DODO_MINEV3_PROXY:"0x1dFd36964e21a2eb633991f0B95b4241c20e1db3"},[S.PLUME]:{MULTI_CALL:m.MulticallWithValid,DODO_APPROVE:m.DODOApprove,ERC20_HELPER:m.ERC20Helper,ROUTE_V2_DATA_FETCH:m.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:m.DODOV1PmmHelper,CALLEE_HELPER:m.DODOCalleeHelper,DODO_PROXY:m.DODOV2Proxy02,DODO_DSP_PROXY:m.DODODspProxy,DODO_DPP_PROXY:m.DODODppProxy,DODO_MINEV3_PROXY:m.DODOMineV3Proxy},[S.PLUME_TESTNET]:{MULTI_CALL:p.MulticallWithValid,DODO_APPROVE:p.DODOApprove,ERC20_HELPER:p.ERC20Helper,ROUTE_V2_DATA_FETCH:p.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:p.DODOV1PmmHelper,CALLEE_HELPER:p.DODOCalleeHelper,DODO_PROXY:p.DODOV2Proxy02,DODO_DSP_PROXY:p.DODODspProxy,DODO_DPP_PROXY:p.DODODppProxy,DODO_MINEV3_PROXY:p.DODOMineV3Proxy},[S.NEOX]:{MULTI_CALL:f.MulticallWithValid,DODO_APPROVE:f.DODOApprove,ERC20_HELPER:f.ERC20Helper,ROUTE_V2_DATA_FETCH:f.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:f.DODOV1PmmHelper,CALLEE_HELPER:f.DODOCalleeHelper,DODO_PROXY:f.DODOV2Proxy02,DODO_DSP_PROXY:f.DODODspProxy,DODO_DPP_PROXY:f.DODODppProxy,DODO_MINEV3_PROXY:f.DODOMineV3Proxy},[S.MORPH]:{MULTI_CALL:h.MulticallWithValid,DODO_APPROVE:h.DODOApprove,ERC20_HELPER:h.ERC20Helper,ROUTE_V2_DATA_FETCH:h.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:h.DODOV1PmmHelper,CALLEE_HELPER:h.DODOCalleeHelper,DODO_PROXY:h.DODOV2Proxy02,DODO_DSP_PROXY:h.DODODspProxy,DODO_DPP_PROXY:h.DODODppProxy,DODO_MINEV3_PROXY:h.DODOMineV3Proxy},[S.RISE_TESTNET]:{MULTI_CALL:d.MulticallWithValid,DODO_APPROVE:d.DODOApprove,ERC20_HELPER:d.ERC20Helper,ROUTE_V2_DATA_FETCH:d.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:d.DODOV1PmmHelper,CALLEE_HELPER:d.DODOCalleeHelper,DODO_PROXY:d.DODOV2Proxy02,DODO_DSP_PROXY:d.DODODspProxy,DODO_DPP_PROXY:d.DODODppProxy,DODO_MINEV3_PROXY:d.DODOMineV3Proxy},[S.NEROCHAIN]:{MULTI_CALL:u.MulticallWithValid,DODO_APPROVE:u.DODOApprove,ERC20_HELPER:u.ERC20Helper,ROUTE_V2_DATA_FETCH:u.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:u.DODOV1PmmHelper,CALLEE_HELPER:u.DODOCalleeHelper,DODO_PROXY:u.DODOV2Proxy02,DODO_DSP_PROXY:u.DODODspProxy,DODO_DPP_PROXY:u.DODODppProxy,DODO_MINEV3_PROXY:u.DODOMineV3Proxy},[S.BITLAYER]:{MULTI_CALL:c.MulticallWithValid,DODO_APPROVE:c.DODOApprove,ERC20_HELPER:c.ERC20Helper,ROUTE_V2_DATA_FETCH:c.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:c.DODOV1PmmHelper,CALLEE_HELPER:c.DODOCalleeHelper,DODO_PROXY:c.DODOV2Proxy02,DODO_DSP_PROXY:c.DODODspProxyWithoutGSP,DODO_DPP_PROXY:c.DODODppProxy,DODO_MINEV3_PROXY:c.DODOMineV3Proxy},[S.ZIRCUIT]:{MULTI_CALL:l.MulticallWithValid,DODO_APPROVE:l.DODOApprove,ERC20_HELPER:l.ERC20Helper,ROUTE_V2_DATA_FETCH:l.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:l.DODOV1PmmHelper,CALLEE_HELPER:l.DODOCalleeHelper,DODO_PROXY:l.DODOV2Proxy02,DODO_DSP_PROXY:l.DODODspProxyWithoutGSP,DODO_DPP_PROXY:l.DODODppProxy,DODO_MINEV3_PROXY:l.DODOMineV3Proxy},[S.X_LAYER]:{MULTI_CALL:a.MulticallWithValid,DODO_APPROVE:a.DODOApprove,ERC20_HELPER:a.ERC20Helper,ROUTE_V2_DATA_FETCH:a.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:a.DODOV1PmmHelper,CALLEE_HELPER:a.DODOCalleeHelper,DODO_PROXY:a.DODOV2Proxy02,DODO_DSP_PROXY:a.DODODspProxy,DODO_DPP_PROXY:a.DODODppProxy,DODO_MINEV3_PROXY:a.DODOMineV3Proxy},[S.ZERO]:{MULTI_CALL:o.MulticallWithValid,DODO_APPROVE:o.DODOApprove,ERC20_HELPER:o.ERC20Helper,ROUTE_V2_DATA_FETCH:o.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:o.DODOV1PmmHelper,CALLEE_HELPER:o.DODOCalleeHelper,DODO_PROXY:o.DODOV2Proxy02,DODO_DSP_PROXY:o.DODODspProxy,DODO_DPP_PROXY:o.DODODppProxy,DODO_MINEV3_PROXY:o.DODOMineV3Proxy},[S.HASHKEY]:{MULTI_CALL:s.MulticallWithValid,DODO_APPROVE:s.DODOApprove,ERC20_HELPER:s.ERC20Helper,ROUTE_V2_DATA_FETCH:s.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:s.DODOV1PmmHelper,CALLEE_HELPER:s.DODOCalleeHelper,DODO_PROXY:s.DODOV2Proxy02,DODO_DSP_PROXY:s.DODODspProxyWithoutGSP,DODO_DPP_PROXY:s.DODODppProxy,DODO_MINEV3_PROXY:s.DODOMineV3Proxy},[S.HEMI]:{MULTI_CALL:i.MulticallWithValid,DODO_APPROVE:i.DODOApprove,ERC20_HELPER:i.ERC20Helper,ROUTE_V2_DATA_FETCH:i.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:i.DODOV1PmmHelper,CALLEE_HELPER:i.DODOCalleeHelper,DODO_PROXY:i.DODOV2Proxy02,DODO_DSP_PROXY:i.DODODspProxyWithoutGSP,DODO_DPP_PROXY:i.DODODppProxy,DODO_MINEV3_PROXY:i.DODOMineV3Proxy},[S.PHAROS_TESTNET]:{MULTI_CALL:r.MulticallWithValid,DODO_APPROVE:r.DODOApprove,ERC20_HELPER:r.ERC20Helper,ROUTE_V2_DATA_FETCH:r.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:r.DODOV1PmmHelper,CALLEE_HELPER:r.DODOCalleeHelper,DODO_PROXY:r.DODOV2Proxy02,DODO_DSP_PROXY:r.DODODspProxy,DODO_DPP_PROXY:r.DODODppProxy,DODO_MINEV3_PROXY:r.DODOMineV3Proxy},[S.PHAROS_ATLANTIC_TESTNET]:{MULTI_CALL:n.MulticallWithValid,DODO_APPROVE:n.DODOApprove,ERC20_HELPER:n.ERC20Helper,ROUTE_V2_DATA_FETCH:n.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:n.DODOV1PmmHelper,CALLEE_HELPER:n.DODOCalleeHelper,DODO_PROXY:n.DODOV2Proxy02,DODO_DSP_PROXY:n.DODODspProxy,DODO_DPP_PROXY:n.DODODppProxy,DODO_MINEV3_PROXY:n.DODOMineV3Proxy},[S.STABLE_TESTNET]:{MULTI_CALL:t.MulticallWithValid,DODO_APPROVE:t.DODOApprove,ERC20_HELPER:t.ERC20Helper,ROUTE_V2_DATA_FETCH:t.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:t.DODOV1PmmHelper,CALLEE_HELPER:t.DODOCalleeHelper,DODO_PROXY:t.DODOV2Proxy02,DODO_DSP_PROXY:t.DODODspProxy,DODO_DPP_PROXY:t.DODODppProxy,DODO_MINEV3_PROXY:t.DODOMineV3Proxy},[S.STABLE]:{MULTI_CALL:e.MulticallWithValid,DODO_APPROVE:e.DODOApprove,ERC20_HELPER:e.ERC20Helper,ROUTE_V2_DATA_FETCH:e.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:e.DODOV1PmmHelper,CALLEE_HELPER:e.DODOCalleeHelper,DODO_PROXY:e.DODOV2Proxy02,DODO_DSP_PROXY:e.DODODspProxy,DODO_DPP_PROXY:e.DODODppProxy,DODO_MINEV3_PROXY:e.DODOMineV3Proxy}},U={[S.MAINNET]:"ethereum",[S.GOERLI]:"goerli",[S.OPTIMISM]:"optimism",[S.CONFLUX]:"cfx",[S.BSC]:"bsc",[S.OKCHAIN]:"okex-chain",[S.POLYGON]:"polygon",[S.ARBITRUM_ONE]:"arbitrum",[S.ARBITRUM_SEPOLIA]:"arb-sep",[S.AURORA]:"aurora",[S.AVALANCHE]:"avalanche",[S.BASE]:"base",[S.LINEA]:"linea",[S.SCROLL]:"scr",[S.MANTA]:"manta",[S.MANTLE]:"mantle",[S.SEPOLIA]:"sepolia",[S.DODO_CHAIN_TESTNET]:"dodochain-testnet",[S.TAIKO]:"taiko",[S.PLUME]:"plume",[S.PLUME_TESTNET]:"plume-testnet",[S.NEOX]:"neox",[S.MORPH]:"morph",[S.RISE_TESTNET]:"rise-testnet",[S.NEROCHAIN]:"nero",[S.BITLAYER]:"btr",[S.ZIRCUIT]:"zircuit-mainnet",[S.X_LAYER]:"okb",[S.ZERO]:"zero-mainnet",[S.HASHKEY]:"hashkey",[S.HEMI]:"hemi",[S.PHAROS_TESTNET]:"pharos-testnet",[S.PHAROS_ATLANTIC_TESTNET]:"pharos-atlantic-testnet",[S.STABLE_TESTNET]:"stable-testnet",[S.STABLE]:"stable"};function V(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let H=!1,j=!1;const Q={debug:1,default:2,info:2,warning:3,error:4,off:5};let Y=Q.default,G=null;const X=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var $,K;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}($||($={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(K||(K={}));const z="0123456789abcdef";class J{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==Q[n]&&this.throwArgumentError("invalid log level name","logLevel",e),Y>Q[n]||console.log.apply(console,t)}debug(...e){this._log(J.levels.DEBUG,e)}info(...e){this._log(J.levels.INFO,e)}warn(...e){this._log(J.levels.WARNING,e)}makeError(e,t,n){if(j)return this.makeError("censored error",t,{});t||(t=J.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach(e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=z[t[e]>>4],n+=z[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(t){r.push(e+"="+JSON.stringify(n[e].toString()))}}),r.push(`code=${t}`),r.push(`version=${this.version}`);const i=e;let s="";switch(t){case K.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case K.CALL_EXCEPTION:case K.INSUFFICIENT_FUNDS:case K.MISSING_NEW:case K.NONCE_EXPIRED:case K.REPLACEMENT_UNDERPRICED:case K.TRANSACTION_REPLACED:case K.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const o=new Error(e);return o.reason=i,o.code=t,Object.keys(n).forEach(function(e){o[e]=n[e]}),o}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,J.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){X&&this.throwError("platform missing String.prototype.normalize",J.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:X})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,J.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,J.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",e<t&&this.throwError("missing argument"+n,J.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,J.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",J.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",J.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",J.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return G||(G=new J("logger/5.8.0")),G}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",J.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),H){if(!e)return;this.globalLogger().throwError("error censorship permanent",J.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}j=!!e,H=!!t}static setLogLevel(e){const t=Q[e.toLowerCase()];null!=t?Y=t:J.globalLogger().warn("invalid log level - "+e)}static from(e){return new J(e)}}J.errors=K,J.levels=$;const W=new J("bytes/5.8.0");function Z(e){return!!e.toHexString}function ee(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return ee(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function te(e){return ae(e)&&!(e.length%2)||re(e)}function ne(e){return"number"==typeof e&&e==e&&e%1==0}function re(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!ne(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!ne(n)||n<0||n>=256)return!1}return!0}function ie(e,t){if(t||(t={}),"number"==typeof e){W.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),ee(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Z(e)&&(e=e.toHexString()),ae(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":W.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return ee(new Uint8Array(r))}return re(e)?ee(new Uint8Array(e)):W.throwArgumentError("invalid arrayify value","value",e)}function se(e){const t=e.map(e=>ie(e)),n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n);return t.reduce((e,t)=>(r.set(t,e),e+t.length),0),ee(r)}function oe(e){let t=ie(e);if(0===t.length)return t;let n=0;for(;n<t.length&&0===t[n];)n++;return n&&(t=t.slice(n)),t}function ae(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const le="0123456789abcdef";function ce(e,t){if(t||(t={}),"number"==typeof e){W.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=le[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Z(e))return e.toHexString();if(ae(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":W.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(re(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=le[(240&r)>>4]+le[15&r]}return t}return W.throwArgumentError("invalid hexlify value","value",e)}function ue(e){if("string"!=typeof e)e=ce(e);else if(!ae(e)||e.length%2)return null;return(e.length-2)/2}function de(e,t,n){return"string"!=typeof e?e=ce(e):(!ae(e)||e.length%2)&&W.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function he(e){let t="0x";return e.forEach(e=>{t+=ce(e).substring(2)}),t}function fe(e){const t=function(e){"string"!=typeof e&&(e=ce(e));ae(e)||W.throwArgumentError("invalid hex string","value",e);e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}(ce(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function pe(e,t){for("string"!=typeof e?e=ce(e):ae(e)||W.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&W.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function me(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(te(e)){let n=ie(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=ce(n.slice(0,32)),t.s=ce(n.slice(32,64))):65===n.length?(t.r=ce(n.slice(0,32)),t.s=ce(n.slice(32,64)),t.v=n[64]):W.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:W.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=ce(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=function(e,t){(e=ie(e)).length>t&&W.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),ee(n)}(ie(t._vs),32);t._vs=ce(n);const r=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=r:t.recoveryParam!==r&&W.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const i=ce(n);null==t.s?t.s=i:t.s!==i&&W.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?W.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&W.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&ae(t.r)?t.r=pe(t.r,32):W.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&ae(t.s)?t.s=pe(t.s,32):W.throwArgumentError("signature missing or invalid s","signature",e);const n=ie(t.s);n[0]>=128&&W.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const r=ce(n);t._vs&&(ae(t._vs)||W.throwArgumentError("signature invalid _vs","signature",e),t._vs=pe(t._vs,32)),null==t._vs?t._vs=r:t._vs!==r&&W.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}const ge="bignumber/5.8.0";var ye=D.BN;const Ae=new J(ge),Ee={},be=9007199254740991;let ve=!1;class we{constructor(e,t){e!==Ee&&Ae.throwError("cannot call constructor directly; use BigNumber.from",J.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return De(Te(this).fromTwos(e))}toTwos(e){return De(Te(this).toTwos(e))}abs(){return"-"===this._hex[0]?we.from(this._hex.substring(1)):this}add(e){return De(Te(this).add(Te(e)))}sub(e){return De(Te(this).sub(Te(e)))}div(e){return we.from(e).isZero()&&_e("division-by-zero","div"),De(Te(this).div(Te(e)))}mul(e){return De(Te(this).mul(Te(e)))}mod(e){const t=Te(e);return t.isNeg()&&_e("division-by-zero","mod"),De(Te(this).umod(t))}pow(e){const t=Te(e);return t.isNeg()&&_e("negative-power","pow"),De(Te(this).pow(t))}and(e){const t=Te(e);return(this.isNegative()||t.isNeg())&&_e("unbound-bitwise-result","and"),De(Te(this).and(t))}or(e){const t=Te(e);return(this.isNegative()||t.isNeg())&&_e("unbound-bitwise-result","or"),De(Te(this).or(t))}xor(e){const t=Te(e);return(this.isNegative()||t.isNeg())&&_e("unbound-bitwise-result","xor"),De(Te(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&_e("negative-width","mask"),De(Te(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&_e("negative-width","shl"),De(Te(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&_e("negative-width","shr"),De(Te(this).shrn(e))}eq(e){return Te(this).eq(Te(e))}lt(e){return Te(this).lt(Te(e))}lte(e){return Te(this).lte(Te(e))}gt(e){return Te(this).gt(Te(e))}gte(e){return Te(this).gte(Te(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Te(this).isZero()}toNumber(){try{return Te(this).toNumber()}catch(e){_e("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ae.throwError("this platform does not support BigInt",J.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ve||(ve=!0,Ae.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ae.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",J.errors.UNEXPECTED_ARGUMENT,{}):Ae.throwError("BigNumber.toString does not accept parameters",J.errors.UNEXPECTED_ARGUMENT,{})),Te(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof we)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new we(Ee,Oe(e)):e.match(/^-?[0-9]+$/)?new we(Ee,Oe(new ye(e))):Ae.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&_e("underflow","BigNumber.from",e),(e>=be||e<=-be)&&_e("overflow","BigNumber.from",e),we.from(String(e));const t=e;if("bigint"==typeof t)return we.from(t.toString());if(re(t))return we.from(ce(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return we.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(ae(e)||"-"===e[0]&&ae(e.substring(1))))return we.from(e)}return Ae.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Oe(e){if("string"!=typeof e)return Oe(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Ae.throwArgumentError("invalid hex","value",e),"0x00"===(e=Oe(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function De(e){return we.from(Oe(e))}function Te(e){const t=we.from(e).toHexString();return"-"===t[0]?new ye("-"+t.substring(3),16):new ye(t.substring(2),16)}function _e(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),Ae.throwError(e,J.errors.NUMERIC_FAULT,r)}const Pe=new J(ge),Re={},Ie=we.from(0),Ce=we.from(-1);function ke(e,t,n,r){const i={fault:t,operation:n};return void 0!==r&&(i.value=r),Pe.throwError(e,J.errors.NUMERIC_FAULT,i)}let Be="0";for(;Be.length<256;)Be+=Be;function Ne(e){if("number"!=typeof e)try{e=we.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Be.substring(0,e):Pe.throwArgumentError("invalid decimal size","decimals",e)}function xe(e,t){null==t&&(t=0);const n=Ne(t),r=(e=we.from(e)).lt(Ie);r&&(e=e.mul(Ce));let i=e.mod(n).toString();for(;i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(n).toString();return e=1===n.length?s:s+"."+i,r&&(e="-"+e),e}function Se(e,t){null==t&&(t=0);const n=Ne(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Pe.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&Pe.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Pe.throwArgumentError("too many decimal points","value",e);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>n.length-1&&ke("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<n.length-1;)o+="0";const a=we.from(s),l=we.from(o);let c=a.mul(n).add(l);return r&&(c=c.mul(Ce)),c}class Le{constructor(e,t,n,r){e!==Re&&Pe.throwError("cannot use FixedFormat constructor; use FixedFormat.from",J.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=n,this.decimals=r,this.name=(t?"":"u")+"fixed"+String(n)+"x"+String(r),this._multiplier=Ne(r),Object.freeze(this)}static from(e){if(e instanceof Le)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Pe.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],n=parseInt(i[2]),r=parseInt(i[3])}else if(e){const i=(t,n,r)=>null==e[t]?r:(typeof e[t]!==n&&Pe.throwArgumentError("invalid fixed format ("+t+" not "+n+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&Pe.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&Pe.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new Le(Re,t,n,r)}}class Fe{constructor(e,t,n,r){e!==Re&&Pe.throwError("cannot use FixedNumber constructor; use FixedNumber.from",J.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=t,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Pe.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=Se(this._value,this.format.decimals),n=Se(e._value,e.format.decimals);return Fe.fromValue(t.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=Se(this._value,this.format.decimals),n=Se(e._value,e.format.decimals);return Fe.fromValue(t.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=Se(this._value,this.format.decimals),n=Se(e._value,e.format.decimals);return Fe.fromValue(t.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=Se(this._value,this.format.decimals),n=Se(e._value,e.format.decimals);return Fe.fromValue(t.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Fe.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(t=t.subUnsafe(Me.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Fe.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(t=t.addUnsafe(Me.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&Pe.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const n=Fe.from("1"+Be.substring(0,e),this.format),r=qe.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&Pe.throwArgumentError("invalid byte width","width",e);return pe(we.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Fe.fromString(this._value,e)}static fromValue(e,t,n){return null!=n||null==t||function(e){return null!=e&&(we.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||ae(e)||"bigint"==typeof e||re(e))}(t)||(n=t,t=null),null==t&&(t=0),null==n&&(n="fixed"),Fe.fromString(xe(e,t),Le.from(n))}static fromString(e,t){null==t&&(t="fixed");const n=Le.from(t),r=Se(e,n.decimals);!n.signed&&r.lt(Ie)&&ke("unsigned value cannot be negative","overflow","value",e);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=pe(i,n.width/8));const s=xe(r,n.decimals);return new Fe(Re,i,s,n)}static fromBytes(e,t){null==t&&(t="fixed");const n=Le.from(t);if(ie(e).length>n.width/8)throw new Error("overflow");let r=we.from(e);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),s=xe(r,n.decimals);return new Fe(Re,i,s,n)}static from(e,t){if("string"==typeof e)return Fe.fromString(e,t);if(re(e))return Fe.fromBytes(e,t);try{return Fe.fromValue(e,0,t)}catch(e){if(e.code!==J.errors.INVALID_ARGUMENT)throw e}return Pe.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const Me=Fe.from(1),qe=Fe.from("0.5");var Ue=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const Ve=new J("properties/5.8.0");function He(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function je(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function Qe(e){return Ue(this,void 0,void 0,function*(){const t=Object.keys(e).map(t=>{const n=e[t];return Promise.resolve(n).then(e=>({key:t,value:e}))});return(yield Promise.all(t)).reduce((e,t)=>(e[t.key]=t.value,e),{})})}function Ye(e){const t={};for(const n in e)t[n]=e[n];return t}const Ge={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Xe(e){if(null==e||Ge[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let n=0;n<t.length;n++){let r=null;try{r=e[t[n]]}catch(e){continue}if(!Xe(r))return!1}return!0}return Ve.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function $e(e){if(Xe(e))return e;if(Array.isArray(e))return Object.freeze(e.map(e=>Ke(e)));if("object"==typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&He(t,n,Ke(r))}return t}return Ve.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Ke(e){return $e(e)}class ze{constructor(e){for(const t in e)this[t]=Ke(e[t])}}var Je=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const We=new J("abstract-provider/5.8.0");class Ze extends ze{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class et{constructor(){We.checkAbstract(new.target,et),He(this,"_isProvider",!0)}getFeeData(){return Je(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield Qe({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(e=>null)});let n=null,r=null,i=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,i=we.from("1500000000"),r=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:t}})}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}const tt=new J("networks/5.8.0");function nt(e){const t=function(t,n){null==n&&(n={});const r=[];if(t.InfuraProvider&&"-"!==n.infura)try{r.push(new t.InfuraProvider(e,n.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==n.etherscan)try{r.push(new t.EtherscanProvider(e,n.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==n.alchemy)try{r.push(new t.AlchemyProvider(e,n.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==n.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const s=new t.PocketProvider(e,n.pocket);s.network&&-1===i.indexOf(s.network.name)&&r.push(s)}catch(e){}}if(t.CloudflareProvider&&"-"!==n.cloudflare)try{r.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==n.ankr)try{const i=["ropsten"],s=new t.AnkrProvider(e,n.ankr);s.network&&-1===i.indexOf(s.network.name)&&r.push(s)}catch(e){}if(t.QuickNodeProvider&&"-"!==n.quicknode)try{r.push(new t.QuickNodeProvider(e,n.quicknode))}catch(e){}if(0===r.length)return null;if(t.FallbackProvider){let i=1;return null!=n.quorum?i=n.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(r,i)}return r[0]};return t.renetwork=function(e){return nt(e)},t}function rt(e,t){const n=function(n,r){return n.JsonRpcProvider?new n.JsonRpcProvider(e,t):null};return n.renetwork=function(t){return rt(e,t)},n}const it={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:nt("homestead")},st={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:nt("ropsten")},ot={chainId:63,name:"classicMordor",_defaultProvider:rt("https://www.ethercluster.com/mordor","classicMordor")},at={unspecified:{chainId:0,name:"unspecified"},homestead:it,mainnet:it,morden:{chainId:2,name:"morden"},ropsten:st,testnet:st,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:nt("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:nt("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:nt("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"sepolia",_defaultProvider:nt("sepolia")},holesky:{chainId:17e3,name:"holesky",_defaultProvider:nt("holesky")},classic:{chainId:61,name:"classic",_defaultProvider:rt("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:ot,classicTestnet:ot,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:rt("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:nt("matic")},maticmum:{chainId:80001,name:"maticmum",_defaultProvider:nt("maticmum")},optimism:{chainId:10,name:"optimism",_defaultProvider:nt("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},"optimism-sepolia":{chainId:11155420,name:"optimism-sepolia"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},"arbitrum-sepolia":{chainId:421614,name:"arbitrum-sepolia"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function lt(e){e=atob(e);const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return ie(t)}function ct(e){e=ie(e);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}class ut{constructor(e){He(this,"alphabet",e),He(this,"base",e.length),He(this,"_alphabetMap",{}),He(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=ie(e);if(0===t.length)return"";let n=[0];for(let e=0;e<t.length;++e){let r=t[e];for(let e=0;e<n.length;++e)r+=n[e]<<8,n[e]=r%this.base,r=r/this.base|0;for(;r>0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let e=0;0===t[e]&&e<t.length-1;++e)r+=this._leader;for(let e=n.length-1;e>=0;--e)r+=this.alphabet[n[e]];return r}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let n=0;n<e.length;n++){let r=this._alphabetMap[e[n]];if(void 0===r)throw new Error("Non-base"+this.base+" character");let i=r;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let n=0;e[n]===this._leader&&n<e.length-1;++n)t.push(0);return ie(new Uint8Array(t.reverse()))}}new ut("abcdefghijklmnopqrstuvwxyz234567");const dt=new ut("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ht=we.from(-1),ft=we.from(0),pt=we.from(1),mt=we.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function gt(e){return"0x"+O.keccak_256(ie(e))}const yt=new J("strings/5.8.0");var At,Et;function bt(e,t,n,r,i){if(e===Et.BAD_PREFIX||e===Et.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return e===Et.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(At||(At={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(Et||(Et={}));const vt=Object.freeze({error:function(e,t,n,r,i){return yt.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)},ignore:bt,replace:function(e,t,n,r,i){return e===Et.OVERLONG?(r.push(i),0):(r.push(65533),bt(e,t,n))}});function wt(e,t){null==t&&(t=vt.error),e=ie(e);const n=[];let r=0;for(;r<e.length;){const i=e[r++];if(!(i>>7)){n.push(i);continue}let s=null,o=null;if(192==(224&i))s=1,o=127;else if(224==(240&i))s=2,o=2047;else{if(240!=(248&i)){r+=t(128==(192&i)?Et.UNEXPECTED_CONTINUE:Et.BAD_PREFIX,r-1,e,n);continue}s=3,o=65535}if(r-1+s>=e.length){r+=t(Et.OVERRUN,r-1,e,n);continue}let a=i&(1<<8-s-1)-1;for(let i=0;i<s;i++){let i=e[r];if(128!=(192&i)){r+=t(Et.MISSING_CONTINUE,r,e,n),a=null;break}a=a<<6|63&i,r++}null!==a&&(a>1114111?r+=t(Et.OUT_OF_RANGE,r-1-s,e,n,a):a>=55296&&a<=57343?r+=t(Et.UTF16_SURROGATE,r-1-s,e,n,a):a<=o?r+=t(Et.OVERLONG,r-1-s,e,n,a):n.push(a))}return n}function Ot(e,t=At.current){t!=At.current&&(yt.checkNormalize(),e=e.normalize(t));let n=[];for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const s=65536+((1023&r)<<10)+(1023&i);n.push(s>>18|240),n.push(s>>12&63|128),n.push(s>>6&63|128),n.push(63&s|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return ie(n)}function Dt(e,t){return wt(e,t).map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))).join("")}function Tt(e){return gt(Ot(e))}const _t="hash/5.8.0";function Pt(e,t){null==t&&(t=1);const n=[],r=n.forEach,i=function(e,t){r.call(e,function(e){t>0&&Array.isArray(e)?i(e,t-1):n.push(e)})};return i(e,t),n}function Rt(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function n(){return e[t++]<<8|e[t++]}let r=n(),i=1,s=[0,1];for(let e=1;e<r;e++)s.push(i+=n());let o=n(),a=t;t+=o;let l=0,c=0;function u(){return 0==l&&(c=c<<8|e[t++],l=8),c>>--l&1}const d=Math.pow(2,31),h=d>>>1,f=h>>1,p=d-1;let m=0;for(let e=0;e<31;e++)m=m<<1|u();let g=[],y=0,A=d;for(;;){let e=Math.floor(((m-y+1)*i-1)/A),t=0,n=r;for(;n-t>1;){let r=t+n>>>1;e<s[r]?n=r:t=r}if(0==t)break;g.push(t);let o=y+Math.floor(A*s[t]/i),a=y+Math.floor(A*s[t+1]/i)-1;for(;0==((o^a)&h);)m=m<<1&p|u(),o=o<<1&p,a=a<<1&p|1;for(;o&~a&f;)m=m&h|m<<1&p>>>1|u(),o=o<<1^h,a=(a^h)<<1|h|1;y=o,A=1+a-o}let E=r-4;return g.map(t=>{switch(t-E){case 3:return E+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return E+256+(e[a++]<<8|e[a++]);case 1:return E+e[a++];default:return t-1}})}(e))}function It(e){return 1&e?~e>>1:e>>1}function Ct(e,t){let n=Array(e);for(let r=0,i=-1;r<e;r++)n[r]=i+=1+t();return n}function kt(e,t){let n=Array(e);for(let r=0,i=0;r<e;r++)n[r]=i+=It(t());return n}function Bt(e,t){let n=Ct(e(),e),r=e(),i=Ct(r,e),s=function(e,t){let n=Array(e);for(let r=0;r<e;r++)n[r]=1+t();return n}(r,e);for(let e=0;e<r;e++)for(let t=0;t<s[e];t++)n.push(i[e]+t);return t?n.map(e=>t[e]):n}function Nt(e,t,n){let r=Array(e).fill(void 0).map(()=>[]);for(let i=0;i<t;i++)kt(e,n).forEach((e,t)=>r[t].push(e));return r}function xt(e,t){let n=1+t(),r=t(),i=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(n)}return t}(t);return Pt(Nt(i.length,1+e,t).map((e,t)=>{const s=e[0],o=e.slice(1);return Array(i[t]).fill(void 0).map((e,t)=>{let i=t*r;return[s+t*n,o.map(e=>e+i)]})}))}function St(e,t){return Nt(1+t(),1+e,t).map(e=>[e[0],e.slice(1)])}const Lt=Rt(lt("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),Ft=new Set(Bt(Lt)),Mt=new Set(Bt(Lt)),qt=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(xt(n,e))}for(;;){let n=e()-1;if(n<0)break;t.push(St(n,e))}return function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[r[0]]=r[1]}return t}(Pt(t))}(Lt),Ut=function(e){let t=Bt(e).sort((e,t)=>e-t);return function n(){let r=[];for(;;){let i=Bt(e,t);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort((e,t)=>t.set.size-e.set.size);let i=e(),s=i%3;i=i/3|0;let o=!!(1&i);return i>>=1,{branches:r,valid:s,fe0f:o,save:1==i,check:2==i}}()}(Lt);function Vt(e){return function(e,t=At.current){return wt(Ot(e,t))}(e)}function Ht(e){return e.filter(e=>65039!=e)}function jt(e){for(let t of e.split(".")){let e=Vt(t);try{for(let t=e.lastIndexOf(95)-1;t>=0;t--)if(95!==e[t])throw new Error("underscore only allowed at start");if(e.length>=4&&e.every(e=>e<128)&&45===e[2]&&45===e[3])throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function Qt(e){return jt(function(e,t){let n=Vt(e).reverse(),r=[];for(;n.length;){let e=Yt(n);if(e){r.push(...t(e));continue}let i=n.pop();if(Ft.has(i)){r.push(i);continue}if(Mt.has(i))continue;let s=qt[i];if(!s)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...s)}return jt((i=String.fromCodePoint(...r),i.normalize("NFC")));var i}(e,Ht))}function Yt(e,t){var n;let r,i,s=Ut,o=[],a=e.length;for(;a;){let t=e[--a];if(s=null===(n=s.branches.find(e=>e.set.has(t)))||void 0===n?void 0:n.node,!s)break;if(s.save)i=t;else if(s.check&&t===i)break;o.push(t),s.fe0f&&(o.push(65039),a>0&&65039==e[a-1]&&a--),s.valid&&(r=o.slice(),2==s.valid&&r.splice(1,1),e.length=a)}return r}const Gt=new J(_t),Xt=new Uint8Array(32);function $t(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function Kt(e){const t=Ot(Qt(e)),n=[];if(0===e.length)return n;let r=0;for(let e=0;e<t.length;e++){46===t[e]&&(n.push($t(t.slice(r,e))),r=e+1)}if(r>=t.length)throw new Error("invalid ENS name; empty component");return n.push($t(t.slice(r))),n}function zt(e){"string"!=typeof e&&Gt.throwArgumentError("invalid ENS name; not a string","name",e);let t=Xt;const n=Kt(e);for(;n.length;)t=gt(se([t,gt(n.pop())]));return ce(t)}Xt.fill(0);const Jt=new J("rlp/5.8.0");function Wt(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function Zt(e,t,n){let r=0;for(let i=0;i<n;i++)r=256*r+e[t+i];return r}function en(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(en(e))}),t.length<=55)return t.unshift(192+t.length),t;const n=Wt(t.length);return n.unshift(247+n.length),n.concat(t)}te(e)||Jt.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(ie(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=Wt(t.length);return n.unshift(183+n.length),n.concat(t)}function tn(e){return ce(en(e))}function nn(e,t,n,r){const i=[];for(;n<t+1+r;){const s=rn(e,n);i.push(s.result),(n+=s.consumed)>t+1+r&&Jt.throwError("child data too short",J.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function rn(e,t){if(0===e.length&&Jt.throwError("data too short",J.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&Jt.throwError("data short segment too short",J.errors.BUFFER_OVERRUN,{});const r=Zt(e,t+1,n);return t+1+n+r>e.length&&Jt.throwError("data long segment too short",J.errors.BUFFER_OVERRUN,{}),nn(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&Jt.throwError("data array too short",J.errors.BUFFER_OVERRUN,{}),nn(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&Jt.throwError("data array too short",J.errors.BUFFER_OVERRUN,{});const r=Zt(e,t+1,n);t+1+n+r>e.length&&Jt.throwError("data array too short",J.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:ce(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&Jt.throwError("data too short",J.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:ce(e.slice(t+1,t+1+n))}}return{consumed:1,result:ce(e[t])}}function sn(e){const t=ie(e),n=rn(t,0);return n.consumed!==t.length&&Jt.throwArgumentError("invalid rlp data","data",e),n.result}const on=new J("address/5.8.0");function an(e){ae(e,20)||on.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=ie(gt(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const ln={};for(let e=0;e<10;e++)ln[String(e)]=String(e);for(let e=0;e<26;e++)ln[String.fromCharCode(65+e)]=String(10+e);const cn=Math.floor((un=9007199254740991,Math.log10?Math.log10(un):Math.log(un)/Math.LN10));var un;function dn(e){let t=null;if("string"!=typeof e&&on.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=an(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&on.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>ln[e]).join("");for(;t.length>=cn;){let e=t.substring(0,cn);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}(e)&&on.throwArgumentError("bad icap checksum","address",e),n=e.substring(4),t=new ye(n,36).toString(16);t.length<40;)t="0"+t;t=an("0x"+t)}else on.throwArgumentError("invalid address","address",e);var n;return t}function hn(e){let t=null;try{t=dn(e.from)}catch(t){on.throwArgumentError("missing from address","transaction",e)}return dn(de(gt(tn([t,oe(ie(we.from(e.nonce).toHexString()))])),12))}var fn=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const pn=new J(_t),mn=new Uint8Array(32);mn.fill(0);const gn=we.from(-1),yn=we.from(0),An=we.from(1),En=we.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const bn=pe(An.toHexString(),32),vn=pe(yn.toHexString(),32),wn={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},On=["name","version","chainId","verifyingContract","salt"];function Dn(e){return function(t){return"string"!=typeof t&&pn.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Tn={name:Dn("name"),version:Dn("version"),chainId:function(e){try{return we.from(e).toString()}catch(e){}return pn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return dn(e).toLowerCase()}catch(e){}return pn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=ie(e);if(32!==t.length)throw new Error("bad length");return ce(t)}catch(e){}return pn.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function _n(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],r=parseInt(t[2]||"256");(r%8!=0||r>256||t[2]&&t[2]!==String(r))&&pn.throwArgumentError("invalid numeric width","type",e);const i=En.mask(n?r-1:r),s=n?i.add(An).mul(gn):yn;return function(t){const n=we.from(t);return(n.lt(s)||n.gt(i))&&pn.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),pe(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const n=parseInt(t[1]);return(0===n||n>32||t[1]!==String(n))&&pn.throwArgumentError("invalid bytes width","type",e),function(t){return ie(t).length!==n&&pn.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=ie(e),n=t.length%32;return n?he([t,mn.slice(n)]):ce(t)}(t)}}}switch(e){case"address":return function(e){return pe(dn(e),32)};case"bool":return function(e){return e?bn:vn};case"bytes":return function(e){return gt(e)};case"string":return function(e){return Tt(e)}}return null}function Pn(e,t){return`${e}(${t.map(({name:e,type:t})=>t+" "+e).join(",")})`}class Rn{constructor(e){He(this,"types",Object.freeze(Ke(e))),He(this,"_encoderCache",{}),He(this,"_types",{});const t={},n={},r={};Object.keys(e).forEach(e=>{t[e]={},n[e]=[],r[e]={}});for(const r in e){const i={};e[r].forEach(s=>{i[s.name]&&pn.throwArgumentError(`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(r)}`,"types",e),i[s.name]=!0;const o=s.type.match(/^([^\x5b]*)(\x5b|$)/)[1];o===r&&pn.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e);_n(o)||(n[o]||pn.throwArgumentError(`unknown type ${JSON.stringify(o)}`,"types",e),n[o].push(r),t[r][o]=!0)})}const i=Object.keys(n).filter(e=>0===n[e].length);0===i.length?pn.throwArgumentError("missing primary type","types",e):i.length>1&&pn.throwArgumentError(`ambiguous primary types or unused types: ${i.map(e=>JSON.stringify(e)).join(", ")}`,"types",e),He(this,"primaryType",i[0]),function i(s,o){o[s]&&pn.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e),o[s]=!0,Object.keys(t[s]).forEach(e=>{n[e]&&(i(e,o),Object.keys(o).forEach(t=>{r[t][e]=!0}))}),delete o[s]}(this.primaryType,{});for(const t in r){const n=Object.keys(r[t]);n.sort(),this._types[t]=Pn(t,e[t])+n.map(t=>Pn(t,e[t])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=_n(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],n=this.getEncoder(e),r=parseInt(t[3]);return t=>{r>=0&&t.length!==r&&pn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(n);return this._types[e]&&(i=i.map(gt)),gt(he(i))}}const n=this.types[e];if(n){const t=Tt(this._types[e]);return e=>{const r=n.map(({name:t,type:n})=>{const r=this.getEncoder(n)(e[t]);return this._types[n]?gt(r):r});return r.unshift(t),he(r)}}return pn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||pn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return gt(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,n){if(_n(e))return n(e,t);const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const e=r[1],i=parseInt(r[3]);return i>=0&&t.length!==i&&pn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map(t=>this._visit(e,t,n))}const i=this.types[e];return i?i.reduce((e,{name:r,type:i})=>(e[r]=this._visit(i,t[r],n),e),{}):pn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Rn(e)}static getPrimaryType(e){return Rn.from(e).primaryType}static hashStruct(e,t,n){return Rn.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){const r=wn[n];r||pn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:r})}return t.sort((e,t)=>On.indexOf(e.name)-On.indexOf(t.name)),Rn.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return he(["0x1901",Rn.hashDomain(e),Rn.from(t).hash(n)])}static hash(e,t,n){return gt(Rn.encode(e,t,n))}static resolveNames(e,t,n,r){return fn(this,void 0,void 0,function*(){e=Ye(e);const i={};e.verifyingContract&&!ae(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=Rn.from(t);s.visit(n,(e,t)=>("address"!==e||ae(t,20)||(i[t]="0x"),t));for(const e in i)i[e]=yield r(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=s.visit(n,(e,t)=>"address"===e&&i[t]?i[t]:t),{domain:e,value:n}})}static getPayload(e,t,n){Rn.hashDomain(e);const r={},i=[];On.forEach(t=>{const n=e[t];null!=n&&(r[t]=Tn[t](n),i.push({name:t,type:wn[t]}))});const s=Rn.from(t),o=Ye(t);return o.EIP712Domain?pn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):o.EIP712Domain=i,s.encode(n),{types:o,domain:r,primaryType:s.primaryType,message:s.visit(n,(e,t)=>{if(e.match(/^bytes(\d*)/))return ce(ie(t));if(e.match(/^u?int/))return we.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&pn.throwArgumentError("invalid string","value",t),t}return pn.throwArgumentError("unsupported type","type",e)})}}}function In(e){return"0x"+T.sha256().update(ie(e)).digest("hex")}var Cn=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};function kn(e,t){return Cn(this,void 0,void 0,function*(){null==t&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(n.mode=e.mode),e.cache&&(n.cache=e.cache),e.credentials&&(n.credentials=e.credentials),e.redirect&&(n.redirect=e.redirect),e.referrer&&(n.referrer=e.referrer)}const r=yield fetch(e,n),i=yield r.arrayBuffer(),s={};return r.headers.forEach?r.headers.forEach((e,t)=>{s[t.toLowerCase()]=e}):r.headers.keys().forEach(e=>{s[e.toLowerCase()]=r.headers.get(e)}),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:ie(new Uint8Array(i))}})}var Bn=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const Nn=new J("web/5.8.0");function xn(e){return new Promise(t=>{setTimeout(t,e)})}function Sn(e,t){if(null==e)return null;if("string"==typeof e)return e;if(te(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return Dt(e)}catch(e){}return ce(e)}return e}function Ln(e,t,n){let r=null;if(null!=t){r=Ot(t);const n="string"==typeof e?{url:e}:Ye(e);if(n.headers){0!==Object.keys(n.headers).filter(e=>"content-type"===e.toLowerCase()).length||(n.headers=Ye(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return function(e,t,n){const r="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;Nn.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof e?e.throttleCallback:null,s="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;Nn.assertArgument(s>0&&s%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o="object"==typeof e&&!!e.errorPassThrough,a={};let l=null;const c={method:"GET"};let u=!1,d=12e4;if("string"==typeof e)l=e;else if("object"==typeof e){if(null!=e&&null!=e.url||Nn.throwArgumentError("missing URL","connection.url",e),l=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(const t in e.headers)a[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(u=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==l.substring(0,6)&&!0!==e.allowInsecureAuthentication&&Nn.throwError("basic authentication requires a secure https url",J.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;a.authorization={key:"Authorization",value:"Basic "+ct(Ot(t))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=Ye(e.fetchOptions))}const h=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=l?l.match(h):null;if(f)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?lt(f[3]):(p=f[3],Ot(p.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))))};let t=e.body;return n&&(t=n(e.body,e)),Promise.resolve(t)}catch(e){Nn.throwError("processing response error",J.errors.SERVER_ERROR,{body:Sn(f[1],f[2]),error:e,requestBody:null,requestMethod:"GET",url:l})}var p;t&&(c.method="POST",c.body=t,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(t.length)}));const m={};Object.keys(a).forEach(e=>{const t=a[e];m[t.key]=t.value}),c.headers=m;const g=function(){let e=null;return{promise:new Promise(function(t,n){d&&(e=setTimeout(()=>{null!=e&&(e=null,n(Nn.makeError("timeout",J.errors.TIMEOUT,{requestBody:Sn(c.body,m["content-type"]),requestMethod:c.method,timeout:d,url:l})))},d))}),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),y=function(){return Bn(this,void 0,void 0,function*(){for(let e=0;e<r;e++){let t=null;try{if(t=yield kn(l,c),e<r)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===c.method&&e.match(/^https:/)){l=t.headers.location;continue}}else if(429===t.statusCode){let n=!0;if(i&&(n=yield i(e,l)),n){let n=0;const r=t.headers["retry-after"];n="string"==typeof r&&r.match(/^[1-9][0-9]*$/)?1e3*parseInt(r):s*parseInt(String(Math.random()*Math.pow(2,e))),yield xn(n);continue}}}catch(e){t=e.response,null==t&&(g.cancel(),Nn.throwError("missing response",J.errors.SERVER_ERROR,{requestBody:Sn(c.body,m["content-type"]),requestMethod:c.method,serverError:e,url:l}))}let a=t.body;if(u&&304===t.statusCode?a=null:!o&&(t.statusCode<200||t.statusCode>=300)&&(g.cancel(),Nn.throwError("bad response",J.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:Sn(a,t.headers?t.headers["content-type"]:null),requestBody:Sn(c.body,m["content-type"]),requestMethod:c.method,url:l})),n)try{const e=yield n(a,t);return g.cancel(),e}catch(n){if(n.throttleRetry&&e<r){let t=!0;if(i&&(t=yield i(e,l)),t){const t=s*parseInt(String(Math.random()*Math.pow(2,e)));yield xn(t);continue}}g.cancel(),Nn.throwError("processing response error",J.errors.SERVER_ERROR,{body:Sn(a,t.headers?t.headers["content-type"]:null),error:n,requestBody:Sn(c.body,m["content-type"]),requestMethod:c.method,url:l})}return g.cancel(),a}return Nn.throwError("failed response",J.errors.SERVER_ERROR,{requestBody:Sn(c.body,m["content-type"]),requestMethod:c.method,url:l})})}();return Promise.race([g.promise,y])}(e,r,(e,t)=>{let r=null;if(null!=e)try{r=JSON.parse(Dt(e))}catch(t){Nn.throwError("invalid JSON",J.errors.SERVER_ERROR,{body:e,error:t})}return n&&(r=n(r,t)),r})}function Fn(e,t){return t||(t={}),null==(t=Ye(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise(function(n,r){let i=null,s=!1;const o=()=>!s&&(s=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout(()=>{o()&&r(new Error("timeout"))},t.timeout));const a=t.retryLimit;let l=0;!function i(){return e().then(function(e){if(void 0!==e)o()&&n(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!s){if(l++,l>a)return void(o()&&r(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,l)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null},function(e){o()&&r(e)})}()})}const Mn="providers/5.8.0";function qn(e,t,n){return n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},e(n,n.exports),n.exports}var Un=Vn;function Vn(e,t){if(!e)throw new Error(t||"Assertion failed")}Vn.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Hn=qn(function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),s=i>>8,o=255&i;s?n.push(s,o):n.push(o)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}}),jn=qn(function(e,t){var n=t;n.assert=Un,n.toArray=Hn.toArray,n.zero2=Hn.zero2,n.toHex=Hn.toHex,n.encode=Hn.encode,n.getNAF=function(e,t,n){var r,i=new Array(Math.max(e.bitLength(),n)+1);for(r=0;r<i.length;r+=1)i[r]=0;var s=1<<t+1,o=e.clone();for(r=0;r<i.length;r++){var a,l=o.andln(s-1);o.isOdd()?(a=l>(s>>1)-1?(s>>1)-l:l,o.isubn(a)):a=0,i[r]=a,o.iushrn(1)}return i},n.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,s=0;e.cmpn(-i)>0||t.cmpn(-s)>0;){var o,a,l=e.andln(3)+i&3,c=t.andln(3)+s&3;3===l&&(l=-1),3===c&&(c=-1),o=1&l?3!==(r=e.andln(7)+i&7)&&5!==r||2!==c?l:-l:0,n[0].push(o),a=1&c?3!==(r=t.andln(7)+s&7)&&5!==r||2!==l?c:-c:0,n[1].push(a),2*i===o+1&&(i=1-i),2*s===a+1&&(s=1-s),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new D(e,"hex","le")}}),Qn=jn.getNAF,Yn=jn.getJSF,Gn=jn.assert;function Xn(e,t){this.type=e,this.p=new D(t.p,16),this.red=t.prime?D.red(t.prime):D.mont(this.p),this.zero=new D(0).toRed(this.red),this.one=new D(1).toRed(this.red),this.two=new D(2).toRed(this.red),this.n=t.n&&new D(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var $n=Xn;function Kn(e,t){this.curve=e,this.type=t,this.precomputed=null}Xn.prototype.point=function(){throw new Error("Not implemented")},Xn.prototype.validate=function(){throw new Error("Not implemented")},Xn.prototype._fixedNafMul=function(e,t){Gn(e.precomputed);var n=e._getDoubles(),r=Qn(t,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var s,o,a=[];for(s=0;s<r.length;s+=n.step){o=0;for(var l=s+n.step-1;l>=s;l--)o=(o<<1)+r[l];a.push(o)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<a.length;s++)(o=a[s])===d?u=u.mixedAdd(n.points[s]):o===-d&&(u=u.mixedAdd(n.points[s].neg()));c=c.add(u)}return c.toP()},Xn.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,s=Qn(t,n,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var l=0;a>=0&&0===s[a];a--)l++;if(a>=0&&l++,o=o.dblp(l),a<0)break;var c=s[a];Gn(0!==c),o="affine"===e.type?c>0?o.mixedAdd(i[c-1>>1]):o.mixedAdd(i[-c-1>>1].neg()):c>0?o.add(i[c-1>>1]):o.add(i[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},Xn.prototype._wnafMulAdd=function(e,t,n,r,i){var s,o,a,l=this._wnafT1,c=this._wnafT2,u=this._wnafT3,d=0;for(s=0;s<r;s++){var h=(a=t[s])._getNAFPoints(e);l[s]=h.wnd,c[s]=h.points}for(s=r-1;s>=1;s-=2){var f=s-1,p=s;if(1===l[f]&&1===l[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Yn(n[f],n[p]);for(d=Math.max(y[0].length,d),u[f]=new Array(d),u[p]=new Array(d),o=0;o<d;o++){var A=0|y[0][o],E=0|y[1][o];u[f][o]=g[3*(A+1)+(E+1)],u[p][o]=0,c[f]=m}}else u[f]=Qn(n[f],l[f],this._bitLength),u[p]=Qn(n[p],l[p],this._bitLength),d=Math.max(u[f].length,d),d=Math.max(u[p].length,d)}var b=this.jpoint(null,null,null),v=this._wnafT4;for(s=d;s>=0;s--){for(var w=0;s>=0;){var O=!0;for(o=0;o<r;o++)v[o]=0|u[o][s],0!==v[o]&&(O=!1);if(!O)break;w++,s--}if(s>=0&&w++,b=b.dblp(w),s<0)break;for(o=0;o<r;o++){var D=v[o];0!==D&&(D>0?a=c[o][D-1>>1]:D<0&&(a=c[o][-D-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(s=0;s<r;s++)c[s]=null;return i?b:b.toP()},Xn.BasePoint=Kn,Kn.prototype.eq=function(){throw new Error("Not implemented")},Kn.prototype.validate=function(){return this.curve.validate(this)},Xn.prototype.decodePoint=function(e,t){e=jn.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?Gn(e[e.length-1]%2==0):7===e[0]&&Gn(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},Kn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Kn.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},Kn.prototype.encode=function(e,t){return jn.encode(this._encode(t),e)},Kn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Kn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Kn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var s=0;s<e;s++)r=r.dbl();n.push(r)}return{step:e,points:n}},Kn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},Kn.prototype._getBeta=function(){return null},Kn.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var zn=qn(function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}}),Jn=jn.assert;function Wn(e){$n.call(this,"short",e),this.a=new D(e.a,16).toRed(this.red),this.b=new D(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}zn(Wn,$n);var Zn=Wn;function er(e,t,n,r){$n.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new D(t,16),this.y=new D(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function tr(e,t,n,r){$n.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new D(0)):(this.x=new D(t,16),this.y=new D(n,16),this.z=new D(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Wn.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new D(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new D(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],Jn(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new D(e.a,16),b:new D(e.b,16)}}):this._getEndoBasis(n)}}},Wn.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:D.mont(e),n=new D(2).toRed(t).redInvm(),r=n.redNeg(),i=new D(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},Wn.prototype._getEndoBasis=function(e){for(var t,n,r,i,s,o,a,l,c,u=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),f=new D(1),p=new D(0),m=new D(0),g=new D(1),y=0;0!==d.cmpn(0);){var A=h.div(d);l=h.sub(A.mul(d)),c=m.sub(A.mul(f));var E=g.sub(A.mul(p));if(!r&&l.cmp(u)<0)t=a.neg(),n=f,r=l.neg(),i=c;else if(r&&2===++y)break;a=l,h=d,d=l,m=f,f=c,g=p,p=E}s=l.neg(),o=c;var b=r.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(b)>=0&&(s=t,o=n),r.negative&&(r=r.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:r,b:i},{a:s,b:o}]},Wn.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),o=i.mul(n.a),a=s.mul(r.a),l=i.mul(n.b),c=s.mul(r.b);return{k1:e.sub(o).sub(a),k2:l.add(c).neg()}},Wn.prototype.pointFromX=function(e,t){(e=new D(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},Wn.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Wn.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],l=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),l=l.neg(!0)),r[2*s]=a,r[2*s+1]=l,i[2*s]=o.k1,i[2*s+1]=o.k2}for(var c=this._wnafMulAdd(1,r,i,2*s,n),u=0;u<2*s;u++)r[u]=null,i[u]=null;return c},zn(er,$n.BasePoint),Wn.prototype.point=function(e,t,n){return new er(this,e,t,n)},Wn.prototype.pointFromJSON=function(e,t){return er.fromJSON(this,e,t)},er.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},er.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},er.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var s=t[2];return r.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[r].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[r].concat(s.naf.points.map(i))}},r},er.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},er.prototype.isInfinity=function(){return this.inf},er.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},er.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},er.prototype.getX=function(){return this.x.fromRed()},er.prototype.getY=function(){return this.y.fromRed()},er.prototype.mul=function(e){return e=new D(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},er.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},er.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},er.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},er.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},er.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},zn(tr,$n.BasePoint),Wn.prototype.jpoint=function(e,t,n){return new tr(this,e,t,n)},tr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},tr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},tr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),l=s.redSub(o);if(0===a.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),d=r.redMul(c),h=l.redSqr().redIAdd(u).redISub(d).redISub(d),f=l.redMul(d.redISub(h)).redISub(s.redMul(u)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,f,p)},tr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,s=e.y.redMul(t).redMul(this.z),o=n.redSub(r),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=o.redSqr(),c=l.redMul(o),u=n.redMul(l),d=a.redSqr().redIAdd(c).redISub(u).redISub(u),h=a.redMul(u.redISub(d)).redISub(i.redMul(c)),f=this.z.redMul(o);return this.curve.jpoint(d,h,f)},tr.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,l=a.redSqr().redSqr(),c=o.redAdd(o);for(t=0;t<e;t++){var u=s.redSqr(),d=c.redSqr(),h=d.redSqr(),f=u.redAdd(u).redIAdd(u).redIAdd(r.redMul(l)),p=s.redMul(d),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=f.redMul(g);y=y.redIAdd(y).redISub(h);var A=c.redMul(a);t+1<e&&(l=l.redMul(h)),s=m,a=A,c=y}return this.curve.jpoint(s,c.redMul(i),a)},tr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},tr.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(s);o=o.redIAdd(o);var a=r.redAdd(r).redIAdd(r),l=a.redSqr().redISub(o).redISub(o),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=l,t=a.redMul(o.redISub(l)).redISub(c),n=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),f=this.x.redAdd(d).redSqr().redISub(u).redISub(h);f=f.redIAdd(f);var p=u.redAdd(u).redIAdd(u),m=p.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},tr.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(s);o=o.redIAdd(o);var a=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),l=a.redSqr().redISub(o).redISub(o);e=l;var c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(o.redISub(l)).redISub(c),n=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),f=this.x.redSub(u).redMul(this.x.redAdd(u));f=f.redAdd(f).redIAdd(f);var p=h.redIAdd(h),m=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(u);var g=d.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=f.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},tr.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),s=t.redSqr(),o=n.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(i)),l=t.redAdd(t),c=(l=l.redIAdd(l)).redMul(o),u=a.redSqr().redISub(c.redAdd(c)),d=c.redISub(u),h=o.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=a.redMul(d).redISub(h),p=n.redAdd(n).redMul(r);return this.curve.jpoint(u,f,p)},tr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),s=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(r),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),l=r.redIAdd(r);l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var c=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(l),u=t.redMul(c);u=(u=u.redIAdd(u)).redIAdd(u);var d=this.x.redMul(a).redISub(u);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(c.redMul(l.redISub(c)).redISub(o.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=this.z.redAdd(o).redSqr().redISub(n).redISub(a);return this.curve.jpoint(d,h,f)},tr.prototype.mul=function(e,t){return e=new D(e,t),this.curve._wnafMul(this,e)},tr.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},tr.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},tr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},tr.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var nr=qn(function(e,t){var n=t;n.base=$n,n.short=Zn,n.mont=null,n.edwards=null}),rr=qn(function(e,t){var n,r=t,i=jn.assert;function s(e){"short"===e.type?this.curve=new nr.short(e):"edwards"===e.type?this.curve=new nr.edwards(e):this.curve=new nr.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new s(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=s,o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:T.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:T.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:T.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:T.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:T.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:T.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:T.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(e){n=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:T.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})});function ir(e){if(!(this instanceof ir))return new ir(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Hn.toArray(e.entropy,e.entropyEnc||"hex"),n=Hn.toArray(e.nonce,e.nonceEnc||"hex"),r=Hn.toArray(e.pers,e.persEnc||"hex");Un(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var sr=ir;ir.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},ir.prototype._hmac=function(){return new T.hmac(this.hash,this.K)},ir.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},ir.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=Hn.toArray(e,t),n=Hn.toArray(n,r),Un(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ir.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=Hn.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,e);return this._update(n),this._reseed++,Hn.encode(s,t)};var or=jn.assert;function ar(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var lr=ar;ar.fromPublic=function(e,t,n){return t instanceof ar?t:new ar(e,{pub:t,pubEnc:n})},ar.fromPrivate=function(e,t,n){return t instanceof ar?t:new ar(e,{priv:t,privEnc:n})},ar.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},ar.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},ar.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},ar.prototype._importPrivate=function(e,t){this.priv=new D(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},ar.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?or(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||or(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},ar.prototype.derive=function(e){return e.validate()||or(e.validate(),"public point not validated"),e.mul(this.priv).getX()},ar.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},ar.prototype.verify=function(e,t,n){return this.ec.verify(e,t,this,void 0,n)},ar.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var cr=jn.assert;function ur(e,t){if(e instanceof ur)return e;this._importDER(e,t)||(cr(e.r&&e.s,"Signature without r or s"),this.r=new D(e.r,16),this.s=new D(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var dr=ur;function hr(){this.place=0}function fr(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;if(0===e[t.place])return!1;for(var i=0,s=0,o=t.place;s<r;s++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function pr(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function mr(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}ur.prototype._importDER=function(e,t){e=jn.toArray(e,t);var n=new hr;if(48!==e[n.place++])return!1;var r=fr(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=fr(e,n);if(!1===i)return!1;if(128&e[n.place])return!1;var s=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var o=fr(e,n);if(!1===o)return!1;if(e.length!==o+n.place)return!1;if(128&e[n.place])return!1;var a=e.slice(n.place,o+n.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new D(s),this.s=new D(a),this.recoveryParam=null,!0},ur.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=pr(t),n=pr(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];mr(r,t.length),(r=r.concat(t)).push(2),mr(r,n.length);var i=r.concat(n),s=[48];return mr(s,i.length),s=s.concat(i),jn.encode(s,e)};var gr=function(){throw new Error("unsupported")},yr=jn.assert;function Ar(e){if(!(this instanceof Ar))return new Ar(e);"string"==typeof e&&(yr(Object.prototype.hasOwnProperty.call(rr,e),"Unknown curve "+e),e=rr[e]),e instanceof rr.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var Er=Ar;Ar.prototype.keyPair=function(e){return new lr(this,e)},Ar.prototype.keyFromPrivate=function(e,t){return lr.fromPrivate(this,e,t)},Ar.prototype.keyFromPublic=function(e,t){return lr.fromPublic(this,e,t)},Ar.prototype.genKeyPair=function(e){e||(e={});for(var t=new sr({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||gr(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new D(2));;){var i=new D(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Ar.prototype._truncateToN=function(e,t,n){var r;if(D.isBN(e)||"number"==typeof e)r=(e=new D(e,16)).byteLength();else if("object"==typeof e)r=e.length,e=new D(e,16);else{var i=e.toString();r=i.length+1>>>1,e=new D(i,16)}"number"!=typeof n&&(n=8*r);var s=n-this.n.bitLength();return s>0&&(e=e.ushrn(s)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Ar.prototype.sign=function(e,t,n,r){if("object"==typeof n&&(r=n,n=null),r||(r={}),"string"!=typeof e&&"number"!=typeof e&&!D.isBN(e)){yr("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),yr(e.length>>>0===e.length);for(var i=0;i<e.length;i++)yr((255&e[i])===e[i])}t=this.keyFromPrivate(t,n),e=this._truncateToN(e,!1,r.msgBitLength),yr(!e.isNeg(),"Can not sign a negative message");var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s);yr(new D(a).eq(e),"Can not sign message");for(var l=new sr({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),c=this.n.sub(new D(1)),u=0;;u++){var d=r.k?r.k(u):new D(l.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(c)>=0)){var h=this.g.mul(d);if(!h.isInfinity()){var f=h.getX(),p=f.umod(this.n);if(0!==p.cmpn(0)){var m=d.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(h.getY().isOdd()?1:0)|(0!==f.cmp(p)?2:0);return r.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new dr({r:p,s:m,recoveryParam:g})}}}}}},Ar.prototype.verify=function(e,t,n,r,i){i||(i={}),e=this._truncateToN(e,!1,i.msgBitLength),n=this.keyFromPublic(n,r);var s=(t=new dr(t,"hex")).r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,l=o.invm(this.n),c=l.mul(e).umod(this.n),u=l.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,n.getPublic(),u)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(c,n.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},Ar.prototype.recoverPubKey=function(e,t,n,r){yr((3&n)===n,"The recovery param is more than two bits"),t=new dr(t,r);var i=this.n,s=new D(e),o=t.r,a=t.s,l=1&n,c=n>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),l):this.curve.pointFromX(o,l);var u=t.r.invm(i),d=i.sub(s).mul(u).umod(i),h=a.mul(u).umod(i);return this.g.mulAdd(d,o,h)},Ar.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new dr(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var br=qn(function(e,t){var n=t;n.version="6.6.1",n.utils=jn,n.rand=function(){throw new Error("unsupported")},n.curve=nr,n.curves=rr,n.ec=Er,n.eddsa=null}).ec;const vr=new J("signing-key/5.8.0");let wr=null;function Or(){return wr||(wr=new br("secp256k1")),wr}class Dr{constructor(e){He(this,"curve","secp256k1"),He(this,"privateKey",ce(e)),32!==ue(this.privateKey)&&vr.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Or().keyFromPrivate(ie(this.privateKey));He(this,"publicKey","0x"+t.getPublic(!1,"hex")),He(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),He(this,"_isSigningKey",!0)}_addPoint(e){const t=Or().keyFromPublic(ie(this.publicKey)),n=Or().keyFromPublic(ie(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const t=Or().keyFromPrivate(ie(this.privateKey)),n=ie(e);32!==n.length&&vr.throwArgumentError("bad digest length","digest",e);const r=t.sign(n,{canonical:!0});return me({recoveryParam:r.recoveryParam,r:pe("0x"+r.r.toString(16),32),s:pe("0x"+r.s.toString(16),32)})}computeSharedSecret(e){const t=Or().keyFromPrivate(ie(this.privateKey)),n=Or().keyFromPublic(ie(Tr(e)));return pe("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function Tr(e,t){const n=ie(e);if(32===n.length){return new Dr(n).publicKey}return 33===n.length?"0x"+Or().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?ce(n):vr.throwArgumentError("invalid public or private key","key","[REDACTED]")}const _r=new J("transactions/5.8.0");var Pr;function Rr(e){return"0x"===e?null:dn(e)}function Ir(e){return"0x"===e?ft:we.from(e)}function Cr(e,t){return function(e){return dn(de(gt(de(Tr(e),1)),12))}(function(e,t){const n=me(t),r={r:ie(n.r),s:ie(n.s)};return"0x"+Or().recoverPubKey(ie(e),r,n.recoveryParam).encode("hex",!1)}(ie(e),t))}function kr(e,t){const n=oe(we.from(e).toHexString());return n.length>32&&_r.throwArgumentError("invalid length for "+t,"transaction:"+t,e),n}function Br(e,t){return{address:dn(e),storageKeys:(t||[]).map((t,n)=>(32!==ue(t)&&_r.throwArgumentError("invalid access list storageKey",`accessList[${e}:${n}]`,t),t.toLowerCase()))}}function Nr(e){if(Array.isArray(e))return e.map((e,t)=>Array.isArray(e)?(e.length>2&&_r.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),Br(e[0],e[1])):Br(e.address,e.storageKeys));const t=Object.keys(e).map(t=>{const n=e[t].reduce((e,t)=>(e[t]=!0,e),{});return Br(t,Object.keys(n).sort())});return t.sort((e,t)=>e.address.localeCompare(t.address)),t}function xr(e){return Nr(e).map(e=>[e.address,e.storageKeys])}function Sr(e,t){if(null!=e.gasPrice){const t=we.from(e.gasPrice),n=we.from(e.maxFeePerGas||0);t.eq(n)||_r.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:n})}const n=[kr(e.chainId||0,"chainId"),kr(e.nonce||0,"nonce"),kr(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),kr(e.maxFeePerGas||0,"maxFeePerGas"),kr(e.gasLimit||0,"gasLimit"),null!=e.to?dn(e.to):"0x",kr(e.value||0,"value"),e.data||"0x",xr(e.accessList||[])];if(t){const e=me(t);n.push(kr(e.recoveryParam,"recoveryParam")),n.push(oe(e.r)),n.push(oe(e.s))}return he(["0x02",tn(n)])}function Lr(e,t){const n=[kr(e.chainId||0,"chainId"),kr(e.nonce||0,"nonce"),kr(e.gasPrice||0,"gasPrice"),kr(e.gasLimit||0,"gasLimit"),null!=e.to?dn(e.to):"0x",kr(e.value||0,"value"),e.data||"0x",xr(e.accessList||[])];if(t){const e=me(t);n.push(kr(e.recoveryParam,"recoveryParam")),n.push(oe(e.r)),n.push(oe(e.s))}return he(["0x01",tn(n)])}function Fr(e,t,n){try{const n=Ir(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(e){_r.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=pe(t[1],32),e.s=pe(t[2],32);try{const t=gt(n(e));e.from=Cr(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function Mr(e){const t=ie(e);if(t[0]>127)return function(e){const t=sn(e);9!==t.length&&6!==t.length&&_r.throwArgumentError("invalid raw transaction","rawTransaction",e);const n={nonce:Ir(t[0]).toNumber(),gasPrice:Ir(t[1]),gasLimit:Ir(t[2]),to:Rr(t[3]),value:Ir(t[4]),data:t[5],chainId:0};if(6===t.length)return n;try{n.v=we.from(t[6]).toNumber()}catch(e){return n}if(n.r=pe(t[7],32),n.s=pe(t[8],32),we.from(n.r).isZero()&&we.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let r=n.v-27;const i=t.slice(0,6);0!==n.chainId&&(i.push(ce(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const s=gt(tn(i));try{n.from=Cr(s,{r:ce(n.r),s:ce(n.s),recoveryParam:r})}catch(e){}n.hash=gt(e)}return n.type=null,n}(t);switch(t[0]){case 1:return function(e){const t=sn(e.slice(1));8!==t.length&&11!==t.length&&_r.throwArgumentError("invalid component count for transaction type: 1","payload",ce(e));const n={type:1,chainId:Ir(t[0]).toNumber(),nonce:Ir(t[1]).toNumber(),gasPrice:Ir(t[2]),gasLimit:Ir(t[3]),to:Rr(t[4]),value:Ir(t[5]),data:t[6],accessList:Nr(t[7])};return 8===t.length||(n.hash=gt(e),Fr(n,t.slice(8),Lr)),n}(t);case 2:return function(e){const t=sn(e.slice(1));9!==t.length&&12!==t.length&&_r.throwArgumentError("invalid component count for transaction type: 2","payload",ce(e));const n=Ir(t[2]),r=Ir(t[3]),i={type:2,chainId:Ir(t[0]).toNumber(),nonce:Ir(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:Ir(t[4]),to:Rr(t[5]),value:Ir(t[6]),data:t[7],accessList:Nr(t[8])};return 9===t.length||(i.hash=gt(e),Fr(i,t.slice(9),Sr)),i}(t)}return _r.throwError(`unsupported transaction type: ${t[0]}`,J.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(Pr||(Pr={}));const qr=new J(Mn);class Ur{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),s=this.hash.bind(this),o=this.hex.bind(this),a=this.number.bind(this),l=this.type.bind(this);return e.transaction={hash:s,type:l,accessList:Ur.allowNull(this.accessList.bind(this),null),blockHash:Ur.allowNull(s,null),blockNumber:Ur.allowNull(a,null),transactionIndex:Ur.allowNull(a,null),confirmations:Ur.allowNull(a,null),from:t,gasPrice:Ur.allowNull(n),maxPriorityFeePerGas:Ur.allowNull(n),maxFeePerGas:Ur.allowNull(n),gasLimit:n,to:Ur.allowNull(t,null),value:n,nonce:a,data:i,r:Ur.allowNull(this.uint256),s:Ur.allowNull(this.uint256),v:Ur.allowNull(a),creates:Ur.allowNull(t,null),raw:Ur.allowNull(i)},e.transactionRequest={from:Ur.allowNull(t),nonce:Ur.allowNull(a),gasLimit:Ur.allowNull(n),gasPrice:Ur.allowNull(n),maxPriorityFeePerGas:Ur.allowNull(n),maxFeePerGas:Ur.allowNull(n),to:Ur.allowNull(t),value:Ur.allowNull(n),data:Ur.allowNull(e=>this.data(e,!0)),type:Ur.allowNull(a),accessList:Ur.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:t,topics:Ur.arrayOf(s),data:i,logIndex:a,blockHash:s},e.receipt={to:Ur.allowNull(this.address,null),from:Ur.allowNull(this.address,null),contractAddress:Ur.allowNull(t,null),transactionIndex:a,root:Ur.allowNull(o),gasUsed:n,logsBloom:Ur.allowNull(i),blockHash:s,transactionHash:s,logs:Ur.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Ur.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:Ur.allowNull(n),status:Ur.allowNull(a),type:l},e.block={hash:Ur.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:Ur.allowNull(o),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:Ur.allowNull(t),extraData:i,transactions:Ur.allowNull(Ur.arrayOf(s)),baseFeePerGas:Ur.allowNull(n)},e.blockWithTransactions=Ye(e.block),e.blockWithTransactions.transactions=Ur.allowNull(Ur.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Ur.allowNull(r,void 0),toBlock:Ur.allowNull(r,void 0),blockHash:Ur.allowNull(s,void 0),address:Ur.allowNull(t,void 0),topics:Ur.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Ur.allowNull(a),blockHash:Ur.allowNull(s),transactionIndex:a,removed:Ur.allowNull(this.boolean.bind(this)),address:t,data:Ur.allowFalsish(i,"0x"),topics:Ur.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return Nr(e||[])}number(e){return"0x"===e?0:we.from(e).toNumber()}type(e){return"0x"===e||null==e?0:we.from(e).toNumber()}bigNumber(e){return we.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),ae(e))?e.toLowerCase():qr.throwArgumentError("invalid hash","value",e)}data(e,t){const n=this.hex(e,t);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return dn(e)}callAddress(e){if(!ae(e,32))return null;const t=dn(de(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return hn(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||ae(e))return fe(e);throw new Error("invalid blockTag")}hash(e,t){const n=this.hex(e,t);return 32!==ue(n)?qr.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(null==e)return null;const t=we.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!ae(e))throw new Error("invalid uint256");return pe(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const n=null!=e._difficulty?e._difficulty:e.difficulty,r=Ur.check(t,e);return r._difficulty=null==n?null:we.from(n),r}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Ur.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&we.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=Ur.check(this.formats.transaction,e);if(null!=e.chainId){let n=e.chainId;ae(n)&&(n=we.from(n).toNumber()),t.chainId=n}else{let n=e.networkId;null==n&&null==t.v&&(n=e.chainId),ae(n)&&(n=we.from(n).toNumber()),"number"!=typeof n&&null!=t.v&&(n=(t.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),t.chainId=n}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return Mr(e)}receiptLog(e){return Ur.check(this.formats.receiptLog,e)}receipt(e){const t=Ur.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=we.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&qr.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):qr.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&qr.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map(e=>this.topics(e)):null!=e?this.hash(e,!0):null}filter(e){return Ur.check(this.formats.filter,e)}filterLog(e){return Ur.check(this.formats.filterLog,e)}static check(e,t){const n={};for(const r in e)try{const i=e[r](t[r]);void 0!==i&&(n[r]=i)}catch(e){throw e.checkKey=r,e.checkValue=t[r],e}return n}static allowNull(e,t){return function(n){return null==n?t:e(n)}}static allowFalsish(e,t){return function(n){return n?e(n):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const n=[];return t.forEach(function(t){n.push(e(t))}),n}}}var Vr=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const Hr=new J(Mn);function jr(e){return null==e?"null":(32!==ue(e)&&Hr.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function Qr(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map(e=>{if(Array.isArray(e)){const t={};e.forEach(e=>{t[jr(e)]=!0});const n=Object.keys(t);return n.sort(),n.join("|")}return jr(e)}).join("&")}function Yr(e){if("string"==typeof e){if(32===ue(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+Qr(e);if(Ze.isForkEvent(e))throw Hr.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+Qr(e.topics||[])}throw new Error("invalid event - "+e)}function Gr(){return(new Date).getTime()}function Xr(e){return new Promise(t=>{setTimeout(t,e)})}const $r=["block","network","pending","poll"];class Kr{constructor(e,t,n){He(this,"tag",e),He(this,"listener",t),He(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],n=""===(r=e[2])?[]:r.split(/&/g).map(e=>{if(""===e)return[];const t=e.split("|").map(e=>"null"===e?null:e);return 1===t.length?t[0]:t});var r;const i={};return n.length>0&&(i.topics=n),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||$r.indexOf(this.tag)>=0}}const zr={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Jr(e){return pe(we.from(e).toHexString(),32)}function Wr(e){return dt.encode(se([e,de(In(In(e)),0,4)]))}const Zr=new RegExp("^(ipfs)://(.*)$","i"),ei=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Zr,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function ti(e,t){try{return Dt(ni(e,t))}catch(e){}return null}function ni(e,t){if("0x"===e)return null;const n=we.from(de(e,t,t+32)).toNumber(),r=we.from(de(e,n,n+32)).toNumber();return de(e,n+32,n+32+r)}function ri(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):Hr.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function ii(e){const t=ie(e);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function si(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function oi(e){const t=[];let n=0;for(let r=0;r<e.length;r++)t.push(null),n+=32;for(let r=0;r<e.length;r++){const i=ie(e[r]);t[r]=ii(n),t.push(ii(i.length)),t.push(si(i)),n+=32+32*Math.ceil(i.length/32)}return he(t)}class ai{constructor(e,t,n,r){He(this,"provider",e),He(this,"name",n),He(this,"address",e.formatter.address(t)),He(this,"_resolvedAddress",r)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(e=>we.from(e).eq(1)).catch(e=>{if(e.code===J.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return Vr(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:he([e,zt(this.name),t||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=he(["0x9061b923",oi([(i=this.name,ce(se(Kt(i).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t})))+"00"),n.data])]));try{let e=yield this.provider.call(n);return ie(e).length%32==4&&Hr.throwError("resolver threw error",J.errors.CALL_EXCEPTION,{transaction:n,data:e}),r&&(e=ni(e,0)),e}catch(e){if(e.code===J.errors.CALL_EXCEPTION)return null;throw e}})}_fetchBytes(e,t){return Vr(this,void 0,void 0,function*(){const n=yield this._fetch(e,t);return null!=n?ni(n,0):null})}_getAddress(e,t){const n=zr[String(e)];if(null==n&&Hr.throwError(`unsupported coin type: ${e}`,J.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===n.ilk)return this.provider.formatter.address(t);const r=ie(t);if(null!=n.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return Wr(se([[n.p2pkh],"0x"+e[2]]))}}if(null!=n.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return Wr(se([[n.p2sh],"0x"+e[2]]))}}if(null!=n.prefix){const e=r[1];let t=r[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&r.length===2+e&&e>=1&&e<=75){const e=_.toWords(r.slice(2));return e.unshift(t),_.encode(n.prefix,e)}}return null}getAddress(e){return Vr(this,void 0,void 0,function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===J.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",Jr(e));if(null==t||"0x"===t)return null;const n=this._getAddress(e,t);return null==n&&Hr.throwError("invalid or unsupported coin data",J.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),n})}getAvatar(){return Vr(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let n=0;n<ei.length;n++){const r=t.match(ei[n]);if(null==r)continue;const i=r[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:ri(t)};case"erc721":case"erc1155":{const n="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});const s=this._resolvedAddress||(yield this.getAddress()),o=(r[2]||"").split("/");if(2!==o.length)return null;const a=yield this.provider.formatter.address(o[0]),l=pe(we.from(o[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:he(["0x6352211e",l])}));if(s!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=we.from(yield this.provider.call({to:a,data:he(["0x00fdd58e",pe(s,32),l])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const c={to:this.provider.formatter.address(o[0]),data:he([n,l])};let u=ti(yield this.provider.call(c),0);if(null==u)return null;e.push({type:"metadata-url-base",content:u}),"erc1155"===i&&(u=u.replace("{id}",l.substring(2)),e.push({type:"metadata-url-expanded",content:u})),u.match(/^ipfs:/i)&&(u=ri(u)),e.push({type:"metadata-url",content:u});const d=yield Ln(u);if(!d)return null;e.push({type:"metadata",content:JSON.stringify(d)});let h=d.image;if("string"!=typeof h)return null;if(h.match(/^(https:\/\/|data:)/i));else{if(null==h.match(Zr))return null;e.push({type:"url-ipfs",content:h}),h=ri(h)}return e.push({type:"url",content:h}),{linkage:e,url:h}}}}}catch(e){}return null})}getContentHash(){return Vr(this,void 0,void 0,function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+dt.encode("0x"+t[1])}const n=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const e=parseInt(n[3],16);if(n[4].length===2*e)return"ipns://"+dt.encode("0x"+n[1])}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&64===r[1].length)return"bzz://"+r[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"};return"sia://"+ct("0x"+i[1]).replace(/[=+\/]/g,t=>e[t])}return Hr.throwError("invalid or unsupported content hash data",J.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return Vr(this,void 0,void 0,function*(){let t=Ot(e);t=se([Jr(64),Jr(t.length),t]),t.length%32!=0&&(t=se([t,pe("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",ce(t));return null==n||"0x"===n?null:Dt(n)})}}let li=null,ci=1;class ui extends et{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),He(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(e=>{}),this._ready().catch(e=>{});else{const t=je(new.target,"getNetwork")(e);t?(He(this,"_network",t),this.emit("network",t,null)):Hr.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Vr(this,void 0,void 0,function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||Hr.throwError("no network detected",J.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:He(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Fn(()=>this._ready().then(e=>e,e=>{if(e.code!==J.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))}static getFormatter(){return null==li&&(li=new Ur),li}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in at){const n=at[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=at[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=at[e.name];if(!t)return"number"!=typeof e.chainId&&tt.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&tt.throwArgumentError("network chainId mismatch","network",e);let n=e._defaultProvider||null;var r;return null==n&&t._defaultProvider&&(n=(r=t._defaultProvider)&&"function"==typeof r.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:n}}(null==e?"homestead":e)}ccipReadFetch(e,t,n){return Vr(this,void 0,void 0,function*(){if(this.disableCcipRead||0===n.length)return null;const r=e.to.toLowerCase(),i=t.toLowerCase(),s=[];for(let e=0;e<n.length;e++){const t=n[e],o=t.replace("{sender}",r).replace("{data}",i),a=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:r}),l=yield Ln({url:o,errorPassThrough:!0},a,(e,t)=>(e.status=t.statusCode,e));if(l.data)return l.data;const c=l.message||"unknown error";if(l.status>=400&&l.status<500)return Hr.throwError(`response not found during CCIP fetch: ${c}`,J.errors.SERVER_ERROR,{url:t,errorMessage:c});s.push(c)}return Hr.throwError(`error encountered during CCIP fetch: ${s.map(e=>JSON.stringify(e)).join(", ")}`,J.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return Vr(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const n=yield t;if(Gr()-n.respTime<=e)return n.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=Gr(),n=Qe({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(e=>null,e=>e)}).then(({blockNumber:e,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=Gr();return(e=we.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}});return this._internalBlockNumber=n,n.catch(e=>{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return Vr(this,void 0,void 0,function*(){const e=ci++,t=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)Hr.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",Hr.makeError("network block skew detected",J.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let e=this._emitted.block+1;e<=n;e++)this.emit("block",e);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&n-t>12&&delete this._emitted[e]})),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach(e=>{switch(e.type){case"tx":{const n=e.hash;let r=this.getTransactionReceipt(n).then(e=>e&&null!=e.blockNumber?(this._emitted["t:"+n]=e.blockNumber,this.emit(n,e),null):null).catch(e=>{this.emit("error",e)});t.push(r);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);const r=e.filter;r.fromBlock=e._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const s=this.getLogs(r).then(t=>{e._inflight=!1,0!==t.length&&t.forEach(t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(r,t)})}).catch(t=>{this.emit("error",t),e._inflight=!1});t.push(s)}}}),this._lastBlockNumber=n,Promise.all(t).then(()=>{this.emit("didPoll",e)}).catch(e=>{this.emit("error",e)})}else this.emit("didPoll",e)})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Vr(this,void 0,void 0,function*(){return Hr.throwError("provider does not support network detection",J.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return Vr(this,void 0,void 0,function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield Xr(0),this._network;const n=Hr.makeError("underlying network changed",J.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=Gr();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=Gr(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,n){return Vr(this,void 0,void 0,function*(){return this._waitForTransaction(e,null==t?1:t,n||0,null)})}_waitForTransaction(e,t,n,r){return Vr(this,void 0,void 0,function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise((i,s)=>{const o=[];let a=!1;const l=function(){return!!a||(a=!0,o.forEach(e=>{e()}),!1)},c=e=>{e.confirmations<t||l()||i(e)};if(this.on(e,c),o.push(()=>{this.removeListener(e,c)}),r){let n=r.startBlock,i=null;const c=o=>Vr(this,void 0,void 0,function*(){a||(yield Xr(1e3),this.getTransactionCount(r.from).then(u=>Vr(this,void 0,void 0,function*(){if(!a){if(u<=r.nonce)n=o;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=n-3,i<r.startBlock&&(i=r.startBlock));i<=o;){if(a)return;const n=yield this.getBlockWithTransactions(i);for(let i=0;i<n.transactions.length;i++){const o=n.transactions[i];if(o.hash===e)return;if(o.from===r.from&&o.nonce===r.nonce){if(a)return;const n=yield this.waitForTransaction(o.hash,t);if(l())return;let i="replaced";return o.data===r.data&&o.to===r.to&&o.value.eq(r.value)?i="repriced":"0x"===o.data&&o.from===o.to&&o.value.isZero()&&(i="cancelled"),void s(Hr.makeError("transaction was replaced",J.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(o),hash:e,receipt:n}))}}i++}}a||this.once("block",c)}}),e=>{a||this.once("block",c)}))});if(a)return;this.once("block",c),o.push(()=>{this.removeListener("block",c)})}if("number"==typeof n&&n>0){const e=setTimeout(()=>{l()||s(Hr.makeError("timeout exceeded",J.errors.TIMEOUT,{timeout:n}))},n);e.unref&&e.unref(),o.push(()=>{clearTimeout(e)})}})})}getBlockNumber(){return Vr(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return we.from(e)}catch(t){return Hr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Qe({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getBalance",n);try{return we.from(r)}catch(e){return Hr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:e})}})}getTransactionCount(e,t){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Qe({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getTransactionCount",n);try{return we.from(r).toNumber()}catch(e){return Hr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:e})}})}getCode(e,t){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Qe({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getCode",n);try{return ce(r)}catch(e){return Hr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:e})}})}getStorageAt(e,t,n){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Qe({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(t).then(e=>fe(e))}),i=yield this.perform("getStorageAt",r);try{return ce(i)}catch(e){return Hr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:e})}})}_wrapTransaction(e,t,n){if(null!=t&&32!==ue(t))throw new Error("invalid response - sendTransaction");const r=e;return null!=t&&e.hash!==t&&Hr.throwError("Transaction hash mismatch from Provider.sendTransaction.",J.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),r.wait=(t,r)=>Vr(this,void 0,void 0,function*(){let i;null==t&&(t=1),null==r&&(r=0),0!==t&&null!=n&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const s=yield this._waitForTransaction(e.hash,t,r,i);return null==s&&0===t?null:(this._emitted["t:"+e.hash]=s.blockNumber,0===s.status&&Hr.throwError("transaction failed",J.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:s}),s)}),r}sendTransaction(e){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(e=>ce(e)),n=this.formatter.transaction(e);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(n,e,r)}catch(e){throw e.transaction=n,e.transactionHash=n.hash,e}})}_getTransactionRequest(e){return Vr(this,void 0,void 0,function*(){const t=yield e,n={};return["from","to"].forEach(e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then(e=>e?this._getAddress(e):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then(e=>e?we.from(e):null))}),["type"].forEach(e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then(e=>null!=e?e:null))}),t.accessList&&(n.accessList=this.formatter.accessList(t.accessList)),["data"].forEach(e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then(e=>e?ce(e):null))}),this.formatter.transactionRequest(yield Qe(n))})}_getFilter(e){return Vr(this,void 0,void 0,function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{null!=e[n]&&(t[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{null!=e[n]&&(t[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield Qe(t))})}_call(e,t,n){return Vr(this,void 0,void 0,function*(){n>=10&&Hr.throwError("CCIP read exceeded maximum redirections",J.errors.SERVER_ERROR,{redirects:n,transaction:e});const r=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(n>=0&&"latest"===t&&null!=r&&"0x556f1830"===i.substring(0,10)&&ue(i)%32==4)try{const s=de(i,4),o=de(s,0,32);we.from(o).eq(r)||Hr.throwError("CCIP Read sender did not match",J.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],l=we.from(de(s,32,64)).toNumber(),c=we.from(de(s,l,l+32)).toNumber(),u=de(s,l+32);for(let t=0;t<c;t++){const n=ti(u,32*t);null==n&&Hr.throwError("CCIP Read contained corrupt URL string",J.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),a.push(n)}const d=ni(s,64);we.from(de(s,100,128)).isZero()||Hr.throwError("CCIP Read callback selector included junk",J.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const h=de(s,96,100),f=ni(s,128),p=yield this.ccipReadFetch(e,d,a);null==p&&Hr.throwError("CCIP Read disabled or provided no URLs",J.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const m={to:r,data:he([h,oi([p,f])])};return this._call(m,t,n+1)}catch(e){if(e.code===J.errors.SERVER_ERROR)throw e}try{return ce(i)}catch(n){return Hr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:n})}})}call(e,t){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Qe({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(n.transaction,n.blockTag,n.ccipReadEnabled?0:-1)})}estimateGas(e){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Qe({transaction:this._getTransactionRequest(e)}),n=yield this.perform("estimateGas",t);try{return we.from(n)}catch(e){return Hr.throwError("bad result from backend",J.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:n,error:e})}})}_getAddress(e){return Vr(this,void 0,void 0,function*(){"string"!=typeof(e=yield e)&&Hr.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&Hr.throwError("ENS name not configured",J.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t})}_getBlock(e,t){return Vr(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let n=-128;const r={includeTransactions:!!t};if(ae(e,32))r.blockHash=e;else try{r.blockTag=yield this._getBlockTag(e),ae(r.blockTag)&&(n=parseInt(r.blockTag.substring(2),16))}catch(t){Hr.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return Fn(()=>Vr(this,void 0,void 0,function*(){const e=yield this.perform("getBlock",r);if(null==e)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(t){let t=null;for(let n=0;n<e.transactions.length;n++){const r=e.transactions[n];if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}}const n=this.formatter.blockWithTransactions(e);return n.transactions=n.transactions.map(e=>this._wrapTransaction(e)),n}return this.formatter.block(e)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Vr(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Fn(()=>Vr(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return this._wrapTransaction(r)}),{oncePoll:this})})}getTransactionReceipt(e){return Vr(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Fn(()=>Vr(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return r}),{oncePoll:this})})}getLogs(e){return Vr(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Qe({filter:this._getFilter(e)}),n=yield this.perform("getLogs",t);return n.forEach(e=>{null==e.removed&&(e.removed=!1)}),Ur.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return Vr(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return Vr(this,void 0,void 0,function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&Hr.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)})}getResolver(e){return Vr(this,void 0,void 0,function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const n=yield this._getResolver(t,"getResolver");if(null!=n){const r=new ai(this,n,e);return t===e||(yield r.supportsWildcard())?r:null}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return Vr(this,void 0,void 0,function*(){null==t&&(t="ENS");const n=yield this.getNetwork();n.ensAddress||Hr.throwError("network does not support ENS",J.errors.UNSUPPORTED_OPERATION,{operation:t,network:n.name});try{const t=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+zt(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null})}resolveName(e){return Vr(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(ae(e))throw t}"string"!=typeof e&&Hr.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return Vr(this,void 0,void 0,function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(t,"lookupAddress");if(null==n)return null;const r=ti(yield this.call({to:n,data:"0x691f3431"+zt(t).substring(2)}),0);return(yield this.resolveName(r))!=e?null:r})}getAvatar(e){return Vr(this,void 0,void 0,function*(){let t=null;if(ae(e)){const n=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;t=new ai(this,r,n);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==J.errors.CALL_EXCEPTION)throw e}try{const e=ti(yield this.call({to:r,data:"0x691f3431"+zt(n).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==J.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const n=yield t.getAvatar();return null==n?null:n.url})}perform(e,t){return Hr.throwError(e+" not implemented",J.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(e=>e.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(e=>e.pollable()).length>0}_addEventListener(e,t,n){const r=new Kr(Yr(e),t,n);return this._events.push(r),this._startEvent(r),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let n=!1,r=[],i=Yr(e);return this._events=this._events.filter(e=>e.tag!==i||(setTimeout(()=>{e.listener.apply(this,t)},0),n=!0,!e.once||(r.push(e),!1))),r.forEach(e=>{this._stopEvent(e)}),n}listenerCount(e){if(!e)return this._events.length;let t=Yr(e);return this._events.filter(e=>e.tag===t).length}listeners(e){if(null==e)return this._events.map(e=>e.listener);let t=Yr(e);return this._events.filter(e=>e.tag===t).map(e=>e.listener)}off(e,t){if(null==t)return this.removeAllListeners(e);const n=[];let r=!1,i=Yr(e);return this._events=this._events.filter(e=>e.tag!==i||e.listener!=t||(!!r||(r=!0,n.push(e),!1))),n.forEach(e=>{this._stopEvent(e)}),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const n=Yr(e);this._events=this._events.filter(e=>e.tag!==n||(t.push(e),!1))}return t.forEach(e=>{this._stopEvent(e)}),this}}var di=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const hi=new J("abstract-signer/5.8.0"),fi=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pi=[J.errors.INSUFFICIENT_FUNDS,J.errors.NONCE_EXPIRED,J.errors.REPLACEMENT_UNDERPRICED];class mi{constructor(){hi.checkAbstract(new.target,mi),He(this,"_isSigner",!0)}getBalance(e){return di(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return di(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return di(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield Qe(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return di(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield Qe(this.checkTransaction(e));return yield this.provider.call(n,t)})}sendTransaction(e){return di(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),n=yield this.signTransaction(t);return yield this.provider.sendTransaction(n)})}getChainId(){return di(this,void 0,void 0,function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId})}getGasPrice(){return di(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return di(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return di(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const t in e)-1===fi.indexOf(t)&&hi.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=Ye(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then(t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&hi.throwArgumentError("from address mismatch","transaction",e),t[0])),t}populateTransaction(e){return di(this,void 0,void 0,function*(){const t=yield Qe(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then(e=>di(this,void 0,void 0,function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&hi.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})),t.to.catch(e=>{}));const n=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!n?0!==t.type&&1!==t.type||!n||hi.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):hi.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(n&&hi.throwError("network does not support EIP-1559",J.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):hi.throwError("failed to get consistent fee data",J.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch(e=>{if(pi.indexOf(e.code)>=0)throw e;return hi.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",J.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})})),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then(t=>(0!==t[1]&&t[0]!==t[1]&&hi.throwArgumentError("chainId address mismatch","transaction",e),t[0])),yield Qe(t)})}_checkProvider(e){this.provider||hi.throwError("missing provider",J.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class gi extends mi{constructor(e,t){super(),He(this,"address",e),He(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{hi.throwError(e,J.errors.UNSUPPORTED_OPERATION,{operation:t})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new gi(this.address,e)}}var yi=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const Ai=new J(Mn),Ei=["call","estimateGas"];function bi(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const n=ae(e.data)?e.data:null;if(!t||n)return{message:e.message,data:n}}if("object"==typeof e){for(const n in e){const r=bi(e[n],t);if(r)return r}return null}if("string"==typeof e)try{return bi(JSON.parse(e),t)}catch(e){}return null}function vi(e,t,n){const r=n.transaction||n.signedTransaction;if("call"===e){const e=bi(t,!0);if(e)return e.data;Ai.throwError("missing revert data in call exception; Transaction reverted without a reason string",J.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:t})}if("estimateGas"===e){let n=bi(t.body,!1);null==n&&(n=bi(t,!1)),n&&Ai.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",J.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:e,transaction:r,error:t})}let i=t.message;throw t.code===J.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Ai.throwError("insufficient funds for intrinsic transaction cost",J.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/nonce (is )?too low/i)&&Ai.throwError("nonce has already been used",J.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Ai.throwError("replacement fee too low",J.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/only replay-protected/i)&&Ai.throwError("legacy pre-eip-155 transactions not supported",J.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:r}),Ei.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Ai.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",J.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}function wi(e){return new Promise(function(t){setTimeout(t,e)})}function Oi(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function Di(e){return e?e.toLowerCase():e}const Ti={};class _i extends mi{constructor(e,t,n){if(super(),e!==Ti)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");He(this,"provider",t),null==n&&(n=0),"string"==typeof n?(He(this,"_address",this.provider.formatter.address(n)),He(this,"_index",null)):"number"==typeof n?(He(this,"_index",n),He(this,"_address",null)):Ai.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return Ai.throwError("cannot alter JSON-RPC Signer connection",J.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Pi(Ti,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&Ai.throwError("unknown account #"+this._index,J.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=Ye(e);const t=this.getAddress().then(e=>(e&&(e=e.toLowerCase()),e));if(null==e.gasLimit){const n=Ye(e);n.from=t,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then(e=>yi(this,void 0,void 0,function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&Ai.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))),Qe({tx:Qe(e),sender:t}).then(({tx:t,sender:n})=>{null!=t.from?t.from.toLowerCase()!==n&&Ai.throwArgumentError("from address mismatch","transaction",e):t.from=n;const r=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then(e=>e,e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&Ai.throwError("user rejected transaction",J.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),vi("sendTransaction",e,r)))})}signTransaction(e){return Ai.throwError("signing transactions is unsupported",J.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return yi(this,void 0,void 0,function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield Fn(()=>yi(this,void 0,void 0,function*(){const e=yield this.provider.getTransaction(n);if(null!==e)return this.provider._wrapTransaction(e,n,t)}),{oncePoll:this.provider})}catch(e){throw e.transactionHash=n,e}})}signMessage(e){return yi(this,void 0,void 0,function*(){const t="string"==typeof e?Ot(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[ce(t),n.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Ai.throwError("user rejected signing",J.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),t}})}_legacySignMessage(e){return yi(this,void 0,void 0,function*(){const t="string"==typeof e?Ot(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),ce(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Ai.throwError("user rejected signing",J.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),t}})}_signTypedData(e,t,n){return yi(this,void 0,void 0,function*(){const r=yield Rn.resolveNames(e,t,n,e=>this.provider.resolveName(e)),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Rn.getPayload(r.domain,t,r.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&Ai.throwError("user rejected signing",J.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:t,value:r.value}}),e}})}unlock(e){return yi(this,void 0,void 0,function*(){const t=this.provider,n=yield this.getAddress();return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class Pi extends _i{sendTransaction(e){return this.sendUncheckedTransaction(e).then(e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)}))}}const Ri={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Ii extends ui{constructor(e,t){let n=t;null==n&&(n=new Promise((e,t)=>{setTimeout(()=>{this.detectNetwork().then(t=>{e(t)},e=>{t(e)})},0)})),super(n),e||(e=je(this.constructor,"defaultUrl")()),He(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(Ye(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return yi(this,void 0,void 0,function*(){yield wi(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=je(this.constructor,"getNetwork");try{return t(we.from(e).toNumber())}catch(t){return Ai.throwError("could not detect network",J.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return Ai.throwError("could not detect network",J.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new _i(Ti,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(e=>this.formatter.address(e)))}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Ke(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const i=Ln(this.connection,JSON.stringify(n),Oi).then(e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e),e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e});return r&&(this._cache[e]=i,setTimeout(()=>{this._cache[e]=null},0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Di(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Di(t.address),t.blockTag]];case"getCode":return["eth_getCode",[Di(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Di(t.address),pe(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[je(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[je(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=Di(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return yi(this,void 0,void 0,function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&we.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((t=Ye(t)).transaction=Ye(e),delete t.transaction.type)}}const n=this.prepareRequest(e,t);null==n&&Ai.throwError(e+" not implemented",J.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(n){return vi(e,n,t)}})}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then(function(n){return function r(){e.send("eth_getFilterChanges",[n]).then(function(n){if(e._pendingFilter!=t)return null;let r=Promise.resolve();return n.forEach(function(t){e._emitted["t:"+t.toLowerCase()]="pending",r=r.then(function(){return e.getTransaction(t).then(function(t){return e.emit("pending",t),null})})}),r.then(function(){return wi(1e3)})}).then(function(){if(e._pendingFilter==t)return setTimeout(function(){r()},0),null;e.send("eth_uninstallFilter",[n])}).catch(e=>{})}(),n}).catch(e=>{})}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const n=Ye(Ri);if(t)for(const e in t)t[e]&&(n[e]=!0);var r,i;i=n,(r=e)&&"object"==typeof r||Ve.throwArgumentError("invalid object","object",r),Object.keys(r).forEach(e=>{i[e]||Ve.throwArgumentError("invalid object key - "+e,"transaction:"+e,r)});const s={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(t){if(null==e[t])return;const n=fe(we.from(e[t]));"gasLimit"===t&&(t="gas"),s[t]=n}),["from","to","data"].forEach(function(t){null!=e[t]&&(s[t]=ce(e[t]))}),e.accessList&&(s.accessList=Nr(e.accessList)),s}}var Ci=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const ki=new J(Mn);class Bi extends Ii{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return Ci(this,void 0,void 0,function*(){let t=this.network;return null==t&&(t=yield e.detectNetwork.call(this),t||ki.throwError("no network detected",J.errors.UNKNOWN_ERROR,{}),null==this._network&&(He(this,"_network",t),this.emit("network",t,null))),t})}}const Ni="abi/5.8.0",xi=new J(Ni),Si={};let Li={calldata:!0,memory:!0,storage:!0},Fi={calldata:!0,memory:!0};function Mi(e,t){if("bytes"===e||"string"===e){if(Li[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Fi[t])return!0;return(Li[t]||"payable"===t)&&xi.throwArgumentError("invalid modifier","name",t),!1}function qi(e,t){for(let n in t)He(e,n,t[n])}const Ui=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Vi=new RegExp(/^(.*)\[([0-9]*)\]$/);class Hi{constructor(e,t){e!==Si&&xi.throwError("use fromString",J.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),qi(this,t);let n=this.type.match(Vi);qi(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:Hi.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=Ui.sighash),Ui[e]||xi.throwArgumentError("invalid format type","format",e),e===Ui.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map(t=>JSON.parse(t.format(e)))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Ui.sighash&&(t+=this.type),t+="("+this.components.map(t=>t.format(e)).join(e===Ui.full?", ":",")+")"):t+=this.type,e!==Ui.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Ui.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?Hi.fromString(e,t):Hi.fromObject(e)}static fromObject(e){return Hi.isParamType(e)?e:new Hi(Si,{name:e.name||null,type:Zi(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(Hi.fromObject):null})}static fromString(e,t){return n=function(e,t){let n=e;function r(t){xi.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let s={type:"",name:"",state:{allowType:!0}},o=s;for(let n=0;n<e.length;n++){let s=e[n];switch(s){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||r(n),o.state.allowType=!1,o.type=Zi(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),Mi(o.type,o.name)&&(o.name=""),o.type=Zi(o.type);let e=o;o=o.parent,o||r(n),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),Mi(o.type,o.name)&&(o.name=""),o.type=Zi(o.type);let a=i(o.parent);o.parent.components.push(a),delete o.parent,o=a;break;case" ":o.state.allowType&&""!==o.type&&(o.type=Zi(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||r(n),o.indexed&&r(n),o.indexed=!0,o.name=""):Mi(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||r(n),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||r(n),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:r(n)}}return o.parent&&xi.throwArgumentError("unexpected eof","param",e),delete s.state,"indexed"===o.name?(t||r(n.length-7),o.indexed&&r(n.length-7),o.indexed=!0,o.name=""):Mi(o.type,o.name)&&(o.name=""),s.type=Zi(s.type),s}(e,!!t),Hi.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}}function ji(e,t){return function(e){e=e.trim();let t=[],n="",r=0;for(let i=0;i<e.length;i++){let s=e[i];","===s&&0===r?(t.push(n),n=""):(n+=s,"("===s?r++:")"===s&&(r--,-1===r&&xi.throwArgumentError("unbalanced parenthesis","value",e)))}n&&t.push(n);return t}(e).map(e=>Hi.fromString(e,t))}class Qi{constructor(e,t){e!==Si&&xi.throwError("use a static from method",J.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),qi(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Qi.isFragment(e)?e:"string"==typeof e?Qi.fromString(e):Qi.fromObject(e)}static fromObject(e){if(Qi.isFragment(e))return e;switch(e.type){case"function":return zi.fromObject(e);case"event":return Yi.fromObject(e);case"constructor":return Ki.fromObject(e);case"error":return Wi.fromObject(e);case"fallback":case"receive":return null}return xi.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Yi.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?zi.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Ki.fromString(e.trim()):"error"===e.split(" ")[0]?Wi.fromString(e.substring(5).trim()):xi.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Yi extends Qi{format(e){if(e||(e=Ui.sighash),Ui[e]||xi.throwArgumentError("invalid format type","format",e),e===Ui.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==Ui.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===Ui.full?", ":",")+") ",e!==Ui.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Yi.fromString(e):Yi.fromObject(e)}static fromObject(e){if(Yi.isEventFragment(e))return e;"event"!==e.type&&xi.throwArgumentError("invalid event object","value",e);const t={name:ts(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Hi.fromObject):[],type:"event"};return new Yi(Si,t)}static fromString(e){let t=e.match(ns);t||xi.throwArgumentError("invalid event string","value",e);let n=!1;return t[3].split(" ").forEach(e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:xi.warn("unknown modifier: "+e)}}),Yi.fromObject({name:t[1].trim(),anonymous:n,inputs:ji(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function Gi(e,t){t.gas=null;let n=e.split("@");return 1!==n.length?(n.length>2&&xi.throwArgumentError("invalid human-readable ABI signature","value",e),n[1].match(/^[0-9]+$/)||xi.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=we.from(n[1]),n[0]):e}function Xi(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach(e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}})}function $i(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&xi.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&xi.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||xi.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&xi.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&xi.throwArgumentError("unable to determine stateMutability","value",e),t}class Ki extends Qi{format(e){if(e||(e=Ui.sighash),Ui[e]||xi.throwArgumentError("invalid format type","format",e),e===Ui.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});e===Ui.sighash&&xi.throwError("cannot format a constructor for sighash",J.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(t=>t.format(e)).join(e===Ui.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?Ki.fromString(e):Ki.fromObject(e)}static fromObject(e){if(Ki.isConstructorFragment(e))return e;"constructor"!==e.type&&xi.throwArgumentError("invalid constructor object","value",e);let t=$i(e);t.constant&&xi.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Hi.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?we.from(e.gas):null};return new Ki(Si,n)}static fromString(e){let t={type:"constructor"},n=(e=Gi(e,t)).match(ns);return n&&"constructor"===n[1].trim()||xi.throwArgumentError("invalid constructor string","value",e),t.inputs=ji(n[2].trim(),!1),Xi(n[3].trim(),t),Ki.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class zi extends Ki{format(e){if(e||(e=Ui.sighash),Ui[e]||xi.throwArgumentError("invalid format type","format",e),e===Ui.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(t=>JSON.parse(t.format(e))),outputs:this.outputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==Ui.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===Ui.full?", ":",")+") ",e!==Ui.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(t=>t.format(e)).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?zi.fromString(e):zi.fromObject(e)}static fromObject(e){if(zi.isFunctionFragment(e))return e;"function"!==e.type&&xi.throwArgumentError("invalid function object","value",e);let t=$i(e);const n={type:e.type,name:ts(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Hi.fromObject):[],outputs:e.outputs?e.outputs.map(Hi.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?we.from(e.gas):null};return new zi(Si,n)}static fromString(e){let t={type:"function"},n=(e=Gi(e,t)).split(" returns ");n.length>2&&xi.throwArgumentError("invalid function string","value",e);let r=n[0].match(ns);if(r||xi.throwArgumentError("invalid function signature","value",e),t.name=r[1].trim(),t.name&&ts(t.name),t.inputs=ji(r[2],!1),Xi(r[3].trim(),t),n.length>1){let r=n[1].match(ns);""==r[1].trim()&&""==r[3].trim()||xi.throwArgumentError("unexpected tokens","value",e),t.outputs=ji(r[2],!1)}else t.outputs=[];return zi.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function Ji(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||xi.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class Wi extends Qi{format(e){if(e||(e=Ui.sighash),Ui[e]||xi.throwArgumentError("invalid format type","format",e),e===Ui.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==Ui.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===Ui.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?Wi.fromString(e):Wi.fromObject(e)}static fromObject(e){if(Wi.isErrorFragment(e))return e;"error"!==e.type&&xi.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:ts(e.name),inputs:e.inputs?e.inputs.map(Hi.fromObject):[]};return Ji(new Wi(Si,t))}static fromString(e){let t={type:"error"},n=e.match(ns);return n||xi.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&ts(t.name),t.inputs=ji(n[2],!1),Ji(Wi.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function Zi(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const es=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function ts(e){return e&&e.match(es)||xi.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const ns=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const rs=new J(Ni);class is{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){rs.throwArgumentError(e,this.localName,t)}}class ss{constructor(e){He(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return he(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(se(e._data))}writeBytes(e){let t=ie(e);const n=t.length%this.wordSize;return n&&(t=se([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=ie(we.from(e));return t.length>this.wordSize&&rs.throwError("value out-of-bounds",J.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=se([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class os{constructor(e,t,n,r){He(this,"_data",ie(e)),He(this,"wordSize",t||32),He(this,"_coerceFunc",n),He(this,"allowLoose",r),this._offset=0}get data(){return ce(this._data)}get consumed(){return this._offset}static coerce(e,t){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):os.coerce(e,t)}_peekBytes(e,t,n){let r=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+t<=this._data.length?r=t:rs.throwError("data out-of-bounds",J.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(e){return new os(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let n=this._peekBytes(0,e,!!t);return this._offset+=n.length,n.slice(0,e)}readValue(){return we.from(this.readBytes(this.wordSize))}}class as extends is{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=dn(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return dn(pe(e.readValue().toHexString(),20))}}class ls extends is{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const cs=new J(Ni);function us(e,t,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map(t=>{const r=t.localName;return r||cs.throwError("cannot encode object for signature with missing names",J.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]&&cs.throwError("cannot encode object for signature with duplicate names",J.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]=!0,n[r]})}else cs.throwArgumentError("invalid tuple value","tuple",n);t.length!==r.length&&cs.throwArgumentError("types/value length mismatch","tuple",n);let i=new ss(e.wordSize),s=new ss(e.wordSize),o=[];t.forEach((e,t)=>{let n=r[t];if(e.dynamic){let t=s.length;e.encode(s,n);let r=i.writeUpdatableValue();o.push(e=>{r(e+t)})}else e.encode(i,n)}),o.forEach(e=>{e(i.length)});let a=e.appendWriter(i);return a+=e.appendWriter(s),a}function ds(e,t){let n=[],r=e.subReader(0);t.forEach(t=>{let i=null;if(t.dynamic){let n=e.readValue(),s=r.subReader(n.toNumber());try{i=t.decode(s)}catch(e){if(e.code===J.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===J.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&n.push(i)});const i=t.reduce((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});t.forEach((e,t)=>{let r=e.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const s=n[t];s instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw s}}):n[r]=s});for(let e=0;e<n.length;e++){const t=n[e];t instanceof Error&&Object.defineProperty(n,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(n)}class hs extends is{constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let n=this.length;-1===n&&(n=t.length,e.writeValue(t.length)),cs.checkArgumentCount(t.length,n,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let e=0;e<t.length;e++)r.push(this.coder);return us(e,r,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&cs.throwError("insufficient data length",J.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let n=[];for(let e=0;e<t;e++)n.push(new ls(this.coder));return e.coerce(this.name,ds(e,n))}}class fs extends is{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class ps extends is{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=ie(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class ms extends ps{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,ce(super.decode(e)))}}class gs extends is{constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=ie(t);return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return e.coerce(this.name,ce(e.readBytes(this.size)))}}class ys extends is{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}class As extends is{constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let n=we.from(t),r=mt.mask(8*e.wordSize);if(this.signed){let e=r.mask(8*this.size-1);(n.gt(e)||n.lt(e.add(pt).mul(ht)))&&this._throwError("value out-of-bounds",t)}else(n.lt(ft)||n.gt(r.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(n)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}class Es extends ps{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Ot(t))}decode(e){return Dt(super.decode(e))}}class bs extends is{constructor(e,t){let n=!1;const r=[];e.forEach(e=>{e.dynamic&&(n=!0),r.push(e.type)});super("tuple","tuple("+r.join(",")+")",t,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(t=>{e.push(t.defaultValue())});const t=this.coders.reduce((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});return this.coders.forEach((n,r)=>{let i=n.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[r]))}),Object.freeze(e)}encode(e,t){return us(e,this.coders,t)}decode(e){return e.coerce(this.name,ds(e,this.coders))}}const vs=new J(Ni),ws=new RegExp(/^bytes([0-9]*)$/),Os=new RegExp(/^(u?int)([0-9]*)$/);const Ds=new class{constructor(e){He(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new as(e.name);case"bool":return new fs(e.name);case"string":return new Es(e.name);case"bytes":return new ms(e.name);case"array":return new hs(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new bs((e.components||[]).map(e=>this._getCoder(e)),e.name);case"":return new ys(e.name)}let t=e.type.match(Os);if(t){let n=parseInt(t[2]||"256");return(0===n||n>256||n%8!=0)&&vs.throwArgumentError("invalid "+t[1]+" bit length","param",e),new As(n/8,"int"===t[1],e.name)}if(t=e.type.match(ws),t){let n=parseInt(t[1]);return(0===n||n>32)&&vs.throwArgumentError("invalid bytes length","param",e),new gs(n,e.name)}return vs.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new os(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new ss(this._getWordSize())}getDefaultValue(e){const t=e.map(e=>this._getCoder(Hi.from(e)));return new bs(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&vs.throwError("types/values length mismatch",J.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const n=e.map(e=>this._getCoder(Hi.from(e))),r=new bs(n,"_"),i=this._getWriter();return r.encode(i,t),i.data}decode(e,t,n){const r=e.map(e=>this._getCoder(Hi.from(e)));return new bs(r,"_").decode(this._getReader(ie(t),n))}},Ts=new J(Ni);class _s extends ze{}class Ps extends ze{}class Rs extends ze{}class Is extends ze{static isIndexed(e){return!(!e||!e._isIndexed)}}const Cs={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function ks(e,t){const n=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return n.error=t,n}class Bs{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,He(this,"fragments",t.map(e=>Qi.from(e)).filter(e=>null!=e)),He(this,"_abiCoder",je(new.target,"getAbiCoder")()),He(this,"functions",{}),He(this,"errors",{}),He(this,"events",{}),He(this,"structs",{}),this.fragments.forEach(e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void Ts.warn("duplicate definition - constructor"):void He(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let n=e.format();t[n]?Ts.warn("duplicate definition - "+n):t[n]=e}),this.deploy||He(this,"deploy",Ki.from({payable:!1,type:"constructor"})),He(this,"_isInterface",!0)}format(e){e||(e=Ui.full),e===Ui.sighash&&Ts.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(t=>t.format(e));return e===Ui.json?JSON.stringify(t.map(e=>JSON.parse(e))):t}static getAbiCoder(){return Ds}static getAddress(e){return dn(e)}static getSighash(e){return de(Tt(e.format()),0,4)}static getEventTopic(e){return Tt(e.format())}getFunction(e){if(ae(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];Ts.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.functions).filter(e=>e.split("(")[0]===t);return 0===n.length?Ts.throwArgumentError("no matching function","name",t):n.length>1&&Ts.throwArgumentError("multiple matching functions","name",t),this.functions[n[0]]}const t=this.functions[zi.fromString(e).format()];return t||Ts.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(ae(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];Ts.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.events).filter(e=>e.split("(")[0]===t);return 0===n.length?Ts.throwArgumentError("no matching event","name",t):n.length>1&&Ts.throwArgumentError("multiple matching events","name",t),this.events[n[0]]}const t=this.events[Yi.fromString(e).format()];return t||Ts.throwArgumentError("no matching event","signature",e),t}getError(e){if(ae(e)){const t=je(this.constructor,"getSighash");for(const n in this.errors){if(e===t(this.errors[n]))return this.errors[n]}Ts.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.errors).filter(e=>e.split("(")[0]===t);return 0===n.length?Ts.throwArgumentError("no matching error","name",t):n.length>1&&Ts.throwArgumentError("multiple matching errors","name",t),this.errors[n[0]]}const t=this.errors[zi.fromString(e).format()];return t||Ts.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return je(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),je(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const n=ie(t);return ce(n.slice(0,4))!==this.getSighash(e)&&Ts.throwArgumentError(`data signature does not match error ${e.name}.`,"data",ce(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),ce(se([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const n=ie(t);return ce(n.slice(0,4))!==this.getSighash(e)&&Ts.throwArgumentError(`data signature does not match function ${e.name}.`,"data",ce(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),ce(se([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let n=ie(t),r=null,i="",s=null,o=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch(e){}break;case 4:{const e=ce(n.slice(0,4)),t=Cs[e];if(t)s=this._abiCoder.decode(t.inputs,n.slice(4)),o=t.name,a=t.signature,t.reason&&(r=s[0]),"Error"===o?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:"Panic"===o&&(i=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const t=this.getError(e);s=this._abiCoder.decode(t.inputs,n.slice(4)),o=t.name,a=t.format()}catch(e){}break}}return Ts.throwError("call revert exception"+i,J.errors.CALL_EXCEPTION,{method:e.format(),data:ce(t),errorArgs:s,errorName:o,errorSignature:a,reason:r})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),ce(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Ts.throwError("too many arguments for "+e.format(),J.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let n=[];e.anonymous||n.push(this.getEventTopic(e));const r=(e,t)=>"string"===e.type?Tt(t):"bytes"===e.type?gt(ce(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=we.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),pe(ce(t),32));for(t.forEach((t,i)=>{let s=e.inputs[i];s.indexed?null==t?n.push(null):"array"===s.baseType||"tuple"===s.baseType?Ts.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,t):Array.isArray(t)?n.push(t.map(e=>r(s,e))):n.push(r(s,t)):null!=t&&Ts.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.name,t)});n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const n=[],r=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Ts.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((e,s)=>{const o=t[s];if(e.indexed)if("string"===e.type)n.push(Tt(o));else if("bytes"===e.type)n.push(gt(o));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([e.type],[o]))}else r.push(e),i.push(o)}),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(e,t,n){if("string"==typeof e&&(e=this.getEvent(e)),null!=n&&!e.anonymous){let t=this.getEventTopic(e);ae(n[0],32)&&n[0].toLowerCase()===t||Ts.throwError("fragment/topic mismatch",J.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:n[0]}),n=n.slice(1)}let r=[],i=[],s=[];e.inputs.forEach((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(r.push(Hi.fromObject({type:"bytes32",name:e.name})),s.push(!0)):(r.push(e),s.push(!1)):(i.push(e),s.push(!1))});let o=null!=n?this._abiCoder.decode(r,se(n)):null,a=this._abiCoder.decode(i,t,!0),l=[],c=0,u=0;e.inputs.forEach((e,t)=>{if(e.indexed)if(null==o)l[t]=new Is({_isIndexed:!0,hash:null});else if(s[t])l[t]=new Is({_isIndexed:!0,hash:o[u++]});else try{l[t]=o[u++]}catch(e){l[t]=e}else try{l[t]=a[c++]}catch(e){l[t]=e}if(e.name&&null==l[e.name]){const n=l[t];n instanceof Error?Object.defineProperty(l,e.name,{enumerable:!0,get:()=>{throw ks(`property ${JSON.stringify(e.name)}`,n)}}):l[e.name]=n}});for(let e=0;e<l.length;e++){const t=l[e];t instanceof Error&&Object.defineProperty(l,e,{enumerable:!0,get:()=>{throw ks(`index ${e}`,t)}})}return Object.freeze(l)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new Ps({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:we.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new _s({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=ce(e);let n=this.getError(t.substring(0,10).toLowerCase());return n?new Rs({args:this._abiCoder.decode(n.inputs,"0x"+t.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!(!e||!e._isInterface)}}var Ns=function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const xs=new J("contracts/5.8.0");function Ss(e,t){return Ns(this,void 0,void 0,function*(){const n=yield t;"string"!=typeof n&&xs.throwArgumentError("invalid address or ENS name","name",n);try{return dn(n)}catch(e){}e||xs.throwError("a provider or signer is needed to resolve ENS names",J.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield e.resolveName(n);return null==r&&xs.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r})}function Ls(e,t,n){return Ns(this,void 0,void 0,function*(){return Array.isArray(n)?yield Promise.all(n.map((n,r)=>Ls(e,Array.isArray(t)?t[r]:t[n.name],n))):"address"===n.type?yield Ss(e,t):"tuple"===n.type?yield Ls(e,t,n.components):"array"===n.baseType?Array.isArray(t)?yield Promise.all(t.map(t=>Ls(e,t,n.arrayChildren))):Promise.reject(xs.makeError("invalid value for array",J.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t})}function Fs(e,t,n){return Ns(this,void 0,void 0,function*(){let r={};n.length===t.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=Ye(n.pop())),xs.checkArgumentCount(n.length,t.inputs.length,"passed to contract"),e.signer?r.from?r.from=Qe({override:Ss(e.signer,r.from),signer:e.signer.getAddress()}).then(e=>Ns(this,void 0,void 0,function*(){return dn(e.signer)!==e.override&&xs.throwError("Contract with a Signer cannot override from",J.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})):r.from=e.signer.getAddress():r.from&&(r.from=Ss(e.provider,r.from));const i=yield Qe({args:Ls(e.signer||e.provider,n,t.inputs),address:e.resolvedAddress,overrides:Qe(r)||{}}),s=e.interface.encodeFunctionData(t,i.args),o={data:s,to:i.address},a=i.overrides;if(null!=a.nonce&&(o.nonce=we.from(a.nonce).toNumber()),null!=a.gasLimit&&(o.gasLimit=we.from(a.gasLimit)),null!=a.gasPrice&&(o.gasPrice=we.from(a.gasPrice)),null!=a.maxFeePerGas&&(o.maxFeePerGas=we.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(o.maxPriorityFeePerGas=we.from(a.maxPriorityFeePerGas)),null!=a.from&&(o.from=a.from),null!=a.type&&(o.type=a.type),null!=a.accessList&&(o.accessList=Nr(a.accessList)),null==o.gasLimit&&null!=t.gas){let e=21e3;const n=ie(s);for(let t=0;t<n.length;t++)e+=4,n[t]&&(e+=64);o.gasLimit=we.from(t.gas).add(e)}if(a.value){const e=we.from(a.value);e.isZero()||t.payable||xs.throwError("non-payable method cannot override value",J.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),o.value=e}a.customData&&(o.customData=Ye(a.customData)),a.ccipReadEnabled&&(o.ccipReadEnabled=!!a.ccipReadEnabled),delete r.nonce,delete r.gasLimit,delete r.gasPrice,delete r.from,delete r.value,delete r.type,delete r.accessList,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.customData,delete r.ccipReadEnabled;const l=Object.keys(r).filter(e=>null!=r[e]);return l.length&&xs.throwError(`cannot override ${l.map(e=>JSON.stringify(e)).join(",")}`,J.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function Ms(e,t,n){const r=e.signer||e.provider;return function(...i){return Ns(this,void 0,void 0,function*(){let s;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=Ye(i.pop());null!=e.blockTag&&(s=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(s));const o=yield Fs(e,t,i),a=yield r.call(o,s);try{let r=e.interface.decodeFunctionResult(t,a);return n&&1===t.outputs.length&&(r=r[0]),r}catch(t){throw t.code===J.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=o),t}})}}function qs(e,t){return function(...n){return Ns(this,void 0,void 0,function*(){e.signer||xs.throwError("sending a transaction requires a signer",J.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const r=yield Fs(e,t,n),i=yield e.signer.sendTransaction(r);return function(e,t){const n=t.wait.bind(t);t.wait=t=>n(t).then(t=>(t.events=t.logs.map(n=>{let r=Ke(n),i=null;try{i=e.interface.parseLog(n)}catch(e){}return i&&(r.args=i.args,r.decode=(t,n)=>e.interface.decodeEventLog(i.eventFragment,t,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>e.provider,r.getBlock=()=>e.provider.getBlock(t.blockHash),r.getTransaction=()=>e.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(t),r}),t))}(e,i),i})}}function Us(e,t,n){return t.constant?Ms(e,t,n):qs(e,t)}function Vs(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):""):"*"}class Hs{constructor(e,t){He(this,"tag",e),He(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(n=>!(!t&&n.listener===e)||(t=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter(t=>{const n=e.slice();return setTimeout(()=>{t.listener.apply(this,n)},0),!t.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class js extends Hs{constructor(){super("error",null)}}class Qs extends Hs{constructor(e,t,n,r){const i={address:e};let s=t.getEventTopic(n);r?(s!==r[0]&&xs.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[s],super(Vs(i),i),He(this,"address",e),He(this,"interface",t),He(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=function(e){const t=[],n=function(e,r){if(Array.isArray(r))for(let i in r){const s=e.slice();s.push(i);try{n(s,r[i])}catch(e){t.push({path:s,error:e})}}};return n([],e),t}(e.args);if(t.length)throw t[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Ys extends Hs{constructor(e,t){super("*",{address:e}),He(this,"address",e),He(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,n)=>this.interface.decodeEventLog(t.eventFragment,e,n),e.args=t.args}catch(e){}}}class Gs{constructor(e,t,n){He(this,"interface",je(new.target,"getInterface")(t)),null==n?(He(this,"provider",null),He(this,"signer",null)):mi.isSigner(n)?(He(this,"provider",n.provider||null),He(this,"signer",n)):et.isProvider(n)?(He(this,"provider",n),He(this,"signer",null)):xs.throwArgumentError("invalid signer or provider","signerOrProvider",n),He(this,"callStatic",{}),He(this,"estimateGas",{}),He(this,"functions",{}),He(this,"populateTransaction",{}),He(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach(t=>{const n=this.interface.events[t];He(this.filters,t,(...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,e)})),e[n.name]||(e[n.name]=[]),e[n.name].push(t)}),Object.keys(e).forEach(t=>{const n=e[t];1===n.length?He(this.filters,t,this.filters[n[0]]):xs.warn(`Duplicate definition of ${t} (${n.join(", ")})`)})}if(He(this,"_runningEvents",{}),He(this,"_wrappedEmits",{}),null==e&&xs.throwArgumentError("invalid contract address or ENS name","addressOrName",e),He(this,"address",e),this.provider)He(this,"resolvedAddress",Ss(this.provider,e));else try{He(this,"resolvedAddress",Promise.resolve(dn(e)))}catch(e){xs.throwError("provider is required to use ENS name as contract address",J.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(e=>{});const r={},i={};Object.keys(this.interface.functions).forEach(e=>{const t=this.interface.functions[e];if(i[e])xs.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const n=t.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(e)}null==this[e]&&He(this,e,Us(this,t,!0)),null==this.functions[e]&&He(this.functions,e,Us(this,t,!1)),null==this.callStatic[e]&&He(this.callStatic,e,Ms(this,t,!0)),null==this.populateTransaction[e]&&He(this.populateTransaction,e,function(e,t){return function(...n){return Fs(e,t,n)}}(this,t)),null==this.estimateGas[e]&&He(this.estimateGas,e,function(e,t){const n=e.signer||e.provider;return function(...r){return Ns(this,void 0,void 0,function*(){n||xs.throwError("estimate require a provider or signer",J.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fs(e,t,r);return yield n.estimateGas(i)})}}(this,t))}}),Object.keys(r).forEach(e=>{const t=r[e];if(t.length>1)return;e=e.substring(1);const n=t[0];try{null==this[e]&&He(this,e,this[n])}catch(e){}null==this.functions[e]&&He(this.functions,e,this.functions[n]),null==this.callStatic[e]&&He(this.callStatic,e,this.callStatic[n]),null==this.populateTransaction[e]&&He(this.populateTransaction,e,this.populateTransaction[n]),null==this.estimateGas[e]&&He(this.estimateGas,e,this.estimateGas[n])})}static getContractAddress(e){return hn(e)}static getInterface(e){return Bs.isInterface(e)?e:new Bs(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(e=>("0x"===e&&xs.throwError("contract not deployed",J.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||xs.throwError("sending a transactions require a signer",J.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=Ye(e||{});return["from","to"].forEach(function(e){null!=t[e]&&xs.throwError("cannot override "+e,J.errors.UNSUPPORTED_OPERATION,{operation:e})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){"string"==typeof e&&(e=new gi(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&He(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Is.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new js);if("event"===e)return this._normalizeRunningEvent(new Hs("event",null));if("*"===e)return this._normalizeRunningEvent(new Ys(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new Qs(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const n=this.interface.getEvent(t);return this._normalizeRunningEvent(new Qs(this.address,this.interface,n,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Hs(Vs(t),t))}return this._normalizeRunningEvent(new Ys(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,n){const r=Ke(t);return r.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},r.getBlock=()=>this.provider.getBlock(t.blockHash),r.getTransaction=()=>this.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(r),r}_addEventListener(e,t,n){if(this.provider||xs.throwError("events require a provider or a signer with a provider",J.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const n=n=>{let r=this._wrapEvent(e,n,t);if(null==r.decodeError)try{const t=e.getEmit(r);this.emit(e.filter,...t)}catch(e){r.decodeError=e.error}null!=e.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[e.tag]=n,null!=e.filter&&this.provider.on(e.filter,n)}}queryFilter(e,t,n){const r=this._getRunningEvent(e),i=Ye(r.filter);return"string"==typeof t&&ae(t,32)?(null!=n&&xs.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then(e=>e.map(e=>this._wrapEvent(r,e,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const n=this._getRunningEvent(e),r=n.run(t)>0;return this._checkRunningEvents(n),r}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce((e,t)=>e+this._runningEvents[t].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach(t=>{e.push(t)});return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(t),this._checkRunningEvents(n),this}removeListener(e,t){return this.off(e,t)}}class Xs extends Gs{}function $s(e,t,...n){return V(this,void 0,void 0,function*(){const r=[];for(const e of n)for(const t of e)t.callData&&r.push(t.callData);const i=yield function(e,t,n){return V(this,void 0,void 0,function*(){const r=yield Ks(e,t,n),i=new Map;for(const{req:e,resp:t}of r)i.set(e,t);return e.map(e=>({req:e,resp:i.get(e)}))})}(r,e,t),s=new Map;for(const{req:e,resp:t}of i)s.set(e,null==t?void 0:t.result);return n.map(e=>e.filter(e=>!e.callData||s.get(e.callData)).map((e,t)=>e.processor(e.callData?s.get(e.callData):null,t)))})}function Ks(e,t,n){return V(this,void 0,void 0,function*(){let r=[e];e.length>800&&(r=P(e,800));let i=[];const s=r.map(e=>V(this,void 0,void 0,function*(){const r=e.map(e=>[e.to,e.data]),s={data:t.interface.encodeFunctionData("aggregate",[r]),to:n};let o;try{o=yield t.provider.call(s)}catch(r){const s=e.length;if(s>20){const r=Math.floor(s/2),[o,a]=yield Promise.all([Ks(e.slice(0,r),t,n),Ks(e.slice(r,s),t,n)]);i=[...i,...o,...a]}else{const e="[sendCallReqs] error";console.error(e,r)}}if(void 0===o)throw new Error("Unexpected batch result");const[a,l]=Ds.decode(["uint256","bytes[]"],o);if(e.length!==l.length)throw new Error("Unexpected length mismatch");return l.map((t,n)=>({resp:{result:t},req:e[n]}))}));return(yield Promise.allSettled(s)).filter(e=>"fulfilled"===e.status).forEach(({value:e})=>{i=[...i,...e]}),i})}var zs;function Js(e){return V(this,void 0,void 0,function*(){switch(e){case zs.customERC20IsMintable:return[{inputs:[],name:"isMintable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];case zs.customMultiCallAggregate:return[{constant:!1,inputs:[{components:[{name:"target",type:"address"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{name:"blockNumber",type:"uint256"},{name:"returnData",type:"bytes[]"}],payable:!1,stateMutability:"nonpayable",type:"function"}];default:return(yield function(e){switch(e){case"./ABIs/AaveLendingPoolABI.ts":return import("./AaveLendingPoolABI-CdLq16uB.js");case"./ABIs/AaveLendingPoolAddressesProvider.ts":return import("./AaveLendingPoolAddressesProvider-EOSAznLK.js");case"./ABIs/AavePriceOracleABI.ts":return import("./AavePriceOracleABI-C2UEpXR4.js");case"./ABIs/AaveProtocolDataProviderABI.ts":return import("./AaveProtocolDataProviderABI-0JclmmLX.js");case"./ABIs/BaseDrops.ts":return import("./BaseDrops-BrQZPqKk.js");case"./ABIs/D3MM_READ_ABI.ts":return import("./D3MM_READ_ABI-B5536S-z.js");case"./ABIs/D3Proxy.ts":return import("./D3Proxy-CKIzLOhI.js");case"./ABIs/DODO1155.ts":return import("./DODO1155-DDY5Jxhf.js");case"./ABIs/DODO721.ts":return import("./DODO721-Kl5REiwU.js");case"./ABIs/DODOCirculationHelperABI.ts":return import("./DODOCirculationHelperABI-gu1sCqZ2.js");case"./ABIs/DODORouteProxy.ts":return import("./DODORouteProxy-51kl6QgI.js");case"./ABIs/DODOV1PmmHelperABI.ts":return import("./DODOV1PmmHelperABI-DQqthyaE.js");case"./ABIs/DVM.ts":return import("./DVM-DjtWbqiJ.js");case"./ABIs/DropsERC721.ts":return import("./DropsERC721-7Bckjcar.js");case"./ABIs/FilterAdmin.ts":return import("./FilterAdmin-jm_-DS1l.js");case"./ABIs/FilterERC1155V1.ts":return import("./FilterERC1155V1-VIUlIHdF.js");case"./ABIs/FilterERC721V1.ts":return import("./FilterERC721V1-CWDEPGmH.js");case"./ABIs/Fragment.ts":return import("./Fragment-Bd_AXeVx.js");case"./ABIs/FundingABI.ts":return import("./FundingABI-WqQDGVVa.js");case"./ABIs/IdodoV2.ts":return import("./IdodoV2-DlW8pwaE.js");case"./ABIs/LockedTokenVaultABI.ts":return import("./LockedTokenVaultABI-CfBj0wEX.js");case"./ABIs/MarginTrading.ts":return import("./MarginTrading-CQ5odvHB.js");case"./ABIs/MarginTradingFactory.ts":return import("./MarginTradingFactory-2RKqvCSO.js");case"./ABIs/MerkleDistributorABI.ts":return import("./MerkleDistributorABI-Ctn26fnA.js");case"./ABIs/NonfungiblePositionManager.ts":return import("./NonfungiblePositionManager-c8Yw_9-Q.js");case"./ABIs/PancakePairABI.ts":return import("./PancakePairABI-Cc9LuXnX.js");case"./ABIs/UniswapV3Pool.ts":return import("./UniswapV3Pool-Da11VKXE.js");case"./ABIs/baseFilterV1.ts":return import("./baseFilterV1-BPjWXMKw.js");case"./ABIs/classicalPoolABI.ts":return import("./classicalPoolABI-D5LxySAJ.js");case"./ABIs/dodoABI.ts":return import("./dodoABI-CLkEBJ8P.js");case"./ABIs/dodoBuyoutModel.ts":return import("./dodoBuyoutModel-BtQv3C3q.js");case"./ABIs/dodoCP.ts":return import("./dodoCP-N8KA8JwJ.js");case"./ABIs/dodoCPABI.ts":return import("./dodoCPABI-CdAN0KhU.js");case"./ABIs/dodoCPABIV2.ts":return import("./dodoCPABIV2-yzF6FlEg.js");case"./ABIs/dodoCPFactory.ts":return import("./dodoCPFactory-CD0SxXT6.js");case"./ABIs/dodoCpProxy.ts":return import("./dodoCpProxy-D2AI9-4r.js");case"./ABIs/dodoCpProxyV2.ts":return import("./dodoCpProxyV2-CGZRqk2H.js");case"./ABIs/dodoCpProxyV202.ts":return import("./dodoCpProxyV202-CoZaEf_6.js");case"./ABIs/dodoCustomMintableERC20.ts":return import("./dodoCustomMintableERC20-CPpNoX1v.js");case"./ABIs/dodoDPPAdmin.ts":return import("./dodoDPPAdmin-B-fmpTbV.js");case"./ABIs/dodoDPPFactory.ts":return import("./dodoDPPFactory-DwAkVskt.js");case"./ABIs/dodoDSP.ts":return import("./dodoDSP-B6KYm-Cn.js");case"./ABIs/dodoDSPFactory.ts":return import("./dodoDSPFactory-j1eg7Ez-.js");case"./ABIs/dodoDVM.ts":return import("./dodoDVM-DDYx1JAy.js");case"./ABIs/dodoDVMFactory.ts":return import("./dodoDVMFactory-FpnJdZb2.js");case"./ABIs/dodoDppProxy.ts":return import("./dodoDppProxy-A7PPYsqp.js");case"./ABIs/dodoDropsProxy.ts":return import("./dodoDropsProxy-vHUWsRNO.js");case"./ABIs/dodoDspProxy.ts":return import("./dodoDspProxy-CU7OAvJG.js");case"./ABIs/dodoERC20V3Factory.ts":return import("./dodoERC20V3Factory-Cz4XKDrU.js");case"./ABIs/dodoEthProxyABI.ts":return import("./dodoEthProxyABI-CoX95QJI.js");case"./ABIs/dodoFeeImpl.ts":return import("./dodoFeeImpl-zR9Qv4Tq.js");case"./ABIs/dodoFragment.ts":return import("./dodoFragment-4lxmE2XJ.js");case"./ABIs/dodoMineV3Proxy.ts":return import("./dodoMineV3Proxy-xOGM7Jnv.js");case"./ABIs/dodoMineV3ProxyOld.ts":return import("./dodoMineV3ProxyOld-BqsZxJRU.js");case"./ABIs/dodoMiningABI.ts":return import("./dodoMiningABI-9J5C_6kN.js");case"./ABIs/dodoMiningReaderABI.ts":return import("./dodoMiningReaderABI-DmUXA9Gv.js");case"./ABIs/dodoNftERC1155.ts":return import("./dodoNftERC1155-Bw6ID2NE.js");case"./ABIs/dodoNftERC721.ts":return import("./dodoNftERC721-CI1l0ip9.js");case"./ABIs/dodoNftPoolProxy.ts":return import("./dodoNftPoolProxy-DQkcZHUV.js");case"./ABIs/dodoNftProxy.ts":return import("./dodoNftProxy-Di-aoLYM.js");case"./ABIs/dodoNftVault.ts":return import("./dodoNftVault-B4NZaXcd.js");case"./ABIs/dodoOracleABI.ts":return import("./dodoOracleABI-BxwZofBV.js");case"./ABIs/dodoPair.ts":return import("./dodoPair-VN1aEVFz.js");case"./ABIs/dodoPreminingABI.ts":return import("./dodoPreminingABI-DU7ocR7L.js");case"./ABIs/dodoProxyV2.ts":return import("./dodoProxyV2-9ED9HqK5.js");case"./ABIs/dodoStarterProxy.ts":return import("./dodoStarterProxy-B1TdMOvw.js");case"./ABIs/dodoTokenABI.ts":return import("./dodoTokenABI-Dd2DVUbK.js");case"./ABIs/dodoUpCPFactoryABI.ts":return import("./dodoUpCPFactoryABI-C1W0Q4Ft.js");case"./ABIs/dodoUpCpFactory.ts":return import("./dodoUpCpFactory-D8ifQyp-.js");case"./ABIs/dodoV1PairProxy.ts":return import("./dodoV1PairProxy-DyRTqyPe.js");case"./ABIs/dodoZooABI.ts":return import("./dodoZooABI-D9Uc4iLK.js");case"./ABIs/dppPoolABI.ts":return import("./dppPoolABI-BvoeLJgK.js");case"./ABIs/erc20ABI.ts":return import("./erc20ABI-v08X4jmE.js");case"./ABIs/erc20Helper.ts":return import("./erc20Helper-CG659oLz.js");case"./ABIs/feeABI.ts":return import("./feeABI-DnQdJUpQ.js");case"./ABIs/multicallABI.ts":return import("./multicallABI-D9E1EeQD.js");case"./ABIs/nftContract.ts":return import("./nftContract-d4b6ObxG.js");case"./ABIs/nftFilterAdmin.ts":return import("./nftFilterAdmin-DMr_jrK_.js");case"./ABIs/oneBitSettlement.ts":return import("./oneBitSettlement-DMzQ-0t_.js");case"./ABIs/setApprovalForAll.ts":return import("./setApprovalForAll-BvnCORJI.js");case"./ABIs/spaceIdABI.ts":return import("./spaceIdABI-BS4XGAT1.js");case"./ABIs/spaceIdResolverABI.ts":return import("./spaceIdResolverABI-sYDT8GfP.js");case"./ABIs/v3MiningABI.ts":return import("./v3MiningABI-ZjGBkolS.js");case"./ABIs/vdodo.ts":return import("./vdodo-ttc2RVOs.js");case"./ABIs/vdodoTokenABI.ts":return import("./vdodoTokenABI-PldrbOSo.js");case"./ABIs/weth.ts":return import("./weth-Dz5DGEIF.js");default:return Promise.reject(new Error("Unknown variable dynamic import: "+e))}}(`./ABIs/${e}.ts`)).default}})}!function(e){e.customERC20IsMintable="customERC20IsMintable",e.customMultiCallAggregate="customMultiCallAggregate",e.erc20Helper="erc20Helper",e.erc20ABI="erc20ABI",e.erc20Mock="erc20Mock",e.dodoERC20V3Factory="dodoERC20V3Factory",e.dodoCustomMintableERC20="dodoCustomMintableERC20",e.multicallABI="multicallABI",e.dppPoolABI="dppPoolABI",e.dvmPoolABI="DVM",e.classicalPoolABI="classicalPoolABI",e.v3MiningABI="v3MiningABI",e.dodoMiningABI="dodoMiningABI",e.dodoCP="dodoCP",e.dodoCPABI="dodoCPABI",e.dodoCPABIV2="dodoCPABIV2",e.dodoCpProxyV2="dodoCpProxyV2",e.dodoCpProxyV202="dodoCpProxyV202",e.dodoFeeImpl="dodoFeeImpl",e.feeABI="feeABI",e.vdodo="vdodo",e.vdodoTokenABI="vdodoTokenABI",e.dodoPreminingABI="dodoPreminingABI",e.MerkleDistributorABI="MerkleDistributorABI",e.DODOCirculationHelperABI="DODOCirculationHelperABI",e.FundingABI="FundingABI",e.dodoStarterProxy="dodoStarterProxy",e.MarginTrading="MarginTrading",e.MarginTradingFactory="MarginTradingFactory",e.DODORouteProxy="DODORouteProxy",e.dodoProxyV2="dodoProxyV2",e.AaveLendingPoolABI="AaveLendingPoolABI",e.AaveProtocolDataProviderABI="AaveProtocolDataProviderABI",e.AaveLendingPoolAddressesProvider="AaveLendingPoolAddressesProvider",e.AavePriceOracleABI="AavePriceOracleABI",e.spaceIdABI="spaceIdABI",e.spaceIdResolverABI="spaceIdResolverABI",e.dodoABI="dodoABI",e.PancakePairABI="PancakePairABI",e.NonfungiblePositionManager="NonfungiblePositionManager",e.UniswapV3Pool="UniswapV3Pool",e.dodoDspProxy="dodoDspProxy",e.dodoDppProxy="dodoDppProxy",e.IdodoV2="IdodoV2",e.dodoDPPAdmin="dodoDPPAdmin",e.dodoDSP="dodoDSP",e.dodoDVM="dodoDVM",e.dodoDSPFactory="dodoDSPFactory",e.dodoDVMFactory="dodoDVMFactory",e.D3Proxy="D3Proxy",e.dodoNftERC721="dodoNftERC721",e.dodoNftERC1155="dodoNftERC1155",e.dodoDropsProxy="dodoDropsProxy",e.dodoNftVault="dodoNftVault",e.dodoNftProxy="dodoNftProxy",e.dodoFragment="dodoFragment",e.dodoBuyoutModel="dodoBuyoutModel",e.dodoNftPoolProxy="dodoNftPoolProxy",e.nftFilterAdmin="nftFilterAdmin",e.baseFilterV1="baseFilterV1",e.FilterERC721V1="FilterERC721V1",e.FilterERC1155V1="FilterERC1155V1",e.dodoV1PairProxy="dodoV1PairProxy",e.dodoPair="dodoPair",e.dodoMineV3Proxy="dodoMineV3Proxy",e.dodoMineV3ProxyOld="dodoMineV3ProxyOld",e.LockedTokenVaultABI="LockedTokenVaultABI",e.DODOV1PmmHelperABI="DODOV1PmmHelperABI",e.D3MM_READ_ABI="D3MM_READ_ABI"}(zs||(zs={}));const Ws=(e,t,n)=>V(void 0,void 0,void 0,function*(){const r=yield Js(e);return new Bs(r).encodeFunctionData(t,n)}),Zs=(e,t,n)=>new Bs(e).encodeFunctionData(t,n);class eo extends Bi{constructor(){super(...arguments),this._pendingBatchAggregator=null,this._pendingBatch=null,this._provider=null}setProvider(e){this._provider=e}send(e,t){const n=Object.create(null,{send:{get:()=>super.send}});return V(this,void 0,void 0,function*(){if("eth_call"!==e||2!==t.length||"object"!=typeof t[0]||!t[0].to||!t[0].data||"string"!=typeof t[1])return this._provider?this._provider.send(e,t):n.send.call(this,e,t);const r={request:{method:e,params:t},resolve:null,reject:null},i=new Promise((e,t)=>{r.resolve=e,r.reject=t});this._pendingBatch||(this._pendingBatch=[]),this._pendingBatch.push(r);const s=()=>V(this,void 0,void 0,function*(){const t=this._pendingBatch||[];let n;this._pendingBatch=null,this._pendingBatchAggregator=null;const i=yield this.detectNetwork();n="object"!=typeof i?parseInt(i,i.startsWith("0x")?16:10):i.chainId;const s=yield function(e,t){return V(this,void 0,void 0,function*(){let n="";const r=t.map(e=>{const[t]=e;return n=e[1],[t.to,t.data]}),i=yield Ws(zs.customMultiCallAggregate,"aggregate",[r]);return[{to:q[e].MULTI_CALL,data:i},n]})}(n,t.map(e=>e.request.params)),o={method:e,params:s,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"requestBatch",request:Ke(t.map(e=>e.request)),provider:this,id:o.id});const a=e=>{if(e.error||!e.result)t.forEach(t=>{try{const n=new Error(e.error.message);n.code=e.error.code,n.data=e.error.data,t.reject(n)}catch(n){t.reject(e.error)}}),this.emit("debug",{action:"responseBatch.error",request:o,response:e,provider:this,id:o.id});else{const[n,i]=Ds.decode(["uint256","bytes[]"],e.result),s=n.toNumber();if(this._setFastBlockNumber(s),this.emit("blockNumberChanged",s),t.length!==i.length)return void r.reject("Unexpected length mismatch");t.forEach((e,t)=>{const n=i[t];e.resolve(n)}),this.emit("debug",{action:"responseBatch",request:o,response:e,provider:this,decodeList:i,id:o.id})}},l=e=>{this.emit("debug",{action:"responseBatch.error",error:e,request:o,provider:this,id:o.id}),t.forEach(t=>{t.reject(e)})};if(!this._provider)return Ln(this.connection,JSON.stringify(o)).then(a,l);try{const e=yield this._provider.send(o.method,o.params);a({id:o.id,jsonrpc:o.jsonrpc,result:e})}catch(e){l(e)}});return this._pendingBatchAggregator?this._pendingBatch.length>800&&(clearTimeout(this._pendingBatchAggregator),s()):this._pendingBatchAggregator=setTimeout(s,10),i})}}const to="contract-query";class no{constructor(e){this.subContractRequestsList=[],this.debugQuery=null==e?void 0:e.debugQuery,this.debugProvider=null==e?void 0:e.debugProvider,this.rpc=null==e?void 0:e.rpc,this.getConfigProvider=null==e?void 0:e.getProvider,this.staticJsonRpcProviderMap=new Map,this.batchStaticJsonRpcProviderMap=new Map,this.batchContractMap=new Map}setRpc(e){this.rpc=e,this.subContractRequestsList.forEach(t=>{t.setRpc(e)})}setGetConfigProvider(e){this.getConfigProvider=e,this.subContractRequestsList.forEach(t=>{t.setGetConfigProvider(e)}),this.batchContractMap=new Map,this.staticJsonRpcProviderMap=new Map,this.batchStaticJsonRpcProviderMap=new Map}getProvider(e){var t,n;const r=null===(t=this.getConfigProvider)||void 0===t?void 0:t.call(this,e);if(r)return r;const i=null===(n=this.rpc)||void 0===n?void 0:n[e];if(!i)throw new Error(`ChainId ${e} not found`);if(this.staticJsonRpcProviderMap.has(e))return this.staticJsonRpcProviderMap.get(e);const s=new Bi(i,e);return this.debugProvider&&s.on("debug",console.log),this.staticJsonRpcProviderMap.set(e,s),s}getBatchProvider(e){var t,n;const r=null===(t=this.getConfigProvider)||void 0===t?void 0:t.call(this,e),i=null===(n=this.rpc)||void 0===n?void 0:n[e];if(!i&&!r)throw new Error(`ChainId ${e} not found`);if(this.batchStaticJsonRpcProviderMap.has(e))return this.batchStaticJsonRpcProviderMap.get(e);const s=new eo(i,e);return s.setProvider(r||null),this.debugProvider&&s.on("debug",console.log),this.batchStaticJsonRpcProviderMap.set(e,s),s}createContractRequests(){const e=new no({rpc:this.rpc,getProvider:this.getConfigProvider,debugQuery:this.debugQuery,debugProvider:this.debugProvider});return this.subContractRequestsList.push(e),e}getContract(e,t,n){const r=this.getProvider(e);return new Xs(t,n,r)}getBatchContract(e,t,n){var r;const i=this.batchContractMap.get(e);if(i){if(i.has(t))return i.get(t)}else this.batchContractMap.set(e,new Map);const s=this.getBatchProvider(e),o=new Xs(t,n,s);return null===(r=this.batchContractMap.get(e))||void 0===r||r.set(t,o),o}getBatchContractByAbiName(e,t,n){return V(this,void 0,void 0,function*(){const r=yield this.getContractInterface(n);return this.getBatchContract(e,t,r)})}getContractInterface(e){return Js(e)}callMultiQuery(e,t){return V(this,void 0,void 0,function*(){const n=q[e],{MULTI_CALL:r}=n,i=yield this.getContractInterface(zs.customMultiCallAggregate),s=this.getContract(e,r,i),o=[],a=new Map,l=new Map,c={};for(let n=0;n<t.length;n++){const{contractAddress:r,method:i,params:s,abiName:u,callback:d}=t[n];let h=l.get(u);if(!h){const t=yield this.getContractInterface(u);a.set(u,t),h=this.getContract(e,r,t),l.set(u,h)}const f={to:r,data:h.interface.encodeFunctionData(i,s)};o.push({callData:f,processor:e=>{const t=new Bs(a.get(u)).decodeFunctionResult(i,e);d&&d(t);const r=d?d(t):void 0;return c[n]=r||t,c[n]}})}const[u]=yield $s(s,r,o);return u})}callQuery(e,t){return V(this,void 0,void 0,function*(){const n=yield this.getContractInterface(t.abiName),r=this.getContract(e,t.contractAddress,n),i=yield r.callStatic[t.method](...t.params),s=t.callback?t.callback(i):void 0;return s||i})}batchCallQuery(e,t){return V(this,void 0,void 0,function*(){this.debugQuery&&console.log({action:"batchCallQuery.request",chainId:e,query:t});const n=yield this.getBatchProvider(e),r=yield Ws(t.abiName,t.method,t.params),i=yield n.call({to:t.contractAddress,data:r}),s=yield((e,t,n)=>V(void 0,void 0,void 0,function*(){const r=yield Js(e);return new Bs(r).decodeFunctionResult(t,n)}))(t.abiName,t.method,i),o=t.callback?t.callback(s):void 0;return this.debugQuery&&console.log({action:"batchCallQuery.response",chainId:e,query:t,response:s}),o||s})}getBlockNumber(e){return V(this,void 0,void 0,function*(){const t=this.getBatchProvider(e),n=yield t.getBlockNumber();return t.emit("blockNumberChanged",n),n})}getETHBalance(e,t){return V(this,void 0,void 0,function*(){const n=this.getProvider(e),r=yield n.getBalance(t);return new I(r.toString()).div(1e18)})}}const ro=JSON;function io(e,t){if(!Boolean(e))throw new Error(t)}function so(e,t){if(!Boolean(e))throw new Error("Unexpected invariant triggered.")}const oo=/\r\n|[\n\r]/g;function ao(e,t){let n=0,r=1;for(const i of e.body.matchAll(oo)){if("number"==typeof i.index||so(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function lo(e){return co(e.source,ao(e.source,e.start))}function co(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=1===t.line?n:0,l=t.column+a,c=`${e.name}:${o}:${l}\n`,u=r.split(/\r\n|[\n\r]/g),d=u[i];if(d.length>120){const e=Math.floor(l/80),t=l%80,n=[];for(let e=0;e<d.length;e+=80)n.push(d.slice(e,e+80));return c+uo([[`${o} |`,n[0]],...n.slice(1,e+1).map(e=>["|",e]),["|","^".padStart(t)],["|",n[e+1]]])}return c+uo([[o-1+" |",u[i-1]],[`${o} |`,d],["|","^".padStart(l)],[`${o+1} |`,u[i+1]]])}function uo(e){const t=e.filter(([e,t])=>void 0!==t),n=Math.max(...t.map(([e])=>e.length));return t.map(([e,t])=>e.padStart(n)+(t?" "+t:"")).join("\n")}class ho extends Error{constructor(e,...t){var n,r,i;const{nodes:s,source:o,positions:a,path:l,originalError:c,extensions:u}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=l?l:void 0,this.originalError=null!=c?c:void 0,this.nodes=fo(Array.isArray(s)?s:s?[s]:void 0);const d=fo(null===(n=this.nodes)||void 0===n?void 0:n.map(e=>e.loc).filter(e=>null!=e));this.source=null!=o?o:null==d||null===(r=d[0])||void 0===r?void 0:r.source,this.positions=null!=a?a:null==d?void 0:d.map(e=>e.start),this.locations=a&&o?a.map(e=>ao(o,e)):null==d?void 0:d.map(e=>ao(e.source,e.start));const h="object"==typeof(f=null==c?void 0:c.extensions)&&null!==f?null==c?void 0:c.extensions:void 0;var f;this.extensions=null!==(i=null!=u?u:h)&&void 0!==i?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=c&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,ho):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const t of this.nodes)t.loc&&(e+="\n\n"+lo(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+co(this.source,t);return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function fo(e){return void 0===e||0===e.length?void 0:e}function po(e,t,n){return new ho(`Syntax Error: ${n}`,{source:e,positions:[t]})}class mo{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class go{constructor(e,t,n,r,i,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const yo={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},Ao=new Set(Object.keys(yo));function Eo(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Ao.has(t)}var bo,vo,wo,Oo;function Do(e){return 9===e||32===e}function To(e){return e>=48&&e<=57}function _o(e){return e>=97&&e<=122||e>=65&&e<=90}function Po(e){return _o(e)||95===e}function Ro(e){return _o(e)||To(e)||95===e}function Io(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let t=0;t<e.length;++t){var s;const o=e[t],a=Co(o);a!==o.length&&(r=null!==(s=r)&&void 0!==s?s:t,i=t,0!==t&&a<n&&(n=a))}return e.map((e,t)=>0===t?e:e.slice(n)).slice(null!==(t=r)&&void 0!==t?t:0,i+1)}function Co(e){let t=0;for(;t<e.length&&Do(e.charCodeAt(t));)++t;return t}!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(bo||(bo={})),function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(vo||(vo={})),function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",e.TYPE_COORDINATE="TypeCoordinate",e.MEMBER_COORDINATE="MemberCoordinate",e.ARGUMENT_COORDINATE="ArgumentCoordinate",e.DIRECTIVE_COORDINATE="DirectiveCoordinate",e.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"}(wo||(wo={})),function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.DOT=".",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(Oo||(Oo={}));class ko{constructor(e){const t=new go(Oo.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==Oo.EOF)do{if(e.next)e=e.next;else{const t=Mo(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===Oo.COMMENT);return e}}function Bo(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function No(e,t){return xo(e.charCodeAt(t))&&So(e.charCodeAt(t+1))}function xo(e){return e>=55296&&e<=56319}function So(e){return e>=56320&&e<=57343}function Lo(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return Oo.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function Fo(e,t,n,r,i){const s=e.line,o=1+n-e.lineStart;return new go(t,n,r,s,o,i)}function Mo(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const t=n.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===n.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return qo(e,i);case 33:return Fo(e,Oo.BANG,i,i+1);case 36:return Fo(e,Oo.DOLLAR,i,i+1);case 38:return Fo(e,Oo.AMP,i,i+1);case 40:return Fo(e,Oo.PAREN_L,i,i+1);case 41:return Fo(e,Oo.PAREN_R,i,i+1);case 46:if(46===n.charCodeAt(i+1)&&46===n.charCodeAt(i+2))return Fo(e,Oo.SPREAD,i,i+3);break;case 58:return Fo(e,Oo.COLON,i,i+1);case 61:return Fo(e,Oo.EQUALS,i,i+1);case 64:return Fo(e,Oo.AT,i,i+1);case 91:return Fo(e,Oo.BRACKET_L,i,i+1);case 93:return Fo(e,Oo.BRACKET_R,i,i+1);case 123:return Fo(e,Oo.BRACE_L,i,i+1);case 124:return Fo(e,Oo.PIPE,i,i+1);case 125:return Fo(e,Oo.BRACE_R,i,i+1);case 34:return 34===n.charCodeAt(i+1)&&34===n.charCodeAt(i+2)?$o(e,i):Ho(e,i)}if(To(t)||45===t)return Uo(e,i,t);if(Po(t))return Ko(e,i);throw po(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":Bo(t)||No(n,i)?`Unexpected character: ${Lo(e,i)}.`:`Invalid character: ${Lo(e,i)}.`)}return Fo(e,Oo.EOF,r,r)}function qo(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const e=n.charCodeAt(i);if(10===e||13===e)break;if(Bo(e))++i;else{if(!No(n,i))break;i+=2}}return Fo(e,Oo.COMMENT,t,i,n.slice(t+1,i))}function Uo(e,t,n){const r=e.source.body;let i=t,s=n,o=!1;if(45===s&&(s=r.charCodeAt(++i)),48===s){if(s=r.charCodeAt(++i),To(s))throw po(e.source,i,`Invalid number, unexpected digit after 0: ${Lo(e,i)}.`)}else i=Vo(e,i,s),s=r.charCodeAt(i);if(46===s&&(o=!0,s=r.charCodeAt(++i),i=Vo(e,i,s),s=r.charCodeAt(i)),69!==s&&101!==s||(o=!0,s=r.charCodeAt(++i),43!==s&&45!==s||(s=r.charCodeAt(++i)),i=Vo(e,i,s),s=r.charCodeAt(i)),46===s||Po(s))throw po(e.source,i,`Invalid number, expected digit but got: ${Lo(e,i)}.`);return Fo(e,o?Oo.FLOAT:Oo.INT,t,i,r.slice(t,i))}function Vo(e,t,n){if(!To(n))throw po(e.source,t,`Invalid number, expected digit but got: ${Lo(e,t)}.`);const r=e.source.body;let i=t+1;for(;To(r.charCodeAt(i));)++i;return i}function Ho(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,o="";for(;i<r;){const r=n.charCodeAt(i);if(34===r)return o+=n.slice(s,i),Fo(e,Oo.STRING,t,i+1,o);if(92===r){o+=n.slice(s,i);const t=117===n.charCodeAt(i+1)?123===n.charCodeAt(i+2)?jo(e,i):Qo(e,i):Xo(e,i);o+=t.value,i+=t.size,s=i;continue}if(10===r||13===r)break;if(Bo(r))++i;else{if(!No(n,i))throw po(e.source,i,`Invalid character within String: ${Lo(e,i)}.`);i+=2}}throw po(e.source,i,"Unterminated string.")}function jo(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const e=n.charCodeAt(t+i++);if(125===e){if(i<5||!Bo(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Go(e),r<0)break}throw po(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Qo(e,t){const n=e.source.body,r=Yo(n,t+2);if(Bo(r))return{value:String.fromCodePoint(r),size:6};if(xo(r)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=Yo(n,t+8);if(So(e))return{value:String.fromCodePoint(r,e),size:12}}throw po(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Yo(e,t){return Go(e.charCodeAt(t))<<12|Go(e.charCodeAt(t+1))<<8|Go(e.charCodeAt(t+2))<<4|Go(e.charCodeAt(t+3))}function Go(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Xo(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw po(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function $o(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,o=s,a="";const l=[];for(;s<r;){const r=n.charCodeAt(s);if(34===r&&34===n.charCodeAt(s+1)&&34===n.charCodeAt(s+2)){a+=n.slice(o,s),l.push(a);const r=Fo(e,Oo.BLOCK_STRING,t,s+3,Io(l).join("\n"));return e.line+=l.length-1,e.lineStart=i,r}if(92!==r||34!==n.charCodeAt(s+1)||34!==n.charCodeAt(s+2)||34!==n.charCodeAt(s+3))if(10!==r&&13!==r)if(Bo(r))++s;else{if(!No(n,s))throw po(e.source,s,`Invalid character within String: ${Lo(e,s)}.`);s+=2}else a+=n.slice(o,s),l.push(a),13===r&&10===n.charCodeAt(s+1)?s+=2:++s,a="",o=s,i=s;else a+=n.slice(o,s),o=s+1,s+=4}throw po(e.source,s,"Unterminated string.")}function Ko(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){if(!Ro(n.charCodeAt(i)))break;++i}return Fo(e,Oo.NAME,t,i,n.slice(t,i))}function zo(e){return Jo(e,[])}function Jo(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:Jo(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";const n=Math.min(10,e.length),r=e.length-n,i=[];for(let r=0;r<n;++r)i.push(Jo(e[r],t));1===r?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`);return"["+i.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const r=n.map(([e,n])=>e+": "+Jo(n,t));return"{ "+r.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const Wo=globalThis.process&&"production"===process.env.NODE_ENV?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var n;const r=t.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(n=e.constructor)||void 0===n?void 0:n.name)){const t=zo(e);throw new Error(`Cannot use ${r} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class Zo{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||io(!1,`Body must be a string. Received: ${zo(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||io(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||io(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class ea{constructor(e,t={}){const{lexer:n,...r}=t;if(n)this._lexer=n;else{const t=function(e){return Wo(e,Zo)}(e)?e:new Zo(e);this._lexer=new ko(t)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(Oo.NAME);return this.node(e,{kind:wo.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:wo.DOCUMENT,definitions:this.many(Oo.SOF,this.parseDefinition,Oo.EOF)})}parseDefinition(){if(this.peek(Oo.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(e&&t.kind===Oo.BRACE_L)throw po(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(t.kind===Oo.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(e)throw po(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if("extend"===t.value)return this.parseTypeSystemExtension()}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(Oo.BRACE_L))return this.node(e,{kind:wo.OPERATION_DEFINITION,operation:bo.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseDescription(),n=this.parseOperationType();let r;return this.peek(Oo.NAME)&&(r=this.parseName()),this.node(e,{kind:wo.OPERATION_DEFINITION,operation:n,description:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Oo.NAME);switch(e.value){case"query":return bo.QUERY;case"mutation":return bo.MUTATION;case"subscription":return bo.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Oo.PAREN_L,this.parseVariableDefinition,Oo.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:wo.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(Oo.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Oo.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Oo.DOLLAR),this.node(e,{kind:wo.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:wo.SELECTION_SET,selections:this.many(Oo.BRACE_L,this.parseSelection,Oo.BRACE_R)})}parseSelection(){return this.peek(Oo.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,r;return this.expectOptionalToken(Oo.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:wo.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Oo.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Oo.PAREN_L,t,Oo.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(Oo.COLON),this.node(t,{kind:wo.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Oo.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Oo.NAME)?this.node(e,{kind:wo.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:wo.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token,t=this.parseDescription();return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:wo.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:wo.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case Oo.BRACKET_L:return this.parseList(e);case Oo.BRACE_L:return this.parseObject(e);case Oo.INT:return this.advanceLexer(),this.node(t,{kind:wo.INT,value:t.value});case Oo.FLOAT:return this.advanceLexer(),this.node(t,{kind:wo.FLOAT,value:t.value});case Oo.STRING:case Oo.BLOCK_STRING:return this.parseStringLiteral();case Oo.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:wo.BOOLEAN,value:!0});case"false":return this.node(t,{kind:wo.BOOLEAN,value:!1});case"null":return this.node(t,{kind:wo.NULL});default:return this.node(t,{kind:wo.ENUM,value:t.value})}case Oo.DOLLAR:if(e){if(this.expectToken(Oo.DOLLAR),this._lexer.token.kind===Oo.NAME){const e=this._lexer.token.value;throw po(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:wo.STRING,value:e.value,block:e.kind===Oo.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:wo.LIST,values:this.any(Oo.BRACKET_L,()=>this.parseValueLiteral(e),Oo.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:wo.OBJECT,fields:this.any(Oo.BRACE_L,()=>this.parseObjectField(e),Oo.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(Oo.COLON),this.node(t,{kind:wo.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Oo.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Oo.AT),this.node(t,{kind:wo.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Oo.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(Oo.BRACKET_R),t=this.node(e,{kind:wo.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(Oo.BANG)?this.node(e,{kind:wo.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:wo.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Oo.STRING)||this.peek(Oo.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.many(Oo.BRACE_L,this.parseOperationTypeDefinition,Oo.BRACE_R);return this.node(e,{kind:wo.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Oo.COLON);const n=this.parseNamedType();return this.node(e,{kind:wo.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:wo.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:wo.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Oo.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Oo.BRACE_L,this.parseFieldDefinition,Oo.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(Oo.COLON);const i=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:wo.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:s})}parseArgumentDefs(){return this.optionalMany(Oo.PAREN_L,this.parseInputValueDef,Oo.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Oo.COLON);const r=this.parseTypeReference();let i;this.expectOptionalToken(Oo.EQUALS)&&(i=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:wo.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:wo.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:wo.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(Oo.EQUALS)?this.delimitedMany(Oo.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:wo.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(Oo.BRACE_L,this.parseEnumValueDefinition,Oo.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:wo.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw po(this._lexer.source,this._lexer.token.start,`${ta(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:wo.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(Oo.BRACE_L,this.parseInputValueDef,Oo.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Oo.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(Oo.BRACE_L,this.parseOperationTypeDefinition,Oo.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:wo.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:wo.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:wo.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:wo.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:wo.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:wo.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:wo.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Oo.AT);const n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:wo.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:s})}parseDirectiveLocations(){return this.delimitedMany(Oo.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(vo,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){const e=this._lexer.token,t=this.expectOptionalToken(Oo.AT),n=this.parseName();let r,i;return!t&&this.expectOptionalToken(Oo.DOT)&&(r=this.parseName()),(t||r)&&this.expectOptionalToken(Oo.PAREN_L)&&(i=this.parseName(),this.expectToken(Oo.COLON),this.expectToken(Oo.PAREN_R)),t?i?this.node(e,{kind:wo.DIRECTIVE_ARGUMENT_COORDINATE,name:n,argumentName:i}):this.node(e,{kind:wo.DIRECTIVE_COORDINATE,name:n}):r?i?this.node(e,{kind:wo.ARGUMENT_COORDINATE,name:n,fieldName:r,argumentName:i}):this.node(e,{kind:wo.MEMBER_COORDINATE,name:n,memberName:r}):this.node(e,{kind:wo.TYPE_COORDINATE,name:n})}node(e,t){return!0!==this._options.noLocation&&(t.loc=new mo(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw po(this._lexer.source,t.start,`Expected ${na(e)}, found ${ta(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==Oo.NAME||t.value!==e)throw po(this._lexer.source,t.start,`Expected "${e}", found ${ta(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Oo.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return po(this._lexer.source,t.start,`Unexpected ${ta(t)}.`)}any(e,t,n){this.expectToken(e);const r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(t.kind!==Oo.EOF&&(++this._tokenCounter,void 0!==e&&this._tokenCounter>e))throw po(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function ta(e){const t=e.value;return na(e.kind)+(null!=t?` "${t}"`:"")}function na(e){return function(e){return e===Oo.BANG||e===Oo.DOLLAR||e===Oo.AMP||e===Oo.PAREN_L||e===Oo.PAREN_R||e===Oo.DOT||e===Oo.SPREAD||e===Oo.COLON||e===Oo.EQUALS||e===Oo.AT||e===Oo.BRACKET_L||e===Oo.BRACKET_R||e===Oo.BRACE_L||e===Oo.PIPE||e===Oo.BRACE_R}(e)?`"${e}"`:e}const ra=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function ia(e){return sa[e.charCodeAt(0)]}const sa=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],oa=Object.freeze({});function aa(e,t){const n=e[t];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function la(e){return function(e,t,n=yo){const r=new Map;for(const e of Object.values(wo))r.set(e,aa(t,e));let i,s,o,a=Array.isArray(e),l=[e],c=-1,u=[],d=e;const h=[],f=[];do{c++;const e=c===l.length,y=e&&0!==u.length;if(e){if(s=0===f.length?void 0:h[h.length-1],d=o,o=f.pop(),y)if(a){d=d.slice();let e=0;for(const[t,n]of u){const r=t-e;null===n?(d.splice(r,1),e++):d[r]=n}}else{d={...d};for(const[e,t]of u)d[e]=t}c=i.index,l=i.keys,u=i.edits,a=i.inArray,i=i.prev}else if(o){if(s=a?c:l[c],d=o[s],null==d)continue;h.push(s)}let A;if(!Array.isArray(d)){var p,m;Eo(d)||io(!1,`Invalid AST Node: ${zo(d)}.`);const n=e?null===(p=r.get(d.kind))||void 0===p?void 0:p.leave:null===(m=r.get(d.kind))||void 0===m?void 0:m.enter;if(A=null==n?void 0:n.call(t,d,s,o,h,f),A===oa)break;if(!1===A){if(!e){h.pop();continue}}else if(void 0!==A&&(u.push([s,A]),!e)){if(!Eo(A)){h.pop();continue}d=A}}var g;void 0===A&&y&&u.push([s,d]),e?h.pop():(i={inArray:a,index:c,keys:l,edits:u,prev:i},a=Array.isArray(d),l=a?d:null!==(g=n[d.kind])&&void 0!==g?g:[],c=-1,u=[],o&&f.push(o),o=d)}while(void 0!==i);return 0!==u.length?u[u.length-1][1]:e}(e,ca)}const ca={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>ua(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=pa(e.variableDefinitions)?ha("(\n",ua(e.variableDefinitions,"\n"),"\n)"):ha("(",ua(e.variableDefinitions,", "),")"),n=ha("",e.description,"\n")+ua([e.operation,ua([e.name,t]),ua(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r,description:i})=>ha("",i,"\n")+e+": "+t+ha(" = ",n)+ha(" ",ua(r," "))},SelectionSet:{leave:({selections:e})=>da(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=ha("",e,": ")+t;let o=s+ha("(",ua(n,", "),")");return o.length>80&&(o=s+ha("(\n",fa(ua(n,"\n")),"\n)")),ua([o,ua(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+ha(" ",ua(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>ua(["...",ha("on ",e),ua(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i,description:s})=>ha("",s,"\n")+`fragment ${e}${ha("(",ua(n,", "),")")} `+`on ${t} ${ha("",ua(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e){const t=e.replace(/"""/g,'\\"""'),n=t.split(/\r\n|[\n\r]/g),r=1===n.length,i=n.length>1&&n.slice(1).every(e=>0===e.length||Do(e.charCodeAt(0))),s=t.endsWith('\\"""'),o=e.endsWith('"')&&!s,a=e.endsWith("\\"),l=o||a,c=!r||e.length>70||l||i||s;let u="";const d=r&&Do(e.charCodeAt(0));return(c&&!d||i)&&(u+="\n"),u+=t,(c||l)&&(u+="\n"),'"""'+u+'"""'}(e):`"${e.replace(ra,ia)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+ua(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+ua(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+ha("(",ua(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>ha("",e,"\n")+ua(["schema",ua(t," "),da(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>ha("",e,"\n")+ua(["scalar",t,ua(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>ha("",e,"\n")+ua(["type",t,ha("implements ",ua(n," & ")),ua(r," "),da(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>ha("",e,"\n")+t+(pa(n)?ha("(\n",fa(ua(n,"\n")),"\n)"):ha("(",ua(n,", "),")"))+": "+r+ha(" ",ua(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>ha("",e,"\n")+ua([t+": "+n,ha("= ",r),ua(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>ha("",e,"\n")+ua(["interface",t,ha("implements ",ua(n," & ")),ua(r," "),da(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>ha("",e,"\n")+ua(["union",t,ua(n," "),ha("= ",ua(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>ha("",e,"\n")+ua(["enum",t,ua(n," "),da(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>ha("",e,"\n")+ua([t,ua(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>ha("",e,"\n")+ua(["input",t,ua(n," "),da(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>ha("",e,"\n")+"directive @"+t+(pa(n)?ha("(\n",fa(ua(n,"\n")),"\n)"):ha("(",ua(n,", "),")"))+(r?" repeatable":"")+" on "+ua(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>ua(["extend schema",ua(e," "),da(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>ua(["extend scalar",e,ua(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>ua(["extend type",e,ha("implements ",ua(t," & ")),ua(n," "),da(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>ua(["extend interface",e,ha("implements ",ua(t," & ")),ua(n," "),da(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>ua(["extend union",e,ua(t," "),ha("= ",ua(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>ua(["extend enum",e,ua(t," "),da(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>ua(["extend input",e,ua(t," "),da(n)]," ")},TypeCoordinate:{leave:({name:e})=>e},MemberCoordinate:{leave:({name:e,memberName:t})=>ua([e,ha(".",t)])},ArgumentCoordinate:{leave:({name:e,fieldName:t,argumentName:n})=>ua([e,ha(".",t),ha("(",n,":)")])},DirectiveCoordinate:{leave:({name:e})=>ua(["@",e])},DirectiveArgumentCoordinate:{leave:({name:e,argumentName:t})=>ua(["@",e,ha("(",t,":)")])}};function ua(e,t=""){var n;return null!==(n=null==e?void 0:e.filter(e=>e).join(t))&&void 0!==n?n:""}function da(e){return ha("{\n",fa(ua(e,"\n")),"\n}")}function ha(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function fa(e){return ha(" ",e.replace(/\n/g,"\n "))}function pa(e){var t;return null!==(t=null==e?void 0:e.some(e=>e.includes("\n")))&&void 0!==t&&t}const ma=e=>{let t;const n=e.definitions.filter(e=>"OperationDefinition"===e.kind);return 1===n.length&&(t=n[0]?.name?.value),t},ga=e=>{if("string"==typeof e){let t;try{const n=function(e,t){const n=new ea(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}(e);t=ma(n)}catch(e){}return{query:e,operationName:t}}const t=ma(e);return{query:la(e),operationName:t}};class ya extends Error{constructor(e,t){super(`${ya.extractMessage(e)}: ${JSON.stringify({response:e,request:t})}`),Object.setPrototypeOf(this,ya.prototype),this.response=e,this.request=t,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ya)}static extractMessage(e){return e.errors?.[0]?.message??`GraphQL Error (Code: ${e.status})`}}const Aa=e=>{let t={};return e&&("undefined"!=typeof Headers&&e instanceof Headers||k&&k.Headers&&e instanceof k.Headers?t=(e=>{const t={};return e.forEach((e,n)=>{t[n]=e}),t})(e):Array.isArray(e)?e.forEach(([e,n])=>{e&&void 0!==n&&(t[e]=n)}):t=e),t},Ea=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),ba=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:o,fetchOptions:a,middleware:l}=t,c={...t.headers};let u,d="";"POST"===e?(u=Oa(r,i,s,a.jsonSerializer),"string"==typeof u&&(c["Content-Type"]="application/json")):d=(e=>{if(!Array.isArray(e.query)){const t=e,n=[`query=${encodeURIComponent(Ea(t.query))}`];return e.variables&&n.push(`variables=${encodeURIComponent(t.jsonSerializer.stringify(t.variables))}`),t.operationName&&n.push(`operationName=${encodeURIComponent(t.operationName)}`),n.join("&")}if(void 0!==e.variables&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((e,n,r)=>(e.push({query:Ea(n),variables:t.variables?t.jsonSerializer.stringify(t.variables[r]):void 0}),e),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`})({query:r,variables:i,operationName:s,jsonSerializer:a.jsonSerializer??ro});const h={method:e,headers:c,body:u,...a};let f=n,p=h;if(l){const e=await Promise.resolve(l({...h,url:n,operationName:s,variables:i})),{url:t,...r}=e;f=t,p=r}return d&&(f=`${f}?${d}`),await o(f,p)};class va{constructor(e,t={}){this.url=e,this.requestConfig=t,this.rawRequest=async(...e)=>{const[t,n,r]=e,i=((e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0})(t,n,r),{headers:s,fetch:o=B,method:a="POST",requestMiddleware:l,responseMiddleware:c,...u}=this.requestConfig,{url:d}=this;void 0!==i.signal&&(u.signal=i.signal);const{operationName:h}=ga(i.query);return wa({url:d,query:i.query,variables:i.variables,headers:{...Aa(Ta(s)),...Aa(i.requestHeaders)},operationName:h,fetch:o,method:a,fetchOptions:u,middleware:l}).then(e=>(c&&c(e),e)).catch(e=>{throw c&&c(e),e})}}async request(e,...t){const[n,r]=t,i=((e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0})(e,n,r),{headers:s,fetch:o=B,method:a="POST",requestMiddleware:l,responseMiddleware:c,...u}=this.requestConfig,{url:d}=this;void 0!==i.signal&&(u.signal=i.signal);const{query:h,operationName:f}=ga(i.document);return wa({url:d,query:h,variables:i.variables,headers:{...Aa(Ta(s)),...Aa(i.requestHeaders)},operationName:f,fetch:o,method:a,fetchOptions:u,middleware:l}).then(e=>(c&&c(e),e.data)).catch(e=>{throw c&&c(e),e})}batchRequests(e,t){const n=((e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0})(e,t),{headers:r,...i}=this.requestConfig;void 0!==n.signal&&(i.signal=n.signal);const s=n.documents.map(({document:e})=>ga(e).query),o=n.documents.map(({variables:e})=>e);return wa({url:this.url,query:s,variables:o,headers:{...Aa(Ta(r)),...Aa(n.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??B,method:this.requestConfig.method||"POST",fetchOptions:i,middleware:this.requestConfig.requestMiddleware}).then(e=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(e),e.data)).catch(e=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(e),e})}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,t){const{headers:n}=this.requestConfig;return n?n[e]=t:this.requestConfig.headers={[e]:t},this}setEndpoint(e){return this.url=e,this}}const wa=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=ba((e.method??"post").toUpperCase());const s=Array.isArray(e.query),o=await i(e),a=await Da(o,r.jsonSerializer??ro),l=Array.isArray(a)?!a.some(({data:e})=>!e):Boolean(a.data),c=Array.isArray(a)||!a.errors||Array.isArray(a.errors)&&!a.errors.length||"all"===r.errorPolicy||"ignore"===r.errorPolicy;if(o.ok&&c&&l){const{errors:e,...t}=(Array.isArray(a),a),n="ignore"===r.errorPolicy?t:a;return{...s?{data:n}:n,headers:o.headers,status:o.status}}throw new ya({..."string"==typeof a?{error:a}:a,status:o.status,headers:o.headers},{query:t,variables:n})},Oa=(e,t,n,r)=>{const i=r??ro;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(void 0!==t&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce((e,n,r)=>(e.push({query:n,variables:t?t[r]:void 0}),e),[]);return i.stringify(s)},Da=async(e,t)=>{let n;return e.headers.forEach((e,t)=>{"content-type"===t.toLowerCase()&&(n=e)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Ta=e=>"function"==typeof e?e():e,_a={url:"https://api.dodoex.io/frontend-graphql"};class Pa{constructor(e){const t=Object.assign(Object.assign({},_a),e);this.url=t.url,this.getHeaders=t.getHeaders;const n=new va(this.url,{fetch:t.fetch,requestMiddleware:e=>{const t=new URL(e.url);return e.operationName&&t.searchParams.append("opname",e.operationName),Object.assign(Object.assign({},e),{url:t.toString()})}});this.client=n,this.setHeaders()}setHeaders(){return V(this,void 0,void 0,function*(){var e;const t=yield null===(e=this.getHeaders)||void 0===e?void 0:e.call(this);t&&this.client.setHeaders(t)})}getData(e,t){return V(this,void 0,void 0,function*(){yield this.setHeaders();return this.client.request(e,t)})}getQuery(e,...[t]){return{queryKey:["graphql","getQuery",e,t],queryFn:()=>V(this,void 0,void 0,function*(){return yield this.getData(e.toString(),t)})}}getInfiniteQuery(e,t,...[n]){return{queryKey:["graphql","getInfiniteQuery",t,e,n],queryFn:r=>V(this,[r],void 0,function*({pageParam:r}){return yield this.getData(e.toString(),Object.assign(Object.assign({},n),{where:Object.assign(Object.assign({},null==n?void 0:n.where),{[t]:r})}))})}}}const Ra={host:"https://api.dodoex.io",fetch:B};class Ia{constructor(e){const t=Object.assign(Object.assign({},Ra),e);this.host=t.host,this._getFetch=()=>t.fetch}getUrl(e,t){let n=`${this.host}/${e}`;return t&&(n=`${n}?${N.stringify(t)}`),n}responseProcessor(e){return V(this,void 0,void 0,function*(){if(e.ok){const t=yield e.json();return{response:e,result:t}}throw new Error(`Response ${JSON.stringify(e)} failed`)})}getJson(e,t,n){return V(this,void 0,void 0,function*(){const r=this.getUrl(e,t),i=this._getFetch(),s=yield i(r,R({method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}},n));return this.responseProcessor(s)})}postJson(e,t,n,r){return V(this,void 0,void 0,function*(){const i=this.getUrl(e,n),s=this._getFetch(),o=yield s(i,R({method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:t?JSON.stringify(t):void 0},r));return this.responseProcessor(o)})}}const Ca={getIsV3Mining:e=>["DSP","GSP","LPTOKEN","V3CLASSICAL"].includes(e),singleSideLp:e=>["CLASSICAL","V3CLASSICAL","DPP"].includes(e),canOperateLiquidity(e,t,n,r){const i=null!=t?t:n;return!!(e&&i&&r)&&("DPP"!==e||i.toLocaleLowerCase()===r.toLocaleLowerCase())}};class ka extends String{constructor(e,t){super(e),this.value=e,this.__meta__=t}toString(){return this.value}}const Ba={"\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n }\n ":new ka("\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n}\n "),"\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n }\n ":new ka("\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n}\n "),"\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n }\n":new ka("\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n}\n "),"\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new ka("\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new ka("\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new ka("\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query FetchPoolList(\n $first: Int\n $where: Pair_filter\n $orderBy: Pair_orderBy\n ) {\n pairs(\n first: $first\n where: $where\n orderBy: $orderBy\n orderDirection: desc\n ) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n }\n ":new ka("\n query FetchPoolList($first: Int, $where: Pair_filter, $orderBy: Pair_orderBy) {\n pairs(first: $first, where: $where, orderBy: $orderBy, orderDirection: desc) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n}\n "),"\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n ":new ka("\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n}\n "),"\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n ":new ka("\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n}\n "),"\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n }\n ":new ka("\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n}\n "),"\n query FetchPool(\n $id: ID!\n $where: Pair_filter\n $liquidityWhere: Liquiditylist_filter\n ) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n }\n ":new ka("\n query FetchPool($id: ID!, $where: Pair_filter, $liquidityWhere: Liquiditylist_filter) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n}\n "),"\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n }\n ":new ka("\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n}\n "),"\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n }\n ":new ka("\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n}\n "),"\n query FetchPoolSwapList(\n $first: Int\n $skip: Int\n $where: Swap_filter\n $orderBy: Swap_orderBy\n $orderDirection: OrderDirection\n ) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n }\n ":new ka("\n query FetchPoolSwapList($first: Int, $skip: Int, $where: Swap_filter, $orderBy: Swap_orderBy, $orderDirection: OrderDirection) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n}\n "),"\n query FetchLiquidityPositions(\n $id: ID!\n $first: Int\n $skip: Int\n $where: LiquidityPosition_filter\n $miningWhere: LiquidityPosition_filter\n $orderBy: LiquidityPosition_orderBy\n $orderDirection: OrderDirection\n ) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n }\n ":new ka("\n query FetchLiquidityPositions($id: ID!, $first: Int, $skip: Int, $where: LiquidityPosition_filter, $miningWhere: LiquidityPosition_filter, $orderBy: LiquidityPosition_orderBy, $orderDirection: OrderDirection) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n}\n "),"\n query FetchPoolPairList(\n $first: Int\n $baseWhere: Pair_filter\n $quoteWhere: Pair_filter\n $orderBy: Pair_orderBy\n $orderDirection: OrderDirection\n ) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n }\n ":new ka("\n query FetchPoolPairList($first: Int, $baseWhere: Pair_filter, $quoteWhere: Pair_filter, $orderBy: Pair_orderBy, $orderDirection: OrderDirection) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n}\n "),"\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ":new ka("\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n}\n "),"\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n ":new ka("\n query FetchNoticeCenterTransactionList($where: Notice_centertransactionListFilter) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n}\n "),"\n query FetchLiquidityLpPartnerRewards(\n $where: LiquidityLpPartnerRewardsInput\n ) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n }\n ":new ka("\n query FetchLiquidityLpPartnerRewards($where: LiquidityLpPartnerRewardsInput) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n}\n "),"\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n }\n ":new ka("\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n}\n ")};function Na(e){var t;return null!==(t=Ba[e])&&void 0!==t?t:{}}const xa=Na("\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n }\n");class Sa{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("AMMV3Api does not initialize the contractRequests");this.contractRequests=new no(e.contractRequestsConfig)}}getPositions(e,t,n){return{queryKey:[to,"ammv3","getPositions",...arguments],enabled:!!e&&!!t,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t)return null;return yield this.contractRequests.callMultiQuery(e,n.map(e=>({abiName:zs.NonfungiblePositionManager,contractAddress:t,method:"positions",params:e})))})}}getOwner(e,t,n){return{queryKey:[to,"ammv3","getOwner",...arguments],enabled:!!e&&!!t,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:zs.NonfungiblePositionManager,contractAddress:t,method:"ownerOf",params:[n]})})}}getBalanceOf(e,t,n){return{queryKey:[to,"ammv3","getBalanceOf",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t||!n)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:zs.NonfungiblePositionManager,contractAddress:t,method:"balanceOf",params:[n]});return new I(r.toString())})}}getTokenOfOwnerByIndex(e,t,n){return{queryKey:[to,"ammv3","getTokenOfOwnerByIndex",...arguments],enabled:!!e&&!!t,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t)return null;return yield this.contractRequests.callMultiQuery(e,n.map(e=>({abiName:zs.NonfungiblePositionManager,contractAddress:t,method:"tokenOfOwnerByIndex",params:e.map(e=>e.toString())})))})}}getV3PoolSlot0(e,t){return{queryKey:[to,"ammv3","getSlot0",...arguments],enabled:!!e||!!t,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:zs.UniswapV3Pool,contractAddress:t,method:"slot0",params:[]})})}}getV3PoolLiquidity(e,t){return{queryKey:[to,"ammv3","getV3PoolLiquidity",...arguments],enabled:!!e||!!t,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:zs.UniswapV3Pool,contractAddress:t,method:"liquidity",params:[]})})}}getCollect(e,t,n,r){return{queryKey:[to,"ammv3","getCollect",...arguments],enabled:!!e||!!t,queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&r))return null;const i=we.from(2).pow(128).sub(1);return yield this.contractRequests.callQuery(e,{abiName:zs.NonfungiblePositionManager,contractAddress:t,method:"collect",params:[{tokenId:n,recipient:r,amount0Max:i,amount1Max:i},{from:r}]})})}}}Sa.graphql={AllV3TicksDocument:xa},Sa.utils=Ca,Sa.encode={};const La=(e,t)=>new C(we.isBigNumber(e)?e.toString():e).div(10**t),Fa={fetchPoolList:Na("\n query FetchPoolList(\n $first: Int\n $where: Pair_filter\n $orderBy: Pair_orderBy\n ) {\n pairs(\n first: $first\n where: $where\n orderBy: $orderBy\n orderDirection: desc\n ) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n }\n "),fetchLiquidityList:Na("\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n "),fetchMyLiquidityList:Na("\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n "),fetchDashboardPairList:Na("\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n }\n "),fetchPool:Na("\n query FetchPool(\n $id: ID!\n $where: Pair_filter\n $liquidityWhere: Liquiditylist_filter\n ) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n }\n "),fetchPoolDayData:Na("\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n }\n "),fetchPoolDashboard:Na("\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n }\n "),fetchPoolSwapList:Na("\n query FetchPoolSwapList(\n $first: Int\n $skip: Int\n $where: Swap_filter\n $orderBy: Swap_orderBy\n $orderDirection: OrderDirection\n ) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n }\n "),fetchLiquidityPositions:Na("\n query FetchLiquidityPositions(\n $id: ID!\n $first: Int\n $skip: Int\n $where: LiquidityPosition_filter\n $miningWhere: LiquidityPosition_filter\n $orderBy: LiquidityPosition_orderBy\n $orderDirection: OrderDirection\n ) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n }\n "),fetchPoolPairList:Na("\n query FetchPoolPairList(\n $first: Int\n $baseWhere: Pair_filter\n $quoteWhere: Pair_filter\n $orderBy: Pair_orderBy\n $orderDirection: OrderDirection\n ) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n }\n ")};class Ma{QuerySellBase(e,t){try{let n;if(0===t.RStatus)n=this.ROneSellBase(e,t);else if(1===t.RStatus){const r=t.B0.minus(t.B),i=t.Q.minus(t.Q0);e.lt(r)?(n=this.RAboveSellBase(e,t),n.gt(i)&&(n=i)):n=e.eq(r)?i:i.plus(this.ROneSellBase(e.minus(r),t))}else n=this.RBelowSellBase(e,t);const r=n.multipliedBy(t.mtFeeRate),i=n.multipliedBy(t.lpFeeRate);return n.minus(r).minus(i)}catch(e){return new I(0)}}QuerySellQuote(e,t){try{let n;if(0===t.RStatus)n=this.ROneSellQuote(e,t);else if(1===t.RStatus)n=this.RAboveSellQuote(e,t);else{const r=t.B.minus(t.B0),i=t.Q0.minus(t.Q);e.lt(i)?(n=this.RBelowSellQuote(e,t),n.gt(r)&&(n=r)):n=e.eq(i)?r:r.plus(this.ROneSellQuote(e.minus(i),t))}const r=n.multipliedBy(t.mtFeeRate),i=n.multipliedBy(t.lpFeeRate);return n.minus(r).minus(i)}catch(e){return new I(0)}}GetMidPrice(e){if(2==e.RStatus){let t=e.Q0.multipliedBy(e.Q0).div(e.Q).div(e.Q);return t=new I(1).minus(e.k).plus(e.k.multipliedBy(t)),e.OraclePrice.div(t)}if(1==e.RStatus){let t=e.B0.multipliedBy(e.B0).div(e.B).div(e.B);return t=new I(1).minus(e.k).plus(e.k.multipliedBy(t)),e.OraclePrice.multipliedBy(t)}return e.OraclePrice}ROneSellBase(e,t){return Ua(t.Q0,t.Q0,e,t.OraclePrice,t.k)}ROneSellQuote(e,t){return Ua(t.B0,t.B0,e,new I(1).div(t.OraclePrice),t.k)}RAboveSellBase(e,t){return qa(t.B0,t.B.plus(e),t.B,t.OraclePrice,t.k)}RAboveSellQuote(e,t){return Ua(t.B0,t.B,e,new I(1).div(t.OraclePrice),t.k)}RBelowSellQuote(e,t){return qa(t.Q0,t.Q.plus(e),t.Q,new I(1).div(t.OraclePrice),t.k)}RBelowSellBase(e,t){return Ua(t.Q0,t.Q,e,t.OraclePrice,t.k)}}const qa=(e,t,n,r,i)=>{if(e.lte(0))throw new Error("TARGET_IS_ZERO");const s=r.multipliedBy(t.minus(n));if(i.eq(0))return s;const o=e.multipliedBy(e).div(t).div(n).multipliedBy(i);return s.multipliedBy(new I(1).minus(i).plus(o))},Ua=(e,t,n,r,i)=>{if(e.lte(0))throw new Error("TARGET_IS_ZERO");if(n.eq(0))return n;if(i.eq(0))return n.multipliedBy(r).gt(t)?t:n.multipliedBy(r);if(i.eq(1)){const i=r.multipliedBy(n).multipliedBy(t).div(e.multipliedBy(e));return t.multipliedBy(i).div(i.plus(1))}const s=i.multipliedBy(e).div(t).multipliedBy(e).plus(r.multipliedBy(n));let o,a=new I(1).minus(i).multipliedBy(t);a.gte(s)?(a=a.minus(s),o=!1):(a=s.minus(a),o=!0);let l=new I(4).multipliedBy(new I(1).minus(i)).multipliedBy(i).multipliedBy(e).multipliedBy(e);l=a.multipliedBy(a).plus(l).sqrt();const c=new I(2).multipliedBy(new I(1).minus(i));let u;return u=o?l.minus(a):a.plus(l),t.minus(u.div(c))},Va=(e,t,n,r)=>{if(e.eq(0))return new I(0);if(r.eq(0))return e.plus(n.multipliedBy(t));const i=r.multipliedBy(4).multipliedBy(n).multipliedBy(t).div(e).plus(1).sqrt().minus(1).div(r.multipliedBy(2)).plus(1);return e.multipliedBy(i)};class Ha{constructor(e){this.B=e.B,this.Q=e.Q,this.B0=e.B0,this.Q0=e.Q0,this.RStatus=e.R,this.OraclePrice=e.i,this.k=e.K,this.mtFeeRate=e.mtFeeRate,this.lpFeeRate=e.lpFeeRate}}function ja(e,t){let n=new I(e.toString());return t&&(n=n.div(new I(10**t))),n.dp(t)}const Qa={DVM:zs.dvmPoolABI,DSP:zs.dvmPoolABI,GSP:zs.dvmPoolABI,LPTOKEN:zs.dvmPoolABI,CLASSICAL:zs.classicalPoolABI,V3CLASSICAL:zs.classicalPoolABI,DPP:zs.dppPoolABI};function Ya({poolAddress:e,type:t,typeMethodObject:n,params:r=[]}){const i=n[t];if(!i)return null;const s=Qa[t];return s?{abiName:s,contractAddress:e,method:i,params:r}:null}class Ga{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequestsConfig)throw new Error("PoolApi does not initialize the contractRequests");this.contractRequests=new no(e.contractRequestsConfig)}}getTotalBaseLpQuery(e,t,n,r){return{queryKey:[to,"pool","getTotalBaseLpQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t||!n||void 0===r)return null;if("AMMV2"===n){const n=yield y(e,t);return new I(x(n,r))}const i=Ya({poolAddress:t,type:n,typeMethodObject:{DVM:"totalSupply",DSP:"totalSupply",GSP:"totalSupply",LPTOKEN:"totalSupply",CLASSICAL:"getTotalBaseCapital",V3CLASSICAL:"getTotalBaseCapital",DPP:null}});if(!i)return null;const s=yield this.contractRequests.batchCallQuery(e,i);return La(s,r)})}}getTotalQuoteLpQuery(e,t,n,r){return{queryKey:[to,"pool","getTotalQuoteLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t||!n||void 0===r)return null;const i=Ya({poolAddress:t,type:n,typeMethodObject:{DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getTotalQuoteCapital",V3CLASSICAL:"getTotalQuoteCapital",DPP:null}});if(!i)return null;const s=yield this.contractRequests.batchCallQuery(e,i);return La(s,r)})}}getUserBaseLpQuery(e,t,n,r,i){return{queryKey:[to,"pool","getUserBaseLp",...arguments],enabled:!!(e&&t&&n&&void 0!==r&&i),queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&void 0!==r&&i))return null;if("AMMV2"===n){const n=yield A(e,t,i);return new I(x(n,r))}const s=Ya({poolAddress:t,type:n,typeMethodObject:{DVM:"balanceOf",DSP:"balanceOf",GSP:"balanceOf",LPTOKEN:"balanceOf",CLASSICAL:"getBaseCapitalBalanceOf",V3CLASSICAL:"getBaseCapitalBalanceOf",DPP:null},params:[i]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return La(o,r)})}}getUserQuoteLpQuery(e,t,n,r,i){return{queryKey:[to,"pool","getUserQuoteLp",...arguments],enabled:!!(e&&t&&n&&void 0!==r&&i),queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&void 0!==r&&i))return null;const s=Ya({poolAddress:t,type:n,typeMethodObject:{DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getQuoteCapitalBalanceOf",V3CLASSICAL:"getQuoteCapitalBalanceOf",DPP:null},params:[i]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return La(o,r)})}}getReserveLpQuery(e,t,n,r,i){return"CLASSICAL"===n?this.getPMMStateQuery(e,t,n,r,i):{queryKey:[to,"pool","getReserveLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&void 0!==r&&void 0!==i))return null;if("AMMV2"===n){const n=yield E(e,t);return{baseReserve:La(n._reserve0.toString(),r),quoteReserve:La(n._reserve1.toString(),i)}}const s=Ya({poolAddress:t,type:n,typeMethodObject:{DVM:"getVaultReserve",DSP:"getVaultReserve",GSP:"getVaultReserve",LPTOKEN:"getVaultReserve",CLASSICAL:null,V3CLASSICAL:null,DPP:"getVaultReserve"},params:[]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return{baseReserve:La(o.baseReserve,r),quoteReserve:La(o.quoteReserve,i)}})}}getClassicalTargetQuery(e,t,n,r,i){return{queryKey:[to,"pool","getClassicalTargetQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&void 0!==r&&void 0!==i&&["CLASSICAL","V3CLASSICAL"].includes(n)))return null;const s=yield this.contractRequests.batchCallQuery(e,{abiName:zs.classicalPoolABI,contractAddress:t,method:"getExpectedTarget",params:[]});return{baseTarget:La(s.baseTarget,r),quoteTarget:La(s.quoteTarget,i)}})}}getTotalBaseMiningLpQuery(e,t,n,r,i){const s=!!n&&Ga.utils.getIsV3Mining(n);return{queryKey:[to,"pool","getTotalBaseMiningLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==i&&(s||!!r),queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&void 0!==i&&(s||r)))return null;let o;const a={DVM:"balanceOf",DSP:"totalSupply",GSP:"totalSupply",LPTOKEN:"totalSupply",CLASSICAL:"balanceOf",V3CLASSICAL:"totalSupply",DPP:null}[n];if(!a)return null;if(s)o={abiName:zs.v3MiningABI,contractAddress:t,method:a,params:[]};else{if(!r)return null;o={abiName:zs.dodoMiningABI,contractAddress:r,method:a,params:[t]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return La(l,i)})}}getTotalQuoteMiningLpQuery(e,t,n,r,i){const s=!!n&&Ga.utils.getIsV3Mining(n);return{queryKey:[to,"pool","getTotalQuoteMiningLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==i&&(s||!!r),queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t||!n||void 0===i)return null;let o;const a={DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"balanceOf",V3CLASSICAL:"totalSupply",DPP:null}[n];if(!a)return null;if(s)o={abiName:zs.v3MiningABI,contractAddress:t,method:a,params:[]};else{if(!r)return null;o={abiName:zs.dodoMiningABI,contractAddress:r,method:a,params:[t]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return La(l,i)})}}getUserBaseMiningLpQuery(e,t,n,r,i,s){const o=!!n&&Ga.utils.getIsV3Mining(n);return{queryKey:[to,"pool","getUserBaseMiningLp",...arguments],enabled:!!e&&!!s&&!!t&&!!n&&void 0!==i&&(o||!!r),queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&s&&t&&n&&void 0!==i))return null;let o;const a={DVM:"getUserLpBalance",DSP:"balanceOf",GSP:"balanceOf",LPTOKEN:"balanceOf",CLASSICAL:"getUserLpBalance",V3CLASSICAL:"balanceOf",DPP:null}[n];if(!a)return null;if(Ga.utils.getIsV3Mining(n))o={abiName:zs.v3MiningABI,contractAddress:t,method:a,params:[s]};else{if(!r)return null;o={abiName:zs.dodoMiningABI,contractAddress:t,method:a,params:[r,s]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return La(l,i)})}}getUserQuoteMiningLpQuery(e,t,n,r,i,s){const o=!!n&&Ga.utils.getIsV3Mining(n);return{queryKey:[to,"pool","getUserQuoteMiningLp",...arguments],enabled:!!e&&!!s&&!!t&&!!n&&void 0!==i&&(o||!!r),queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&s&&t&&n&&void 0!==i))return null;let o;const a={DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getUserLpBalance",V3CLASSICAL:"balanceOf",DPP:null}[n];if(!a)return null;if(Ga.utils.getIsV3Mining(n))o={abiName:zs.v3MiningABI,contractAddress:t,method:a,params:[s]};else{if(!r)return null;o={abiName:zs.dodoMiningABI,contractAddress:t,method:a,params:[r,s]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return La(l,i)})}}getLPFeeRateQuery(e,t,n){return{queryKey:[to,"pool","getLpFeeRateQuery",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t||!n)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:zs.dvmPoolABI,contractAddress:t,method:"_LP_FEE_RATE_",params:[]});return new I(r.toString()).div(10**18)})}}getFeeRateQuery(e,t,n,r){return{queryKey:[to,"pool","getFeeRateQuery",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>V(this,void 0,void 0,function*(){var i;if(!e||!t||!n)return null;let s=new I(0),o=new I(0);if("CLASSICAL"===n){const{ROUTE_V1_DATA_FETCH:n}=q[e],r=yield this.contractRequests.batchCallQuery(e,{abiName:zs.DODOV1PmmHelperABI,contractAddress:n,method:"getPairDetail",params:[t]}),a=null===(i=null==r?void 0:r.res)||void 0===i?void 0:i[0];s=new I(a.lpFeeRate.toString()).div(10**18),o=new I(a.mtFeeRate.toString()).div(10**18)}else if("AMMV2"===n)if(b(e)&&v(e)){const n=yield w(e,t),r=La(n.toString(),4);s=r.times(.8),o=r.times(.2)}else s=new I(.003),o=new I(0);else{const n=yield this.contractRequests.batchCallQuery(e,{abiName:zs.dvmPoolABI,contractAddress:t,method:"getUserFeeRate",params:[null!=r?r:t]});s=new I(n.lpFeeRate.toString()).div(10**18),o=new I(n.mtFeeRate.toString()).div(10**18)}return{lpFeeRate:s,mtFeeRate:o}})}}getPMMStateQuery(e,t,n,r,i){return{queryKey:[to,"pool","getPMMStateQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>V(this,void 0,void 0,function*(){var s;if(!e||!t||!n||void 0===r||void 0===i)return null;if("AMMV2"===n||"AMMV3"===n)return null;let o=null,a=null;if("CLASSICAL"===n){const{ROUTE_V1_DATA_FETCH:n}=q[e],r=yield this.contractRequests.batchCallQuery(e,{abiName:zs.DODOV1PmmHelperABI,contractAddress:n,method:"getPairDetail",params:[t]});o=null===(s=null==r?void 0:r.res)||void 0===s?void 0:s[0]}else{if(!["DVM","DPP","LPTOKEN","DSP","GSP"].includes(n))throw new Error(`type: ${n} not supported`);o=yield this.contractRequests.batchCallQuery(e,{abiName:zs.dvmPoolABI,contractAddress:t,method:"getPMMStateForCall",params:[]}),a=yield this.contractRequests.batchCallQuery(e,{abiName:zs.dvmPoolABI,contractAddress:t,method:"totalSupply",params:[]})}if(!Array.isArray(o)||!o.length)throw new Error("queryResult is not valid.");const l=function(e,t,n){const r=ja(e.i,18-t+n),i=ja(e.K,18),s=ja(e.B,t),o=ja(e.Q,n),a=ja(e.B0,t),l=ja(e.Q0,n),c=parseInt(e.R.toString());let u,d;return e.lpFeeRate&&(u=ja(e.lpFeeRate,18)),e.mtFeeRate&&(d=ja(e.mtFeeRate,18)),{q:o,b:s,k:i,i:r,b0:a,q0:l,R:c,lpFeeRate:u,mtFeeRate:d}}(o,r,i);let c,u;if(Array.isArray(a)&&(c=new I(a[0].toString())),l.q.isEqualTo(0)&&2===l.R||l.b.isEqualTo(0)&&(1===l.R||0===l.R));else{const e=new Ma,t=new Ha({Q:l.q,B:l.b,K:l.k,i:l.i,B0:l.b0,Q0:l.q0,R:l.R,mtFeeRate:new I(0),lpFeeRate:new I(0)});u=e.GetMidPrice(t),u.isNaN()&&(u=void 0)}return{midPrice:u,pmmParamsBG:l,baseReserve:l.b,quoteReserve:l.q,totalSupplyBG:c}})}}getDPPOwnerProxyAddressQuery(e,t){return{queryKey:[...arguments],enabled:!!e&&!!t,queryFn:()=>e&&t?this.contractRequests.batchCallQuery(e,{abiName:zs.IdodoV2,contractAddress:t,method:"_OWNER_",params:[]}):null}}getWithdrawBasePenaltyQuery(e,t,n,r){return{queryKey:[...arguments],enabled:!!(e&&t&&n&&r),queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&r))return null;const i=yield this.contractRequests.batchCallQuery(e,{abiName:zs.dodoPair,contractAddress:t,method:"getWithdrawBasePenalty",params:[n]});return La(i,r)})}}}Ga.graphql=Fa,Ga.utils=Ca,Ga.encode={createDSPPoolABI(e,t,n,r,i,s,o,a,l){return V(this,arguments,void 0,function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_DSP_PROXY:u}=q[e];return{to:u,data:yield Ws(zs.dodoDspProxy,"createDODOStablePair",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),Se(new I(o).toString(),18-t.decimals+n.decimals).toString(),Se(new I(a).toString(),18).toString(),c,l])}})},createGSPPoolABI(e,t,n,r,i,s,o,a,l,c){return V(this,void 0,void 0,function*(){const{DODO_DSP_PROXY:u}=q[e];return{to:u,data:yield Ws(zs.dodoDspProxy,"createDODOGasSavingPair",[t,n.address,r.address,i,s,new I(o).div(1e4).multipliedBy(10**18).toString(),"0",Se(new I(a).toString(),18-n.decimals+r.decimals).toString(),Se(new I(l).toString(),18).toString(),"1000",c])}})},createDVMPoolABI(e,t,n,r,i,s,o,a,l){return V(this,arguments,void 0,function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_PROXY:u}=q[e];return{to:u,data:yield Ws(zs.dodoProxyV2,"createDODOVendingMachine",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),Se(new I(o).toString(),18-t.decimals+n.decimals).toString(),Se(new I(a).toString(),18).toString(),c,l])}})},createDPPPoolABI(e,t,n,r,i,s,o,a,l){return V(this,arguments,void 0,function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_DPP_PROXY:u}=q[e];return{to:u,data:yield Ws(zs.dodoDppProxy,"createDODOPrivatePool",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),Se(new I(o).toString(),18-t.decimals+n.decimals).toString(),Se(new I(a).toString(),18).toString(),c,l])}})},removeDPPPoolABI(e,t,n,r,i,s,o,a,l,c){return V(this,void 0,void 0,function*(){const u=new I(t).div(1e4).multipliedBy(10**18).toString(),d=Se(new I(n).toString(),18-l+c).toString(),h=Se(new I(r).toString(),18).toString(),f=yield Ws(zs.dodoDPPAdmin,"reset",["0x0000000000000000000000000000000000000000",u,d,h,i,s,o,a]);return{to:e,data:f}})},resetDPPPoolABI(e,t,n,r,i,s,o,a,l,c,u,d,h,f,p){return V(this,void 0,void 0,function*(){const{DODO_DPP_PROXY:m}=q[e],g=new I(n).div(1e4).multipliedBy(10**18).toString(),y=Se(new I(r).toString(),18-h+f).toString(),A=Se(new I(i).toString(),18).toString();return{to:m,data:yield Ws(zs.dodoDppProxy,"resetDODOPrivatePool",[t,[g,y,A],[s,o,a,l],d,c,u,p])}})},addDSPLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,function*(){if(!i||"0"===i)throw new Error("Invalid baseMinAmount");const{DODO_DSP_PROXY:l}=q[e];return{to:l,data:yield Ws(zs.dodoDspProxy,"addDSPLiquidity",[t,n,r,i,s,o,a])}})},addDVMLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,function*(){if(!i||"0"===i)throw new Error("Invalid baseMinAmount");const{DODO_PROXY:l}=q[e];return{to:l,data:yield Ws(zs.dodoProxyV2,"addDVMLiquidity",[t,n,r,i,s,o,a])}})},removeDSPLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,function*(){if(28!=e&&69!=e){const{CALLEE_HELPER:t}=q[e];o&&(n=t)}const l=yield Ws(zs.dodoDSP,"sellShares",[r,n,i,s,o?"0x00":"0x",a]);return{to:t,data:l}})},removeDVMLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,function*(){if(28!=e&&69!=e){const{CALLEE_HELPER:t}=q[e];o&&(n=t)}const l=yield Ws(zs.dodoDVM,"sellShares",[r,n,i,s,o?"0x00":"0x",a]);return{to:t,data:l}})},addClassicalLiquidityABI(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,function*(){const{DODO_PROXY:l}=q[e];return{to:l,data:yield Ws(zs.dodoProxyV2,"addLiquidityToV1",[t,n,r,i,s,o,a])}})},removeClassicalBaseABI(e,t,n,r){return V(this,void 0,void 0,function*(){const{DODO_V1_PAIR_PROXY:i}=q[e];let s="",o="";return i?(o=i,s=yield Ws(zs.dodoV1PairProxy,"withdrawBase",[t,n,r])):(o=t,s=yield Ws(zs.dodoPair,"withdrawBase",[n])),{to:o,data:s}})},removeMaxClassicalBaseABI(e,t,n){return V(this,void 0,void 0,function*(){const{DODO_V1_PAIR_PROXY:r}=q[e];let i="",s="";return r?(s=r,i=yield Ws(zs.dodoV1PairProxy,"withdrawAllBase",[t,n])):(s=t,i=yield Ws(zs.dodoPair,"withdrawAllBase",[])),{to:s,data:i}})},removeClassicalQuoteABI(e,t,n,r){return V(this,void 0,void 0,function*(){const{DODO_V1_PAIR_PROXY:i}=q[e];let s="",o="";return i?(o=i,s=yield Ws(zs.dodoV1PairProxy,"withdrawQuote",[t,n,r])):(o=t,s=yield Ws(zs.dodoPair,"withdrawQuote",[n])),{to:o,data:s}})},removeMaxClassicalQuoteABI(e,t,n){return V(this,void 0,void 0,function*(){const{DODO_V1_PAIR_PROXY:r}=q[e];let i="",s="";return r?(s=r,i=yield Ws(zs.dodoV1PairProxy,"withdrawAllQuote",[t,n])):(s=t,i=yield Ws(zs.dodoPair,"withdrawAllQuote",[])),{to:s,data:i}})}};const Xa=(e,t,n,r,i)=>{const s=r.multipliedBy(t.minus(n)),o=e.multipliedBy(e).div(t).div(n).multipliedBy(i);return s.multipliedBy(new C(1).minus(i).plus(o))},$a=(e,t,n,r,i)=>{let s=new C(1).minus(i).multipliedBy(t);s=s.minus(i.multipliedBy(e).multipliedBy(e).div(t)),s=s.plus(n.multipliedBy(r));let o=new C(4).multipliedBy(new C(1).minus(i)).multipliedBy(i).multipliedBy(e).multipliedBy(e);o=s.multipliedBy(s).plus(o).sqrt();const a=new C(2).multipliedBy(new C(1).minus(i));return s.plus(o).div(a)},Ka=(e,t,n)=>{let r=new C(4).multipliedBy(t).multipliedBy(n).div(e);r=new C(1).plus(r).sqrt();const i=r.minus(new C(1)).div(t.multipliedBy(new C(2)));return e.multipliedBy(new C(1).plus(i))};C.config({EXPONENTIAL_AT:1e3,DECIMAL_PLACES:80});class za{getMidPrice(){if(0===this.RStatus)return this.i;const e=this.getExpectedTarget();if(1===this.RStatus){let t=e.base.div(this.B);return t=t.multipliedBy(t).multipliedBy(this.k).minus(this.k).plus(new C(1)),this.i.multipliedBy(t)}if(2===this.RStatus){let t=e.quote.div(this.Q);return t=t.multipliedBy(t).multipliedBy(this.k).minus(this.k).plus(new C(1)),this.i.div(t)}return this.i}getQuoteByMidPrice(e){if(1!==this.RStatus)throw new Error("No support is needed at the moment");const t=e.div(this.k.times(this.i)).plus(1).minus(new C(1).div(this.k)).times(this.B).times(this.B).sqrt();return this.i.times(this.k.div(this.B).times(t).times(t).plus(new C(1).minus(this.k.times(2)).times(t)).minus(new C(1).minus(this.k).times(this.B)))}getExpectedTarget(){let e,t;return e=this.B0,t=this.Q0,0===this.RStatus&&(e=this.B0,t=this.Q0),1===this.RStatus&&(t=this.Q0,e=Ka(this.B,this.k,this.Q.minus(this.Q0).div(this.i))),2===this.RStatus&&(e=this.B0,t=Ka(this.Q,this.k,this.B.minus(this.B0).multipliedBy(this.i))),{base:e,quote:t}}queryBuyBase(e){const t=e.multipliedBy(this.mtFeeRate),n=e.multipliedBy(this.lpFeeRate);e=e.plus(t).plus(n);const r=this.getExpectedTarget();let i=new C(0);if(0===this.RStatus)i=this.ROneBuyBase(e,r.base);else if(1===this.RStatus)i=this.RAboveBuyBase(e,r.base);else{const t=this.B.minus(r.base),n=r.quote.minus(this.Q);i=e.isLessThanOrEqualTo(t)?this.RBelowBuyBase(e,r.quote):n.plus(this.ROneBuyBase(e.minus(t),r.base))}return i}querySellBase(e){let t;const n=this.getExpectedTarget();if(0===this.RStatus)t=this.ROneSellBase(e,n.quote);else if(2===this.RStatus)t=this.RBelowSellBase(e,n.quote);else{const r=n.base.minus(this.B),i=this.Q.minus(n.quote);t=e.isLessThanOrEqualTo(r)?this.RAboveSellBase(e,n.base):i.plus(this.ROneSellBase(e.minus(r),n.quote))}const r=t.multipliedBy(this.mtFeeRate),i=t.multipliedBy(this.lpFeeRate);return t.minus(r).minus(i)}queryBuyQuote(e){const t=e.multipliedBy(this.mtFeeRate),n=e.multipliedBy(this.lpFeeRate);e=e.plus(t).plus(n);const r=this.getExpectedTarget();if(0===this.RStatus)return this.ROneBuyQuote(e,r.quote);if(2===this.RStatus)return this.RBelowBuyQuote(e,r.quote);const i=r.base.minus(this.B),s=this.Q.minus(r.quote);return e.isLessThanOrEqualTo(s)?this.RAboveBuyQuote(e,r.base):i.plus(this.ROneBuyQuote(e.minus(s),r.quote))}querySellQuote(e){let t;const n=this.getExpectedTarget();if(0===this.RStatus)t=this.ROneSellQuote(e,n.base);else if(1===this.RStatus)t=this.RAboveSellQuote(e,n.base);else{const r=this.B.minus(n.base),i=n.quote.minus(this.Q);t=e.isLessThanOrEqualTo(i)?this.RBelowSellQuote(e,n.quote):r.plus(this.ROneSellQuote(e.minus(i),n.base))}const r=t.multipliedBy(this.mtFeeRate),i=t.multipliedBy(this.lpFeeRate);return t.minus(r).minus(i)}getPriceDepth(e){const t=this.getExpectedTarget();let n,r;if(e.gt(this.i)){const i=e.div(this.i);n=t.base.div(i.minus(1).plus(this.k).div(this.k).sqrt()),r=this.ROneBuyBase(t.base.minus(n),t.base).plus(t.quote)}else{const i=this.i.div(e);r=t.quote.div(i.minus(1).plus(this.k).div(this.k).sqrt()),n=this.ROneBuyQuote(t.quote.minus(r),t.quote).plus(t.base)}return{baseAmount:this.B.minus(n).abs(),quoteAmount:this.Q.minus(r).abs(),isBuy:this.B.gt(n)}}getWithdrawBasePenalty(e){if(1===this.RStatus){const t=Ka(this.B,this.k,this.Q.minus(this.Q0).div(this.i)),n=Ka(this.B.minus(e),this.k,this.Q.minus(this.Q0).div(this.i));return t.minus(n).minus(e)}return new C(0)}getWithdrawQuotePenalty(e){if(2===this.RStatus){const t=Ka(this.Q,this.k,this.B.minus(this.B0).multipliedBy(this.i)),n=Ka(this.Q.minus(e),this.k,this.B.minus(this.B0).multipliedBy(this.i));return t.minus(n).minus(e)}return new C(0)}ROneBuyBase(e,t){return e.isGreaterThanOrEqualTo(t),Xa(t,t,t.minus(e),this.i,this.k)}ROneBuyQuote(e,t){return e.isGreaterThanOrEqualTo(t),Xa(t,t,t.minus(e),new C(1).div(this.i),this.k)}ROneSellBase(e,t){const n=$a(t,t,this.i,e.negated(),this.k);return t.minus(n)}ROneSellQuote(e,t){const n=$a(t,t,new C(1).div(this.i),e.negated(),this.k);return t.minus(n)}RAboveBuyBase(e,t){if(e.isGreaterThanOrEqualTo(this.B))throw new Error("RAbove Buy Base Amount Exceed Limitation");return Xa(t,this.B,this.B.minus(e),this.i,this.k)}RAboveSellBase(e,t){if(e.plus(this.B).isGreaterThan(t))throw new Error("RAbove Sell Base Amount Exceed Limitation");return Xa(t,this.B.plus(e),this.B,this.i,this.k)}RAboveBuyQuote(e,t){return $a(t,this.B,new C(1).div(this.i),e,this.k).minus(this.B)}RAboveSellQuote(e,t){const n=$a(t,this.B,new C(1).div(this.i),e.negated(),this.k);return this.B.minus(n)}RBelowBuyQuote(e,t){if(e.isGreaterThanOrEqualTo(this.Q))throw new Error("RBelow Buy Quote Amount Exceed Limitation");return Xa(t,this.Q,this.Q.minus(e),new C(1).div(this.i),this.k)}RBelowSellQuote(e,t){if(e.plus(this.Q).isGreaterThan(t))throw new Error("RBelow Sell Quote Amount Exceed Limitation");return Xa(t,this.Q.plus(e),this.Q,new C(1).div(this.i),this.k)}RBelowBuyBase(e,t){return $a(t,this.Q,this.i,e,this.k).minus(this.Q)}RBelowSellBase(e,t){const n=$a(t,this.Q,this.i,e.negated(),this.k);return this.Q.minus(n)}}function Ja({q:e,b:t,k:n,i:r,q0:i,b0:s,R:o}){const a=new za;return a.B0=new I(s),a.Q0=new I(i),a.B=new I(t),a.Q=new I(e),a.i=new I(r),a.k=new I(n),a.RStatus=o,a.mtFeeRate=new I(0),a.lpFeeRate=new I(0),a}function Wa(e){return e&&/^#[a-f\d]{3,6}\s*[0-9]{1,3}%/i.test(e)?(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})\s*([0-9]{1,3})*%?$/i.exec(e),(t=n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:n[4]?Number(n[4])/100:1}:void 0)?`rgba(${t.r}, ${t.g}, ${t.b}, ${t.a})`:t):e;var t,n}var Za;!function(e){e.All="all"}(Za||(Za={}));class el{constructor(e){this.restApiRequest=(null==e?void 0:e.restApiRequest)||new Ia}getWidgetTokenListConfig(e,t){return this.restApiRequest.getJson("/config-center/user/tokenlist/v2",{project:e,apikey:t})}convertConfigToSwapWidgetProps(e){var t,n,r,i,s,o,a,l;const c=[];let u,d=!0,h=!0;if(e.chains.forEach(e=>{e.fromTokens&&(d=!1),e.toTokens&&(h=!1)}),e.chains.forEach(({chainId:e,fromTokens:t,toTokens:n,tokens:r})=>{if(null==r?void 0:r.length){const i=Number(e);[{isAllChain:d,selectTokens:t,side:"from"},{isAllChain:h,selectTokens:n,side:"to"}].forEach(({isAllChain:e,selectTokens:t,side:n})=>{(e||t)&&((null==t?void 0:t.length)?r.forEach(e=>{var r;t.some(t=>t.toLocaleLowerCase()===e.address.toLocaleLowerCase())&&c.push(Object.assign(Object.assign({logoURI:e.logoImg},e),{chainId:null!==(r=e.chainId)&&void 0!==r?r:i,side:n}))}):r.forEach(e=>{var t;c.push(Object.assign(Object.assign({logoURI:e.logoImg},e),{chainId:null!==(t=e.chainId)&&void 0!==t?t:i,side:n}))}))})}}),(null==e?void 0:e.style)&&Object.keys(e.style).length){const n=null===(t=null==e?void 0:e.basis)||void 0===t?void 0:t.fontSizeModify;u={palette:{mode:"light",primary:{main:Wa(e.style.primary)},secondary:{main:Wa(e.style.secondary),contrastText:Wa(e.style.secondaryContrast)},error:{main:Wa(e.style.error),contrastText:Wa(e.style.errorContrast)},warning:{main:Wa(e.style.warning)},success:{main:Wa(e.style.success)},background:{paper:Wa(e.style.background1),paperContrast:Wa(e.style.background2),backdrop:Wa(e.style.mask),input:Wa(e.style.input),tag:Wa(e.style.card)},text:{primary:Wa(e.style.text1),secondary:Wa(e.style.text2),disabled:Wa(e.style.textDisable),placeholder:Wa(e.style.textPlaceholder)},border:{main:Wa(e.style.borderSolid),light:Wa(e.style.borderDash),disabled:Wa(e.style.borderSolid)}},typography:n?{fontSize:16+n,ht:{fontSize:36+n},h2:{fontSize:32+n},h3:{fontSize:28+n},caption:{fontSize:20+n},h5:{fontSize:18+n},body1:{fontSize:16+n},body2:{fontSize:14+n},h6:{fontSize:12+n},button:{fontSize:16+n}}:void 0}}const f=e.rebateAddress,p=e.rebateRatio,m=e.swapSlippage,g=e.crossChainSlippage,y=null===(n=e.basis)||void 0===n?void 0:n.width,A=null===(r=e.basis)||void 0===r?void 0:r.height,E=null===(i=e.basis)||void 0===i?void 0:i.locale,b=null===(o=null===(s=e.basis)||void 0===s?void 0:s.crossChainSupport)||void 0===o||o,v=null===(a=e.basis)||void 0===a?void 0:a.rpcMap,w=null===(l=e.basis)||void 0===l?void 0:l.noPowerBy;return{tokenList:c,theme:u,rebateAddress:f,rebateRatio:p,swapSlippage:m,bridgeSlippage:g,width:y,height:A,locale:E,crossChain:b,jsonRpcUrlMap:v,noPowerBy:w}}getConfigSwapWidgetProps(e,t){return V(this,void 0,void 0,function*(){var n;const{result:r}=yield this.getWidgetTokenListConfig(e,t),i=r.data;if(!i)throw new Error(null!==(n=r.msg)&&void 0!==n?n:"Error");return{swapWidgetProps:this.convertConfigToSwapWidgetProps(i),configTokenList:i}})}}const tl={fetchMiningList:Na("\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n "),fetchMiningListV1:Na("\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n "),fetchMyCreatedMiningList:Na("\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ")};var nl;!function(e){e[e.upcoming=0]="upcoming",e[e.active=1]="active",e[e.ended=2]="ended"}(nl||(nl={}));const rl={getMiningStatusByTimestamp:({startTime:e,endTime:t,rewardTokenInfoList:n})=>{let r,i;for(const s of n){const n=s.startTime||e,o=s.endTime||t;n&&(r=r?I.min(n,r):I.isBigNumber(n)?n:new I(n)),o&&(i=i?I.max(o,i):I.isBigNumber(o)?o:new I(o))}const s=new I(Math.floor(Date.now()/1e3));let o=nl.ended;return r&&s.lt(r)&&(o=nl.upcoming),r&&i&&s.gte(r)&&s.lte(i)&&(o=nl.active),{status:o,firstStartTime:r,lastEndTime:i,currentTime:s}}},il=[{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimAllRewards",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"isLpToken",type:"bool"},{internalType:"uint256",name:"platform",type:"uint256"},{internalType:"address[]",name:"rewardTokens",type:"address[]"},{internalType:"uint256[]",name:"rewardPerBlock",type:"uint256[]"},{internalType:"uint256[]",name:"startBlock",type:"uint256[]"},{internalType:"uint256[]",name:"endBlock",type:"uint256[]"}],name:"createDODOMineV3",outputs:[{internalType:"address",name:"newMineV3",type:"address"}],stateMutability:"nonpayable",type:"function"}],sl=[{inputs:[{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"isLpToken",type:"bool"},{internalType:"address[]",name:"rewardTokens",type:"address[]"},{internalType:"uint256[]",name:"rewardPerBlock",type:"uint256[]"},{internalType:"uint256[]",name:"startBlock",type:"uint256[]"},{internalType:"uint256[]",name:"endBlock",type:"uint256[]"}],name:"createDODOMineV3",outputs:[{internalType:"address",name:"newMineV3",type:"address"}],stateMutability:"nonpayable",type:"function"}];class ol{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("MiningApi does not initialize the contractRequests");this.contractRequests=new no(e.contractRequestsConfig)}}getPendingRewardQuery(e,t,n,r,i,s){return{queryKey:[to,"mining","getPendingRewardQuery",...arguments],enabled:!!(e&&t&&n&&r&&void 0!==i),queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&r&&void 0!==i))return null;let o;if("3"===s)o=yield this.contractRequests.batchCallQuery(e,{abiName:zs.v3MiningABI,contractAddress:t,method:"getPendingRewardByToken",params:[n,r]});else o=yield this.contractRequests.batchCallQuery(e,{abiName:zs.dodoMiningABI,contractAddress:t,method:"getPendingReward",params:[r,n]});return La(o,i)})}}getLpStakedBalance(e,t,n,r,i,s){return{queryKey:[to,"mining","getLpStakedBalance",...arguments],enabled:!(!e||!t||!n||void 0===i||"3"!==s&&!r),queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&void 0!==i)||"3"!==s&&!r)return null;let o;if("3"===s)o=yield this.contractRequests.batchCallQuery(e,{abiName:zs.v3MiningABI,contractAddress:t,method:"balanceOf",params:[n]});else o=yield this.contractRequests.batchCallQuery(e,{abiName:zs.dodoMiningABI,contractAddress:t,method:"getUserLpBalance",params:[n,r]});return La(o,i)})}}getRewardTokenInfos(e,t,n,r){return{queryKey:[to,"mining","getRewardTokenInfos",...arguments],enabled:null!=e&&null!=t&&null!=n&&!r,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:zs.v3MiningABI,contractAddress:t,method:"rewardTokenInfos",params:[n]});if(!r)return null;const{rewardVault:i,rewardPerBlock:s,workThroughReward:o,lastFlagBlock:a,startBlock:l,endBlock:c}=r;return{rewardVault:i,rewardPerBlock:La(s,0),workThroughReward:o?La(o,0):void 0,lastFlagBlock:a?La(a,0):void 0,startBlock:La(l,0),endBlock:La(c,0)}})}}}ol.utils=rl,ol.graphql=tl,ol.encode={depositMining(e,t,n){return V(this,void 0,void 0,function*(){const r=Zs(il,"deposit",[Se(t.dp(n,I.ROUND_FLOOR).toString(),n).toString()]);return{to:e,data:r}})},withdrawMining(e,t,n){return V(this,void 0,void 0,function*(){const r=Zs(il,"withdraw",[Se(t.dp(n,I.ROUND_FLOOR).toString(),n).toString()]);return{to:e,data:r}})},claimAllMining(e){return V(this,void 0,void 0,function*(){const t=Zs(il,"claimAllRewards",[]);return{to:e,data:t}})},createDODOMineV3(e,t,n,r,i,s,o,a){return V(this,void 0,void 0,function*(){const{DODO_MINEV3_PROXY:l}=q[e];if(!l)return null;let c;return c=[1,10,288,66,128,137,1285,42161,1313161554,43114].includes(e)?Zs(sl,"createDODOMineV3",[t,n,i,s,o,a]):Zs(il,"createDODOMineV3",[t,n,r,i,s,o,a]),{to:l,data:c}})}};const al={fetchErc20SwapCrossList:Na("\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n }\n "),fetchErc20ForecastSlippage:Na("\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n }\n ")},ll=new I(2).pow(256).minus(1);function cl(e){return e?e.replaceAll("\0",""):e}class ul{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("TokenApi does not initialize the contractRequests");this.contractRequests=new no(e.contractRequestsConfig)}this.restApiRequest=(null==e?void 0:e.restApiRequest)||new Ia}getTokenDecimals(e,t){return{queryKey:["token","getTokenDecimals",null!=e?e:"",null==t?void 0:t.toLocaleLowerCase()],enabled:!!e&&!!t,queryFn:()=>V(this,void 0,void 0,function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:zs.erc20ABI,contractAddress:t,method:"decimals",params:[]})})}}getFiatPriceBatch(e,t){return this.restApiRequest.postJson("/frontend-v2-price-api/current/batch",{networks:e.map(e=>U[e.chainId]),addresses:e.map(e=>e.address),symbols:e.map(e=>e.symbol),isCache:!0},void 0,{headers:{"pass-key":t}})}getFetchTokenQuery(e,t,n,r){let i=r,s="";if(void 0!==e){const t=q[e];i||(i=null==t?void 0:t.DODO_APPROVE),s=null==t?void 0:t.ERC20_HELPER}return{queryKey:[to,"token","getFetchTokenQuery",null!=e?e:"",null==n?void 0:n.toLocaleLowerCase(),null==i?void 0:i.toLocaleLowerCase(),null==t?void 0:t.toLocaleLowerCase()],enabled:!!e&&!!t&&!!n,queryFn:()=>V(this,void 0,void 0,function*(){if(!(e&&t&&n&&i))return null;const o=yield(e=>V(void 0,void 0,void 0,function*(){let t=[];if(!t.length)switch(e){case S.MAINNET:t=(yield import("./eth-B9cviUl5.js")).default;break;case S.BSC:t=(yield import("./bsc-3D5wcqPq.js")).default}return t}))(e);if(o.includes(t))return null;const a=M[e];if(ul.utils.isSameAddress(t,a.address)){const t=yield this.contractRequests.getETHBalance(e,n);return{symbol:a.symbol,address:a.address,name:a.name,decimals:a.decimals,balance:t,allowance:ll,account:n,spender:r,chainId:e}}const l=yield this.contractRequests.batchCallQuery(e,{abiName:zs.erc20Helper,contractAddress:s,method:"isERC20",params:[t,n,i]}),{name:c,isOk:u}=l;if(u&&c){const n=parseInt(l.decimals,10),i=new I(10).pow(n),s=new I(l.allownance.toString()).div(i),o=new I(l.balance.toString()).div(i);return{address:t,decimals:n,symbol:cl(l.symbol),name:cl(c),balance:o,spender:r,allowance:s,chainId:e}}return null})}}}ul.graphql=al,ul.utils={isSameAddress:(e,t)=>{const n=e.length,r=t.length;if(0===n||0===r)return!1;if(n===r)return e.toLowerCase()===t.toLowerCase();const i=e.substring(2,n).toLowerCase(),s=t.substring(2,n).toLowerCase();return i.length>s.length?i.endsWith(s):s.endsWith(i)}},ul.encode={approveABI:(e,t)=>Ws(zs.erc20ABI,"approve",[e,t.toFixed()]),transferEncodeABI(e,t){return V(this,void 0,void 0,function*(){return yield Ws(zs.erc20ABI,"transfer",[e,t])})}};const dl={fetchUserSwapOrderHistories:Na("\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ")};class hl{constructor(){}}hl.graphql=dl;const fl={fetchNoticeCenterTransactionList:Na("\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n "),fetchLiquidityLpPartnerRewards:Na("\n query FetchLiquidityLpPartnerRewards(\n $where: LiquidityLpPartnerRewardsInput\n ) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n }\n "),fetchUserprofileReward:Na("\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n }\n ")};class pl{constructor(){}}pl.graphql=fl;export{zs as ABIName,Sa as AMMV3Api,to as CONTRACT_QUERY_KEY,S as ChainId,no as ContractRequests,Pa as GraphQLRequests,ol as MiningApi,nl as MiningStatusE,Ma as PMMHelper,za as PMMModel,Ha as PMMState,Ga as PoolApi,Ia as RestApiRequests,hl as SwapApi,el as SwapWidgetApi,pl as SystemApi,ul as TokenApi,M as basicTokenMap,q as contractConfig,L as etherTokenAddress,Ja as getPmmModel,U as platformIdMap,Va as solveQuadraticFunctionForTarget};
|