@across-protocol/sdk 4.1.63 → 4.2.1
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/dist/cjs/arch/evm/BlockUtils.d.ts +15 -0
- package/dist/cjs/arch/evm/BlockUtils.js +218 -0
- package/dist/cjs/arch/evm/BlockUtils.js.map +1 -0
- package/dist/cjs/arch/evm/SpokeUtils.d.ts +1 -1
- package/dist/cjs/arch/evm/SpokeUtils.js +6 -5
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/evm/index.d.ts +1 -0
- package/dist/cjs/arch/evm/index.js +1 -0
- package/dist/cjs/arch/evm/index.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +20 -0
- package/dist/cjs/arch/svm/SpokeUtils.js +449 -0
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -0
- package/dist/cjs/arch/svm/constants.d.ts +2 -0
- package/dist/cjs/arch/svm/constants.js +7 -0
- package/dist/cjs/arch/svm/constants.js.map +1 -0
- package/dist/cjs/arch/svm/eventsClient.d.ts +26 -0
- package/dist/cjs/arch/svm/eventsClient.js +253 -0
- package/dist/cjs/arch/svm/eventsClient.js.map +1 -0
- package/dist/cjs/arch/svm/index.d.ts +5 -1
- package/dist/cjs/arch/svm/index.js +6 -2
- package/dist/cjs/arch/svm/index.js.map +1 -1
- package/dist/cjs/{svm → arch/svm}/types.d.ts +9 -4
- package/dist/cjs/arch/svm/types.js.map +1 -0
- package/dist/cjs/arch/svm/utils.d.ts +18 -0
- package/dist/cjs/arch/svm/utils.js +212 -0
- package/dist/cjs/arch/svm/utils.js.map +1 -0
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BaseAbstractClient.d.ts +6 -5
- package/dist/cjs/clients/BaseAbstractClient.js +30 -19
- package/dist/cjs/clients/BaseAbstractClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +15 -11
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
- package/dist/cjs/clients/HubPoolClient.d.ts +4 -3
- package/dist/cjs/clients/HubPoolClient.js +18 -17
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +23 -20
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +23 -0
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +172 -0
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -0
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -5
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +54 -57
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/index.d.ts +3 -0
- package/dist/cjs/clients/SpokePoolClient/index.js +8 -1
- package/dist/cjs/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/cjs/clients/index.d.ts +1 -1
- package/dist/cjs/clients/index.js +2 -1
- package/dist/cjs/clients/index.js.map +1 -1
- package/dist/cjs/clients/mocks/MockConfigStoreClient.d.ts +1 -1
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js +2 -2
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +2 -2
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +7 -4
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +33 -0
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +184 -0
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -0
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +30 -0
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +90 -0
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -0
- package/dist/cjs/clients/mocks/index.d.ts +2 -0
- package/dist/cjs/clients/mocks/index.js +2 -0
- package/dist/cjs/clients/mocks/index.js.map +1 -1
- package/dist/cjs/coingecko/Coingecko.d.ts +3 -2
- package/dist/cjs/coingecko/Coingecko.js +11 -3
- package/dist/cjs/coingecko/Coingecko.js.map +1 -1
- package/dist/cjs/constants.d.ts +1 -0
- package/dist/cjs/constants.js +2 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/ethereum.d.ts +4 -4
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/linea-viem.js +3 -2
- package/dist/cjs/gasPriceOracle/adapters/linea-viem.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/polygon.d.ts +3 -3
- package/dist/cjs/gasPriceOracle/adapters/solana.d.ts +4 -0
- package/dist/cjs/gasPriceOracle/adapters/solana.js +43 -0
- package/dist/cjs/gasPriceOracle/adapters/solana.js.map +1 -0
- package/dist/cjs/gasPriceOracle/index.d.ts +1 -1
- package/dist/cjs/gasPriceOracle/oracle.d.ts +4 -3
- package/dist/cjs/gasPriceOracle/oracle.js +16 -9
- package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/gasPriceOracle/types.d.ts +6 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/SpokePool.d.ts +13 -0
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/providers/index.d.ts +1 -1
- package/dist/cjs/providers/index.js +1 -2
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.d.ts +5 -0
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js +21 -0
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js.map +1 -0
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +5 -0
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js +20 -0
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +1 -0
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.d.ts +13 -0
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js +76 -0
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js.map +1 -0
- package/dist/cjs/providers/mocks/index.d.ts +4 -0
- package/dist/cjs/providers/mocks/index.js +8 -0
- package/dist/cjs/providers/mocks/index.js.map +1 -0
- package/dist/cjs/providers/{mockProvider.js → mocks/mockEthersProvider.js} +2 -2
- package/dist/cjs/providers/mocks/mockEthersProvider.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +10 -8
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +8 -2
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +37 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +171 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +2 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +9 -3
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +9 -3
- package/dist/cjs/utils/AddressUtils.js +36 -6
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/ArrayUtils.d.ts +1 -0
- package/dist/cjs/utils/ArrayUtils.js +6 -1
- package/dist/cjs/utils/ArrayUtils.js.map +1 -1
- package/dist/cjs/utils/BlockFinder.d.ts +22 -0
- package/dist/cjs/utils/BlockFinder.js +10 -0
- package/dist/cjs/utils/BlockFinder.js.map +1 -0
- package/dist/cjs/utils/BlockUtils.d.ts +2 -27
- package/dist/cjs/utils/BlockUtils.js +2 -208
- package/dist/cjs/utils/BlockUtils.js.map +1 -1
- package/dist/cjs/utils/EventUtils.d.ts +4 -4
- package/dist/cjs/utils/EventUtils.js +7 -4
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/JSONUtils.js +3 -0
- package/dist/cjs/utils/JSONUtils.js.map +1 -1
- package/dist/cjs/utils/NumberUtils.d.ts +1 -0
- package/dist/cjs/utils/NumberUtils.js +7 -1
- package/dist/cjs/utils/NumberUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.js +5 -0
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.js +4 -1
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/arch/evm/BlockUtils.d.ts +24 -0
- package/dist/esm/arch/evm/BlockUtils.js +250 -0
- package/dist/esm/arch/evm/BlockUtils.js.map +1 -0
- package/dist/esm/arch/evm/SpokeUtils.d.ts +1 -1
- package/dist/esm/arch/evm/SpokeUtils.js +6 -5
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/evm/index.d.ts +1 -0
- package/dist/esm/arch/evm/index.js +1 -0
- package/dist/esm/arch/evm/index.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +122 -0
- package/dist/esm/arch/svm/SpokeUtils.js +566 -0
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -0
- package/dist/esm/arch/svm/constants.d.ts +2 -0
- package/dist/esm/arch/svm/constants.js +3 -0
- package/dist/esm/arch/svm/constants.js.map +1 -0
- package/dist/esm/arch/svm/eventsClient.d.ts +87 -0
- package/dist/esm/arch/svm/eventsClient.js +316 -0
- package/dist/esm/arch/svm/eventsClient.js.map +1 -0
- package/dist/esm/arch/svm/index.d.ts +5 -1
- package/dist/esm/arch/svm/index.js +5 -1
- package/dist/esm/arch/svm/index.js.map +1 -1
- package/dist/esm/{svm → arch/svm}/types.d.ts +9 -4
- package/dist/esm/arch/svm/types.js.map +1 -0
- package/dist/esm/arch/svm/utils.d.ts +63 -0
- package/dist/esm/arch/svm/utils.js +258 -0
- package/dist/esm/arch/svm/utils.js.map +1 -0
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BaseAbstractClient.d.ts +6 -5
- package/dist/esm/clients/BaseAbstractClient.js +30 -19
- package/dist/esm/clients/BaseAbstractClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +17 -14
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
- package/dist/esm/clients/HubPoolClient.d.ts +4 -3
- package/dist/esm/clients/HubPoolClient.js +19 -18
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +23 -20
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +66 -0
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +225 -0
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -0
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +57 -59
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/index.d.ts +8 -0
- package/dist/esm/clients/SpokePoolClient/index.js +10 -0
- package/dist/esm/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/esm/clients/index.d.ts +1 -1
- package/dist/esm/clients/index.js +1 -1
- package/dist/esm/clients/index.js.map +1 -1
- package/dist/esm/clients/mocks/MockConfigStoreClient.d.ts +1 -1
- package/dist/esm/clients/mocks/MockConfigStoreClient.js +2 -2
- package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.js +2 -2
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +8 -5
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +33 -0
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +183 -0
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -0
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +30 -0
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +89 -0
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -0
- package/dist/esm/clients/mocks/index.d.ts +2 -0
- package/dist/esm/clients/mocks/index.js +2 -0
- package/dist/esm/clients/mocks/index.js.map +1 -1
- package/dist/esm/coingecko/Coingecko.d.ts +3 -2
- package/dist/esm/coingecko/Coingecko.js +12 -3
- package/dist/esm/coingecko/Coingecko.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -0
- package/dist/esm/constants.js +1 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
- package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/ethereum.d.ts +4 -4
- package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/linea-viem.js +3 -2
- package/dist/esm/gasPriceOracle/adapters/linea-viem.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/polygon.d.ts +4 -4
- package/dist/esm/gasPriceOracle/adapters/polygon.js +1 -1
- package/dist/esm/gasPriceOracle/adapters/solana.d.ts +8 -0
- package/dist/esm/gasPriceOracle/adapters/solana.js +43 -0
- package/dist/esm/gasPriceOracle/adapters/solana.js.map +1 -0
- package/dist/esm/gasPriceOracle/index.d.ts +1 -1
- package/dist/esm/gasPriceOracle/oracle.d.ts +4 -3
- package/dist/esm/gasPriceOracle/oracle.js +18 -9
- package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/gasPriceOracle/types.d.ts +6 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/SpokePool.d.ts +13 -0
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/providers/index.d.ts +1 -1
- package/dist/esm/providers/index.js +1 -2
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.d.ts +5 -0
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js +19 -0
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js.map +1 -0
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +5 -0
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js +18 -0
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +1 -0
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.d.ts +13 -0
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.js +74 -0
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.js.map +1 -0
- package/dist/esm/providers/mocks/index.d.ts +4 -0
- package/dist/esm/providers/mocks/index.js +5 -0
- package/dist/esm/providers/mocks/index.js.map +1 -0
- package/dist/esm/providers/{mockProvider.js → mocks/mockEthersProvider.js} +2 -2
- package/dist/esm/providers/mocks/mockEthersProvider.js.map +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +10 -8
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +11 -5
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/index.js +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +84 -0
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +216 -0
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +12 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +9 -4
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +9 -3
- package/dist/esm/utils/AddressUtils.js +41 -6
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/ArrayUtils.d.ts +6 -0
- package/dist/esm/utils/ArrayUtils.js +9 -0
- package/dist/esm/utils/ArrayUtils.js.map +1 -1
- package/dist/esm/utils/BlockFinder.d.ts +22 -0
- package/dist/esm/utils/BlockFinder.js +7 -0
- package/dist/esm/utils/BlockFinder.js.map +1 -0
- package/dist/esm/utils/BlockUtils.d.ts +2 -36
- package/dist/esm/utils/BlockUtils.js +2 -243
- package/dist/esm/utils/BlockUtils.js.map +1 -1
- package/dist/esm/utils/EventUtils.d.ts +4 -4
- package/dist/esm/utils/EventUtils.js +7 -4
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/JSONUtils.js +3 -0
- package/dist/esm/utils/JSONUtils.js.map +1 -1
- package/dist/esm/utils/NumberUtils.d.ts +7 -0
- package/dist/esm/utils/NumberUtils.js +11 -0
- package/dist/esm/utils/NumberUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.js +5 -0
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +12 -0
- package/dist/esm/utils/TokenUtils.js +6 -3
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/esm/utils/index.d.ts +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/types/arch/evm/BlockUtils.d.ts +25 -0
- package/dist/types/arch/evm/BlockUtils.d.ts.map +1 -0
- package/dist/types/arch/evm/SpokeUtils.d.ts +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/evm/index.d.ts +1 -0
- package/dist/types/arch/evm/index.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +123 -0
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -0
- package/dist/types/arch/svm/constants.d.ts +3 -0
- package/dist/types/arch/svm/constants.d.ts.map +1 -0
- package/dist/types/arch/svm/eventsClient.d.ts +88 -0
- package/dist/types/arch/svm/eventsClient.d.ts.map +1 -0
- package/dist/types/arch/svm/index.d.ts +5 -1
- package/dist/types/arch/svm/index.d.ts.map +1 -1
- package/dist/types/{svm → arch/svm}/types.d.ts +9 -4
- package/dist/types/arch/svm/types.d.ts.map +1 -0
- package/dist/types/arch/svm/utils.d.ts +64 -0
- package/dist/types/arch/svm/utils.d.ts.map +1 -0
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/BaseAbstractClient.d.ts +6 -5
- package/dist/types/clients/BaseAbstractClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
- package/dist/types/clients/HubPoolClient.d.ts +4 -3
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +67 -0
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +1 -0
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/index.d.ts +8 -0
- package/dist/types/clients/SpokePoolClient/index.d.ts.map +1 -1
- package/dist/types/clients/index.d.ts +1 -1
- package/dist/types/clients/index.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockConfigStoreClient.d.ts +1 -1
- package/dist/types/clients/mocks/MockConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +34 -0
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -0
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +31 -0
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -0
- package/dist/types/clients/mocks/index.d.ts +2 -0
- package/dist/types/clients/mocks/index.d.ts.map +1 -1
- package/dist/types/coingecko/Coingecko.d.ts +3 -2
- package/dist/types/coingecko/Coingecko.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
- package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts +4 -4
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/polygon.d.ts +4 -4
- package/dist/types/gasPriceOracle/adapters/polygon.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/solana.d.ts +9 -0
- package/dist/types/gasPriceOracle/adapters/solana.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/index.d.ts +1 -1
- package/dist/types/gasPriceOracle/index.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/oracle.d.ts +4 -3
- package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/types.d.ts +6 -1
- package/dist/types/gasPriceOracle/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +13 -0
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/providers/index.d.ts +1 -1
- package/dist/types/providers/index.d.ts.map +1 -1
- package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts +6 -0
- package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts.map +1 -0
- package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +6 -0
- package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts.map +1 -0
- package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts +14 -0
- package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts.map +1 -0
- package/dist/types/providers/mocks/index.d.ts +5 -0
- package/dist/types/providers/mocks/index.d.ts.map +1 -0
- package/dist/types/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +1 -1
- package/dist/types/providers/mocks/mockEthersProvider.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/types/relayFeeCalculator/chain-queries/index.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +85 -0
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +12 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +9 -3
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/ArrayUtils.d.ts +6 -0
- package/dist/types/utils/ArrayUtils.d.ts.map +1 -1
- package/dist/types/utils/BlockFinder.d.ts +23 -0
- package/dist/types/utils/BlockFinder.d.ts.map +1 -0
- package/dist/types/utils/BlockUtils.d.ts +2 -36
- package/dist/types/utils/BlockUtils.d.ts.map +1 -1
- package/dist/types/utils/EventUtils.d.ts +4 -4
- package/dist/types/utils/EventUtils.d.ts.map +1 -1
- package/dist/types/utils/JSONUtils.d.ts.map +1 -1
- package/dist/types/utils/NumberUtils.d.ts +7 -0
- package/dist/types/utils/NumberUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +12 -0
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/arch/evm/BlockUtils.ts +209 -0
- package/src/arch/evm/SpokeUtils.ts +5 -5
- package/src/arch/evm/index.ts +1 -0
- package/src/arch/svm/SpokeUtils.ts +581 -0
- package/src/arch/svm/constants.ts +2 -0
- package/src/arch/svm/eventsClient.ts +342 -0
- package/src/arch/svm/index.ts +5 -1
- package/src/{svm → arch/svm}/types.ts +21 -4
- package/src/arch/svm/utils.ts +233 -0
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -7
- package/src/clients/BaseAbstractClient.ts +20 -13
- package/src/clients/BundleDataClient/BundleDataClient.ts +28 -19
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +1 -1
- package/src/clients/HubPoolClient.ts +19 -19
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +23 -21
- package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +268 -0
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +50 -59
- package/src/clients/SpokePoolClient/index.ts +11 -0
- package/src/clients/index.ts +1 -1
- package/src/clients/mocks/MockConfigStoreClient.ts +2 -2
- package/src/clients/mocks/MockHubPoolClient.ts +2 -2
- package/src/clients/mocks/MockSpokePoolClient.ts +9 -4
- package/src/clients/mocks/MockSvmCpiEventsClient.ts +226 -0
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +119 -0
- package/src/clients/mocks/index.ts +2 -0
- package/src/coingecko/Coingecko.ts +12 -3
- package/src/constants.ts +1 -0
- package/src/gasPriceOracle/adapters/arbitrum.ts +5 -2
- package/src/gasPriceOracle/adapters/ethereum.ts +7 -4
- package/src/gasPriceOracle/adapters/linea-viem.ts +3 -1
- package/src/gasPriceOracle/adapters/polygon.ts +6 -6
- package/src/gasPriceOracle/adapters/solana.ts +47 -0
- package/src/gasPriceOracle/index.ts +1 -1
- package/src/gasPriceOracle/oracle.ts +20 -4
- package/src/gasPriceOracle/types.ts +7 -1
- package/src/index.ts +0 -1
- package/src/interfaces/SpokePool.ts +14 -0
- package/src/providers/index.ts +1 -1
- package/src/providers/mocks/MockCachedSolanaRpcFactory.ts +15 -0
- package/src/providers/mocks/MockRateLimitedSolanaRpcFactory.ts +14 -0
- package/src/providers/mocks/MockSolanaRpcFactory.ts +55 -0
- package/src/providers/mocks/index.ts +4 -0
- package/src/providers/{mockProvider.ts → mocks/mockEthersProvider.ts} +1 -1
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +11 -9
- package/src/relayFeeCalculator/chain-queries/factory.ts +24 -8
- package/src/relayFeeCalculator/chain-queries/index.ts +1 -0
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +225 -0
- package/src/relayFeeCalculator/relayFeeCalculator.ts +15 -3
- package/src/utils/AddressUtils.ts +49 -6
- package/src/utils/ArrayUtils.ts +12 -0
- package/src/utils/BlockFinder.ts +26 -0
- package/src/utils/BlockUtils.ts +5 -215
- package/src/utils/EventUtils.ts +11 -11
- package/src/utils/JSONUtils.ts +2 -0
- package/src/utils/NumberUtils.ts +10 -0
- package/src/utils/SpokeUtils.ts +7 -3
- package/src/utils/TokenUtils.ts +6 -3
- package/src/utils/index.ts +1 -0
- package/dist/cjs/providers/mockProvider.js.map +0 -1
- package/dist/cjs/svm/eventsClient.d.ts +0 -15
- package/dist/cjs/svm/eventsClient.js +0 -157
- package/dist/cjs/svm/eventsClient.js.map +0 -1
- package/dist/cjs/svm/index.d.ts +0 -3
- package/dist/cjs/svm/index.js +0 -8
- package/dist/cjs/svm/index.js.map +0 -1
- package/dist/cjs/svm/types.js.map +0 -1
- package/dist/cjs/svm/utils/events.d.ts +0 -8
- package/dist/cjs/svm/utils/events.js +0 -47
- package/dist/cjs/svm/utils/events.js.map +0 -1
- package/dist/cjs/svm/utils/helpers.d.ts +0 -2
- package/dist/cjs/svm/utils/helpers.js +0 -19
- package/dist/cjs/svm/utils/helpers.js.map +0 -1
- package/dist/cjs/svm/utils/index.d.ts +0 -1
- package/dist/cjs/svm/utils/index.js +0 -5
- package/dist/cjs/svm/utils/index.js.map +0 -1
- package/dist/esm/providers/mockProvider.js.map +0 -1
- package/dist/esm/svm/eventsClient.d.ts +0 -51
- package/dist/esm/svm/eventsClient.js +0 -195
- package/dist/esm/svm/eventsClient.js.map +0 -1
- package/dist/esm/svm/index.d.ts +0 -3
- package/dist/esm/svm/index.js +0 -5
- package/dist/esm/svm/index.js.map +0 -1
- package/dist/esm/svm/types.js.map +0 -1
- package/dist/esm/svm/utils/events.d.ts +0 -17
- package/dist/esm/svm/utils/events.js +0 -55
- package/dist/esm/svm/utils/events.js.map +0 -1
- package/dist/esm/svm/utils/helpers.d.ts +0 -5
- package/dist/esm/svm/utils/helpers.js +0 -18
- package/dist/esm/svm/utils/helpers.js.map +0 -1
- package/dist/esm/svm/utils/index.d.ts +0 -1
- package/dist/esm/svm/utils/index.js +0 -2
- package/dist/esm/svm/utils/index.js.map +0 -1
- package/dist/types/providers/mockProvider.d.ts.map +0 -1
- package/dist/types/svm/eventsClient.d.ts +0 -52
- package/dist/types/svm/eventsClient.d.ts.map +0 -1
- package/dist/types/svm/index.d.ts +0 -4
- package/dist/types/svm/index.d.ts.map +0 -1
- package/dist/types/svm/types.d.ts.map +0 -1
- package/dist/types/svm/utils/events.d.ts +0 -18
- package/dist/types/svm/utils/events.d.ts.map +0 -1
- package/dist/types/svm/utils/helpers.d.ts +0 -6
- package/dist/types/svm/utils/helpers.d.ts.map +0 -1
- package/dist/types/svm/utils/index.d.ts +0 -2
- package/dist/types/svm/utils/index.d.ts.map +0 -1
- package/src/svm/eventsClient.ts +0 -199
- package/src/svm/index.ts +0 -3
- package/src/svm/utils/events.ts +0 -58
- package/src/svm/utils/helpers.ts +0 -9
- package/src/svm/utils/index.ts +0 -1
- /package/dist/cjs/{svm → arch/svm}/types.js +0 -0
- /package/dist/cjs/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +0 -0
- /package/dist/esm/{svm → arch/svm}/types.js +0 -0
- /package/dist/esm/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
2
|
import { providers } from "ethers";
|
|
3
|
-
import { bnZero } from "
|
|
3
|
+
import { bnZero } from "../../utils/BigNumberUtils";
|
|
4
4
|
/**
|
|
5
5
|
* @notice Class used to test GasPriceOracle which makes ethers provider calls to the following implemented
|
|
6
6
|
* methods.
|
|
@@ -70,4 +70,4 @@ var MockedProvider = /** @class */ (function (_super) {
|
|
|
70
70
|
return MockedProvider;
|
|
71
71
|
}(providers.StaticJsonRpcProvider));
|
|
72
72
|
export { MockedProvider };
|
|
73
|
-
//# sourceMappingURL=
|
|
73
|
+
//# sourceMappingURL=mockEthersProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockEthersProvider.js","sourceRoot":"","sources":["../../../../src/providers/mocks/mockEthersProvider.ts"],"names":[],"mappings":";AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD;;;GAGG;AACH;IAAoC,kCAA+B;IAGjE,wBACW,oBAA+B,EAC/B,uBAAkC,EAClC,cAAkB;QAAlB,+BAAA,EAAA,kBAAkB;QAH7B,YAKE,kBAAM,SAAS,EAAE,cAAc,CAAC,SACjC;QALU,0BAAoB,GAApB,oBAAoB,CAAW;QAC/B,6BAAuB,GAAvB,uBAAuB,CAAW;QAClC,oBAAc,GAAd,cAAc,CAAI;QALrB,kBAAY,GAA4C,EAAE,CAAC;;IAQnE,CAAC;IAED,iCAAQ,GAAR,UAAS,oBAAoE;QAC3E,IAAM,SAAS,GAAU;YACvB,YAAY,EAAE,EAAE;YAChB,IAAI,EAAE,IAAI;YACV,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,GAAG;YACV,UAAU,EAAE,CAAC;YACb,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,IAAI,CAAC,oBAAoB;YACxC,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,IAAI;SAChB,CAAC;QACF,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,8DAA8D;IAC9D,6BAAI,GAAJ,UAAK,MAAc,EAAE,OAAmB;QACtC,QAAQ,MAAM,EAAE;YACd,KAAK,0BAA0B;gBAC7B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YACvD;gBACE,MAAM,IAAI,KAAK,CAAC,+CAAwC,MAAM,CAAE,CAAC,CAAC;SACrE;IACH,CAAC;IAED,mCAAU,GAAV;QACE,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,iBAAiB,EAAE,IAAI,CAAC,oBAAoB;YAC5C,oBAAoB,EAAE,IAAI,CAAC,uBAAuB;YAClD,6CAA6C;YAC7C,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;IACL,CAAC;IAED,uCAAc,GAAd,UAAe,IAAY;QACzB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,oCAAW,GAAX;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,mCAAU,GAAV;QACE,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,IAAI,CAAC,cAAc;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,wCAAe,GAAf,UAAgB,IAAY,EAAE,WAAgC;QAC5D,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;IACxC,CAAC;IACH,qBAAC;AAAD,CAAC,AApED,CAAoC,SAAS,CAAC,qBAAqB,GAoElE"}
|
|
@@ -7,7 +7,7 @@ import { Logger, QueryInterface } from "../relayFeeCalculator";
|
|
|
7
7
|
import { Transport } from "viem";
|
|
8
8
|
type Provider = providers.Provider;
|
|
9
9
|
type OptimismProvider = L2Provider<Provider>;
|
|
10
|
-
type SymbolMappingType = Record<string, {
|
|
10
|
+
export type SymbolMappingType = Record<string, {
|
|
11
11
|
addresses: Record<number, string>;
|
|
12
12
|
decimals: number;
|
|
13
13
|
}>;
|
|
@@ -2,12 +2,13 @@ import { __assign, __awaiter, __generator } from "tslib";
|
|
|
2
2
|
import { isL2Provider as isOptimismL2Provider } from "@eth-optimism/sdk/dist/l2-provider";
|
|
3
3
|
import { VoidSigner } from "ethers";
|
|
4
4
|
import { Coingecko } from "../../coingecko";
|
|
5
|
-
import { CHAIN_IDs
|
|
5
|
+
import { CHAIN_IDs } from "../../constants";
|
|
6
6
|
import { SpokePool__factory } from "../../typechain";
|
|
7
7
|
import { populateV3Relay } from "../../arch/evm";
|
|
8
8
|
import { BigNumber, toBNWei, bnZero, chainIsOPStack, fixedPointAdjustment, } from "../../utils";
|
|
9
9
|
import assert from "assert";
|
|
10
|
-
import {
|
|
10
|
+
import { getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
11
|
+
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
11
12
|
/**
|
|
12
13
|
* A unified QueryBase for querying gas costs, token prices, and decimals of various tokens
|
|
13
14
|
* on a blockchain.
|
|
@@ -47,7 +48,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
47
48
|
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
48
49
|
*/
|
|
49
50
|
QueryBase.prototype.getGasCosts = function (deposit, relayer, options) {
|
|
50
|
-
if (relayer === void 0) { relayer =
|
|
51
|
+
if (relayer === void 0) { relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId); }
|
|
51
52
|
if (options === void 0) { options = {}; }
|
|
52
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
54
|
var _a, gasPrice, gasUnits, baseFeeMultiplier, priorityFeeMultiplier, opStackL1GasCostMultiplier, transport, tx, _b, nativeGasCost, tokenGasCost, impliedGasPrice, opStackL1GasCost;
|
|
@@ -85,7 +86,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
85
86
|
* @returns PopulatedTransaction
|
|
86
87
|
*/
|
|
87
88
|
QueryBase.prototype.getUnsignedTxFromDeposit = function (deposit, relayer) {
|
|
88
|
-
if (relayer === void 0) { relayer =
|
|
89
|
+
if (relayer === void 0) { relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId); }
|
|
89
90
|
return populateV3Relay(this.spokePool, deposit, relayer);
|
|
90
91
|
};
|
|
91
92
|
/**
|
|
@@ -95,7 +96,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
95
96
|
* @returns Estimated gas cost based on ethers.VoidSigner's gas estimation
|
|
96
97
|
*/
|
|
97
98
|
QueryBase.prototype.getNativeGasCost = function (deposit, relayer) {
|
|
98
|
-
if (relayer === void 0) { relayer =
|
|
99
|
+
if (relayer === void 0) { relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId); }
|
|
99
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
100
101
|
var unsignedTx, voidSigner;
|
|
101
102
|
return __generator(this, function (_a) {
|
|
@@ -118,7 +119,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
118
119
|
* @returns BigNumber L1 data fee in gas units
|
|
119
120
|
*/
|
|
120
121
|
QueryBase.prototype.getOpStackL1DataFee = function (unsignedTx, relayer, options) {
|
|
121
|
-
if (relayer === void 0) { relayer =
|
|
122
|
+
if (relayer === void 0) { relayer = getDefaultSimulatedRelayerAddress(unsignedTx.chainId); }
|
|
122
123
|
return __awaiter(this, void 0, void 0, function () {
|
|
123
124
|
var _a, opStackL2GasUnits, _b, opStackL1DataFeeMultiplier, chainId, voidSigner, populatedTransaction, l1DataFee;
|
|
124
125
|
return __generator(this, function (_c) {
|
|
@@ -155,7 +156,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
155
156
|
QueryBase.prototype.estimateGas = function (unsignedTx, senderAddress, provider, options) {
|
|
156
157
|
if (options === void 0) { options = {}; }
|
|
157
158
|
return __awaiter(this, void 0, void 0, function () {
|
|
158
|
-
var _a, _gasPrice, gasUnits, _b, baseFeeMultiplier, _c, priorityFeeMultiplier, _d, opStackL1GasCostMultiplier, transport, chainId, voidSigner, queries, _e, nativeGasCost, gasPrice, tokenGasCost, opStackL1GasCost, l2GasCost;
|
|
159
|
+
var _a, _gasPrice, gasUnits, _b, baseFeeMultiplier, _c, priorityFeeMultiplier, _d, opStackL1GasCostMultiplier, transport, chainId, voidSigner, queries, _e, nativeGasCost, _gasPriceEstimate, gasPrice, tokenGasCost, opStackL1GasCost, l2GasCost;
|
|
159
160
|
return __generator(this, function (_f) {
|
|
160
161
|
switch (_f.label) {
|
|
161
162
|
case 0:
|
|
@@ -172,7 +173,8 @@ var QueryBase = /** @class */ (function () {
|
|
|
172
173
|
];
|
|
173
174
|
return [4 /*yield*/, Promise.all(queries)];
|
|
174
175
|
case 2:
|
|
175
|
-
_e = _f.sent(), nativeGasCost = _e[0],
|
|
176
|
+
_e = _f.sent(), nativeGasCost = _e[0], _gasPriceEstimate = _e[1];
|
|
177
|
+
gasPrice = _gasPriceEstimate.maxFeePerGas;
|
|
176
178
|
assert(nativeGasCost.gt(bnZero), "Gas cost should not be 0");
|
|
177
179
|
if (!chainIsOPStack(chainId)) return [3 /*break*/, 4];
|
|
178
180
|
return [4 /*yield*/, this.getOpStackL1DataFee(unsignedTx, senderAddress, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseQuery.js","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/baseQuery.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1F,OAAO,EAAmC,UAAU,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"baseQuery.js","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/baseQuery.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1F,OAAO,EAAmC,UAAU,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAa,kBAAkB,EAAE,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C,SAAS,CAAC,CAAC;;;wBAE/C,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;;4BAG7C,sBAAO;4BACL,aAAa,eAAA;4BACb,YAAY,cAAA;4BACZ,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;4BAC7C,gBAAgB,kBAAA;yBACjB,EAAC;;;;KACH;IAED;;;;OAIG;IACG,iCAAa,GAAnB,UAAoB,WAAmB;;;;;;wBACrC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;4BAAE,MAAM,IAAI,KAAK,CAAC,UAAG,WAAW,+BAA4B,CAAC,CAAC;wBAC5F,iBAAiB,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;wBAC5D,qBAAM,iBAAiB,CAAC,yBAAyB,CACjE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,EAC5D,IAAI,CAAC,qBAAqB,CAC3B,EAAA;;wBAHK,KAAY,SAGjB,EAHQ,KAAK,QAAA;wBAId,sBAAO,KAAK,EAAC;;;;KACd;IACH,gBAAC;AAAD,CAAC,AA5ND,IA4NC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { providers } from "ethers";
|
|
2
2
|
import { QueryBase } from "./baseQuery";
|
|
3
|
+
import { SVMProvider as svmProvider } from "../../arch/svm";
|
|
3
4
|
import { Logger } from "../relayFeeCalculator";
|
|
5
|
+
import { SvmQuery } from "./svmQuery";
|
|
4
6
|
export declare class QueryBase__factory {
|
|
5
|
-
static create(chainId: number, provider: providers.Provider, symbolMapping?: {
|
|
7
|
+
static create(chainId: number, provider: providers.Provider | svmProvider, symbolMapping?: {
|
|
6
8
|
ACX: {
|
|
7
9
|
name: string;
|
|
8
10
|
symbol: string;
|
|
@@ -395,5 +397,5 @@ export declare class QueryBase__factory {
|
|
|
395
397
|
};
|
|
396
398
|
coingeckoId: string;
|
|
397
399
|
};
|
|
398
|
-
}, spokePoolAddress?: string | undefined, simulatedRelayerAddress?: string, coingeckoProApiKey?: string, logger?: Logger, coingeckoBaseCurrency?: string): QueryBase;
|
|
400
|
+
}, spokePoolAddress?: string | undefined, simulatedRelayerAddress?: string, coingeckoProApiKey?: string, logger?: Logger, coingeckoBaseCurrency?: string): QueryBase | SvmQuery;
|
|
399
401
|
}
|
|
@@ -3,11 +3,12 @@ import assert from "assert";
|
|
|
3
3
|
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
|
|
4
4
|
import { getDeployedAddress } from "@across-protocol/contracts";
|
|
5
5
|
import { asL2Provider } from "@eth-optimism/sdk";
|
|
6
|
-
import {
|
|
7
|
-
import { chainIsOPStack, isDefined } from "../../utils";
|
|
6
|
+
import { CUSTOM_GAS_TOKENS } from "../../constants";
|
|
7
|
+
import { chainIsOPStack, isDefined, chainIsSvm, SvmAddress } from "../../utils";
|
|
8
8
|
import { QueryBase } from "./baseQuery";
|
|
9
|
-
import { DEFAULT_LOGGER } from "../relayFeeCalculator";
|
|
9
|
+
import { DEFAULT_LOGGER, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
10
10
|
import { CustomGasTokenQueries } from "./customGasToken";
|
|
11
|
+
import { SvmQuery } from "./svmQuery";
|
|
11
12
|
/**
|
|
12
13
|
* Some chains have a fixed gas price that is applied to the gas estimates. We should override
|
|
13
14
|
* the gas markup for these chains.
|
|
@@ -21,7 +22,7 @@ var QueryBase__factory = /** @class */ (function () {
|
|
|
21
22
|
QueryBase__factory.create = function (chainId, provider, symbolMapping, spokePoolAddress, simulatedRelayerAddress, coingeckoProApiKey, logger, coingeckoBaseCurrency) {
|
|
22
23
|
if (symbolMapping === void 0) { symbolMapping = TOKEN_SYMBOLS_MAP; }
|
|
23
24
|
if (spokePoolAddress === void 0) { spokePoolAddress = getDeployedAddress("SpokePool", chainId); }
|
|
24
|
-
if (simulatedRelayerAddress === void 0) { simulatedRelayerAddress =
|
|
25
|
+
if (simulatedRelayerAddress === void 0) { simulatedRelayerAddress = getDefaultSimulatedRelayerAddress(chainId); }
|
|
25
26
|
if (logger === void 0) { logger = DEFAULT_LOGGER; }
|
|
26
27
|
if (coingeckoBaseCurrency === void 0) { coingeckoBaseCurrency = "eth"; }
|
|
27
28
|
assert(isDefined(spokePoolAddress));
|
|
@@ -41,8 +42,13 @@ var QueryBase__factory = /** @class */ (function () {
|
|
|
41
42
|
customGasTokenSymbol: customGasTokenSymbol,
|
|
42
43
|
});
|
|
43
44
|
}
|
|
45
|
+
if (chainIsSvm(chainId)) {
|
|
46
|
+
return new SvmQuery(provider, symbolMapping, SvmAddress.from(spokePoolAddress), SvmAddress.from(simulatedRelayerAddress), logger, coingeckoProApiKey, fixedGasPrice[chainId], coingeckoBaseCurrency);
|
|
47
|
+
}
|
|
44
48
|
// For OPStack chains, we need to wrap the provider in an L2Provider
|
|
45
|
-
provider = chainIsOPStack(chainId)
|
|
49
|
+
provider = chainIsOPStack(chainId)
|
|
50
|
+
? asL2Provider(provider)
|
|
51
|
+
: provider;
|
|
46
52
|
return new QueryBase(provider, symbolMapping, spokePoolAddress, simulatedRelayerAddress, logger, coingeckoProApiKey, fixedGasPrice[chainId], coingeckoBaseCurrency);
|
|
47
53
|
};
|
|
48
54
|
return QueryBase__factory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/factory.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,
|
|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AI,oBAAoB,EAAE;YACxB,OAAO,IAAI,qBAAqB,CAAC;gBAC/B,aAAa,EAAE;oBACb,QAA8B;oBAC9B,aAAa;oBACb,gBAAgB;oBAChB,uBAAuB;oBACvB,MAAM;oBACN,kBAAkB;oBAClB,aAAa,CAAC,OAAO,CAAC;oBACtB,KAAK;iBACN;gBACD,oBAAoB,sBAAA;aACrB,CAAC,CAAC;SACJ;QACD,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE;YACvB,OAAO,IAAI,QAAQ,CACjB,QAAuB,EACvB,aAAa,EACb,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,EACjC,UAAU,CAAC,IAAI,CAAC,uBAAuB,CAAC,EACxC,MAAM,EACN,kBAAkB,EAClB,aAAa,CAAC,OAAO,CAAC,EACtB,qBAAqB,CACtB,CAAC;SACH;QAED,oEAAoE;QACpE,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC;YAChC,CAAC,CAAC,YAAY,CAAC,QAA8B,CAAC;YAC9C,CAAC,CAAE,QAA+B,CAAC;QAErC,OAAO,IAAI,SAAS,CAClB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,aAAa,CAAC,OAAO,CAAC,EACtB,qBAAqB,CACtB,CAAC;IACJ,CAAC;IACH,yBAAC;AAAD,CAAC,AA1DD,IA0DC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { SymbolMappingType } from "./";
|
|
2
|
+
import { Deposit } from "../../interfaces";
|
|
3
|
+
import { BigNumberish, TransactionCostEstimate, BigNumber, SvmAddress } from "../../utils";
|
|
4
|
+
import { Logger, QueryInterface } from "../relayFeeCalculator";
|
|
5
|
+
import { SVMProvider } from "../../arch/svm";
|
|
6
|
+
import { IInstruction } from "@solana/kit";
|
|
7
|
+
/**
|
|
8
|
+
* A special QueryBase implementation for SVM used for querying gas costs, token prices, and decimals of various tokens
|
|
9
|
+
* on Solana.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SvmQuery implements QueryInterface {
|
|
12
|
+
readonly provider: SVMProvider;
|
|
13
|
+
readonly symbolMapping: SymbolMappingType;
|
|
14
|
+
readonly spokePoolAddress: SvmAddress;
|
|
15
|
+
readonly simulatedRelayerAddress: SvmAddress;
|
|
16
|
+
readonly logger: Logger;
|
|
17
|
+
readonly coingeckoProApiKey?: string | undefined;
|
|
18
|
+
readonly fixedGasPrice?: BigNumberish | undefined;
|
|
19
|
+
readonly coingeckoBaseCurrency: string;
|
|
20
|
+
protected computeUnitEstimator: (transactionMessage: import("@solana/kit").CompilableTransactionMessage | (import("@solana/kit").ITransactionMessageWithFeePayer<string> & import("@solana/kit").TransactionMessage), config?: Omit<Readonly<{
|
|
21
|
+
abortSignal?: AbortSignal | undefined;
|
|
22
|
+
commitment?: import("@solana/kit").Commitment | undefined;
|
|
23
|
+
minContextSlot?: bigint | undefined;
|
|
24
|
+
rpc: import("@solana/kit").Rpc<import("@solana/kit").SimulateTransactionApi>;
|
|
25
|
+
transactionMessage: import("@solana/kit").CompilableTransactionMessage | (import("@solana/kit").ITransactionMessageWithFeePayer<string> & import("@solana/kit").TransactionMessage);
|
|
26
|
+
}>, "rpc" | "transactionMessage"> | undefined) => Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Instantiates a SvmQuery instance
|
|
29
|
+
* @param provider A valid solana/kit rpc client.
|
|
30
|
+
* @param symbolMapping A mapping to valid ERC20 tokens and their respective characteristics
|
|
31
|
+
* @param spokePoolAddress The valid address of the Spoke Pool deployment
|
|
32
|
+
* @param simulatedRelayerAddress The address that these queries will reference as the sender. Note: This address must be approved for USDC
|
|
33
|
+
* @param logger A logging utility to report logs
|
|
34
|
+
* @param coingeckoProApiKey An optional CoinGecko API key that links to a PRO account
|
|
35
|
+
* @param fixedGasPrice Overrides the gas price with a fixed value. Note: primarily used for the Boba blockchain
|
|
36
|
+
* @param coingeckoBaseCurrency The basis currency that CoinGecko will use to resolve pricing
|
|
37
|
+
*/
|
|
38
|
+
constructor(provider: SVMProvider, symbolMapping: SymbolMappingType, spokePoolAddress: SvmAddress, simulatedRelayerAddress: SvmAddress, logger: Logger, coingeckoProApiKey?: string | undefined, fixedGasPrice?: BigNumberish | undefined, coingeckoBaseCurrency?: string);
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
41
|
+
* @param deposit V3 deposit instance.
|
|
42
|
+
* @param relayerAddress Relayer address to simulate with.
|
|
43
|
+
* @param options
|
|
44
|
+
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
45
|
+
* @param options.gasUnits Optional gas units to use for the simulation.
|
|
46
|
+
* @param options.transport Optional transport object for custom gas price retrieval.
|
|
47
|
+
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
48
|
+
*/
|
|
49
|
+
getGasCosts(deposit: Omit<Deposit, "messageHash">, _relayer?: string, options?: Partial<{
|
|
50
|
+
gasPrice: BigNumberish;
|
|
51
|
+
gasUnits: BigNumberish;
|
|
52
|
+
baseFeeMultiplier: BigNumber;
|
|
53
|
+
priorityFeeMultiplier: BigNumber;
|
|
54
|
+
}>): Promise<TransactionCostEstimate>;
|
|
55
|
+
/**
|
|
56
|
+
* @notice Return the gas cost of a simulated transaction
|
|
57
|
+
* @param fillRelayTx FillRelay transaction
|
|
58
|
+
* @param relayer SVM address of the relayer
|
|
59
|
+
* @returns Estimated gas cost in compute units
|
|
60
|
+
*/
|
|
61
|
+
getNativeGasCost(deposit: Omit<Deposit, "messageHash">, _relayer?: string): Promise<BigNumber>;
|
|
62
|
+
/**
|
|
63
|
+
* @notice Return the fillRelay transaction for a given deposit
|
|
64
|
+
* @param deposit
|
|
65
|
+
* @param relayer SVM address of the relayer
|
|
66
|
+
* @returns FillRelay transaction
|
|
67
|
+
*/
|
|
68
|
+
getFillRelayTx(deposit: Omit<Deposit, "messageHash">, _relayer?: string): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayer<string> & Omit<Readonly<{
|
|
69
|
+
instructions: readonly IInstruction<string, readonly (import("@solana/kit").IAccountMeta<string> | import("@solana/kit").IAccountLookupMeta<string, string>)[]>[];
|
|
70
|
+
version: 0;
|
|
71
|
+
}>, "feePayer">>;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves the current price of a token
|
|
74
|
+
* @param tokenSymbol A valid [CoinGecko-ID](https://api.coingecko.com/api/v3/coins/list)
|
|
75
|
+
* @returns The resolved token price within the specified coingeckoBaseCurrency
|
|
76
|
+
*/
|
|
77
|
+
getTokenPrice(tokenSymbol: string): Promise<number>;
|
|
78
|
+
/**
|
|
79
|
+
* Resolves the number of decimal places a token can have
|
|
80
|
+
* @param tokenSymbol A valid Across-Enabled Token ID
|
|
81
|
+
* @returns The number of decimals of precision for the corresponding tokenSymbol
|
|
82
|
+
*/
|
|
83
|
+
getTokenDecimals(tokenSymbol: string): number;
|
|
84
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { pipe } from "@solana/functional";
|
|
3
|
+
import { Coingecko } from "../../coingecko";
|
|
4
|
+
import { CHAIN_IDs } from "../../constants";
|
|
5
|
+
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
6
|
+
import { toBN, isDefined, toAddressType, } from "../../utils";
|
|
7
|
+
import { getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
8
|
+
import { fillRelayInstruction, createApproveInstruction, createTokenAccountsInstruction, SolanaVoidSigner, getAssociatedTokenAddress, } from "../../arch/svm";
|
|
9
|
+
import { createTransactionMessage, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstructions, getComputeUnitEstimateForTransactionMessageFactory, fetchEncodedAccount, } from "@solana/kit";
|
|
10
|
+
import { TOKEN_PROGRAM_ADDRESS, getMintSize, getInitializeMintInstruction, fetchMint } from "@solana-program/token";
|
|
11
|
+
import { getCreateAccountInstruction } from "@solana-program/system";
|
|
12
|
+
/**
|
|
13
|
+
* A special QueryBase implementation for SVM used for querying gas costs, token prices, and decimals of various tokens
|
|
14
|
+
* on Solana.
|
|
15
|
+
*/
|
|
16
|
+
var SvmQuery = /** @class */ (function () {
|
|
17
|
+
/**
|
|
18
|
+
* Instantiates a SvmQuery instance
|
|
19
|
+
* @param provider A valid solana/kit rpc client.
|
|
20
|
+
* @param symbolMapping A mapping to valid ERC20 tokens and their respective characteristics
|
|
21
|
+
* @param spokePoolAddress The valid address of the Spoke Pool deployment
|
|
22
|
+
* @param simulatedRelayerAddress The address that these queries will reference as the sender. Note: This address must be approved for USDC
|
|
23
|
+
* @param logger A logging utility to report logs
|
|
24
|
+
* @param coingeckoProApiKey An optional CoinGecko API key that links to a PRO account
|
|
25
|
+
* @param fixedGasPrice Overrides the gas price with a fixed value. Note: primarily used for the Boba blockchain
|
|
26
|
+
* @param coingeckoBaseCurrency The basis currency that CoinGecko will use to resolve pricing
|
|
27
|
+
*/
|
|
28
|
+
function SvmQuery(provider, symbolMapping, spokePoolAddress, simulatedRelayerAddress, logger, coingeckoProApiKey, fixedGasPrice, coingeckoBaseCurrency) {
|
|
29
|
+
if (coingeckoBaseCurrency === void 0) { coingeckoBaseCurrency = "eth"; }
|
|
30
|
+
this.provider = provider;
|
|
31
|
+
this.symbolMapping = symbolMapping;
|
|
32
|
+
this.spokePoolAddress = spokePoolAddress;
|
|
33
|
+
this.simulatedRelayerAddress = simulatedRelayerAddress;
|
|
34
|
+
this.logger = logger;
|
|
35
|
+
this.coingeckoProApiKey = coingeckoProApiKey;
|
|
36
|
+
this.fixedGasPrice = fixedGasPrice;
|
|
37
|
+
this.coingeckoBaseCurrency = coingeckoBaseCurrency;
|
|
38
|
+
this.computeUnitEstimator = getComputeUnitEstimateForTransactionMessageFactory({
|
|
39
|
+
rpc: provider,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
44
|
+
* @param deposit V3 deposit instance.
|
|
45
|
+
* @param relayerAddress Relayer address to simulate with.
|
|
46
|
+
* @param options
|
|
47
|
+
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
48
|
+
* @param options.gasUnits Optional gas units to use for the simulation.
|
|
49
|
+
* @param options.transport Optional transport object for custom gas price retrieval.
|
|
50
|
+
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
51
|
+
*/
|
|
52
|
+
SvmQuery.prototype.getGasCosts = function (deposit, _relayer, options) {
|
|
53
|
+
if (_relayer === void 0) { _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId); }
|
|
54
|
+
if (options === void 0) { options = {}; }
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var relayer, fillRelayTx, _a, computeUnitsConsumed, _gasPriceEstimate, _b, _c, _d, gasPriceEstimate, gasPrice;
|
|
57
|
+
return __generator(this, function (_e) {
|
|
58
|
+
switch (_e.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
relayer = _relayer ? toAddressType(_relayer).forceSvmAddress() : this.simulatedRelayerAddress;
|
|
61
|
+
return [4 /*yield*/, this.getFillRelayTx(deposit, relayer.toBase58())];
|
|
62
|
+
case 1:
|
|
63
|
+
fillRelayTx = _e.sent();
|
|
64
|
+
_c = (_b = Promise).all;
|
|
65
|
+
_d = toBN;
|
|
66
|
+
return [4 /*yield*/, this.computeUnitEstimator(fillRelayTx)];
|
|
67
|
+
case 2: return [4 /*yield*/, _c.apply(_b, [[
|
|
68
|
+
_d.apply(void 0, [_e.sent()]),
|
|
69
|
+
getGasPriceEstimate(this.provider, {
|
|
70
|
+
unsignedTx: fillRelayTx,
|
|
71
|
+
baseFeeMultiplier: options.baseFeeMultiplier,
|
|
72
|
+
priorityFeeMultiplier: options.priorityFeeMultiplier,
|
|
73
|
+
})
|
|
74
|
+
]])];
|
|
75
|
+
case 3:
|
|
76
|
+
_a = _e.sent(), computeUnitsConsumed = _a[0], _gasPriceEstimate = _a[1];
|
|
77
|
+
gasPriceEstimate = _gasPriceEstimate;
|
|
78
|
+
gasPrice = gasPriceEstimate.baseFee.add(gasPriceEstimate.microLamportsPerComputeUnit.mul(computeUnitsConsumed).div(toBN(1000000)) // 1_000_000 microLamports/lamport.
|
|
79
|
+
);
|
|
80
|
+
return [2 /*return*/, {
|
|
81
|
+
nativeGasCost: computeUnitsConsumed,
|
|
82
|
+
tokenGasCost: gasPrice,
|
|
83
|
+
gasPrice: gasPrice,
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* @notice Return the gas cost of a simulated transaction
|
|
91
|
+
* @param fillRelayTx FillRelay transaction
|
|
92
|
+
* @param relayer SVM address of the relayer
|
|
93
|
+
* @returns Estimated gas cost in compute units
|
|
94
|
+
*/
|
|
95
|
+
SvmQuery.prototype.getNativeGasCost = function (deposit, _relayer) {
|
|
96
|
+
if (_relayer === void 0) { _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId); }
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
var fillRelayTx, computeUnitsConsumed, _a;
|
|
99
|
+
return __generator(this, function (_b) {
|
|
100
|
+
switch (_b.label) {
|
|
101
|
+
case 0: return [4 /*yield*/, this.getFillRelayTx(deposit, _relayer)];
|
|
102
|
+
case 1:
|
|
103
|
+
fillRelayTx = _b.sent();
|
|
104
|
+
_a = toBN;
|
|
105
|
+
return [4 /*yield*/, this.computeUnitEstimator(fillRelayTx)];
|
|
106
|
+
case 2:
|
|
107
|
+
computeUnitsConsumed = _a.apply(void 0, [_b.sent()]);
|
|
108
|
+
return [2 /*return*/, computeUnitsConsumed];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* @notice Return the fillRelay transaction for a given deposit
|
|
115
|
+
* @param deposit
|
|
116
|
+
* @param relayer SVM address of the relayer
|
|
117
|
+
* @returns FillRelay transaction
|
|
118
|
+
*/
|
|
119
|
+
SvmQuery.prototype.getFillRelayTx = function (deposit, _relayer) {
|
|
120
|
+
if (_relayer === void 0) { _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId); }
|
|
121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
+
var relayer, mint, owner, associatedToken, simulatedSigner, recipientCreateTokenAccountInstructions, _a, associatedTokenAccountExists, mintInfo, _b, _c, space, rent, createAccountIx, initializeMintIx, _d, createTokenAccountsIx, approveIx, fillIx, recentBlockhash, fillRelayTx;
|
|
123
|
+
return __generator(this, function (_e) {
|
|
124
|
+
switch (_e.label) {
|
|
125
|
+
case 0:
|
|
126
|
+
relayer = _relayer ? toAddressType(_relayer).forceSvmAddress() : this.simulatedRelayerAddress;
|
|
127
|
+
mint = toAddressType(deposit.outputToken).forceSvmAddress();
|
|
128
|
+
owner = toAddressType(deposit.recipient).forceSvmAddress();
|
|
129
|
+
return [4 /*yield*/, getAssociatedTokenAddress(owner, mint)];
|
|
130
|
+
case 1:
|
|
131
|
+
associatedToken = _e.sent();
|
|
132
|
+
simulatedSigner = SolanaVoidSigner(relayer.toBase58());
|
|
133
|
+
recipientCreateTokenAccountInstructions = undefined;
|
|
134
|
+
_c = (_b = Promise).all;
|
|
135
|
+
return [4 /*yield*/, fetchEncodedAccount(this.provider, associatedToken)];
|
|
136
|
+
case 2: return [4 /*yield*/, _c.apply(_b, [[
|
|
137
|
+
(_e.sent()).exists,
|
|
138
|
+
fetchMint(this.provider, mint.toV2Address())
|
|
139
|
+
]])];
|
|
140
|
+
case 3:
|
|
141
|
+
_a = _e.sent(), associatedTokenAccountExists = _a[0], mintInfo = _a[1];
|
|
142
|
+
if (!!associatedTokenAccountExists) return [3 /*break*/, 5];
|
|
143
|
+
space = BigInt(getMintSize());
|
|
144
|
+
return [4 /*yield*/, this.provider.getMinimumBalanceForRentExemption(space).send()];
|
|
145
|
+
case 4:
|
|
146
|
+
rent = _e.sent();
|
|
147
|
+
createAccountIx = getCreateAccountInstruction({
|
|
148
|
+
payer: simulatedSigner,
|
|
149
|
+
newAccount: SolanaVoidSigner(mint.toBase58()),
|
|
150
|
+
lamports: rent,
|
|
151
|
+
space: space,
|
|
152
|
+
programAddress: TOKEN_PROGRAM_ADDRESS,
|
|
153
|
+
});
|
|
154
|
+
initializeMintIx = getInitializeMintInstruction({
|
|
155
|
+
mint: mint.toV2Address(),
|
|
156
|
+
decimals: mintInfo.data.decimals,
|
|
157
|
+
mintAuthority: owner.toV2Address(),
|
|
158
|
+
});
|
|
159
|
+
recipientCreateTokenAccountInstructions = [createAccountIx, initializeMintIx];
|
|
160
|
+
_e.label = 5;
|
|
161
|
+
case 5: return [4 /*yield*/, Promise.all([
|
|
162
|
+
createTokenAccountsInstruction(mint, simulatedSigner),
|
|
163
|
+
createApproveInstruction(mint, deposit.outputAmount, this.simulatedRelayerAddress, this.spokePoolAddress, mintInfo.data.decimals),
|
|
164
|
+
fillRelayInstruction(this.spokePoolAddress, deposit, simulatedSigner, associatedToken),
|
|
165
|
+
])];
|
|
166
|
+
case 6:
|
|
167
|
+
_d = _e.sent(), createTokenAccountsIx = _d[0], approveIx = _d[1], fillIx = _d[2];
|
|
168
|
+
return [4 /*yield*/, this.provider.getLatestBlockhash().send()];
|
|
169
|
+
case 7:
|
|
170
|
+
recentBlockhash = _e.sent();
|
|
171
|
+
fillRelayTx = pipe(createTransactionMessage({ version: 0 }), function (tx) { return setTransactionMessageFeePayer(relayer.toV2Address(), tx); }, function (tx) { return setTransactionMessageLifetimeUsingBlockhash(recentBlockhash.value, tx); }, function (tx) {
|
|
172
|
+
return isDefined(recipientCreateTokenAccountInstructions)
|
|
173
|
+
? appendTransactionMessageInstructions(recipientCreateTokenAccountInstructions, tx)
|
|
174
|
+
: tx;
|
|
175
|
+
}, function (tx) { return appendTransactionMessageInstructions([createTokenAccountsIx, approveIx, fillIx], tx); });
|
|
176
|
+
return [2 /*return*/, fillRelayTx];
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Retrieves the current price of a token
|
|
183
|
+
* @param tokenSymbol A valid [CoinGecko-ID](https://api.coingecko.com/api/v3/coins/list)
|
|
184
|
+
* @returns The resolved token price within the specified coingeckoBaseCurrency
|
|
185
|
+
*/
|
|
186
|
+
SvmQuery.prototype.getTokenPrice = function (tokenSymbol) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
188
|
+
var coingeckoInstance, _a, price;
|
|
189
|
+
return __generator(this, function (_b) {
|
|
190
|
+
switch (_b.label) {
|
|
191
|
+
case 0:
|
|
192
|
+
if (!this.symbolMapping[tokenSymbol])
|
|
193
|
+
throw new Error("".concat(tokenSymbol, " does not exist in mapping"));
|
|
194
|
+
coingeckoInstance = Coingecko.get(this.logger, this.coingeckoProApiKey);
|
|
195
|
+
return [4 /*yield*/, coingeckoInstance.getCurrentPriceByContract(this.symbolMapping[tokenSymbol].addresses[CHAIN_IDs.MAINNET], this.coingeckoBaseCurrency)];
|
|
196
|
+
case 1:
|
|
197
|
+
_a = _b.sent(), price = _a[1];
|
|
198
|
+
return [2 /*return*/, price];
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Resolves the number of decimal places a token can have
|
|
205
|
+
* @param tokenSymbol A valid Across-Enabled Token ID
|
|
206
|
+
* @returns The number of decimals of precision for the corresponding tokenSymbol
|
|
207
|
+
*/
|
|
208
|
+
SvmQuery.prototype.getTokenDecimals = function (tokenSymbol) {
|
|
209
|
+
if (!this.symbolMapping[tokenSymbol])
|
|
210
|
+
throw new Error("".concat(tokenSymbol, " does not exist in mapping"));
|
|
211
|
+
return this.symbolMapping[tokenSymbol].decimals;
|
|
212
|
+
};
|
|
213
|
+
return SvmQuery;
|
|
214
|
+
}());
|
|
215
|
+
export { SvmQuery };
|
|
216
|
+
//# sourceMappingURL=svmQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svmQuery.js","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAKL,IAAI,EACJ,SAAS,EACT,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iCAAiC,EAA0B,MAAM,uBAAuB,CAAC;AAClG,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAE9B,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,2CAA2C,EAC3C,oCAAoC,EACpC,kDAAkD,EAClD,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,4BAA4B,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAA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C7F,CAAC;wBACF,sBAAO,WAAW,EAAC;;;;KACpB;IAED;;;;OAIG;IACG,gCAAa,GAAnB,UAAoB,WAAmB;;;;;;wBACrC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;4BAAE,MAAM,IAAI,KAAK,CAAC,UAAG,WAAW,+BAA4B,CAAC,CAAC;wBAC5F,iBAAiB,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;wBAC5D,qBAAM,iBAAiB,CAAC,yBAAyB,CACjE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,EAC5D,IAAI,CAAC,qBAAqB,CAC3B,EAAA;;wBAHK,KAAY,SAGjB,EAHQ,KAAK,QAAA;wBAId,sBAAO,KAAK,EAAC;;;;KACd;IAED;;;;OAIG;IACH,mCAAgB,GAAhB,UAAiB,WAAmB;QAClC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,UAAG,WAAW,+BAA4B,CAAC,CAAC;QAClG,OAAO,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC;IAClD,CAAC;IACH,eAAC;AAAD,CAAC,AAxLD,IAwLC"}
|
|
@@ -11,6 +11,7 @@ export interface QueryInterface {
|
|
|
11
11
|
transport: Transport;
|
|
12
12
|
}>) => Promise<TransactionCostEstimate>;
|
|
13
13
|
getTokenPrice: (tokenSymbol: string) => Promise<number>;
|
|
14
|
+
getNativeGasCost: (deposit: Omit<Deposit, "messageHash">, relayer: string) => Promise<BigNumber>;
|
|
14
15
|
}
|
|
15
16
|
export declare const expectedCapitalCostsKeys: string[];
|
|
16
17
|
export interface CapitalCostConfig {
|
|
@@ -73,6 +74,7 @@ export interface Logger {
|
|
|
73
74
|
error: LoggingFunction;
|
|
74
75
|
}
|
|
75
76
|
export declare const DEFAULT_LOGGER: Logger;
|
|
77
|
+
export declare function getDefaultSimulatedRelayerAddress(chainId?: number): "0x07aE8551Be970cB1cCa11Dd7a11F47Ae82e70E67" | "FmMK62wrtWVb5SVoTZftSCGw3nEDA79hDbZNTRnC1R6t";
|
|
76
78
|
export declare class RelayFeeCalculator {
|
|
77
79
|
private queries;
|
|
78
80
|
private gasDiscountPercent;
|
|
@@ -421,7 +423,16 @@ export declare class RelayFeeCalculator {
|
|
|
421
423
|
VLR: {
|
|
422
424
|
name: string;
|
|
423
425
|
symbol: string;
|
|
424
|
-
decimals: number;
|
|
426
|
+
decimals: number; /**
|
|
427
|
+
* Type guard to check if a config is a CapitalCostConfigOverride or a CapitalCostConfig.
|
|
428
|
+
* @param config CapitalCostConfig or CapitalCostConfigOverride
|
|
429
|
+
* @returns true if the config is a CapitalCostConfigOverride, false otherwise.
|
|
430
|
+
* @private
|
|
431
|
+
* @dev This is a type guard that is used to check if a config is a CapitalCostConfigOverride or a CapitalCostConfig.
|
|
432
|
+
* This is needed because the config can be either a CapitalCostConfig or a CapitalCostConfigOverride. If it's a
|
|
433
|
+
* CapitalCostConfig, then we need to convert it to a CapitalCostConfigOverride with the default config set with no route
|
|
434
|
+
* overrides.
|
|
435
|
+
*/
|
|
425
436
|
addresses: {
|
|
426
437
|
[x: number]: string;
|
|
427
438
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
2
|
import assert from "assert";
|
|
3
|
-
import { DEFAULT_SIMULATED_RELAYER_ADDRESS, TOKEN_SYMBOLS_MAP } from "../constants";
|
|
4
|
-
import { MAX_BIG_INT, bnZero, fixedPointAdjustment, getTokenInfo, isDefined, max, min, nativeToToken, percent, toBN, toBNWei, isZeroAddress, compareAddressesSimple, } from "../utils";
|
|
3
|
+
import { DEFAULT_SIMULATED_RELAYER_ADDRESS, DEFAULT_SIMULATED_RELAYER_ADDRESS_SVM, TOKEN_SYMBOLS_MAP, } from "../constants";
|
|
4
|
+
import { MAX_BIG_INT, bnZero, fixedPointAdjustment, getTokenInfo, isDefined, max, min, nativeToToken, percent, toBN, toBNWei, isZeroAddress, compareAddressesSimple, chainIsSvm, } from "../utils";
|
|
5
5
|
export var expectedCapitalCostsKeys = ["lowerBound", "upperBound", "cutoff", "decimals"];
|
|
6
6
|
export var DEFAULT_LOGGER = {
|
|
7
7
|
debug: function () {
|
|
@@ -33,6 +33,11 @@ export var DEFAULT_LOGGER = {
|
|
|
33
33
|
return console.error(args);
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
|
+
export function getDefaultSimulatedRelayerAddress(chainId) {
|
|
37
|
+
return isDefined(chainId) && chainIsSvm(chainId)
|
|
38
|
+
? DEFAULT_SIMULATED_RELAYER_ADDRESS_SVM
|
|
39
|
+
: DEFAULT_SIMULATED_RELAYER_ADDRESS;
|
|
40
|
+
}
|
|
36
41
|
// Small amount to simulate filling with. Should be low enough to guarantee a successful fill.
|
|
37
42
|
var safeOutputAmount = toBN(100);
|
|
38
43
|
var RelayFeeCalculator = /** @class */ (function () {
|
|
@@ -132,7 +137,7 @@ var RelayFeeCalculator = /** @class */ (function () {
|
|
|
132
137
|
*/
|
|
133
138
|
RelayFeeCalculator.prototype.gasFeePercent = function (deposit, amountToRelay, simulateZeroFill, relayerAddress, _tokenPrice, tokenMapping, gasPrice, gasLimit, _tokenGasCost, transport) {
|
|
134
139
|
if (simulateZeroFill === void 0) { simulateZeroFill = false; }
|
|
135
|
-
if (relayerAddress === void 0) { relayerAddress =
|
|
140
|
+
if (relayerAddress === void 0) { relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId); }
|
|
136
141
|
if (tokenMapping === void 0) { tokenMapping = TOKEN_SYMBOLS_MAP; }
|
|
137
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
138
143
|
var inputToken, destinationChainId, originChainId, destinationChainTokenDetails, outputToken, outputTokenInfo, inputTokenInfo, simulatedAmount, getGasCosts, _a, tokenGasCost, tokenPrice, gasFeesInToken;
|
|
@@ -333,7 +338,7 @@ var RelayFeeCalculator = /** @class */ (function () {
|
|
|
333
338
|
*/
|
|
334
339
|
RelayFeeCalculator.prototype.relayerFeeDetails = function (deposit, amountToRelay, simulateZeroFill, relayerAddress, _tokenPrice, gasPrice, gasUnits, tokenGasCost) {
|
|
335
340
|
if (simulateZeroFill === void 0) { simulateZeroFill = false; }
|
|
336
|
-
if (relayerAddress === void 0) { relayerAddress =
|
|
341
|
+
if (relayerAddress === void 0) { relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId); }
|
|
337
342
|
return __awaiter(this, void 0, void 0, function () {
|
|
338
343
|
var inputToken, originChainId, token, gasFeePercent, gasFeeTotal, capitalFeePercent, capitalFeeTotal, relayFeePercent, relayFeeTotal, maxGasFeePercent, minDeposit, isAmountTooLow;
|
|
339
344
|
return __generator(this, function (_a) {
|