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