@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,894 @@
|
|
|
1
|
+
import { BigNumber, Contract, Event, EventFilter } from "ethers";
|
|
2
|
+
import winston from "winston";
|
|
3
|
+
import {
|
|
4
|
+
AnyObject,
|
|
5
|
+
bnZero,
|
|
6
|
+
DefaultLogLevels,
|
|
7
|
+
EventSearchConfig,
|
|
8
|
+
MAX_BIG_INT,
|
|
9
|
+
MakeOptional,
|
|
10
|
+
assign,
|
|
11
|
+
getRelayDataHash,
|
|
12
|
+
isDefined,
|
|
13
|
+
toBN,
|
|
14
|
+
} from "../utils";
|
|
15
|
+
import {
|
|
16
|
+
paginatedEventQuery,
|
|
17
|
+
sortEventsAscendingInPlace,
|
|
18
|
+
spreadEvent,
|
|
19
|
+
spreadEventWithBlockNumber,
|
|
20
|
+
} from "../utils/EventUtils";
|
|
21
|
+
import { validateFillForDeposit } from "../utils/FlowUtils";
|
|
22
|
+
|
|
23
|
+
import { ZERO_ADDRESS } from "../constants";
|
|
24
|
+
import {
|
|
25
|
+
Deposit,
|
|
26
|
+
DepositWithBlock,
|
|
27
|
+
Fill,
|
|
28
|
+
FillWithBlock,
|
|
29
|
+
FilledV3RelayEvent,
|
|
30
|
+
RealizedLpFee,
|
|
31
|
+
RelayData,
|
|
32
|
+
RelayerRefundExecutionWithBlock,
|
|
33
|
+
RootBundleRelayWithBlock,
|
|
34
|
+
SlowFillRequestWithBlock,
|
|
35
|
+
SpeedUp,
|
|
36
|
+
TokensBridged,
|
|
37
|
+
V3FundsDepositedEvent,
|
|
38
|
+
} from "../interfaces";
|
|
39
|
+
import { SpokePool } from "../typechain";
|
|
40
|
+
import { chainIsCCTPEnabled, getNetworkName } from "../utils/NetworkUtils";
|
|
41
|
+
import { getBlockRangeForDepositId, getDepositIdAtBlock } from "../utils/SpokeUtils";
|
|
42
|
+
import { BaseAbstractClient, isUpdateFailureReason, UpdateFailureReason } from "./BaseAbstractClient";
|
|
43
|
+
import { HubPoolClient } from "./HubPoolClient";
|
|
44
|
+
|
|
45
|
+
type SpokePoolUpdateSuccess = {
|
|
46
|
+
success: true;
|
|
47
|
+
currentTime: number;
|
|
48
|
+
oldestTime: number;
|
|
49
|
+
firstDepositId: number;
|
|
50
|
+
latestDepositId: number;
|
|
51
|
+
events: Event[][];
|
|
52
|
+
searchEndBlock: number;
|
|
53
|
+
hasCCTPBridgingEnabled: boolean;
|
|
54
|
+
};
|
|
55
|
+
type SpokePoolUpdateFailure = {
|
|
56
|
+
success: false;
|
|
57
|
+
reason: UpdateFailureReason;
|
|
58
|
+
};
|
|
59
|
+
export type SpokePoolUpdate = SpokePoolUpdateSuccess | SpokePoolUpdateFailure;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* SpokePoolClient is a client for the SpokePool contract. It is responsible for querying the SpokePool contract
|
|
63
|
+
* for events and storing them in memory. It also provides some convenience methods for querying the stored events.
|
|
64
|
+
*/
|
|
65
|
+
export class SpokePoolClient extends BaseAbstractClient {
|
|
66
|
+
protected currentTime = 0;
|
|
67
|
+
protected oldestTime = 0;
|
|
68
|
+
protected depositHashes: { [depositHash: string]: DepositWithBlock } = {};
|
|
69
|
+
protected depositHashesToFills: { [depositHash: string]: FillWithBlock[] } = {};
|
|
70
|
+
protected speedUps: { [depositorAddress: string]: { [depositId: number]: SpeedUp[] } } = {};
|
|
71
|
+
protected slowFillRequests: { [relayDataHash: string]: SlowFillRequestWithBlock } = {};
|
|
72
|
+
protected depositRoutes: { [originToken: string]: { [DestinationChainId: number]: boolean } } = {};
|
|
73
|
+
protected tokensBridged: TokensBridged[] = [];
|
|
74
|
+
protected rootBundleRelays: RootBundleRelayWithBlock[] = [];
|
|
75
|
+
protected relayerRefundExecutions: RelayerRefundExecutionWithBlock[] = [];
|
|
76
|
+
protected queryableEventNames: string[] = [];
|
|
77
|
+
protected hasCCTPBridgingEnabled: boolean = false;
|
|
78
|
+
public earliestDepositIdQueried = Number.MAX_SAFE_INTEGER;
|
|
79
|
+
public latestDepositIdQueried = 0;
|
|
80
|
+
public firstDepositIdForSpokePool = Number.MAX_SAFE_INTEGER;
|
|
81
|
+
public lastDepositIdForSpokePool = Number.MAX_SAFE_INTEGER;
|
|
82
|
+
public fills: { [OriginChainId: number]: FillWithBlock[] } = {};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new SpokePoolClient.
|
|
86
|
+
* @param logger A logger instance.
|
|
87
|
+
* @param spokePool The SpokePool contract instance that this client will query.
|
|
88
|
+
* @param hubPoolClient An optional HubPoolClient instance. This is used to fetch spoke data that is not stored on the SpokePool contract but is stored on the HubPool contract.
|
|
89
|
+
* @param chainId The chain ID of the chain that this client is querying.
|
|
90
|
+
* @param deploymentBlock The block number that the SpokePool contract was deployed at.
|
|
91
|
+
* @param eventSearchConfig An optional EventSearchConfig object that controls how far back in history the client will search for events. If not provided, the client will only search for events from the deployment block.
|
|
92
|
+
*/
|
|
93
|
+
constructor(
|
|
94
|
+
readonly logger: winston.Logger,
|
|
95
|
+
readonly spokePool: Contract,
|
|
96
|
+
// Can be excluded. This disables some deposit validation.
|
|
97
|
+
readonly hubPoolClient: HubPoolClient | null,
|
|
98
|
+
readonly chainId: number,
|
|
99
|
+
public deploymentBlock: number,
|
|
100
|
+
eventSearchConfig: MakeOptional<EventSearchConfig, "toBlock"> = { fromBlock: 0, maxBlockLookBack: 0 }
|
|
101
|
+
) {
|
|
102
|
+
super(eventSearchConfig);
|
|
103
|
+
this.firstBlockToSearch = eventSearchConfig.fromBlock;
|
|
104
|
+
this.latestBlockSearched = 0;
|
|
105
|
+
this.queryableEventNames = Object.keys(this._queryableEventNames());
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public _queryableEventNames(): { [eventName: string]: EventFilter } {
|
|
109
|
+
const knownEventNames = [
|
|
110
|
+
"EnabledDepositRoute",
|
|
111
|
+
"TokensBridged",
|
|
112
|
+
"RelayedRootBundle",
|
|
113
|
+
"ExecutedRelayerRefundRoot",
|
|
114
|
+
"V3FundsDeposited",
|
|
115
|
+
"RequestedSpeedUpV3Deposit",
|
|
116
|
+
"RequestedV3SlowFill",
|
|
117
|
+
"FilledV3Relay",
|
|
118
|
+
];
|
|
119
|
+
return Object.fromEntries(
|
|
120
|
+
this.spokePool.interface.fragments
|
|
121
|
+
.filter(({ name, type }) => type === "event" && knownEventNames.includes(name))
|
|
122
|
+
.map(({ name }) => [name, this.spokePool.filters[name]()])
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Retrieves a list of deposits from the SpokePool contract destined for the given destination chain ID.
|
|
128
|
+
* @param destinationChainId The destination chain ID.
|
|
129
|
+
* @returns A list of deposits.
|
|
130
|
+
*/
|
|
131
|
+
public getDepositsForDestinationChain(destinationChainId: number): DepositWithBlock[] {
|
|
132
|
+
return Object.values(this.depositHashes).filter((deposit) => deposit.destinationChainId === destinationChainId);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Retrieves a list of deposits from the SpokePool contract that are associated with this spoke pool.
|
|
137
|
+
* @returns A list of deposits.
|
|
138
|
+
* @note This method returns all deposits, regardless of destination chain ID in sorted order.
|
|
139
|
+
*/
|
|
140
|
+
public getDeposits(filter?: { fromBlock: number; toBlock: number }): DepositWithBlock[] {
|
|
141
|
+
let deposits = Object.values(this.depositHashes);
|
|
142
|
+
if (isDefined(filter)) {
|
|
143
|
+
const { fromBlock, toBlock } = filter;
|
|
144
|
+
deposits = deposits.filter(({ blockNumber }) => blockNumber >= fromBlock && toBlock >= blockNumber);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return sortEventsAscendingInPlace(deposits);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Retrieves a list of the tokens that have been bridged.
|
|
152
|
+
* @returns A list of tokens.
|
|
153
|
+
*/
|
|
154
|
+
public getTokensBridged(): TokensBridged[] {
|
|
155
|
+
return this.tokensBridged;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Certain spoke pools can bridge USDC back to the hub via CCTP. Of these spokes, not all
|
|
160
|
+
* have this feature enabled.
|
|
161
|
+
* @returns Whether or not this spoke pool is capable of bridging USDC via CCTP back to the hub
|
|
162
|
+
*/
|
|
163
|
+
public isCCTPBridgingEnabled(): boolean {
|
|
164
|
+
return this.hasCCTPBridgingEnabled;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Retrieves a mapping of tokens and their associated destination chain IDs that can be bridged.
|
|
169
|
+
* @returns A mapping of tokens and their associated destination chain IDs in a nested mapping.
|
|
170
|
+
*/
|
|
171
|
+
public getDepositRoutes(): { [originToken: string]: { [DestinationChainId: number]: boolean } } {
|
|
172
|
+
return this.depositRoutes;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Determines whether a deposit route is enabled for the given origin token and destination chain ID.
|
|
177
|
+
* @param originToken The origin token address.
|
|
178
|
+
* @param destinationChainId The destination chain ID.
|
|
179
|
+
* @returns True if the deposit route is enabled, false otherwise.
|
|
180
|
+
*/
|
|
181
|
+
public isDepositRouteEnabled(originToken: string, destinationChainId: number): boolean {
|
|
182
|
+
return this.depositRoutes[originToken]?.[destinationChainId] ?? false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Retrieves a list of all the available origin tokens that can be bridged.
|
|
187
|
+
* @returns A list of origin tokens.
|
|
188
|
+
*/
|
|
189
|
+
public getAllOriginTokens(): string[] {
|
|
190
|
+
return Object.keys(this.depositRoutes);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Retrieves a list of fills from the SpokePool contract.
|
|
195
|
+
* @returns A list of fills.
|
|
196
|
+
*/
|
|
197
|
+
public getFills(): FillWithBlock[] {
|
|
198
|
+
return sortEventsAscendingInPlace(Object.values(this.fills).flat());
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Retrieves a list of fills from a specific origin chain ID.
|
|
203
|
+
* @param originChainId The origin chain ID.
|
|
204
|
+
* @returns A list of fills.
|
|
205
|
+
*/
|
|
206
|
+
public getFillsForOriginChain(originChainId: number): FillWithBlock[] {
|
|
207
|
+
return this.fills[originChainId] || [];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Retrieves a list of fills from a specific relayer address.
|
|
212
|
+
* @param relayer The relayer address.
|
|
213
|
+
* @returns A list of fills.
|
|
214
|
+
*/
|
|
215
|
+
public getFillsForRelayer(relayer: string): FillWithBlock[] {
|
|
216
|
+
return this.getFills().filter((fill) => fill.relayer === relayer);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Retrieves a list of fills from a given block range.
|
|
221
|
+
* @param startingBlock The starting block number.
|
|
222
|
+
* @param endingBlock The ending block number.
|
|
223
|
+
* @returns A list of fills.
|
|
224
|
+
*/
|
|
225
|
+
public getFillsWithBlockInRange(startingBlock: number, endingBlock: number): FillWithBlock[] {
|
|
226
|
+
return this.getFills().filter((fill) => fill.blockNumber >= startingBlock && fill.blockNumber <= endingBlock);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Retrieves a list of root bundle relays from the SpokePool contract.
|
|
231
|
+
* @returns A list of root bundle relays.
|
|
232
|
+
*/
|
|
233
|
+
public getRootBundleRelays(): RootBundleRelayWithBlock[] {
|
|
234
|
+
return this.rootBundleRelays;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Retrieves the ID of the latest root bundle.
|
|
239
|
+
* @returns The ID of the latest root bundle. This will be 0 if no root bundles have been relayed.
|
|
240
|
+
*/
|
|
241
|
+
public getLatestRootBundleId(): number {
|
|
242
|
+
return this.rootBundleRelays.length > 0
|
|
243
|
+
? this.rootBundleRelays[this.rootBundleRelays.length - 1]?.rootBundleId + 1
|
|
244
|
+
: 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Retrieves a list of relayer refund executions from the SpokePool contract.
|
|
249
|
+
* @returns A list of relayer refund executions.
|
|
250
|
+
*/
|
|
251
|
+
public getRelayerRefundExecutions(): RelayerRefundExecutionWithBlock[] {
|
|
252
|
+
return this.relayerRefundExecutions;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Appends a speed up signature to a specific deposit.
|
|
257
|
+
* @param deposit The deposit to append the speed up signature to.
|
|
258
|
+
* @returns A new deposit instance with the speed up signature appended to the deposit.
|
|
259
|
+
*/
|
|
260
|
+
public appendMaxSpeedUpSignatureToDeposit(deposit: DepositWithBlock): DepositWithBlock {
|
|
261
|
+
const { depositId, depositor } = deposit;
|
|
262
|
+
const speedups = this.speedUps[depositor]?.[depositId];
|
|
263
|
+
if (!isDefined(speedups) || speedups.length === 0) {
|
|
264
|
+
return deposit;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const maxSpeedUp = speedups.reduce((prev, current) =>
|
|
268
|
+
prev.updatedOutputAmount.lt(current.updatedOutputAmount) ? prev : current
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
// We assume that the depositor authorises SpeedUps in isolation of each other, which keeps the relayer
|
|
272
|
+
// logic simple: find the SpeedUp with the lowest updatedOutputAmount, and use all of its fields.
|
|
273
|
+
if (maxSpeedUp.updatedOutputAmount.gte(deposit.outputAmount)) {
|
|
274
|
+
return deposit;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Return deposit with updated params from the speedup with the lowest updated output amount.
|
|
278
|
+
const updatedDeposit = {
|
|
279
|
+
...deposit,
|
|
280
|
+
speedUpSignature: maxSpeedUp.depositorSignature,
|
|
281
|
+
updatedOutputAmount: maxSpeedUp.updatedOutputAmount,
|
|
282
|
+
updatedRecipient: maxSpeedUp.updatedRecipient,
|
|
283
|
+
updatedMessage: maxSpeedUp.updatedMessage,
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
return updatedDeposit;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Find a deposit based on its deposit ID.
|
|
291
|
+
* @notice If evaluating a fill, be sure to verify it against the resulting deposit.
|
|
292
|
+
* @param depositId The unique ID of the deposit being queried.
|
|
293
|
+
* @returns The corresponding deposit if found, undefined otherwise.
|
|
294
|
+
*/
|
|
295
|
+
public getDeposit(depositId: number): DepositWithBlock | undefined {
|
|
296
|
+
const depositHash = this.getDepositHash({ depositId, originChainId: this.chainId });
|
|
297
|
+
return this.depositHashes[depositHash];
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Find a SlowFillRequested event based on its deposit RelayData.
|
|
302
|
+
* @param relayData RelayData field for the SlowFill request.
|
|
303
|
+
* @returns The corresponding SlowFIllRequest event if found, otherwise undefined.
|
|
304
|
+
*/
|
|
305
|
+
public getSlowFillRequest(relayData: RelayData): SlowFillRequestWithBlock | undefined {
|
|
306
|
+
const hash = getRelayDataHash(relayData, this.chainId);
|
|
307
|
+
return this.slowFillRequests[hash];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Retrieves a list of slow fill requests for deposits from a specific origin chain ID.
|
|
312
|
+
* @param originChainId The origin chain ID.
|
|
313
|
+
* @returns A list of slow fill requests.
|
|
314
|
+
*/
|
|
315
|
+
public getSlowFillRequestsForOriginChain(originChainId: number): SlowFillRequestWithBlock[] {
|
|
316
|
+
return Object.values(this.slowFillRequests).filter(
|
|
317
|
+
(e: SlowFillRequestWithBlock) => e.originChainId === originChainId
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Find a corresponding deposit for a given fill.
|
|
323
|
+
* @param fill The fill to find a corresponding deposit for.
|
|
324
|
+
* @returns The corresponding deposit if found, undefined otherwise.
|
|
325
|
+
*/
|
|
326
|
+
public getDepositForFill(fill: Fill): DepositWithBlock | undefined {
|
|
327
|
+
const depositWithMatchingDepositId = this.depositHashes[this.getDepositHash(fill)];
|
|
328
|
+
return validateFillForDeposit(fill, depositWithMatchingDepositId) ? depositWithMatchingDepositId : undefined;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Find the unfilled amount for a given deposit. This is the full deposit amount minus the total filled amount.
|
|
333
|
+
* @param deposit The deposit to find the unfilled amount for.
|
|
334
|
+
* @param fillCount The number of fills that have been applied to this deposit.
|
|
335
|
+
* @param invalidFills The invalid fills that have been applied to this deposit.
|
|
336
|
+
* @returns The unfilled amount.
|
|
337
|
+
*/
|
|
338
|
+
public getValidUnfilledAmountForDeposit(deposit: Deposit): {
|
|
339
|
+
unfilledAmount: BigNumber;
|
|
340
|
+
fillCount: number;
|
|
341
|
+
invalidFills: Fill[];
|
|
342
|
+
} {
|
|
343
|
+
const { outputAmount } = deposit;
|
|
344
|
+
const fillsForDeposit = this.depositHashesToFills[this.getDepositHash(deposit)];
|
|
345
|
+
// If no fills then the full amount is remaining.
|
|
346
|
+
if (fillsForDeposit === undefined || fillsForDeposit.length === 0) {
|
|
347
|
+
return { unfilledAmount: toBN(outputAmount), fillCount: 0, invalidFills: [] };
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const { validFills, invalidFills } = fillsForDeposit.reduce(
|
|
351
|
+
(groupedFills: { validFills: Fill[]; invalidFills: Fill[] }, fill: Fill) => {
|
|
352
|
+
if (validateFillForDeposit(fill, deposit)) {
|
|
353
|
+
groupedFills.validFills.push(fill);
|
|
354
|
+
} else {
|
|
355
|
+
groupedFills.invalidFills.push(fill);
|
|
356
|
+
}
|
|
357
|
+
return groupedFills;
|
|
358
|
+
},
|
|
359
|
+
{ validFills: [], invalidFills: [] }
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
// Log any invalid deposits with same deposit id but different params.
|
|
363
|
+
const invalidFillsForDeposit = invalidFills.filter((x) => x.depositId === deposit.depositId);
|
|
364
|
+
if (invalidFillsForDeposit.length > 0) {
|
|
365
|
+
this.logger.warn({
|
|
366
|
+
at: "SpokePoolClient",
|
|
367
|
+
chainId: this.chainId,
|
|
368
|
+
message: "Invalid fills found matching deposit ID",
|
|
369
|
+
deposit,
|
|
370
|
+
invalidFills: Object.fromEntries(invalidFillsForDeposit.map((x) => [x.relayer, x])),
|
|
371
|
+
notificationPath: "across-invalid-fills",
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// If all fills are invalid we can consider this unfilled.
|
|
376
|
+
if (validFills.length === 0) {
|
|
377
|
+
return { unfilledAmount: toBN(outputAmount), fillCount: 0, invalidFills };
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return {
|
|
381
|
+
unfilledAmount: bnZero,
|
|
382
|
+
fillCount: validFills.length,
|
|
383
|
+
invalidFills,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Formulate a hash for a given deposit or fill
|
|
389
|
+
* @param event The deposit or fill to formulate a hash for.
|
|
390
|
+
* @returns The hash.
|
|
391
|
+
* @note This hash is used to match deposits and fills together.
|
|
392
|
+
* @note This hash takes the form of: `${depositId}-${originChainId}`.
|
|
393
|
+
*/
|
|
394
|
+
public getDepositHash(event: { depositId: number; originChainId: number }): string {
|
|
395
|
+
return `${event.depositId}-${event.originChainId}`;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Find the block range that contains the deposit ID. This is a binary search that searches for the block range
|
|
400
|
+
* that contains the deposit ID.
|
|
401
|
+
* @param targetDepositId The target deposit ID to search for.
|
|
402
|
+
* @param initLow The initial lower bound of the block range to search.
|
|
403
|
+
* @param initHigh The initial upper bound of the block range to search.
|
|
404
|
+
* @param maxSearches The maximum number of searches to perform. This is used to prevent infinite loops.
|
|
405
|
+
* @returns The block range that contains the deposit ID.
|
|
406
|
+
* @note // We want to find the block range that satisfies these conditions:
|
|
407
|
+
* // - the low block has deposit count <= targetDepositId
|
|
408
|
+
* // - the high block has a deposit count > targetDepositId.
|
|
409
|
+
* // This way the caller can search for a FundsDeposited event between [low, high] that will always
|
|
410
|
+
* // contain the event emitted when deposit ID was incremented to targetDepositId + 1. This is the same transaction
|
|
411
|
+
* // where the deposit with deposit ID = targetDepositId was created.
|
|
412
|
+
*/
|
|
413
|
+
public _getBlockRangeForDepositId(
|
|
414
|
+
targetDepositId: number,
|
|
415
|
+
initLow: number,
|
|
416
|
+
initHigh: number,
|
|
417
|
+
maxSearches: number
|
|
418
|
+
): Promise<{
|
|
419
|
+
low: number;
|
|
420
|
+
high: number;
|
|
421
|
+
}> {
|
|
422
|
+
return getBlockRangeForDepositId(targetDepositId, initLow, initHigh, maxSearches, this);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Finds the deposit id at a specific block number.
|
|
427
|
+
* @param blockTag The block number to search for the deposit ID at.
|
|
428
|
+
* @returns The deposit ID.
|
|
429
|
+
*/
|
|
430
|
+
public _getDepositIdAtBlock(blockTag: number): Promise<number> {
|
|
431
|
+
return getDepositIdAtBlock(this.spokePool as SpokePool, blockTag);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* @notice Return maximum of fill deadline buffer at start and end of block range. This is a contract
|
|
436
|
+
* immutable state variable so we can't query other events to find its updates.
|
|
437
|
+
* @dev V3 deposits have a fill deadline which can be set to a maximum of fillDeadlineBuffer + deposit.block.timestamp.
|
|
438
|
+
* Therefore, we cannot evaluate a block range for expired deposits if the spoke pool client doesn't return us
|
|
439
|
+
* deposits whose block.timestamp is within fillDeadlineBuffer of the end block time. As a conservative check,
|
|
440
|
+
* we verify that the time between the end block timestamp and the first timestamp queried by the
|
|
441
|
+
* spoke pool client is greater than the maximum of the fill deadline buffers at the start and end of the block
|
|
442
|
+
* range. We assume the fill deadline buffer wasn't changed more than once within a bundle.
|
|
443
|
+
* @param startBlock start block
|
|
444
|
+
* @param endBlock end block
|
|
445
|
+
* @returns maximum of fill deadline buffer at start and end block
|
|
446
|
+
*/
|
|
447
|
+
public async getMaxFillDeadlineInRange(startBlock: number, endBlock: number): Promise<number> {
|
|
448
|
+
const fillDeadlineBuffers: number[] = await Promise.all([
|
|
449
|
+
this.spokePool.fillDeadlineBuffer({ blockTag: startBlock }),
|
|
450
|
+
this.spokePool.fillDeadlineBuffer({ blockTag: endBlock }),
|
|
451
|
+
]);
|
|
452
|
+
return Math.max(fillDeadlineBuffers[0], fillDeadlineBuffers[1]);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Performs an update to refresh the state of this client. This will query the SpokePool contract for new events
|
|
457
|
+
* and store them in memory. This method is the primary method for updating the state of this client.
|
|
458
|
+
* @param eventsToQuery An optional list of events to query. If not provided, all events will be queried.
|
|
459
|
+
* @returns A Promise that resolves to a SpokePoolUpdate object.
|
|
460
|
+
*/
|
|
461
|
+
protected async _update(eventsToQuery: string[]): Promise<SpokePoolUpdate> {
|
|
462
|
+
// Find the earliest known depositId. This assumes no deposits were placed in the deployment block.
|
|
463
|
+
let firstDepositId: number = this.firstDepositIdForSpokePool;
|
|
464
|
+
if (firstDepositId === Number.MAX_SAFE_INTEGER) {
|
|
465
|
+
firstDepositId = await this.spokePool.numberOfDeposits({ blockTag: this.deploymentBlock });
|
|
466
|
+
if (isNaN(firstDepositId) || firstDepositId < 0) {
|
|
467
|
+
throw new Error(`SpokePoolClient::update: Invalid first deposit id (${firstDepositId})`);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const searchConfig = await this.updateSearchConfig(this.spokePool.provider);
|
|
472
|
+
if (isUpdateFailureReason(searchConfig)) {
|
|
473
|
+
const reason = searchConfig;
|
|
474
|
+
return { success: false, reason };
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Determine if this spoke pool has the capability to bridge UDSC via the CCTP token bridge.
|
|
478
|
+
// The CCTP bridge is canonically disabled if the `cctpTokenMessenger` is the ZERO address.
|
|
479
|
+
let hasCCTPBridgingEnabled = false;
|
|
480
|
+
if (chainIsCCTPEnabled(this.chainId) && isDefined(this.spokePool.cctpTokenMessenger)) {
|
|
481
|
+
const cctpBridgeAddress = String(
|
|
482
|
+
await this.spokePool.cctpTokenMessenger({
|
|
483
|
+
blockTag: searchConfig.toBlock,
|
|
484
|
+
})
|
|
485
|
+
);
|
|
486
|
+
hasCCTPBridgingEnabled = cctpBridgeAddress.toLowerCase() !== ZERO_ADDRESS.toLowerCase();
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
const eventSearchConfigs = eventsToQuery.map((eventName) => {
|
|
490
|
+
if (!this.queryableEventNames.includes(eventName)) {
|
|
491
|
+
throw new Error(`SpokePoolClient: Cannot query unrecognised SpokePool event name: ${eventName}`);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const _searchConfig = { ...searchConfig }; // shallow copy
|
|
495
|
+
|
|
496
|
+
// By default, an event's query range is controlled by the `eventSearchConfig` passed in during instantiation.
|
|
497
|
+
// However, certain events have special overriding requirements to their search ranges:
|
|
498
|
+
// - EnabledDepositRoute: The full history is always required, so override the requested fromBlock.
|
|
499
|
+
if (eventName === "EnabledDepositRoute" && !this.isUpdated) {
|
|
500
|
+
_searchConfig.fromBlock = this.deploymentBlock;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
return {
|
|
504
|
+
filter: this._queryableEventNames()[eventName],
|
|
505
|
+
searchConfig: _searchConfig,
|
|
506
|
+
};
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
this.log("debug", `Updating SpokePool client for chain ${this.chainId}`, {
|
|
510
|
+
eventsToQuery,
|
|
511
|
+
searchConfig,
|
|
512
|
+
spokePool: this.spokePool.address,
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
const timerStart = Date.now();
|
|
516
|
+
const [numberOfDeposits, currentTime, oldestTime, ...events] = await Promise.all([
|
|
517
|
+
this.spokePool.numberOfDeposits({ blockTag: searchConfig.toBlock }),
|
|
518
|
+
this.spokePool.getCurrentTime({ blockTag: searchConfig.toBlock }),
|
|
519
|
+
this.spokePool.getCurrentTime({ blockTag: Math.max(searchConfig.fromBlock, this.deploymentBlock) }),
|
|
520
|
+
...eventSearchConfigs.map((config) => paginatedEventQuery(this.spokePool, config.filter, config.searchConfig)),
|
|
521
|
+
]);
|
|
522
|
+
this.log("debug", `Time to query new events from RPC for ${this.chainId}: ${Date.now() - timerStart} ms`);
|
|
523
|
+
|
|
524
|
+
if (!BigNumber.isBigNumber(currentTime) || currentTime.lt(this.currentTime)) {
|
|
525
|
+
const errMsg = BigNumber.isBigNumber(currentTime)
|
|
526
|
+
? `currentTime: ${currentTime} < ${toBN(this.currentTime)}`
|
|
527
|
+
: `currentTime is not a BigNumber: ${JSON.stringify(currentTime)}`;
|
|
528
|
+
throw new Error(`SpokePoolClient::update: ${errMsg}`);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Sort all events to ensure they are stored in a consistent order.
|
|
532
|
+
events.forEach((events: Event[]) => sortEventsAscendingInPlace(events));
|
|
533
|
+
|
|
534
|
+
return {
|
|
535
|
+
success: true,
|
|
536
|
+
currentTime: currentTime.toNumber(), // uint32
|
|
537
|
+
oldestTime: oldestTime.toNumber(),
|
|
538
|
+
firstDepositId,
|
|
539
|
+
latestDepositId: Math.max(numberOfDeposits - 1, 0),
|
|
540
|
+
searchEndBlock: searchConfig.toBlock,
|
|
541
|
+
events,
|
|
542
|
+
hasCCTPBridgingEnabled,
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* A wrapper over the `_update` method that handles errors and logs. This method additionally calls into the
|
|
548
|
+
* HubPoolClient to update the state of this client with data from the HubPool contract.
|
|
549
|
+
* @param eventsToQuery An optional list of events to query. If not provided, all events will be queried.
|
|
550
|
+
* @returns A Promise that resolves to a SpokePoolUpdate object.
|
|
551
|
+
* @note This method is the primary method for updating the state of this client externally.
|
|
552
|
+
* @see _update
|
|
553
|
+
*/
|
|
554
|
+
public async update(eventsToQuery = this.queryableEventNames): Promise<void> {
|
|
555
|
+
if (this.hubPoolClient !== null && !this.hubPoolClient.isUpdated) {
|
|
556
|
+
throw new Error("HubPoolClient not updated");
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
const update = await this._update(eventsToQuery);
|
|
560
|
+
if (!update.success) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
const { events: queryResults, currentTime, oldestTime, searchEndBlock } = update;
|
|
564
|
+
|
|
565
|
+
if (eventsToQuery.includes("TokensBridged")) {
|
|
566
|
+
for (const event of queryResults[eventsToQuery.indexOf("TokensBridged")]) {
|
|
567
|
+
this.tokensBridged.push(spreadEventWithBlockNumber(event) as TokensBridged);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
if (eventsToQuery.includes("V3FundsDeposited")) {
|
|
572
|
+
const depositEvents = [
|
|
573
|
+
...((queryResults[eventsToQuery.indexOf("V3FundsDeposited")] ?? []) as V3FundsDepositedEvent[]),
|
|
574
|
+
];
|
|
575
|
+
if (depositEvents.length > 0) {
|
|
576
|
+
this.log("debug", `Using ${depositEvents.length} newly queried deposit events for chain ${this.chainId}`, {
|
|
577
|
+
earliestEvent: depositEvents[0].blockNumber,
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const dataForQuoteTime = await this.batchComputeRealizedLpFeePct(depositEvents);
|
|
582
|
+
for (const [index, event] of Array.from(depositEvents.entries())) {
|
|
583
|
+
const rawDeposit = spreadEventWithBlockNumber(event);
|
|
584
|
+
|
|
585
|
+
// Derive and append the common properties that are not part of the onchain event.
|
|
586
|
+
const { quoteBlock: quoteBlockNumber } = dataForQuoteTime[index];
|
|
587
|
+
const deposit = { ...(rawDeposit as DepositWithBlock), originChainId: this.chainId, quoteBlockNumber };
|
|
588
|
+
if (deposit.outputToken === ZERO_ADDRESS) {
|
|
589
|
+
deposit.outputToken = this.getDestinationTokenForDeposit(deposit);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
if (this.depositHashes[this.getDepositHash(deposit)] !== undefined) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
assign(this.depositHashes, [this.getDepositHash(deposit)], deposit);
|
|
596
|
+
|
|
597
|
+
if (deposit.depositId < this.earliestDepositIdQueried) {
|
|
598
|
+
this.earliestDepositIdQueried = deposit.depositId;
|
|
599
|
+
}
|
|
600
|
+
if (deposit.depositId > this.latestDepositIdQueried) {
|
|
601
|
+
this.latestDepositIdQueried = deposit.depositId;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// TODO: When validating fills with deposits for the purposes of UBA flows, do we need to consider
|
|
607
|
+
// speed ups as well? For example, do we need to also consider that the speed up is before the fill
|
|
608
|
+
// timestamp to be applied for the fill? My brain hurts.
|
|
609
|
+
// Update deposits with speed up requests from depositor.
|
|
610
|
+
if (eventsToQuery.includes("RequestedSpeedUpV3Deposit")) {
|
|
611
|
+
const speedUpEvents = [...(queryResults[eventsToQuery.indexOf("RequestedSpeedUpV3Deposit")] ?? [])];
|
|
612
|
+
|
|
613
|
+
for (const event of speedUpEvents) {
|
|
614
|
+
const speedUp: SpeedUp = { ...spreadEvent(event.args), originChainId: this.chainId };
|
|
615
|
+
assign(this.speedUps, [speedUp.depositor, speedUp.depositId], [speedUp]);
|
|
616
|
+
|
|
617
|
+
// Find deposit hash matching this speed up event and update the deposit data associated with the hash,
|
|
618
|
+
// if the hash+data exists.
|
|
619
|
+
const depositHash = this.getDepositHash(speedUp);
|
|
620
|
+
|
|
621
|
+
// We can assume all deposits in this lookback window are loaded in-memory already so if the depositHash
|
|
622
|
+
// is not mapped to a deposit, then we can throw away the speedup as it can't be applied to anything.
|
|
623
|
+
const depositDataAssociatedWithSpeedUp = this.depositHashes[depositHash];
|
|
624
|
+
if (isDefined(depositDataAssociatedWithSpeedUp)) {
|
|
625
|
+
this.depositHashes[depositHash] = this.appendMaxSpeedUpSignatureToDeposit(depositDataAssociatedWithSpeedUp);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
if (eventsToQuery.includes("RequestedV3SlowFill")) {
|
|
631
|
+
const slowFillRequests = queryResults[eventsToQuery.indexOf("RequestedV3SlowFill")];
|
|
632
|
+
for (const event of slowFillRequests) {
|
|
633
|
+
const slowFillRequest: SlowFillRequestWithBlock = {
|
|
634
|
+
...(spreadEventWithBlockNumber(event) as SlowFillRequestWithBlock),
|
|
635
|
+
destinationChainId: this.chainId,
|
|
636
|
+
};
|
|
637
|
+
const relayDataHash = getRelayDataHash(slowFillRequest, this.chainId);
|
|
638
|
+
if (this.slowFillRequests[relayDataHash] !== undefined) {
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
this.slowFillRequests[relayDataHash] = slowFillRequest;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
if (eventsToQuery.includes("FilledV3Relay")) {
|
|
646
|
+
const fillEvents = [...((queryResults[eventsToQuery.indexOf("FilledV3Relay")] ?? []) as FilledV3RelayEvent[])];
|
|
647
|
+
|
|
648
|
+
if (fillEvents.length > 0) {
|
|
649
|
+
this.log("debug", `Using ${fillEvents.length} newly queried fill events for chain ${this.chainId}`, {
|
|
650
|
+
earliestEvent: fillEvents[0].blockNumber,
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// @note The type assertions here suppress errors that might arise due to incomplete types. For now, verify via
|
|
655
|
+
// test that the types are complete. A broader change in strategy for safely unpacking events will be introduced.
|
|
656
|
+
for (const event of fillEvents) {
|
|
657
|
+
const fill = {
|
|
658
|
+
...(spreadEventWithBlockNumber(event) as FillWithBlock),
|
|
659
|
+
destinationChainId: this.chainId,
|
|
660
|
+
};
|
|
661
|
+
assign(this.fills, [fill.originChainId], [fill]);
|
|
662
|
+
assign(this.depositHashesToFills, [this.getDepositHash(fill)], [fill]);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
if (eventsToQuery.includes("EnabledDepositRoute")) {
|
|
667
|
+
const enableDepositsEvents = queryResults[eventsToQuery.indexOf("EnabledDepositRoute")];
|
|
668
|
+
|
|
669
|
+
for (const event of enableDepositsEvents) {
|
|
670
|
+
const enableDeposit = spreadEvent(event.args);
|
|
671
|
+
assign(
|
|
672
|
+
this.depositRoutes,
|
|
673
|
+
[enableDeposit.originToken, enableDeposit.destinationChainId],
|
|
674
|
+
enableDeposit.enabled
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
if (eventsToQuery.includes("RelayedRootBundle")) {
|
|
680
|
+
const relayedRootBundleEvents = queryResults[eventsToQuery.indexOf("RelayedRootBundle")];
|
|
681
|
+
for (const event of relayedRootBundleEvents) {
|
|
682
|
+
this.rootBundleRelays.push(spreadEventWithBlockNumber(event) as RootBundleRelayWithBlock);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
if (eventsToQuery.includes("ExecutedRelayerRefundRoot")) {
|
|
687
|
+
const refundEvents = queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")];
|
|
688
|
+
for (const event of refundEvents) {
|
|
689
|
+
const executedRefund = spreadEventWithBlockNumber(event) as RelayerRefundExecutionWithBlock;
|
|
690
|
+
executedRefund.l2TokenAddress = SpokePoolClient.getExecutedRefundLeafL2Token(
|
|
691
|
+
executedRefund.chainId,
|
|
692
|
+
executedRefund.l2TokenAddress
|
|
693
|
+
);
|
|
694
|
+
this.relayerRefundExecutions.push(executedRefund);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// Next iteration should start off from where this one ended.
|
|
699
|
+
this.currentTime = currentTime;
|
|
700
|
+
if (this.oldestTime === 0) this.oldestTime = oldestTime; // Set oldest time only after the first update.
|
|
701
|
+
this.firstDepositIdForSpokePool = update.firstDepositId;
|
|
702
|
+
this.hasCCTPBridgingEnabled = update.hasCCTPBridgingEnabled;
|
|
703
|
+
this.latestBlockSearched = searchEndBlock;
|
|
704
|
+
this.lastDepositIdForSpokePool = update.latestDepositId;
|
|
705
|
+
this.firstBlockToSearch = searchEndBlock + 1;
|
|
706
|
+
this.eventSearchConfig.toBlock = undefined; // Caller can re-set on subsequent updates if necessary
|
|
707
|
+
this.isUpdated = true;
|
|
708
|
+
this.log("debug", `SpokePool client for chain ${this.chainId} updated!`, {
|
|
709
|
+
nextFirstBlockToSearch: this.firstBlockToSearch,
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Retrieves the l2TokenAddress for a given executed refund leaf.
|
|
715
|
+
* @param chainId The chain ID of the executed refund leaf.
|
|
716
|
+
* @param eventL2Token The l2TokenAddress of the executed refund leaf.
|
|
717
|
+
* @returns The l2TokenAddress of the executed refund leaf.
|
|
718
|
+
*/
|
|
719
|
+
public static getExecutedRefundLeafL2Token(chainId: number, eventL2Token: string): string {
|
|
720
|
+
// If execution of WETH refund leaf occurred on an OVM spoke pool, then we'll convert its l2Token from the native
|
|
721
|
+
// token address to the wrapped token address. This is because the OVM_SpokePool modifies the l2TokenAddress prop
|
|
722
|
+
// in _bridgeTokensToHubPool before emitting the ExecutedRelayerRefundLeaf event.
|
|
723
|
+
// Here is the contract code referenced:
|
|
724
|
+
// - https://github.com/across-protocol/contracts/blob/954528a4620863d1c868e54a370fd8556d5ed05c/contracts/Ovm_SpokePool.sol#L142
|
|
725
|
+
if (
|
|
726
|
+
(chainId === 10 || chainId === 8453) &&
|
|
727
|
+
eventL2Token.toLowerCase() === "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000"
|
|
728
|
+
) {
|
|
729
|
+
return "0x4200000000000000000000000000000000000006";
|
|
730
|
+
} else if (chainId === 288 && eventL2Token.toLowerCase() === "0x4200000000000000000000000000000000000006") {
|
|
731
|
+
return "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000";
|
|
732
|
+
} else {
|
|
733
|
+
return eventL2Token;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Computes the realized LP fee percentage for a given deposit.
|
|
739
|
+
* @param depositEvent The deposit event to compute the realized LP fee percentage for.
|
|
740
|
+
* @returns The realized LP fee percentage.
|
|
741
|
+
*/
|
|
742
|
+
protected async computeRealizedLpFeePct(depositEvent: V3FundsDepositedEvent): Promise<RealizedLpFee> {
|
|
743
|
+
const [lpFee] = await this.batchComputeRealizedLpFeePct([depositEvent]);
|
|
744
|
+
return lpFee;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Computes the realized LP fee percentage for a batch of deposits.
|
|
749
|
+
* @dev Computing in batch opens up for efficiencies, e.g. in quoteTimestamp -> blockNumber resolution.
|
|
750
|
+
* @param depositEvents The array of deposit events to compute the realized LP fee percentage for.
|
|
751
|
+
* @returns The array of realized LP fee percentages and associated HubPool block numbers.
|
|
752
|
+
*/
|
|
753
|
+
protected async batchComputeRealizedLpFeePct(depositEvents: V3FundsDepositedEvent[]): Promise<RealizedLpFee[]> {
|
|
754
|
+
// If no hub pool client, we're using this for testing. Set quote block very high so that if it's ever
|
|
755
|
+
// used to look up a configuration for a block, it will always match with the latest configuration.
|
|
756
|
+
if (this.hubPoolClient === null) {
|
|
757
|
+
const realizedLpFeePct = bnZero;
|
|
758
|
+
const quoteBlock = MAX_BIG_INT.toNumber();
|
|
759
|
+
return depositEvents.map(() => {
|
|
760
|
+
return { realizedLpFeePct, quoteBlock };
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const deposits = depositEvents.map(({ args }) => {
|
|
765
|
+
// For v3 deposits, leave payment chain ID undefined so we don't compute lp fee since we don't have the
|
|
766
|
+
// payment chain ID until we match this deposit with a fill.
|
|
767
|
+
const { inputToken, inputAmount, quoteTimestamp } = args;
|
|
768
|
+
return {
|
|
769
|
+
inputToken,
|
|
770
|
+
inputAmount,
|
|
771
|
+
originChainId: this.chainId,
|
|
772
|
+
paymentChainId: undefined,
|
|
773
|
+
quoteTimestamp,
|
|
774
|
+
};
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
return deposits.length > 0 ? await this.hubPoolClient.batchComputeRealizedLpFeePct(deposits) : [];
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Retrieves the destination token for a given deposit.
|
|
782
|
+
* @param deposit The deposit to retrieve the destination token for.
|
|
783
|
+
* @returns The destination token.
|
|
784
|
+
*/
|
|
785
|
+
protected getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
|
|
786
|
+
// If there is no rate model client return address(0).
|
|
787
|
+
if (!this.hubPoolClient) {
|
|
788
|
+
return ZERO_ADDRESS;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
return this.hubPoolClient.getL2TokenForDeposit(deposit);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Performs a log for a specific level, message and data.
|
|
796
|
+
* @param level The log level.
|
|
797
|
+
* @param message The log message.
|
|
798
|
+
* @param data Optional data to log.
|
|
799
|
+
*/
|
|
800
|
+
protected log(level: DefaultLogLevels, message: string, data?: AnyObject) {
|
|
801
|
+
this.logger[level]({ at: "SpokePoolClient", chainId: this.chainId, message, ...data });
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Retrieves the current time from the SpokePool contract.
|
|
806
|
+
* @returns The current time, which will be 0 if there has been no update() yet.
|
|
807
|
+
*/
|
|
808
|
+
public getCurrentTime(): number {
|
|
809
|
+
return this.currentTime;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Retrieves the oldest time searched on the SpokePool contract.
|
|
814
|
+
* @returns The oldest time searched, which will be 0 if there has been no update() yet.
|
|
815
|
+
*/
|
|
816
|
+
public getOldestTime(): number {
|
|
817
|
+
return this.oldestTime;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
async findDeposit(depositId: number, destinationChainId: number, depositor: string): Promise<DepositWithBlock> {
|
|
821
|
+
// Binary search for event search bounds. This way we can get the blocks before and after the deposit with
|
|
822
|
+
// deposit ID = fill.depositId and use those blocks to optimize the search for that deposit.
|
|
823
|
+
// Stop searches after a maximum # of searches to limit number of eth_call requests. Make an
|
|
824
|
+
// eth_getLogs call on the remaining block range (i.e. the [low, high] remaining from the binary
|
|
825
|
+
// search) to find the target deposit ID.
|
|
826
|
+
//
|
|
827
|
+
// @dev Limiting between 5-10 searches empirically performs best when there are ~300,000 deposits
|
|
828
|
+
// for a spoke pool and we're looking for a deposit <5 days older than HEAD.
|
|
829
|
+
const searchBounds = await this._getBlockRangeForDepositId(
|
|
830
|
+
depositId,
|
|
831
|
+
this.deploymentBlock,
|
|
832
|
+
this.latestBlockSearched,
|
|
833
|
+
7
|
|
834
|
+
);
|
|
835
|
+
|
|
836
|
+
const tStart = Date.now();
|
|
837
|
+
const query = await paginatedEventQuery(
|
|
838
|
+
this.spokePool,
|
|
839
|
+
this.spokePool.filters.V3FundsDeposited(
|
|
840
|
+
null,
|
|
841
|
+
null,
|
|
842
|
+
null,
|
|
843
|
+
null,
|
|
844
|
+
destinationChainId,
|
|
845
|
+
depositId,
|
|
846
|
+
null,
|
|
847
|
+
null,
|
|
848
|
+
null,
|
|
849
|
+
depositor,
|
|
850
|
+
null,
|
|
851
|
+
null,
|
|
852
|
+
null
|
|
853
|
+
),
|
|
854
|
+
{
|
|
855
|
+
fromBlock: searchBounds.low,
|
|
856
|
+
toBlock: searchBounds.high,
|
|
857
|
+
maxBlockLookBack: this.eventSearchConfig.maxBlockLookBack,
|
|
858
|
+
}
|
|
859
|
+
);
|
|
860
|
+
const tStop = Date.now();
|
|
861
|
+
|
|
862
|
+
const event = (query as V3FundsDepositedEvent[]).find((deposit) => deposit.args.depositId === depositId);
|
|
863
|
+
if (event === undefined) {
|
|
864
|
+
const srcChain = getNetworkName(this.chainId);
|
|
865
|
+
const dstChain = getNetworkName(destinationChainId);
|
|
866
|
+
throw new Error(
|
|
867
|
+
`Could not find deposit ${depositId} for ${dstChain} fill` +
|
|
868
|
+
` between ${srcChain} blocks [${searchBounds.low}, ${searchBounds.high}]`
|
|
869
|
+
);
|
|
870
|
+
}
|
|
871
|
+
const partialDeposit = spreadEventWithBlockNumber(event) as DepositWithBlock;
|
|
872
|
+
const { quoteBlock: quoteBlockNumber } = await this.computeRealizedLpFeePct(event);
|
|
873
|
+
|
|
874
|
+
// Append destination token and realized lp fee to deposit.
|
|
875
|
+
const deposit: DepositWithBlock = {
|
|
876
|
+
...partialDeposit,
|
|
877
|
+
originChainId: this.chainId,
|
|
878
|
+
quoteBlockNumber,
|
|
879
|
+
outputToken:
|
|
880
|
+
partialDeposit.outputToken === ZERO_ADDRESS
|
|
881
|
+
? this.getDestinationTokenForDeposit({ ...partialDeposit, originChainId: this.chainId })
|
|
882
|
+
: partialDeposit.outputToken,
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
this.logger.debug({
|
|
886
|
+
at: "SpokePoolClient#findDeposit",
|
|
887
|
+
message: "Located V3 deposit outside of SpokePoolClient's search range",
|
|
888
|
+
deposit,
|
|
889
|
+
elapsedMs: tStop - tStart,
|
|
890
|
+
});
|
|
891
|
+
|
|
892
|
+
return deposit;
|
|
893
|
+
}
|
|
894
|
+
}
|