@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,167 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
import { toBN } from "./BigNumberUtils";
|
|
3
|
+
import { fromWei } from "./common";
|
|
4
|
+
import assert from "assert";
|
|
5
|
+
import { BigNumber } from "bignumber.js";
|
|
6
|
+
// Formats the input to round to decimalPlaces number of decimals if the number has a magnitude larger than 1 and fixes
|
|
7
|
+
// precision to minPrecision if the number has a magnitude less than 1.
|
|
8
|
+
export var formatWithMaxDecimals = function (num, decimalPlaces, minPrecision, roundUp, showSign) {
|
|
9
|
+
if (roundUp) {
|
|
10
|
+
BigNumber.set({ ROUNDING_MODE: BigNumber.ROUND_UP });
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
BigNumber.set({ ROUNDING_MODE: BigNumber.ROUND_DOWN });
|
|
14
|
+
}
|
|
15
|
+
var fullPrecisionFloat = new BigNumber(num);
|
|
16
|
+
var positiveSign = showSign && fullPrecisionFloat.gt(0) ? "+" : "";
|
|
17
|
+
var fixedPrecisionFloat;
|
|
18
|
+
// Convert back to BN to truncate any trailing 0s that the toFixed() output would print. If the number is equal to or larger than
|
|
19
|
+
// 1 then truncate to `decimalPlaces` number of decimal places. EG 999.999 -> 999.99 with decimalPlaces=2 If the number
|
|
20
|
+
// is less than 1 then truncate to minPrecision precision. EG: 0.0022183471 -> 0.002218 with minPrecision=4
|
|
21
|
+
if (fullPrecisionFloat.abs().gte(new BigNumber(1))) {
|
|
22
|
+
fixedPrecisionFloat = new BigNumber(fullPrecisionFloat).toFixed(decimalPlaces).toString();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
fixedPrecisionFloat = new BigNumber(fullPrecisionFloat).toPrecision(minPrecision).toString();
|
|
26
|
+
}
|
|
27
|
+
// This puts commas in the thousands places, but only before the decimal point.
|
|
28
|
+
var fixedPrecisionFloatParts = fixedPrecisionFloat.split(".");
|
|
29
|
+
fixedPrecisionFloatParts[0] = fixedPrecisionFloatParts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
30
|
+
return positiveSign + fixedPrecisionFloatParts.join(".");
|
|
31
|
+
};
|
|
32
|
+
export var createFormatFunction = function (numDisplayedDecimals, minDisplayedPrecision, showSign, decimals) {
|
|
33
|
+
if (showSign === void 0) { showSign = false; }
|
|
34
|
+
if (decimals === void 0) { decimals = 18; }
|
|
35
|
+
return function (valInWei) {
|
|
36
|
+
return formatWithMaxDecimals(formatWei(ConvertDecimals(decimals, 18)(valInWei)), numDisplayedDecimals, minDisplayedPrecision, false, showSign);
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export var formatFeePct = function (relayerFeePct) {
|
|
40
|
+
// 1e18 = 100% so 1e16 = 1%.
|
|
41
|
+
return createFormatFunction(2, 4, false, 16)(toBN(relayerFeePct).toString());
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Shortens a lengthy hexadecimal string to a shorter version with an ellipsis in the middle.
|
|
45
|
+
* @param hex A hexadecimal string to be shortened.
|
|
46
|
+
* @param maxLength The maximum length of the shortened string. Defaults to 8.
|
|
47
|
+
* @param delimiter The delimiter to use in the middle of the shortened string. Defaults to "...".
|
|
48
|
+
* @returns The shortened hexadecimal string.
|
|
49
|
+
* @example createShortHexString("0x772871a444c6e4e9903d8533a5a13101b74037158123e6709470f0afbf6e7d94") -> "0x7787...7d94"
|
|
50
|
+
*/
|
|
51
|
+
export function createShortHexString(hex, maxLength, delimiter) {
|
|
52
|
+
if (maxLength === void 0) { maxLength = 8; }
|
|
53
|
+
if (delimiter === void 0) { delimiter = ".."; }
|
|
54
|
+
// If we have more maxLength then the hex size, we can simply
|
|
55
|
+
// return the hex directly.
|
|
56
|
+
if (hex.length <= maxLength) {
|
|
57
|
+
return hex;
|
|
58
|
+
}
|
|
59
|
+
// Resolve the maximum available after we account for the delimiter.
|
|
60
|
+
var maxAvailable = maxLength - delimiter.length;
|
|
61
|
+
// Sanity check to make sure we have enough characters to
|
|
62
|
+
// create a shortened version.
|
|
63
|
+
if (maxAvailable <= 0) {
|
|
64
|
+
throw new Error("Invalid max length");
|
|
65
|
+
}
|
|
66
|
+
// We can simulate rounding by adding 0.5 to the integer. If
|
|
67
|
+
// we had an odd division, the floor will add one additional
|
|
68
|
+
// character to the left side.
|
|
69
|
+
var leftCharacters = Math.floor(maxAvailable / 2 + 0.5);
|
|
70
|
+
// A simple floor division between the max character length
|
|
71
|
+
var rightCharacters = Math.floor(maxAvailable / 2);
|
|
72
|
+
// Combine the two sides with the delimiter in the middle.
|
|
73
|
+
return "".concat(hex.substring(0, leftCharacters)).concat(delimiter).concat(hex.substring(hex.length - rightCharacters));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Converts a utf8 string to a hex string.
|
|
77
|
+
* @param input The utf8 string to convert.
|
|
78
|
+
* @returns The hex string.
|
|
79
|
+
*/
|
|
80
|
+
export function utf8ToHex(input) {
|
|
81
|
+
return ethers.utils.formatBytes32String(input);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Converts a hexadecimal string to a utf8 string.
|
|
85
|
+
* @param input The hexadecimal string to convert.
|
|
86
|
+
* @returns The utf8 string.
|
|
87
|
+
*/
|
|
88
|
+
export function hexToUtf8(input) {
|
|
89
|
+
return ethers.utils.toUtf8String(input);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Converts a BigNumber to a 32-byte hexadecimal string.
|
|
93
|
+
*
|
|
94
|
+
* @param input - The BigNumber to convert.
|
|
95
|
+
* @returns The 32-byte hexadecimal string representation of the input.
|
|
96
|
+
*/
|
|
97
|
+
export function bnToHex(input) {
|
|
98
|
+
return ethers.utils.hexZeroPad(ethers.utils.hexlify(toBN(input)), 32);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Converts a value from wei to a decimal value with the specified number of decimal places.
|
|
102
|
+
* @param weiVal - The value in wei to convert.
|
|
103
|
+
* @param decimals - The number of decimal places to include in the converted value.
|
|
104
|
+
* @returns The converted value as a string.
|
|
105
|
+
*/
|
|
106
|
+
export function convertFromWei(weiVal, decimals) {
|
|
107
|
+
var formatFunction = createFormatFunction(2, 4, false, decimals);
|
|
108
|
+
return formatFunction(weiVal);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Shortens a list of addresses to a shorter version with only the first 10 characters.
|
|
112
|
+
* @param addresses A list of addresses to shorten.
|
|
113
|
+
* @returns A list of shortened addresses.
|
|
114
|
+
* @see createShortHexString
|
|
115
|
+
*/
|
|
116
|
+
export function shortenHexStrings(addresses) {
|
|
117
|
+
return addresses.map(function (h) { return createShortHexString(h); });
|
|
118
|
+
}
|
|
119
|
+
// formatWei converts a string or BN instance from Wei to Ether, e.g., 1e19 -> 10.
|
|
120
|
+
export var formatWei = function (num) {
|
|
121
|
+
// Web3's `fromWei` function doesn't work on BN objects in minified mode (e.g.,
|
|
122
|
+
// `web3.utils.isBN(web3.utils.fromBN("5"))` is false), so we use a workaround where we always pass in strings.
|
|
123
|
+
// See https://github.com/ethereum/web3.js/issues/1777.
|
|
124
|
+
return fromWei(num.toString());
|
|
125
|
+
};
|
|
126
|
+
// Take an amount based on fromDecimals and convert it to an amount based on toDecimals. For example 100 usdt = 100e6,
|
|
127
|
+
// with 6 decimals. If you wanted to convert this to a base 18 decimals you would get:
|
|
128
|
+
// convertDecimals(6,18)(100000000) => 100000000000000000000 = 100e18.
|
|
129
|
+
// Returns a BigNumber you will need to call toString on
|
|
130
|
+
// fromDecimals: number - decimal value of amount
|
|
131
|
+
// toDecimals: number - decimal value to convert to
|
|
132
|
+
// web3: web3 object to get a big number function.
|
|
133
|
+
// return => (amount:string)=>BN
|
|
134
|
+
export var ConvertDecimals = function (fromDecimals, toDecimals) {
|
|
135
|
+
assert(fromDecimals >= 0, "requires fromDecimals as an integer >= 0");
|
|
136
|
+
assert(toDecimals >= 0, "requires toDecimals as an integer >= 0");
|
|
137
|
+
// amount: string, BN, number - integer amount in fromDecimals smallest unit that want to convert toDecimals
|
|
138
|
+
// returns: BN with toDecimals in smallest unit
|
|
139
|
+
return function (amountIn) {
|
|
140
|
+
var amount = toBN(amountIn.toString());
|
|
141
|
+
if (amount.isZero())
|
|
142
|
+
return amount;
|
|
143
|
+
var diff = fromDecimals - toDecimals;
|
|
144
|
+
if (diff == 0)
|
|
145
|
+
return amount;
|
|
146
|
+
if (diff > 0)
|
|
147
|
+
return amount.div(toBN("10").pow(toBN(diff.toString())));
|
|
148
|
+
return amount.mul(toBN("10").pow(toBN((-1 * diff).toString())));
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Converts a numeric decimal-inclusive string to winston, the base unit of Arweave
|
|
153
|
+
* @param numericString The numeric string to convert
|
|
154
|
+
* @returns The winston representation of the numeric string as a BigNumber
|
|
155
|
+
*/
|
|
156
|
+
export function parseWinston(numericString) {
|
|
157
|
+
return ethers.utils.parseUnits(numericString, 12);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Converts a winston value to a numeric string
|
|
161
|
+
* @param winstonValue The winston value to convert
|
|
162
|
+
* @returns The numeric string representation of the winston value
|
|
163
|
+
*/
|
|
164
|
+
export function formatWinston(winstonValue) {
|
|
165
|
+
return ethers.utils.formatUnits(winstonValue, 12);
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=FormattingUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormattingUtils.js","sourceRoot":"","sources":["../../../src/utils/FormattingUtils.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import PinataClient from "@pinata/sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Build an IPFS client for interacting with the IPFS API
|
|
4
|
+
* @param APIKey The project ID
|
|
5
|
+
* @param secretAPIKey The project secret
|
|
6
|
+
* @returns An IPFS client for interacting with Pinata
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildIPFSClient(APIKey: string, secretAPIKey: string): PinataClient;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves a value from an IPFS gateway
|
|
11
|
+
* @param contentHash The content hash of the value to retrieve
|
|
12
|
+
* @param publicGatewayURL The URL of the public IPFS gateway to use
|
|
13
|
+
* @returns The value retrieved from the IPFS gateway
|
|
14
|
+
* @throws Error if the value could not be retrieved
|
|
15
|
+
*/
|
|
16
|
+
export declare function retrieveValueFromIPFS(contentHash: string, publicGatewayURL: string): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Pins a value to the IPFS network
|
|
19
|
+
* @param key A key to use for pinning the value. This is a metadata field.
|
|
20
|
+
* @param content The value to pin
|
|
21
|
+
* @param client The IPFS client to use
|
|
22
|
+
* @returns The content hash of the pinned value
|
|
23
|
+
*/
|
|
24
|
+
export declare function storeValueInIPFS(key: string, content: string, client: PinataClient): Promise<string>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import PinataClient from "@pinata/sdk";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
/**
|
|
5
|
+
* Build an IPFS client for interacting with the IPFS API
|
|
6
|
+
* @param APIKey The project ID
|
|
7
|
+
* @param secretAPIKey The project secret
|
|
8
|
+
* @returns An IPFS client for interacting with Pinata
|
|
9
|
+
*/
|
|
10
|
+
export function buildIPFSClient(APIKey, secretAPIKey) {
|
|
11
|
+
return new PinataClient(APIKey, secretAPIKey);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves a value from an IPFS gateway
|
|
15
|
+
* @param contentHash The content hash of the value to retrieve
|
|
16
|
+
* @param publicGatewayURL The URL of the public IPFS gateway to use
|
|
17
|
+
* @returns The value retrieved from the IPFS gateway
|
|
18
|
+
* @throws Error if the value could not be retrieved
|
|
19
|
+
*/
|
|
20
|
+
export function retrieveValueFromIPFS(contentHash, publicGatewayURL) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
22
|
+
var result;
|
|
23
|
+
return __generator(this, function (_a) {
|
|
24
|
+
switch (_a.label) {
|
|
25
|
+
case 0: return [4 /*yield*/, axios.get("".concat(publicGatewayURL, "/ipfs/").concat(contentHash), {
|
|
26
|
+
// We need to set the Accept header to text/plain to avoid
|
|
27
|
+
// any anomalies with the response
|
|
28
|
+
headers: {
|
|
29
|
+
Accept: "text/plain",
|
|
30
|
+
},
|
|
31
|
+
// We want just the raw response, not the parsed response
|
|
32
|
+
transformResponse: function (r) { return r; },
|
|
33
|
+
})];
|
|
34
|
+
case 1:
|
|
35
|
+
result = _a.sent();
|
|
36
|
+
return [2 /*return*/, result.data];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Pins a value to the IPFS network
|
|
43
|
+
* @param key A key to use for pinning the value. This is a metadata field.
|
|
44
|
+
* @param content The value to pin
|
|
45
|
+
* @param client The IPFS client to use
|
|
46
|
+
* @returns The content hash of the pinned value
|
|
47
|
+
*/
|
|
48
|
+
export function storeValueInIPFS(key, content, client) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
var result;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, client.pinJSONToIPFS(JSON.parse(content), {
|
|
54
|
+
pinataMetadata: {
|
|
55
|
+
name: key,
|
|
56
|
+
},
|
|
57
|
+
})];
|
|
58
|
+
case 1:
|
|
59
|
+
result = _a.sent();
|
|
60
|
+
return [2 /*return*/, result.IpfsHash];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=IPFSUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPFSUtils.js","sourceRoot":"","sources":["../../../src/utils/IPFSUtils.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,YAAoB;IAClE,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAgB,qBAAqB,CAAC,WAAmB,EAAE,gBAAwB;;;;;wBACxE,qBAAM,KAAK,CAAC,GAAG,CAAC,UAAG,gBAAgB,mBAAS,WAAW,CAAE,EAAE;wBACxE,0DAA0D;wBAC1D,kCAAkC;wBAClC,OAAO,EAAE;4BACP,MAAM,EAAE,YAAY;yBACrB;wBACD,yDAAyD;wBACzD,iBAAiB,EAAE,UAAC,CAAC,IAAK,OAAA,CAAC,EAAD,CAAC;qBAC5B,CAAC,EAAA;;oBARI,MAAM,GAAG,SAQb;oBACF,sBAAO,MAAM,CAAC,IAAI,EAAC;;;;CACpB;AAED;;;;;;GAMG;AACH,MAAM,UAAgB,gBAAgB,CAAC,GAAW,EAAE,OAAe,EAAE,MAAoB;;;;;wBACxE,qBAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;wBAC7D,cAAc,EAAE;4BACd,IAAI,EAAE,GAAG;yBACV;qBACF,CAAC,EAAA;;oBAJI,MAAM,GAAG,SAIb;oBACF,sBAAO,MAAM,CAAC,QAAQ,EAAC;;;;CACxB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function converts a JSON string into a JSON object. The caveat is that if
|
|
3
|
+
* the parser detects a number, it will convert it to a string and floor it to
|
|
4
|
+
* an integer. This function will not throw but instead return an undefined value
|
|
5
|
+
* if the JSON string is invalid.
|
|
6
|
+
* @param jsonString The JSON string to parse
|
|
7
|
+
* @returns The parsed JSON object or undefined if the JSON string is invalid
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseJSONWithNumericString(jsonString: string): unknown | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* This function converts an object into a JSON string. The caveat is that if
|
|
12
|
+
* the parser detects a BigNumber or BN, it will convert it to a string.
|
|
13
|
+
* @param obj The object to stringify
|
|
14
|
+
* @returns The stringified JSON object
|
|
15
|
+
* @throws Error if the object cannot be stringified
|
|
16
|
+
*/
|
|
17
|
+
export declare function stringifyJSONWithNumericString(obj: unknown): string;
|
|
18
|
+
/**
|
|
19
|
+
* A replacer for use in `JSON.stringify` that converts big numbers to numeric strings.
|
|
20
|
+
* @param _key Unused
|
|
21
|
+
* @param value The value to convert
|
|
22
|
+
* @returns The converted value
|
|
23
|
+
*/
|
|
24
|
+
export declare function jsonReplacerWithBigNumbers(_key: string, value: unknown): unknown;
|
|
25
|
+
/**
|
|
26
|
+
* A reviver for use in `JSON.parse` that converts numeric strings to big numbers.
|
|
27
|
+
* @param _key Unused
|
|
28
|
+
* @param value The value to convert
|
|
29
|
+
* @returns The converted value
|
|
30
|
+
*/
|
|
31
|
+
export declare function jsonReviverWithBigNumbers(_key: string, value: unknown): unknown;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { BigNumber } from "ethers";
|
|
2
|
+
import { isDefined } from "./TypeGuards";
|
|
3
|
+
/**
|
|
4
|
+
* This function converts a JSON string into a JSON object. The caveat is that if
|
|
5
|
+
* the parser detects a number, it will convert it to a string and floor it to
|
|
6
|
+
* an integer. This function will not throw but instead return an undefined value
|
|
7
|
+
* if the JSON string is invalid.
|
|
8
|
+
* @param jsonString The JSON string to parse
|
|
9
|
+
* @returns The parsed JSON object or undefined if the JSON string is invalid
|
|
10
|
+
*/
|
|
11
|
+
export function parseJSONWithNumericString(jsonString) {
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(jsonString, function (_key, value) {
|
|
14
|
+
if (typeof value === "number") {
|
|
15
|
+
return String(Math.floor(value));
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* This function converts an object into a JSON string. The caveat is that if
|
|
26
|
+
* the parser detects a BigNumber or BN, it will convert it to a string.
|
|
27
|
+
* @param obj The object to stringify
|
|
28
|
+
* @returns The stringified JSON object
|
|
29
|
+
* @throws Error if the object cannot be stringified
|
|
30
|
+
*/
|
|
31
|
+
export function stringifyJSONWithNumericString(obj) {
|
|
32
|
+
return JSON.stringify(obj, function (_key, value) {
|
|
33
|
+
if (typeof value === "object" && value !== null && value.type === "BigNumber") {
|
|
34
|
+
return BigNumber.from(value).toString();
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A replacer for use in `JSON.stringify` that converts big numbers to numeric strings.
|
|
41
|
+
* @param _key Unused
|
|
42
|
+
* @param value The value to convert
|
|
43
|
+
* @returns The converted value
|
|
44
|
+
*/
|
|
45
|
+
export function jsonReplacerWithBigNumbers(_key, value) {
|
|
46
|
+
// If the value is not defined (null or undefined), return it as is
|
|
47
|
+
if (!isDefined(value)) {
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
// We need to check if this is a big number, because the JSON parser
|
|
51
|
+
// is not aware of BigNumbers and will convert them to the string representation
|
|
52
|
+
// of the object itself which is not what we want.
|
|
53
|
+
if (BigNumber.isBigNumber(value)) {
|
|
54
|
+
return value.toString();
|
|
55
|
+
}
|
|
56
|
+
// There's a legacy issues that returns BigNumbers as { type: "BigNumber", hex: "0x..." }
|
|
57
|
+
// so we need to check for that as well.
|
|
58
|
+
var recordValue = value;
|
|
59
|
+
if (recordValue.type === "BigNumber" && isDefined(recordValue.hex)) {
|
|
60
|
+
return BigNumber.from(recordValue.hex).toString();
|
|
61
|
+
}
|
|
62
|
+
// Return the value as is
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A reviver for use in `JSON.parse` that converts numeric strings to big numbers.
|
|
67
|
+
* @param _key Unused
|
|
68
|
+
* @param value The value to convert
|
|
69
|
+
* @returns The converted value
|
|
70
|
+
*/
|
|
71
|
+
export function jsonReviverWithBigNumbers(_key, value) {
|
|
72
|
+
// We need to check for both strings and big numbers, because the JSON parser
|
|
73
|
+
// is not aware of BigNumbers.
|
|
74
|
+
if (typeof value === "string" && /^-?\d+$/.test(value)) {
|
|
75
|
+
var bigNumber = BigNumber.from(value);
|
|
76
|
+
if (bigNumber.toString() === value) {
|
|
77
|
+
return bigNumber;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=JSONUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONUtils.js","sourceRoot":"","sources":["../../../src/utils/JSONUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CAAC,UAAkB;IAC3D,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,UAAC,IAAI,EAAE,KAAK;YACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;aAClC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAAC,GAAY;IACzD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,UAAC,IAAI,EAAE,KAAK;QACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE;YAC7E,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;SACzC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAY,EAAE,KAAc;IACrE,mEAAmE;IACnE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACrB,OAAO,KAAK,CAAC;KACd;IAED,oEAAoE;IACpE,gFAAgF;IAChF,kDAAkD;IAClD,IAAI,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;QAChC,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;KACzB;IACD,yFAAyF;IACzF,wCAAwC;IACxC,IAAM,WAAW,GAAG,KAAsC,CAAC;IAC3D,IAAI,WAAW,CAAC,IAAI,KAAK,WAAW,IAAI,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;QAClE,OAAO,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;KACnD;IACD,yBAAyB;IACzB,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAY,EAAE,KAAc;IACpE,6EAA6E;IAC7E,8BAA8B;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACtD,IAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI,SAAS,CAAC,QAAQ,EAAE,KAAK,KAAK,EAAE;YAClC,OAAO,SAAS,CAAC;SAClB;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Logger } from "winston";
|
|
2
|
+
export type DefaultLogLevels = "debug" | "info" | "warn" | "error";
|
|
3
|
+
type LogParamType = {
|
|
4
|
+
level: DefaultLogLevels;
|
|
5
|
+
message: string;
|
|
6
|
+
at: {
|
|
7
|
+
location: string;
|
|
8
|
+
function: string;
|
|
9
|
+
};
|
|
10
|
+
data?: Record<string | number, unknown>;
|
|
11
|
+
};
|
|
12
|
+
export declare function formattedLog(logger: Logger | undefined, { level, message, at: { location, function: fnName }, data }: LogParamType): void;
|
|
13
|
+
/**
|
|
14
|
+
* Asserts the truth of a condition. If the condition is false, an error is thrown with the provided message.
|
|
15
|
+
* @param condition The condition to assert.
|
|
16
|
+
* @param message The message to throw if the condition is false.
|
|
17
|
+
* @throws Error if the condition is false.
|
|
18
|
+
*/
|
|
19
|
+
export declare function assert(condition: boolean, message: string): void;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
export function formattedLog(logger, _a) {
|
|
3
|
+
var level = _a.level, message = _a.message, _b = _a.at, location = _b.location, fnName = _b.function, data = _a.data;
|
|
4
|
+
if (logger) {
|
|
5
|
+
logger[level](__assign({ at: "".concat(location, "#").concat(fnName), message: message }, data));
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Asserts the truth of a condition. If the condition is false, an error is thrown with the provided message.
|
|
10
|
+
* @param condition The condition to assert.
|
|
11
|
+
* @param message The message to throw if the condition is false.
|
|
12
|
+
* @throws Error if the condition is false.
|
|
13
|
+
*/
|
|
14
|
+
export function assert(condition, message) {
|
|
15
|
+
if (!condition) {
|
|
16
|
+
throw new Error(message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=LogUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogUtils.js","sourceRoot":"","sources":["../../../src/utils/LogUtils.ts"],"names":[],"mappings":";AAcA,MAAM,UAAU,YAAY,CAC1B,MAA0B,EAC1B,EAA0E;QAAxE,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,UAAkC,EAA5B,QAAQ,cAAA,EAAY,MAAM,cAAA,EAAI,IAAI,UAAA;IAE1D,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,KAAK,CAAC,YACX,EAAE,EAAE,UAAG,QAAQ,cAAI,MAAM,CAAE,EAC3B,OAAO,SAAA,IACJ,IAAI,EACP,CAAC;KACJ;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,SAAkB,EAAE,OAAe;IACxD,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KAC1B;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Contract, providers, Signer, utils as ethersUtils } from "ethers";
|
|
2
|
+
type Provider = providers.Provider;
|
|
3
|
+
type BlockTag = providers.BlockTag;
|
|
4
|
+
type Result = ethersUtils.Result;
|
|
5
|
+
export type Call3 = {
|
|
6
|
+
contract: Contract;
|
|
7
|
+
method: string;
|
|
8
|
+
args?: any[];
|
|
9
|
+
};
|
|
10
|
+
export declare const multicall3Addresses: Record<number, string>;
|
|
11
|
+
export declare function getMulticall3(chainId: number, signerOrProvider?: Signer | Provider): Promise<Contract | undefined>;
|
|
12
|
+
export declare function aggregate(multicall3: Contract, calls: Call3[], blockTag?: BlockTag): Promise<Result[]>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { Contract } from "ethers";
|
|
3
|
+
import { getABI } from "./abi";
|
|
4
|
+
// Multicall3 Constants:
|
|
5
|
+
export var multicall3Addresses = {
|
|
6
|
+
1: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
7
|
+
10: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
8
|
+
137: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
9
|
+
324: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
|
|
10
|
+
8453: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
11
|
+
34443: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
12
|
+
42161: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
13
|
+
59144: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
14
|
+
534352: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
15
|
+
// Testnets
|
|
16
|
+
5: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
17
|
+
300: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
|
|
18
|
+
59140: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
19
|
+
59141: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
20
|
+
80002: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
21
|
+
84531: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
22
|
+
84532: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
23
|
+
421613: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
24
|
+
534351: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
25
|
+
11155111: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
26
|
+
11155420: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
27
|
+
};
|
|
28
|
+
export function getMulticall3(chainId, signerOrProvider) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30
|
+
var address, _a, _b;
|
|
31
|
+
return __generator(this, function (_c) {
|
|
32
|
+
switch (_c.label) {
|
|
33
|
+
case 0:
|
|
34
|
+
address = multicall3Addresses[chainId];
|
|
35
|
+
if (!address) {
|
|
36
|
+
return [2 /*return*/, undefined];
|
|
37
|
+
}
|
|
38
|
+
_a = Contract.bind;
|
|
39
|
+
_b = [void 0, address];
|
|
40
|
+
return [4 /*yield*/, getABI("Multicall3")];
|
|
41
|
+
case 1: return [2 /*return*/, new (_a.apply(Contract, _b.concat([_c.sent(), signerOrProvider])))()];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function aggregate(multicall3, calls, blockTag) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
var inputs, _a, results;
|
|
49
|
+
return __generator(this, function (_b) {
|
|
50
|
+
switch (_b.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
inputs = calls.map(function (_a) {
|
|
53
|
+
var contract = _a.contract, method = _a.method, args = _a.args;
|
|
54
|
+
return ({
|
|
55
|
+
target: contract.address,
|
|
56
|
+
callData: contract.interface.encodeFunctionData(method, args),
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
return [4 /*yield*/, multicall3.callStatic.aggregate(inputs, { blockTag: blockTag })];
|
|
60
|
+
case 1:
|
|
61
|
+
_a = _b.sent(), results = _a[1];
|
|
62
|
+
return [2 /*return*/, results.map(function (result, idx) {
|
|
63
|
+
var _a = calls[idx], contract = _a.contract, method = _a.method;
|
|
64
|
+
return contract.interface.decodeFunctionResult(method, result);
|
|
65
|
+
})];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=Multicall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Multicall.js","sourceRoot":"","sources":["../../../src/utils/Multicall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAa,QAAQ,EAA2C,MAAM,QAAQ,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAa/B,wBAAwB;AACxB,MAAM,CAAC,IAAM,mBAAmB,GAA2B;IACzD,CAAC,EAAE,4CAA4C;IAC/C,EAAE,EAAE,4CAA4C;IAChD,GAAG,EAAE,4CAA4C;IACjD,GAAG,EAAE,4CAA4C;IACjD,IAAI,EAAE,4CAA4C;IAClD,KAAK,EAAE,4CAA4C;IACnD,KAAK,EAAE,4CAA4C;IACnD,KAAK,EAAE,4CAA4C;IACnD,MAAM,EAAE,4CAA4C;IACpD,WAAW;IACX,CAAC,EAAE,4CAA4C;IAC/C,GAAG,EAAE,4CAA4C;IACjD,KAAK,EAAE,4CAA4C;IACnD,KAAK,EAAE,4CAA4C;IACnD,KAAK,EAAE,4CAA4C;IACnD,KAAK,EAAE,4CAA4C;IACnD,KAAK,EAAE,4CAA4C;IACnD,MAAM,EAAE,4CAA4C;IACpD,MAAM,EAAE,4CAA4C;IACpD,QAAQ,EAAE,4CAA4C;IACtD,QAAQ,EAAE,4CAA4C;CACvD,CAAC;AAEF,MAAM,UAAgB,aAAa,CACjC,OAAe,EACf,gBAAoC;;;;;;oBAE9B,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;oBAC7C,IAAI,CAAC,OAAO,EAAE;wBACZ,sBAAO,SAAS,EAAC;qBAClB;yBAEU,QAAQ;kCAAC,OAAO;oBAAE,qBAAM,MAAM,CAAC,YAAY,CAAC,EAAA;wBAAvD,sBAAO,cAAI,QAAQ,aAAU,SAA0B,EAAE,gBAAgB,MAAC,EAAC;;;;CAC5E;AAED,MAAM,UAAgB,SAAS,CAAC,UAAoB,EAAE,KAAc,EAAE,QAAmB;;;;;;oBACjF,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,EAA0B;4BAAxB,QAAQ,cAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAA;wBAAO,OAAA,CAAC;4BACxD,MAAM,EAAE,QAAQ,CAAC,OAAO;4BACxB,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC;yBAC9D,CAAC;oBAHuD,CAGvD,CAAC,CAAC;oBAEgB,qBAAO,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,QAAQ,UAAA,EAAE,CAAoC,EAAA;;oBAA7G,KAAc,SAA+F,EAA1G,OAAO,QAAA;oBAEhB,sBAAO,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,GAAG;4BACvB,IAAA,KAAuB,KAAK,CAAC,GAAG,CAAC,EAA/B,QAAQ,cAAA,EAAE,MAAM,YAAe,CAAC;4BACxC,OAAO,QAAQ,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;wBACjE,CAAC,CAAC,EAAC;;;;CACJ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a network name from a network id.
|
|
3
|
+
* @param networkId The network id to resolve the name for
|
|
4
|
+
* @returns The network name for the network id. If the network id is not found, returns "unknown"
|
|
5
|
+
*/
|
|
6
|
+
export declare function getNetworkName(networkId: number | string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves a native token symbol from a chain id.
|
|
9
|
+
* @param chainId The chain id to resolve the native token symbol for
|
|
10
|
+
* @returns The native token symbol for the chain id. If the chain id is not found, returns "ETH"
|
|
11
|
+
*/
|
|
12
|
+
export declare function getNativeTokenSymbol(chainId: number | string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Determines whether a chain ID is part of the production network.
|
|
15
|
+
* @param chainId Chain ID to query.
|
|
16
|
+
* @returns true if the chain ID is part of the production network, otherwise false.
|
|
17
|
+
*/
|
|
18
|
+
export declare function chainIsProd(chainId: number): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Determines whether a chain ID is part of the production network.
|
|
21
|
+
* @param chainId Chain ID to query.
|
|
22
|
+
* @returns true if the chain ID is part of the production network, otherwise false.
|
|
23
|
+
*/
|
|
24
|
+
export declare function chainIsTestnet(chainId: number): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Determines whether a chain ID is a Polygon implementation.
|
|
27
|
+
* @param chainId Chain ID to evaluate.
|
|
28
|
+
* @returns True if chainId is a Polygon chain (mainnet or testnet), otherwise false.
|
|
29
|
+
*/
|
|
30
|
+
export declare function chainIsMatic(chainId: number): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Determines whether a chain ID is an Optimism OP Stack implementation.
|
|
33
|
+
* @param chainId Chain ID to evaluate.
|
|
34
|
+
* @returns True if chainId is an OP stack, otherwise false.
|
|
35
|
+
*/
|
|
36
|
+
export declare function chainIsOPStack(chainId: number): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Determines whether a chain ID is an Arbitrum implementation.
|
|
39
|
+
* @param chainId Chain ID to evaluate.
|
|
40
|
+
* @returns True if chainId is an Arbitrum chain, otherwise false.
|
|
41
|
+
*/
|
|
42
|
+
export declare function chainIsArbitrum(chainId: number): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Determines whether a chain ID is a Linea implementation.
|
|
45
|
+
* @param chainId Chain ID to evaluate.
|
|
46
|
+
* @returns True if chainId is a Linea chain, otherwise false.
|
|
47
|
+
*/
|
|
48
|
+
export declare function chainIsLinea(chainId: number): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Determines whether a chain ID has the capacity for having its USDC bridged via CCTP.
|
|
51
|
+
* @param chainId Chain ID to evaluate.
|
|
52
|
+
* @returns True if chainId is a CCTP-bridging enabled chain, otherwise false.
|
|
53
|
+
*/
|
|
54
|
+
export declare function chainIsCCTPEnabled(chainId: number): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Determines if a chain ID requires a manual L1 -> L2 finalization step.
|
|
57
|
+
* @param chainId Chain ID to evaluate.
|
|
58
|
+
* @returns True if chainId requires manual L1 -> L2 finalization, otherwise false.
|
|
59
|
+
*/
|
|
60
|
+
export declare function chainRequiresL1ToL2Finalization(chainId: number): boolean;
|