@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,298 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
import { DEFAULT_SIMULATED_RELAYER_ADDRESS, TOKEN_SYMBOLS_MAP } from "../constants";
|
|
4
|
+
import { MAX_BIG_INT, bnZero, fixedPointAdjustment, getTokenInformationFromAddress, isDefined, max, min, nativeToToken, percent, toBN, toBNWei, } from "../utils";
|
|
5
|
+
export var expectedCapitalCostsKeys = ["lowerBound", "upperBound", "cutoff", "decimals"];
|
|
6
|
+
export var DEFAULT_LOGGER = {
|
|
7
|
+
debug: function () {
|
|
8
|
+
var args = [];
|
|
9
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10
|
+
args[_i] = arguments[_i];
|
|
11
|
+
}
|
|
12
|
+
return console.debug(args);
|
|
13
|
+
},
|
|
14
|
+
info: function () {
|
|
15
|
+
var args = [];
|
|
16
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
17
|
+
args[_i] = arguments[_i];
|
|
18
|
+
}
|
|
19
|
+
return console.info(args);
|
|
20
|
+
},
|
|
21
|
+
warn: function () {
|
|
22
|
+
var args = [];
|
|
23
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
24
|
+
args[_i] = arguments[_i];
|
|
25
|
+
}
|
|
26
|
+
return console.warn(args);
|
|
27
|
+
},
|
|
28
|
+
error: function () {
|
|
29
|
+
var args = [];
|
|
30
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
31
|
+
args[_i] = arguments[_i];
|
|
32
|
+
}
|
|
33
|
+
return console.error(args);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// Small amount to simulate filling with. Should be low enough to guarantee a successful fill.
|
|
37
|
+
var safeOutputAmount = toBN(100);
|
|
38
|
+
var RelayFeeCalculator = /** @class */ (function () {
|
|
39
|
+
function RelayFeeCalculator(config, logger, destinationChainId) {
|
|
40
|
+
assert(config, "config must be provided");
|
|
41
|
+
if ("queries" in config) {
|
|
42
|
+
this.queries = config.queries;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
assert(destinationChainId !== undefined, "destinationChainId must be provided if queriesMap is provided");
|
|
46
|
+
assert(config.queriesMap[destinationChainId], "No queries provided for destination chain");
|
|
47
|
+
this.queries = config.queriesMap[destinationChainId];
|
|
48
|
+
}
|
|
49
|
+
this.gasDiscountPercent = config.gasDiscountPercent || 0;
|
|
50
|
+
this.capitalDiscountPercent = config.capitalDiscountPercent || 0;
|
|
51
|
+
this.feeLimitPercent = config.feeLimitPercent || 0;
|
|
52
|
+
this.nativeTokenDecimals = config.nativeTokenDecimals || 18;
|
|
53
|
+
assert(this.gasDiscountPercent >= 0 && this.gasDiscountPercent <= 100, "gasDiscountPercent must be between 0 and 100 percent");
|
|
54
|
+
assert(this.capitalDiscountPercent >= 0 && this.capitalDiscountPercent <= 100, "capitalDiscountPercent must be between 0 and 100 percent");
|
|
55
|
+
assert(this.feeLimitPercent >= 0 && this.feeLimitPercent <= 100, "feeLimitPercent must be between 0 and 100 percent");
|
|
56
|
+
this.capitalCostsConfig = Object.fromEntries(Object.entries(config.capitalCostsConfig).map(function (_a) {
|
|
57
|
+
var token = _a[0], capitalCosts = _a[1];
|
|
58
|
+
return [token.toUpperCase(), RelayFeeCalculator.validateAndTransformCapitalCostsConfigOverride(capitalCosts)];
|
|
59
|
+
}));
|
|
60
|
+
assert(Object.keys(this.capitalCostsConfig).length > 0, "capitalCostsConfig must have at least one entry");
|
|
61
|
+
this.logger = logger || DEFAULT_LOGGER;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Type guard to check if a config is a CapitalCostConfigOverride or a CapitalCostConfig.
|
|
65
|
+
* @param config CapitalCostConfig or CapitalCostConfigOverride
|
|
66
|
+
* @returns true if the config is a CapitalCostConfigOverride, false otherwise.
|
|
67
|
+
* @private
|
|
68
|
+
* @dev This is a type guard that is used to check if a config is a CapitalCostConfigOverride or a CapitalCostConfig.
|
|
69
|
+
* This is needed because the config can be either a CapitalCostConfig or a CapitalCostConfigOverride. If it's a
|
|
70
|
+
* CapitalCostConfig, then we need to convert it to a CapitalCostConfigOverride with the default config set with no route
|
|
71
|
+
* overrides.
|
|
72
|
+
*/
|
|
73
|
+
RelayFeeCalculator.capitalCostConfigIsOverride = function (config) {
|
|
74
|
+
return config.default !== undefined;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Validates a CapitalCostConfigOverride or a CapitalCostConfig.
|
|
78
|
+
* @param capitalCosts CapitalCostConfig or CapitalCostConfigOverride
|
|
79
|
+
* @returns CapitalCostConfigOverride
|
|
80
|
+
*/
|
|
81
|
+
RelayFeeCalculator.validateAndTransformCapitalCostsConfigOverride = function (capitalCosts) {
|
|
82
|
+
// We need to first convert the config to a baseline type. This is because the config can be either a CapitalCostConfig
|
|
83
|
+
// or a CapitalCostConfigOverride. If it's a CapitalCostConfig, then we need to convert it to a CapitalCostConfigOverride with
|
|
84
|
+
// the default config set with no route overrides.
|
|
85
|
+
var config = this.capitalCostConfigIsOverride(capitalCosts)
|
|
86
|
+
? capitalCosts
|
|
87
|
+
: { default: capitalCosts };
|
|
88
|
+
// Validate the default config.
|
|
89
|
+
this.validateCapitalCostsConfig(config.default);
|
|
90
|
+
// Iterate over all the route overrides and validate them.
|
|
91
|
+
for (var _i = 0, _a = Object.values(config.routeOverrides || {}); _i < _a.length; _i++) {
|
|
92
|
+
var toChainIdRoutes = _a[_i];
|
|
93
|
+
for (var _b = 0, _c = Object.values(toChainIdRoutes); _b < _c.length; _b++) {
|
|
94
|
+
var override = _c[_b];
|
|
95
|
+
this.validateCapitalCostsConfig(override);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return config;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Validates a CapitalCostConfig.
|
|
102
|
+
* @param capitalCosts CapitalCostConfig
|
|
103
|
+
*/
|
|
104
|
+
RelayFeeCalculator.validateCapitalCostsConfig = function (capitalCosts) {
|
|
105
|
+
assert(toBN(capitalCosts.upperBound).lt(toBNWei("0.01")), "upper bound must be < 1%");
|
|
106
|
+
assert(toBN(capitalCosts.lowerBound).lte(capitalCosts.upperBound), "lower bound must be <= upper bound");
|
|
107
|
+
assert(capitalCosts.decimals > 0 && capitalCosts.decimals <= 18, "invalid decimals");
|
|
108
|
+
};
|
|
109
|
+
RelayFeeCalculator.prototype.getTokenPrice = function (tokenSymbol) {
|
|
110
|
+
return this.queries.getTokenPrice(tokenSymbol);
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Calculate the gas fee as a % of the amount to relay.
|
|
114
|
+
* @param deposit A valid deposit object to reason about
|
|
115
|
+
* @param amountToRelay The amount that we should fill the deposit for
|
|
116
|
+
* @param simulateZeroFill Whether to simulate a zero fill for the gas cost simulation
|
|
117
|
+
* A fill of 1 wei which would result in a slow/partial fill.
|
|
118
|
+
* You should do this if you're not worried about simulating a proper fill of a deposit
|
|
119
|
+
* with a message or if you are worried a fill amount that could exceed the balance of
|
|
120
|
+
* the relayer.
|
|
121
|
+
* @param relayerAddress The relayer that will be used for the gas cost simulation
|
|
122
|
+
* @param _tokenPrice The token price for normalizing fees
|
|
123
|
+
* @returns The fee as a % of the amount to relay.
|
|
124
|
+
* @note Setting simulateZeroFill to true will result on the gas costs being estimated
|
|
125
|
+
* on a zero fill. However, the percentage will be returned as a percentage of the
|
|
126
|
+
* amount to relay. This is useful for determining the maximum gas fee % that a
|
|
127
|
+
* relayer may need to make on a regular fill. You will get differing results if
|
|
128
|
+
* a message & recipient contract is provided as this function may not simulate with
|
|
129
|
+
* the correct parameters to see a full fill.
|
|
130
|
+
*/
|
|
131
|
+
RelayFeeCalculator.prototype.gasFeePercent = function (deposit, amountToRelay, simulateZeroFill, relayerAddress, _tokenPrice, tokenMapping) {
|
|
132
|
+
if (simulateZeroFill === void 0) { simulateZeroFill = false; }
|
|
133
|
+
if (relayerAddress === void 0) { relayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS; }
|
|
134
|
+
if (tokenMapping === void 0) { tokenMapping = TOKEN_SYMBOLS_MAP; }
|
|
135
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
+
var inputToken, token, simulatedAmount, getGasCosts, getTokenPrice, _a, tokenGasCost, tokenPrice, gasFeesInToken;
|
|
137
|
+
var _this = this;
|
|
138
|
+
return __generator(this, function (_b) {
|
|
139
|
+
switch (_b.label) {
|
|
140
|
+
case 0:
|
|
141
|
+
if (toBN(amountToRelay).eq(bnZero))
|
|
142
|
+
return [2 /*return*/, MAX_BIG_INT];
|
|
143
|
+
inputToken = deposit.inputToken;
|
|
144
|
+
token = getTokenInformationFromAddress(inputToken, tokenMapping);
|
|
145
|
+
if (!isDefined(token)) {
|
|
146
|
+
throw new Error("Could not find token information for ".concat(inputToken));
|
|
147
|
+
}
|
|
148
|
+
simulatedAmount = simulateZeroFill ? safeOutputAmount : toBN(amountToRelay);
|
|
149
|
+
deposit = __assign(__assign({}, deposit), { outputAmount: simulatedAmount });
|
|
150
|
+
getGasCosts = this.queries.getGasCosts(deposit, relayerAddress).catch(function (error) {
|
|
151
|
+
_this.logger.error({
|
|
152
|
+
at: "sdk/gasFeePercent",
|
|
153
|
+
message: "Error while fetching gas costs",
|
|
154
|
+
error: error,
|
|
155
|
+
simulateZeroFill: simulateZeroFill,
|
|
156
|
+
deposit: deposit,
|
|
157
|
+
});
|
|
158
|
+
throw error;
|
|
159
|
+
});
|
|
160
|
+
getTokenPrice = this.queries.getTokenPrice(token.symbol).catch(function (error) {
|
|
161
|
+
_this.logger.error({
|
|
162
|
+
at: "sdk/gasFeePercent",
|
|
163
|
+
message: "Error while fetching token price",
|
|
164
|
+
error: error,
|
|
165
|
+
destinationChainId: deposit.destinationChainId,
|
|
166
|
+
inputToken: inputToken,
|
|
167
|
+
});
|
|
168
|
+
throw error;
|
|
169
|
+
});
|
|
170
|
+
return [4 /*yield*/, Promise.all([
|
|
171
|
+
getGasCosts,
|
|
172
|
+
_tokenPrice !== undefined ? _tokenPrice : getTokenPrice,
|
|
173
|
+
])];
|
|
174
|
+
case 1:
|
|
175
|
+
_a = _b.sent(), tokenGasCost = _a[0].tokenGasCost, tokenPrice = _a[1];
|
|
176
|
+
gasFeesInToken = nativeToToken(tokenGasCost, tokenPrice, token.decimals, this.nativeTokenDecimals);
|
|
177
|
+
return [2 /*return*/, percent(gasFeesInToken, amountToRelay.toString())];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
// Note: these variables are unused now, but may be needed in future versions of this function that are more complex.
|
|
183
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
184
|
+
RelayFeeCalculator.prototype.capitalFeePercent = function (_amountToRelay, _tokenSymbol, _originRoute, _destinationRoute) {
|
|
185
|
+
var _a, _b, _c;
|
|
186
|
+
// If amount is 0, then the capital fee % should be the max 100%
|
|
187
|
+
if (toBN(_amountToRelay).eq(toBN(0)))
|
|
188
|
+
return MAX_BIG_INT;
|
|
189
|
+
// V0: Ensure that there is a capital fee available for the token.
|
|
190
|
+
// If not, then we should throw an error because this is indicative
|
|
191
|
+
// of a misconfiguration.
|
|
192
|
+
var tokenCostConfig = this.capitalCostsConfig[_tokenSymbol.toUpperCase()];
|
|
193
|
+
if (!isDefined(tokenCostConfig)) {
|
|
194
|
+
this.logger.error({
|
|
195
|
+
at: "sdk/capitalFeePercent",
|
|
196
|
+
message: "No capital fee available for token ".concat(_tokenSymbol),
|
|
197
|
+
});
|
|
198
|
+
throw new Error("No capital cost config available for token ".concat(_tokenSymbol));
|
|
199
|
+
}
|
|
200
|
+
// V1: Charge fee that scales with size. This will charge a fee % based on a linear fee curve with a "kink" at a
|
|
201
|
+
// cutoff in the same units as _amountToRelay. Before the kink, the fee % will increase linearly from a lower
|
|
202
|
+
// bound to an upper bound. After the kink, the fee % increase will be fixed, and slowly approach the upper bound
|
|
203
|
+
// for very large amount inputs.
|
|
204
|
+
else {
|
|
205
|
+
var config = isDefined(_originRoute) && isDefined(_destinationRoute)
|
|
206
|
+
? (_c = (_b = (_a = tokenCostConfig.routeOverrides) === null || _a === void 0 ? void 0 : _a[_originRoute]) === null || _b === void 0 ? void 0 : _b[_destinationRoute]) !== null && _c !== void 0 ? _c : tokenCostConfig.default
|
|
207
|
+
: tokenCostConfig.default;
|
|
208
|
+
// Scale amount "y" to 18 decimals.
|
|
209
|
+
var y = toBN(_amountToRelay).mul(toBNWei("1", 18 - config.decimals));
|
|
210
|
+
// At a minimum, the fee will be equal to lower bound fee * y
|
|
211
|
+
var minCharge = toBN(config.lowerBound).mul(y).div(fixedPointAdjustment);
|
|
212
|
+
// Charge an increasing marginal fee % up to min(cutoff, y). If y is very close to the cutoff, the fee %
|
|
213
|
+
// will be equal to half the sum of (upper bound + lower bound).
|
|
214
|
+
var yTriangle = min(config.cutoff, y);
|
|
215
|
+
// triangleSlope is slope of fee curve from lower bound to upper bound. If cutoff is 0, slope is 0.
|
|
216
|
+
// triangleCharge is interval of curve from 0 to y for curve = triangleSlope * y
|
|
217
|
+
var triangleSlope = toBN(config.cutoff).eq(toBN(0))
|
|
218
|
+
? toBN(0)
|
|
219
|
+
: toBN(config.upperBound).sub(config.lowerBound).mul(fixedPointAdjustment).div(config.cutoff);
|
|
220
|
+
var triangleHeight = triangleSlope.mul(yTriangle).div(fixedPointAdjustment);
|
|
221
|
+
var triangleCharge = triangleHeight.mul(yTriangle).div(toBNWei(2));
|
|
222
|
+
// For any amounts above the cutoff, the marginal fee % will not increase but will be fixed at the upper bound
|
|
223
|
+
// value.
|
|
224
|
+
var yRemainder = max(toBN(0), y.sub(config.cutoff));
|
|
225
|
+
var remainderCharge = yRemainder.mul(toBN(config.upperBound).sub(config.lowerBound)).div(fixedPointAdjustment);
|
|
226
|
+
return minCharge.add(triangleCharge).add(remainderCharge).mul(fixedPointAdjustment).div(y);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Retrieves the relayer fee details for a deposit.
|
|
231
|
+
* @param deposit A valid deposit object to reason about
|
|
232
|
+
* @param amountToRelay The amount that the relayer would simulate a fill for
|
|
233
|
+
* @param simulateZeroFill Whether to simulate a zero fill for the gas cost simulation
|
|
234
|
+
* For simulateZeroFill: A fill of 1 wei which would result in a slow/partial fill.
|
|
235
|
+
* You should do this if you're not worried about simulating a proper fill of a deposit
|
|
236
|
+
* with a message or if you are worried a fill amount that could exceed the balance of
|
|
237
|
+
* the relayer.
|
|
238
|
+
* @param relayerAddress The relayer that will be used for the gas cost simulation
|
|
239
|
+
* @param _tokenPrice The token price for normalizing fees
|
|
240
|
+
* @returns A resulting `RelayerFeeDetails` object
|
|
241
|
+
*/
|
|
242
|
+
RelayFeeCalculator.prototype.relayerFeeDetails = function (deposit, amountToRelay, simulateZeroFill, relayerAddress, _tokenPrice) {
|
|
243
|
+
if (simulateZeroFill === void 0) { simulateZeroFill = false; }
|
|
244
|
+
if (relayerAddress === void 0) { relayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS; }
|
|
245
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
246
|
+
var inputToken, token, gasFeePercent, gasFeeTotal, capitalFeePercent, capitalFeeTotal, relayFeePercent, relayFeeTotal, maxGasFeePercent, minDeposit, isAmountTooLow;
|
|
247
|
+
return __generator(this, function (_a) {
|
|
248
|
+
switch (_a.label) {
|
|
249
|
+
case 0:
|
|
250
|
+
// If the amount to relay is not provided, then we
|
|
251
|
+
// should use the full deposit amount.
|
|
252
|
+
amountToRelay !== null && amountToRelay !== void 0 ? amountToRelay : (amountToRelay = deposit.outputAmount);
|
|
253
|
+
inputToken = deposit.inputToken;
|
|
254
|
+
token = getTokenInformationFromAddress(inputToken);
|
|
255
|
+
if (!isDefined(token)) {
|
|
256
|
+
throw new Error("Could not find token information for ".concat(inputToken));
|
|
257
|
+
}
|
|
258
|
+
return [4 /*yield*/, this.gasFeePercent(deposit, amountToRelay, simulateZeroFill, relayerAddress, _tokenPrice)];
|
|
259
|
+
case 1:
|
|
260
|
+
gasFeePercent = _a.sent();
|
|
261
|
+
gasFeeTotal = gasFeePercent.mul(amountToRelay).div(fixedPointAdjustment);
|
|
262
|
+
capitalFeePercent = this.capitalFeePercent(amountToRelay, token.symbol, deposit.originChainId.toString(), deposit.destinationChainId.toString());
|
|
263
|
+
capitalFeeTotal = capitalFeePercent.mul(amountToRelay).div(fixedPointAdjustment);
|
|
264
|
+
relayFeePercent = gasFeePercent.add(capitalFeePercent);
|
|
265
|
+
relayFeeTotal = gasFeeTotal.add(capitalFeeTotal);
|
|
266
|
+
maxGasFeePercent = max(toBNWei(this.feeLimitPercent / 100).sub(capitalFeePercent), toBN(0));
|
|
267
|
+
if (maxGasFeePercent.eq(toBN(0))) {
|
|
268
|
+
minDeposit = MAX_BIG_INT;
|
|
269
|
+
isAmountTooLow = true;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
minDeposit = gasFeeTotal.mul(fixedPointAdjustment).div(maxGasFeePercent);
|
|
273
|
+
isAmountTooLow = toBN(amountToRelay).lt(minDeposit);
|
|
274
|
+
}
|
|
275
|
+
return [2 /*return*/, {
|
|
276
|
+
amountToRelay: amountToRelay.toString(),
|
|
277
|
+
tokenSymbol: token.symbol,
|
|
278
|
+
gasFeePercent: gasFeePercent.toString(),
|
|
279
|
+
gasFeeTotal: gasFeeTotal.toString(),
|
|
280
|
+
gasDiscountPercent: this.gasDiscountPercent,
|
|
281
|
+
capitalFeePercent: capitalFeePercent.toString(),
|
|
282
|
+
capitalFeeTotal: capitalFeeTotal.toString(),
|
|
283
|
+
capitalDiscountPercent: this.capitalDiscountPercent,
|
|
284
|
+
relayFeePercent: relayFeePercent.toString(),
|
|
285
|
+
relayFeeTotal: relayFeeTotal.toString(),
|
|
286
|
+
feeLimitPercent: this.feeLimitPercent,
|
|
287
|
+
maxGasFeePercent: maxGasFeePercent.toString(),
|
|
288
|
+
minDeposit: minDeposit.toString(),
|
|
289
|
+
isAmountTooLow: isAmountTooLow,
|
|
290
|
+
}];
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
return RelayFeeCalculator;
|
|
296
|
+
}());
|
|
297
|
+
export { RelayFeeCalculator };
|
|
298
|
+
//# sourceMappingURL=relayFeeCalculator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relayFeeCalculator.js","sourceRoot":"","sources":["../../../src/relayFeeCalculator/relayFeeCalculator.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,EAEL,WAAW,EAEX,MAAM,EACN,oBAAoB,EACpB,8BAA8B,EAC9B,SAAS,EACT,GAAG,EACH,GAAG,EACH,aAAa,EACb,OAAO,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EAAE,eAAe,CAAC,QAAQ,EAAE;gCAC3C,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;gCACnD,eAAe,EAAE,eAAe,CAAC,QAAQ,EAAE;gCAC3C,aAAa,EAAE,aAAa,CAAC,QAAQ,EAAE;gCACvC,eAAe,EAAE,IAAI,CAAC,eAAe;gCACrC,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ,EAAE;gCAC7C,UAAU,EAAE,UAAU,CAAC,QAAQ,EAAE;gCACjC,cAAc,gBAAA;6BACf,EAAC;;;;KACH;IACH,yBAAC;AAAD,CAAC,AA1TD,IA0TC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file re-exports some of the typechain bindings so that they can be tree-shaken in the final frontend bundle.
|
|
3
|
+
* Currently, the packages `@across-protocol/contracts` and `@across-protocol/across-token` are not optimized for tree-shaking
|
|
4
|
+
* and contain modules that are not compatible in a browser environment. This is a temporary solution until we can fix the issue upstream.
|
|
5
|
+
*/
|
|
6
|
+
import type { TypedEvent, TypedEventFilter } from "@across-protocol/contracts/dist/typechain/common";
|
|
7
|
+
export type { TypedEvent, TypedEventFilter };
|
|
8
|
+
export { AcrossMerkleDistributor__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/merkle-distributor/AcrossMerkleDistributor__factory";
|
|
9
|
+
export { AcrossConfigStore__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/AcrossConfigStore__factory";
|
|
10
|
+
export { HubPool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/HubPool__factory";
|
|
11
|
+
export { SpokePool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePool.sol/SpokePool__factory";
|
|
12
|
+
export { ERC20__factory } from "@across-protocol/contracts/dist/typechain/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory";
|
|
13
|
+
export { AcceleratingDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/AcceleratingDistributor__factory";
|
|
14
|
+
export { ClaimAndStake__factory } from "@across-protocol/across-token/dist/typechain/factories/ClaimAndStake__factory";
|
|
15
|
+
export { MerkleDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/MerkleDistributor__factory";
|
|
16
|
+
export type { AcrossMerkleDistributor, AcrossMerkleDistributorInterface, } from "@across-protocol/contracts/dist/typechain/contracts/merkle-distributor/AcrossMerkleDistributor";
|
|
17
|
+
export type { AcrossConfigStore, AcrossConfigStoreInterface, } from "@across-protocol/contracts/dist/typechain/contracts/AcrossConfigStore";
|
|
18
|
+
export type { HubPool, HubPoolInterface } from "@across-protocol/contracts/dist/typechain/contracts/HubPool";
|
|
19
|
+
export type { SpokePool, SpokePoolInterface, FundsDepositedEvent, FilledRelayEvent, RequestedSpeedUpDepositEvent, V3FundsDepositedEvent, FilledV3RelayEvent, } from "@across-protocol/contracts/dist/typechain/contracts/SpokePool.sol/SpokePool";
|
|
20
|
+
export type { AcceleratingDistributor, AcceleratingDistributorInterface, } from "@across-protocol/across-token/dist/typechain/AcceleratingDistributor";
|
|
21
|
+
export type { ClaimAndStake, ClaimAndStakeInterface } from "@across-protocol/across-token/dist/typechain/ClaimAndStake";
|
|
22
|
+
export type { MerkleDistributor, MerkleDistributorInterface, } from "@across-protocol/across-token/dist/typechain/MerkleDistributor";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { AcrossMerkleDistributor__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/merkle-distributor/AcrossMerkleDistributor__factory";
|
|
2
|
+
export { AcrossConfigStore__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/AcrossConfigStore__factory";
|
|
3
|
+
export { HubPool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/HubPool__factory";
|
|
4
|
+
export { SpokePool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePool.sol/SpokePool__factory";
|
|
5
|
+
export { ERC20__factory } from "@across-protocol/contracts/dist/typechain/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory";
|
|
6
|
+
export { AcceleratingDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/AcceleratingDistributor__factory";
|
|
7
|
+
export { ClaimAndStake__factory } from "@across-protocol/across-token/dist/typechain/factories/ClaimAndStake__factory";
|
|
8
|
+
export { MerkleDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/MerkleDistributor__factory";
|
|
9
|
+
//# sourceMappingURL=typechain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typechain.js","sourceRoot":"","sources":["../../src/typechain.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gCAAgC,EAAE,MAAM,mHAAmH,CAAC;AACrK,OAAO,EAAE,0BAA0B,EAAE,MAAM,0FAA0F,CAAC;AACtI,OAAO,EAAE,gBAAgB,EAAE,MAAM,gFAAgF,CAAC;AAClH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gGAAgG,CAAC;AACpI,OAAO,EAAE,cAAc,EAAE,MAAM,wGAAwG,CAAC;AAExI,OAAO,EAAE,gCAAgC,EAAE,MAAM,yFAAyF,CAAC;AAC3I,OAAO,EAAE,sBAAsB,EAAE,MAAM,+EAA+E,CAAC;AACvH,OAAO,EAAE,0BAA0B,EAAE,MAAM,mFAAmF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
export var isError = function (error) { return error instanceof Error; };
|
|
3
|
+
export var isEthersError = function (error) {
|
|
4
|
+
return (error === null || error === void 0 ? void 0 : error.code) in ethers.utils.Logger.errors;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/typeguards/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,MAAM,CAAC,IAAM,OAAO,GAAG,UAAC,KAAc,IAAqB,OAAA,KAAK,YAAY,KAAK,EAAtB,CAAsB,CAAC;AAElF,MAAM,CAAC,IAAM,aAAa,GAAG,UAAC,KAAe;IAC3C,OAAA,CAAC,KAAqB,aAArB,KAAK,uBAAL,KAAK,CAAkB,IAAI,KAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;AAA1D,CAA0D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./error";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/typeguards/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { providers } from "ethers";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a contract is deployed at the given address
|
|
4
|
+
* @param address The ETH address to check
|
|
5
|
+
* @param provider A valid Ethers.js provider
|
|
6
|
+
* @returns A boolean indicating if a contract is deployed at the given address or not (true = contract, false = no contract)
|
|
7
|
+
*/
|
|
8
|
+
export declare function isContractDeployedToAddress(address: string, provider: providers.Provider): Promise<boolean>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { utils } from "ethers";
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a contract is deployed at the given address
|
|
5
|
+
* @param address The ETH address to check
|
|
6
|
+
* @param provider A valid Ethers.js provider
|
|
7
|
+
* @returns A boolean indicating if a contract is deployed at the given address or not (true = contract, false = no contract)
|
|
8
|
+
*/
|
|
9
|
+
export function isContractDeployedToAddress(address, provider) {
|
|
10
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11
|
+
var code;
|
|
12
|
+
return __generator(this, function (_a) {
|
|
13
|
+
switch (_a.label) {
|
|
14
|
+
case 0:
|
|
15
|
+
// A base case for if the address is null or malformed
|
|
16
|
+
if (!address || !utils.isAddress(address)) {
|
|
17
|
+
return [2 /*return*/, false];
|
|
18
|
+
}
|
|
19
|
+
return [4 /*yield*/, provider.getCode(address)];
|
|
20
|
+
case 1:
|
|
21
|
+
code = _a.sent();
|
|
22
|
+
// If the code is not empty, then there is a contract at this address
|
|
23
|
+
return [2 /*return*/, code !== "0x"];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=AddressUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddressUtils.js","sourceRoot":"","sources":["../../../src/utils/AddressUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAa,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAgB,2BAA2B,CAAC,OAAe,EAAE,QAA4B;;;;;;oBAC7F,sDAAsD;oBACtD,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;wBACzC,sBAAO,KAAK,EAAC;qBACd;oBAEY,qBAAM,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAA;;oBAAtC,IAAI,GAAG,SAA+B;oBAC5C,qEAAqE;oBACrE,sBAAO,IAAI,KAAK,IAAI,EAAC;;;;CACtB"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deduplicates an array by filtering it via a Set.
|
|
3
|
+
* @notice Should not be used for deduplicating arrays of complex types.
|
|
4
|
+
* @param array The array to deduplicate.
|
|
5
|
+
* @returns A new array, filtered for uniqueness.
|
|
6
|
+
*/
|
|
7
|
+
export declare function dedupArray<T>(array: T[]): T[];
|
|
8
|
+
/**
|
|
9
|
+
* Splits an arbitrary array into a series of chunks.
|
|
10
|
+
* @param array The array to chunk.
|
|
11
|
+
* @param chunkSize The maximum size of any chunk within the array.
|
|
12
|
+
* @returns A new array of chunked members.
|
|
13
|
+
*/
|
|
14
|
+
export declare function chunk<T>(array: T[], chunkSize: number): T[][];
|
|
15
|
+
/**
|
|
16
|
+
* Returns the last index of an array that matches the given predicate.
|
|
17
|
+
* @note Emulates Array.prototype.findLastIndex
|
|
18
|
+
* @param array The array to search.
|
|
19
|
+
* @param predicate The predicate function to apply to each element.
|
|
20
|
+
* @returns The last index of the array that matches the predicate, or -1 if no element matches.
|
|
21
|
+
*/
|
|
22
|
+
export declare function findLastIndex<T>(array: T[], predicate: (value: T, index: number, obj: T[]) => boolean): number;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the last element of an array that matches the given predicate.
|
|
25
|
+
* @note Emulates Array.prototype.findLast
|
|
26
|
+
* @param array The array to search.
|
|
27
|
+
* @param predicate The predicate function to apply to each element.
|
|
28
|
+
* @returns The last element of the array that matches the predicate, or undefined if no element matches.
|
|
29
|
+
*/
|
|
30
|
+
export declare function findLast<T>(array: T[], predicate: (value: T, index: number, obj: T[]) => boolean): T | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Performs an asynchronous filter operation on an array. This function behaves like Array.prototype.filter, but
|
|
33
|
+
* accepts an asynchronous predicate function.
|
|
34
|
+
* @param array The array to filter.
|
|
35
|
+
* @param predicate The asynchronous predicate function to apply to each element.
|
|
36
|
+
* @returns A promise that resolves to an array of elements that match the predicate.
|
|
37
|
+
*/
|
|
38
|
+
export declare function filterAsync<T>(array: T[], predicate: (value: T, index: number, obj: T[]) => Promise<boolean>): Promise<T[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Performs an asynchronous map operation on an array. This function behaves like Array.prototype.map, but accepts an
|
|
41
|
+
* asynchronous mapper function.
|
|
42
|
+
* @param array The array to map.
|
|
43
|
+
* @param mapper The asynchronous mapper function to apply to each element.
|
|
44
|
+
* @returns A promise that resolves to an array of mapped elements.
|
|
45
|
+
*/
|
|
46
|
+
export declare function mapAsync<T, U>(array: T[], mapper: (value: T, index: number, obj: T[]) => Promise<U>): Promise<U[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Performs an asynchronous reduce operation on an array. This function behaves like Array.prototype.reduce, but
|
|
49
|
+
* accepts an asynchronous reducer function.
|
|
50
|
+
* @param array The array to reduce.
|
|
51
|
+
* @param reducer The asynchronous reducer function to apply to each element.
|
|
52
|
+
* @param initialValue The initial value of the accumulator.
|
|
53
|
+
* @returns A promise that resolves to the final value of the accumulator.
|
|
54
|
+
*/
|
|
55
|
+
export declare function reduceAsync<T, U>(array: T[], reducer: (accumulator: U, currentValue: T, currentIndex: number, obj: T[]) => Promise<U>, initialValue: U): Promise<U>;
|
|
56
|
+
/**
|
|
57
|
+
* Performs an asynchronous forEach operation on an array. This function behaves like Array.prototype.forEach, but
|
|
58
|
+
* accepts an asynchronous callback function.
|
|
59
|
+
* @param array The array to iterate over.
|
|
60
|
+
* @param callback The asynchronous callback function to apply to each element.
|
|
61
|
+
* @returns A promise that resolves to void.
|
|
62
|
+
*/
|
|
63
|
+
export declare function forEachAsync<T>(array: T[], callback: (value: T, index: number, obj: T[]) => Promise<void>): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Performs an asynchronous some operation on an array. This function behaves like Array.prototype.some, but accepts
|
|
66
|
+
* an asynchronous predicate function.
|
|
67
|
+
* @param array The array to search.
|
|
68
|
+
* @param predicate The asynchronous predicate function to apply to each element.
|
|
69
|
+
* @returns A promise that resolves to true if any element matches the predicate, or false if no element matches.
|
|
70
|
+
*/
|
|
71
|
+
export declare function someAsync<T>(array: T[], predicate: (value: T, index: number, obj: T[]) => Promise<boolean>): Promise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Performs an asynchronous every operation on an array. This function behaves like Array.prototype.every, but accepts
|
|
74
|
+
* an asynchronous predicate function.
|
|
75
|
+
* @param array The array to test.
|
|
76
|
+
* @param predicate The asynchronous predicate function to apply to each element.
|
|
77
|
+
* @returns A promise that resolves to true if all elements match the predicate, or false if any element does not match.
|
|
78
|
+
* @note This function uses De Morgan's law to convert the predicate to a negated predicate, and then uses someAsync.
|
|
79
|
+
* This is done because it is more efficient to short-circuit on the first false value than the first true value.
|
|
80
|
+
*/
|
|
81
|
+
export declare function everyAsync<T>(array: T[], predicate: (value: T, index: number, obj: T[]) => Promise<boolean>): Promise<boolean>;
|
|
82
|
+
/**
|
|
83
|
+
* Performs an asynchronous includes operation on an array. This function behaves like Array.prototype.includes, but
|
|
84
|
+
* accepts an asynchronous predicate function.
|
|
85
|
+
* @param array The array to search.
|
|
86
|
+
* @param predicate The asynchronous predicate function to apply to each element.
|
|
87
|
+
* @returns A promise that resolves to true if any element matches the predicate, or false if no element matches.
|
|
88
|
+
* @note This function uses someAsync.
|
|
89
|
+
*/
|
|
90
|
+
export declare function includesAsync<T>(array: T[], predicate: (value: T, index: number, obj: T[]) => Promise<boolean>): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* A generic type guard for arrays of a specific type.
|
|
93
|
+
* @param array The array to test.
|
|
94
|
+
* @param predicate The type guard predicate function to apply to each element.
|
|
95
|
+
* @returns True if the array is an array of the specified type, or false otherwise.
|
|
96
|
+
* @note This function uses Array.prototype.every.
|
|
97
|
+
*/
|
|
98
|
+
export declare function isArrayOf<T>(array: unknown, predicate: (value: unknown) => value is T): array is T[];
|