@across-protocol/sdk 4.1.63 → 4.2.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/BlockUtils.d.ts +15 -0
- package/dist/cjs/arch/evm/BlockUtils.js +218 -0
- package/dist/cjs/arch/evm/BlockUtils.js.map +1 -0
- package/dist/cjs/arch/evm/SpokeUtils.d.ts +1 -1
- package/dist/cjs/arch/evm/SpokeUtils.js +6 -5
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/evm/index.d.ts +1 -0
- package/dist/cjs/arch/evm/index.js +1 -0
- package/dist/cjs/arch/evm/index.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +20 -0
- package/dist/cjs/arch/svm/SpokeUtils.js +449 -0
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -0
- package/dist/cjs/arch/svm/constants.d.ts +2 -0
- package/dist/cjs/arch/svm/constants.js +7 -0
- package/dist/cjs/arch/svm/constants.js.map +1 -0
- package/dist/cjs/arch/svm/eventsClient.d.ts +26 -0
- package/dist/cjs/arch/svm/eventsClient.js +253 -0
- package/dist/cjs/arch/svm/eventsClient.js.map +1 -0
- package/dist/cjs/arch/svm/index.d.ts +5 -1
- package/dist/cjs/arch/svm/index.js +6 -2
- package/dist/cjs/arch/svm/index.js.map +1 -1
- package/dist/cjs/{svm → arch/svm}/types.d.ts +9 -4
- package/dist/cjs/arch/svm/types.js.map +1 -0
- package/dist/cjs/arch/svm/utils.d.ts +18 -0
- package/dist/cjs/arch/svm/utils.js +212 -0
- package/dist/cjs/arch/svm/utils.js.map +1 -0
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BaseAbstractClient.d.ts +6 -5
- package/dist/cjs/clients/BaseAbstractClient.js +30 -19
- package/dist/cjs/clients/BaseAbstractClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +15 -11
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
- package/dist/cjs/clients/HubPoolClient.d.ts +4 -3
- package/dist/cjs/clients/HubPoolClient.js +18 -17
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +23 -20
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +23 -0
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +172 -0
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -0
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -5
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +54 -57
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/index.d.ts +3 -0
- package/dist/cjs/clients/SpokePoolClient/index.js +8 -1
- package/dist/cjs/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/cjs/clients/index.d.ts +1 -1
- package/dist/cjs/clients/index.js +2 -1
- package/dist/cjs/clients/index.js.map +1 -1
- package/dist/cjs/clients/mocks/MockConfigStoreClient.d.ts +1 -1
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js +2 -2
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +2 -2
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +7 -4
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +33 -0
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +184 -0
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -0
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +30 -0
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +90 -0
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -0
- package/dist/cjs/clients/mocks/index.d.ts +2 -0
- package/dist/cjs/clients/mocks/index.js +2 -0
- package/dist/cjs/clients/mocks/index.js.map +1 -1
- package/dist/cjs/constants.d.ts +1 -0
- package/dist/cjs/constants.js +2 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/ethereum.d.ts +4 -4
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/linea-viem.js +3 -2
- package/dist/cjs/gasPriceOracle/adapters/linea-viem.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/polygon.d.ts +3 -3
- package/dist/cjs/gasPriceOracle/adapters/solana.d.ts +4 -0
- package/dist/cjs/gasPriceOracle/adapters/solana.js +43 -0
- package/dist/cjs/gasPriceOracle/adapters/solana.js.map +1 -0
- package/dist/cjs/gasPriceOracle/index.d.ts +1 -1
- package/dist/cjs/gasPriceOracle/oracle.d.ts +4 -3
- package/dist/cjs/gasPriceOracle/oracle.js +16 -9
- package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/gasPriceOracle/types.d.ts +6 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/SpokePool.d.ts +13 -0
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/providers/index.d.ts +1 -1
- package/dist/cjs/providers/index.js +1 -2
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.d.ts +5 -0
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js +21 -0
- package/dist/cjs/providers/mocks/MockCachedSolanaRpcFactory.js.map +1 -0
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +5 -0
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js +20 -0
- package/dist/cjs/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +1 -0
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.d.ts +13 -0
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js +76 -0
- package/dist/cjs/providers/mocks/MockSolanaRpcFactory.js.map +1 -0
- package/dist/cjs/providers/mocks/index.d.ts +4 -0
- package/dist/cjs/providers/mocks/index.js +8 -0
- package/dist/cjs/providers/mocks/index.js.map +1 -0
- package/dist/cjs/providers/{mockProvider.js → mocks/mockEthersProvider.js} +2 -2
- package/dist/cjs/providers/mocks/mockEthersProvider.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +10 -8
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +8 -2
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js +1 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +37 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +171 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +2 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +9 -3
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +9 -3
- package/dist/cjs/utils/AddressUtils.js +36 -6
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/ArrayUtils.d.ts +1 -0
- package/dist/cjs/utils/ArrayUtils.js +6 -1
- package/dist/cjs/utils/ArrayUtils.js.map +1 -1
- package/dist/cjs/utils/BlockFinder.d.ts +22 -0
- package/dist/cjs/utils/BlockFinder.js +10 -0
- package/dist/cjs/utils/BlockFinder.js.map +1 -0
- package/dist/cjs/utils/BlockUtils.d.ts +2 -27
- package/dist/cjs/utils/BlockUtils.js +2 -208
- package/dist/cjs/utils/BlockUtils.js.map +1 -1
- package/dist/cjs/utils/EventUtils.d.ts +4 -4
- package/dist/cjs/utils/EventUtils.js +7 -4
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/JSONUtils.js +3 -0
- package/dist/cjs/utils/JSONUtils.js.map +1 -1
- package/dist/cjs/utils/NumberUtils.d.ts +1 -0
- package/dist/cjs/utils/NumberUtils.js +7 -1
- package/dist/cjs/utils/NumberUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.js +5 -0
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/arch/evm/BlockUtils.d.ts +24 -0
- package/dist/esm/arch/evm/BlockUtils.js +250 -0
- package/dist/esm/arch/evm/BlockUtils.js.map +1 -0
- package/dist/esm/arch/evm/SpokeUtils.d.ts +1 -1
- package/dist/esm/arch/evm/SpokeUtils.js +6 -5
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/evm/index.d.ts +1 -0
- package/dist/esm/arch/evm/index.js +1 -0
- package/dist/esm/arch/evm/index.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +122 -0
- package/dist/esm/arch/svm/SpokeUtils.js +566 -0
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -0
- package/dist/esm/arch/svm/constants.d.ts +2 -0
- package/dist/esm/arch/svm/constants.js +3 -0
- package/dist/esm/arch/svm/constants.js.map +1 -0
- package/dist/esm/arch/svm/eventsClient.d.ts +87 -0
- package/dist/esm/arch/svm/eventsClient.js +316 -0
- package/dist/esm/arch/svm/eventsClient.js.map +1 -0
- package/dist/esm/arch/svm/index.d.ts +5 -1
- package/dist/esm/arch/svm/index.js +5 -1
- package/dist/esm/arch/svm/index.js.map +1 -1
- package/dist/esm/{svm → arch/svm}/types.d.ts +9 -4
- package/dist/esm/arch/svm/types.js.map +1 -0
- package/dist/esm/arch/svm/utils.d.ts +63 -0
- package/dist/esm/arch/svm/utils.js +258 -0
- package/dist/esm/arch/svm/utils.js.map +1 -0
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +7 -7
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BaseAbstractClient.d.ts +6 -5
- package/dist/esm/clients/BaseAbstractClient.js +30 -19
- package/dist/esm/clients/BaseAbstractClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +17 -14
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
- package/dist/esm/clients/HubPoolClient.d.ts +4 -3
- package/dist/esm/clients/HubPoolClient.js +19 -18
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +23 -20
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +66 -0
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +225 -0
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -0
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +57 -59
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/index.d.ts +8 -0
- package/dist/esm/clients/SpokePoolClient/index.js +10 -0
- package/dist/esm/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/esm/clients/index.d.ts +1 -1
- package/dist/esm/clients/index.js +1 -1
- package/dist/esm/clients/index.js.map +1 -1
- package/dist/esm/clients/mocks/MockConfigStoreClient.d.ts +1 -1
- package/dist/esm/clients/mocks/MockConfigStoreClient.js +2 -2
- package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.js +2 -2
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +8 -5
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +33 -0
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +183 -0
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -0
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +30 -0
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +89 -0
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -0
- package/dist/esm/clients/mocks/index.d.ts +2 -0
- package/dist/esm/clients/mocks/index.js +2 -0
- package/dist/esm/clients/mocks/index.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -0
- package/dist/esm/constants.js +1 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
- package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/ethereum.d.ts +4 -4
- package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/linea-viem.js +3 -2
- package/dist/esm/gasPriceOracle/adapters/linea-viem.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/polygon.d.ts +4 -4
- package/dist/esm/gasPriceOracle/adapters/polygon.js +1 -1
- package/dist/esm/gasPriceOracle/adapters/solana.d.ts +8 -0
- package/dist/esm/gasPriceOracle/adapters/solana.js +43 -0
- package/dist/esm/gasPriceOracle/adapters/solana.js.map +1 -0
- package/dist/esm/gasPriceOracle/index.d.ts +1 -1
- package/dist/esm/gasPriceOracle/oracle.d.ts +4 -3
- package/dist/esm/gasPriceOracle/oracle.js +18 -9
- package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/gasPriceOracle/types.d.ts +6 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/SpokePool.d.ts +13 -0
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/providers/index.d.ts +1 -1
- package/dist/esm/providers/index.js +1 -2
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.d.ts +5 -0
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js +19 -0
- package/dist/esm/providers/mocks/MockCachedSolanaRpcFactory.js.map +1 -0
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +5 -0
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js +18 -0
- package/dist/esm/providers/mocks/MockRateLimitedSolanaRpcFactory.js.map +1 -0
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.d.ts +13 -0
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.js +74 -0
- package/dist/esm/providers/mocks/MockSolanaRpcFactory.js.map +1 -0
- package/dist/esm/providers/mocks/index.d.ts +4 -0
- package/dist/esm/providers/mocks/index.js +5 -0
- package/dist/esm/providers/mocks/index.js.map +1 -0
- package/dist/esm/providers/{mockProvider.js → mocks/mockEthersProvider.js} +2 -2
- package/dist/esm/providers/mocks/mockEthersProvider.js.map +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +10 -8
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +11 -5
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/index.js +1 -0
- package/dist/esm/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +84 -0
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +216 -0
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -0
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +12 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +9 -4
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +9 -3
- package/dist/esm/utils/AddressUtils.js +41 -6
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/ArrayUtils.d.ts +6 -0
- package/dist/esm/utils/ArrayUtils.js +9 -0
- package/dist/esm/utils/ArrayUtils.js.map +1 -1
- package/dist/esm/utils/BlockFinder.d.ts +22 -0
- package/dist/esm/utils/BlockFinder.js +7 -0
- package/dist/esm/utils/BlockFinder.js.map +1 -0
- package/dist/esm/utils/BlockUtils.d.ts +2 -36
- package/dist/esm/utils/BlockUtils.js +2 -243
- package/dist/esm/utils/BlockUtils.js.map +1 -1
- package/dist/esm/utils/EventUtils.d.ts +4 -4
- package/dist/esm/utils/EventUtils.js +7 -4
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/JSONUtils.js +3 -0
- package/dist/esm/utils/JSONUtils.js.map +1 -1
- package/dist/esm/utils/NumberUtils.d.ts +7 -0
- package/dist/esm/utils/NumberUtils.js +11 -0
- package/dist/esm/utils/NumberUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.js +5 -0
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/index.d.ts +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/types/arch/evm/BlockUtils.d.ts +25 -0
- package/dist/types/arch/evm/BlockUtils.d.ts.map +1 -0
- package/dist/types/arch/evm/SpokeUtils.d.ts +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/evm/index.d.ts +1 -0
- package/dist/types/arch/evm/index.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +123 -0
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -0
- package/dist/types/arch/svm/constants.d.ts +3 -0
- package/dist/types/arch/svm/constants.d.ts.map +1 -0
- package/dist/types/arch/svm/eventsClient.d.ts +88 -0
- package/dist/types/arch/svm/eventsClient.d.ts.map +1 -0
- package/dist/types/arch/svm/index.d.ts +5 -1
- package/dist/types/arch/svm/index.d.ts.map +1 -1
- package/dist/types/{svm → arch/svm}/types.d.ts +9 -4
- package/dist/types/arch/svm/types.d.ts.map +1 -0
- package/dist/types/arch/svm/utils.d.ts +64 -0
- package/dist/types/arch/svm/utils.d.ts.map +1 -0
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +1 -1
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/BaseAbstractClient.d.ts +6 -5
- package/dist/types/clients/BaseAbstractClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +114 -114
- package/dist/types/clients/HubPoolClient.d.ts +4 -3
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +67 -0
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +1 -0
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -7
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/index.d.ts +8 -0
- package/dist/types/clients/SpokePoolClient/index.d.ts.map +1 -1
- package/dist/types/clients/index.d.ts +1 -1
- package/dist/types/clients/index.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockConfigStoreClient.d.ts +1 -1
- package/dist/types/clients/mocks/MockConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +34 -0
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -0
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +31 -0
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -0
- package/dist/types/clients/mocks/index.d.ts +2 -0
- package/dist/types/clients/mocks/index.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts +2 -2
- package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts +4 -4
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/polygon.d.ts +4 -4
- package/dist/types/gasPriceOracle/adapters/polygon.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/solana.d.ts +9 -0
- package/dist/types/gasPriceOracle/adapters/solana.d.ts.map +1 -0
- package/dist/types/gasPriceOracle/index.d.ts +1 -1
- package/dist/types/gasPriceOracle/index.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/oracle.d.ts +4 -3
- package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/types.d.ts +6 -1
- package/dist/types/gasPriceOracle/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +13 -0
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/providers/index.d.ts +1 -1
- package/dist/types/providers/index.d.ts.map +1 -1
- package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts +6 -0
- package/dist/types/providers/mocks/MockCachedSolanaRpcFactory.d.ts.map +1 -0
- package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts +6 -0
- package/dist/types/providers/mocks/MockRateLimitedSolanaRpcFactory.d.ts.map +1 -0
- package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts +14 -0
- package/dist/types/providers/mocks/MockSolanaRpcFactory.d.ts.map +1 -0
- package/dist/types/providers/mocks/index.d.ts +5 -0
- package/dist/types/providers/mocks/index.d.ts.map +1 -0
- package/dist/types/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +1 -1
- package/dist/types/providers/mocks/mockEthersProvider.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +4 -2
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/types/relayFeeCalculator/chain-queries/index.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +85 -0
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -0
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +12 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +9 -3
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/ArrayUtils.d.ts +6 -0
- package/dist/types/utils/ArrayUtils.d.ts.map +1 -1
- package/dist/types/utils/BlockFinder.d.ts +23 -0
- package/dist/types/utils/BlockFinder.d.ts.map +1 -0
- package/dist/types/utils/BlockUtils.d.ts +2 -36
- package/dist/types/utils/BlockUtils.d.ts.map +1 -1
- package/dist/types/utils/EventUtils.d.ts +4 -4
- package/dist/types/utils/EventUtils.d.ts.map +1 -1
- package/dist/types/utils/JSONUtils.d.ts.map +1 -1
- package/dist/types/utils/NumberUtils.d.ts +7 -0
- package/dist/types/utils/NumberUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/arch/evm/BlockUtils.ts +209 -0
- package/src/arch/evm/SpokeUtils.ts +5 -5
- package/src/arch/evm/index.ts +1 -0
- package/src/arch/svm/SpokeUtils.ts +581 -0
- package/src/arch/svm/constants.ts +2 -0
- package/src/arch/svm/eventsClient.ts +342 -0
- package/src/arch/svm/index.ts +5 -1
- package/src/{svm → arch/svm}/types.ts +21 -4
- package/src/arch/svm/utils.ts +233 -0
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -7
- package/src/clients/BaseAbstractClient.ts +20 -13
- package/src/clients/BundleDataClient/BundleDataClient.ts +28 -19
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +1 -1
- package/src/clients/HubPoolClient.ts +19 -19
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +23 -21
- package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +268 -0
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +50 -59
- package/src/clients/SpokePoolClient/index.ts +11 -0
- package/src/clients/index.ts +1 -1
- package/src/clients/mocks/MockConfigStoreClient.ts +2 -2
- package/src/clients/mocks/MockHubPoolClient.ts +2 -2
- package/src/clients/mocks/MockSpokePoolClient.ts +9 -4
- package/src/clients/mocks/MockSvmCpiEventsClient.ts +226 -0
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +119 -0
- package/src/clients/mocks/index.ts +2 -0
- package/src/constants.ts +1 -0
- package/src/gasPriceOracle/adapters/arbitrum.ts +5 -2
- package/src/gasPriceOracle/adapters/ethereum.ts +7 -4
- package/src/gasPriceOracle/adapters/linea-viem.ts +3 -1
- package/src/gasPriceOracle/adapters/polygon.ts +6 -6
- package/src/gasPriceOracle/adapters/solana.ts +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/providers/index.ts +1 -1
- package/src/providers/mocks/MockCachedSolanaRpcFactory.ts +15 -0
- package/src/providers/mocks/MockRateLimitedSolanaRpcFactory.ts +14 -0
- package/src/providers/mocks/MockSolanaRpcFactory.ts +55 -0
- package/src/providers/mocks/index.ts +4 -0
- package/src/providers/{mockProvider.ts → mocks/mockEthersProvider.ts} +1 -1
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +11 -9
- package/src/relayFeeCalculator/chain-queries/factory.ts +24 -8
- package/src/relayFeeCalculator/chain-queries/index.ts +1 -0
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +225 -0
- package/src/relayFeeCalculator/relayFeeCalculator.ts +15 -3
- package/src/utils/AddressUtils.ts +49 -6
- package/src/utils/ArrayUtils.ts +12 -0
- package/src/utils/BlockFinder.ts +26 -0
- package/src/utils/BlockUtils.ts +5 -215
- package/src/utils/EventUtils.ts +11 -11
- package/src/utils/JSONUtils.ts +2 -0
- package/src/utils/NumberUtils.ts +10 -0
- package/src/utils/SpokeUtils.ts +7 -3
- package/src/utils/index.ts +1 -0
- package/dist/cjs/providers/mockProvider.js.map +0 -1
- package/dist/cjs/svm/eventsClient.d.ts +0 -15
- package/dist/cjs/svm/eventsClient.js +0 -157
- package/dist/cjs/svm/eventsClient.js.map +0 -1
- package/dist/cjs/svm/index.d.ts +0 -3
- package/dist/cjs/svm/index.js +0 -8
- package/dist/cjs/svm/index.js.map +0 -1
- package/dist/cjs/svm/types.js.map +0 -1
- package/dist/cjs/svm/utils/events.d.ts +0 -8
- package/dist/cjs/svm/utils/events.js +0 -47
- package/dist/cjs/svm/utils/events.js.map +0 -1
- package/dist/cjs/svm/utils/helpers.d.ts +0 -2
- package/dist/cjs/svm/utils/helpers.js +0 -19
- package/dist/cjs/svm/utils/helpers.js.map +0 -1
- package/dist/cjs/svm/utils/index.d.ts +0 -1
- package/dist/cjs/svm/utils/index.js +0 -5
- package/dist/cjs/svm/utils/index.js.map +0 -1
- package/dist/esm/providers/mockProvider.js.map +0 -1
- package/dist/esm/svm/eventsClient.d.ts +0 -51
- package/dist/esm/svm/eventsClient.js +0 -195
- package/dist/esm/svm/eventsClient.js.map +0 -1
- package/dist/esm/svm/index.d.ts +0 -3
- package/dist/esm/svm/index.js +0 -5
- package/dist/esm/svm/index.js.map +0 -1
- package/dist/esm/svm/types.js.map +0 -1
- package/dist/esm/svm/utils/events.d.ts +0 -17
- package/dist/esm/svm/utils/events.js +0 -55
- package/dist/esm/svm/utils/events.js.map +0 -1
- package/dist/esm/svm/utils/helpers.d.ts +0 -5
- package/dist/esm/svm/utils/helpers.js +0 -18
- package/dist/esm/svm/utils/helpers.js.map +0 -1
- package/dist/esm/svm/utils/index.d.ts +0 -1
- package/dist/esm/svm/utils/index.js +0 -2
- package/dist/esm/svm/utils/index.js.map +0 -1
- package/dist/types/providers/mockProvider.d.ts.map +0 -1
- package/dist/types/svm/eventsClient.d.ts +0 -52
- package/dist/types/svm/eventsClient.d.ts.map +0 -1
- package/dist/types/svm/index.d.ts +0 -4
- package/dist/types/svm/index.d.ts.map +0 -1
- package/dist/types/svm/types.d.ts.map +0 -1
- package/dist/types/svm/utils/events.d.ts +0 -18
- package/dist/types/svm/utils/events.d.ts.map +0 -1
- package/dist/types/svm/utils/helpers.d.ts +0 -6
- package/dist/types/svm/utils/helpers.d.ts.map +0 -1
- package/dist/types/svm/utils/index.d.ts +0 -2
- package/dist/types/svm/utils/index.d.ts.map +0 -1
- package/src/svm/eventsClient.ts +0 -199
- package/src/svm/index.ts +0 -3
- package/src/svm/utils/events.ts +0 -58
- package/src/svm/utils/helpers.ts +0 -9
- package/src/svm/utils/index.ts +0 -1
- /package/dist/cjs/{svm → arch/svm}/types.js +0 -0
- /package/dist/cjs/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +0 -0
- /package/dist/esm/{svm → arch/svm}/types.js +0 -0
- /package/dist/esm/providers/{mockProvider.d.ts → mocks/mockEthersProvider.d.ts} +0 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { Idl } from "@coral-xyz/anchor";
|
|
2
|
+
import { getDeployedAddress, SvmSpokeIdl } from "@across-protocol/contracts";
|
|
3
|
+
import { getSolanaChainId } from "@across-protocol/contracts/dist/src/svm/web3-v1";
|
|
4
|
+
import {
|
|
5
|
+
address,
|
|
6
|
+
Address,
|
|
7
|
+
Commitment,
|
|
8
|
+
getProgramDerivedAddress,
|
|
9
|
+
GetSignaturesForAddressApi,
|
|
10
|
+
GetTransactionApi,
|
|
11
|
+
Signature,
|
|
12
|
+
} from "@solana/kit";
|
|
13
|
+
import { bs58, chainIsSvm, getMessageHash } from "../../utils";
|
|
14
|
+
import { EventName, EventWithData, SVMProvider } from "./types";
|
|
15
|
+
import { decodeEvent, isDevnet } from "./utils";
|
|
16
|
+
import { DepositWithTime, FillWithTime } from "../../interfaces";
|
|
17
|
+
import { unwrapEventData } from "./";
|
|
18
|
+
import assert from "assert";
|
|
19
|
+
import {
|
|
20
|
+
FundsDepositedEventObject,
|
|
21
|
+
FilledRelayEventObject,
|
|
22
|
+
} from "@across-protocol/contracts/dist/typechain/contracts/SpokePool";
|
|
23
|
+
|
|
24
|
+
// Utility type to extract the return type for the JSON encoding overload. We only care about the overload where the
|
|
25
|
+
// configuration parameter (C) has the optional property 'encoding' set to 'json'.
|
|
26
|
+
type ExtractJsonOverload<T> = T extends (signature: infer _S, config: infer C) => infer R
|
|
27
|
+
? C extends { encoding?: "json" }
|
|
28
|
+
? R
|
|
29
|
+
: never
|
|
30
|
+
: never;
|
|
31
|
+
|
|
32
|
+
type GetTransactionReturnType = ExtractJsonOverload<GetTransactionApi["getTransaction"]>;
|
|
33
|
+
type GetSignaturesForAddressConfig = Parameters<GetSignaturesForAddressApi["getSignaturesForAddress"]>[1];
|
|
34
|
+
type GetSignaturesForAddressTransaction = ReturnType<GetSignaturesForAddressApi["getSignaturesForAddress"]>[number];
|
|
35
|
+
type GetSignaturesForAddressApiResponse = readonly GetSignaturesForAddressTransaction[];
|
|
36
|
+
|
|
37
|
+
export type DepositEventFromSignature = Omit<DepositWithTime, "fromLiteChain" | "toLiteChain">;
|
|
38
|
+
export type FillEventFromSignature = FillWithTime;
|
|
39
|
+
|
|
40
|
+
export class SvmCpiEventsClient {
|
|
41
|
+
private rpc: SVMProvider;
|
|
42
|
+
private programAddress: Address;
|
|
43
|
+
private programEventAuthority: Address;
|
|
44
|
+
private idl: Idl;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Protected constructor. Use the async create() method to instantiate.
|
|
48
|
+
*/
|
|
49
|
+
protected constructor(rpc: SVMProvider, address: Address, eventAuthority: Address, idl: Idl) {
|
|
50
|
+
this.rpc = rpc;
|
|
51
|
+
this.programAddress = address;
|
|
52
|
+
this.programEventAuthority = eventAuthority;
|
|
53
|
+
this.idl = idl;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Factory method to asynchronously create an instance of SvmSpokeEventsClient.
|
|
58
|
+
*/
|
|
59
|
+
public static async create(rpc: SVMProvider): Promise<SvmCpiEventsClient> {
|
|
60
|
+
const isTestnet = await isDevnet(rpc);
|
|
61
|
+
const programId = getDeployedAddress("SvmSpoke", getSolanaChainId(isTestnet ? "devnet" : "mainnet").toString());
|
|
62
|
+
if (!programId) throw new Error("Program not found");
|
|
63
|
+
return this.createFor(rpc, programId, SvmSpokeIdl);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public static async createFor(rpc: SVMProvider, programId: string, idl: Idl): Promise<SvmCpiEventsClient> {
|
|
67
|
+
const programAddress = address(programId);
|
|
68
|
+
const [eventAuthority] = await getProgramDerivedAddress({
|
|
69
|
+
programAddress,
|
|
70
|
+
seeds: ["__event_authority"],
|
|
71
|
+
});
|
|
72
|
+
return new SvmCpiEventsClient(rpc, programAddress, eventAuthority, idl);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Queries events for the SvmSpoke program filtered by event name.
|
|
77
|
+
*
|
|
78
|
+
* @param eventName - The name of the event to filter by.
|
|
79
|
+
* @param fromSlot - Optional starting slot.
|
|
80
|
+
* @param toSlot - Optional ending slot.
|
|
81
|
+
* @param options - Options for fetching signatures.
|
|
82
|
+
* @returns A promise that resolves to an array of events matching the eventName.
|
|
83
|
+
*/
|
|
84
|
+
public async queryEvents(
|
|
85
|
+
eventName: EventName,
|
|
86
|
+
fromSlot?: bigint,
|
|
87
|
+
toSlot?: bigint,
|
|
88
|
+
options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
|
|
89
|
+
): Promise<EventWithData[]> {
|
|
90
|
+
const events = await this.queryAllEvents(fromSlot, toSlot, options);
|
|
91
|
+
return events.filter((event) => event.name === eventName) as EventWithData[];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Queries events for the provided derived address at instantiation filtered by event name.
|
|
96
|
+
*
|
|
97
|
+
* @param eventName - The name of the event to filter by.
|
|
98
|
+
* @param fromSlot - Optional starting slot.
|
|
99
|
+
* @param toSlot - Optional ending slot.
|
|
100
|
+
* @param options - Options for fetching signatures.
|
|
101
|
+
* @returns A promise that resolves to an array of events matching the eventName.
|
|
102
|
+
*/
|
|
103
|
+
public async queryDerivedAddressEvents(
|
|
104
|
+
eventName: string,
|
|
105
|
+
derivedAddress: Address,
|
|
106
|
+
fromSlot?: bigint,
|
|
107
|
+
toSlot?: bigint,
|
|
108
|
+
options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
|
|
109
|
+
): Promise<EventWithData[]> {
|
|
110
|
+
const events = await this.queryAllEvents(fromSlot, toSlot, options, derivedAddress);
|
|
111
|
+
return events.filter((event) => event.name === eventName) as EventWithData[];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Queries all events for a specific program.
|
|
116
|
+
*
|
|
117
|
+
* @param fromSlot - Optional starting slot.
|
|
118
|
+
* @param toSlot - Optional ending slot.
|
|
119
|
+
* @param options - Options for fetching signatures.
|
|
120
|
+
* @param forDerivedAddress - Whether to query events for the program or the derived address.
|
|
121
|
+
* @returns A promise that resolves to an array of all events with additional metadata.
|
|
122
|
+
*/
|
|
123
|
+
private async queryAllEvents(
|
|
124
|
+
fromSlot?: bigint,
|
|
125
|
+
toSlot?: bigint,
|
|
126
|
+
options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" },
|
|
127
|
+
derivedAddress?: Address
|
|
128
|
+
): Promise<EventWithData[]> {
|
|
129
|
+
const addressToQuery = derivedAddress || this.programAddress;
|
|
130
|
+
const allSignatures: GetSignaturesForAddressTransaction[] = [];
|
|
131
|
+
let hasMoreSignatures = true;
|
|
132
|
+
let currentOptions = options;
|
|
133
|
+
|
|
134
|
+
while (hasMoreSignatures) {
|
|
135
|
+
const signatures: GetSignaturesForAddressApiResponse = await this.rpc
|
|
136
|
+
.getSignaturesForAddress(addressToQuery!, currentOptions)
|
|
137
|
+
.send();
|
|
138
|
+
// Signatures are sorted by slot in descending order.
|
|
139
|
+
allSignatures.push(...signatures);
|
|
140
|
+
|
|
141
|
+
// Update options for the next batch. Set "before" to the last fetched signature.
|
|
142
|
+
if (signatures.length > 0) {
|
|
143
|
+
currentOptions = { ...currentOptions, before: signatures[signatures.length - 1].signature };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (fromSlot && allSignatures.length > 0 && allSignatures[allSignatures.length - 1].slot < fromSlot) {
|
|
147
|
+
hasMoreSignatures = false;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
hasMoreSignatures = Boolean(
|
|
151
|
+
hasMoreSignatures && currentOptions.limit && signatures.length === currentOptions.limit
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const filteredSignatures = allSignatures.filter((signatureTransaction) => {
|
|
156
|
+
if (fromSlot && signatureTransaction.slot < fromSlot) return false;
|
|
157
|
+
if (toSlot && signatureTransaction.slot > toSlot) return false;
|
|
158
|
+
return true;
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Fetch events for all signatures in parallel.
|
|
162
|
+
const eventsWithSlots = await Promise.all(
|
|
163
|
+
filteredSignatures.map(async (signatureTransaction) => {
|
|
164
|
+
const events = await this.readEventsFromSignature(signatureTransaction.signature, options.commitment);
|
|
165
|
+
return events.map((event) => ({
|
|
166
|
+
...event,
|
|
167
|
+
confirmationStatus: signatureTransaction.confirmationStatus,
|
|
168
|
+
blockTime: signatureTransaction.blockTime,
|
|
169
|
+
signature: signatureTransaction.signature,
|
|
170
|
+
slot: signatureTransaction.slot,
|
|
171
|
+
}));
|
|
172
|
+
})
|
|
173
|
+
);
|
|
174
|
+
return eventsWithSlots.flat();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Reads events from a transaction signature.
|
|
179
|
+
*
|
|
180
|
+
* @param txSignature - The transaction signature.
|
|
181
|
+
* @param commitment - Commitment level.
|
|
182
|
+
* @returns A promise that resolves to an array of events.
|
|
183
|
+
*/
|
|
184
|
+
private async readEventsFromSignature(txSignature: Signature, commitment: Commitment = "confirmed") {
|
|
185
|
+
const txResult = await this.rpc
|
|
186
|
+
.getTransaction(txSignature, { commitment, maxSupportedTransactionVersion: 0 })
|
|
187
|
+
.send();
|
|
188
|
+
|
|
189
|
+
if (txResult === null) return [];
|
|
190
|
+
return this.processEventFromTx(txResult);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Processes events from a transaction.
|
|
195
|
+
*
|
|
196
|
+
* @param txResult - The transaction result.
|
|
197
|
+
* @returns A promise that resolves to an array of events with their data and name.
|
|
198
|
+
*/
|
|
199
|
+
private processEventFromTx(txResult: GetTransactionReturnType): { program: Address; data: unknown; name: string }[] {
|
|
200
|
+
if (!txResult) return [];
|
|
201
|
+
const events: { program: Address; data: unknown; name: string }[] = [];
|
|
202
|
+
|
|
203
|
+
const accountKeys = txResult.transaction.message.accountKeys;
|
|
204
|
+
const messageAccountKeys = [...accountKeys];
|
|
205
|
+
// Writable accounts come first, then readonly.
|
|
206
|
+
// See https://docs.anza.xyz/proposals/versioned-transactions#new-transaction-format
|
|
207
|
+
messageAccountKeys.push(...(txResult?.meta?.loadedAddresses?.writable ?? []));
|
|
208
|
+
messageAccountKeys.push(...(txResult?.meta?.loadedAddresses?.readonly ?? []));
|
|
209
|
+
|
|
210
|
+
for (const ixBlock of txResult.meta?.innerInstructions ?? []) {
|
|
211
|
+
for (const ix of ixBlock.instructions) {
|
|
212
|
+
const ixProgramId = messageAccountKeys[ix.programIdIndex];
|
|
213
|
+
const singleIxAccount = ix.accounts.length === 1 ? messageAccountKeys[ix.accounts[0]] : undefined;
|
|
214
|
+
if (
|
|
215
|
+
ixProgramId !== undefined &&
|
|
216
|
+
singleIxAccount !== undefined &&
|
|
217
|
+
this.programAddress === ixProgramId &&
|
|
218
|
+
this.programEventAuthority === singleIxAccount
|
|
219
|
+
) {
|
|
220
|
+
const ixData = bs58.decode(ix.data);
|
|
221
|
+
// Skip the first 8 bytes (assumed header) and encode the rest.
|
|
222
|
+
const eventData = Buffer.from(ixData.slice(8)).toString("base64");
|
|
223
|
+
const { name, data } = decodeEvent(this.idl, eventData);
|
|
224
|
+
events.push({ program: this.programAddress, name, data });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return events;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Finds all FundsDeposited events for a given transaction signature.
|
|
234
|
+
*
|
|
235
|
+
* @param originChainId - The chain ID where the deposit originated.
|
|
236
|
+
* @param txSignature - The transaction signature to search for events.
|
|
237
|
+
* @param commitment - Optional commitment level for the transaction query.
|
|
238
|
+
* @returns A promise that resolves to an array of deposit events for the transaction, or undefined if none found.
|
|
239
|
+
*/
|
|
240
|
+
public async getDepositEventsFromSignature(
|
|
241
|
+
originChainId: number,
|
|
242
|
+
txSignature: Signature,
|
|
243
|
+
commitment: Commitment = "confirmed"
|
|
244
|
+
): Promise<DepositEventFromSignature[] | undefined> {
|
|
245
|
+
assert(chainIsSvm(originChainId), `Origin chain ${originChainId} is not an SVM chain`);
|
|
246
|
+
|
|
247
|
+
const [events, txDetails] = await Promise.all([
|
|
248
|
+
this.readEventsFromSignature(txSignature, commitment),
|
|
249
|
+
this.rpc
|
|
250
|
+
.getTransaction(txSignature, {
|
|
251
|
+
commitment,
|
|
252
|
+
maxSupportedTransactionVersion: 0,
|
|
253
|
+
})
|
|
254
|
+
.send(),
|
|
255
|
+
]);
|
|
256
|
+
|
|
257
|
+
// Filter for FundsDeposited events only
|
|
258
|
+
const depositEvents = events?.filter((event) => event?.name === "FundsDeposited");
|
|
259
|
+
|
|
260
|
+
if (!txDetails || !depositEvents?.length) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return events.map((event) => {
|
|
265
|
+
const unwrappedEventArgs = unwrapEventData(event as Record<string, unknown>, ["depositId"]) as Record<
|
|
266
|
+
"data",
|
|
267
|
+
FundsDepositedEventObject
|
|
268
|
+
>;
|
|
269
|
+
|
|
270
|
+
return {
|
|
271
|
+
...unwrappedEventArgs.data,
|
|
272
|
+
depositTimestamp: Number(txDetails.blockTime),
|
|
273
|
+
originChainId,
|
|
274
|
+
messageHash: getMessageHash(unwrappedEventArgs.data.message),
|
|
275
|
+
blockNumber: Number(txDetails.slot),
|
|
276
|
+
txnIndex: 0,
|
|
277
|
+
txnRef: txSignature,
|
|
278
|
+
logIndex: 0,
|
|
279
|
+
destinationChainId: unwrappedEventArgs.data.destinationChainId.toNumber(),
|
|
280
|
+
} satisfies DepositEventFromSignature;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Finds all FilledRelay events for a given transaction signature.
|
|
286
|
+
*
|
|
287
|
+
* @param destinationChainId - The destination chain ID (must be an SVM chain).
|
|
288
|
+
* @param txSignature - The transaction signature to search for events.
|
|
289
|
+
* @returns A promise that resolves to an array of fill events for the transaction, or undefined if none found.
|
|
290
|
+
*/
|
|
291
|
+
public async getFillEventsFromSignature(
|
|
292
|
+
destinationChainId: number,
|
|
293
|
+
txSignature: Signature,
|
|
294
|
+
commitment: Commitment = "confirmed"
|
|
295
|
+
): Promise<FillEventFromSignature[] | undefined> {
|
|
296
|
+
assert(chainIsSvm(destinationChainId), `Destination chain ${destinationChainId} is not an SVM chain`);
|
|
297
|
+
|
|
298
|
+
// Find all events from the transaction signature and get transaction details
|
|
299
|
+
const [events, txDetails] = await Promise.all([
|
|
300
|
+
this.readEventsFromSignature(txSignature, commitment),
|
|
301
|
+
this.rpc
|
|
302
|
+
.getTransaction(txSignature, {
|
|
303
|
+
commitment,
|
|
304
|
+
maxSupportedTransactionVersion: 0,
|
|
305
|
+
})
|
|
306
|
+
.send(),
|
|
307
|
+
]);
|
|
308
|
+
|
|
309
|
+
// Filter for FilledRelay events only
|
|
310
|
+
const fillEvents = events?.filter((event) => event?.name === "FilledRelay");
|
|
311
|
+
|
|
312
|
+
if (!txDetails || !fillEvents?.length) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return fillEvents.map((event) => {
|
|
317
|
+
const unwrappedEventData = unwrapEventData(event as Record<string, unknown>) as Record<
|
|
318
|
+
"data",
|
|
319
|
+
FilledRelayEventObject
|
|
320
|
+
>;
|
|
321
|
+
return {
|
|
322
|
+
...unwrappedEventData.data,
|
|
323
|
+
fillTimestamp: Number(txDetails.blockTime),
|
|
324
|
+
blockNumber: Number(txDetails.slot),
|
|
325
|
+
txnRef: txSignature,
|
|
326
|
+
txnIndex: 0,
|
|
327
|
+
logIndex: 0,
|
|
328
|
+
destinationChainId,
|
|
329
|
+
repaymentChainId: unwrappedEventData.data.repaymentChainId.toNumber(),
|
|
330
|
+
originChainId: unwrappedEventData.data.originChainId.toNumber(),
|
|
331
|
+
} satisfies FillEventFromSignature;
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
public getProgramAddress(): Address {
|
|
336
|
+
return this.programAddress;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
public getRpc(): SVMProvider {
|
|
340
|
+
return this.rpc;
|
|
341
|
+
}
|
|
342
|
+
}
|
package/src/arch/svm/index.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { Signature, Address, UnixTimestamp } from "@solana/kit";
|
|
2
1
|
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
2
|
+
import {
|
|
3
|
+
Address,
|
|
4
|
+
Rpc,
|
|
5
|
+
RpcSubscriptions,
|
|
6
|
+
RpcTransport,
|
|
7
|
+
Signature,
|
|
8
|
+
SignatureNotificationsApi,
|
|
9
|
+
SlotNotificationsApi,
|
|
10
|
+
SolanaRpcApiFromTransport,
|
|
11
|
+
UnixTimestamp,
|
|
12
|
+
} from "@solana/kit";
|
|
3
13
|
|
|
4
14
|
export type EventData =
|
|
5
15
|
| SvmSpokeClient.BridgedToHubPool
|
|
@@ -36,12 +46,19 @@ export enum SVMEventNames {
|
|
|
36
46
|
|
|
37
47
|
export type EventName = keyof typeof SVMEventNames;
|
|
38
48
|
|
|
39
|
-
export type EventWithData
|
|
49
|
+
export type EventWithData = {
|
|
40
50
|
confirmationStatus: string | null;
|
|
41
51
|
blockTime: UnixTimestamp | null;
|
|
42
52
|
signature: Signature;
|
|
43
53
|
slot: bigint;
|
|
44
|
-
name:
|
|
45
|
-
data:
|
|
54
|
+
name: string;
|
|
55
|
+
data: unknown;
|
|
46
56
|
program: Address;
|
|
47
57
|
};
|
|
58
|
+
|
|
59
|
+
// Typed aggregate of JSON‑RPC and subscription clients.
|
|
60
|
+
export type RpcClient = {
|
|
61
|
+
rpc: Rpc<SolanaRpcApiFromTransport<RpcTransport>>;
|
|
62
|
+
rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi & SlotNotificationsApi>;
|
|
63
|
+
};
|
|
64
|
+
export type SVMProvider = Rpc<SolanaRpcApiFromTransport<RpcTransport>>;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import bs58 from "bs58";
|
|
2
|
+
import { ethers } from "ethers";
|
|
3
|
+
import { BN, BorshEventCoder, Idl } from "@coral-xyz/anchor";
|
|
4
|
+
import {
|
|
5
|
+
Address,
|
|
6
|
+
address,
|
|
7
|
+
getAddressEncoder,
|
|
8
|
+
getProgramDerivedAddress,
|
|
9
|
+
getU64Encoder,
|
|
10
|
+
isAddress,
|
|
11
|
+
type TransactionSigner,
|
|
12
|
+
} from "@solana/kit";
|
|
13
|
+
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
14
|
+
import { FillType, RelayData } from "../../interfaces";
|
|
15
|
+
import { BigNumber, SvmAddress, getRelayDataHash, isUint8Array } from "../../utils";
|
|
16
|
+
import { EventName, SVMEventNames, SVMProvider } from "./types";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Basic void TransactionSigner type
|
|
20
|
+
*/
|
|
21
|
+
export const SolanaVoidSigner: (simulationAddress: string) => TransactionSigner<string> = (
|
|
22
|
+
simulationAddress: string
|
|
23
|
+
) => {
|
|
24
|
+
return {
|
|
25
|
+
address: address(simulationAddress),
|
|
26
|
+
signAndSendTransactions: async () => {
|
|
27
|
+
return await Promise.resolve([]);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Helper to determine if the current RPC network is devnet.
|
|
34
|
+
*/
|
|
35
|
+
export async function isDevnet(rpc: SVMProvider): Promise<boolean> {
|
|
36
|
+
const genesisHash = await rpc.getGenesisHash().send();
|
|
37
|
+
return genesisHash === "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Parses event data from a transaction.
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
export function parseEventData(eventData: any): any {
|
|
45
|
+
if (!eventData) return eventData;
|
|
46
|
+
|
|
47
|
+
if (Array.isArray(eventData)) {
|
|
48
|
+
return eventData.map(parseEventData);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof eventData === "object") {
|
|
52
|
+
if (eventData.constructor.name === "PublicKey") {
|
|
53
|
+
return address(eventData.toString());
|
|
54
|
+
}
|
|
55
|
+
if (BN.isBN(eventData)) {
|
|
56
|
+
return BigInt(eventData.toString());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Convert each key from snake_case to camelCase and process the value recursively.
|
|
60
|
+
return Object.fromEntries(
|
|
61
|
+
Object.entries(eventData).map(([key, value]) => [snakeToCamel(key), parseEventData(value)])
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return eventData;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Decodes a raw event according to a supplied IDL.
|
|
70
|
+
*/
|
|
71
|
+
export function decodeEvent(idl: Idl, rawEvent: string): { data: unknown; name: string } {
|
|
72
|
+
const event = new BorshEventCoder(idl).decode(rawEvent);
|
|
73
|
+
if (!event) throw new Error(`Malformed rawEvent for IDL ${idl.address}: ${rawEvent}`);
|
|
74
|
+
return {
|
|
75
|
+
name: event.name,
|
|
76
|
+
data: parseEventData(event.data),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Converts a snake_case string to camelCase.
|
|
82
|
+
*/
|
|
83
|
+
function snakeToCamel(s: string): string {
|
|
84
|
+
return s.replace(/(_\w)/g, (match) => match[1].toUpperCase());
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Gets the event name from a raw name.
|
|
89
|
+
*/
|
|
90
|
+
export function getEventName(rawName: string): EventName {
|
|
91
|
+
if (Object.values(SVMEventNames).some((name) => rawName.includes(name))) return rawName as EventName;
|
|
92
|
+
throw new Error(`Unknown event name: ${rawName}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Unwraps any data structure and converts Address types to strings and Uint8Array to hex or BigInt.
|
|
97
|
+
* Recursively processes nested objects and arrays.
|
|
98
|
+
*/
|
|
99
|
+
export function unwrapEventData(
|
|
100
|
+
data: unknown,
|
|
101
|
+
uint8ArrayKeysAsBigInt: string[] = ["depositId"],
|
|
102
|
+
currentKey?: string
|
|
103
|
+
): unknown {
|
|
104
|
+
// Handle null/undefined
|
|
105
|
+
if (data == null) {
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
// Handle BigInt
|
|
109
|
+
if (typeof data === "bigint") {
|
|
110
|
+
return BigNumber.from(data);
|
|
111
|
+
}
|
|
112
|
+
// Handle Uint8Array and byte arrays
|
|
113
|
+
if (data instanceof Uint8Array || isUint8Array(data)) {
|
|
114
|
+
const bytes = data instanceof Uint8Array ? data : new Uint8Array(data as number[]);
|
|
115
|
+
const hex = "0x" + Buffer.from(bytes).toString("hex");
|
|
116
|
+
if (currentKey && uint8ArrayKeysAsBigInt.includes(currentKey)) {
|
|
117
|
+
return BigNumber.from(hex);
|
|
118
|
+
}
|
|
119
|
+
return hex;
|
|
120
|
+
}
|
|
121
|
+
// Handle regular arrays (non-byte arrays)
|
|
122
|
+
if (Array.isArray(data)) {
|
|
123
|
+
return data.map((item) => unwrapEventData(item, uint8ArrayKeysAsBigInt));
|
|
124
|
+
}
|
|
125
|
+
// Handle strings (potential addresses)
|
|
126
|
+
if (typeof data === "string" && isAddress(data)) {
|
|
127
|
+
return SvmAddress.from(data).toBytes32();
|
|
128
|
+
}
|
|
129
|
+
// Handle objects
|
|
130
|
+
if (typeof data === "object") {
|
|
131
|
+
// Special case: if an object is in the context of the fillType key, then
|
|
132
|
+
// parse out the fillType from the object
|
|
133
|
+
if (currentKey === "fillType") {
|
|
134
|
+
const fillType = Object.keys(data)[0];
|
|
135
|
+
switch (fillType) {
|
|
136
|
+
case "FastFill":
|
|
137
|
+
return FillType.FastFill;
|
|
138
|
+
case "ReplacedSlowFill":
|
|
139
|
+
return FillType.ReplacedSlowFill;
|
|
140
|
+
case "SlowFill":
|
|
141
|
+
return FillType.SlowFill;
|
|
142
|
+
default:
|
|
143
|
+
throw new Error(`Unknown fill type: ${fillType}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Special case: if an object is empty, return 0x
|
|
147
|
+
if (Object.keys(data).length === 0) {
|
|
148
|
+
return "0x";
|
|
149
|
+
}
|
|
150
|
+
return Object.fromEntries(
|
|
151
|
+
Object.entries(data as Record<string, unknown>).map(([key, value]) => [
|
|
152
|
+
key,
|
|
153
|
+
unwrapEventData(value, uint8ArrayKeysAsBigInt, key),
|
|
154
|
+
])
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
// Return primitives as is
|
|
158
|
+
return data;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Returns the PDA for the State account.
|
|
163
|
+
* @param programId The SpokePool program ID.
|
|
164
|
+
* @returns The PDA for the State account.
|
|
165
|
+
*/
|
|
166
|
+
export async function getStatePda(programId: Address): Promise<Address> {
|
|
167
|
+
const intEncoder = getU64Encoder();
|
|
168
|
+
const seed = intEncoder.encode(0);
|
|
169
|
+
const [statePda] = await getProgramDerivedAddress({
|
|
170
|
+
programAddress: programId,
|
|
171
|
+
seeds: ["state", seed],
|
|
172
|
+
});
|
|
173
|
+
return statePda;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Returns the fill status PDA for the given relay data.
|
|
178
|
+
* @param programId The SpokePool program ID.
|
|
179
|
+
* @param relayData The relay data to get the fill status PDA for.
|
|
180
|
+
* @param destinationChainId The destination chain ID.
|
|
181
|
+
* @returns The PDA for the fill status.
|
|
182
|
+
*/
|
|
183
|
+
export async function getFillStatusPda(
|
|
184
|
+
programId: Address,
|
|
185
|
+
relayData: RelayData,
|
|
186
|
+
destinationChainId: number
|
|
187
|
+
): Promise<Address> {
|
|
188
|
+
const relayDataHash = getRelayDataHash(relayData, destinationChainId);
|
|
189
|
+
const uint8RelayDataHash = new Uint8Array(Buffer.from(relayDataHash.slice(2), "hex"));
|
|
190
|
+
const [fillStatusPda] = await getProgramDerivedAddress({
|
|
191
|
+
programAddress: programId,
|
|
192
|
+
seeds: ["fills", uint8RelayDataHash],
|
|
193
|
+
});
|
|
194
|
+
return fillStatusPda;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Returns the PDA for a route account on SVM Spoke.
|
|
199
|
+
* @param originToken The origin token address.
|
|
200
|
+
* @param seed The seed for the route account.
|
|
201
|
+
* @param routeChainId The route chain ID.
|
|
202
|
+
* @returns The PDA for the route account.
|
|
203
|
+
*/
|
|
204
|
+
export async function getRoutePda(originToken: Address, seed: bigint, routeChainId: bigint): Promise<Address> {
|
|
205
|
+
const intEncoder = getU64Encoder();
|
|
206
|
+
const addressEncoder = getAddressEncoder();
|
|
207
|
+
const [pda] = await getProgramDerivedAddress({
|
|
208
|
+
programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
|
|
209
|
+
seeds: ["route", addressEncoder.encode(originToken), intEncoder.encode(seed), intEncoder.encode(routeChainId)],
|
|
210
|
+
});
|
|
211
|
+
return pda;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Returns the PDA for the Event Authority.
|
|
216
|
+
* @returns The PDA for the Event Authority.
|
|
217
|
+
*/
|
|
218
|
+
export const getEventAuthority = async () => {
|
|
219
|
+
const [eventAuthority] = await getProgramDerivedAddress({
|
|
220
|
+
programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
|
|
221
|
+
seeds: ["__event_authority"],
|
|
222
|
+
});
|
|
223
|
+
return eventAuthority;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Returns a random SVM address.
|
|
228
|
+
*/
|
|
229
|
+
export function getRandomSvmAddress() {
|
|
230
|
+
const bytes = ethers.utils.randomBytes(32);
|
|
231
|
+
const base58Address = bs58.encode(bytes);
|
|
232
|
+
return address(base58Address);
|
|
233
|
+
}
|
|
@@ -98,12 +98,12 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
98
98
|
constructor(
|
|
99
99
|
readonly logger: winston.Logger,
|
|
100
100
|
readonly configStore: Contract,
|
|
101
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "
|
|
101
|
+
eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 },
|
|
102
102
|
readonly configStoreVersion: number
|
|
103
103
|
) {
|
|
104
104
|
super(eventSearchConfig);
|
|
105
|
-
this.
|
|
106
|
-
this.
|
|
105
|
+
this.firstHeightToSearch = eventSearchConfig.from;
|
|
106
|
+
this.latestHeightSearched = 0;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
getRateModelForBlockNumber(
|
|
@@ -355,7 +355,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
355
355
|
return {
|
|
356
356
|
success: true,
|
|
357
357
|
chainId,
|
|
358
|
-
searchEndBlock: searchConfig.
|
|
358
|
+
searchEndBlock: searchConfig.to,
|
|
359
359
|
events: {
|
|
360
360
|
updatedTokenConfigEvents: updatedTokenConfigSortableEvents,
|
|
361
361
|
updatedGlobalConfigEvents: updatedGlobalConfigSortableEvents,
|
|
@@ -550,9 +550,9 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
550
550
|
}
|
|
551
551
|
|
|
552
552
|
this.hasLatestConfigStoreVersion = this.hasValidConfigStoreVersionForTimestamp();
|
|
553
|
-
this.
|
|
554
|
-
this.
|
|
555
|
-
this.eventSearchConfig.
|
|
553
|
+
this.latestHeightSearched = result.searchEndBlock;
|
|
554
|
+
this.firstHeightToSearch = result.searchEndBlock + 1; // Next iteration should start off from where this one ended.
|
|
555
|
+
this.eventSearchConfig.to = undefined; // Caller can re-set on subsequent updates if necessary
|
|
556
556
|
this.chainId = this.chainId ?? chainId; // Update on the first run only.
|
|
557
557
|
this.isUpdated = true;
|
|
558
558
|
|