@across-protocol/sdk 4.1.63-beta.0 → 4.1.63
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/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 +90 -90
- package/dist/cjs/clients/HubPoolClient.d.ts +1 -1
- package/dist/cjs/clients/HubPoolClient.js +16 -16
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +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 +54 -50
- 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/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 -7
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +4 -5
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +11 -4
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +1 -7
- 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 +9 -0
- package/dist/cjs/svm/eventsClient.d.ts +15 -0
- package/dist/cjs/{arch/svm → svm}/eventsClient.js +28 -60
- 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/{esm/arch → cjs}/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/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/TokenUtils.d.ts +18 -0
- 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/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 +90 -90
- package/dist/esm/clients/HubPoolClient.d.ts +1 -1
- package/dist/esm/clients/HubPoolClient.js +16 -16
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +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 +55 -51
- 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/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 -7
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +3 -4
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +11 -4
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +2 -8
- 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 +9 -0
- package/dist/esm/svm/eventsClient.d.ts +51 -0
- package/dist/esm/{arch/svm → svm}/eventsClient.js +27 -69
- 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/{cjs/arch → esm}/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/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/TokenUtils.d.ts +18 -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/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 +90 -90
- package/dist/types/clients/HubPoolClient.d.ts +1 -1
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +3 -3
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/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/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 -7
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +11 -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 +9 -0
- 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/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/TokenUtils.d.ts +18 -0
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -5
- package/src/arch/evm/SpokeUtils.ts +5 -5
- 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 +16 -16
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +21 -23
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +56 -44
- 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/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 -7
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +3 -5
- package/src/relayFeeCalculator/chain-queries/factory.ts +5 -21
- package/src/relayFeeCalculator/chain-queries/index.ts +0 -1
- package/src/{arch/svm → svm}/eventsClient.ts +45 -67
- 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/EventUtils.ts +11 -11
- package/src/utils/JSONUtils.ts +0 -2
- package/src/utils/SpokeUtils.ts +1 -5
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +0 -20
- package/dist/cjs/arch/svm/SpokeUtils.js +0 -428
- package/dist/cjs/arch/svm/SpokeUtils.js.map +0 -1
- package/dist/cjs/arch/svm/constants.d.ts +0 -1
- package/dist/cjs/arch/svm/constants.js +0 -5
- package/dist/cjs/arch/svm/constants.js.map +0 -1
- package/dist/cjs/arch/svm/eventsClient.d.ts +0 -21
- 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 -17
- package/dist/cjs/arch/svm/utils.js +0 -204
- 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 -145
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.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/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -31
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +0 -136
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +0 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +0 -94
- package/dist/esm/arch/svm/SpokeUtils.js +0 -513
- package/dist/esm/arch/svm/SpokeUtils.js.map +0 -1
- package/dist/esm/arch/svm/constants.d.ts +0 -1
- package/dist/esm/arch/svm/constants.js +0 -2
- package/dist/esm/arch/svm/constants.js.map +0 -1
- package/dist/esm/arch/svm/eventsClient.d.ts +0 -67
- 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 -59
- package/dist/esm/arch/svm/utils.js +0 -248
- package/dist/esm/arch/svm/utils.js.map +0 -1
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +0 -67
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +0 -196
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.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/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -66
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +0 -169
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +0 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +0 -95
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +0 -1
- package/dist/types/arch/svm/constants.d.ts +0 -2
- package/dist/types/arch/svm/constants.d.ts.map +0 -1
- package/dist/types/arch/svm/eventsClient.d.ts +0 -68
- 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 -60
- package/dist/types/arch/svm/utils.d.ts.map +0 -1
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts +0 -68
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.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/relayFeeCalculator/chain-queries/svmQuery.d.ts +0 -67
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +0 -1
- package/src/arch/svm/SpokeUtils.ts +0 -526
- package/src/arch/svm/constants.ts +0 -1
- package/src/arch/svm/utils.ts +0 -222
- package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +0 -244
- package/src/gasPriceOracle/adapters/solana.ts +0 -45
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +0 -193
- /package/dist/cjs/{arch/svm → svm}/types.js +0 -0
- /package/dist/esm/{arch/svm → svm}/types.js +0 -0
package/src/arch/svm/utils.ts
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { BN, BorshEventCoder, Idl } from "@coral-xyz/anchor";
|
|
2
|
-
import {
|
|
3
|
-
address,
|
|
4
|
-
getProgramDerivedAddress,
|
|
5
|
-
getU64Encoder,
|
|
6
|
-
getAddressEncoder,
|
|
7
|
-
Address,
|
|
8
|
-
isAddress,
|
|
9
|
-
type TransactionSigner,
|
|
10
|
-
} from "@solana/kit";
|
|
11
|
-
import { BigNumber, getRelayDataHash, isUint8Array, SvmAddress } from "../../utils";
|
|
12
|
-
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
13
|
-
import { FillType, RelayData } from "../../interfaces";
|
|
14
|
-
import { EventName, SVMEventNames, SVMProvider } from "./types";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Basic void TransactionSigner type
|
|
18
|
-
*/
|
|
19
|
-
export const SolanaVoidSigner: (simulationAddress: string) => TransactionSigner<string> = (
|
|
20
|
-
simulationAddress: string
|
|
21
|
-
) => {
|
|
22
|
-
return {
|
|
23
|
-
address: address(simulationAddress),
|
|
24
|
-
signAndSendTransactions: async () => {
|
|
25
|
-
return await Promise.resolve([]);
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Helper to determine if the current RPC network is devnet.
|
|
32
|
-
*/
|
|
33
|
-
export async function isDevnet(rpc: SVMProvider): Promise<boolean> {
|
|
34
|
-
const genesisHash = await rpc.getGenesisHash().send();
|
|
35
|
-
return genesisHash === "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Parses event data from a transaction.
|
|
40
|
-
*/
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
export function parseEventData(eventData: any): any {
|
|
43
|
-
if (!eventData) return eventData;
|
|
44
|
-
|
|
45
|
-
if (Array.isArray(eventData)) {
|
|
46
|
-
return eventData.map(parseEventData);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (typeof eventData === "object") {
|
|
50
|
-
if (eventData.constructor.name === "PublicKey") {
|
|
51
|
-
return address(eventData.toString());
|
|
52
|
-
}
|
|
53
|
-
if (BN.isBN(eventData)) {
|
|
54
|
-
return BigInt(eventData.toString());
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Convert each key from snake_case to camelCase and process the value recursively.
|
|
58
|
-
return Object.fromEntries(
|
|
59
|
-
Object.entries(eventData).map(([key, value]) => [snakeToCamel(key), parseEventData(value)])
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return eventData;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Decodes a raw event according to a supplied IDL.
|
|
68
|
-
*/
|
|
69
|
-
export function decodeEvent(idl: Idl, rawEvent: string): { data: unknown; name: string } {
|
|
70
|
-
const event = new BorshEventCoder(idl).decode(rawEvent);
|
|
71
|
-
if (!event) throw new Error(`Malformed rawEvent for IDL ${idl.address}: ${rawEvent}`);
|
|
72
|
-
return {
|
|
73
|
-
name: event.name,
|
|
74
|
-
data: parseEventData(event.data),
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Converts a snake_case string to camelCase.
|
|
80
|
-
*/
|
|
81
|
-
function snakeToCamel(s: string): string {
|
|
82
|
-
return s.replace(/(_\w)/g, (match) => match[1].toUpperCase());
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Gets the event name from a raw name.
|
|
87
|
-
*/
|
|
88
|
-
export function getEventName(rawName: string): EventName {
|
|
89
|
-
if (Object.values(SVMEventNames).some((name) => rawName.includes(name))) return rawName as EventName;
|
|
90
|
-
throw new Error(`Unknown event name: ${rawName}`);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Unwraps any data structure and converts Address types to strings and Uint8Array to hex or BigInt.
|
|
95
|
-
* Recursively processes nested objects and arrays.
|
|
96
|
-
*/
|
|
97
|
-
export function unwrapEventData(
|
|
98
|
-
data: unknown,
|
|
99
|
-
uint8ArrayKeysAsBigInt: string[] = ["depositId"],
|
|
100
|
-
currentKey?: string
|
|
101
|
-
): unknown {
|
|
102
|
-
// Handle null/undefined
|
|
103
|
-
if (data == null) {
|
|
104
|
-
return data;
|
|
105
|
-
}
|
|
106
|
-
// Handle BigInt
|
|
107
|
-
if (typeof data === "bigint") {
|
|
108
|
-
return BigNumber.from(data);
|
|
109
|
-
}
|
|
110
|
-
// Handle Uint8Array and byte arrays
|
|
111
|
-
if (data instanceof Uint8Array || isUint8Array(data)) {
|
|
112
|
-
const bytes = data instanceof Uint8Array ? data : new Uint8Array(data as number[]);
|
|
113
|
-
const hex = "0x" + Buffer.from(bytes).toString("hex");
|
|
114
|
-
if (currentKey && uint8ArrayKeysAsBigInt.includes(currentKey)) {
|
|
115
|
-
return BigNumber.from(hex);
|
|
116
|
-
}
|
|
117
|
-
return hex;
|
|
118
|
-
}
|
|
119
|
-
// Handle regular arrays (non-byte arrays)
|
|
120
|
-
if (Array.isArray(data)) {
|
|
121
|
-
return data.map((item) => unwrapEventData(item, uint8ArrayKeysAsBigInt));
|
|
122
|
-
}
|
|
123
|
-
// Handle strings (potential addresses)
|
|
124
|
-
if (typeof data === "string" && isAddress(data)) {
|
|
125
|
-
return SvmAddress.from(data).toBytes32();
|
|
126
|
-
}
|
|
127
|
-
// Handle objects
|
|
128
|
-
if (typeof data === "object") {
|
|
129
|
-
// Special case: if an object is in the context of the fillType key, then
|
|
130
|
-
// parse out the fillType from the object
|
|
131
|
-
if (currentKey === "fillType") {
|
|
132
|
-
const fillType = Object.keys(data)[0];
|
|
133
|
-
switch (fillType) {
|
|
134
|
-
case "FastFill":
|
|
135
|
-
return FillType.FastFill;
|
|
136
|
-
case "ReplacedSlowFill":
|
|
137
|
-
return FillType.ReplacedSlowFill;
|
|
138
|
-
case "SlowFill":
|
|
139
|
-
return FillType.SlowFill;
|
|
140
|
-
default:
|
|
141
|
-
throw new Error(`Unknown fill type: ${fillType}`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
// Special case: if an object is empty, return 0x
|
|
145
|
-
if (Object.keys(data).length === 0) {
|
|
146
|
-
return "0x";
|
|
147
|
-
}
|
|
148
|
-
return Object.fromEntries(
|
|
149
|
-
Object.entries(data as Record<string, unknown>).map(([key, value]) => [
|
|
150
|
-
key,
|
|
151
|
-
unwrapEventData(value, uint8ArrayKeysAsBigInt, key),
|
|
152
|
-
])
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
// Return primitives as is
|
|
156
|
-
return data;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Returns the PDA for the State account.
|
|
161
|
-
* @param programId The SpokePool program ID.
|
|
162
|
-
* @returns The PDA for the State account.
|
|
163
|
-
*/
|
|
164
|
-
export async function getStatePda(programId: Address): Promise<Address> {
|
|
165
|
-
const intEncoder = getU64Encoder();
|
|
166
|
-
const seed = intEncoder.encode(0);
|
|
167
|
-
const [statePda] = await getProgramDerivedAddress({
|
|
168
|
-
programAddress: programId,
|
|
169
|
-
seeds: ["state", seed],
|
|
170
|
-
});
|
|
171
|
-
return statePda;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Returns the fill status PDA for the given relay data.
|
|
176
|
-
* @param programId The SpokePool program ID.
|
|
177
|
-
* @param relayData The relay data to get the fill status PDA for.
|
|
178
|
-
* @param destinationChainId The destination chain ID.
|
|
179
|
-
* @returns The PDA for the fill status.
|
|
180
|
-
*/
|
|
181
|
-
export async function getFillStatusPda(
|
|
182
|
-
programId: Address,
|
|
183
|
-
relayData: RelayData,
|
|
184
|
-
destinationChainId: number
|
|
185
|
-
): Promise<Address> {
|
|
186
|
-
const relayDataHash = getRelayDataHash(relayData, destinationChainId);
|
|
187
|
-
const uint8RelayDataHash = new Uint8Array(Buffer.from(relayDataHash.slice(2), "hex"));
|
|
188
|
-
const [fillStatusPda] = await getProgramDerivedAddress({
|
|
189
|
-
programAddress: programId,
|
|
190
|
-
seeds: ["fills", uint8RelayDataHash],
|
|
191
|
-
});
|
|
192
|
-
return fillStatusPda;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Returns the PDA for a route account on SVM Spoke.
|
|
197
|
-
* @param originToken The origin token address.
|
|
198
|
-
* @param seed The seed for the route account.
|
|
199
|
-
* @param routeChainId The route chain ID.
|
|
200
|
-
* @returns The PDA for the route account.
|
|
201
|
-
*/
|
|
202
|
-
export async function getRoutePda(originToken: Address, seed: bigint, routeChainId: bigint): Promise<Address> {
|
|
203
|
-
const intEncoder = getU64Encoder();
|
|
204
|
-
const addressEncoder = getAddressEncoder();
|
|
205
|
-
const [pda] = await getProgramDerivedAddress({
|
|
206
|
-
programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
|
|
207
|
-
seeds: ["route", addressEncoder.encode(originToken), intEncoder.encode(seed), intEncoder.encode(routeChainId)],
|
|
208
|
-
});
|
|
209
|
-
return pda;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Returns the PDA for the Event Authority.
|
|
214
|
-
* @returns The PDA for the Event Authority.
|
|
215
|
-
*/
|
|
216
|
-
export const getEventAuthority = async () => {
|
|
217
|
-
const [eventAuthority] = await getProgramDerivedAddress({
|
|
218
|
-
programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
|
|
219
|
-
seeds: ["__event_authority"],
|
|
220
|
-
});
|
|
221
|
-
return eventAuthority;
|
|
222
|
-
};
|
|
@@ -1,244 +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
|
-
relayFillStatus,
|
|
11
|
-
fillStatusArray,
|
|
12
|
-
} from "../../arch/svm";
|
|
13
|
-
import { FillStatus, RelayData, SortableEvent } from "../../interfaces";
|
|
14
|
-
import {
|
|
15
|
-
BigNumber,
|
|
16
|
-
DepositSearchResult,
|
|
17
|
-
EventSearchConfig,
|
|
18
|
-
MakeOptional,
|
|
19
|
-
sortEventsAscendingInPlace,
|
|
20
|
-
} from "../../utils";
|
|
21
|
-
import { isUpdateFailureReason } from "../BaseAbstractClient";
|
|
22
|
-
import { HubPoolClient } from "../HubPoolClient";
|
|
23
|
-
import { knownEventNames, SpokePoolClient, SpokePoolUpdate } from "./SpokePoolClient";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* SvmSpokePoolClient is a client for the SVM SpokePool program. It extends the base SpokePoolClient
|
|
27
|
-
* and implements the abstract methods required for interacting with an SVM Spoke Pool.
|
|
28
|
-
*/
|
|
29
|
-
export class SvmSpokePoolClient extends SpokePoolClient {
|
|
30
|
-
/**
|
|
31
|
-
* Protected constructor. Use the async create() method to instantiate.
|
|
32
|
-
*/
|
|
33
|
-
protected constructor(
|
|
34
|
-
logger: winston.Logger,
|
|
35
|
-
hubPoolClient: HubPoolClient | null,
|
|
36
|
-
chainId: number,
|
|
37
|
-
deploymentSlot: bigint, // Using slot instead of block number for SVM
|
|
38
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "to">,
|
|
39
|
-
public svmEventsClient: SvmCpiEventsClient,
|
|
40
|
-
protected programId: Address,
|
|
41
|
-
protected statePda: Address
|
|
42
|
-
) {
|
|
43
|
-
// Convert deploymentSlot to number for base class, might need refinement
|
|
44
|
-
super(logger, hubPoolClient, chainId, Number(deploymentSlot), eventSearchConfig);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Factory method to asynchronously create an instance of SvmSpokePoolClient.
|
|
49
|
-
*/
|
|
50
|
-
public static async create(
|
|
51
|
-
logger: winston.Logger,
|
|
52
|
-
hubPoolClient: HubPoolClient | null,
|
|
53
|
-
chainId: number,
|
|
54
|
-
deploymentSlot: bigint,
|
|
55
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 }, // Provide default
|
|
56
|
-
rpc: Rpc<SolanaRpcApiFromTransport<RpcTransport>>
|
|
57
|
-
): Promise<SvmSpokePoolClient> {
|
|
58
|
-
const svmEventsClient = await SvmCpiEventsClient.create(rpc);
|
|
59
|
-
const programId = svmEventsClient.getProgramAddress();
|
|
60
|
-
const statePda = await getStatePda(programId);
|
|
61
|
-
return new SvmSpokePoolClient(
|
|
62
|
-
logger,
|
|
63
|
-
hubPoolClient,
|
|
64
|
-
chainId,
|
|
65
|
-
deploymentSlot,
|
|
66
|
-
eventSearchConfig,
|
|
67
|
-
svmEventsClient,
|
|
68
|
-
programId,
|
|
69
|
-
statePda
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Factory method to asynchronously create an instance of SvmSpokePoolClient with an existing event client.
|
|
75
|
-
*/
|
|
76
|
-
public static async createWithExistingEventClient(
|
|
77
|
-
logger: winston.Logger,
|
|
78
|
-
hubPoolClient: HubPoolClient | null,
|
|
79
|
-
chainId: number,
|
|
80
|
-
deploymentSlot: bigint,
|
|
81
|
-
eventSearchConfig: MakeOptional<EventSearchConfig, "to"> = { from: 0, maxLookBack: 0 }, // Provide default
|
|
82
|
-
eventClient: SvmCpiEventsClient
|
|
83
|
-
) {
|
|
84
|
-
const programId = eventClient.getProgramAddress();
|
|
85
|
-
const statePda = await getStatePda(programId);
|
|
86
|
-
return new SvmSpokePoolClient(
|
|
87
|
-
logger,
|
|
88
|
-
hubPoolClient,
|
|
89
|
-
chainId,
|
|
90
|
-
deploymentSlot,
|
|
91
|
-
eventSearchConfig,
|
|
92
|
-
eventClient,
|
|
93
|
-
programId,
|
|
94
|
-
statePda
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public _queryableEventNames(): string[] {
|
|
99
|
-
// We want to take the internal event names relevant to
|
|
100
|
-
// the SVM SpokePoolClient and filter them against the
|
|
101
|
-
// knownEventNames list that we reference in practice
|
|
102
|
-
const internalEventNames = Object.values(SVMEventNames);
|
|
103
|
-
return internalEventNames.filter((e) => knownEventNames.includes(e));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Performs an update to refresh the state of this client by querying SVM events.
|
|
108
|
-
*/
|
|
109
|
-
protected async _update(eventsToQuery: string[]): Promise<SpokePoolUpdate> {
|
|
110
|
-
const searchConfig = await this.updateSearchConfig(this.svmEventsClient.getRpc());
|
|
111
|
-
if (isUpdateFailureReason(searchConfig)) {
|
|
112
|
-
const reason = searchConfig;
|
|
113
|
-
return { success: false, reason };
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const deploymentSlot = BigInt(this.deploymentBlock);
|
|
117
|
-
|
|
118
|
-
const eventSearchConfigs = eventsToQuery.map((eventName) => {
|
|
119
|
-
if (!this._queryableEventNames().includes(eventName)) {
|
|
120
|
-
throw new Error(`SpokePoolClient: Cannot query unrecognised SpokePool event name: ${eventName}`);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const _searchConfig = { ...searchConfig }; // shallow copy
|
|
124
|
-
|
|
125
|
-
// By default, an event's query range is controlled by the `eventSearchConfig` passed in during instantiation.
|
|
126
|
-
// However, certain events have special overriding requirements to their search ranges:
|
|
127
|
-
// - EnabledDepositRoute: The full history is always required, so override the requested fromBlock.
|
|
128
|
-
if (eventName === "EnabledDepositRoute" && !this.isUpdated) {
|
|
129
|
-
_searchConfig.from = Number(deploymentSlot);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return _searchConfig as EventSearchConfig;
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const spokePoolAddress = this.svmEventsClient.getProgramAddress();
|
|
136
|
-
|
|
137
|
-
this.log("debug", `Updating SpokePool client for chain ${this.chainId}`, {
|
|
138
|
-
eventsToQuery,
|
|
139
|
-
searchConfig,
|
|
140
|
-
spokePool: spokePoolAddress,
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
const timerStart = Date.now();
|
|
144
|
-
|
|
145
|
-
const [currentTime, ...eventsQueried] = await Promise.all([
|
|
146
|
-
this.svmEventsClient.getRpc().getBlockTime(BigInt(searchConfig.to)).send(),
|
|
147
|
-
...eventsToQuery.map(async (eventName, idx) => {
|
|
148
|
-
const config = eventSearchConfigs[idx];
|
|
149
|
-
const events = await this.svmEventsClient.queryEvents(
|
|
150
|
-
eventName as SVMEventNames,
|
|
151
|
-
BigInt(config.from),
|
|
152
|
-
BigInt(config.to),
|
|
153
|
-
{
|
|
154
|
-
limit: config.maxLookBack,
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
return events.map(
|
|
158
|
-
(event): SortableEvent => ({
|
|
159
|
-
txnRef: event.signature,
|
|
160
|
-
blockNumber: Number(event.slot),
|
|
161
|
-
txnIndex: 0,
|
|
162
|
-
logIndex: 0,
|
|
163
|
-
...(unwrapEventData(event.data) as Record<string, unknown>),
|
|
164
|
-
})
|
|
165
|
-
);
|
|
166
|
-
}),
|
|
167
|
-
]);
|
|
168
|
-
this.log("debug", `Time to query new events from RPC for ${this.chainId}: ${Date.now() - timerStart} ms`);
|
|
169
|
-
if (currentTime < this.currentTime) {
|
|
170
|
-
const errMsg = `currentTime: ${currentTime} < ${this.currentTime}`;
|
|
171
|
-
throw new Error(`SvmSpokePoolClient::update: ${errMsg}`);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Sort all events to ensure they are stored in a consistent order.
|
|
175
|
-
eventsQueried.forEach((events) => sortEventsAscendingInPlace(events));
|
|
176
|
-
|
|
177
|
-
return {
|
|
178
|
-
success: true,
|
|
179
|
-
currentTime: Number(currentTime), // uint32
|
|
180
|
-
searchEndBlock: searchConfig.to,
|
|
181
|
-
events: eventsQueried,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Retrieves the fill deadline buffer fetched from the State PDA.
|
|
187
|
-
* @note This function assumes that fill deadline buffer is a constant value in svm environments.
|
|
188
|
-
*/
|
|
189
|
-
public override getMaxFillDeadlineInRange(_startSlot: number, _endSlot: number): Promise<number> {
|
|
190
|
-
return getFillDeadline(this.svmEventsClient.getRpc(), this.statePda);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Retrieves the timestamp for a given SVM slot number.
|
|
195
|
-
*/
|
|
196
|
-
public override getTimestampForBlock(slot: number): Promise<number> {
|
|
197
|
-
return getTimestampForSlot(this.svmEventsClient.getRpc(), slot);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Retrieves the timestamp for a given SVM slot number.
|
|
202
|
-
* @note This function uses the same underlying function as getTimestampForBlock.
|
|
203
|
-
* It is kept for consistency with the EVM SpokePoolClient.
|
|
204
|
-
*/
|
|
205
|
-
public getTimeAt(slot: number): Promise<number> {
|
|
206
|
-
return getTimestampForSlot(this.svmEventsClient.getRpc(), slot);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Finds a deposit based on its deposit ID on the SVM chain.
|
|
211
|
-
* TODO: Implement SVM state query for deposit details.
|
|
212
|
-
*/
|
|
213
|
-
public findDeposit(_depositId: BigNumber): Promise<DepositSearchResult> {
|
|
214
|
-
throw new Error("findDeposit not implemented for SVM");
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Retrieves the fill status for a given relay data from the SVM chain.
|
|
219
|
-
*/
|
|
220
|
-
public override relayFillStatus(
|
|
221
|
-
relayData: RelayData,
|
|
222
|
-
atHeight?: number,
|
|
223
|
-
destinationChainId?: number
|
|
224
|
-
): Promise<FillStatus> {
|
|
225
|
-
destinationChainId ??= this.chainId;
|
|
226
|
-
return relayFillStatus(this.programId, relayData, destinationChainId, this.svmEventsClient, atHeight);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Retrieves the fill status for an array of given relay data.
|
|
231
|
-
* @param relayData The array relay data to retrieve the fill status for.
|
|
232
|
-
* @param atHeight The slot at which to query the fill status.
|
|
233
|
-
* @returns The fill status for each of the given relay data.
|
|
234
|
-
*/
|
|
235
|
-
public fillStatusArray(
|
|
236
|
-
relayData: RelayData[],
|
|
237
|
-
atHeight?: number,
|
|
238
|
-
destinationChainId?: number
|
|
239
|
-
): Promise<(FillStatus | undefined)[]> {
|
|
240
|
-
// @note: deploymentBlock actually refers to the deployment slot. Also, blockTag should be a slot number.
|
|
241
|
-
destinationChainId ??= this.chainId;
|
|
242
|
-
return fillStatusArray(this.programId, relayData, destinationChainId, this.svmEventsClient, atHeight, this.logger);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
@@ -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
|
-
}
|