@across-protocol/sdk 4.1.63-alpha.1 → 4.1.63-beta.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/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/svm/SpokeUtils.d.ts +20 -0
- package/dist/cjs/arch/svm/SpokeUtils.js +424 -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 +17 -0
- package/dist/cjs/arch/svm/utils.js +204 -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 +1 -1
- package/dist/cjs/clients/HubPoolClient.js +16 -16
- 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 +145 -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 +50 -54
- 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/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/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +5 -4
- 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 +7 -1
- 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 +31 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +136 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
- 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/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/SpokeUtils.js +5 -0
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- 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/svm/SpokeUtils.d.ts +94 -0
- package/dist/esm/arch/svm/SpokeUtils.js +509 -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/{types → esm/arch}/svm/types.d.ts +9 -5
- package/dist/esm/arch/svm/types.js.map +1 -0
- package/dist/esm/arch/svm/utils.d.ts +59 -0
- package/dist/esm/arch/svm/utils.js +248 -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 +1 -1
- package/dist/esm/clients/HubPoolClient.js +16 -16
- 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 +67 -0
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +196 -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 +51 -55
- 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/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/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +4 -3
- 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 +8 -2
- 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 +66 -0
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +169 -0
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
- 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/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/SpokeUtils.js +5 -0
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- 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/svm/SpokeUtils.d.ts +95 -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/{esm → types/arch}/svm/types.d.ts +10 -4
- package/dist/types/arch/svm/types.d.ts.map +1 -0
- package/dist/types/arch/svm/utils.d.ts +60 -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 +1 -1
- 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 +68 -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/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/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 +67 -0
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -0
- 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/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/SpokeUtils.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/arch/evm/SpokeUtils.ts +5 -5
- package/src/arch/svm/SpokeUtils.ts +526 -0
- package/src/arch/svm/constants.ts +2 -0
- package/src/arch/svm/eventsClient.ts +334 -0
- package/src/arch/svm/index.ts +5 -1
- package/src/{svm → arch/svm}/types.ts +21 -4
- package/src/arch/svm/utils.ts +222 -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 +16 -16
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +23 -21
- package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +244 -0
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +44 -56
- 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/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 +45 -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/relayFeeCalculator/chain-queries/baseQuery.ts +5 -3
- package/src/relayFeeCalculator/chain-queries/factory.ts +21 -5
- package/src/relayFeeCalculator/chain-queries/index.ts +1 -0
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +193 -0
- package/src/utils/AddressUtils.ts +49 -6
- package/src/utils/ArrayUtils.ts +12 -0
- package/src/utils/EventUtils.ts +11 -11
- package/src/utils/JSONUtils.ts +2 -0
- package/src/utils/SpokeUtils.ts +7 -3
- 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/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/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/esm/{svm → arch/svm}/types.js +0 -0
|
@@ -19,24 +19,20 @@ import {
|
|
|
19
19
|
validateFillForDeposit,
|
|
20
20
|
chainIsEvm,
|
|
21
21
|
} from "../../utils";
|
|
22
|
-
import {
|
|
23
|
-
duplicateEvent,
|
|
24
|
-
sortEventsAscendingInPlace,
|
|
25
|
-
spreadEvent,
|
|
26
|
-
spreadEventWithBlockNumber,
|
|
27
|
-
} from "../../utils/EventUtils";
|
|
22
|
+
import { duplicateEvent, sortEventsAscendingInPlace } from "../../utils/EventUtils";
|
|
28
23
|
import { ZERO_ADDRESS } from "../../constants";
|
|
29
24
|
import {
|
|
30
25
|
Deposit,
|
|
31
26
|
DepositWithBlock,
|
|
27
|
+
EnabledDepositRouteWithBlock,
|
|
32
28
|
Fill,
|
|
33
29
|
FillStatus,
|
|
34
30
|
FillWithBlock,
|
|
35
|
-
Log,
|
|
36
31
|
RelayData,
|
|
37
32
|
RelayerRefundExecutionWithBlock,
|
|
38
33
|
RootBundleRelayWithBlock,
|
|
39
34
|
SlowFillRequestWithBlock,
|
|
35
|
+
SortableEvent,
|
|
40
36
|
SpeedUpWithBlock,
|
|
41
37
|
TokensBridged,
|
|
42
38
|
} from "../../interfaces";
|
|
@@ -48,7 +44,7 @@ import { HubPoolClient } from "../HubPoolClient";
|
|
|
48
44
|
export type SpokePoolUpdateSuccess = {
|
|
49
45
|
success: true;
|
|
50
46
|
currentTime: number;
|
|
51
|
-
events:
|
|
47
|
+
events: SortableEvent[][];
|
|
52
48
|
searchEndBlock: number;
|
|
53
49
|
};
|
|
54
50
|
export type SpokePoolUpdateFailure = {
|
|
@@ -105,11 +101,11 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
105
101
|
readonly hubPoolClient: HubPoolClient | null,
|
|
106
102
|
readonly chainId: number,
|
|
107
103
|
public deploymentBlock: number,
|
|
108
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "
|
|
104
|
+
eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 }
|
|
109
105
|
) {
|
|
110
106
|
super(eventSearchConfig);
|
|
111
|
-
this.
|
|
112
|
-
this.
|
|
107
|
+
this.firstHeightToSearch = eventSearchConfig.from;
|
|
108
|
+
this.latestHeightSearched = 0;
|
|
113
109
|
this.configStoreClient = hubPoolClient?.configStoreClient;
|
|
114
110
|
}
|
|
115
111
|
|
|
@@ -373,7 +369,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
373
369
|
const { chainToSendRefundTo: repaymentChainId } = getRefundInformationFromFill(
|
|
374
370
|
fillRepaymentData,
|
|
375
371
|
this.hubPoolClient!,
|
|
376
|
-
this.hubPoolClient!.
|
|
372
|
+
this.hubPoolClient!.latestHeightSearched
|
|
377
373
|
);
|
|
378
374
|
// In order to keep this function sync, we can't call verifyFillRepayment so we'll log any fills where
|
|
379
375
|
// the filler-specified repayment chain and repayment address is not a valid repayment upon
|
|
@@ -486,7 +482,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
486
482
|
* @see _update
|
|
487
483
|
*/
|
|
488
484
|
public async update(eventsToQuery = this._queryableEventNames()): Promise<void> {
|
|
489
|
-
const duplicateEvents:
|
|
485
|
+
const duplicateEvents: SortableEvent[] = [];
|
|
490
486
|
if (this.hubPoolClient !== null && !this.hubPoolClient.isUpdated) {
|
|
491
487
|
throw new Error("HubPoolClient not updated");
|
|
492
488
|
}
|
|
@@ -498,14 +494,14 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
498
494
|
const { events: queryResults, currentTime, searchEndBlock } = update;
|
|
499
495
|
|
|
500
496
|
if (eventsToQuery.includes("TokensBridged")) {
|
|
501
|
-
for (const event of queryResults[eventsToQuery.indexOf("TokensBridged")]) {
|
|
502
|
-
this.tokensBridged.push(
|
|
497
|
+
for (const event of queryResults[eventsToQuery.indexOf("TokensBridged")] as TokensBridged[]) {
|
|
498
|
+
this.tokensBridged.push(event);
|
|
503
499
|
}
|
|
504
500
|
}
|
|
505
501
|
|
|
506
502
|
// Performs the indexing of a deposit-like spoke pool event.
|
|
507
503
|
const queryDepositEvents = async (eventName: string) => {
|
|
508
|
-
const depositEvents = queryResults[eventsToQuery.indexOf(eventName)] ?? [];
|
|
504
|
+
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as DepositWithBlock[];
|
|
509
505
|
if (depositEvents.length > 0) {
|
|
510
506
|
this.log(
|
|
511
507
|
"debug",
|
|
@@ -518,22 +514,20 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
518
514
|
|
|
519
515
|
// For each deposit, resolve its quoteTimestamp to a block number on the HubPool.
|
|
520
516
|
// Don't bother filtering for uniqueness; the HubPoolClient handles this efficienctly.
|
|
521
|
-
const quoteBlockNumbers = await this.getBlockNumbers(
|
|
522
|
-
depositEvents.map(({ args }) => Number(args["quoteTimestamp"]))
|
|
523
|
-
);
|
|
517
|
+
const quoteBlockNumbers = await this.getBlockNumbers(depositEvents.map((e) => e.quoteTimestamp));
|
|
524
518
|
for (const event of depositEvents) {
|
|
525
|
-
const quoteBlockNumber = quoteBlockNumbers[Number(event.
|
|
519
|
+
const quoteBlockNumber = quoteBlockNumbers[Number(event.quoteTimestamp)];
|
|
526
520
|
|
|
527
521
|
// Derive and append the common properties that are not part of the onchain event.
|
|
528
522
|
const deposit = {
|
|
529
|
-
...
|
|
530
|
-
messageHash: getMessageHash(event.
|
|
523
|
+
...event,
|
|
524
|
+
messageHash: getMessageHash(event.message),
|
|
531
525
|
quoteBlockNumber,
|
|
532
526
|
originChainId: this.chainId,
|
|
533
527
|
// The following properties are placeholders to be updated immediately.
|
|
534
528
|
fromLiteChain: true,
|
|
535
529
|
toLiteChain: true,
|
|
536
|
-
}
|
|
530
|
+
};
|
|
537
531
|
|
|
538
532
|
deposit.fromLiteChain = this.isOriginLiteChain(deposit);
|
|
539
533
|
deposit.toLiteChain = this.isDestinationLiteChain(deposit);
|
|
@@ -564,10 +558,10 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
564
558
|
|
|
565
559
|
// Performs indexing of a "speed up deposit"-like event.
|
|
566
560
|
const querySpeedUpDepositEvents = (eventName: string) => {
|
|
567
|
-
const speedUpEvents = queryResults[eventsToQuery.indexOf(eventName)] ?? [];
|
|
561
|
+
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as SpeedUpWithBlock[];
|
|
568
562
|
|
|
569
563
|
for (const event of speedUpEvents) {
|
|
570
|
-
const speedUp = { ...
|
|
564
|
+
const speedUp = { ...event, originChainId: this.chainId };
|
|
571
565
|
assign(this.speedUps, [speedUp.depositor, speedUp.depositId.toString()], [speedUp]);
|
|
572
566
|
|
|
573
567
|
// Find deposit hash matching this speed up event and update the deposit data associated with the hash,
|
|
@@ -592,12 +586,12 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
592
586
|
|
|
593
587
|
// Performs indexing of "requested slow fill"-like events.
|
|
594
588
|
const queryRequestedSlowFillEvents = (eventName: string) => {
|
|
595
|
-
const slowFillRequests = queryResults[eventsToQuery.indexOf(eventName)];
|
|
589
|
+
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as SlowFillRequestWithBlock[];
|
|
596
590
|
for (const event of slowFillRequests) {
|
|
597
591
|
const slowFillRequest = {
|
|
598
|
-
...
|
|
592
|
+
...event,
|
|
599
593
|
destinationChainId: this.chainId,
|
|
600
|
-
}
|
|
594
|
+
};
|
|
601
595
|
|
|
602
596
|
if (eventName === "RequestedV3SlowFill") {
|
|
603
597
|
slowFillRequest.messageHash = getMessageHash(slowFillRequest.message);
|
|
@@ -623,7 +617,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
623
617
|
|
|
624
618
|
// Performs indexing of filled relay-like events.
|
|
625
619
|
const queryFilledRelayEvents = (eventName: string) => {
|
|
626
|
-
const fillEvents = queryResults[eventsToQuery.indexOf(eventName)] ?? [];
|
|
620
|
+
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as FillWithBlock[];
|
|
627
621
|
|
|
628
622
|
if (fillEvents.length > 0) {
|
|
629
623
|
this.log("debug", `Using ${fillEvents.length} newly queried ${eventName} events for chain ${this.chainId}`, {
|
|
@@ -635,13 +629,13 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
635
629
|
// test that the types are complete. A broader change in strategy for safely unpacking events will be introduced.
|
|
636
630
|
for (const event of fillEvents) {
|
|
637
631
|
const fill = {
|
|
638
|
-
...
|
|
632
|
+
...event,
|
|
639
633
|
destinationChainId: this.chainId,
|
|
640
|
-
}
|
|
634
|
+
};
|
|
641
635
|
|
|
642
636
|
if (eventName === "FilledV3Relay") {
|
|
643
|
-
fill.messageHash = getMessageHash(event.
|
|
644
|
-
fill.relayExecutionInfo.updatedMessageHash = getMessageHash(event.
|
|
637
|
+
fill.messageHash = getMessageHash((event as unknown as { message: string }).message);
|
|
638
|
+
fill.relayExecutionInfo.updatedMessageHash = getMessageHash(event.relayExecutionInfo.updatedMessage!);
|
|
645
639
|
}
|
|
646
640
|
|
|
647
641
|
// Sanity check that this event is not a duplicate.
|
|
@@ -664,30 +658,27 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
664
658
|
});
|
|
665
659
|
|
|
666
660
|
if (eventsToQuery.includes("EnabledDepositRoute")) {
|
|
667
|
-
const enableDepositsEvents = queryResults[eventsToQuery.indexOf("EnabledDepositRoute")]
|
|
661
|
+
const enableDepositsEvents = (queryResults[eventsToQuery.indexOf("EnabledDepositRoute")] ??
|
|
662
|
+
[]) as EnabledDepositRouteWithBlock[];
|
|
668
663
|
|
|
669
664
|
for (const event of enableDepositsEvents) {
|
|
670
|
-
|
|
671
|
-
assign(
|
|
672
|
-
this.depositRoutes,
|
|
673
|
-
[enableDeposit.originToken, enableDeposit.destinationChainId],
|
|
674
|
-
enableDeposit.enabled
|
|
675
|
-
);
|
|
665
|
+
assign(this.depositRoutes, [event.originToken, event.destinationChainId], event.enabled);
|
|
676
666
|
}
|
|
677
667
|
}
|
|
678
668
|
|
|
679
669
|
if (eventsToQuery.includes("RelayedRootBundle")) {
|
|
680
|
-
const relayedRootBundleEvents = queryResults[eventsToQuery.indexOf("RelayedRootBundle")]
|
|
670
|
+
const relayedRootBundleEvents = (queryResults[eventsToQuery.indexOf("RelayedRootBundle")] ??
|
|
671
|
+
[]) as RootBundleRelayWithBlock[];
|
|
681
672
|
for (const event of relayedRootBundleEvents) {
|
|
682
|
-
this.rootBundleRelays.push(
|
|
673
|
+
this.rootBundleRelays.push(event);
|
|
683
674
|
}
|
|
684
675
|
}
|
|
685
676
|
|
|
686
677
|
if (eventsToQuery.includes("ExecutedRelayerRefundRoot")) {
|
|
687
|
-
const refundEvents = queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")]
|
|
678
|
+
const refundEvents = (queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")] ??
|
|
679
|
+
[]) as RelayerRefundExecutionWithBlock[];
|
|
688
680
|
for (const event of refundEvents) {
|
|
689
|
-
|
|
690
|
-
this.relayerRefundExecutions.push(executedRefund);
|
|
681
|
+
this.relayerRefundExecutions.push(event);
|
|
691
682
|
}
|
|
692
683
|
}
|
|
693
684
|
|
|
@@ -700,12 +691,12 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
700
691
|
|
|
701
692
|
// Next iteration should start off from where this one ended.
|
|
702
693
|
this.currentTime = currentTime;
|
|
703
|
-
this.
|
|
704
|
-
this.
|
|
705
|
-
this.eventSearchConfig.
|
|
694
|
+
this.latestHeightSearched = searchEndBlock;
|
|
695
|
+
this.firstHeightToSearch = searchEndBlock + 1;
|
|
696
|
+
this.eventSearchConfig.to = undefined; // Caller can re-set on subsequent updates if necessary
|
|
706
697
|
this.isUpdated = true;
|
|
707
698
|
this.log("debug", `SpokePool client for chain ${this.chainId} updated!`, {
|
|
708
|
-
|
|
699
|
+
nextFirstHeightToSearch: this.firstHeightToSearch,
|
|
709
700
|
});
|
|
710
701
|
}
|
|
711
702
|
|
|
@@ -848,19 +839,16 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
848
839
|
/**
|
|
849
840
|
* Retrieves the fill status for a given relay data.
|
|
850
841
|
* @param relayData The relay data to retrieve the fill status for.
|
|
851
|
-
* @param
|
|
842
|
+
* @param atHeight The height at which to query the fill status.
|
|
852
843
|
* @returns The fill status for the given relay data.
|
|
853
844
|
*/
|
|
854
|
-
public abstract relayFillStatus(relayData: RelayData,
|
|
845
|
+
public abstract relayFillStatus(relayData: RelayData, atHeight?: number): Promise<FillStatus>;
|
|
855
846
|
|
|
856
847
|
/**
|
|
857
848
|
* Retrieves the fill status for an array of given relay data.
|
|
858
849
|
* @param relayData The array relay data to retrieve the fill status for.
|
|
859
|
-
* @param
|
|
850
|
+
* @param atHeight The height at which to query the fill status.
|
|
860
851
|
* @returns The fill status for each of the given relay data.
|
|
861
852
|
*/
|
|
862
|
-
public abstract fillStatusArray(
|
|
863
|
-
relayData: RelayData[],
|
|
864
|
-
blockTag?: number | "latest"
|
|
865
|
-
): Promise<(FillStatus | undefined)[]>;
|
|
853
|
+
public abstract fillStatusArray(relayData: RelayData[], atHeight?: number): Promise<(FillStatus | undefined)[]>;
|
|
866
854
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { EVMSpokePoolClient } from "./EVMSpokePoolClient";
|
|
2
|
+
import { SvmSpokePoolClient } from "./SVMSpokePoolClient";
|
|
2
3
|
import { SpokePoolClient } from "./SpokePoolClient";
|
|
3
4
|
|
|
4
5
|
export { EVMSpokePoolClient } from "./EVMSpokePoolClient";
|
|
5
6
|
export { SpokePoolClient, SpokePoolUpdate } from "./SpokePoolClient";
|
|
7
|
+
export { SvmSpokePoolClient } from "./SVMSpokePoolClient";
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Checks if a SpokePoolClient is an EVMSpokePoolClient.
|
|
@@ -12,3 +14,12 @@ export { SpokePoolClient, SpokePoolUpdate } from "./SpokePoolClient";
|
|
|
12
14
|
export function isEVMSpokePoolClient(spokePoolClient: SpokePoolClient): spokePoolClient is EVMSpokePoolClient {
|
|
13
15
|
return spokePoolClient instanceof EVMSpokePoolClient;
|
|
14
16
|
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a SpokePoolClient is an SVMSpokePoolClient.
|
|
20
|
+
* @param spokePoolClient The SpokePoolClient to check.
|
|
21
|
+
* @returns True if the SpokePoolClient is an SVMSpokePoolClient, false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export function isSvmSpokePoolClient(spokePoolClient: SpokePoolClient): spokePoolClient is SvmSpokePoolClient {
|
|
24
|
+
return spokePoolClient instanceof SvmSpokePoolClient;
|
|
25
|
+
}
|
package/src/clients/index.ts
CHANGED
|
@@ -6,6 +6,6 @@ export {
|
|
|
6
6
|
} from "./AcrossConfigStoreClient";
|
|
7
7
|
export { UpdateFailureReason } from "./BaseAbstractClient";
|
|
8
8
|
export { HubPoolClient, LpFeeRequest } from "./HubPoolClient";
|
|
9
|
-
export { SpokePoolClient, SpokePoolUpdate, EVMSpokePoolClient } from "./SpokePoolClient";
|
|
9
|
+
export { SpokePoolClient, SpokePoolUpdate, EVMSpokePoolClient, SvmSpokePoolClient } from "./SpokePoolClient";
|
|
10
10
|
export * as BundleDataClient from "./BundleDataClient";
|
|
11
11
|
export * as mocks from "./mocks";
|
|
@@ -33,7 +33,7 @@ export class MockConfigStoreClient extends AcrossConfigStoreClient {
|
|
|
33
33
|
constructor(
|
|
34
34
|
logger: winston.Logger,
|
|
35
35
|
configStore: Contract,
|
|
36
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "
|
|
36
|
+
eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 },
|
|
37
37
|
configStoreVersion: number,
|
|
38
38
|
chainId = 1,
|
|
39
39
|
mockUpdate = false,
|
|
@@ -97,7 +97,7 @@ export class MockConfigStoreClient extends AcrossConfigStoreClient {
|
|
|
97
97
|
return Promise.resolve({
|
|
98
98
|
success: true,
|
|
99
99
|
chainId: this.chainId as number,
|
|
100
|
-
searchEndBlock: this.eventSearchConfig.
|
|
100
|
+
searchEndBlock: this.eventSearchConfig.to || latestBlockSearched,
|
|
101
101
|
events: {
|
|
102
102
|
updatedGlobalConfigEvents: events["UpdatedGlobalConfig"].map(spreadEventWithBlockNumber),
|
|
103
103
|
globalConfigUpdateTimes,
|
|
@@ -79,7 +79,7 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
setLatestBlockNumber(blockNumber: number) {
|
|
82
|
-
this.
|
|
82
|
+
this.latestHeightSearched = blockNumber;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
addL1Token(l1Token: L1Token) {
|
|
@@ -158,7 +158,7 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
158
158
|
latestBlockSearched,
|
|
159
159
|
pendingRootBundleProposal: this.rootBundleProposal,
|
|
160
160
|
events,
|
|
161
|
-
searchEndBlock: this.eventSearchConfig.
|
|
161
|
+
searchEndBlock: this.eventSearchConfig.to || latestBlockSearched,
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
bnOne,
|
|
28
28
|
toAddress,
|
|
29
29
|
toBytes32,
|
|
30
|
+
spreadEventWithBlockNumber,
|
|
30
31
|
} from "../../utils";
|
|
31
32
|
import { EVMSpokePoolClient, SpokePoolUpdate } from "../SpokePoolClient";
|
|
32
33
|
import { HubPoolClient } from "../HubPoolClient";
|
|
@@ -50,7 +51,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
50
51
|
opts: { hubPoolClient: HubPoolClient | null } = { hubPoolClient: null }
|
|
51
52
|
) {
|
|
52
53
|
super(logger, spokePool, opts.hubPoolClient, chainId, deploymentBlock);
|
|
53
|
-
this.
|
|
54
|
+
this.latestHeightSearched = deploymentBlock;
|
|
54
55
|
this.eventManager = getEventManager(chainId, this.eventSignatures, deploymentBlock);
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -67,7 +68,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
setLatestBlockNumber(blockNumber: number): void {
|
|
70
|
-
this.
|
|
71
|
+
this.latestHeightSearched = blockNumber;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
setDepositIds(_depositIds: BigNumber[]): void {
|
|
@@ -106,12 +107,16 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
106
107
|
}
|
|
107
108
|
});
|
|
108
109
|
|
|
110
|
+
const eventsWithBlockNumber = events.map((eventList) =>
|
|
111
|
+
eventList.map((event) => spreadEventWithBlockNumber(event))
|
|
112
|
+
);
|
|
113
|
+
|
|
109
114
|
return Promise.resolve({
|
|
110
115
|
success: true,
|
|
111
116
|
firstDepositId: bnZero,
|
|
112
117
|
currentTime,
|
|
113
|
-
events,
|
|
114
|
-
searchEndBlock: this.eventSearchConfig.
|
|
118
|
+
events: eventsWithBlockNumber,
|
|
119
|
+
searchEndBlock: this.eventSearchConfig.to || latestBlockSearched,
|
|
115
120
|
});
|
|
116
121
|
}
|
|
117
122
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { providers } from "ethers";
|
|
2
2
|
import { bnOne } from "../../utils";
|
|
3
|
-
import {
|
|
3
|
+
import { EvmGasPriceEstimate } from "../types";
|
|
4
4
|
import * as ethereum from "./ethereum";
|
|
5
5
|
import { GasPriceEstimateOptions } from "../oracle";
|
|
6
6
|
|
|
@@ -16,7 +16,10 @@ import { GasPriceEstimateOptions } from "../oracle";
|
|
|
16
16
|
* function.
|
|
17
17
|
* @returns GasPriceEstimate
|
|
18
18
|
*/
|
|
19
|
-
export async function eip1559(
|
|
19
|
+
export async function eip1559(
|
|
20
|
+
provider: providers.Provider,
|
|
21
|
+
opts: GasPriceEstimateOptions
|
|
22
|
+
): Promise<EvmGasPriceEstimate> {
|
|
20
23
|
const { maxFeePerGas: _maxFeePerGas, maxPriorityFeePerGas } = await ethereum.eip1559(provider, opts);
|
|
21
24
|
|
|
22
25
|
// eip1559() sets maxFeePerGas = lastBaseFeePerGas + maxPriorityFeePerGas, so back out priority fee.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
2
|
import { providers } from "ethers";
|
|
3
3
|
import { BigNumber, bnZero, fixedPointAdjustment, getNetworkName, parseUnits } from "../../utils";
|
|
4
|
-
import {
|
|
4
|
+
import { EvmGasPriceEstimate } from "../types";
|
|
5
5
|
import { gasPriceError } from "../util";
|
|
6
6
|
import { GasPriceEstimateOptions } from "../oracle";
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ import { GasPriceEstimateOptions } from "../oracle";
|
|
|
13
13
|
* @param priorityFeeMultiplier Amount to multiply priority fee or unused for legacy gas pricing.
|
|
14
14
|
* @returns Promise of gas price estimate object.
|
|
15
15
|
*/
|
|
16
|
-
export function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<
|
|
16
|
+
export function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<EvmGasPriceEstimate> {
|
|
17
17
|
return eip1559Raw(provider, opts.chainId, opts.baseFeeMultiplier, opts.priorityFeeMultiplier);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -29,7 +29,7 @@ export async function eip1559Raw(
|
|
|
29
29
|
chainId: number,
|
|
30
30
|
baseFeeMultiplier: BigNumber,
|
|
31
31
|
priorityFeeMultiplier: BigNumber
|
|
32
|
-
): Promise<
|
|
32
|
+
): Promise<EvmGasPriceEstimate> {
|
|
33
33
|
const [{ baseFeePerGas }, _maxPriorityFeePerGas] = await Promise.all([
|
|
34
34
|
provider.getBlock("pending"),
|
|
35
35
|
(provider as providers.JsonRpcProvider).send("eth_maxPriorityFeePerGas", []),
|
|
@@ -54,7 +54,10 @@ export async function eip1559Raw(
|
|
|
54
54
|
* @dev Its recommended to use the eip1559Raw method over this one where possible as it will be more accurate.
|
|
55
55
|
* @returns GasPriceEstimate
|
|
56
56
|
*/
|
|
57
|
-
export async function legacy(
|
|
57
|
+
export async function legacy(
|
|
58
|
+
provider: providers.Provider,
|
|
59
|
+
opts: GasPriceEstimateOptions
|
|
60
|
+
): Promise<EvmGasPriceEstimate> {
|
|
58
61
|
const { chainId, baseFeeMultiplier } = opts;
|
|
59
62
|
const gasPrice = await provider.getGasPrice();
|
|
60
63
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PopulatedTransaction } from "ethers";
|
|
1
2
|
import { Address, Hex, PublicClient } from "viem";
|
|
2
3
|
import { estimateGas } from "viem/linea";
|
|
3
4
|
import { DEFAULT_SIMULATED_RELAYER_ADDRESS as account } from "../../constants";
|
|
@@ -26,7 +27,8 @@ export async function eip1559(
|
|
|
26
27
|
provider: PublicClient,
|
|
27
28
|
opts: GasPriceEstimateOptions
|
|
28
29
|
): Promise<InternalGasPriceEstimate> {
|
|
29
|
-
const { unsignedTx, priorityFeeMultiplier } = opts;
|
|
30
|
+
const { unsignedTx: _unsignedTx, priorityFeeMultiplier } = opts;
|
|
31
|
+
const unsignedTx = _unsignedTx as PopulatedTransaction; // Cast the opaque unsignedTx type to an ethers PopulatedTransaction.
|
|
30
32
|
const { baseFeePerGas, priorityFeePerGas: _priorityFeePerGas } = await estimateGas(provider, {
|
|
31
33
|
account: (unsignedTx?.from as Address) ?? account,
|
|
32
34
|
to: (unsignedTx?.to as Address) ?? account,
|
|
@@ -2,7 +2,7 @@ import { providers } from "ethers";
|
|
|
2
2
|
import { BaseHTTPAdapter, BaseHTTPAdapterArgs } from "../../priceClient/adapters/baseAdapter";
|
|
3
3
|
import { BigNumber, bnZero, fixedPointAdjustment, isDefined, parseUnits } from "../../utils";
|
|
4
4
|
import { CHAIN_IDs } from "../../constants";
|
|
5
|
-
import {
|
|
5
|
+
import { EvmGasPriceEstimate } from "../types";
|
|
6
6
|
import { gasPriceError } from "../util";
|
|
7
7
|
import { eip1559 } from "./ethereum";
|
|
8
8
|
import { GasPriceEstimateOptions } from "../oracle";
|
|
@@ -38,7 +38,7 @@ export class PolygonGasStation extends BaseHTTPAdapter {
|
|
|
38
38
|
this.chainId = chainId;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
async getFeeData(strategy: "safeLow" | "standard" | "fast" = "fast"): Promise<
|
|
41
|
+
async getFeeData(strategy: "safeLow" | "standard" | "fast" = "fast"): Promise<EvmGasPriceEstimate> {
|
|
42
42
|
const gas = await this.query("v2", {});
|
|
43
43
|
|
|
44
44
|
const gasPrice = (gas as GasStationV2Response)?.[strategy];
|
|
@@ -69,7 +69,7 @@ export class PolygonGasStation extends BaseHTTPAdapter {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
class MockRevertingPolygonGasStation extends PolygonGasStation {
|
|
72
|
-
getFeeData(): Promise<
|
|
72
|
+
getFeeData(): Promise<EvmGasPriceEstimate> {
|
|
73
73
|
throw new Error();
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -78,7 +78,7 @@ export const MockPolygonGasStationBaseFee = () => parseUnits("12", 9);
|
|
|
78
78
|
export const MockPolygonGasStationPriorityFee = () => parseUnits("1", 9);
|
|
79
79
|
|
|
80
80
|
class MockPolygonGasStation extends PolygonGasStation {
|
|
81
|
-
getFeeData(): Promise<
|
|
81
|
+
getFeeData(): Promise<EvmGasPriceEstimate> {
|
|
82
82
|
return Promise.resolve({
|
|
83
83
|
maxPriorityFeePerGas: MockPolygonGasStationPriorityFee(),
|
|
84
84
|
maxFeePerGas: MockPolygonGasStationBaseFee().add(MockPolygonGasStationPriorityFee()),
|
|
@@ -90,12 +90,12 @@ class MockPolygonGasStation extends PolygonGasStation {
|
|
|
90
90
|
* @notice Returns the gas price suggested by the Polygon GasStation API or reconstructs it using
|
|
91
91
|
* the eip1559() method as a fallback.
|
|
92
92
|
* @param provider Ethers Provider.
|
|
93
|
-
* @returns
|
|
93
|
+
* @returns EvmGasPriceEstimate
|
|
94
94
|
*/
|
|
95
95
|
export async function gasStation(
|
|
96
96
|
provider: providers.Provider,
|
|
97
97
|
opts: GasPriceEstimateOptions
|
|
98
|
-
): Promise<
|
|
98
|
+
): Promise<EvmGasPriceEstimate> {
|
|
99
99
|
const { chainId, baseFeeMultiplier, priorityFeeMultiplier } = opts;
|
|
100
100
|
let gasStation: PolygonGasStation;
|
|
101
101
|
if (process.env.TEST_POLYGON_GAS_STATION === "true") {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SVMProvider } from "../../arch/svm";
|
|
2
|
+
import { toBN, dedupArray, parseUnits } from "../../utils";
|
|
3
|
+
import { GasPriceEstimate } from "../types";
|
|
4
|
+
import { GasPriceEstimateOptions } from "../oracle";
|
|
5
|
+
import { CompilableTransactionMessage, TransactionMessageBytesBase64, compileTransaction } from "@solana/kit";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @notice Returns result of getFeeForMessage and getRecentPrioritizationFees RPC calls.
|
|
9
|
+
* @returns GasPriceEstimate
|
|
10
|
+
*/
|
|
11
|
+
export async function messageFee(provider: SVMProvider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
|
|
12
|
+
const { unsignedTx: _unsignedTx } = opts;
|
|
13
|
+
|
|
14
|
+
// Cast the opaque unsignedTx type to a solana-kit CompilableTransactionMessage.
|
|
15
|
+
const unsignedTx = _unsignedTx as CompilableTransactionMessage;
|
|
16
|
+
const compiledTransaction = compileTransaction(unsignedTx);
|
|
17
|
+
|
|
18
|
+
// Get this base fee. This should result in LAMPORTS_PER_SIGNATURE * nSignatures.
|
|
19
|
+
const encodedTransactionMessage = Buffer.from(compiledTransaction.messageBytes).toString(
|
|
20
|
+
"base64"
|
|
21
|
+
) as TransactionMessageBytesBase64;
|
|
22
|
+
const baseFeeResponse = await provider.getFeeForMessage(encodedTransactionMessage).send();
|
|
23
|
+
|
|
24
|
+
// Get the priority fee by calling `getRecentPrioritzationFees` on all the addresses in the transaction's instruction array.
|
|
25
|
+
const instructionAddresses = dedupArray(unsignedTx.instructions.map((instruction) => instruction.programAddress));
|
|
26
|
+
const recentPriorityFees = await provider.getRecentPrioritizationFees(instructionAddresses).send();
|
|
27
|
+
|
|
28
|
+
// Take the most recent 25 slots and find the average of the nonzero priority fees.
|
|
29
|
+
const nonzeroPrioritizationFees = recentPriorityFees
|
|
30
|
+
.slice(125)
|
|
31
|
+
.map((value) => value.prioritizationFee)
|
|
32
|
+
.filter((fee) => fee > 0);
|
|
33
|
+
const totalPrioritizationFees = nonzeroPrioritizationFees.reduce((acc, fee) => acc + fee, BigInt(0));
|
|
34
|
+
|
|
35
|
+
// Optionally impose a minimum priority fee, denoted in microLamports/computeUnit.
|
|
36
|
+
const flooredPriorityFeePerGas = parseUnits(process.env[`MIN_PRIORITY_FEE_PER_GAS_${opts.chainId}`] || "0", 6);
|
|
37
|
+
let microLamportsPerComputeUnit = toBN(totalPrioritizationFees / BigInt(nonzeroPrioritizationFees.length));
|
|
38
|
+
if (microLamportsPerComputeUnit.lt(flooredPriorityFeePerGas)) {
|
|
39
|
+
microLamportsPerComputeUnit = flooredPriorityFeePerGas;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
baseFee: toBN(baseFeeResponse!.value!),
|
|
43
|
+
microLamportsPerComputeUnit,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { getGasPriceEstimate } from "./oracle";
|
|
2
|
-
export { GasPriceEstimate } from "./types";
|
|
2
|
+
export { GasPriceEstimate, EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
2
|
import { Transport } from "viem";
|
|
3
|
-
import {
|
|
3
|
+
import { providers } from "ethers";
|
|
4
4
|
import { CHAIN_IDs } from "../constants";
|
|
5
5
|
import { BigNumber, chainIsOPStack, fixedPointAdjustment, toBNWei } from "../utils";
|
|
6
|
+
import { SVMProvider as SolanaProvider } from "../arch/svm";
|
|
6
7
|
import { GasPriceEstimate } from "./types";
|
|
7
8
|
import { getPublicClient } from "./util";
|
|
8
9
|
import * as arbitrum from "./adapters/arbitrum";
|
|
9
10
|
import * as ethereum from "./adapters/ethereum";
|
|
10
11
|
import * as polygon from "./adapters/polygon";
|
|
11
12
|
import * as lineaViem from "./adapters/linea-viem";
|
|
13
|
+
import * as solana from "./adapters/solana";
|
|
12
14
|
|
|
13
15
|
export interface GasPriceEstimateOptions {
|
|
14
16
|
// baseFeeMultiplier Multiplier applied to base fee for EIP1559 gas prices (or total fee for legacy).
|
|
@@ -19,8 +21,8 @@ export interface GasPriceEstimateOptions {
|
|
|
19
21
|
legacyFallback: boolean;
|
|
20
22
|
// chainId The chain ID to query for gas prices. If omitted can be inferred by provider.
|
|
21
23
|
chainId: number;
|
|
22
|
-
// unsignedTx The unsigned transaction used for simulation by Linea's Viem provider to produce the priority gas fee.
|
|
23
|
-
unsignedTx?:
|
|
24
|
+
// unsignedTx The unsigned transaction used for simulation by Linea's Viem provider to produce the priority gas fee, or alternatively, by Solana's provider to determine the base/priority fee.
|
|
25
|
+
unsignedTx?: unknown;
|
|
24
26
|
// transport Viem Transport object to use for querying gas fees used for testing.
|
|
25
27
|
transport?: Transport;
|
|
26
28
|
}
|
|
@@ -39,7 +41,7 @@ const VIEM_CHAINS = [CHAIN_IDs.LINEA];
|
|
|
39
41
|
* @returns An object of type GasPriceEstimate.
|
|
40
42
|
*/
|
|
41
43
|
export async function getGasPriceEstimate(
|
|
42
|
-
provider: providers.Provider,
|
|
44
|
+
provider: providers.Provider | SolanaProvider,
|
|
43
45
|
opts: Partial<GasPriceEstimateOptions> = {}
|
|
44
46
|
): Promise<GasPriceEstimate> {
|
|
45
47
|
const baseFeeMultiplier = opts.baseFeeMultiplier ?? toBNWei("1");
|
|
@@ -53,6 +55,20 @@ export async function getGasPriceEstimate(
|
|
|
53
55
|
`Require 1.0 < priority fee multiplier (${priorityFeeMultiplier}) <= 5.0 for a total gas multiplier within [+1.0, +5.0]`
|
|
54
56
|
);
|
|
55
57
|
|
|
58
|
+
// Exit here if we need to estimate on Solana.
|
|
59
|
+
if (!(provider instanceof providers.Provider)) {
|
|
60
|
+
const optsWithDefaults: GasPriceEstimateOptions = {
|
|
61
|
+
...GAS_PRICE_ESTIMATE_DEFAULTS,
|
|
62
|
+
baseFeeMultiplier,
|
|
63
|
+
priorityFeeMultiplier,
|
|
64
|
+
...opts,
|
|
65
|
+
chainId: opts.chainId ?? CHAIN_IDs.SOLANA,
|
|
66
|
+
};
|
|
67
|
+
return solana.messageFee(provider, optsWithDefaults);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Cast the provider to an ethers provider, which should be given to the oracle when querying an EVM network.
|
|
71
|
+
provider = provider as providers.Provider;
|
|
56
72
|
const chainId = opts.chainId ?? (await provider.getNetwork()).chainId;
|
|
57
73
|
const optsWithDefaults: GasPriceEstimateOptions = {
|
|
58
74
|
...GAS_PRICE_ESTIMATE_DEFAULTS,
|
|
@@ -2,12 +2,18 @@ import { type Chain, type Transport, PublicClient, FeeValuesEIP1559 } from "viem
|
|
|
2
2
|
import { BigNumber } from "../utils";
|
|
3
3
|
|
|
4
4
|
export type InternalGasPriceEstimate = FeeValuesEIP1559;
|
|
5
|
+
export type GasPriceEstimate = EvmGasPriceEstimate | SvmGasPriceEstimate;
|
|
5
6
|
|
|
6
|
-
export type
|
|
7
|
+
export type EvmGasPriceEstimate = {
|
|
7
8
|
maxFeePerGas: BigNumber;
|
|
8
9
|
maxPriorityFeePerGas: BigNumber;
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
export type SvmGasPriceEstimate = {
|
|
13
|
+
baseFee: BigNumber;
|
|
14
|
+
microLamportsPerComputeUnit: BigNumber;
|
|
15
|
+
};
|
|
16
|
+
|
|
11
17
|
export interface GasPriceFeed {
|
|
12
18
|
(provider: PublicClient<Transport, Chain>, chainId: number): Promise<InternalGasPriceEstimate>;
|
|
13
19
|
}
|
package/src/index.ts
CHANGED
|
@@ -37,6 +37,10 @@ export interface DepositWithBlock extends Deposit, SortableEvent {
|
|
|
37
37
|
quoteBlockNumber: number;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
export interface DepositWithTime extends Deposit, SortableEvent {
|
|
41
|
+
depositTimestamp: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
export enum FillStatus {
|
|
41
45
|
Unfilled = 0,
|
|
42
46
|
RequestedSlowFill,
|
|
@@ -66,7 +70,17 @@ export interface Fill extends Omit<RelayData, "message"> {
|
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
export interface FillWithBlock extends Fill, SortableEvent {}
|
|
73
|
+
export interface FillWithTime extends Fill, SortableEvent {
|
|
74
|
+
fillTimestamp: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface EnabledDepositRoute {
|
|
78
|
+
originToken: string;
|
|
79
|
+
destinationChainId: number;
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
}
|
|
69
82
|
|
|
83
|
+
export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
|
|
70
84
|
export interface SpeedUp {
|
|
71
85
|
depositor: string;
|
|
72
86
|
depositorSignature: string;
|