@across-protocol/sdk 4.1.63-beta.3 → 4.1.64-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/arch/evm/SpokeUtils.d.ts +1 -1
- package/dist/cjs/arch/evm/SpokeUtils.js +5 -6
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/evm/index.d.ts +0 -1
- package/dist/cjs/arch/evm/index.js +0 -1
- package/dist/cjs/arch/evm/index.js.map +1 -1
- package/dist/cjs/arch/svm/index.d.ts +1 -5
- package/dist/cjs/arch/svm/index.js +2 -6
- package/dist/cjs/arch/svm/index.js.map +1 -1
- 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 +5 -6
- package/dist/cjs/clients/BaseAbstractClient.js +19 -30
- package/dist/cjs/clients/BaseAbstractClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +11 -15
- 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 +3 -4
- package/dist/cjs/clients/HubPoolClient.js +17 -18
- 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 +20 -23
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -5
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +57 -54
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/index.d.ts +0 -3
- package/dist/cjs/clients/SpokePoolClient/index.js +1 -8
- 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 +1 -2
- 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 +4 -7
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/index.d.ts +0 -2
- package/dist/cjs/clients/mocks/index.js +0 -2
- package/dist/cjs/clients/mocks/index.js.map +1 -1
- package/dist/cjs/constants.d.ts +0 -1
- package/dist/cjs/constants.js +1 -2
- 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 +2 -3
- 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/index.d.ts +1 -1
- package/dist/cjs/gasPriceOracle/oracle.d.ts +3 -4
- package/dist/cjs/gasPriceOracle/oracle.js +9 -16
- package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/gasPriceOracle/types.d.ts +1 -6
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/SpokePool.d.ts +0 -13
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/providers/index.d.ts +1 -1
- package/dist/cjs/providers/index.js +2 -1
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/providers/{mocks/mockEthersProvider.js → mockProvider.js} +2 -2
- package/dist/cjs/providers/mockProvider.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +8 -10
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +2 -4
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +2 -8
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/index.d.ts +0 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js +0 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +0 -2
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +4 -10
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/svm/eventsClient.d.ts +15 -0
- package/dist/cjs/svm/eventsClient.js +157 -0
- package/dist/cjs/svm/eventsClient.js.map +1 -0
- package/dist/cjs/svm/index.d.ts +3 -0
- package/dist/cjs/svm/index.js +8 -0
- package/dist/cjs/svm/index.js.map +1 -0
- package/dist/cjs/{arch/svm → svm}/types.d.ts +4 -9
- package/dist/cjs/svm/types.js.map +1 -0
- package/dist/cjs/svm/utils/events.d.ts +8 -0
- package/dist/cjs/svm/utils/events.js +47 -0
- package/dist/cjs/svm/utils/events.js.map +1 -0
- package/dist/cjs/svm/utils/helpers.d.ts +2 -0
- package/dist/cjs/svm/utils/helpers.js +19 -0
- package/dist/cjs/svm/utils/helpers.js.map +1 -0
- package/dist/cjs/svm/utils/index.d.ts +1 -0
- package/dist/cjs/svm/utils/index.js +5 -0
- package/dist/cjs/svm/utils/index.js.map +1 -0
- package/dist/cjs/utils/AddressUtils.d.ts +3 -9
- package/dist/cjs/utils/AddressUtils.js +6 -36
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/ArrayUtils.d.ts +0 -1
- package/dist/cjs/utils/ArrayUtils.js +1 -6
- package/dist/cjs/utils/ArrayUtils.js.map +1 -1
- package/dist/cjs/utils/BlockUtils.d.ts +27 -2
- package/dist/cjs/utils/BlockUtils.js +208 -2
- package/dist/cjs/utils/BlockUtils.js.map +1 -1
- package/dist/cjs/utils/EventUtils.d.ts +4 -4
- package/dist/cjs/utils/EventUtils.js +4 -7
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/JSONUtils.js +0 -3
- package/dist/cjs/utils/JSONUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.js +0 -5
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +0 -1
- package/dist/cjs/utils/index.js +0 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +1 -1
- package/dist/esm/arch/evm/SpokeUtils.js +5 -6
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/evm/index.d.ts +0 -1
- package/dist/esm/arch/evm/index.js +0 -1
- package/dist/esm/arch/evm/index.js.map +1 -1
- package/dist/esm/arch/svm/index.d.ts +1 -5
- package/dist/esm/arch/svm/index.js +1 -5
- package/dist/esm/arch/svm/index.js.map +1 -1
- 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 +5 -6
- package/dist/esm/clients/BaseAbstractClient.js +19 -30
- package/dist/esm/clients/BaseAbstractClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +14 -17
- 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 +3 -4
- package/dist/esm/clients/HubPoolClient.js +18 -19
- 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 +20 -23
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +59 -57
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/index.d.ts +0 -8
- package/dist/esm/clients/SpokePoolClient/index.js +0 -10
- 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 +5 -8
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/index.d.ts +0 -2
- package/dist/esm/clients/mocks/index.js +0 -2
- package/dist/esm/clients/mocks/index.js.map +1 -1
- package/dist/esm/constants.d.ts +0 -1
- package/dist/esm/constants.js +0 -1
- 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 +2 -3
- 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/index.d.ts +1 -1
- package/dist/esm/gasPriceOracle/oracle.d.ts +3 -4
- package/dist/esm/gasPriceOracle/oracle.js +9 -18
- package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/gasPriceOracle/types.d.ts +1 -6
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/SpokePool.d.ts +0 -13
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/providers/index.d.ts +1 -1
- package/dist/esm/providers/index.js +2 -1
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/providers/{mocks/mockEthersProvider.js → mockProvider.js} +2 -2
- package/dist/esm/providers/mockProvider.js.map +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -10
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +2 -4
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +5 -11
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/index.d.ts +0 -1
- package/dist/esm/relayFeeCalculator/chain-queries/index.js +0 -1
- package/dist/esm/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +1 -12
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +5 -10
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/svm/eventsClient.d.ts +51 -0
- package/dist/esm/svm/eventsClient.js +195 -0
- package/dist/esm/svm/eventsClient.js.map +1 -0
- package/dist/esm/svm/index.d.ts +3 -0
- package/dist/esm/svm/index.js +5 -0
- package/dist/esm/svm/index.js.map +1 -0
- package/dist/esm/{arch/svm → svm}/types.d.ts +4 -9
- package/dist/esm/svm/types.js.map +1 -0
- package/dist/esm/svm/utils/events.d.ts +17 -0
- package/dist/esm/svm/utils/events.js +55 -0
- package/dist/esm/svm/utils/events.js.map +1 -0
- package/dist/esm/svm/utils/helpers.d.ts +5 -0
- package/dist/esm/svm/utils/helpers.js +18 -0
- package/dist/esm/svm/utils/helpers.js.map +1 -0
- package/dist/esm/svm/utils/index.d.ts +1 -0
- package/dist/esm/svm/utils/index.js +2 -0
- package/dist/esm/svm/utils/index.js.map +1 -0
- package/dist/esm/utils/AddressUtils.d.ts +3 -9
- package/dist/esm/utils/AddressUtils.js +6 -41
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/ArrayUtils.d.ts +0 -6
- package/dist/esm/utils/ArrayUtils.js +0 -9
- package/dist/esm/utils/ArrayUtils.js.map +1 -1
- package/dist/esm/utils/BlockUtils.d.ts +36 -2
- package/dist/esm/utils/BlockUtils.js +243 -2
- package/dist/esm/utils/BlockUtils.js.map +1 -1
- package/dist/esm/utils/EventUtils.d.ts +4 -4
- package/dist/esm/utils/EventUtils.js +4 -7
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/JSONUtils.js +0 -3
- package/dist/esm/utils/JSONUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.js +0 -5
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/index.d.ts +0 -1
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/index.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/evm/index.d.ts +0 -1
- package/dist/types/arch/evm/index.d.ts.map +1 -1
- package/dist/types/arch/svm/index.d.ts +1 -5
- package/dist/types/arch/svm/index.d.ts.map +1 -1
- 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 +5 -6
- 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 +3 -4
- 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/SpokePoolClient.d.ts +7 -7
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/index.d.ts +0 -8
- 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/index.d.ts +0 -2
- package/dist/types/clients/mocks/index.d.ts.map +1 -1
- package/dist/types/constants.d.ts +0 -1
- 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/index.d.ts +1 -1
- package/dist/types/gasPriceOracle/index.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/oracle.d.ts +3 -4
- package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/types.d.ts +1 -6
- package/dist/types/gasPriceOracle/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +0 -13
- 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/mockEthersProvider.d.ts → mockProvider.d.ts} +1 -1
- package/dist/types/providers/mockProvider.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 +2 -4
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/index.d.ts +0 -1
- package/dist/types/relayFeeCalculator/chain-queries/index.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +1 -12
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/svm/eventsClient.d.ts +52 -0
- package/dist/types/svm/eventsClient.d.ts.map +1 -0
- package/dist/types/svm/index.d.ts +4 -0
- package/dist/types/svm/index.d.ts.map +1 -0
- package/dist/types/{arch/svm → svm}/types.d.ts +4 -9
- package/dist/types/svm/types.d.ts.map +1 -0
- package/dist/types/svm/utils/events.d.ts +18 -0
- package/dist/types/svm/utils/events.d.ts.map +1 -0
- package/dist/types/svm/utils/helpers.d.ts +6 -0
- package/dist/types/svm/utils/helpers.d.ts.map +1 -0
- package/dist/types/svm/utils/index.d.ts +2 -0
- package/dist/types/svm/utils/index.d.ts.map +1 -0
- package/dist/types/utils/AddressUtils.d.ts +3 -9
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/ArrayUtils.d.ts +0 -6
- package/dist/types/utils/ArrayUtils.d.ts.map +1 -1
- package/dist/types/utils/BlockUtils.d.ts +36 -2
- 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/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types/utils/index.d.ts.map +1 -1
- package/package.json +1 -3
- package/src/arch/evm/SpokeUtils.ts +5 -5
- package/src/arch/evm/index.ts +0 -1
- package/src/arch/svm/index.ts +1 -5
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -7
- package/src/clients/BaseAbstractClient.ts +13 -20
- package/src/clients/BundleDataClient/BundleDataClient.ts +19 -28
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +1 -1
- package/src/clients/HubPoolClient.ts +19 -19
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +21 -23
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +59 -50
- package/src/clients/SpokePoolClient/index.ts +0 -11
- 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 +4 -9
- package/src/clients/mocks/index.ts +0 -2
- package/src/constants.ts +0 -1
- package/src/gasPriceOracle/adapters/arbitrum.ts +2 -5
- package/src/gasPriceOracle/adapters/ethereum.ts +4 -7
- package/src/gasPriceOracle/adapters/linea-viem.ts +1 -3
- package/src/gasPriceOracle/adapters/polygon.ts +6 -6
- package/src/gasPriceOracle/index.ts +1 -1
- package/src/gasPriceOracle/oracle.ts +4 -20
- package/src/gasPriceOracle/types.ts +1 -7
- package/src/index.ts +1 -0
- package/src/interfaces/SpokePool.ts +0 -14
- package/src/providers/index.ts +1 -1
- package/src/providers/{mocks/mockEthersProvider.ts → mockProvider.ts} +1 -1
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +9 -11
- package/src/relayFeeCalculator/chain-queries/factory.ts +8 -24
- package/src/relayFeeCalculator/chain-queries/index.ts +0 -1
- package/src/relayFeeCalculator/relayFeeCalculator.ts +4 -16
- package/src/svm/eventsClient.ts +199 -0
- package/src/svm/index.ts +3 -0
- package/src/{arch/svm → svm}/types.ts +4 -21
- package/src/svm/utils/events.ts +58 -0
- package/src/svm/utils/helpers.ts +9 -0
- package/src/svm/utils/index.ts +1 -0
- package/src/utils/AddressUtils.ts +6 -49
- package/src/utils/ArrayUtils.ts +0 -12
- package/src/utils/BlockUtils.ts +215 -5
- package/src/utils/EventUtils.ts +11 -11
- package/src/utils/JSONUtils.ts +0 -2
- package/src/utils/SpokeUtils.ts +3 -7
- package/src/utils/index.ts +0 -1
- package/dist/cjs/arch/evm/BlockUtils.d.ts +0 -15
- package/dist/cjs/arch/evm/BlockUtils.js +0 -218
- package/dist/cjs/arch/evm/BlockUtils.js.map +0 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +0 -21
- package/dist/cjs/arch/svm/SpokeUtils.js +0 -454
- package/dist/cjs/arch/svm/SpokeUtils.js.map +0 -1
- package/dist/cjs/arch/svm/constants.d.ts +0 -2
- package/dist/cjs/arch/svm/constants.js +0 -7
- package/dist/cjs/arch/svm/constants.js.map +0 -1
- package/dist/cjs/arch/svm/eventsClient.d.ts +0 -26
- package/dist/cjs/arch/svm/eventsClient.js +0 -253
- package/dist/cjs/arch/svm/eventsClient.js.map +0 -1
- package/dist/cjs/arch/svm/types.js.map +0 -1
- package/dist/cjs/arch/svm/utils.d.ts +0 -18
- package/dist/cjs/arch/svm/utils.js +0 -212
- package/dist/cjs/arch/svm/utils.js.map +0 -1
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +0 -23
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +0 -172
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +0 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +0 -33
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +0 -184
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +0 -1
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +0 -30
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +0 -90
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +0 -1
- package/dist/cjs/gasPriceOracle/adapters/solana.d.ts +0 -4
- package/dist/cjs/gasPriceOracle/adapters/solana.js +0 -43
- package/dist/cjs/gasPriceOracle/adapters/solana.js.map +0 -1
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.d.ts +0 -5
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js +0 -21
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js.map +0 -1
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +0 -5
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js +0 -20
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +0 -1
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.d.ts +0 -13
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js +0 -76
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js.map +0 -1
- package/dist/cjs/providers/mocks/index.d.ts +0 -4
- package/dist/cjs/providers/mocks/index.js +0 -8
- package/dist/cjs/providers/mocks/index.js.map +0 -1
- package/dist/cjs/providers/mocks/mockEthersProvider.js.map +0 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -37
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +0 -171
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +0 -1
- package/dist/cjs/utils/BlockFinder.d.ts +0 -22
- package/dist/cjs/utils/BlockFinder.js +0 -10
- package/dist/cjs/utils/BlockFinder.js.map +0 -1
- package/dist/esm/arch/evm/BlockUtils.d.ts +0 -24
- package/dist/esm/arch/evm/BlockUtils.js +0 -250
- package/dist/esm/arch/evm/BlockUtils.js.map +0 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +0 -129
- package/dist/esm/arch/svm/SpokeUtils.js +0 -576
- package/dist/esm/arch/svm/SpokeUtils.js.map +0 -1
- package/dist/esm/arch/svm/constants.d.ts +0 -2
- package/dist/esm/arch/svm/constants.js +0 -3
- package/dist/esm/arch/svm/constants.js.map +0 -1
- package/dist/esm/arch/svm/eventsClient.d.ts +0 -87
- package/dist/esm/arch/svm/eventsClient.js +0 -316
- package/dist/esm/arch/svm/eventsClient.js.map +0 -1
- package/dist/esm/arch/svm/types.js.map +0 -1
- package/dist/esm/arch/svm/utils.d.ts +0 -63
- package/dist/esm/arch/svm/utils.js +0 -258
- package/dist/esm/arch/svm/utils.js.map +0 -1
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +0 -66
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +0 -225
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +0 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +0 -33
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +0 -183
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +0 -1
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +0 -30
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +0 -89
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +0 -1
- package/dist/esm/gasPriceOracle/adapters/solana.d.ts +0 -8
- package/dist/esm/gasPriceOracle/adapters/solana.js +0 -43
- package/dist/esm/gasPriceOracle/adapters/solana.js.map +0 -1
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.d.ts +0 -5
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js +0 -19
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js.map +0 -1
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +0 -5
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js +0 -18
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +0 -1
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.d.ts +0 -13
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.js +0 -74
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.js.map +0 -1
- package/dist/esm/providers/mocks/index.d.ts +0 -4
- package/dist/esm/providers/mocks/index.js +0 -5
- package/dist/esm/providers/mocks/index.js.map +0 -1
- package/dist/esm/providers/mocks/mockEthersProvider.js.map +0 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -84
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +0 -216
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +0 -1
- package/dist/esm/utils/BlockFinder.d.ts +0 -22
- package/dist/esm/utils/BlockFinder.js +0 -7
- package/dist/esm/utils/BlockFinder.js.map +0 -1
- package/dist/types/arch/evm/BlockUtils.d.ts +0 -25
- package/dist/types/arch/evm/BlockUtils.d.ts.map +0 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +0 -130
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +0 -1
- package/dist/types/arch/svm/constants.d.ts +0 -3
- package/dist/types/arch/svm/constants.d.ts.map +0 -1
- package/dist/types/arch/svm/eventsClient.d.ts +0 -88
- package/dist/types/arch/svm/eventsClient.d.ts.map +0 -1
- package/dist/types/arch/svm/types.d.ts.map +0 -1
- package/dist/types/arch/svm/utils.d.ts +0 -64
- package/dist/types/arch/svm/utils.d.ts.map +0 -1
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +0 -67
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +0 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +0 -34
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +0 -1
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +0 -31
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +0 -1
- package/dist/types/gasPriceOracle/adapters/solana.d.ts +0 -9
- package/dist/types/gasPriceOracle/adapters/solana.d.ts.map +0 -1
- package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts +0 -6
- package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts.map +0 -1
- package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +0 -6
- package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts.map +0 -1
- package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts +0 -14
- package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts.map +0 -1
- package/dist/types/providers/mocks/index.d.ts +0 -5
- package/dist/types/providers/mocks/index.d.ts.map +0 -1
- package/dist/types/providers/mocks/mockEthersProvider.d.ts.map +0 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -85
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +0 -1
- package/dist/types/utils/BlockFinder.d.ts +0 -23
- package/dist/types/utils/BlockFinder.d.ts.map +0 -1
- package/src/arch/evm/BlockUtils.ts +0 -209
- package/src/arch/svm/SpokeUtils.ts +0 -596
- package/src/arch/svm/constants.ts +0 -2
- package/src/arch/svm/eventsClient.ts +0 -342
- package/src/arch/svm/utils.ts +0 -233
- package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +0 -268
- package/src/clients/mocks/MockSvmCpiEventsClient.ts +0 -226
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +0 -119
- package/src/gasPriceOracle/adapters/solana.ts +0 -45
- package/src/providers/mocks/MockCachedSolanaRpcFactory.ts +0 -15
- package/src/providers/mocks/MockRateLimitedSolanaRpcFactory.ts +0 -14
- package/src/providers/mocks/MockSolanaRpcFactory.ts +0 -55
- package/src/providers/mocks/index.ts +0 -4
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +0 -225
- package/src/utils/BlockFinder.ts +0 -26
- /package/dist/cjs/providers/{mocks/mockEthersProvider.d.ts → mockProvider.d.ts} +0 -0
- /package/dist/cjs/{arch/svm → svm}/types.js +0 -0
- /package/dist/esm/providers/{mocks/mockEthersProvider.d.ts → mockProvider.d.ts} +0 -0
- /package/dist/esm/{arch/svm → svm}/types.js +0 -0
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { Address, Rpc, RpcTransport, SolanaRpcApiFromTransport } from "@solana/kit";
|
|
2
|
-
import winston from "winston";
|
|
3
|
-
import {
|
|
4
|
-
SVMEventNames,
|
|
5
|
-
unwrapEventData,
|
|
6
|
-
getFillDeadline,
|
|
7
|
-
getTimestampForSlot,
|
|
8
|
-
getStatePda,
|
|
9
|
-
SvmCpiEventsClient,
|
|
10
|
-
findDeposit,
|
|
11
|
-
relayFillStatus,
|
|
12
|
-
fillStatusArray,
|
|
13
|
-
} from "../../arch/svm";
|
|
14
|
-
import { FillStatus, RelayData, SortableEvent } from "../../interfaces";
|
|
15
|
-
import {
|
|
16
|
-
BigNumber,
|
|
17
|
-
DepositSearchResult,
|
|
18
|
-
EventSearchConfig,
|
|
19
|
-
InvalidFill,
|
|
20
|
-
isZeroAddress,
|
|
21
|
-
MakeOptional,
|
|
22
|
-
sortEventsAscendingInPlace,
|
|
23
|
-
} from "../../utils";
|
|
24
|
-
import { isUpdateFailureReason } from "../BaseAbstractClient";
|
|
25
|
-
import { HubPoolClient } from "../HubPoolClient";
|
|
26
|
-
import { knownEventNames, SpokePoolClient, SpokePoolUpdate } from "./SpokePoolClient";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* SvmSpokePoolClient is a client for the SVM SpokePool program. It extends the base SpokePoolClient
|
|
30
|
-
* and implements the abstract methods required for interacting with an SVM Spoke Pool.
|
|
31
|
-
*/
|
|
32
|
-
export class SvmSpokePoolClient extends SpokePoolClient {
|
|
33
|
-
/**
|
|
34
|
-
* Protected constructor. Use the async create() method to instantiate.
|
|
35
|
-
*/
|
|
36
|
-
protected constructor(
|
|
37
|
-
logger: winston.Logger,
|
|
38
|
-
hubPoolClient: HubPoolClient | null,
|
|
39
|
-
chainId: number,
|
|
40
|
-
deploymentSlot: bigint, // Using slot instead of block number for SVM
|
|
41
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "to">,
|
|
42
|
-
public svmEventsClient: SvmCpiEventsClient,
|
|
43
|
-
protected programId: Address,
|
|
44
|
-
protected statePda: Address
|
|
45
|
-
) {
|
|
46
|
-
// Convert deploymentSlot to number for base class, might need refinement
|
|
47
|
-
super(logger, hubPoolClient, chainId, Number(deploymentSlot), eventSearchConfig);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Factory method to asynchronously create an instance of SvmSpokePoolClient.
|
|
52
|
-
*/
|
|
53
|
-
public static async create(
|
|
54
|
-
logger: winston.Logger,
|
|
55
|
-
hubPoolClient: HubPoolClient | null,
|
|
56
|
-
chainId: number,
|
|
57
|
-
deploymentSlot: bigint,
|
|
58
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 }, // Provide default
|
|
59
|
-
rpc: Rpc<SolanaRpcApiFromTransport<RpcTransport>>
|
|
60
|
-
): Promise<SvmSpokePoolClient> {
|
|
61
|
-
const svmEventsClient = await SvmCpiEventsClient.create(rpc);
|
|
62
|
-
const programId = svmEventsClient.getProgramAddress();
|
|
63
|
-
const statePda = await getStatePda(programId);
|
|
64
|
-
return new SvmSpokePoolClient(
|
|
65
|
-
logger,
|
|
66
|
-
hubPoolClient,
|
|
67
|
-
chainId,
|
|
68
|
-
deploymentSlot,
|
|
69
|
-
eventSearchConfig,
|
|
70
|
-
svmEventsClient,
|
|
71
|
-
programId,
|
|
72
|
-
statePda
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Factory method to asynchronously create an instance of SvmSpokePoolClient with an existing event client.
|
|
78
|
-
*/
|
|
79
|
-
public static async createWithExistingEventClient(
|
|
80
|
-
logger: winston.Logger,
|
|
81
|
-
hubPoolClient: HubPoolClient | null,
|
|
82
|
-
chainId: number,
|
|
83
|
-
deploymentSlot: bigint,
|
|
84
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 }, // Provide default
|
|
85
|
-
eventClient: SvmCpiEventsClient
|
|
86
|
-
) {
|
|
87
|
-
const programId = eventClient.getProgramAddress();
|
|
88
|
-
const statePda = await getStatePda(programId);
|
|
89
|
-
return new SvmSpokePoolClient(
|
|
90
|
-
logger,
|
|
91
|
-
hubPoolClient,
|
|
92
|
-
chainId,
|
|
93
|
-
deploymentSlot,
|
|
94
|
-
eventSearchConfig,
|
|
95
|
-
eventClient,
|
|
96
|
-
programId,
|
|
97
|
-
statePda
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
public _queryableEventNames(): string[] {
|
|
102
|
-
// We want to take the internal event names relevant to
|
|
103
|
-
// the SVM SpokePoolClient and filter them against the
|
|
104
|
-
// knownEventNames list that we reference in practice
|
|
105
|
-
const internalEventNames = Object.values(SVMEventNames);
|
|
106
|
-
return internalEventNames.filter((e) => knownEventNames.includes(e));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Performs an update to refresh the state of this client by querying SVM events.
|
|
111
|
-
*/
|
|
112
|
-
protected async _update(eventsToQuery: string[]): Promise<SpokePoolUpdate> {
|
|
113
|
-
const searchConfig = await this.updateSearchConfig(this.svmEventsClient.getRpc());
|
|
114
|
-
if (isUpdateFailureReason(searchConfig)) {
|
|
115
|
-
const reason = searchConfig;
|
|
116
|
-
return { success: false, reason };
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const deploymentSlot = BigInt(this.deploymentBlock);
|
|
120
|
-
|
|
121
|
-
const eventSearchConfigs = eventsToQuery.map((eventName) => {
|
|
122
|
-
if (!this._queryableEventNames().includes(eventName)) {
|
|
123
|
-
throw new Error(`SpokePoolClient: Cannot query unrecognised SpokePool event name: ${eventName}`);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const _searchConfig = { ...searchConfig }; // shallow copy
|
|
127
|
-
|
|
128
|
-
// By default, an event's query range is controlled by the `eventSearchConfig` passed in during instantiation.
|
|
129
|
-
// However, certain events have special overriding requirements to their search ranges:
|
|
130
|
-
// - EnabledDepositRoute: The full history is always required, so override the requested fromBlock.
|
|
131
|
-
if (eventName === "EnabledDepositRoute" && !this.isUpdated) {
|
|
132
|
-
_searchConfig.from = Number(deploymentSlot);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return _searchConfig as EventSearchConfig;
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const spokePoolAddress = this.svmEventsClient.getProgramAddress();
|
|
139
|
-
|
|
140
|
-
this.log("debug", `Updating SpokePool client for chain ${this.chainId}`, {
|
|
141
|
-
eventsToQuery,
|
|
142
|
-
searchConfig,
|
|
143
|
-
spokePool: spokePoolAddress,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
const timerStart = Date.now();
|
|
147
|
-
|
|
148
|
-
const [currentTime, ...eventsQueried] = await Promise.all([
|
|
149
|
-
this.svmEventsClient.getRpc().getBlockTime(BigInt(searchConfig.to)).send(),
|
|
150
|
-
...eventsToQuery.map(async (eventName, idx) => {
|
|
151
|
-
const config = eventSearchConfigs[idx];
|
|
152
|
-
const events = await this.svmEventsClient.queryEvents(
|
|
153
|
-
eventName as SVMEventNames,
|
|
154
|
-
BigInt(config.from),
|
|
155
|
-
BigInt(config.to),
|
|
156
|
-
{
|
|
157
|
-
limit: config.maxLookBack,
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
return events.map(
|
|
161
|
-
(event): SortableEvent => ({
|
|
162
|
-
txnRef: event.signature,
|
|
163
|
-
blockNumber: Number(event.slot),
|
|
164
|
-
txnIndex: 0,
|
|
165
|
-
logIndex: 0,
|
|
166
|
-
...(unwrapEventData(event.data) as Record<string, unknown>),
|
|
167
|
-
})
|
|
168
|
-
);
|
|
169
|
-
}),
|
|
170
|
-
]);
|
|
171
|
-
this.log("debug", `Time to query new events from RPC for ${this.chainId}: ${Date.now() - timerStart} ms`);
|
|
172
|
-
if (currentTime < this.currentTime) {
|
|
173
|
-
const errMsg = `currentTime: ${currentTime} < ${this.currentTime}`;
|
|
174
|
-
throw new Error(`SvmSpokePoolClient::update: ${errMsg}`);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Sort all events to ensure they are stored in a consistent order.
|
|
178
|
-
eventsQueried.forEach((events) => sortEventsAscendingInPlace(events));
|
|
179
|
-
|
|
180
|
-
return {
|
|
181
|
-
success: true,
|
|
182
|
-
currentTime: Number(currentTime), // uint32
|
|
183
|
-
searchEndBlock: searchConfig.to,
|
|
184
|
-
events: eventsQueried,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Retrieves the fill deadline buffer fetched from the State PDA.
|
|
190
|
-
* @note This function assumes that fill deadline buffer is a constant value in svm environments.
|
|
191
|
-
*/
|
|
192
|
-
public override getMaxFillDeadlineInRange(_startSlot: number, _endSlot: number): Promise<number> {
|
|
193
|
-
return getFillDeadline(this.svmEventsClient.getRpc(), this.statePda);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Retrieves the timestamp for a given SVM slot number.
|
|
198
|
-
*/
|
|
199
|
-
public override getTimestampForBlock(slot: number): Promise<number> {
|
|
200
|
-
return getTimestampForSlot(this.svmEventsClient.getRpc(), slot);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Retrieves the timestamp for a given SVM slot number.
|
|
205
|
-
* @note This function uses the same underlying function as getTimestampForBlock.
|
|
206
|
-
* It is kept for consistency with the EVM SpokePoolClient.
|
|
207
|
-
*/
|
|
208
|
-
public getTimeAt(slot: number): Promise<number> {
|
|
209
|
-
return getTimestampForSlot(this.svmEventsClient.getRpc(), slot);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Finds a deposit based on its deposit ID on the SVM chain.
|
|
214
|
-
*/
|
|
215
|
-
public async findDeposit(depositId: BigNumber): Promise<DepositSearchResult> {
|
|
216
|
-
const deposit = await findDeposit(this.svmEventsClient, depositId);
|
|
217
|
-
if (!deposit) {
|
|
218
|
-
return {
|
|
219
|
-
found: false,
|
|
220
|
-
code: InvalidFill.DepositIdNotFound,
|
|
221
|
-
reason: `Deposit with ID ${depositId} not found`,
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
// Because we have additional context about this deposit, we can enrich it
|
|
225
|
-
// with additional information.
|
|
226
|
-
return {
|
|
227
|
-
found: true,
|
|
228
|
-
deposit: {
|
|
229
|
-
...deposit,
|
|
230
|
-
quoteBlockNumber: await this.getBlockNumber(Number(deposit.quoteTimestamp)),
|
|
231
|
-
originChainId: this.chainId,
|
|
232
|
-
fromLiteChain: this.isOriginLiteChain(deposit),
|
|
233
|
-
toLiteChain: this.isDestinationLiteChain(deposit),
|
|
234
|
-
outputToken: isZeroAddress(deposit.outputToken)
|
|
235
|
-
? this.getDestinationTokenForDeposit(deposit)
|
|
236
|
-
: deposit.outputToken,
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Retrieves the fill status for a given relay data from the SVM chain.
|
|
243
|
-
*/
|
|
244
|
-
public override relayFillStatus(
|
|
245
|
-
relayData: RelayData,
|
|
246
|
-
atHeight?: number,
|
|
247
|
-
destinationChainId?: number
|
|
248
|
-
): Promise<FillStatus> {
|
|
249
|
-
destinationChainId ??= this.chainId;
|
|
250
|
-
return relayFillStatus(this.programId, relayData, destinationChainId, this.svmEventsClient, atHeight);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Retrieves the fill status for an array of given relay data.
|
|
255
|
-
* @param relayData The array relay data to retrieve the fill status for.
|
|
256
|
-
* @param atHeight The slot at which to query the fill status.
|
|
257
|
-
* @returns The fill status for each of the given relay data.
|
|
258
|
-
*/
|
|
259
|
-
public fillStatusArray(
|
|
260
|
-
relayData: RelayData[],
|
|
261
|
-
atHeight?: number,
|
|
262
|
-
destinationChainId?: number
|
|
263
|
-
): Promise<(FillStatus | undefined)[]> {
|
|
264
|
-
// @note: deploymentBlock actually refers to the deployment slot. Also, blockTag should be a slot number.
|
|
265
|
-
destinationChainId ??= this.chainId;
|
|
266
|
-
return fillStatusArray(this.programId, relayData, destinationChainId, this.svmEventsClient, atHeight, this.logger);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
|
-
import { createHash } from "crypto";
|
|
3
|
-
import { hexlify, arrayify, hexZeroPad } from "ethers/lib/utils";
|
|
4
|
-
import { random } from "lodash";
|
|
5
|
-
import { Address, UnixTimestamp, signature } from "@solana/kit";
|
|
6
|
-
import { Idl } from "@coral-xyz/anchor";
|
|
7
|
-
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
8
|
-
import { CHAIN_IDs } from "@across-protocol/constants";
|
|
9
|
-
|
|
10
|
-
import { MockSolanaRpcFactory } from "../../providers/mocks";
|
|
11
|
-
import {
|
|
12
|
-
SVM_DEFAULT_ADDRESS,
|
|
13
|
-
EventName,
|
|
14
|
-
EventWithData,
|
|
15
|
-
SvmCpiEventsClient,
|
|
16
|
-
SVMEventNames,
|
|
17
|
-
SVMProvider,
|
|
18
|
-
getRandomSvmAddress,
|
|
19
|
-
} from "../../arch/svm";
|
|
20
|
-
import { bnZero, bnOne, bs58, getCurrentTime, randomAddress, EvmAddress } from "../../utils";
|
|
21
|
-
import { FillType } from "../../interfaces";
|
|
22
|
-
|
|
23
|
-
export class MockSvmCpiEventsClient extends SvmCpiEventsClient {
|
|
24
|
-
private events: Record<EventName, EventWithData[]> = {} as Record<EventName, EventWithData[]>;
|
|
25
|
-
private slotHeight: bigint = BigInt(0);
|
|
26
|
-
public chainId: number;
|
|
27
|
-
public minBlockRange = 10;
|
|
28
|
-
public numberOfDeposits = bnZero;
|
|
29
|
-
|
|
30
|
-
constructor(programId = SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS, chainId = CHAIN_IDs.SOLANA) {
|
|
31
|
-
super(null as unknown as SVMProvider, programId as Address, null as unknown as Address, null as unknown as Idl);
|
|
32
|
-
this.chainId = chainId;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public setSlotHeight(slotHeight: bigint) {
|
|
36
|
-
this.slotHeight = slotHeight;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public setEvents(events: EventWithData[]) {
|
|
40
|
-
for (const event of events) {
|
|
41
|
-
this.events[event.name as EventName] ??= [];
|
|
42
|
-
this.events[event.name as EventName].push(event);
|
|
43
|
-
}
|
|
44
|
-
const maxSlot = Math.max(...events.map((event) => Number(event.slot)));
|
|
45
|
-
this.setSlotHeight(BigInt(maxSlot) + BigInt(1));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public clearEvents(name?: EventName) {
|
|
49
|
-
if (name) {
|
|
50
|
-
this.events[name] = [];
|
|
51
|
-
} else {
|
|
52
|
-
this.events = {} as Record<EventName, EventWithData[]>;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public override queryEvents(eventName: EventName, fromSlot?: bigint, toSlot?: bigint): Promise<EventWithData[]> {
|
|
57
|
-
return Promise.resolve(
|
|
58
|
-
this.events[eventName]?.filter(
|
|
59
|
-
(event) => (!fromSlot || event.slot >= fromSlot) && (!toSlot || event.slot <= toSlot)
|
|
60
|
-
) ?? []
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public override getRpc(): SVMProvider {
|
|
65
|
-
const client = new MockSolanaRpcFactory("https://test.com", 1234567890);
|
|
66
|
-
client.setResult("getSlot", [], this.slotHeight);
|
|
67
|
-
return client.createRpcClient();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public deposit(deposit: SvmSpokeClient.FundsDeposited & Partial<EventWithData>): EventWithData {
|
|
71
|
-
const { slot } = deposit;
|
|
72
|
-
let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
|
|
73
|
-
depositId ??= arrayify(hexZeroPad(hexlify(random(1, 100_000, false)), 32));
|
|
74
|
-
this.numberOfDeposits = this.numberOfDeposits.add(bnOne);
|
|
75
|
-
|
|
76
|
-
destinationChainId ??= BigInt(random(1, 42161, false));
|
|
77
|
-
const depositor = deposit.depositor ?? getRandomSvmAddress();
|
|
78
|
-
const recipient = deposit.recipient ?? EvmAddress.from(randomAddress()).toBase58();
|
|
79
|
-
const inputToken = deposit.inputToken ?? getRandomSvmAddress();
|
|
80
|
-
const outputToken = deposit.outputToken ?? EvmAddress.from(randomAddress()).toBase58();
|
|
81
|
-
inputAmount ??= BigInt(random(1, 1000, false));
|
|
82
|
-
outputAmount ??= (inputAmount * BigInt(95)) / BigInt(100);
|
|
83
|
-
const message = deposit.message ?? new Uint8Array(32);
|
|
84
|
-
const quoteTimestamp = deposit.quoteTimestamp ?? getCurrentTime();
|
|
85
|
-
|
|
86
|
-
const args = {
|
|
87
|
-
depositId,
|
|
88
|
-
destinationChainId,
|
|
89
|
-
depositor,
|
|
90
|
-
recipient,
|
|
91
|
-
inputToken,
|
|
92
|
-
inputAmount,
|
|
93
|
-
outputToken,
|
|
94
|
-
outputAmount,
|
|
95
|
-
quoteTimestamp,
|
|
96
|
-
fillDeadline: deposit.fillDeadline ?? quoteTimestamp + 3600,
|
|
97
|
-
exclusiveRelayer: deposit.exclusiveRelayer ?? SVM_DEFAULT_ADDRESS,
|
|
98
|
-
exclusivityDeadline: deposit.exclusivityDeadline ?? quoteTimestamp + 600,
|
|
99
|
-
message,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return this.generateEvent({
|
|
103
|
-
event: SVMEventNames.FundsDeposited,
|
|
104
|
-
address: this.getProgramAddress(),
|
|
105
|
-
args,
|
|
106
|
-
slot,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public fillRelay(fill: SvmSpokeClient.FilledRelay & Partial<EventWithData>): EventWithData {
|
|
111
|
-
const { slot } = fill;
|
|
112
|
-
let { depositId, inputAmount, outputAmount, fillDeadline } = fill;
|
|
113
|
-
depositId ??= arrayify(hexZeroPad(hexlify(random(1, 100_000, false)), 32));
|
|
114
|
-
inputAmount ??= BigInt(random(1, 1000, false));
|
|
115
|
-
outputAmount ??= (inputAmount * BigInt(95)) / BigInt(100);
|
|
116
|
-
fillDeadline ??= getCurrentTime() + 60;
|
|
117
|
-
|
|
118
|
-
const depositor = fill.depositor ?? EvmAddress.from(randomAddress()).toBase58();
|
|
119
|
-
const recipient = fill.recipient ?? getRandomSvmAddress();
|
|
120
|
-
const inputToken = fill.inputToken ?? EvmAddress.from(randomAddress()).toBase58();
|
|
121
|
-
const outputToken = fill.outputToken ?? getRandomSvmAddress();
|
|
122
|
-
const messageHash = fill.messageHash ?? new Uint8Array(32);
|
|
123
|
-
|
|
124
|
-
const relayExecutionInfo = {
|
|
125
|
-
updatedRecipient: fill.relayExecutionInfo?.updatedRecipient ?? recipient,
|
|
126
|
-
updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
|
|
127
|
-
fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
|
|
128
|
-
updatedMessageHash: fill.relayExecutionInfo?.updatedMessageHash ?? messageHash,
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const args = {
|
|
132
|
-
depositId,
|
|
133
|
-
originChainId: fill.originChainId ?? BigInt(random(1, 42161, false)),
|
|
134
|
-
depositor,
|
|
135
|
-
recipient,
|
|
136
|
-
inputToken,
|
|
137
|
-
inputAmount,
|
|
138
|
-
outputToken,
|
|
139
|
-
outputAmount,
|
|
140
|
-
fillDeadline,
|
|
141
|
-
exclusiveRelayer: fill.exclusiveRelayer ?? SVM_DEFAULT_ADDRESS,
|
|
142
|
-
exclusivityDeadline: fill.exclusivityDeadline ?? fillDeadline,
|
|
143
|
-
relayer: fill.relayer ?? getRandomSvmAddress(),
|
|
144
|
-
messageHash,
|
|
145
|
-
relayExecutionInfo,
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
return this.generateEvent({
|
|
149
|
-
event: SVMEventNames.FilledRelay,
|
|
150
|
-
address: this.getProgramAddress(),
|
|
151
|
-
args,
|
|
152
|
-
slot,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
public requestSlowFill(slowFillRequest: SvmSpokeClient.RequestedSlowFill & Partial<EventWithData>): EventWithData {
|
|
157
|
-
const { slot } = slowFillRequest;
|
|
158
|
-
let { depositId, originChainId } = slowFillRequest;
|
|
159
|
-
depositId ??= Uint8Array.from([random(1, 100_000, false)]);
|
|
160
|
-
originChainId ??= BigInt(random(1, 42161, false));
|
|
161
|
-
const depositor = slowFillRequest.depositor ?? EvmAddress.from(randomAddress()).toBase58();
|
|
162
|
-
const recipient = slowFillRequest.recipient ?? getRandomSvmAddress();
|
|
163
|
-
const inputToken = slowFillRequest.inputToken ?? EvmAddress.from(randomAddress()).toBase58();
|
|
164
|
-
const outputToken = slowFillRequest.outputToken ?? getRandomSvmAddress();
|
|
165
|
-
|
|
166
|
-
const args = {
|
|
167
|
-
...slowFillRequest,
|
|
168
|
-
depositId,
|
|
169
|
-
originChainId,
|
|
170
|
-
depositor,
|
|
171
|
-
recipient,
|
|
172
|
-
inputToken,
|
|
173
|
-
outputToken,
|
|
174
|
-
inputAmount: slowFillRequest.inputAmount ?? BigInt(random(1, 1000, false)),
|
|
175
|
-
outputAmount: slowFillRequest.outputAmount ?? slowFillRequest.inputAmount ?? BigInt(random(1, 1000, false)),
|
|
176
|
-
exclusiveRelayer: slowFillRequest.exclusiveRelayer ?? SVM_DEFAULT_ADDRESS,
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
return this.generateEvent({
|
|
180
|
-
event: SVMEventNames.RequestedSlowFill,
|
|
181
|
-
address: this.getProgramAddress(),
|
|
182
|
-
args,
|
|
183
|
-
slot,
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
protected generateEvent(inputs: {
|
|
188
|
-
address: Address;
|
|
189
|
-
event: EventName;
|
|
190
|
-
args: Record<string, unknown>;
|
|
191
|
-
slot?: bigint;
|
|
192
|
-
}) {
|
|
193
|
-
const { address, event, args } = inputs;
|
|
194
|
-
let { slot } = inputs;
|
|
195
|
-
|
|
196
|
-
const randomSlotWithinRange = () =>
|
|
197
|
-
random(Number(this.slotHeight) + 1, Number(this.slotHeight) + this.minBlockRange, false);
|
|
198
|
-
|
|
199
|
-
// Increment the slot number by at least 1, by default. The caller may override
|
|
200
|
-
// to force the same slot number to be used, but never a previous slot number.
|
|
201
|
-
slot ??= BigInt(randomSlotWithinRange());
|
|
202
|
-
assert(slot >= this.slotHeight, `${slot} < ${this.slotHeight}`);
|
|
203
|
-
this.slotHeight = slot;
|
|
204
|
-
|
|
205
|
-
const generatedEvent = {
|
|
206
|
-
name: event,
|
|
207
|
-
slot,
|
|
208
|
-
signature: signature(
|
|
209
|
-
bs58.encode(
|
|
210
|
-
Uint8Array.from(
|
|
211
|
-
createHash("sha512")
|
|
212
|
-
.update(`Across-${event}-${slot}-${random(1, 100_000)}`)
|
|
213
|
-
.digest()
|
|
214
|
-
)
|
|
215
|
-
)
|
|
216
|
-
),
|
|
217
|
-
program: address,
|
|
218
|
-
data: args,
|
|
219
|
-
confirmationStatus: "finalized",
|
|
220
|
-
blockTime: BigInt(new Date().getTime()) as UnixTimestamp,
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
this.setEvents([generatedEvent]);
|
|
224
|
-
return generatedEvent;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import winston from "winston";
|
|
2
|
-
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
3
|
-
import { Address } from "@solana/kit";
|
|
4
|
-
import { DepositWithBlock, RelayerRefundExecution, SortableEvent, SlowFillLeaf, Log } from "../../interfaces";
|
|
5
|
-
import { getCurrentTime, bnZero, MakeOptional, EventSearchConfig } from "../../utils";
|
|
6
|
-
import { SpokePoolUpdate, SvmSpokePoolClient } from "../SpokePoolClient";
|
|
7
|
-
import { HubPoolClient } from "../HubPoolClient";
|
|
8
|
-
import { EventOverrides } from "./MockEvents";
|
|
9
|
-
import { AcrossConfigStoreClient } from "../AcrossConfigStoreClient";
|
|
10
|
-
import { MockSvmCpiEventsClient } from "./MockSvmCpiEventsClient";
|
|
11
|
-
import { EventWithData, SvmCpiEventsClient, SVMEventNames, unwrapEventData } from "../../arch/svm";
|
|
12
|
-
|
|
13
|
-
// This class replaces internal SpokePoolClient functionality, enabling
|
|
14
|
-
// the user to bypass on-chain queries and inject events directly.
|
|
15
|
-
export class MockSvmSpokePoolClient extends SvmSpokePoolClient {
|
|
16
|
-
public mockEventsClient: MockSvmCpiEventsClient;
|
|
17
|
-
private destinationTokenForChainOverride: Record<number, string> = {};
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
logger: winston.Logger,
|
|
21
|
-
chainId: number,
|
|
22
|
-
programId = SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS,
|
|
23
|
-
deploymentBlock: number = 1,
|
|
24
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 },
|
|
25
|
-
opts: { hubPoolClient: HubPoolClient | null } = { hubPoolClient: null }
|
|
26
|
-
) {
|
|
27
|
-
super(
|
|
28
|
-
logger,
|
|
29
|
-
opts.hubPoolClient,
|
|
30
|
-
chainId,
|
|
31
|
-
BigInt(deploymentBlock),
|
|
32
|
-
eventSearchConfig,
|
|
33
|
-
null as unknown as SvmCpiEventsClient,
|
|
34
|
-
programId,
|
|
35
|
-
null as unknown as Address
|
|
36
|
-
);
|
|
37
|
-
this.mockEventsClient = new MockSvmCpiEventsClient();
|
|
38
|
-
this.latestHeightSearched = deploymentBlock;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
setConfigStoreClient(configStore?: AcrossConfigStoreClient): void {
|
|
42
|
-
this.configStoreClient = configStore;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
setDestinationTokenForChain(chainId: number, token: string): void {
|
|
46
|
-
this.destinationTokenForChainOverride[chainId] = token;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
|
|
50
|
-
return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
setLatestBlockNumber(blockNumber: number): void {
|
|
54
|
-
this.latestHeightSearched = blockNumber;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async _update(eventsToQuery: string[]): Promise<SpokePoolUpdate> {
|
|
58
|
-
const from = this.eventSearchConfig.from ?? this.deploymentBlock;
|
|
59
|
-
const to = this.eventSearchConfig.to ? BigInt(this.eventSearchConfig.to) : undefined;
|
|
60
|
-
|
|
61
|
-
// Get events from the mock event client.
|
|
62
|
-
const events: EventWithData[][] = await Promise.all(
|
|
63
|
-
eventsToQuery.map((eventName) => this.mockEventsClient.queryEvents(eventName as SVMEventNames, BigInt(from), to))
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const eventsWithBlockNumber = events.map((eventList) =>
|
|
67
|
-
eventList.map((event) => {
|
|
68
|
-
return {
|
|
69
|
-
txnRef: event.signature,
|
|
70
|
-
blockNumber: Number(event.slot),
|
|
71
|
-
txnIndex: 0,
|
|
72
|
-
logIndex: 0,
|
|
73
|
-
...(unwrapEventData(event.data) as Record<string, unknown>),
|
|
74
|
-
};
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
return Promise.resolve({
|
|
79
|
-
success: true,
|
|
80
|
-
firstDepositId: bnZero,
|
|
81
|
-
currentTime: getCurrentTime(),
|
|
82
|
-
events: eventsWithBlockNumber,
|
|
83
|
-
searchEndBlock: this.eventSearchConfig.to || this.latestHeightSearched,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
deposit(deposit: SvmSpokeClient.FundsDeposited & Partial<EventWithData>): EventWithData {
|
|
88
|
-
return this.mockEventsClient.deposit(deposit);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
fillRelay(fill: SvmSpokeClient.FilledRelay & Partial<EventWithData>): EventWithData {
|
|
92
|
-
return this.mockEventsClient.fillRelay(fill);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
requestSlowFill(request: SvmSpokeClient.RequestedSlowFill & Partial<EventWithData>): EventWithData {
|
|
96
|
-
return this.mockEventsClient.requestSlowFill(request);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
setTokensBridged(_tokensBridged: SvmSpokeClient.TokensBridged & Partial<EventWithData>): EventWithData {
|
|
100
|
-
throw new Error("MockSvmSpokePoolClient#setTokensBridged not implemented");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
executeSlowRelayLeaf(_leaf: Omit<SlowFillLeaf, "messageHash">): Log {
|
|
104
|
-
throw new Error("MockSvmSpokePoolClient#executeV3SlowRelayLeaf not implemented");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
executeRelayerRefundLeaf(_refund: RelayerRefundExecution & Partial<SortableEvent>): Log {
|
|
108
|
-
throw new Error("MockSvmSpokePoolClient#executeRelayerRefundLeaf not implemented");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
setEnableRoute(
|
|
112
|
-
_originToken: string,
|
|
113
|
-
_destinationChainId: number,
|
|
114
|
-
_enabled: boolean,
|
|
115
|
-
_overrides: EventOverrides = {}
|
|
116
|
-
): Log {
|
|
117
|
-
throw new Error("MockSvmSpokePoolClient#setEnableRoute not implemented");
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
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,15 +0,0 @@
|
|
|
1
|
-
import { CachedSolanaRpcFactory } from "..";
|
|
2
|
-
import { MockRateLimitedSolanaRpcFactory } from "./MockRateLimitedSolanaRpcFactory";
|
|
3
|
-
|
|
4
|
-
// Creates mocked cached Solana RPC factory by using the mocked Solana RPC factory.
|
|
5
|
-
export class MockCachedSolanaRpcFactory extends CachedSolanaRpcFactory {
|
|
6
|
-
constructor(
|
|
7
|
-
mockRateLimitedSolanaRpcFactory: MockRateLimitedSolanaRpcFactory,
|
|
8
|
-
...cachedConstructorParams: ConstructorParameters<typeof CachedSolanaRpcFactory>
|
|
9
|
-
) {
|
|
10
|
-
super(...cachedConstructorParams);
|
|
11
|
-
|
|
12
|
-
this.rateLimitedTransport = mockRateLimitedSolanaRpcFactory.createTransport();
|
|
13
|
-
this.rateLimitedRpcClient = mockRateLimitedSolanaRpcFactory.createRpcClient();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { RateLimitedSolanaRpcFactory } from "..";
|
|
2
|
-
import { MockSolanaRpcFactory } from "./MockSolanaRpcFactory";
|
|
3
|
-
|
|
4
|
-
// Creates mocked rate limited Solana RPC factory by using the mocked Solana RPC factory.
|
|
5
|
-
export class MockRateLimitedSolanaRpcFactory extends RateLimitedSolanaRpcFactory {
|
|
6
|
-
constructor(
|
|
7
|
-
mockSolanaRpcFactory: MockSolanaRpcFactory,
|
|
8
|
-
...rateLimitedConstructorParams: ConstructorParameters<typeof RateLimitedSolanaRpcFactory>
|
|
9
|
-
) {
|
|
10
|
-
super(...rateLimitedConstructorParams);
|
|
11
|
-
|
|
12
|
-
this.defaultTransport = mockSolanaRpcFactory.createTransport();
|
|
13
|
-
}
|
|
14
|
-
}
|