@across-protocol/sdk 4.3.111-alpha.4 → 4.3.111
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/cjs/addressAggregator/adapters/abstract.js +64 -50
- package/dist/cjs/addressAggregator/adapters/abstract.js.map +1 -1
- package/dist/cjs/addressAggregator/adapters/bybit.js +29 -16
- package/dist/cjs/addressAggregator/adapters/bybit.js.map +1 -1
- package/dist/cjs/addressAggregator/adapters/env.js +15 -11
- package/dist/cjs/addressAggregator/adapters/env.js.map +1 -1
- package/dist/cjs/addressAggregator/adapters/file.js +45 -32
- package/dist/cjs/addressAggregator/adapters/file.js.map +1 -1
- package/dist/cjs/addressAggregator/adapters/index.js +1 -1
- package/dist/cjs/addressAggregator/adapters/risklabs.js +36 -22
- package/dist/cjs/addressAggregator/adapters/risklabs.js.map +1 -1
- package/dist/cjs/addressAggregator/index.js +87 -57
- package/dist/cjs/addressAggregator/index.js.map +1 -1
- package/dist/cjs/apiClient/abstractClient.js +8 -9
- package/dist/cjs/apiClient/abstractClient.js.map +1 -1
- package/dist/cjs/apiClient/index.js +1 -1
- package/dist/cjs/apiClient/mockedClient.js +29 -23
- package/dist/cjs/apiClient/mockedClient.js.map +1 -1
- package/dist/cjs/apiClient/productionClient.js +103 -65
- package/dist/cjs/apiClient/productionClient.js.map +1 -1
- package/dist/cjs/arch/evm/BlockUtils.js +208 -122
- package/dist/cjs/arch/evm/BlockUtils.js.map +1 -1
- package/dist/cjs/arch/evm/MessageUtils.js +1 -1
- package/dist/cjs/arch/evm/MessageUtils.js.map +1 -1
- package/dist/cjs/arch/evm/SpokeUtils.js +288 -134
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/evm/index.js +1 -1
- package/dist/cjs/arch/evm/utils/index.js +1 -1
- package/dist/cjs/arch/evm/utils/wait.js +49 -38
- package/dist/cjs/arch/evm/utils/wait.js.map +1 -1
- package/dist/cjs/arch/index.js +1 -1
- package/dist/cjs/arch/svm/BlockUtils.js +158 -102
- package/dist/cjs/arch/svm/BlockUtils.js.map +1 -1
- package/dist/cjs/arch/svm/MessageUtils.js +2 -2
- package/dist/cjs/arch/svm/MessageUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.js +1147 -708
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/encoders.js +1 -1
- package/dist/cjs/arch/svm/encoders.js.map +1 -1
- package/dist/cjs/arch/svm/eventsClient.js +236 -174
- package/dist/cjs/arch/svm/eventsClient.js.map +1 -1
- package/dist/cjs/arch/svm/index.js +1 -1
- package/dist/cjs/arch/svm/provider.js +3 -3
- package/dist/cjs/arch/svm/provider.js.map +1 -1
- package/dist/cjs/arch/svm/utils.js +355 -166
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/caching/Arweave/ArweaveClient.js +246 -168
- package/dist/cjs/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/cjs/caching/Arweave/index.js +1 -1
- package/dist/cjs/caching/IPFS/PinataIPFSClient.js +49 -40
- package/dist/cjs/caching/IPFS/PinataIPFSClient.js.map +1 -1
- package/dist/cjs/caching/IPFS/index.js +1 -1
- package/dist/cjs/caching/Memory/MemoryCacheClient.js +18 -13
- package/dist/cjs/caching/Memory/MemoryCacheClient.js.map +1 -1
- package/dist/cjs/caching/Memory/index.js +1 -1
- package/dist/cjs/caching/index.js +1 -1
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +381 -302
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/AcrossConfigStoreClient/index.js +1 -1
- package/dist/cjs/clients/BaseAbstractClient.js +83 -58
- package/dist/cjs/clients/BaseAbstractClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +900 -709
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/index.js +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +128 -95
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +53 -48
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +8 -10
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +90 -67
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +24 -46
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/index.js +1 -1
- package/dist/cjs/clients/HubPoolClient.js +708 -526
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +179 -133
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +183 -124
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +389 -357
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.js +8 -9
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/index.js +3 -3
- package/dist/cjs/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/cjs/clients/index.js +1 -1
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js +67 -58
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockEvents.js +52 -47
- package/dist/cjs/clients/mocks/MockEvents.js.map +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +185 -142
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +192 -208
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +143 -140
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +73 -57
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/index.js +1 -1
- package/dist/cjs/coingecko/Coingecko.js +437 -285
- package/dist/cjs/coingecko/Coingecko.js.map +1 -1
- package/dist/cjs/coingecko/index.js +1 -1
- package/dist/cjs/constants.js +30 -23
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/contracts/acrossConfigStore.js +48 -27
- package/dist/cjs/contracts/acrossConfigStore.js.map +1 -1
- package/dist/cjs/contracts/hubPool.js +20 -36
- package/dist/cjs/contracts/hubPool.js.map +1 -1
- package/dist/cjs/contracts/index.js +1 -1
- package/dist/cjs/contracts/utils.js +8 -6
- package/dist/cjs/contracts/utils.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.js +16 -7
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js +45 -26
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/linea-viem.js +28 -16
- package/dist/cjs/gasPriceOracle/adapters/linea-viem.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/polygon.js +112 -73
- package/dist/cjs/gasPriceOracle/adapters/polygon.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/solana.js +33 -20
- package/dist/cjs/gasPriceOracle/adapters/solana.js.map +1 -1
- package/dist/cjs/gasPriceOracle/oracle.js +104 -77
- package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/gasPriceOracle/types.js +3 -3
- package/dist/cjs/gasPriceOracle/types.js.map +1 -1
- package/dist/cjs/gasPriceOracle/util.js +8 -8
- package/dist/cjs/gasPriceOracle/util.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/interfaces/index.js +1 -1
- package/dist/cjs/lpFeeCalculator/index.js +1 -1
- package/dist/cjs/lpFeeCalculator/lpFeeCalculator.js +35 -33
- package/dist/cjs/lpFeeCalculator/lpFeeCalculator.js.map +1 -1
- package/dist/cjs/lpFeeCalculator/rateModel.js +9 -7
- package/dist/cjs/lpFeeCalculator/rateModel.js.map +1 -1
- package/dist/cjs/merkleDistributor/MerkleDistributor.js +18 -20
- package/dist/cjs/merkleDistributor/MerkleDistributor.js.map +1 -1
- package/dist/cjs/merkleDistributor/index.js +1 -1
- package/dist/cjs/merkleDistributor/model/index.js +1 -1
- package/dist/cjs/pool/TransactionManager.js +100 -45
- package/dist/cjs/pool/TransactionManager.js.map +1 -1
- package/dist/cjs/pool/index.js +1 -1
- package/dist/cjs/pool/poolClient.js +731 -464
- package/dist/cjs/pool/poolClient.js.map +1 -1
- package/dist/cjs/pool/uma/across/index.js +1 -1
- package/dist/cjs/pool/uma/across/transactionManager.js +100 -45
- package/dist/cjs/pool/uma/across/transactionManager.js.map +1 -1
- package/dist/cjs/pool/uma/clients/erc20/client.js +16 -18
- package/dist/cjs/pool/uma/clients/erc20/client.js.map +1 -1
- package/dist/cjs/pool/uma/clients/erc20/index.js +1 -1
- package/dist/cjs/pool/uma/clients/index.js +1 -1
- package/dist/cjs/pool/uma/index.js +1 -1
- package/dist/cjs/pool/uma/oracle/index.js +1 -1
- package/dist/cjs/pool/uma/oracle/utils.js +5 -4
- package/dist/cjs/pool/uma/oracle/utils.js.map +1 -1
- package/dist/cjs/pool/uma/utils.js +30 -11
- package/dist/cjs/pool/uma/utils.js.map +1 -1
- package/dist/cjs/priceClient/adapters/acrossApi.js +39 -22
- package/dist/cjs/priceClient/adapters/acrossApi.js.map +1 -1
- package/dist/cjs/priceClient/adapters/baseAdapter.js +73 -49
- package/dist/cjs/priceClient/adapters/baseAdapter.js.map +1 -1
- package/dist/cjs/priceClient/adapters/coingecko.js +61 -34
- package/dist/cjs/priceClient/adapters/coingecko.js.map +1 -1
- package/dist/cjs/priceClient/adapters/default.js +31 -16
- package/dist/cjs/priceClient/adapters/default.js.map +1 -1
- package/dist/cjs/priceClient/adapters/defiLlama.js +74 -40
- package/dist/cjs/priceClient/adapters/defiLlama.js.map +1 -1
- package/dist/cjs/priceClient/adapters/index.js +1 -1
- package/dist/cjs/priceClient/index.js +1 -1
- package/dist/cjs/priceClient/priceClient.js +159 -110
- package/dist/cjs/priceClient/priceClient.js.map +1 -1
- package/dist/cjs/providers/alchemy.js +19 -17
- package/dist/cjs/providers/alchemy.js.map +1 -1
- package/dist/cjs/providers/cachedProvider.js +129 -88
- package/dist/cjs/providers/cachedProvider.js.map +1 -1
- package/dist/cjs/providers/drpc.js +11 -9
- package/dist/cjs/providers/drpc.js.map +1 -1
- package/dist/cjs/providers/index.js +1 -1
- package/dist/cjs/providers/infura.js +12 -10
- package/dist/cjs/providers/infura.js.map +1 -1
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js +15 -7
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js.map +1 -1
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js +14 -6
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +1 -1
- package/dist/cjs/providers/mocks/MockRetrySolanaRpcFactory.js +15 -7
- package/dist/cjs/providers/mocks/MockRetrySolanaRpcFactory.js.map +1 -1
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js +66 -42
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js.map +1 -1
- package/dist/cjs/providers/mocks/index.js +1 -1
- package/dist/cjs/providers/mocks/mockEthersProvider.js +31 -29
- package/dist/cjs/providers/mocks/mockEthersProvider.js.map +1 -1
- package/dist/cjs/providers/quicknode.js +21 -19
- package/dist/cjs/providers/quicknode.js.map +1 -1
- package/dist/cjs/providers/rateLimitedProvider.js +79 -64
- package/dist/cjs/providers/rateLimitedProvider.js.map +1 -1
- package/dist/cjs/providers/retryProvider.js +246 -163
- package/dist/cjs/providers/retryProvider.js.map +1 -1
- package/dist/cjs/providers/solana/baseRpcFactories.js +18 -14
- package/dist/cjs/providers/solana/baseRpcFactories.js.map +1 -1
- package/dist/cjs/providers/solana/cachedRpcFactory.js +112 -70
- package/dist/cjs/providers/solana/cachedRpcFactory.js.map +1 -1
- package/dist/cjs/providers/solana/defaultRpcFactory.js +15 -8
- package/dist/cjs/providers/solana/defaultRpcFactory.js.map +1 -1
- package/dist/cjs/providers/solana/index.js +1 -1
- package/dist/cjs/providers/solana/quorumFallbackRpcFactory.js +191 -135
- package/dist/cjs/providers/solana/quorumFallbackRpcFactory.js.map +1 -1
- package/dist/cjs/providers/solana/rateLimitedRpcFactory.js +90 -67
- package/dist/cjs/providers/solana/rateLimitedRpcFactory.js.map +1 -1
- package/dist/cjs/providers/solana/retryRpcFactory.js +79 -52
- package/dist/cjs/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/cjs/providers/solana/utils.js +2 -2
- package/dist/cjs/providers/solana/utils.js.map +1 -1
- package/dist/cjs/providers/speedProvider.js +53 -31
- package/dist/cjs/providers/speedProvider.js.map +1 -1
- package/dist/cjs/providers/types.js +1 -1
- package/dist/cjs/providers/types.js.map +1 -1
- package/dist/cjs/providers/utils.js +28 -26
- package/dist/cjs/providers/utils.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +162 -108
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/customGasToken.js +26 -14
- package/dist/cjs/relayFeeCalculator/chain-queries/customGasToken.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +29 -20
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +137 -88
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/index.js +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +297 -199
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/typeguards/error.js +7 -5
- package/dist/cjs/typeguards/error.js.map +1 -1
- package/dist/cjs/typeguards/index.js +1 -1
- package/dist/cjs/utils/AddressUtils.js +144 -117
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/ArrayUtils.js +78 -21
- package/dist/cjs/utils/ArrayUtils.js.map +1 -1
- package/dist/cjs/utils/BigNumberUtils.js +10 -9
- package/dist/cjs/utils/BigNumberUtils.js.map +1 -1
- package/dist/cjs/utils/BlockExplorerUtils.js +30 -26
- package/dist/cjs/utils/BlockExplorerUtils.js.map +1 -1
- package/dist/cjs/utils/BlockFinder.js +5 -2
- package/dist/cjs/utils/BlockFinder.js.map +1 -1
- package/dist/cjs/utils/BlockUtils.js +41 -24
- package/dist/cjs/utils/BlockUtils.js.map +1 -1
- package/dist/cjs/utils/BundleUtils.js +24 -21
- package/dist/cjs/utils/BundleUtils.js.map +1 -1
- package/dist/cjs/utils/CCTPUtils.js +126 -62
- package/dist/cjs/utils/CCTPUtils.js.map +1 -1
- package/dist/cjs/utils/CachingUtils.js +42 -20
- package/dist/cjs/utils/CachingUtils.js.map +1 -1
- package/dist/cjs/utils/ContractUtils.js +5 -5
- package/dist/cjs/utils/ContractUtils.js.map +1 -1
- package/dist/cjs/utils/DepositUtils.js +99 -122
- package/dist/cjs/utils/DepositUtils.js.map +1 -1
- package/dist/cjs/utils/EventUtils.js +70 -49
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/FormattingUtils.js +32 -26
- package/dist/cjs/utils/FormattingUtils.js.map +1 -1
- package/dist/cjs/utils/HyperLiquidUtils.js +23 -10
- package/dist/cjs/utils/HyperLiquidUtils.js.map +1 -1
- package/dist/cjs/utils/IPFSUtils.js +34 -16
- package/dist/cjs/utils/IPFSUtils.js.map +1 -1
- package/dist/cjs/utils/JSONUtils.js +6 -6
- package/dist/cjs/utils/JSONUtils.js.map +1 -1
- package/dist/cjs/utils/LogUtils.js +12 -10
- package/dist/cjs/utils/LogUtils.js.map +1 -1
- package/dist/cjs/utils/Multicall.js +115 -56
- package/dist/cjs/utils/Multicall.js.map +1 -1
- package/dist/cjs/utils/NetworkUtils.js +28 -12
- package/dist/cjs/utils/NetworkUtils.js.map +1 -1
- package/dist/cjs/utils/NumberUtils.js +3 -1
- package/dist/cjs/utils/NumberUtils.js.map +1 -1
- package/dist/cjs/utils/ObjectUtils.js +41 -27
- package/dist/cjs/utils/ObjectUtils.js.map +1 -1
- package/dist/cjs/utils/Profiler.js +83 -80
- package/dist/cjs/utils/Profiler.js.map +1 -1
- package/dist/cjs/utils/ReviverUtils.js +9 -5
- package/dist/cjs/utils/ReviverUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.js +84 -84
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.js +64 -41
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/cjs/utils/TypeGuards.js +1 -1
- package/dist/cjs/utils/TypeGuards.js.map +1 -1
- package/dist/cjs/utils/ValidatorUtils.js +7 -7
- package/dist/cjs/utils/ValidatorUtils.js.map +1 -1
- package/dist/cjs/utils/abi/contracts/index.js +1 -1
- package/dist/cjs/utils/abi/index.js +22 -12
- package/dist/cjs/utils/abi/index.js.map +1 -1
- package/dist/cjs/utils/abi/typechain/factories/Multicall3__factory.js +12 -9
- package/dist/cjs/utils/abi/typechain/factories/Multicall3__factory.js.map +1 -1
- package/dist/cjs/utils/abi/typechain/index.js +1 -1
- package/dist/cjs/utils/common.js +53 -40
- package/dist/cjs/utils/common.js.map +1 -1
- package/dist/cjs/utils/index.js +1 -1
- package/dist/esm/addressAggregator/adapters/abstract.js +64 -48
- package/dist/esm/addressAggregator/adapters/abstract.js.map +1 -1
- package/dist/esm/addressAggregator/adapters/bybit.js +29 -15
- package/dist/esm/addressAggregator/adapters/bybit.js.map +1 -1
- package/dist/esm/addressAggregator/adapters/env.js +14 -9
- package/dist/esm/addressAggregator/adapters/env.js.map +1 -1
- package/dist/esm/addressAggregator/adapters/file.js +43 -29
- package/dist/esm/addressAggregator/adapters/file.js.map +1 -1
- package/dist/esm/addressAggregator/adapters/risklabs.js +35 -20
- package/dist/esm/addressAggregator/adapters/risklabs.js.map +1 -1
- package/dist/esm/addressAggregator/index.js +83 -52
- package/dist/esm/addressAggregator/index.js.map +1 -1
- package/dist/esm/addressAggregator/types.js +1 -1
- package/dist/esm/addressAggregator/types.js.map +1 -1
- package/dist/esm/apiClient/abstractClient.js +9 -15
- package/dist/esm/apiClient/abstractClient.js.map +1 -1
- package/dist/esm/apiClient/mockedClient.js +26 -21
- package/dist/esm/apiClient/mockedClient.js.map +1 -1
- package/dist/esm/apiClient/productionClient.js +101 -61
- package/dist/esm/apiClient/productionClient.js.map +1 -1
- package/dist/esm/arch/evm/BlockUtils.js +217 -139
- package/dist/esm/arch/evm/BlockUtils.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.js +289 -146
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/evm/utils/wait.js +46 -34
- package/dist/esm/arch/evm/utils/wait.js.map +1 -1
- package/dist/esm/arch/svm/BlockUtils.js +166 -118
- package/dist/esm/arch/svm/BlockUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.js +1150 -738
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/constants.js +1 -1
- package/dist/esm/arch/svm/constants.js.map +1 -1
- package/dist/esm/arch/svm/eventsClient.js +232 -172
- package/dist/esm/arch/svm/eventsClient.js.map +1 -1
- package/dist/esm/arch/svm/provider.js +1 -1
- package/dist/esm/arch/svm/provider.js.map +1 -1
- package/dist/esm/arch/svm/utils.js +345 -155
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/caching/Arweave/ArweaveClient.js +256 -182
- package/dist/esm/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/esm/caching/IPFS/PinataIPFSClient.js +48 -47
- package/dist/esm/caching/IPFS/PinataIPFSClient.js.map +1 -1
- package/dist/esm/caching/Memory/MemoryCacheClient.js +19 -13
- package/dist/esm/caching/Memory/MemoryCacheClient.js.map +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +408 -333
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BaseAbstractClient.js +92 -66
- package/dist/esm/clients/BaseAbstractClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +1054 -927
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +131 -102
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +59 -57
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -7
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +94 -75
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +23 -45
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.js +740 -581
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +178 -133
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +183 -126
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +399 -372
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.js +9 -9
- package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/index.js +2 -2
- package/dist/esm/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/types.js +2 -2
- package/dist/esm/clients/SpokePoolClient/types.js.map +1 -1
- package/dist/esm/clients/mocks/MockConfigStoreClient.js +64 -53
- package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockEvents.js +49 -42
- package/dist/esm/clients/mocks/MockEvents.js.map +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.js +182 -138
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +188 -202
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +132 -127
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +69 -53
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/esm/coingecko/Coingecko.js +443 -298
- package/dist/esm/coingecko/Coingecko.js.map +1 -1
- package/dist/esm/constants.js +47 -40
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/contracts/acrossConfigStore.js +46 -24
- package/dist/esm/contracts/acrossConfigStore.js.map +1 -1
- package/dist/esm/contracts/hubPool.js +18 -34
- package/dist/esm/contracts/hubPool.js.map +1 -1
- package/dist/esm/contracts/utils.js +5 -3
- package/dist/esm/contracts/utils.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/arbitrum.js +14 -6
- package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/ethereum.js +42 -22
- package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/linea-viem.js +25 -13
- package/dist/esm/gasPriceOracle/adapters/linea-viem.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/polygon.js +108 -72
- package/dist/esm/gasPriceOracle/adapters/polygon.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/solana.js +31 -22
- package/dist/esm/gasPriceOracle/adapters/solana.js.map +1 -1
- package/dist/esm/gasPriceOracle/oracle.js +96 -70
- package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/gasPriceOracle/types.js +2 -2
- package/dist/esm/gasPriceOracle/types.js.map +1 -1
- package/dist/esm/gasPriceOracle/util.js +4 -4
- package/dist/esm/gasPriceOracle/util.js.map +1 -1
- package/dist/esm/lpFeeCalculator/lpFeeCalculator.js +33 -30
- package/dist/esm/lpFeeCalculator/lpFeeCalculator.js.map +1 -1
- package/dist/esm/lpFeeCalculator/rateModel.js +9 -7
- package/dist/esm/lpFeeCalculator/rateModel.js.map +1 -1
- package/dist/esm/merkleDistributor/MerkleDistributor.js +17 -18
- package/dist/esm/merkleDistributor/MerkleDistributor.js.map +1 -1
- package/dist/esm/pool/TransactionManager.js +100 -45
- package/dist/esm/pool/TransactionManager.js.map +1 -1
- package/dist/esm/pool/poolClient.js +740 -479
- package/dist/esm/pool/poolClient.js.map +1 -1
- package/dist/esm/pool/uma/across/constants.js +2 -2
- package/dist/esm/pool/uma/across/constants.js.map +1 -1
- package/dist/esm/pool/uma/across/transactionManager.js +100 -45
- package/dist/esm/pool/uma/across/transactionManager.js.map +1 -1
- package/dist/esm/pool/uma/clients/erc20/client.js +13 -15
- package/dist/esm/pool/uma/clients/erc20/client.js.map +1 -1
- package/dist/esm/pool/uma/oracle/utils.js +3 -2
- package/dist/esm/pool/uma/oracle/utils.js.map +1 -1
- package/dist/esm/pool/uma/utils.js +28 -9
- package/dist/esm/pool/uma/utils.js.map +1 -1
- package/dist/esm/priceClient/adapters/acrossApi.js +40 -21
- package/dist/esm/priceClient/adapters/acrossApi.js.map +1 -1
- package/dist/esm/priceClient/adapters/baseAdapter.js +72 -46
- package/dist/esm/priceClient/adapters/baseAdapter.js.map +1 -1
- package/dist/esm/priceClient/adapters/coingecko.js +61 -33
- package/dist/esm/priceClient/adapters/coingecko.js.map +1 -1
- package/dist/esm/priceClient/adapters/default.js +31 -15
- package/dist/esm/priceClient/adapters/default.js.map +1 -1
- package/dist/esm/priceClient/adapters/defiLlama.js +73 -38
- package/dist/esm/priceClient/adapters/defiLlama.js.map +1 -1
- package/dist/esm/priceClient/priceClient.js +158 -109
- package/dist/esm/priceClient/priceClient.js.map +1 -1
- package/dist/esm/providers/alchemy.js +18 -16
- package/dist/esm/providers/alchemy.js.map +1 -1
- package/dist/esm/providers/cachedProvider.js +134 -99
- package/dist/esm/providers/cachedProvider.js.map +1 -1
- package/dist/esm/providers/constants.js +3 -3
- package/dist/esm/providers/constants.js.map +1 -1
- package/dist/esm/providers/drpc.js +10 -8
- package/dist/esm/providers/drpc.js.map +1 -1
- package/dist/esm/providers/infura.js +11 -9
- package/dist/esm/providers/infura.js.map +1 -1
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js +15 -6
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js.map +1 -1
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js +14 -5
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +1 -1
- package/dist/esm/providers/mocks/MockRetrySolanaRpcFactory.js +15 -6
- package/dist/esm/providers/mocks/MockRetrySolanaRpcFactory.js.map +1 -1
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.js +66 -41
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.js.map +1 -1
- package/dist/esm/providers/mocks/mockEthersProvider.js +30 -27
- package/dist/esm/providers/mocks/mockEthersProvider.js.map +1 -1
- package/dist/esm/providers/quicknode.js +20 -18
- package/dist/esm/providers/quicknode.js.map +1 -1
- package/dist/esm/providers/rateLimitedProvider.js +80 -68
- package/dist/esm/providers/rateLimitedProvider.js.map +1 -1
- package/dist/esm/providers/retryProvider.js +259 -186
- package/dist/esm/providers/retryProvider.js.map +1 -1
- package/dist/esm/providers/solana/baseRpcFactories.js +19 -13
- package/dist/esm/providers/solana/baseRpcFactories.js.map +1 -1
- package/dist/esm/providers/solana/cachedRpcFactory.js +112 -75
- package/dist/esm/providers/solana/cachedRpcFactory.js.map +1 -1
- package/dist/esm/providers/solana/defaultRpcFactory.js +14 -6
- package/dist/esm/providers/solana/defaultRpcFactory.js.map +1 -1
- package/dist/esm/providers/solana/quorumFallbackRpcFactory.js +202 -149
- package/dist/esm/providers/solana/quorumFallbackRpcFactory.js.map +1 -1
- package/dist/esm/providers/solana/rateLimitedRpcFactory.js +90 -70
- package/dist/esm/providers/solana/rateLimitedRpcFactory.js.map +1 -1
- package/dist/esm/providers/solana/retryRpcFactory.js +74 -50
- package/dist/esm/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/esm/providers/solana/utils.js +1 -1
- package/dist/esm/providers/solana/utils.js.map +1 -1
- package/dist/esm/providers/speedProvider.js +51 -28
- package/dist/esm/providers/speedProvider.js.map +1 -1
- package/dist/esm/providers/types.js +2 -2
- package/dist/esm/providers/types.js.map +1 -1
- package/dist/esm/providers/utils.js +20 -17
- package/dist/esm/providers/utils.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +152 -98
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/customGasToken.js +26 -13
- package/dist/esm/relayFeeCalculator/chain-queries/customGasToken.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +19 -9
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +128 -83
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +299 -211
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/typeguards/error.js +5 -3
- package/dist/esm/typeguards/error.js.map +1 -1
- package/dist/esm/utils/AddressUtils.js +147 -115
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/ArrayUtils.js +78 -21
- package/dist/esm/utils/ArrayUtils.js.map +1 -1
- package/dist/esm/utils/BigNumberUtils.js +12 -11
- package/dist/esm/utils/BigNumberUtils.js.map +1 -1
- package/dist/esm/utils/BlockExplorerUtils.js +23 -19
- package/dist/esm/utils/BlockExplorerUtils.js.map +1 -1
- package/dist/esm/utils/BlockFinder.js +6 -2
- package/dist/esm/utils/BlockFinder.js.map +1 -1
- package/dist/esm/utils/BlockUtils.js +40 -31
- package/dist/esm/utils/BlockUtils.js.map +1 -1
- package/dist/esm/utils/BundleUtils.js +24 -21
- package/dist/esm/utils/BundleUtils.js.map +1 -1
- package/dist/esm/utils/CCTPUtils.js +123 -62
- package/dist/esm/utils/CCTPUtils.js.map +1 -1
- package/dist/esm/utils/CachingUtils.js +38 -17
- package/dist/esm/utils/CachingUtils.js.map +1 -1
- package/dist/esm/utils/ContractUtils.js +3 -3
- package/dist/esm/utils/ContractUtils.js.map +1 -1
- package/dist/esm/utils/DepositUtils.js +98 -121
- package/dist/esm/utils/DepositUtils.js.map +1 -1
- package/dist/esm/utils/EventUtils.js +69 -52
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/FormattingUtils.js +26 -20
- package/dist/esm/utils/FormattingUtils.js.map +1 -1
- package/dist/esm/utils/HyperLiquidUtils.js +22 -8
- package/dist/esm/utils/HyperLiquidUtils.js.map +1 -1
- package/dist/esm/utils/IPFSUtils.js +35 -16
- package/dist/esm/utils/IPFSUtils.js.map +1 -1
- package/dist/esm/utils/JSONUtils.js +4 -4
- package/dist/esm/utils/JSONUtils.js.map +1 -1
- package/dist/esm/utils/LogUtils.js +12 -8
- package/dist/esm/utils/LogUtils.js.map +1 -1
- package/dist/esm/utils/Multicall.js +110 -50
- package/dist/esm/utils/Multicall.js.map +1 -1
- package/dist/esm/utils/NetworkUtils.js +28 -12
- package/dist/esm/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/utils/NumberUtils.js +3 -1
- package/dist/esm/utils/NumberUtils.js.map +1 -1
- package/dist/esm/utils/ObjectUtils.js +41 -27
- package/dist/esm/utils/ObjectUtils.js.map +1 -1
- package/dist/esm/utils/Profiler.js +82 -77
- package/dist/esm/utils/Profiler.js.map +1 -1
- package/dist/esm/utils/ReviverUtils.js +7 -3
- package/dist/esm/utils/ReviverUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.js +78 -83
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.js +57 -33
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/esm/utils/ValidatorUtils.js +4 -4
- package/dist/esm/utils/ValidatorUtils.js.map +1 -1
- package/dist/esm/utils/abi/index.js +20 -10
- package/dist/esm/utils/abi/index.js.map +1 -1
- package/dist/esm/utils/abi/typechain/factories/Multicall3__factory.js +12 -8
- package/dist/esm/utils/abi/typechain/factories/Multicall3__factory.js.map +1 -1
- package/dist/esm/utils/common.js +52 -38
- package/dist/esm/utils/common.js.map +1 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/utils/Multicall.d.ts.map +1 -1
- package/dist/types/utils/NetworkUtils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/constants.ts +1 -0
- package/src/gasPriceOracle/oracle.ts +1 -0
- package/src/utils/Multicall.ts +1 -0
- package/src/utils/NetworkUtils.ts +8 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AcrossConfigStoreClient = exports.GLOBAL_CONFIG_STORE_KEYS = exports.DEFAULT_CONFIG_STORE_VERSION = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
var typeguards_1 = require("../../typeguards");
|
|
7
|
+
var evm_1 = require("../../arch/evm");
|
|
8
|
+
var utils_1 = require("../../utils");
|
|
9
|
+
var constants_1 = require("../../constants");
|
|
10
|
+
var JSONUtils_1 = require("../../utils/JSONUtils");
|
|
11
|
+
var BaseAbstractClient_1 = require("../BaseAbstractClient");
|
|
12
|
+
var rateModel_1 = require("../../lpFeeCalculator/rateModel");
|
|
13
13
|
exports.DEFAULT_CONFIG_STORE_VERSION = 0;
|
|
14
14
|
var GLOBAL_CONFIG_STORE_KEYS;
|
|
15
15
|
(function (GLOBAL_CONFIG_STORE_KEYS) {
|
|
@@ -20,7 +20,7 @@ var GLOBAL_CONFIG_STORE_KEYS;
|
|
|
20
20
|
GLOBAL_CONFIG_STORE_KEYS["CHAIN_ID_INDICES"] = "CHAIN_ID_INDICES";
|
|
21
21
|
GLOBAL_CONFIG_STORE_KEYS["LITE_CHAIN_ID_INDICES"] = "LITE_CHAIN_ID_INDICES";
|
|
22
22
|
})(GLOBAL_CONFIG_STORE_KEYS || (exports.GLOBAL_CONFIG_STORE_KEYS = GLOBAL_CONFIG_STORE_KEYS = {}));
|
|
23
|
-
|
|
23
|
+
var KNOWN_INVALID_TOKEN_CONFIG_UPDATE_HASHES = [
|
|
24
24
|
"0x422abc617c6598e4b91859f99c392939d2034c1a839a342a963a34a2f0390195",
|
|
25
25
|
"0x36c85e388279714b2c98d46e3377dc37a1575665b2cac5e52fe97d8d77efcd2b",
|
|
26
26
|
"0x6f0a93119e538dd84e02adfce821fb4e6dd9baddcceb041977e8ba3c39185ab8",
|
|
@@ -35,343 +35,422 @@ const KNOWN_INVALID_TOKEN_CONFIG_UPDATE_HASHES = [
|
|
|
35
35
|
"0x89830f5e81b9e8b44ac2f8966b2fa4bf8e71d7f546e2bc0e773d8ee8df4bdb36",
|
|
36
36
|
"0xb0ad6270124c925a234d9c4f87b60396f2b52fdc250cd2fc9cac792d0d62e467",
|
|
37
37
|
"0x779bc3bf2dba1128d5dda6be8ae99b503cae23343a7265a86bca3d5572ed4268",
|
|
38
|
-
].map((hash)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
configStore
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.latestHeightSearched = 0;
|
|
38
|
+
].map(function (hash) { return hash.toLowerCase(); });
|
|
39
|
+
var AcrossConfigStoreClient = (function (_super) {
|
|
40
|
+
tslib_1.__extends(AcrossConfigStoreClient, _super);
|
|
41
|
+
function AcrossConfigStoreClient(logger, configStore, eventSearchConfig, configStoreVersion) {
|
|
42
|
+
if (eventSearchConfig === void 0) { eventSearchConfig = { from: 0, maxLookBack: 0 }; }
|
|
43
|
+
var _this = _super.call(this, eventSearchConfig) || this;
|
|
44
|
+
_this.logger = logger;
|
|
45
|
+
_this.configStore = configStore;
|
|
46
|
+
_this.configStoreVersion = configStoreVersion;
|
|
47
|
+
_this.cumulativeRateModelUpdates = [];
|
|
48
|
+
_this.cumulativeRouteRateModelUpdates = [];
|
|
49
|
+
_this.cumulativeMaxRefundCountUpdates = [];
|
|
50
|
+
_this.cumulativeMaxL1TokenCountUpdates = [];
|
|
51
|
+
_this.chainIdIndicesUpdates = [];
|
|
52
|
+
_this.liteChainIndicesUpdates = [];
|
|
53
|
+
_this.cumulativeSpokeTargetBalanceUpdates = [];
|
|
54
|
+
_this.cumulativeConfigStoreVersionUpdates = [];
|
|
55
|
+
_this.cumulativeDisabledChainUpdates = [];
|
|
56
|
+
_this.hasLatestConfigStoreVersion = false;
|
|
57
|
+
_this.firstHeightToSearch = eventSearchConfig.from;
|
|
58
|
+
_this.latestHeightSearched = 0;
|
|
59
|
+
return _this;
|
|
61
60
|
}
|
|
62
|
-
getRateModelForBlockNumber(l1Token, originChainId, destinationChainId, blockNumber
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
AcrossConfigStoreClient.prototype.getRateModelForBlockNumber = function (l1Token, originChainId, destinationChainId, blockNumber) {
|
|
62
|
+
if (blockNumber === void 0) { blockNumber = undefined; }
|
|
63
|
+
var route = "".concat(originChainId, "-").concat(destinationChainId);
|
|
64
|
+
var routeRateModel = this.getRouteRateModelForBlockNumber(l1Token, route, blockNumber);
|
|
65
65
|
if (routeRateModel) {
|
|
66
66
|
return routeRateModel;
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
config.
|
|
70
|
-
|
|
68
|
+
var defaultRateModelUpdate = (0, utils_1.sortEventsDescending)(this.cumulativeRateModelUpdates).find(function (config) {
|
|
69
|
+
return config.blockNumber <= (blockNumber !== null && blockNumber !== void 0 ? blockNumber : 0) &&
|
|
70
|
+
config.l1Token === l1Token.toEvmAddress() &&
|
|
71
|
+
config.rateModel !== undefined;
|
|
72
|
+
});
|
|
71
73
|
if (!defaultRateModelUpdate) {
|
|
72
|
-
throw new Error(
|
|
74
|
+
throw new Error("Could not find TokenConfig update for ".concat(l1Token, " at block ").concat(blockNumber));
|
|
73
75
|
}
|
|
74
76
|
return (0, rateModel_1.parseAndReturnRateModelFromString)(defaultRateModelUpdate.rateModel);
|
|
75
|
-
}
|
|
76
|
-
getRouteRateModelForBlockNumber(l1Token, route, blockNumber
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
};
|
|
78
|
+
AcrossConfigStoreClient.prototype.getRouteRateModelForBlockNumber = function (l1Token, route, blockNumber) {
|
|
79
|
+
if (blockNumber === void 0) { blockNumber = undefined; }
|
|
80
|
+
var config = (0, utils_1.sortEventsDescending)(this.cumulativeRouteRateModelUpdates).find(function (config) { return config.blockNumber <= (blockNumber !== null && blockNumber !== void 0 ? blockNumber : 0) && config.l1Token === l1Token.toEvmAddress(); });
|
|
81
|
+
if ((config === null || config === void 0 ? void 0 : config.routeRateModel[route]) === undefined) {
|
|
79
82
|
return undefined;
|
|
80
83
|
}
|
|
81
84
|
return (0, rateModel_1.parseAndReturnRateModelFromString)(config.routeRateModel[route]);
|
|
82
|
-
}
|
|
83
|
-
implicitChainIdIndices(chainId) {
|
|
85
|
+
};
|
|
86
|
+
AcrossConfigStoreClient.prototype.implicitChainIdIndices = function (chainId) {
|
|
84
87
|
(0, assert_1.default)((0, utils_1.isDefined)(chainId), "ConfigStoreClient used before update");
|
|
85
88
|
return constants_1.PROTOCOL_DEFAULT_CHAIN_ID_INDICES[0] === chainId ? constants_1.PROTOCOL_DEFAULT_CHAIN_ID_INDICES : [chainId];
|
|
86
|
-
}
|
|
87
|
-
getChainIdIndicesForBlock
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return liteChainIdList.find((update)
|
|
99
|
-
}
|
|
100
|
-
|
|
89
|
+
};
|
|
90
|
+
AcrossConfigStoreClient.prototype.getChainIdIndicesForBlock = function (blockNumber) {
|
|
91
|
+
var _a;
|
|
92
|
+
if (blockNumber === void 0) { blockNumber = Number.MAX_SAFE_INTEGER; }
|
|
93
|
+
var chainIdUpdates = (0, utils_1.sortEventsDescending)(this.chainIdIndicesUpdates);
|
|
94
|
+
var chainIdIndices = (_a = chainIdUpdates.find(function (update) { return update.blockNumber <= blockNumber; })) === null || _a === void 0 ? void 0 : _a.value;
|
|
95
|
+
return chainIdIndices !== null && chainIdIndices !== void 0 ? chainIdIndices : this.implicitChainIdIndices(this.chainId);
|
|
96
|
+
};
|
|
97
|
+
AcrossConfigStoreClient.prototype.getLiteChainIdIndicesForBlock = function (blockNumber) {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
if (blockNumber === void 0) { blockNumber = Number.MAX_SAFE_INTEGER; }
|
|
100
|
+
var liteChainIdList = (0, utils_1.sortEventsDescending)(this.liteChainIndicesUpdates);
|
|
101
|
+
return (_b = (_a = liteChainIdList.find(function (update) { return update.blockNumber <= blockNumber; })) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : [];
|
|
102
|
+
};
|
|
103
|
+
AcrossConfigStoreClient.prototype.getLiteChainIdIndicesForTimestamp = function (timestamp) {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
if (timestamp === void 0) { timestamp = Number.MAX_SAFE_INTEGER; }
|
|
106
|
+
var liteChainIdList = (0, utils_1.sortEventsDescending)(this.liteChainIndicesUpdates);
|
|
107
|
+
return (_b = (_a = liteChainIdList.find(function (update) { return update.timestamp <= timestamp; })) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : [];
|
|
108
|
+
};
|
|
109
|
+
AcrossConfigStoreClient.prototype.isChainLiteChainAtTimestamp = function (chainId, timestamp) {
|
|
110
|
+
if (timestamp === void 0) { timestamp = Number.MAX_SAFE_INTEGER; }
|
|
101
111
|
return this.getLiteChainIdIndicesForTimestamp(timestamp).includes(chainId);
|
|
102
|
-
}
|
|
103
|
-
getSpokeTargetBalancesForBlock(l1Token, chainId, blockNumber
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
};
|
|
113
|
+
AcrossConfigStoreClient.prototype.getSpokeTargetBalancesForBlock = function (l1Token, chainId, blockNumber) {
|
|
114
|
+
var _a;
|
|
115
|
+
if (blockNumber === void 0) { blockNumber = Number.MAX_SAFE_INTEGER; }
|
|
116
|
+
var config = (0, utils_1.sortEventsDescending)(this.cumulativeSpokeTargetBalanceUpdates).find(function (config) { return config.l1Token === l1Token && config.blockNumber <= blockNumber; });
|
|
117
|
+
var targetBalance = (_a = config === null || config === void 0 ? void 0 : config.spokeTargetBalances) === null || _a === void 0 ? void 0 : _a[chainId];
|
|
106
118
|
return targetBalance || { target: (0, utils_1.toBN)(0), threshold: (0, utils_1.toBN)(0) };
|
|
107
|
-
}
|
|
108
|
-
getMaxRefundCountForRelayerRefundLeafForBlock
|
|
109
|
-
|
|
119
|
+
};
|
|
120
|
+
AcrossConfigStoreClient.prototype.getMaxRefundCountForRelayerRefundLeafForBlock = function (blockNumber) {
|
|
121
|
+
if (blockNumber === void 0) { blockNumber = Number.MAX_SAFE_INTEGER; }
|
|
122
|
+
var config = (0, utils_1.sortEventsDescending)(this.cumulativeMaxRefundCountUpdates).find(function (config) { return config.blockNumber <= blockNumber; });
|
|
110
123
|
if (!config) {
|
|
111
|
-
throw new Error(
|
|
124
|
+
throw new Error("Could not find MaxRefundCount before block ".concat(blockNumber));
|
|
112
125
|
}
|
|
113
126
|
return Number(config.value);
|
|
114
|
-
}
|
|
115
|
-
getMaxL1TokenCountForPoolRebalanceLeafForBlock
|
|
116
|
-
|
|
127
|
+
};
|
|
128
|
+
AcrossConfigStoreClient.prototype.getMaxL1TokenCountForPoolRebalanceLeafForBlock = function (blockNumber) {
|
|
129
|
+
if (blockNumber === void 0) { blockNumber = Number.MAX_SAFE_INTEGER; }
|
|
130
|
+
var config = (0, utils_1.sortEventsDescending)(this.cumulativeMaxL1TokenCountUpdates).find(function (config) { return config.blockNumber <= blockNumber; });
|
|
117
131
|
if (!config) {
|
|
118
|
-
throw new Error(
|
|
132
|
+
throw new Error("Could not find MaxL1TokenCount before block ".concat(blockNumber));
|
|
119
133
|
}
|
|
120
134
|
return Number(config.value);
|
|
121
|
-
}
|
|
122
|
-
getEnabledChainsInBlockRange(fromBlock, toBlock
|
|
135
|
+
};
|
|
136
|
+
AcrossConfigStoreClient.prototype.getEnabledChainsInBlockRange = function (fromBlock, toBlock) {
|
|
137
|
+
if (toBlock === void 0) { toBlock = Number.MAX_SAFE_INTEGER; }
|
|
123
138
|
if (fromBlock > toBlock) {
|
|
124
|
-
throw new Error(
|
|
139
|
+
throw new Error("Invalid block range: fromBlock ".concat(fromBlock, " > toBlock ").concat(toBlock));
|
|
125
140
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
141
|
+
var disabledChainsAtFromBlock = this.getDisabledChainsForBlock(fromBlock);
|
|
142
|
+
var allPossibleChains = this.getChainIdIndicesForBlock(toBlock);
|
|
143
|
+
var enabledChainsInBlockRange = allPossibleChains.filter(function (chainId) { return !disabledChainsAtFromBlock.includes(chainId); });
|
|
129
144
|
this.cumulativeDisabledChainUpdates
|
|
130
|
-
.filter((e)
|
|
131
|
-
.forEach((e)
|
|
132
|
-
|
|
133
|
-
disabledChainsAtFromBlock.forEach((disabledChain)
|
|
145
|
+
.filter(function (e) { return e.blockNumber <= toBlock && e.blockNumber >= fromBlock; })
|
|
146
|
+
.forEach(function (e) {
|
|
147
|
+
var newDisabledSet = e.chainIds;
|
|
148
|
+
disabledChainsAtFromBlock.forEach(function (disabledChain) {
|
|
134
149
|
if (!newDisabledSet.includes(disabledChain)) {
|
|
135
150
|
enabledChainsInBlockRange.push(disabledChain);
|
|
136
151
|
}
|
|
137
152
|
});
|
|
138
153
|
});
|
|
139
|
-
return allPossibleChains.filter((chainId)
|
|
140
|
-
}
|
|
141
|
-
getEnabledChains
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
154
|
+
return allPossibleChains.filter(function (chainId) { return enabledChainsInBlockRange.includes(chainId); });
|
|
155
|
+
};
|
|
156
|
+
AcrossConfigStoreClient.prototype.getEnabledChains = function (block) {
|
|
157
|
+
if (block === void 0) { block = Number.MAX_SAFE_INTEGER; }
|
|
158
|
+
var currentlyDisabledChains = this.getDisabledChainsForBlock(block);
|
|
159
|
+
return this.getChainIdIndicesForBlock(block).filter(function (chainId) { return !currentlyDisabledChains.includes(chainId); });
|
|
160
|
+
};
|
|
161
|
+
AcrossConfigStoreClient.prototype.getDisabledChainsForBlock = function (blockNumber) {
|
|
162
|
+
var _a, _b;
|
|
163
|
+
if (blockNumber === void 0) { blockNumber = Number.MAX_SAFE_INTEGER; }
|
|
164
|
+
return ((_b = (_a = (0, utils_1.sortEventsDescending)(this.cumulativeDisabledChainUpdates).find(function (config) { return config.blockNumber <= blockNumber; })) === null || _a === void 0 ? void 0 : _a.chainIds) !== null && _b !== void 0 ? _b : []);
|
|
165
|
+
};
|
|
166
|
+
AcrossConfigStoreClient.prototype.getConfigStoreVersionForTimestamp = function (timestamp) {
|
|
167
|
+
if (timestamp === void 0) { timestamp = Number.MAX_SAFE_INTEGER; }
|
|
168
|
+
var config = this.cumulativeConfigStoreVersionUpdates.find(function (config) { return config.timestamp <= timestamp; });
|
|
151
169
|
return (0, utils_1.isDefined)(config) ? Number(config.value) : exports.DEFAULT_CONFIG_STORE_VERSION;
|
|
152
|
-
}
|
|
153
|
-
getConfigStoreVersionForBlock
|
|
154
|
-
|
|
170
|
+
};
|
|
171
|
+
AcrossConfigStoreClient.prototype.getConfigStoreVersionForBlock = function (blockNumber) {
|
|
172
|
+
if (blockNumber === void 0) { blockNumber = Number.MAX_SAFE_INTEGER; }
|
|
173
|
+
var config = this.cumulativeConfigStoreVersionUpdates.find(function (config) { return config.blockNumber <= blockNumber; });
|
|
155
174
|
return (0, utils_1.isDefined)(config) ? Number(config.value) : exports.DEFAULT_CONFIG_STORE_VERSION;
|
|
156
|
-
}
|
|
157
|
-
hasValidConfigStoreVersionForTimestamp
|
|
158
|
-
|
|
175
|
+
};
|
|
176
|
+
AcrossConfigStoreClient.prototype.hasValidConfigStoreVersionForTimestamp = function (timestamp) {
|
|
177
|
+
if (timestamp === void 0) { timestamp = Number.MAX_SAFE_INTEGER; }
|
|
178
|
+
var version = this.getConfigStoreVersionForTimestamp(timestamp);
|
|
159
179
|
return this.configStoreVersion >= version;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return this
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const updatedTokenConfigSortableEvents = updatedTokenConfigEvents.map(utils_1.spreadEventWithBlockNumber);
|
|
177
|
-
const updatedGlobalConfigSortableEvents = updatedGlobalConfigEvents.map(utils_1.spreadEventWithBlockNumber);
|
|
178
|
-
[updatedTokenConfigSortableEvents, updatedGlobalConfigSortableEvents].forEach((events) => (0, utils_1.sortEventsAscendingInPlace)(events));
|
|
179
|
-
const globalConfigUpdateTimes = (await Promise.all(updatedGlobalConfigEvents.map((event) => this.configStore.provider.getBlock(event.blockNumber)))).map((block) => block.timestamp);
|
|
180
|
-
return {
|
|
181
|
-
success: true,
|
|
182
|
-
chainId,
|
|
183
|
-
searchEndBlock: searchConfig.to,
|
|
184
|
-
events: {
|
|
185
|
-
updatedTokenConfigEvents: updatedTokenConfigSortableEvents,
|
|
186
|
-
updatedGlobalConfigEvents: updatedGlobalConfigSortableEvents,
|
|
187
|
-
globalConfigUpdateTimes,
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
async update() {
|
|
192
|
-
const result = await this._update();
|
|
193
|
-
if (!result.success) {
|
|
194
|
-
if (result.reason !== BaseAbstractClient_1.UpdateFailureReason.AlreadyUpdated) {
|
|
195
|
-
throw new Error(`Unable to update ConfigStoreClient: ${result.reason}`);
|
|
196
|
-
}
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const { chainId } = result;
|
|
200
|
-
const { updatedTokenConfigEvents, updatedGlobalConfigEvents, globalConfigUpdateTimes } = result.events;
|
|
201
|
-
(0, assert_1.default)(updatedGlobalConfigEvents.length === globalConfigUpdateTimes.length, `GlobalConfigUpdate events mismatch (${updatedGlobalConfigEvents.length} != ${globalConfigUpdateTimes.length})`);
|
|
202
|
-
for (const event of updatedTokenConfigEvents) {
|
|
203
|
-
if (KNOWN_INVALID_TOKEN_CONFIG_UPDATE_HASHES.includes(event.txnRef.toLowerCase())) {
|
|
204
|
-
continue;
|
|
205
|
-
}
|
|
206
|
-
const args = event;
|
|
207
|
-
try {
|
|
208
|
-
const { rateModel, routeRateModel, spokeTargetBalances } = this.validateTokenConfigUpdate(args);
|
|
209
|
-
const { value, key: l1Token, ...eventData } = args;
|
|
210
|
-
if (rateModel !== undefined) {
|
|
211
|
-
this.cumulativeRateModelUpdates.push({ ...eventData, rateModel, l1Token });
|
|
212
|
-
this.cumulativeSpokeTargetBalanceUpdates.push({
|
|
213
|
-
...eventData,
|
|
214
|
-
spokeTargetBalances,
|
|
215
|
-
l1Token,
|
|
216
|
-
});
|
|
217
|
-
this.cumulativeRouteRateModelUpdates.push({ ...eventData, routeRateModel, l1Token });
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
catch (err) {
|
|
221
|
-
const { average: blockTime } = await (0, evm_1.averageBlockTime)(this.configStore.provider);
|
|
222
|
-
const maxWarnAge = (24 * 60 * 60) / blockTime;
|
|
223
|
-
if (result.searchEndBlock - event.blockNumber < maxWarnAge) {
|
|
224
|
-
const errMsg = (0, typeguards_1.isError)(err) ? err.message : "unknown error";
|
|
225
|
-
this.logger.warn({
|
|
226
|
-
at: "ConfigStore::update",
|
|
227
|
-
message: `Caught error during ConfigStore update: ${errMsg}`,
|
|
228
|
-
update: args,
|
|
229
|
-
});
|
|
180
|
+
};
|
|
181
|
+
AcrossConfigStoreClient.prototype.resolveChainId = function () {
|
|
182
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
183
|
+
var _a;
|
|
184
|
+
var _b;
|
|
185
|
+
return tslib_1.__generator(this, function (_c) {
|
|
186
|
+
switch (_c.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
if (!((_b = this.chainId) !== null && _b !== void 0)) return [3, 1];
|
|
189
|
+
_a = _b;
|
|
190
|
+
return [3, 3];
|
|
191
|
+
case 1: return [4, this.configStore.provider.getNetwork()];
|
|
192
|
+
case 2:
|
|
193
|
+
_a = (_c.sent()).chainId;
|
|
194
|
+
_c.label = 3;
|
|
195
|
+
case 3: return [2, _a];
|
|
230
196
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
message: `The array ${chainIndices} contains duplicates making it invalid.`,
|
|
262
|
-
});
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
this.liteChainIndicesUpdates.push({ ...args, value: chainIndices, timestamp: globalConfigUpdateTimes[i] });
|
|
266
|
-
}
|
|
267
|
-
else if (args.key === (0, utils_1.utf8ToHex)(GLOBAL_CONFIG_STORE_KEYS.CHAIN_ID_INDICES)) {
|
|
268
|
-
try {
|
|
269
|
-
const chainIndices = JSON.parse(args.value.replace(/['"\s]/g, ""));
|
|
270
|
-
if (!(0, utils_1.isArrayOf)(chainIndices, utils_1.isPositiveInteger)) {
|
|
271
|
-
this.logger.warn({ at: "ConfigStore", message: `The array ${chainIndices} is invalid.` });
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
if (new Set(chainIndices).size !== chainIndices.length) {
|
|
275
|
-
this.logger.warn({
|
|
276
|
-
at: "ConfigStore",
|
|
277
|
-
message: `The array ${chainIndices} contains duplicates making it invalid.`,
|
|
278
|
-
});
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
const previousUpdate = this.chainIdIndicesUpdates.at(-1)?.value ?? this.implicitChainIdIndices(chainId);
|
|
282
|
-
if (!previousUpdate.every((chainId, idx) => chainIndices[idx] === chainId)) {
|
|
283
|
-
this.logger.warn({
|
|
284
|
-
at: "ConfigStoreClient#update",
|
|
285
|
-
message: `The array ${chainIndices} is invalid. It must be a superset of the previous array ${previousUpdate}`,
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
AcrossConfigStoreClient.prototype._update = function () {
|
|
201
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
202
|
+
var chainId, searchConfig, reason, _a, updatedTokenConfigEvents, updatedGlobalConfigEvents, updatedTokenConfigSortableEvents, updatedGlobalConfigSortableEvents, globalConfigUpdateTimes;
|
|
203
|
+
var _this = this;
|
|
204
|
+
return tslib_1.__generator(this, function (_b) {
|
|
205
|
+
switch (_b.label) {
|
|
206
|
+
case 0: return [4, this.resolveChainId()];
|
|
207
|
+
case 1:
|
|
208
|
+
chainId = _b.sent();
|
|
209
|
+
return [4, this.updateSearchConfig(this.configStore.provider)];
|
|
210
|
+
case 2:
|
|
211
|
+
searchConfig = _b.sent();
|
|
212
|
+
if ((0, BaseAbstractClient_1.isUpdateFailureReason)(searchConfig)) {
|
|
213
|
+
reason = searchConfig;
|
|
214
|
+
return [2, { success: false, reason: reason }];
|
|
215
|
+
}
|
|
216
|
+
this.logger.debug({ at: "AcrossConfigStore", message: "Updating ConfigStore client", searchConfig: searchConfig });
|
|
217
|
+
return [4, Promise.all([
|
|
218
|
+
(0, utils_1.paginatedEventQuery)(this.configStore, this.configStore.filters.UpdatedTokenConfig(), searchConfig),
|
|
219
|
+
(0, utils_1.paginatedEventQuery)(this.configStore, this.configStore.filters.UpdatedGlobalConfig(), searchConfig),
|
|
220
|
+
])];
|
|
221
|
+
case 3:
|
|
222
|
+
_a = _b.sent(), updatedTokenConfigEvents = _a[0], updatedGlobalConfigEvents = _a[1];
|
|
223
|
+
updatedTokenConfigSortableEvents = updatedTokenConfigEvents.map(utils_1.spreadEventWithBlockNumber);
|
|
224
|
+
updatedGlobalConfigSortableEvents = updatedGlobalConfigEvents.map(utils_1.spreadEventWithBlockNumber);
|
|
225
|
+
[updatedTokenConfigSortableEvents, updatedGlobalConfigSortableEvents].forEach(function (events) {
|
|
226
|
+
return (0, utils_1.sortEventsAscendingInPlace)(events);
|
|
286
227
|
});
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
else if (args.key === (0, utils_1.utf8ToHex)(GLOBAL_CONFIG_STORE_KEYS.VERSION)) {
|
|
301
|
-
if (isNaN(args.value)) {
|
|
302
|
-
continue;
|
|
303
|
-
}
|
|
304
|
-
const value = Number(args.value);
|
|
305
|
-
if (!Number.isInteger(value)) {
|
|
306
|
-
continue;
|
|
228
|
+
return [4, Promise.all(updatedGlobalConfigEvents.map(function (event) { return _this.configStore.provider.getBlock(event.blockNumber); }))];
|
|
229
|
+
case 4:
|
|
230
|
+
globalConfigUpdateTimes = (_b.sent()).map(function (block) { return block.timestamp; });
|
|
231
|
+
return [2, {
|
|
232
|
+
success: true,
|
|
233
|
+
chainId: chainId,
|
|
234
|
+
searchEndBlock: searchConfig.to,
|
|
235
|
+
events: {
|
|
236
|
+
updatedTokenConfigEvents: updatedTokenConfigSortableEvents,
|
|
237
|
+
updatedGlobalConfigEvents: updatedGlobalConfigSortableEvents,
|
|
238
|
+
globalConfigUpdateTimes: globalConfigUpdateTimes,
|
|
239
|
+
},
|
|
240
|
+
}];
|
|
307
241
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
AcrossConfigStoreClient.prototype.update = function () {
|
|
246
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
247
|
+
var result, chainId, _a, updatedTokenConfigEvents, updatedGlobalConfigEvents, globalConfigUpdateTimes, _i, updatedTokenConfigEvents_1, event_1, args, _b, rateModel, routeRateModel, spokeTargetBalances, value, l1Token, eventData, err_1, blockTime, maxWarnAge, errMsg, _loop_1, this_1, i;
|
|
248
|
+
var _c, _d, _e, _f, _g;
|
|
249
|
+
return tslib_1.__generator(this, function (_h) {
|
|
250
|
+
switch (_h.label) {
|
|
251
|
+
case 0: return [4, this._update()];
|
|
252
|
+
case 1:
|
|
253
|
+
result = _h.sent();
|
|
254
|
+
if (!result.success) {
|
|
255
|
+
if (result.reason !== BaseAbstractClient_1.UpdateFailureReason.AlreadyUpdated) {
|
|
256
|
+
throw new Error("Unable to update ConfigStoreClient: ".concat(result.reason));
|
|
257
|
+
}
|
|
258
|
+
return [2];
|
|
259
|
+
}
|
|
260
|
+
chainId = result.chainId;
|
|
261
|
+
_a = result.events, updatedTokenConfigEvents = _a.updatedTokenConfigEvents, updatedGlobalConfigEvents = _a.updatedGlobalConfigEvents, globalConfigUpdateTimes = _a.globalConfigUpdateTimes;
|
|
262
|
+
(0, assert_1.default)(updatedGlobalConfigEvents.length === globalConfigUpdateTimes.length, "GlobalConfigUpdate events mismatch (".concat(updatedGlobalConfigEvents.length, " != ").concat(globalConfigUpdateTimes.length, ")"));
|
|
263
|
+
_i = 0, updatedTokenConfigEvents_1 = updatedTokenConfigEvents;
|
|
264
|
+
_h.label = 2;
|
|
265
|
+
case 2:
|
|
266
|
+
if (!(_i < updatedTokenConfigEvents_1.length)) return [3, 7];
|
|
267
|
+
event_1 = updatedTokenConfigEvents_1[_i];
|
|
268
|
+
if (KNOWN_INVALID_TOKEN_CONFIG_UPDATE_HASHES.includes(event_1.txnRef.toLowerCase())) {
|
|
269
|
+
return [3, 6];
|
|
270
|
+
}
|
|
271
|
+
args = event_1;
|
|
272
|
+
_h.label = 3;
|
|
273
|
+
case 3:
|
|
274
|
+
_h.trys.push([3, 4, , 6]);
|
|
275
|
+
_b = this.validateTokenConfigUpdate(args), rateModel = _b.rateModel, routeRateModel = _b.routeRateModel, spokeTargetBalances = _b.spokeTargetBalances;
|
|
276
|
+
value = args.value, l1Token = args.key, eventData = tslib_1.__rest(args, ["value", "key"]);
|
|
277
|
+
if (rateModel !== undefined) {
|
|
278
|
+
this.cumulativeRateModelUpdates.push(tslib_1.__assign(tslib_1.__assign({}, eventData), { rateModel: rateModel, l1Token: l1Token }));
|
|
279
|
+
this.cumulativeSpokeTargetBalanceUpdates.push(tslib_1.__assign(tslib_1.__assign({}, eventData), { spokeTargetBalances: spokeTargetBalances, l1Token: l1Token }));
|
|
280
|
+
this.cumulativeRouteRateModelUpdates.push(tslib_1.__assign(tslib_1.__assign({}, eventData), { routeRateModel: routeRateModel, l1Token: l1Token }));
|
|
281
|
+
}
|
|
282
|
+
return [3, 6];
|
|
283
|
+
case 4:
|
|
284
|
+
err_1 = _h.sent();
|
|
285
|
+
return [4, (0, evm_1.averageBlockTime)(this.configStore.provider)];
|
|
286
|
+
case 5:
|
|
287
|
+
blockTime = (_h.sent()).average;
|
|
288
|
+
maxWarnAge = (24 * 60 * 60) / blockTime;
|
|
289
|
+
if (result.searchEndBlock - event_1.blockNumber < maxWarnAge) {
|
|
290
|
+
errMsg = (0, typeguards_1.isError)(err_1) ? err_1.message : "unknown error";
|
|
291
|
+
this.logger.warn({
|
|
292
|
+
at: "ConfigStore::update",
|
|
293
|
+
message: "Caught error during ConfigStore update: ".concat(errMsg),
|
|
294
|
+
update: args,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
this.logger.debug({
|
|
299
|
+
at: "ConfigStoreClient::update",
|
|
300
|
+
message: "Skipping invalid historical update at block ".concat(event_1.blockNumber),
|
|
301
|
+
txnRef: event_1.txnRef,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
return [3, 6];
|
|
305
|
+
case 6:
|
|
306
|
+
_i++;
|
|
307
|
+
return [3, 2];
|
|
308
|
+
case 7:
|
|
309
|
+
_loop_1 = function (i) {
|
|
310
|
+
var args = updatedGlobalConfigEvents[i];
|
|
311
|
+
if (args.key === (0, utils_1.utf8ToHex)(GLOBAL_CONFIG_STORE_KEYS.MAX_RELAYER_REPAYMENT_LEAF_SIZE)) {
|
|
312
|
+
if (!isNaN(args.value)) {
|
|
313
|
+
this_1.cumulativeMaxRefundCountUpdates.push(args);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
else if (args.key === (0, utils_1.utf8ToHex)(GLOBAL_CONFIG_STORE_KEYS.LITE_CHAIN_ID_INDICES)) {
|
|
317
|
+
if (!/^\s*["']?\[(\d+(,\d+)*)?\]["']?\s*$/.test(args.value)) {
|
|
318
|
+
this_1.logger.warn({ at: "ConfigStore", message: "The lite chain indices array ".concat(args.value, " is invalid.") });
|
|
319
|
+
return "continue";
|
|
320
|
+
}
|
|
321
|
+
var chainIndices = JSON.parse(args.value.replace(/['"\s]/g, ""));
|
|
322
|
+
if (!(0, utils_1.isArrayOf)(chainIndices, utils_1.isPositiveInteger)) {
|
|
323
|
+
this_1.logger.warn({ at: "ConfigStore", message: "The array ".concat(chainIndices, " is invalid.") });
|
|
324
|
+
return "continue";
|
|
325
|
+
}
|
|
326
|
+
if (new Set(chainIndices).size !== chainIndices.length) {
|
|
327
|
+
this_1.logger.warn({
|
|
328
|
+
at: "ConfigStore",
|
|
329
|
+
message: "The array ".concat(chainIndices, " contains duplicates making it invalid."),
|
|
330
|
+
});
|
|
331
|
+
return "continue";
|
|
332
|
+
}
|
|
333
|
+
this_1.liteChainIndicesUpdates.push(tslib_1.__assign(tslib_1.__assign({}, args), { value: chainIndices, timestamp: globalConfigUpdateTimes[i] }));
|
|
334
|
+
}
|
|
335
|
+
else if (args.key === (0, utils_1.utf8ToHex)(GLOBAL_CONFIG_STORE_KEYS.CHAIN_ID_INDICES)) {
|
|
336
|
+
try {
|
|
337
|
+
var chainIndices_1 = JSON.parse(args.value.replace(/['"\s]/g, ""));
|
|
338
|
+
if (!(0, utils_1.isArrayOf)(chainIndices_1, utils_1.isPositiveInteger)) {
|
|
339
|
+
this_1.logger.warn({ at: "ConfigStore", message: "The array ".concat(chainIndices_1, " is invalid.") });
|
|
340
|
+
return "continue";
|
|
341
|
+
}
|
|
342
|
+
if (new Set(chainIndices_1).size !== chainIndices_1.length) {
|
|
343
|
+
this_1.logger.warn({
|
|
344
|
+
at: "ConfigStore",
|
|
345
|
+
message: "The array ".concat(chainIndices_1, " contains duplicates making it invalid."),
|
|
346
|
+
});
|
|
347
|
+
return "continue";
|
|
348
|
+
}
|
|
349
|
+
var previousUpdate = (_d = (_c = this_1.chainIdIndicesUpdates.at(-1)) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : this_1.implicitChainIdIndices(chainId);
|
|
350
|
+
if (!previousUpdate.every(function (chainId, idx) { return chainIndices_1[idx] === chainId; })) {
|
|
351
|
+
this_1.logger.warn({
|
|
352
|
+
at: "ConfigStoreClient#update",
|
|
353
|
+
message: "The array ".concat(chainIndices_1, " is invalid. It must be a superset of the previous array ").concat(previousUpdate),
|
|
354
|
+
});
|
|
355
|
+
return "continue";
|
|
356
|
+
}
|
|
357
|
+
this_1.chainIdIndicesUpdates.push(tslib_1.__assign(tslib_1.__assign({}, args), { value: chainIndices_1 }));
|
|
358
|
+
}
|
|
359
|
+
catch (e) {
|
|
360
|
+
this_1.logger.warn({ at: "ConfigStore::update", message: "Failed to parse chain ID indices: ".concat(args.value) });
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else if (args.key === (0, utils_1.utf8ToHex)(GLOBAL_CONFIG_STORE_KEYS.MAX_POOL_REBALANCE_LEAF_SIZE)) {
|
|
364
|
+
if (!isNaN(args.value)) {
|
|
365
|
+
this_1.cumulativeMaxL1TokenCountUpdates.push(args);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else if (args.key === (0, utils_1.utf8ToHex)(GLOBAL_CONFIG_STORE_KEYS.VERSION)) {
|
|
369
|
+
if (isNaN(args.value)) {
|
|
370
|
+
return "continue";
|
|
371
|
+
}
|
|
372
|
+
var value = Number(args.value);
|
|
373
|
+
if (!Number.isInteger(value)) {
|
|
374
|
+
return "continue";
|
|
375
|
+
}
|
|
376
|
+
var lastValue = Number((_f = (_e = this_1.cumulativeConfigStoreVersionUpdates[0]) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : exports.DEFAULT_CONFIG_STORE_VERSION);
|
|
377
|
+
if (value <= lastValue) {
|
|
378
|
+
return "continue";
|
|
379
|
+
}
|
|
380
|
+
this_1.cumulativeConfigStoreVersionUpdates = tslib_1.__spreadArray([
|
|
381
|
+
tslib_1.__assign(tslib_1.__assign({}, args), { timestamp: globalConfigUpdateTimes[i] })
|
|
382
|
+
], this_1.cumulativeConfigStoreVersionUpdates, true);
|
|
383
|
+
}
|
|
384
|
+
else if (args.key === (0, utils_1.utf8ToHex)(GLOBAL_CONFIG_STORE_KEYS.DISABLED_CHAINS)) {
|
|
385
|
+
try {
|
|
386
|
+
var chainIds = this_1.filterDisabledChains(JSON.parse(args.value));
|
|
387
|
+
this_1.cumulativeDisabledChainUpdates.push(tslib_1.__assign(tslib_1.__assign({}, args), { chainIds: chainIds }));
|
|
388
|
+
}
|
|
389
|
+
catch (err) {
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
return "continue";
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
this_1 = this;
|
|
397
|
+
for (i = 0; i < updatedGlobalConfigEvents.length; i++) {
|
|
398
|
+
_loop_1(i);
|
|
399
|
+
}
|
|
400
|
+
this.hasLatestConfigStoreVersion = this.hasValidConfigStoreVersionForTimestamp();
|
|
401
|
+
this.latestHeightSearched = result.searchEndBlock;
|
|
402
|
+
this.firstHeightToSearch = result.searchEndBlock + 1;
|
|
403
|
+
this.eventSearchConfig.to = undefined;
|
|
404
|
+
this.chainId = (_g = this.chainId) !== null && _g !== void 0 ? _g : chainId;
|
|
405
|
+
this.isUpdated = true;
|
|
406
|
+
this.logger.debug({ at: "ConfigStore", message: "ConfigStore client updated!" });
|
|
407
|
+
return [2];
|
|
323
408
|
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
const { value, key, txnRef } = args;
|
|
339
|
-
const parsedValue = (0, JSONUtils_1.parseJSONWithNumericString)(value);
|
|
340
|
-
const l1Token = key;
|
|
341
|
-
let rateModelForToken = undefined;
|
|
342
|
-
let spokeTargetBalances = {};
|
|
343
|
-
let routeRateModel = {};
|
|
344
|
-
if (parsedValue?.rateModel !== undefined) {
|
|
345
|
-
const rateModel = parsedValue.rateModel;
|
|
346
|
-
(0, assert_1.default)(this.isValidRateModel(rateModel), `Invalid rateModel UBar for ${l1Token} at transaction ${txnRef}, ${JSON.stringify(rateModel)}`);
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
AcrossConfigStoreClient.prototype.validateTokenConfigUpdate = function (args) {
|
|
413
|
+
var _this = this;
|
|
414
|
+
var value = args.value, key = args.key, txnRef = args.txnRef;
|
|
415
|
+
var parsedValue = (0, JSONUtils_1.parseJSONWithNumericString)(value);
|
|
416
|
+
var l1Token = key;
|
|
417
|
+
var rateModelForToken = undefined;
|
|
418
|
+
var spokeTargetBalances = {};
|
|
419
|
+
var routeRateModel = {};
|
|
420
|
+
if ((parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.rateModel) !== undefined) {
|
|
421
|
+
var rateModel = parsedValue.rateModel;
|
|
422
|
+
(0, assert_1.default)(this.isValidRateModel(rateModel), "Invalid rateModel UBar for ".concat(l1Token, " at transaction ").concat(txnRef, ", ").concat(JSON.stringify(rateModel)));
|
|
347
423
|
rateModelForToken = JSON.stringify(rateModel);
|
|
348
|
-
if (parsedValue
|
|
349
|
-
spokeTargetBalances = Object.fromEntries(Object.entries(parsedValue.spokeTargetBalances).map((
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
424
|
+
if (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.spokeTargetBalances) {
|
|
425
|
+
spokeTargetBalances = Object.fromEntries(Object.entries(parsedValue.spokeTargetBalances).map(function (_a) {
|
|
426
|
+
var chainId = _a[0], targetBalance = _a[1];
|
|
427
|
+
var target = (0, utils_1.max)((0, utils_1.toBN)(targetBalance.target), (0, utils_1.toBN)(0));
|
|
428
|
+
var threshold = (0, utils_1.max)((0, utils_1.toBN)(targetBalance.threshold), (0, utils_1.toBN)(0));
|
|
429
|
+
return [chainId, { target: target, threshold: threshold }];
|
|
353
430
|
}));
|
|
354
431
|
}
|
|
355
|
-
if (parsedValue
|
|
356
|
-
routeRateModel = Object.fromEntries(Object.entries(parsedValue.routeRateModel).map((
|
|
357
|
-
|
|
358
|
-
|
|
432
|
+
if (parsedValue === null || parsedValue === void 0 ? void 0 : parsedValue.routeRateModel) {
|
|
433
|
+
routeRateModel = Object.fromEntries(Object.entries(parsedValue.routeRateModel).map(function (_a) {
|
|
434
|
+
var path = _a[0], routeRateModel = _a[1];
|
|
435
|
+
(0, assert_1.default)(_this.isValidRateModel(routeRateModel) &&
|
|
436
|
+
"Invalid routeRateModel UBar for ".concat(path, " for ").concat(l1Token, " at transaction ").concat(txnRef, ", ").concat(JSON.stringify(routeRateModel)));
|
|
359
437
|
return [path, JSON.stringify(routeRateModel)];
|
|
360
438
|
}));
|
|
361
439
|
}
|
|
362
440
|
}
|
|
363
441
|
return {
|
|
364
|
-
spokeTargetBalances,
|
|
442
|
+
spokeTargetBalances: spokeTargetBalances,
|
|
365
443
|
rateModel: rateModelForToken,
|
|
366
|
-
routeRateModel,
|
|
444
|
+
routeRateModel: routeRateModel,
|
|
367
445
|
};
|
|
368
|
-
}
|
|
369
|
-
isValidRateModel(rateModel) {
|
|
446
|
+
};
|
|
447
|
+
AcrossConfigStoreClient.prototype.isValidRateModel = function (rateModel) {
|
|
370
448
|
return (0, utils_1.toBN)(rateModel.UBar).gt(0) && (0, utils_1.toBN)(rateModel.UBar).lt((0, utils_1.toWei)("1"));
|
|
371
|
-
}
|
|
372
|
-
filterDisabledChains(disabledChains) {
|
|
373
|
-
return disabledChains.filter((chainId)
|
|
374
|
-
}
|
|
375
|
-
|
|
449
|
+
};
|
|
450
|
+
AcrossConfigStoreClient.prototype.filterDisabledChains = function (disabledChains) {
|
|
451
|
+
return disabledChains.filter(function (chainId) { return !isNaN(chainId) && Number.isInteger(chainId) && chainId !== 1; });
|
|
452
|
+
};
|
|
453
|
+
return AcrossConfigStoreClient;
|
|
454
|
+
}(BaseAbstractClient_1.BaseAbstractClient));
|
|
376
455
|
exports.AcrossConfigStoreClient = AcrossConfigStoreClient;
|
|
377
456
|
//# sourceMappingURL=AcrossConfigStoreClient.js.map
|