@across-protocol/sdk 3.0.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/LICENSE +661 -0
- package/README.md +116 -0
- package/dist/cjs/apiClient/abstractClient.d.ts +13 -0
- package/dist/cjs/apiClient/abstractClient.js +17 -0
- package/dist/cjs/apiClient/abstractClient.js.map +1 -0
- package/dist/cjs/apiClient/index.d.ts +2 -0
- package/dist/cjs/apiClient/index.js +11 -0
- package/dist/cjs/apiClient/index.js.map +1 -0
- package/dist/cjs/apiClient/mockedClient.d.ts +11 -0
- package/dist/cjs/apiClient/mockedClient.js +60 -0
- package/dist/cjs/apiClient/mockedClient.js.map +1 -0
- package/dist/cjs/apiClient/productionClient.d.ts +10 -0
- package/dist/cjs/apiClient/productionClient.js +110 -0
- package/dist/cjs/apiClient/productionClient.js.map +1 -0
- package/dist/cjs/apiClient/types.d.ts +44 -0
- package/dist/cjs/apiClient/types.js +3 -0
- package/dist/cjs/apiClient/types.js.map +1 -0
- package/dist/cjs/caching/Arweave/ArweaveClient.d.ts +20 -0
- package/dist/cjs/caching/Arweave/ArweaveClient.js +218 -0
- package/dist/cjs/caching/Arweave/ArweaveClient.js.map +1 -0
- package/dist/cjs/caching/Arweave/index.d.ts +1 -0
- package/dist/cjs/caching/Arweave/index.js +5 -0
- package/dist/cjs/caching/Arweave/index.js.map +1 -0
- package/dist/cjs/caching/IPFS/PinataIPFSClient.d.ts +11 -0
- package/dist/cjs/caching/IPFS/PinataIPFSClient.js +67 -0
- package/dist/cjs/caching/IPFS/PinataIPFSClient.js.map +1 -0
- package/dist/cjs/caching/IPFS/index.d.ts +1 -0
- package/dist/cjs/caching/IPFS/index.js +5 -0
- package/dist/cjs/caching/IPFS/index.js.map +1 -0
- package/dist/cjs/caching/index.d.ts +2 -0
- package/dist/cjs/caching/index.js +6 -0
- package/dist/cjs/caching/index.js.map +1 -0
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +66 -0
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +377 -0
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -0
- package/dist/cjs/clients/AcrossConfigStoreClient/index.d.ts +1 -0
- package/dist/cjs/clients/AcrossConfigStoreClient/index.js +5 -0
- package/dist/cjs/clients/AcrossConfigStoreClient/index.js.map +1 -0
- package/dist/cjs/clients/BaseAbstractClient.d.ts +22 -0
- package/dist/cjs/clients/BaseAbstractClient.js +76 -0
- package/dist/cjs/clients/BaseAbstractClient.js.map +1 -0
- package/dist/cjs/clients/HubPoolClient.d.ts +111 -0
- package/dist/cjs/clients/HubPoolClient.js +758 -0
- package/dist/cjs/clients/HubPoolClient.js.map +1 -0
- package/dist/cjs/clients/SpokePoolClient.d.ts +117 -0
- package/dist/cjs/clients/SpokePoolClient.js +553 -0
- package/dist/cjs/clients/SpokePoolClient.js.map +1 -0
- package/dist/cjs/clients/index.d.ts +4 -0
- package/dist/cjs/clients/index.js +14 -0
- package/dist/cjs/clients/index.js.map +1 -0
- package/dist/cjs/clients/mocks/MockConfigStoreClient.d.ts +20 -0
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js +121 -0
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -0
- package/dist/cjs/clients/mocks/MockEvents.d.ts +27 -0
- package/dist/cjs/clients/mocks/MockEvents.js +117 -0
- package/dist/cjs/clients/mocks/MockEvents.js.map +1 -0
- package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +35 -0
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +222 -0
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -0
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +38 -0
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +319 -0
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -0
- package/dist/cjs/clients/mocks/index.d.ts +3 -0
- package/dist/cjs/clients/mocks/index.js +7 -0
- package/dist/cjs/clients/mocks/index.js.map +1 -0
- package/dist/cjs/coingecko/Coingecko.d.ts +40 -0
- package/dist/cjs/coingecko/Coingecko.js +277 -0
- package/dist/cjs/coingecko/Coingecko.js.map +1 -0
- package/dist/cjs/coingecko/index.d.ts +1 -0
- package/dist/cjs/coingecko/index.js +5 -0
- package/dist/cjs/coingecko/index.js.map +1 -0
- package/dist/cjs/constants.d.ts +18 -0
- package/dist/cjs/constants.js +27 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/contracts/acrossConfigStore.d.ts +57 -0
- package/dist/cjs/contracts/acrossConfigStore.js +65 -0
- package/dist/cjs/contracts/acrossConfigStore.js.map +1 -0
- package/dist/cjs/contracts/hubPool.d.ts +17 -0
- package/dist/cjs/contracts/hubPool.js +61 -0
- package/dist/cjs/contracts/hubPool.js.map +1 -0
- package/dist/cjs/contracts/index.d.ts +2 -0
- package/dist/cjs/contracts/index.js +7 -0
- package/dist/cjs/contracts/index.js.map +1 -0
- package/dist/cjs/contracts/utils.d.ts +15 -0
- package/dist/cjs/contracts/utils.js +40 -0
- package/dist/cjs/contracts/utils.js.map +1 -0
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.d.ts +3 -0
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.js +25 -0
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -0
- package/dist/cjs/gasPriceOracle/adapters/ethereum.d.ts +4 -0
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js +46 -0
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -0
- package/dist/cjs/gasPriceOracle/adapters/index.d.ts +3 -0
- package/dist/cjs/gasPriceOracle/adapters/index.js +7 -0
- package/dist/cjs/gasPriceOracle/adapters/index.js.map +1 -0
- package/dist/cjs/gasPriceOracle/adapters/polygon.d.ts +3 -0
- package/dist/cjs/gasPriceOracle/adapters/polygon.js +77 -0
- package/dist/cjs/gasPriceOracle/adapters/polygon.js.map +1 -0
- package/dist/cjs/gasPriceOracle/index.d.ts +2 -0
- package/dist/cjs/gasPriceOracle/index.js +6 -0
- package/dist/cjs/gasPriceOracle/index.js.map +1 -0
- package/dist/cjs/gasPriceOracle/oracle.d.ts +3 -0
- package/dist/cjs/gasPriceOracle/oracle.js +45 -0
- package/dist/cjs/gasPriceOracle/oracle.js.map +1 -0
- package/dist/cjs/gasPriceOracle/types.d.ts +8 -0
- package/dist/cjs/gasPriceOracle/types.js +3 -0
- package/dist/cjs/gasPriceOracle/types.js.map +1 -0
- package/dist/cjs/gasPriceOracle/util.d.ts +2 -0
- package/dist/cjs/gasPriceOracle/util.js +8 -0
- package/dist/cjs/gasPriceOracle/util.js.map +1 -0
- package/dist/cjs/index.d.ts +15 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interfaces/Bridge.d.ts +9 -0
- package/dist/cjs/interfaces/Bridge.js +3 -0
- package/dist/cjs/interfaces/Bridge.js.map +1 -0
- package/dist/cjs/interfaces/CachingMechanism.d.ts +5 -0
- package/dist/cjs/interfaces/CachingMechanism.js +3 -0
- package/dist/cjs/interfaces/CachingMechanism.js.map +1 -0
- package/dist/cjs/interfaces/Common.d.ts +10 -0
- package/dist/cjs/interfaces/Common.js +3 -0
- package/dist/cjs/interfaces/Common.js.map +1 -0
- package/dist/cjs/interfaces/ConfigStore.d.ts +81 -0
- package/dist/cjs/interfaces/ConfigStore.js +3 -0
- package/dist/cjs/interfaces/ConfigStore.js.map +1 -0
- package/dist/cjs/interfaces/Error.d.ts +5 -0
- package/dist/cjs/interfaces/Error.js +3 -0
- package/dist/cjs/interfaces/Error.js.map +1 -0
- package/dist/cjs/interfaces/HubPool.d.ts +98 -0
- package/dist/cjs/interfaces/HubPool.js +3 -0
- package/dist/cjs/interfaces/HubPool.js.map +1 -0
- package/dist/cjs/interfaces/SpokePool.d.ts +103 -0
- package/dist/cjs/interfaces/SpokePool.js +16 -0
- package/dist/cjs/interfaces/SpokePool.js.map +1 -0
- package/dist/cjs/interfaces/TypedData.d.ts +19 -0
- package/dist/cjs/interfaces/TypedData.js +3 -0
- package/dist/cjs/interfaces/TypedData.js.map +1 -0
- package/dist/cjs/interfaces/index.d.ts +8 -0
- package/dist/cjs/interfaces/index.js +12 -0
- package/dist/cjs/interfaces/index.js.map +1 -0
- package/dist/cjs/lpFeeCalculator/index.d.ts +1 -0
- package/dist/cjs/lpFeeCalculator/index.js +5 -0
- package/dist/cjs/lpFeeCalculator/index.js.map +1 -0
- package/dist/cjs/lpFeeCalculator/lpFeeCalculator.d.ts +19 -0
- package/dist/cjs/lpFeeCalculator/lpFeeCalculator.js +79 -0
- package/dist/cjs/lpFeeCalculator/lpFeeCalculator.js.map +1 -0
- package/dist/cjs/lpFeeCalculator/rateModel.d.ts +28 -0
- package/dist/cjs/lpFeeCalculator/rateModel.js +103 -0
- package/dist/cjs/lpFeeCalculator/rateModel.js.map +1 -0
- package/dist/cjs/merkleDistributor/MerkleDistributor.d.ts +8 -0
- package/dist/cjs/merkleDistributor/MerkleDistributor.js +25 -0
- package/dist/cjs/merkleDistributor/MerkleDistributor.js.map +1 -0
- package/dist/cjs/merkleDistributor/index.d.ts +2 -0
- package/dist/cjs/merkleDistributor/index.js +6 -0
- package/dist/cjs/merkleDistributor/index.js.map +1 -0
- package/dist/cjs/merkleDistributor/model/Distribution.d.ts +17 -0
- package/dist/cjs/merkleDistributor/model/Distribution.js +3 -0
- package/dist/cjs/merkleDistributor/model/Distribution.js.map +1 -0
- package/dist/cjs/merkleDistributor/model/index.d.ts +1 -0
- package/dist/cjs/merkleDistributor/model/index.js +5 -0
- package/dist/cjs/merkleDistributor/model/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/pool/TransactionManager.d.ts +12 -0
- package/dist/cjs/pool/TransactionManager.js +121 -0
- package/dist/cjs/pool/TransactionManager.js.map +1 -0
- package/dist/cjs/pool/index.d.ts +1 -0
- package/dist/cjs/pool/index.js +5 -0
- package/dist/cjs/pool/index.js.map +1 -0
- package/dist/cjs/pool/poolClient.d.ts +232 -0
- package/dist/cjs/pool/poolClient.js +869 -0
- package/dist/cjs/pool/poolClient.js.map +1 -0
- package/dist/cjs/priceClient/adapters/acrossApi.d.ts +13 -0
- package/dist/cjs/priceClient/adapters/acrossApi.js +48 -0
- package/dist/cjs/priceClient/adapters/acrossApi.js.map +1 -0
- package/dist/cjs/priceClient/adapters/baseAdapter.d.ts +17 -0
- package/dist/cjs/priceClient/adapters/baseAdapter.js +81 -0
- package/dist/cjs/priceClient/adapters/baseAdapter.js.map +1 -0
- package/dist/cjs/priceClient/adapters/coingecko.d.ts +14 -0
- package/dist/cjs/priceClient/adapters/coingecko.js +75 -0
- package/dist/cjs/priceClient/adapters/coingecko.js.map +1 -0
- package/dist/cjs/priceClient/adapters/defiLlama.d.ts +17 -0
- package/dist/cjs/priceClient/adapters/defiLlama.js +95 -0
- package/dist/cjs/priceClient/adapters/defiLlama.js.map +1 -0
- package/dist/cjs/priceClient/adapters/index.d.ts +3 -0
- package/dist/cjs/priceClient/adapters/index.js +8 -0
- package/dist/cjs/priceClient/adapters/index.js.map +1 -0
- package/dist/cjs/priceClient/index.d.ts +2 -0
- package/dist/cjs/priceClient/index.js +7 -0
- package/dist/cjs/priceClient/index.js.map +1 -0
- package/dist/cjs/priceClient/priceClient.d.ts +32 -0
- package/dist/cjs/priceClient/priceClient.js +197 -0
- package/dist/cjs/priceClient/priceClient.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +29 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +62 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +151 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +35 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/index.d.ts +3 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js +7 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/polygon.d.ts +152 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/polygon.js +43 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/polygon.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/index.d.ts +2 -0
- package/dist/cjs/relayFeeCalculator/index.js +6 -0
- package/dist/cjs/relayFeeCalculator/index.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +231 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +224 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -0
- package/dist/cjs/typechain.d.ts +17 -0
- package/dist/cjs/typechain.js +20 -0
- package/dist/cjs/typechain.js.map +1 -0
- package/dist/cjs/typeguards/error.d.ts +3 -0
- package/dist/cjs/typeguards/error.js +11 -0
- package/dist/cjs/typeguards/error.js.map +1 -0
- package/dist/cjs/typeguards/index.d.ts +1 -0
- package/dist/cjs/typeguards/index.js +5 -0
- package/dist/cjs/typeguards/index.js.map +1 -0
- package/dist/cjs/utils/AddressUtils.d.ts +2 -0
- package/dist/cjs/utils/AddressUtils.js +24 -0
- package/dist/cjs/utils/AddressUtils.js.map +1 -0
- package/dist/cjs/utils/ArrayUtils.d.ts +12 -0
- package/dist/cjs/utils/ArrayUtils.js +125 -0
- package/dist/cjs/utils/ArrayUtils.js.map +1 -0
- package/dist/cjs/utils/BigNumberUtils.d.ts +8 -0
- package/dist/cjs/utils/BigNumberUtils.js +26 -0
- package/dist/cjs/utils/BigNumberUtils.js.map +1 -0
- package/dist/cjs/utils/BlockExplorerUtils.d.ts +3 -0
- package/dist/cjs/utils/BlockExplorerUtils.js +52 -0
- package/dist/cjs/utils/BlockExplorerUtils.js.map +1 -0
- package/dist/cjs/utils/BlockUtils.d.ts +28 -0
- package/dist/cjs/utils/BlockUtils.js +251 -0
- package/dist/cjs/utils/BlockUtils.js.map +1 -0
- package/dist/cjs/utils/BundleUtils.d.ts +5 -0
- package/dist/cjs/utils/BundleUtils.js +62 -0
- package/dist/cjs/utils/BundleUtils.js.map +1 -0
- package/dist/cjs/utils/CachingUtils.d.ts +5 -0
- package/dist/cjs/utils/CachingUtils.js +59 -0
- package/dist/cjs/utils/CachingUtils.js.map +1 -0
- package/dist/cjs/utils/DeploymentUtils.d.ts +1 -0
- package/dist/cjs/utils/DeploymentUtils.js +8 -0
- package/dist/cjs/utils/DeploymentUtils.js.map +1 -0
- package/dist/cjs/utils/DepositUtils.d.ts +19 -0
- package/dist/cjs/utils/DepositUtils.js +107 -0
- package/dist/cjs/utils/DepositUtils.js.map +1 -0
- package/dist/cjs/utils/EventUtils.d.ts +18 -0
- package/dist/cjs/utils/EventUtils.js +169 -0
- package/dist/cjs/utils/EventUtils.js.map +1 -0
- package/dist/cjs/utils/FlowUtils.d.ts +7 -0
- package/dist/cjs/utils/FlowUtils.js +42 -0
- package/dist/cjs/utils/FlowUtils.js.map +1 -0
- package/dist/cjs/utils/FormattingUtils.d.ts +15 -0
- package/dist/cjs/utils/FormattingUtils.js +107 -0
- package/dist/cjs/utils/FormattingUtils.js.map +1 -0
- package/dist/cjs/utils/IPFSUtils.d.ts +4 -0
- package/dist/cjs/utils/IPFSUtils.js +48 -0
- package/dist/cjs/utils/IPFSUtils.js.map +1 -0
- package/dist/cjs/utils/JSONUtils.d.ts +4 -0
- package/dist/cjs/utils/JSONUtils.js +53 -0
- package/dist/cjs/utils/JSONUtils.js.map +1 -0
- package/dist/cjs/utils/LogUtils.d.ts +14 -0
- package/dist/cjs/utils/LogUtils.js +18 -0
- package/dist/cjs/utils/LogUtils.js.map +1 -0
- package/dist/cjs/utils/Multicall.d.ts +13 -0
- package/dist/cjs/utils/Multicall.js +73 -0
- package/dist/cjs/utils/Multicall.js.map +1 -0
- package/dist/cjs/utils/NetworkUtils.d.ts +10 -0
- package/dist/cjs/utils/NetworkUtils.js +70 -0
- package/dist/cjs/utils/NetworkUtils.js.map +1 -0
- package/dist/cjs/utils/NumberUtils.d.ts +2 -0
- package/dist/cjs/utils/NumberUtils.js +12 -0
- package/dist/cjs/utils/NumberUtils.js.map +1 -0
- package/dist/cjs/utils/ObjectUtils.d.ts +5 -0
- package/dist/cjs/utils/ObjectUtils.js +65 -0
- package/dist/cjs/utils/ObjectUtils.js.map +1 -0
- package/dist/cjs/utils/ReviverUtils.d.ts +3 -0
- package/dist/cjs/utils/ReviverUtils.js +23 -0
- package/dist/cjs/utils/ReviverUtils.js.map +1 -0
- package/dist/cjs/utils/SpokeUtils.d.ts +16 -0
- package/dist/cjs/utils/SpokeUtils.js +299 -0
- package/dist/cjs/utils/SpokeUtils.js.map +1 -0
- package/dist/cjs/utils/TimeUtils.d.ts +1 -0
- package/dist/cjs/utils/TimeUtils.js +8 -0
- package/dist/cjs/utils/TimeUtils.js.map +1 -0
- package/dist/cjs/utils/TokenUtils.d.ts +303 -0
- package/dist/cjs/utils/TokenUtils.js +74 -0
- package/dist/cjs/utils/TokenUtils.js.map +1 -0
- package/dist/cjs/utils/TypeGuards.d.ts +3 -0
- package/dist/cjs/utils/TypeGuards.js +16 -0
- package/dist/cjs/utils/TypeGuards.js.map +1 -0
- package/dist/cjs/utils/TypeUtils.d.ts +5 -0
- package/dist/cjs/utils/TypeUtils.js +3 -0
- package/dist/cjs/utils/TypeUtils.js.map +1 -0
- package/dist/cjs/utils/V3Utils.d.ts +4 -0
- package/dist/cjs/utils/V3Utils.js +15 -0
- package/dist/cjs/utils/V3Utils.js.map +1 -0
- package/dist/cjs/utils/ValidatorUtils.d.ts +2 -0
- package/dist/cjs/utils/ValidatorUtils.js +39 -0
- package/dist/cjs/utils/ValidatorUtils.js.map +1 -0
- package/dist/cjs/utils/abi/contracts/Multicall3.json +440 -0
- package/dist/cjs/utils/abi/index.d.ts +3 -0
- package/dist/cjs/utils/abi/index.js +31 -0
- package/dist/cjs/utils/abi/index.js.map +1 -0
- package/dist/cjs/utils/common.d.ts +79 -0
- package/dist/cjs/utils/common.js +220 -0
- package/dist/cjs/utils/common.js.map +1 -0
- package/dist/cjs/utils/index.d.ts +29 -0
- package/dist/cjs/utils/index.js +33 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/esm/apiClient/abstractClient.d.ts +66 -0
- package/dist/esm/apiClient/abstractClient.js +31 -0
- package/dist/esm/apiClient/abstractClient.js.map +1 -0
- package/dist/esm/apiClient/index.d.ts +2 -0
- package/dist/esm/apiClient/index.js +3 -0
- package/dist/esm/apiClient/index.js.map +1 -0
- package/dist/esm/apiClient/mockedClient.d.ts +24 -0
- package/dist/esm/apiClient/mockedClient.js +69 -0
- package/dist/esm/apiClient/mockedClient.js.map +1 -0
- package/dist/esm/apiClient/productionClient.d.ts +16 -0
- package/dist/esm/apiClient/productionClient.js +114 -0
- package/dist/esm/apiClient/productionClient.js.map +1 -0
- package/dist/esm/apiClient/types.d.ts +44 -0
- package/dist/esm/apiClient/types.js +2 -0
- package/dist/esm/apiClient/types.js.map +1 -0
- package/dist/esm/caching/Arweave/ArweaveClient.d.ts +61 -0
- package/dist/esm/caching/Arweave/ArweaveClient.js +265 -0
- package/dist/esm/caching/Arweave/ArweaveClient.js.map +1 -0
- package/dist/esm/caching/Arweave/index.d.ts +1 -0
- package/dist/esm/caching/Arweave/index.js +2 -0
- package/dist/esm/caching/Arweave/index.js.map +1 -0
- package/dist/esm/caching/IPFS/PinataIPFSClient.d.ts +37 -0
- package/dist/esm/caching/IPFS/PinataIPFSClient.js +81 -0
- package/dist/esm/caching/IPFS/PinataIPFSClient.js.map +1 -0
- package/dist/esm/caching/IPFS/index.d.ts +1 -0
- package/dist/esm/caching/IPFS/index.js +2 -0
- package/dist/esm/caching/IPFS/index.js.map +1 -0
- package/dist/esm/caching/index.d.ts +2 -0
- package/dist/esm/caching/index.js +3 -0
- package/dist/esm/caching/index.js.map +1 -0
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +108 -0
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +467 -0
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -0
- package/dist/esm/clients/AcrossConfigStoreClient/index.d.ts +1 -0
- package/dist/esm/clients/AcrossConfigStoreClient/index.js +2 -0
- package/dist/esm/clients/AcrossConfigStoreClient/index.js.map +1 -0
- package/dist/esm/clients/BaseAbstractClient.d.ts +51 -0
- package/dist/esm/clients/BaseAbstractClient.js +101 -0
- package/dist/esm/clients/BaseAbstractClient.js.map +1 -0
- package/dist/esm/clients/HubPoolClient.d.ts +134 -0
- package/dist/esm/clients/HubPoolClient.js +862 -0
- package/dist/esm/clients/HubPoolClient.js.map +1 -0
- package/dist/esm/clients/SpokePoolClient.d.ts +318 -0
- package/dist/esm/clients/SpokePoolClient.js +780 -0
- package/dist/esm/clients/SpokePoolClient.js.map +1 -0
- package/dist/esm/clients/index.d.ts +4 -0
- package/dist/esm/clients/index.js +6 -0
- package/dist/esm/clients/index.js.map +1 -0
- package/dist/esm/clients/mocks/MockConfigStoreClient.d.ts +20 -0
- package/dist/esm/clients/mocks/MockConfigStoreClient.js +122 -0
- package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -0
- package/dist/esm/clients/mocks/MockEvents.d.ts +34 -0
- package/dist/esm/clients/mocks/MockEvents.js +126 -0
- package/dist/esm/clients/mocks/MockEvents.js.map +1 -0
- package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +35 -0
- package/dist/esm/clients/mocks/MockHubPoolClient.js +223 -0
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -0
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +38 -0
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +322 -0
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -0
- package/dist/esm/clients/mocks/index.d.ts +3 -0
- package/dist/esm/clients/mocks/index.js +4 -0
- package/dist/esm/clients/mocks/index.js.map +1 -0
- package/dist/esm/coingecko/Coingecko.d.ts +40 -0
- package/dist/esm/coingecko/Coingecko.js +283 -0
- package/dist/esm/coingecko/Coingecko.js.map +1 -0
- package/dist/esm/coingecko/index.d.ts +1 -0
- package/dist/esm/coingecko/index.js +2 -0
- package/dist/esm/coingecko/index.js.map +1 -0
- package/dist/esm/constants.d.ts +29 -0
- package/dist/esm/constants.js +34 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/contracts/acrossConfigStore.d.ts +57 -0
- package/dist/esm/contracts/acrossConfigStore.js +62 -0
- package/dist/esm/contracts/acrossConfigStore.js.map +1 -0
- package/dist/esm/contracts/hubPool.d.ts +17 -0
- package/dist/esm/contracts/hubPool.js +55 -0
- package/dist/esm/contracts/hubPool.js.map +1 -0
- package/dist/esm/contracts/index.d.ts +2 -0
- package/dist/esm/contracts/index.js +5 -0
- package/dist/esm/contracts/index.js.map +1 -0
- package/dist/esm/contracts/utils.d.ts +23 -0
- package/dist/esm/contracts/utils.js +38 -0
- package/dist/esm/contracts/utils.js.map +1 -0
- package/dist/esm/gasPriceOracle/adapters/arbitrum.d.ts +3 -0
- package/dist/esm/gasPriceOracle/adapters/arbitrum.js +25 -0
- package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -0
- package/dist/esm/gasPriceOracle/adapters/ethereum.d.ts +4 -0
- package/dist/esm/gasPriceOracle/adapters/ethereum.js +41 -0
- package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -0
- package/dist/esm/gasPriceOracle/adapters/index.d.ts +3 -0
- package/dist/esm/gasPriceOracle/adapters/index.js +4 -0
- package/dist/esm/gasPriceOracle/adapters/index.js.map +1 -0
- package/dist/esm/gasPriceOracle/adapters/polygon.d.ts +3 -0
- package/dist/esm/gasPriceOracle/adapters/polygon.js +78 -0
- package/dist/esm/gasPriceOracle/adapters/polygon.js.map +1 -0
- package/dist/esm/gasPriceOracle/index.d.ts +2 -0
- package/dist/esm/gasPriceOracle/index.js +2 -0
- package/dist/esm/gasPriceOracle/index.js.map +1 -0
- package/dist/esm/gasPriceOracle/oracle.d.ts +10 -0
- package/dist/esm/gasPriceOracle/oracle.js +48 -0
- package/dist/esm/gasPriceOracle/oracle.js.map +1 -0
- package/dist/esm/gasPriceOracle/types.d.ts +8 -0
- package/dist/esm/gasPriceOracle/types.js +2 -0
- package/dist/esm/gasPriceOracle/types.js.map +1 -0
- package/dist/esm/gasPriceOracle/util.d.ts +2 -0
- package/dist/esm/gasPriceOracle/util.js +4 -0
- package/dist/esm/gasPriceOracle/util.js.map +1 -0
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.js +31 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interfaces/Bridge.d.ts +9 -0
- package/dist/esm/interfaces/Bridge.js +2 -0
- package/dist/esm/interfaces/Bridge.js.map +1 -0
- package/dist/esm/interfaces/CachingMechanism.d.ts +26 -0
- package/dist/esm/interfaces/CachingMechanism.js +2 -0
- package/dist/esm/interfaces/CachingMechanism.js.map +1 -0
- package/dist/esm/interfaces/Common.d.ts +10 -0
- package/dist/esm/interfaces/Common.js +2 -0
- package/dist/esm/interfaces/Common.js.map +1 -0
- package/dist/esm/interfaces/ConfigStore.d.ts +157 -0
- package/dist/esm/interfaces/ConfigStore.js +2 -0
- package/dist/esm/interfaces/ConfigStore.js.map +1 -0
- package/dist/esm/interfaces/Error.d.ts +5 -0
- package/dist/esm/interfaces/Error.js +2 -0
- package/dist/esm/interfaces/Error.js.map +1 -0
- package/dist/esm/interfaces/HubPool.d.ts +98 -0
- package/dist/esm/interfaces/HubPool.js +2 -0
- package/dist/esm/interfaces/HubPool.js.map +1 -0
- package/dist/esm/interfaces/SpokePool.d.ts +103 -0
- package/dist/esm/interfaces/SpokePool.js +13 -0
- package/dist/esm/interfaces/SpokePool.js.map +1 -0
- package/dist/esm/interfaces/TypedData.d.ts +19 -0
- package/dist/esm/interfaces/TypedData.js +2 -0
- package/dist/esm/interfaces/TypedData.js.map +1 -0
- package/dist/esm/interfaces/index.d.ts +8 -0
- package/dist/esm/interfaces/index.js +9 -0
- package/dist/esm/interfaces/index.js.map +1 -0
- package/dist/esm/lpFeeCalculator/index.d.ts +1 -0
- package/dist/esm/lpFeeCalculator/index.js +2 -0
- package/dist/esm/lpFeeCalculator/index.js.map +1 -0
- package/dist/esm/lpFeeCalculator/lpFeeCalculator.d.ts +66 -0
- package/dist/esm/lpFeeCalculator/lpFeeCalculator.js +129 -0
- package/dist/esm/lpFeeCalculator/lpFeeCalculator.js.map +1 -0
- package/dist/esm/lpFeeCalculator/rateModel.d.ts +45 -0
- package/dist/esm/lpFeeCalculator/rateModel.js +138 -0
- package/dist/esm/lpFeeCalculator/rateModel.js.map +1 -0
- package/dist/esm/merkleDistributor/MerkleDistributor.d.ts +20 -0
- package/dist/esm/merkleDistributor/MerkleDistributor.js +34 -0
- package/dist/esm/merkleDistributor/MerkleDistributor.js.map +1 -0
- package/dist/esm/merkleDistributor/index.d.ts +2 -0
- package/dist/esm/merkleDistributor/index.js +3 -0
- package/dist/esm/merkleDistributor/index.js.map +1 -0
- package/dist/esm/merkleDistributor/model/Distribution.d.ts +17 -0
- package/dist/esm/merkleDistributor/model/Distribution.js +2 -0
- package/dist/esm/merkleDistributor/model/Distribution.js.map +1 -0
- package/dist/esm/merkleDistributor/model/index.d.ts +1 -0
- package/dist/esm/merkleDistributor/model/index.js +2 -0
- package/dist/esm/merkleDistributor/model/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/pool/TransactionManager.d.ts +12 -0
- package/dist/esm/pool/TransactionManager.js +122 -0
- package/dist/esm/pool/TransactionManager.js.map +1 -0
- package/dist/esm/pool/index.d.ts +1 -0
- package/dist/esm/pool/index.js +2 -0
- package/dist/esm/pool/index.js.map +1 -0
- package/dist/esm/pool/poolClient.d.ts +242 -0
- package/dist/esm/pool/poolClient.js +899 -0
- package/dist/esm/pool/poolClient.js.map +1 -0
- package/dist/esm/priceClient/adapters/acrossApi.d.ts +14 -0
- package/dist/esm/priceClient/adapters/acrossApi.js +49 -0
- package/dist/esm/priceClient/adapters/acrossApi.js.map +1 -0
- package/dist/esm/priceClient/adapters/baseAdapter.d.ts +17 -0
- package/dist/esm/priceClient/adapters/baseAdapter.js +78 -0
- package/dist/esm/priceClient/adapters/baseAdapter.js.map +1 -0
- package/dist/esm/priceClient/adapters/coingecko.d.ts +14 -0
- package/dist/esm/priceClient/adapters/coingecko.js +73 -0
- package/dist/esm/priceClient/adapters/coingecko.js.map +1 -0
- package/dist/esm/priceClient/adapters/defiLlama.d.ts +17 -0
- package/dist/esm/priceClient/adapters/defiLlama.js +93 -0
- package/dist/esm/priceClient/adapters/defiLlama.js.map +1 -0
- package/dist/esm/priceClient/adapters/index.d.ts +3 -0
- package/dist/esm/priceClient/adapters/index.js +7 -0
- package/dist/esm/priceClient/adapters/index.js.map +1 -0
- package/dist/esm/priceClient/index.d.ts +2 -0
- package/dist/esm/priceClient/index.js +4 -0
- package/dist/esm/priceClient/index.js.map +1 -0
- package/dist/esm/priceClient/priceClient.d.ts +32 -0
- package/dist/esm/priceClient/priceClient.js +206 -0
- package/dist/esm/priceClient/priceClient.js.map +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +61 -0
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +91 -0
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +151 -0
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +38 -0
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/index.d.ts +3 -0
- package/dist/esm/relayFeeCalculator/chain-queries/index.js +4 -0
- package/dist/esm/relayFeeCalculator/chain-queries/index.js.map +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/polygon.d.ts +152 -0
- package/dist/esm/relayFeeCalculator/chain-queries/polygon.js +40 -0
- package/dist/esm/relayFeeCalculator/chain-queries/polygon.js.map +1 -0
- package/dist/esm/relayFeeCalculator/index.d.ts +2 -0
- package/dist/esm/relayFeeCalculator/index.js +3 -0
- package/dist/esm/relayFeeCalculator/index.js.map +1 -0
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +282 -0
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +298 -0
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -0
- package/dist/esm/typechain.d.ts +22 -0
- package/dist/esm/typechain.js +9 -0
- package/dist/esm/typechain.js.map +1 -0
- package/dist/esm/typeguards/error.d.ts +3 -0
- package/dist/esm/typeguards/error.js +6 -0
- package/dist/esm/typeguards/error.js.map +1 -0
- package/dist/esm/typeguards/index.d.ts +1 -0
- package/dist/esm/typeguards/index.js +2 -0
- package/dist/esm/typeguards/index.js.map +1 -0
- package/dist/esm/utils/AddressUtils.d.ts +8 -0
- package/dist/esm/utils/AddressUtils.js +28 -0
- package/dist/esm/utils/AddressUtils.js.map +1 -0
- package/dist/esm/utils/ArrayUtils.d.ts +98 -0
- package/dist/esm/utils/ArrayUtils.js +196 -0
- package/dist/esm/utils/ArrayUtils.js.map +1 -0
- package/dist/esm/utils/BigNumberUtils.d.ts +31 -0
- package/dist/esm/utils/BigNumberUtils.js +52 -0
- package/dist/esm/utils/BigNumberUtils.js.map +1 -0
- package/dist/esm/utils/BlockExplorerUtils.d.ts +21 -0
- package/dist/esm/utils/BlockExplorerUtils.js +91 -0
- package/dist/esm/utils/BlockExplorerUtils.js.map +1 -0
- package/dist/esm/utils/BlockUtils.d.ts +46 -0
- package/dist/esm/utils/BlockUtils.js +294 -0
- package/dist/esm/utils/BlockUtils.js.map +1 -0
- package/dist/esm/utils/BundleUtils.d.ts +29 -0
- package/dist/esm/utils/BundleUtils.js +89 -0
- package/dist/esm/utils/BundleUtils.js.map +1 -0
- package/dist/esm/utils/CachingUtils.d.ts +17 -0
- package/dist/esm/utils/CachingUtils.js +66 -0
- package/dist/esm/utils/CachingUtils.js.map +1 -0
- package/dist/esm/utils/DeploymentUtils.d.ts +1 -0
- package/dist/esm/utils/DeploymentUtils.js +2 -0
- package/dist/esm/utils/DeploymentUtils.js.map +1 -0
- package/dist/esm/utils/DepositUtils.d.ts +46 -0
- package/dist/esm/utils/DepositUtils.js +138 -0
- package/dist/esm/utils/DepositUtils.js.map +1 -0
- package/dist/esm/utils/EventUtils.d.ts +32 -0
- package/dist/esm/utils/EventUtils.js +194 -0
- package/dist/esm/utils/EventUtils.js.map +1 -0
- package/dist/esm/utils/FlowUtils.d.ts +8 -0
- package/dist/esm/utils/FlowUtils.js +39 -0
- package/dist/esm/utils/FlowUtils.js.map +1 -0
- package/dist/esm/utils/FormattingUtils.d.ts +61 -0
- package/dist/esm/utils/FormattingUtils.js +167 -0
- package/dist/esm/utils/FormattingUtils.js.map +1 -0
- package/dist/esm/utils/IPFSUtils.d.ts +24 -0
- package/dist/esm/utils/IPFSUtils.js +65 -0
- package/dist/esm/utils/IPFSUtils.js.map +1 -0
- package/dist/esm/utils/JSONUtils.d.ts +31 -0
- package/dist/esm/utils/JSONUtils.js +82 -0
- package/dist/esm/utils/JSONUtils.js.map +1 -0
- package/dist/esm/utils/LogUtils.d.ts +20 -0
- package/dist/esm/utils/LogUtils.js +19 -0
- package/dist/esm/utils/LogUtils.js.map +1 -0
- package/dist/esm/utils/Multicall.d.ts +13 -0
- package/dist/esm/utils/Multicall.js +70 -0
- package/dist/esm/utils/Multicall.js.map +1 -0
- package/dist/esm/utils/NetworkUtils.d.ts +60 -0
- package/dist/esm/utils/NetworkUtils.js +109 -0
- package/dist/esm/utils/NetworkUtils.js.map +1 -0
- package/dist/esm/utils/NumberUtils.d.ts +12 -0
- package/dist/esm/utils/NumberUtils.js +17 -0
- package/dist/esm/utils/NumberUtils.js.map +1 -0
- package/dist/esm/utils/ObjectUtils.d.ts +10 -0
- package/dist/esm/utils/ObjectUtils.js +72 -0
- package/dist/esm/utils/ObjectUtils.js.map +1 -0
- package/dist/esm/utils/ReviverUtils.d.ts +15 -0
- package/dist/esm/utils/ReviverUtils.js +33 -0
- package/dist/esm/utils/ReviverUtils.js.map +1 -0
- package/dist/esm/utils/SpokeUtils.d.ts +64 -0
- package/dist/esm/utils/SpokeUtils.js +370 -0
- package/dist/esm/utils/SpokeUtils.js.map +1 -0
- package/dist/esm/utils/TimeUtils.d.ts +5 -0
- package/dist/esm/utils/TimeUtils.js +8 -0
- package/dist/esm/utils/TimeUtils.js.map +1 -0
- package/dist/esm/utils/TokenUtils.d.ts +325 -0
- package/dist/esm/utils/TokenUtils.js +88 -0
- package/dist/esm/utils/TokenUtils.js.map +1 -0
- package/dist/esm/utils/TypeGuards.d.ts +3 -0
- package/dist/esm/utils/TypeGuards.js +10 -0
- package/dist/esm/utils/TypeGuards.js.map +1 -0
- package/dist/esm/utils/TypeUtils.d.ts +5 -0
- package/dist/esm/utils/TypeUtils.js +2 -0
- package/dist/esm/utils/TypeUtils.js.map +1 -0
- package/dist/esm/utils/V3Utils.d.ts +4 -0
- package/dist/esm/utils/V3Utils.js +10 -0
- package/dist/esm/utils/V3Utils.js.map +1 -0
- package/dist/esm/utils/ValidatorUtils.d.ts +2 -0
- package/dist/esm/utils/ValidatorUtils.js +35 -0
- package/dist/esm/utils/ValidatorUtils.js.map +1 -0
- package/dist/esm/utils/abi/contracts/Multicall3.json +440 -0
- package/dist/esm/utils/abi/index.d.ts +18 -0
- package/dist/esm/utils/abi/index.js +41 -0
- package/dist/esm/utils/abi/index.js.map +1 -0
- package/dist/esm/utils/common.d.ts +204 -0
- package/dist/esm/utils/common.js +325 -0
- package/dist/esm/utils/common.js.map +1 -0
- package/dist/esm/utils/index.d.ts +29 -0
- package/dist/esm/utils/index.js +30 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/types/apiClient/abstractClient.d.ts +67 -0
- package/dist/types/apiClient/abstractClient.d.ts.map +1 -0
- package/dist/types/apiClient/index.d.ts +3 -0
- package/dist/types/apiClient/index.d.ts.map +1 -0
- package/dist/types/apiClient/mockedClient.d.ts +25 -0
- package/dist/types/apiClient/mockedClient.d.ts.map +1 -0
- package/dist/types/apiClient/productionClient.d.ts +17 -0
- package/dist/types/apiClient/productionClient.d.ts.map +1 -0
- package/dist/types/apiClient/types.d.ts +45 -0
- package/dist/types/apiClient/types.d.ts.map +1 -0
- package/dist/types/caching/Arweave/ArweaveClient.d.ts +62 -0
- package/dist/types/caching/Arweave/ArweaveClient.d.ts.map +1 -0
- package/dist/types/caching/Arweave/index.d.ts +2 -0
- package/dist/types/caching/Arweave/index.d.ts.map +1 -0
- package/dist/types/caching/IPFS/PinataIPFSClient.d.ts +38 -0
- package/dist/types/caching/IPFS/PinataIPFSClient.d.ts.map +1 -0
- package/dist/types/caching/IPFS/index.d.ts +2 -0
- package/dist/types/caching/IPFS/index.d.ts.map +1 -0
- package/dist/types/caching/index.d.ts +3 -0
- package/dist/types/caching/index.d.ts.map +1 -0
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +109 -0
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -0
- package/dist/types/clients/AcrossConfigStoreClient/index.d.ts +2 -0
- package/dist/types/clients/AcrossConfigStoreClient/index.d.ts.map +1 -0
- package/dist/types/clients/BaseAbstractClient.d.ts +52 -0
- package/dist/types/clients/BaseAbstractClient.d.ts.map +1 -0
- package/dist/types/clients/HubPoolClient.d.ts +135 -0
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -0
- package/dist/types/clients/SpokePoolClient.d.ts +319 -0
- package/dist/types/clients/SpokePoolClient.d.ts.map +1 -0
- package/dist/types/clients/index.d.ts +5 -0
- package/dist/types/clients/index.d.ts.map +1 -0
- package/dist/types/clients/mocks/MockConfigStoreClient.d.ts +21 -0
- package/dist/types/clients/mocks/MockConfigStoreClient.d.ts.map +1 -0
- package/dist/types/clients/mocks/MockEvents.d.ts +35 -0
- package/dist/types/clients/mocks/MockEvents.d.ts.map +1 -0
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts +36 -0
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -0
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +39 -0
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -0
- package/dist/types/clients/mocks/index.d.ts +4 -0
- package/dist/types/clients/mocks/index.d.ts.map +1 -0
- package/dist/types/coingecko/Coingecko.d.ts +41 -0
- package/dist/types/coingecko/Coingecko.d.ts.map +1 -0
- package/dist/types/coingecko/index.d.ts +2 -0
- package/dist/types/coingecko/index.d.ts.map +1 -0
- package/dist/types/constants.d.ts +30 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/contracts/acrossConfigStore.d.ts +58 -0
- package/dist/types/contracts/acrossConfigStore.d.ts.map +1 -0
- package/dist/types/contracts/hubPool.d.ts +18 -0
- package/dist/types/contracts/hubPool.d.ts.map +1 -0
- package/dist/types/contracts/index.d.ts +3 -0
- package/dist/types/contracts/index.d.ts.map +1 -0
- package/dist/types/contracts/utils.d.ts +24 -0
- package/dist/types/contracts/utils.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts +4 -0
- package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts +5 -0
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/adapters/index.d.ts +4 -0
- package/dist/types/gasPriceOracle/adapters/index.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/adapters/polygon.d.ts +4 -0
- package/dist/types/gasPriceOracle/adapters/polygon.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/index.d.ts +3 -0
- package/dist/types/gasPriceOracle/index.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/oracle.d.ts +11 -0
- package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/types.d.ts +9 -0
- package/dist/types/gasPriceOracle/types.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/util.d.ts +3 -0
- package/dist/types/gasPriceOracle/util.d.ts.map +1 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/interfaces/Bridge.d.ts +10 -0
- package/dist/types/interfaces/Bridge.d.ts.map +1 -0
- package/dist/types/interfaces/CachingMechanism.d.ts +27 -0
- package/dist/types/interfaces/CachingMechanism.d.ts.map +1 -0
- package/dist/types/interfaces/Common.d.ts +11 -0
- package/dist/types/interfaces/Common.d.ts.map +1 -0
- package/dist/types/interfaces/ConfigStore.d.ts +158 -0
- package/dist/types/interfaces/ConfigStore.d.ts.map +1 -0
- package/dist/types/interfaces/Error.d.ts +6 -0
- package/dist/types/interfaces/Error.d.ts.map +1 -0
- package/dist/types/interfaces/HubPool.d.ts +99 -0
- package/dist/types/interfaces/HubPool.d.ts.map +1 -0
- package/dist/types/interfaces/SpokePool.d.ts +104 -0
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -0
- package/dist/types/interfaces/TypedData.d.ts +20 -0
- package/dist/types/interfaces/TypedData.d.ts.map +1 -0
- package/dist/types/interfaces/index.d.ts +9 -0
- package/dist/types/interfaces/index.d.ts.map +1 -0
- package/dist/types/lpFeeCalculator/index.d.ts +2 -0
- package/dist/types/lpFeeCalculator/index.d.ts.map +1 -0
- package/dist/types/lpFeeCalculator/lpFeeCalculator.d.ts +67 -0
- package/dist/types/lpFeeCalculator/lpFeeCalculator.d.ts.map +1 -0
- package/dist/types/lpFeeCalculator/rateModel.d.ts +46 -0
- package/dist/types/lpFeeCalculator/rateModel.d.ts.map +1 -0
- package/dist/types/merkleDistributor/MerkleDistributor.d.ts +21 -0
- package/dist/types/merkleDistributor/MerkleDistributor.d.ts.map +1 -0
- package/dist/types/merkleDistributor/index.d.ts +3 -0
- package/dist/types/merkleDistributor/index.d.ts.map +1 -0
- package/dist/types/merkleDistributor/model/Distribution.d.ts +18 -0
- package/dist/types/merkleDistributor/model/Distribution.d.ts.map +1 -0
- package/dist/types/merkleDistributor/model/index.d.ts +2 -0
- package/dist/types/merkleDistributor/model/index.d.ts.map +1 -0
- package/dist/types/pool/TransactionManager.d.ts +13 -0
- package/dist/types/pool/TransactionManager.d.ts.map +1 -0
- package/dist/types/pool/index.d.ts +2 -0
- package/dist/types/pool/index.d.ts.map +1 -0
- package/dist/types/pool/poolClient.d.ts +243 -0
- package/dist/types/pool/poolClient.d.ts.map +1 -0
- package/dist/types/priceClient/adapters/acrossApi.d.ts +15 -0
- package/dist/types/priceClient/adapters/acrossApi.d.ts.map +1 -0
- package/dist/types/priceClient/adapters/baseAdapter.d.ts +18 -0
- package/dist/types/priceClient/adapters/baseAdapter.d.ts.map +1 -0
- package/dist/types/priceClient/adapters/coingecko.d.ts +15 -0
- package/dist/types/priceClient/adapters/coingecko.d.ts.map +1 -0
- package/dist/types/priceClient/adapters/defiLlama.d.ts +18 -0
- package/dist/types/priceClient/adapters/defiLlama.d.ts.map +1 -0
- package/dist/types/priceClient/adapters/index.d.ts +4 -0
- package/dist/types/priceClient/adapters/index.d.ts.map +1 -0
- package/dist/types/priceClient/index.d.ts +3 -0
- package/dist/types/priceClient/index.d.ts.map +1 -0
- package/dist/types/priceClient/priceClient.d.ts +33 -0
- package/dist/types/priceClient/priceClient.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +62 -0
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +152 -0
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/chain-queries/index.d.ts +4 -0
- package/dist/types/relayFeeCalculator/chain-queries/index.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/chain-queries/polygon.d.ts +153 -0
- package/dist/types/relayFeeCalculator/chain-queries/polygon.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/index.d.ts +3 -0
- package/dist/types/relayFeeCalculator/index.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +283 -0
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -0
- package/dist/types/typechain.d.ts +23 -0
- package/dist/types/typechain.d.ts.map +1 -0
- package/dist/types/typeguards/error.d.ts +4 -0
- package/dist/types/typeguards/error.d.ts.map +1 -0
- package/dist/types/typeguards/index.d.ts +2 -0
- package/dist/types/typeguards/index.d.ts.map +1 -0
- package/dist/types/utils/AddressUtils.d.ts +9 -0
- package/dist/types/utils/AddressUtils.d.ts.map +1 -0
- package/dist/types/utils/ArrayUtils.d.ts +99 -0
- package/dist/types/utils/ArrayUtils.d.ts.map +1 -0
- package/dist/types/utils/BigNumberUtils.d.ts +32 -0
- package/dist/types/utils/BigNumberUtils.d.ts.map +1 -0
- package/dist/types/utils/BlockExplorerUtils.d.ts +22 -0
- package/dist/types/utils/BlockExplorerUtils.d.ts.map +1 -0
- package/dist/types/utils/BlockUtils.d.ts +47 -0
- package/dist/types/utils/BlockUtils.d.ts.map +1 -0
- package/dist/types/utils/BundleUtils.d.ts +30 -0
- package/dist/types/utils/BundleUtils.d.ts.map +1 -0
- package/dist/types/utils/CachingUtils.d.ts +18 -0
- package/dist/types/utils/CachingUtils.d.ts.map +1 -0
- package/dist/types/utils/DeploymentUtils.d.ts +2 -0
- package/dist/types/utils/DeploymentUtils.d.ts.map +1 -0
- package/dist/types/utils/DepositUtils.d.ts +47 -0
- package/dist/types/utils/DepositUtils.d.ts.map +1 -0
- package/dist/types/utils/EventUtils.d.ts +33 -0
- package/dist/types/utils/EventUtils.d.ts.map +1 -0
- package/dist/types/utils/FlowUtils.d.ts +9 -0
- package/dist/types/utils/FlowUtils.d.ts.map +1 -0
- package/dist/types/utils/FormattingUtils.d.ts +62 -0
- package/dist/types/utils/FormattingUtils.d.ts.map +1 -0
- package/dist/types/utils/IPFSUtils.d.ts +25 -0
- package/dist/types/utils/IPFSUtils.d.ts.map +1 -0
- package/dist/types/utils/JSONUtils.d.ts +32 -0
- package/dist/types/utils/JSONUtils.d.ts.map +1 -0
- package/dist/types/utils/LogUtils.d.ts +21 -0
- package/dist/types/utils/LogUtils.d.ts.map +1 -0
- package/dist/types/utils/Multicall.d.ts +14 -0
- package/dist/types/utils/Multicall.d.ts.map +1 -0
- package/dist/types/utils/NetworkUtils.d.ts +61 -0
- package/dist/types/utils/NetworkUtils.d.ts.map +1 -0
- package/dist/types/utils/NumberUtils.d.ts +13 -0
- package/dist/types/utils/NumberUtils.d.ts.map +1 -0
- package/dist/types/utils/ObjectUtils.d.ts +11 -0
- package/dist/types/utils/ObjectUtils.d.ts.map +1 -0
- package/dist/types/utils/ReviverUtils.d.ts +16 -0
- package/dist/types/utils/ReviverUtils.d.ts.map +1 -0
- package/dist/types/utils/SpokeUtils.d.ts +65 -0
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -0
- package/dist/types/utils/TimeUtils.d.ts +6 -0
- package/dist/types/utils/TimeUtils.d.ts.map +1 -0
- package/dist/types/utils/TokenUtils.d.ts +326 -0
- package/dist/types/utils/TokenUtils.d.ts.map +1 -0
- package/dist/types/utils/TypeGuards.d.ts +4 -0
- package/dist/types/utils/TypeGuards.d.ts.map +1 -0
- package/dist/types/utils/TypeUtils.d.ts +6 -0
- package/dist/types/utils/TypeUtils.d.ts.map +1 -0
- package/dist/types/utils/V3Utils.d.ts +5 -0
- package/dist/types/utils/V3Utils.d.ts.map +1 -0
- package/dist/types/utils/ValidatorUtils.d.ts +3 -0
- package/dist/types/utils/ValidatorUtils.d.ts.map +1 -0
- package/dist/types/utils/abi/index.d.ts +19 -0
- package/dist/types/utils/abi/index.d.ts.map +1 -0
- package/dist/types/utils/common.d.ts +205 -0
- package/dist/types/utils/common.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +30 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/package.json +144 -0
- package/src/apiClient/abstractClient.ts +95 -0
- package/src/apiClient/index.ts +2 -0
- package/src/apiClient/mockedClient.ts +90 -0
- package/src/apiClient/productionClient.ts +98 -0
- package/src/apiClient/types.ts +49 -0
- package/src/caching/Arweave/ArweaveClient.ts +238 -0
- package/src/caching/Arweave/index.ts +1 -0
- package/src/caching/IPFS/PinataIPFSClient.ts +92 -0
- package/src/caching/IPFS/index.ts +1 -0
- package/src/caching/index.ts +2 -0
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +526 -0
- package/src/clients/AcrossConfigStoreClient/index.ts +1 -0
- package/src/clients/BaseAbstractClient.ts +94 -0
- package/src/clients/HubPoolClient.ts +1010 -0
- package/src/clients/SpokePoolClient.ts +894 -0
- package/src/clients/index.ts +9 -0
- package/src/clients/mocks/MockConfigStoreClient.ts +129 -0
- package/src/clients/mocks/MockEvents.ts +156 -0
- package/src/clients/mocks/MockHubPoolClient.ts +257 -0
- package/src/clients/mocks/MockSpokePoolClient.ts +341 -0
- package/src/clients/mocks/index.ts +3 -0
- package/src/coingecko/Coingecko.ts +277 -0
- package/src/coingecko/index.ts +1 -0
- package/src/constants.ts +53 -0
- package/src/contracts/acrossConfigStore.ts +49 -0
- package/src/contracts/hubPool.ts +90 -0
- package/src/contracts/index.ts +2 -0
- package/src/contracts/utils.ts +56 -0
- package/src/gasPriceOracle/adapters/arbitrum.ts +21 -0
- package/src/gasPriceOracle/adapters/ethereum.ts +27 -0
- package/src/gasPriceOracle/adapters/index.ts +3 -0
- package/src/gasPriceOracle/adapters/polygon.ts +77 -0
- package/src/gasPriceOracle/index.ts +2 -0
- package/src/gasPriceOracle/oracle.ts +42 -0
- package/src/gasPriceOracle/types.ts +10 -0
- package/src/gasPriceOracle/util.ts +5 -0
- package/src/index.ts +15 -0
- package/src/interfaces/Bridge.ts +10 -0
- package/src/interfaces/CachingMechanism.ts +37 -0
- package/src/interfaces/Common.ts +12 -0
- package/src/interfaces/ConfigStore.ts +173 -0
- package/src/interfaces/Error.ts +5 -0
- package/src/interfaces/HubPool.ts +118 -0
- package/src/interfaces/SpokePool.ts +119 -0
- package/src/interfaces/TypedData.ts +21 -0
- package/src/interfaces/index.ts +8 -0
- package/src/lpFeeCalculator/README.md +27 -0
- package/src/lpFeeCalculator/index.ts +1 -0
- package/src/lpFeeCalculator/lpFeeCalculator.ts +169 -0
- package/src/lpFeeCalculator/rateModel.ts +183 -0
- package/src/merkleDistributor/MerkleDistributor.ts +37 -0
- package/src/merkleDistributor/README.md +30 -0
- package/src/merkleDistributor/index.ts +2 -0
- package/src/merkleDistributor/model/Distribution.ts +17 -0
- package/src/merkleDistributor/model/index.ts +1 -0
- package/src/pool/TransactionManager.ts +73 -0
- package/src/pool/index.ts +1 -0
- package/src/pool/poolClient.ts +840 -0
- package/src/priceClient/README.md +36 -0
- package/src/priceClient/adapters/acrossApi.ts +44 -0
- package/src/priceClient/adapters/baseAdapter.ts +65 -0
- package/src/priceClient/adapters/coingecko.ts +67 -0
- package/src/priceClient/adapters/defiLlama.ts +96 -0
- package/src/priceClient/adapters/index.ts +3 -0
- package/src/priceClient/index.ts +2 -0
- package/src/priceClient/priceClient.ts +192 -0
- package/src/relayFeeCalculator/README.md +34 -0
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +98 -0
- package/src/relayFeeCalculator/chain-queries/factory.ts +58 -0
- package/src/relayFeeCalculator/chain-queries/index.ts +3 -0
- package/src/relayFeeCalculator/chain-queries/polygon.ts +45 -0
- package/src/relayFeeCalculator/index.ts +2 -0
- package/src/relayFeeCalculator/relayFeeCalculator.ts +410 -0
- package/src/typechain.ts +46 -0
- package/src/typeguards/error.ts +7 -0
- package/src/typeguards/index.ts +1 -0
- package/src/utils/AddressUtils.ts +18 -0
- package/src/utils/ArrayUtils.ts +170 -0
- package/src/utils/BigNumberUtils.ts +58 -0
- package/src/utils/BlockExplorerUtils.ts +91 -0
- package/src/utils/BlockUtils.ts +265 -0
- package/src/utils/BundleUtils.ts +109 -0
- package/src/utils/CachingUtils.ts +56 -0
- package/src/utils/DeploymentUtils.ts +5 -0
- package/src/utils/DepositUtils.ts +144 -0
- package/src/utils/EventUtils.ts +227 -0
- package/src/utils/FlowUtils.ts +48 -0
- package/src/utils/FormattingUtils.ts +186 -0
- package/src/utils/IPFSUtils.ts +48 -0
- package/src/utils/JSONUtils.ts +85 -0
- package/src/utils/LogUtils.ts +38 -0
- package/src/utils/Multicall.ts +64 -0
- package/src/utils/NetworkUtils.ts +117 -0
- package/src/utils/NumberUtils.ts +17 -0
- package/src/utils/ObjectUtils.ts +77 -0
- package/src/utils/ReviverUtils.ts +31 -0
- package/src/utils/SpokeUtils.ts +372 -0
- package/src/utils/TimeUtils.ts +7 -0
- package/src/utils/TokenUtils.ts +94 -0
- package/src/utils/TypeGuards.ts +15 -0
- package/src/utils/TypeUtils.ts +9 -0
- package/src/utils/V3Utils.ts +12 -0
- package/src/utils/ValidatorUtils.ts +38 -0
- package/src/utils/abi/contracts/Multicall3.json +440 -0
- package/src/utils/abi/index.ts +33 -0
- package/src/utils/common.ts +392 -0
- package/src/utils/index.ts +29 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import { utils, across } from "@uma/sdk";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
import { Contract, Event } from "ethers";
|
|
4
|
+
import winston from "winston";
|
|
5
|
+
import { isError } from "../../typeguards";
|
|
6
|
+
import {
|
|
7
|
+
EventSearchConfig,
|
|
8
|
+
MakeOptional,
|
|
9
|
+
findLast,
|
|
10
|
+
isArrayOf,
|
|
11
|
+
isDefined,
|
|
12
|
+
isPositiveInteger,
|
|
13
|
+
max,
|
|
14
|
+
paginatedEventQuery,
|
|
15
|
+
sortEventsAscendingInPlace,
|
|
16
|
+
sortEventsDescending,
|
|
17
|
+
spreadEvent,
|
|
18
|
+
spreadEventWithBlockNumber,
|
|
19
|
+
toBN,
|
|
20
|
+
utf8ToHex,
|
|
21
|
+
} from "../../utils";
|
|
22
|
+
import { PROTOCOL_DEFAULT_CHAIN_ID_INDICES } from "../../constants";
|
|
23
|
+
import {
|
|
24
|
+
ConfigStoreVersionUpdate,
|
|
25
|
+
DisabledChainsUpdate,
|
|
26
|
+
GlobalConfigUpdate,
|
|
27
|
+
ParsedTokenConfig,
|
|
28
|
+
RouteRateModelUpdate,
|
|
29
|
+
SpokePoolTargetBalance,
|
|
30
|
+
SpokeTargetBalanceUpdate,
|
|
31
|
+
TokenConfig,
|
|
32
|
+
UBAConfigUpdates,
|
|
33
|
+
UBAParsedConfigType,
|
|
34
|
+
} from "../../interfaces";
|
|
35
|
+
import { parseJSONWithNumericString } from "../../utils/JSONUtils";
|
|
36
|
+
import { BaseAbstractClient, isUpdateFailureReason, UpdateFailureReason } from "../BaseAbstractClient";
|
|
37
|
+
|
|
38
|
+
type ConfigStoreUpdateSuccess = {
|
|
39
|
+
success: true;
|
|
40
|
+
chainId: number;
|
|
41
|
+
searchEndBlock: number;
|
|
42
|
+
events: {
|
|
43
|
+
updatedTokenConfigEvents: Event[];
|
|
44
|
+
updatedGlobalConfigEvents: Event[];
|
|
45
|
+
globalConfigUpdateTimes: number[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
type ConfigStoreUpdateFailure = { success: false; reason: UpdateFailureReason };
|
|
49
|
+
export type ConfigStoreUpdate = ConfigStoreUpdateSuccess | ConfigStoreUpdateFailure;
|
|
50
|
+
|
|
51
|
+
// Version 0 is the implicit ConfigStore version from before the version attribute was introduced.
|
|
52
|
+
// @dev Do not change this value.
|
|
53
|
+
export const DEFAULT_CONFIG_STORE_VERSION = 0;
|
|
54
|
+
|
|
55
|
+
export enum GLOBAL_CONFIG_STORE_KEYS {
|
|
56
|
+
MAX_RELAYER_REPAYMENT_LEAF_SIZE = "MAX_RELAYER_REPAYMENT_LEAF_SIZE",
|
|
57
|
+
MAX_POOL_REBALANCE_LEAF_SIZE = "MAX_POOL_REBALANCE_LEAF_SIZE",
|
|
58
|
+
VERSION = "VERSION",
|
|
59
|
+
DISABLED_CHAINS = "DISABLED_CHAINS",
|
|
60
|
+
CHAIN_ID_INDICES = "CHAIN_ID_INDICES",
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
64
|
+
public cumulativeRateModelUpdates: across.rateModel.RateModelEvent[] = [];
|
|
65
|
+
public ubaConfigUpdates: UBAConfigUpdates[] = [];
|
|
66
|
+
public cumulativeRouteRateModelUpdates: RouteRateModelUpdate[] = [];
|
|
67
|
+
public cumulativeMaxRefundCountUpdates: GlobalConfigUpdate[] = [];
|
|
68
|
+
public cumulativeMaxL1TokenCountUpdates: GlobalConfigUpdate[] = [];
|
|
69
|
+
public chainIdIndicesUpdates: GlobalConfigUpdate<number[]>[] = [];
|
|
70
|
+
public cumulativeSpokeTargetBalanceUpdates: SpokeTargetBalanceUpdate[] = [];
|
|
71
|
+
public cumulativeConfigStoreVersionUpdates: ConfigStoreVersionUpdate[] = [];
|
|
72
|
+
public cumulativeDisabledChainUpdates: DisabledChainsUpdate[] = [];
|
|
73
|
+
|
|
74
|
+
protected rateModelDictionary: across.rateModel.RateModelDictionary;
|
|
75
|
+
|
|
76
|
+
public hasLatestConfigStoreVersion = false;
|
|
77
|
+
public chainId: number | undefined;
|
|
78
|
+
|
|
79
|
+
constructor(
|
|
80
|
+
readonly logger: winston.Logger,
|
|
81
|
+
readonly configStore: Contract,
|
|
82
|
+
eventSearchConfig: MakeOptional<EventSearchConfig, "toBlock"> = { fromBlock: 0, maxBlockLookBack: 0 },
|
|
83
|
+
readonly configStoreVersion: number
|
|
84
|
+
) {
|
|
85
|
+
super(eventSearchConfig);
|
|
86
|
+
this.firstBlockToSearch = eventSearchConfig.fromBlock;
|
|
87
|
+
this.latestBlockSearched = 0;
|
|
88
|
+
this.rateModelDictionary = new across.rateModel.RateModelDictionary();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// <-- START LEGACY CONFIGURATION OBJECTS -->
|
|
92
|
+
// @dev The following configuration objects are pre-UBA fee model configurations and are deprecated as of version
|
|
93
|
+
// 2 of the ConfigStore. They are kept here for backwards compatibility.
|
|
94
|
+
|
|
95
|
+
getRateModelForBlockNumber(
|
|
96
|
+
l1Token: string,
|
|
97
|
+
originChainId: number | string,
|
|
98
|
+
destinationChainId: number | string,
|
|
99
|
+
blockNumber: number | undefined = undefined
|
|
100
|
+
): across.constants.RateModel {
|
|
101
|
+
// Use route-rate model if available, otherwise use default rate model for l1Token.
|
|
102
|
+
const route = `${originChainId}-${destinationChainId}`;
|
|
103
|
+
const routeRateModel = this.getRouteRateModelForBlockNumber(l1Token, route, blockNumber);
|
|
104
|
+
return routeRateModel ?? this.rateModelDictionary.getRateModelForBlockNumber(l1Token, blockNumber);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
getRouteRateModelForBlockNumber(
|
|
108
|
+
l1Token: string,
|
|
109
|
+
route: string,
|
|
110
|
+
blockNumber: number | undefined = undefined
|
|
111
|
+
): across.constants.RateModel | undefined {
|
|
112
|
+
const config = (sortEventsDescending(this.cumulativeRouteRateModelUpdates) as RouteRateModelUpdate[]).find(
|
|
113
|
+
(config) => config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token
|
|
114
|
+
);
|
|
115
|
+
if (config?.routeRateModel[route] === undefined) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
return across.rateModel.parseAndReturnRateModelFromString(config.routeRateModel[route]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Resolve the implied set of chain ID indices based on the chain ID of the ConfigStore.
|
|
123
|
+
* @param chainId Chain ID of the ConfigStore.
|
|
124
|
+
* @dev If the resolved chain ID is part of the default set, assume the protocol defaults.
|
|
125
|
+
* Otherwise, assume this is a test deployment with a lone chain ID.
|
|
126
|
+
* @dev The protocol defaults are [1, 10, 137, 288, 42161] (outlined in UMIP-157).
|
|
127
|
+
* @dev chainId is marked optional to appease tsc. It must always be passed in.
|
|
128
|
+
*/
|
|
129
|
+
protected implicitChainIdIndices(chainId?: number): number[] {
|
|
130
|
+
assert(isDefined(chainId), "ConfigStoreClient used before update");
|
|
131
|
+
return PROTOCOL_DEFAULT_CHAIN_ID_INDICES[0] === chainId ? PROTOCOL_DEFAULT_CHAIN_ID_INDICES : [chainId];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Resolves the chain ids that were available to the protocol at a given block range.
|
|
136
|
+
* @param blockNumber Block number to search for. Defaults to latest block.
|
|
137
|
+
* @returns List of chain IDs that were available to the protocol at the given block number.
|
|
138
|
+
* @note This dynamic functionality has been added after the launch of Across.
|
|
139
|
+
* @note This function will return a default list of chain IDs if the block requested
|
|
140
|
+
* existed before the initial inclusion of this dynamic key/value entry. In the
|
|
141
|
+
* case that a block number is requested that is before the initial inclusion of
|
|
142
|
+
* this key/value entry, the function will return the default list of chain IDs as
|
|
143
|
+
* outlined per the UMIP (https://github.com/UMAprotocol/UMIPs/pull/590).
|
|
144
|
+
*/
|
|
145
|
+
getChainIdIndicesForBlock(blockNumber: number = Number.MAX_SAFE_INTEGER): number[] {
|
|
146
|
+
// Resolve the chain ID indices for the block number requested.
|
|
147
|
+
const chainIdUpdates = sortEventsDescending(this.chainIdIndicesUpdates);
|
|
148
|
+
// Iterate through each of the chain ID updates and resolve the first update that is
|
|
149
|
+
// less than or equal to the block number requested.
|
|
150
|
+
const chainIdIndices = chainIdUpdates.find((update) => update.blockNumber <= blockNumber)?.value;
|
|
151
|
+
|
|
152
|
+
// Return either the found value or the protocol default.
|
|
153
|
+
return chainIdIndices ?? this.implicitChainIdIndices(this.chainId);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
getSpokeTargetBalancesForBlock(
|
|
157
|
+
l1Token: string,
|
|
158
|
+
chainId: number,
|
|
159
|
+
blockNumber: number = Number.MAX_SAFE_INTEGER
|
|
160
|
+
): SpokePoolTargetBalance {
|
|
161
|
+
const config = (sortEventsDescending(this.cumulativeSpokeTargetBalanceUpdates) as SpokeTargetBalanceUpdate[]).find(
|
|
162
|
+
(config) => config.l1Token === l1Token && config.blockNumber <= blockNumber
|
|
163
|
+
);
|
|
164
|
+
const targetBalance = config?.spokeTargetBalances?.[chainId];
|
|
165
|
+
return targetBalance || { target: toBN(0), threshold: toBN(0) };
|
|
166
|
+
}
|
|
167
|
+
// <-- END LEGACY CONFIGURATION OBJECTS -->
|
|
168
|
+
|
|
169
|
+
getMaxRefundCountForRelayerRefundLeafForBlock(blockNumber: number = Number.MAX_SAFE_INTEGER): number {
|
|
170
|
+
const config = (sortEventsDescending(this.cumulativeMaxRefundCountUpdates) as GlobalConfigUpdate[]).find(
|
|
171
|
+
(config) => config.blockNumber <= blockNumber
|
|
172
|
+
);
|
|
173
|
+
if (!config) {
|
|
174
|
+
throw new Error(`Could not find MaxRefundCount before block ${blockNumber}`);
|
|
175
|
+
}
|
|
176
|
+
return Number(config.value);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
getMaxL1TokenCountForPoolRebalanceLeafForBlock(blockNumber: number = Number.MAX_SAFE_INTEGER): number {
|
|
180
|
+
const config = (sortEventsDescending(this.cumulativeMaxL1TokenCountUpdates) as GlobalConfigUpdate[]).find(
|
|
181
|
+
(config) => config.blockNumber <= blockNumber
|
|
182
|
+
);
|
|
183
|
+
if (!config) {
|
|
184
|
+
throw new Error(`Could not find MaxL1TokenCount before block ${blockNumber}`);
|
|
185
|
+
}
|
|
186
|
+
return Number(config.value);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Returns list of chains that have been enabled at least once in the block range.
|
|
191
|
+
* If a chain was disabled in the block range, it will be included in the list provided it was enabled
|
|
192
|
+
* at some point in the block range.
|
|
193
|
+
* @dev If fromBlock == toBlock then defaults to returning enabled chains at fromBlock
|
|
194
|
+
* @param fromBlock Start block to search inclusive
|
|
195
|
+
* @param toBlock End block to search inclusive. Defaults to MAX_SAFE_INTEGER, so grabs all disabled chain events
|
|
196
|
+
* up until `latest`.
|
|
197
|
+
* @returns List of chain IDs that have been enabled at least once in the block range. Sorted from lowest to highest.
|
|
198
|
+
*/
|
|
199
|
+
getEnabledChainsInBlockRange(fromBlock: number, toBlock = Number.MAX_SAFE_INTEGER): number[] {
|
|
200
|
+
// If our fromBlock is greater than our toBlock, then we have an invalid range.
|
|
201
|
+
if (fromBlock > toBlock) {
|
|
202
|
+
throw new Error(`Invalid block range: fromBlock ${fromBlock} > toBlock ${toBlock}`);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Initiate list with all possible chains enabled at the toBlock while removing any chains
|
|
206
|
+
// that were disabled at the from block.
|
|
207
|
+
const disabledChainsAtFromBlock = this.getDisabledChainsForBlock(fromBlock);
|
|
208
|
+
const allPossibleChains = this.getChainIdIndicesForBlock(toBlock);
|
|
209
|
+
const enabledChainsInBlockRange = allPossibleChains.filter(
|
|
210
|
+
(chainId) => !disabledChainsAtFromBlock.includes(chainId)
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
// If there are any disabled chain updates in the block range, then we might need to update the list of enabled
|
|
214
|
+
// chains in the block range.
|
|
215
|
+
this.cumulativeDisabledChainUpdates
|
|
216
|
+
.filter((e) => e.blockNumber <= toBlock && e.blockNumber >= fromBlock)
|
|
217
|
+
.forEach((e) => {
|
|
218
|
+
// If disabled chain update no longer includes a previously disabled chain, then add it back to the enabled chains
|
|
219
|
+
// list.
|
|
220
|
+
const newDisabledSet = e.chainIds;
|
|
221
|
+
disabledChainsAtFromBlock.forEach((disabledChain) => {
|
|
222
|
+
// New disabled set doesn't include this chain that was previously disabled so it was re-enabled at this point
|
|
223
|
+
// in the block range.
|
|
224
|
+
if (!newDisabledSet.includes(disabledChain)) {
|
|
225
|
+
enabledChainsInBlockRange.push(disabledChain);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
// Return the enabled chains in the block range sorted in the same order as the chain indices.
|
|
230
|
+
return allPossibleChains.filter((chainId) => enabledChainsInBlockRange.includes(chainId));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
getEnabledChains(block = Number.MAX_SAFE_INTEGER): number[] {
|
|
234
|
+
// Get most recent disabled chain list before the block specified.
|
|
235
|
+
const currentlyDisabledChains = this.getDisabledChainsForBlock(block);
|
|
236
|
+
return this.getChainIdIndicesForBlock(block).filter((chainId) => !currentlyDisabledChains.includes(chainId));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
getDisabledChainsForBlock(blockNumber: number = Number.MAX_SAFE_INTEGER): number[] {
|
|
240
|
+
return (
|
|
241
|
+
sortEventsDescending(this.cumulativeDisabledChainUpdates).find((config) => config.blockNumber <= blockNumber)
|
|
242
|
+
?.chainIds ?? []
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
getConfigStoreVersionForTimestamp(timestamp: number = Number.MAX_SAFE_INTEGER): number {
|
|
247
|
+
const config = this.cumulativeConfigStoreVersionUpdates.find((config) => config.timestamp <= timestamp);
|
|
248
|
+
return isDefined(config) ? Number(config.value) : DEFAULT_CONFIG_STORE_VERSION;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
getConfigStoreVersionForBlock(blockNumber: number = Number.MAX_SAFE_INTEGER): number {
|
|
252
|
+
const config = this.cumulativeConfigStoreVersionUpdates.find((config) => config.blockNumber <= blockNumber);
|
|
253
|
+
return isDefined(config) ? Number(config.value) : DEFAULT_CONFIG_STORE_VERSION;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
hasValidConfigStoreVersionForTimestamp(timestamp: number = Number.MAX_SAFE_INTEGER): boolean {
|
|
257
|
+
const version = this.getConfigStoreVersionForTimestamp(timestamp);
|
|
258
|
+
return this.configStoreVersion >= version;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Resolve the chain ID for the ConfigStore Provider instance.
|
|
263
|
+
* @dev When the provider is a StatisJsonRpcProvider instance, the getNetwork() is non-blocking.
|
|
264
|
+
* @returns Chain ID for the ConfigStore deployment.
|
|
265
|
+
*/
|
|
266
|
+
protected async resolveChainId(): Promise<number> {
|
|
267
|
+
return this.chainId ?? (await this.configStore.provider.getNetwork()).chainId;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
protected async _update(): Promise<ConfigStoreUpdate> {
|
|
271
|
+
const chainId = await this.resolveChainId();
|
|
272
|
+
|
|
273
|
+
const searchConfig = await this.updateSearchConfig(this.configStore.provider);
|
|
274
|
+
if (isUpdateFailureReason(searchConfig)) {
|
|
275
|
+
const reason = searchConfig;
|
|
276
|
+
return { success: false, reason };
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
this.logger.debug({ at: "AcrossConfigStore", message: "Updating ConfigStore client", searchConfig });
|
|
280
|
+
|
|
281
|
+
const [updatedTokenConfigEvents, updatedGlobalConfigEvents] = await Promise.all([
|
|
282
|
+
paginatedEventQuery(this.configStore, this.configStore.filters.UpdatedTokenConfig(), searchConfig),
|
|
283
|
+
paginatedEventQuery(this.configStore, this.configStore.filters.UpdatedGlobalConfig(), searchConfig),
|
|
284
|
+
]);
|
|
285
|
+
|
|
286
|
+
// Events *should* normally be received in ascending order, but explicitly enforce the ordering.
|
|
287
|
+
[updatedTokenConfigEvents, updatedGlobalConfigEvents].forEach((events) => sortEventsAscendingInPlace(events));
|
|
288
|
+
|
|
289
|
+
const globalConfigUpdateTimes = (
|
|
290
|
+
await Promise.all(updatedGlobalConfigEvents.map((event) => this.configStore.provider.getBlock(event.blockNumber)))
|
|
291
|
+
).map((block) => block.timestamp);
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
success: true,
|
|
295
|
+
chainId,
|
|
296
|
+
searchEndBlock: searchConfig.toBlock,
|
|
297
|
+
events: {
|
|
298
|
+
updatedTokenConfigEvents,
|
|
299
|
+
updatedGlobalConfigEvents,
|
|
300
|
+
globalConfigUpdateTimes,
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
async update(): Promise<void> {
|
|
306
|
+
const result = await this._update();
|
|
307
|
+
if (!result.success) {
|
|
308
|
+
if (result.reason !== UpdateFailureReason.AlreadyUpdated) {
|
|
309
|
+
throw new Error(`Unable to update ConfigStoreClient: ${result.reason}`);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// No need to touch `this.isUpdated` because it should already be set from a previous update.
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const { chainId } = result;
|
|
316
|
+
const { updatedTokenConfigEvents, updatedGlobalConfigEvents, globalConfigUpdateTimes } = result.events;
|
|
317
|
+
assert(
|
|
318
|
+
updatedGlobalConfigEvents.length === globalConfigUpdateTimes.length,
|
|
319
|
+
`GlobalConfigUpdate events mismatch (${updatedGlobalConfigEvents.length} != ${globalConfigUpdateTimes.length})`
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
// Save new TokenConfig updates.
|
|
323
|
+
for (const event of updatedTokenConfigEvents) {
|
|
324
|
+
const args = {
|
|
325
|
+
...(spreadEventWithBlockNumber(event) as TokenConfig),
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
try {
|
|
329
|
+
const parsedValue = parseJSONWithNumericString(args.value) as ParsedTokenConfig;
|
|
330
|
+
const l1Token = args.key;
|
|
331
|
+
|
|
332
|
+
// TODO: Temporarily reformat the shape of the event that we pass into the sdk.rateModel class to make it fit
|
|
333
|
+
// the expected shape. This is a fix for now that we should eventually replace when we change the sdk.rateModel
|
|
334
|
+
// class itself to work with the generalized ConfigStore.
|
|
335
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
336
|
+
const { value, key, ...passedArgs } = args;
|
|
337
|
+
|
|
338
|
+
// Drop value and key before passing args.
|
|
339
|
+
if (parsedValue?.rateModel !== undefined) {
|
|
340
|
+
const rateModelForToken = JSON.stringify(parsedValue.rateModel);
|
|
341
|
+
this.cumulativeRateModelUpdates.push({ ...passedArgs, rateModel: rateModelForToken, l1Token });
|
|
342
|
+
|
|
343
|
+
// Store spokeTargetBalances
|
|
344
|
+
if (parsedValue?.spokeTargetBalances) {
|
|
345
|
+
// Note: cast is required because fromEntries always produces string keys, despite the function returning a
|
|
346
|
+
// numerical key.
|
|
347
|
+
const targetBalances = Object.fromEntries(
|
|
348
|
+
Object.entries(parsedValue.spokeTargetBalances).map(([chainId, targetBalance]) => {
|
|
349
|
+
const target = max(toBN(targetBalance.target), toBN(0));
|
|
350
|
+
const threshold = max(toBN(targetBalance.threshold), toBN(0));
|
|
351
|
+
return [chainId, { target, threshold }];
|
|
352
|
+
})
|
|
353
|
+
) as SpokeTargetBalanceUpdate["spokeTargetBalances"];
|
|
354
|
+
this.cumulativeSpokeTargetBalanceUpdates.push({
|
|
355
|
+
...passedArgs,
|
|
356
|
+
spokeTargetBalances: targetBalances,
|
|
357
|
+
l1Token,
|
|
358
|
+
});
|
|
359
|
+
} else {
|
|
360
|
+
this.cumulativeSpokeTargetBalanceUpdates.push({ ...passedArgs, spokeTargetBalances: {}, l1Token });
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// Store route-specific rate models
|
|
364
|
+
if (parsedValue?.routeRateModel) {
|
|
365
|
+
const routeRateModel = Object.fromEntries(
|
|
366
|
+
Object.entries(parsedValue.routeRateModel).map(([path, routeRateModel]) => {
|
|
367
|
+
return [path, JSON.stringify(routeRateModel)];
|
|
368
|
+
})
|
|
369
|
+
);
|
|
370
|
+
this.cumulativeRouteRateModelUpdates.push({ ...passedArgs, routeRateModel, l1Token });
|
|
371
|
+
} else {
|
|
372
|
+
this.cumulativeRouteRateModelUpdates.push({ ...passedArgs, routeRateModel: {}, l1Token });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
} catch (err) {
|
|
376
|
+
// @dev averageBlockTimeSeconds does not actually block.
|
|
377
|
+
const maxWarnAge = (24 * 60 * 60) / (await utils.averageBlockTimeSeconds());
|
|
378
|
+
if (result.searchEndBlock - event.blockNumber < maxWarnAge) {
|
|
379
|
+
const errMsg = isError(err) ? err.message : "unknown error";
|
|
380
|
+
this.logger.warn({
|
|
381
|
+
at: "ConfigStore::update",
|
|
382
|
+
message: `Caught error during ConfigStore update: ${errMsg}`,
|
|
383
|
+
update: args,
|
|
384
|
+
});
|
|
385
|
+
} else {
|
|
386
|
+
this.logger.debug({
|
|
387
|
+
at: "ConfigStoreClient::update",
|
|
388
|
+
message: `Skipping invalid historical update at block ${event.blockNumber}`,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
sortEventsAscendingInPlace(this.ubaConfigUpdates);
|
|
395
|
+
|
|
396
|
+
// Save new Global config updates.
|
|
397
|
+
for (let i = 0; i < updatedGlobalConfigEvents.length; i++) {
|
|
398
|
+
const event = updatedGlobalConfigEvents[i];
|
|
399
|
+
const args = {
|
|
400
|
+
blockNumber: event.blockNumber,
|
|
401
|
+
transactionIndex: event.transactionIndex,
|
|
402
|
+
logIndex: event.logIndex,
|
|
403
|
+
...spreadEvent(event.args),
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
if (args.key === utf8ToHex(GLOBAL_CONFIG_STORE_KEYS.MAX_RELAYER_REPAYMENT_LEAF_SIZE)) {
|
|
407
|
+
if (!isNaN(args.value)) {
|
|
408
|
+
this.cumulativeMaxRefundCountUpdates.push(args);
|
|
409
|
+
}
|
|
410
|
+
} else if (args.key === utf8ToHex(GLOBAL_CONFIG_STORE_KEYS.CHAIN_ID_INDICES)) {
|
|
411
|
+
try {
|
|
412
|
+
// We need to parse the chain ID indices array from the stringified JSON. However,
|
|
413
|
+
// the on-chain string has quotes around the array, which will parse our JSON as a
|
|
414
|
+
// string instead of an array. We need to remove these quotes before parsing.
|
|
415
|
+
// To be sure, we can check for single quotes, double quotes, and spaces.
|
|
416
|
+
const chainIndices = JSON.parse(args.value.replace(/['"\s]/g, ""));
|
|
417
|
+
// Check that the array is valid and that every element is a number.
|
|
418
|
+
if (!isArrayOf<number>(chainIndices, isPositiveInteger)) {
|
|
419
|
+
this.logger.warn({ at: "ConfigStore", message: `The array ${chainIndices} is invalid.` });
|
|
420
|
+
// If not a valid array, skip.
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
// Let's also check that the array doesn't contain any duplicates.
|
|
424
|
+
if (new Set(chainIndices).size !== chainIndices.length) {
|
|
425
|
+
this.logger.warn({
|
|
426
|
+
at: "ConfigStore",
|
|
427
|
+
message: `The array ${chainIndices} contains duplicates making it invalid.`,
|
|
428
|
+
});
|
|
429
|
+
// If not a valid array, skip.
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
// Now check that we're only appending positive integers to the chainIndices array on each
|
|
433
|
+
// update. If this isn't the case, skip the update & warn. If there is no previous update,
|
|
434
|
+
// resolve an implcit chain ID list.
|
|
435
|
+
const previousUpdate = this.chainIdIndicesUpdates.at(-1)?.value ?? this.implicitChainIdIndices(chainId);
|
|
436
|
+
// We should now check that previousUpdate is a subset of chainIndices.
|
|
437
|
+
if (!previousUpdate.every((chainId, idx) => chainIndices[idx] === chainId)) {
|
|
438
|
+
this.logger.warn({
|
|
439
|
+
at: "ConfigStoreClient#update",
|
|
440
|
+
message: `The array ${chainIndices} is invalid. It must be a superset of the previous array ${previousUpdate}`,
|
|
441
|
+
});
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
// If all else passes, we can add this update.
|
|
445
|
+
this.chainIdIndicesUpdates.push({ ...args, value: chainIndices });
|
|
446
|
+
} catch (e) {
|
|
447
|
+
this.logger.warn({ at: "ConfigStore::update", message: `Failed to parse chain ID indices: ${args.value}` });
|
|
448
|
+
}
|
|
449
|
+
} else if (args.key === utf8ToHex(GLOBAL_CONFIG_STORE_KEYS.MAX_POOL_REBALANCE_LEAF_SIZE)) {
|
|
450
|
+
if (!isNaN(args.value)) {
|
|
451
|
+
this.cumulativeMaxL1TokenCountUpdates.push(args);
|
|
452
|
+
}
|
|
453
|
+
} else if (args.key === utf8ToHex(GLOBAL_CONFIG_STORE_KEYS.VERSION)) {
|
|
454
|
+
// If not a number, skip.
|
|
455
|
+
if (isNaN(args.value)) {
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
const value = Number(args.value);
|
|
459
|
+
|
|
460
|
+
// If not an integer, skip.
|
|
461
|
+
if (!Number.isInteger(value)) {
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Extract the current highest version. Require that the version always increments, otherwise skip the update.
|
|
466
|
+
const lastValue = Number(this.cumulativeConfigStoreVersionUpdates[0]?.value ?? DEFAULT_CONFIG_STORE_VERSION);
|
|
467
|
+
if (value <= lastValue) {
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// Prepend the update to impose descending ordering for version updates.
|
|
472
|
+
this.cumulativeConfigStoreVersionUpdates = [
|
|
473
|
+
{ ...args, timestamp: globalConfigUpdateTimes[i] },
|
|
474
|
+
...this.cumulativeConfigStoreVersionUpdates,
|
|
475
|
+
];
|
|
476
|
+
} else if (args.key === utf8ToHex(GLOBAL_CONFIG_STORE_KEYS.DISABLED_CHAINS)) {
|
|
477
|
+
try {
|
|
478
|
+
const chainIds = this.filterDisabledChains(JSON.parse(args.value) as number[]);
|
|
479
|
+
this.cumulativeDisabledChainUpdates.push({ ...args, chainIds });
|
|
480
|
+
} catch (err) {
|
|
481
|
+
// Can't parse list, skip.
|
|
482
|
+
}
|
|
483
|
+
} else {
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
this.rateModelDictionary.updateWithEvents(this.cumulativeRateModelUpdates);
|
|
489
|
+
|
|
490
|
+
this.hasLatestConfigStoreVersion = this.hasValidConfigStoreVersionForTimestamp();
|
|
491
|
+
this.latestBlockSearched = result.searchEndBlock;
|
|
492
|
+
this.firstBlockToSearch = result.searchEndBlock + 1; // Next iteration should start off from where this one ended.
|
|
493
|
+
this.eventSearchConfig.toBlock = undefined; // Caller can re-set on subsequent updates if necessary
|
|
494
|
+
this.chainId = this.chainId ?? chainId; // Update on the first run only.
|
|
495
|
+
this.isUpdated = true;
|
|
496
|
+
|
|
497
|
+
this.logger.debug({ at: "ConfigStore", message: "ConfigStore client updated!" });
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
filterDisabledChains(disabledChains: number[]): number[] {
|
|
501
|
+
// If any chain ID's are not integers then ignore. UMIP-157 requires that this key cannot include
|
|
502
|
+
// the chain ID 1.
|
|
503
|
+
return disabledChains.filter((chainId: number) => !isNaN(chainId) && Number.isInteger(chainId) && chainId !== 1);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Retrieves the most recently set UBA config for a given L1 token address before a block number.
|
|
508
|
+
* @param l1TokenAddress The L1 token address to retrieve the config for
|
|
509
|
+
* @param blockNumber The block number to retrieve the config for. If not specified, sets block to max integer
|
|
510
|
+
* meaning that this function will return the latest config.
|
|
511
|
+
* @returns The UBA config for the given L1 token address and block number, or undefined if no config exists
|
|
512
|
+
* before blockNumber.
|
|
513
|
+
*/
|
|
514
|
+
public getUBAConfig(l1TokenAddress: string, blockNumber = Number.MAX_SAFE_INTEGER): UBAParsedConfigType | undefined {
|
|
515
|
+
// We only care about searching on the block number and not any events that occurred in the same block
|
|
516
|
+
// but with a lower transaction index. In other words, if the UBA config was updated as the absolute
|
|
517
|
+
// last transaction in a block, the update still applies to all preceding UBA events in the same block.
|
|
518
|
+
// This is a simplifying assumption that we can make because the ConfigStore admin role is whitelisted and assumed
|
|
519
|
+
// to be acting in the best interest of the protocol.
|
|
520
|
+
const config = findLast(
|
|
521
|
+
this.ubaConfigUpdates,
|
|
522
|
+
(config) => config.l1Token === l1TokenAddress && config.blockNumber <= blockNumber
|
|
523
|
+
);
|
|
524
|
+
return config?.config;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AcrossConfigStoreClient";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { providers } from "ethers";
|
|
2
|
+
import { CachingMechanismInterface } from "../interfaces";
|
|
3
|
+
import { EventSearchConfig, isDefined, MakeOptional } from "../utils";
|
|
4
|
+
|
|
5
|
+
export enum UpdateFailureReason {
|
|
6
|
+
AlreadyUpdated,
|
|
7
|
+
BadRequest,
|
|
8
|
+
RPCError,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isUpdateFailureReason(x: EventSearchConfig | UpdateFailureReason): x is UpdateFailureReason {
|
|
12
|
+
return Number.isInteger(x);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Base class for all clients to extend.
|
|
17
|
+
*/
|
|
18
|
+
export abstract class BaseAbstractClient {
|
|
19
|
+
protected _isUpdated: boolean;
|
|
20
|
+
public firstBlockToSearch = 0;
|
|
21
|
+
public latestBlockSearched = 0;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new client.
|
|
25
|
+
* @param cachingMechanism The caching mechanism to use for this client. If not provided, the client will not rely on an external cache.
|
|
26
|
+
*/
|
|
27
|
+
constructor(
|
|
28
|
+
readonly eventSearchConfig: MakeOptional<EventSearchConfig, "toBlock"> = { fromBlock: 0, maxBlockLookBack: 0 },
|
|
29
|
+
protected cachingMechanism?: CachingMechanismInterface
|
|
30
|
+
) {
|
|
31
|
+
this._isUpdated = false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Indicates whether the client has been updated since it was created.
|
|
36
|
+
* @returns Whether the client has been updated since it was created.
|
|
37
|
+
*/
|
|
38
|
+
public get isUpdated(): boolean {
|
|
39
|
+
return this._isUpdated;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Sets whether the client has been updated since it was created.
|
|
44
|
+
* @param value Whether the client has been updated since it was created.
|
|
45
|
+
* @throws Error if the client has already been updated and the value is false.
|
|
46
|
+
*/
|
|
47
|
+
public set isUpdated(value: boolean) {
|
|
48
|
+
if (this._isUpdated === true && !value) {
|
|
49
|
+
throw new Error("Cannot set isUpdated to false once it is true");
|
|
50
|
+
}
|
|
51
|
+
this._isUpdated = value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Validates and updates the stored EventSearchConfig in advance of an update() call.
|
|
56
|
+
* Use isEventSearchConfig() to discriminate the result.
|
|
57
|
+
* @provider Ethers RPC provider instance.
|
|
58
|
+
* @returns An EventSearchConfig instance if valid, otherwise an UpdateFailureReason.
|
|
59
|
+
*/
|
|
60
|
+
public async updateSearchConfig(provider: providers.Provider): Promise<EventSearchConfig | UpdateFailureReason> {
|
|
61
|
+
const fromBlock = this.firstBlockToSearch;
|
|
62
|
+
let { toBlock } = this.eventSearchConfig;
|
|
63
|
+
if (isDefined(toBlock)) {
|
|
64
|
+
if (fromBlock > toBlock) {
|
|
65
|
+
throw new Error(`Invalid event search config fromBlock (${fromBlock}) > toBlock (${toBlock})`);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
toBlock = await provider.getBlockNumber();
|
|
69
|
+
if (toBlock < fromBlock) {
|
|
70
|
+
return UpdateFailureReason.AlreadyUpdated;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const { maxBlockLookBack } = this.eventSearchConfig;
|
|
75
|
+
return { fromBlock, toBlock, maxBlockLookBack };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Asserts that the client has been updated.
|
|
80
|
+
*/
|
|
81
|
+
protected assertUpdated(): void {
|
|
82
|
+
if (!this.isUpdated) {
|
|
83
|
+
throw new Error("Client not updated");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Determines if the client has an external cache.
|
|
89
|
+
* @returns Whether the client has an external cache.
|
|
90
|
+
*/
|
|
91
|
+
protected hasCachingMechanism(): boolean {
|
|
92
|
+
return isDefined(this.cachingMechanism);
|
|
93
|
+
}
|
|
94
|
+
}
|