@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
|
@@ -4,12 +4,10 @@ import { getDeployedAddress } from "@across-protocol/contracts";
|
|
|
4
4
|
import { asL2Provider } from "@eth-optimism/sdk";
|
|
5
5
|
import { providers } from "ethers";
|
|
6
6
|
import { DEFAULT_SIMULATED_RELAYER_ADDRESS, CUSTOM_GAS_TOKENS } from "../../constants";
|
|
7
|
-
import { chainIsOPStack, isDefined
|
|
7
|
+
import { chainIsOPStack, isDefined } from "../../utils";
|
|
8
8
|
import { QueryBase } from "./baseQuery";
|
|
9
|
-
import { SVMProvider as svmProvider } from "../../arch/svm";
|
|
10
9
|
import { DEFAULT_LOGGER, Logger } from "../relayFeeCalculator";
|
|
11
10
|
import { CustomGasTokenQueries } from "./customGasToken";
|
|
12
|
-
import { SvmQuery } from "./svmQuery";
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* Some chains have a fixed gas price that is applied to the gas estimates. We should override
|
|
@@ -22,21 +20,21 @@ const fixedGasPrice = {
|
|
|
22
20
|
export class QueryBase__factory {
|
|
23
21
|
static create(
|
|
24
22
|
chainId: number,
|
|
25
|
-
provider: providers.Provider
|
|
23
|
+
provider: providers.Provider,
|
|
26
24
|
symbolMapping = TOKEN_SYMBOLS_MAP,
|
|
27
25
|
spokePoolAddress = getDeployedAddress("SpokePool", chainId),
|
|
28
26
|
simulatedRelayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS,
|
|
29
27
|
coingeckoProApiKey?: string,
|
|
30
28
|
logger: Logger = DEFAULT_LOGGER,
|
|
31
29
|
coingeckoBaseCurrency = "eth"
|
|
32
|
-
): QueryBase
|
|
30
|
+
): QueryBase {
|
|
33
31
|
assert(isDefined(spokePoolAddress));
|
|
34
32
|
|
|
35
33
|
const customGasTokenSymbol = CUSTOM_GAS_TOKENS[chainId];
|
|
36
34
|
if (customGasTokenSymbol) {
|
|
37
35
|
return new CustomGasTokenQueries({
|
|
38
36
|
queryBaseArgs: [
|
|
39
|
-
provider
|
|
37
|
+
provider,
|
|
40
38
|
symbolMapping,
|
|
41
39
|
spokePoolAddress,
|
|
42
40
|
simulatedRelayerAddress,
|
|
@@ -48,23 +46,9 @@ export class QueryBase__factory {
|
|
|
48
46
|
customGasTokenSymbol,
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
|
-
if (chainIsSvm(chainId)) {
|
|
52
|
-
return new SvmQuery(
|
|
53
|
-
provider as svmProvider,
|
|
54
|
-
symbolMapping,
|
|
55
|
-
SvmAddress.from(spokePoolAddress),
|
|
56
|
-
SvmAddress.from(simulatedRelayerAddress),
|
|
57
|
-
logger,
|
|
58
|
-
coingeckoProApiKey,
|
|
59
|
-
fixedGasPrice[chainId],
|
|
60
|
-
coingeckoBaseCurrency
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
49
|
|
|
64
50
|
// For OPStack chains, we need to wrap the provider in an L2Provider
|
|
65
|
-
provider = chainIsOPStack(chainId)
|
|
66
|
-
? asL2Provider(provider as providers.Provider)
|
|
67
|
-
: (provider as providers.Provider);
|
|
51
|
+
provider = chainIsOPStack(chainId) ? asL2Provider(provider) : provider;
|
|
68
52
|
|
|
69
53
|
return new QueryBase(
|
|
70
54
|
provider,
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { Idl } from "@coral-xyz/anchor";
|
|
2
1
|
import { getDeployedAddress, SvmSpokeIdl } from "@across-protocol/contracts";
|
|
3
2
|
import { getSolanaChainId } from "@across-protocol/contracts/dist/src/svm/web3-v1";
|
|
4
|
-
import web3, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import web3, {
|
|
4
|
+
Address,
|
|
5
|
+
Commitment,
|
|
6
|
+
GetSignaturesForAddressApi,
|
|
7
|
+
GetTransactionApi,
|
|
8
|
+
RpcTransport,
|
|
9
|
+
Signature,
|
|
10
|
+
} from "@solana/kit";
|
|
11
|
+
import { bs58 } from "../utils";
|
|
12
|
+
import { EventData, EventName, EventWithData } from "./types";
|
|
13
|
+
import { decodeEvent } from "./utils/events";
|
|
14
|
+
import { isDevnet } from "./utils/helpers";
|
|
8
15
|
|
|
9
16
|
// Utility type to extract the return type for the JSON encoding overload. We only care about the overload where the
|
|
10
17
|
// configuration parameter (C) has the optional property 'encoding' set to 'json'.
|
|
@@ -19,39 +26,39 @@ type GetSignaturesForAddressConfig = Parameters<GetSignaturesForAddressApi["getS
|
|
|
19
26
|
type GetSignaturesForAddressTransaction = ReturnType<GetSignaturesForAddressApi["getSignaturesForAddress"]>[number];
|
|
20
27
|
type GetSignaturesForAddressApiResponse = readonly GetSignaturesForAddressTransaction[];
|
|
21
28
|
|
|
22
|
-
export class
|
|
23
|
-
private rpc:
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private idl: Idl;
|
|
29
|
+
export class SvmSpokeEventsClient {
|
|
30
|
+
private rpc: web3.Rpc<web3.SolanaRpcApiFromTransport<RpcTransport>>;
|
|
31
|
+
private svmSpokeAddress: Address;
|
|
32
|
+
private svmSpokeEventAuthority: Address;
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
|
-
*
|
|
35
|
+
* Private constructor. Use the async create() method to instantiate.
|
|
30
36
|
*/
|
|
31
|
-
|
|
37
|
+
private constructor(
|
|
38
|
+
rpc: web3.Rpc<web3.SolanaRpcApiFromTransport<RpcTransport>>,
|
|
39
|
+
svmSpokeAddress: Address,
|
|
40
|
+
eventAuthority: Address
|
|
41
|
+
) {
|
|
32
42
|
this.rpc = rpc;
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.idl = idl;
|
|
43
|
+
this.svmSpokeAddress = svmSpokeAddress;
|
|
44
|
+
this.svmSpokeEventAuthority = eventAuthority;
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
/**
|
|
39
48
|
* Factory method to asynchronously create an instance of SvmSpokeEventsClient.
|
|
40
49
|
*/
|
|
41
|
-
public static async create(
|
|
50
|
+
public static async create(
|
|
51
|
+
rpc: web3.Rpc<web3.SolanaRpcApiFromTransport<RpcTransport>>
|
|
52
|
+
): Promise<SvmSpokeEventsClient> {
|
|
42
53
|
const isTestnet = await isDevnet(rpc);
|
|
43
54
|
const programId = getDeployedAddress("SvmSpoke", getSolanaChainId(isTestnet ? "devnet" : "mainnet").toString());
|
|
44
55
|
if (!programId) throw new Error("Program not found");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
public static async createFor(rpc: SVMProvider, programId: string, idl: Idl): Promise<SvmCpiEventsClient> {
|
|
49
|
-
const address = web3.address(programId);
|
|
50
|
-
const [eventAuthority] = await web3.getProgramDerivedAddress({
|
|
51
|
-
programAddress: address,
|
|
56
|
+
const svmSpokeAddress = web3.address(programId);
|
|
57
|
+
const [svmSpokeEventAuthority] = await web3.getProgramDerivedAddress({
|
|
58
|
+
programAddress: svmSpokeAddress,
|
|
52
59
|
seeds: ["__event_authority"],
|
|
53
60
|
});
|
|
54
|
-
return new
|
|
61
|
+
return new SvmSpokeEventsClient(rpc, svmSpokeAddress, svmSpokeEventAuthority);
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
/**
|
|
@@ -63,34 +70,14 @@ export class SvmCpiEventsClient {
|
|
|
63
70
|
* @param options - Options for fetching signatures.
|
|
64
71
|
* @returns A promise that resolves to an array of events matching the eventName.
|
|
65
72
|
*/
|
|
66
|
-
public async queryEvents(
|
|
73
|
+
public async queryEvents<T extends EventData>(
|
|
67
74
|
eventName: EventName,
|
|
68
75
|
fromSlot?: bigint,
|
|
69
76
|
toSlot?: bigint,
|
|
70
77
|
options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
|
|
71
|
-
): Promise<EventWithData[]> {
|
|
78
|
+
): Promise<EventWithData<T>[]> {
|
|
72
79
|
const events = await this.queryAllEvents(fromSlot, toSlot, options);
|
|
73
|
-
return events.filter((event) => event.name === eventName) as EventWithData[];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Queries events for the provided derived address at instantiation filtered by event name.
|
|
78
|
-
*
|
|
79
|
-
* @param eventName - The name of the event to filter by.
|
|
80
|
-
* @param fromSlot - Optional starting slot.
|
|
81
|
-
* @param toSlot - Optional ending slot.
|
|
82
|
-
* @param options - Options for fetching signatures.
|
|
83
|
-
* @returns A promise that resolves to an array of events matching the eventName.
|
|
84
|
-
*/
|
|
85
|
-
public async queryDerivedAddressEvents(
|
|
86
|
-
eventName: string,
|
|
87
|
-
derivedAddress: Address,
|
|
88
|
-
fromSlot?: bigint,
|
|
89
|
-
toSlot?: bigint,
|
|
90
|
-
options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
|
|
91
|
-
): Promise<EventWithData[]> {
|
|
92
|
-
const events = await this.queryAllEvents(fromSlot, toSlot, options, derivedAddress);
|
|
93
|
-
return events.filter((event) => event.name === eventName) as EventWithData[];
|
|
80
|
+
return events.filter((event) => event.name === eventName) as EventWithData<T>[];
|
|
94
81
|
}
|
|
95
82
|
|
|
96
83
|
/**
|
|
@@ -99,23 +86,20 @@ export class SvmCpiEventsClient {
|
|
|
99
86
|
* @param fromSlot - Optional starting slot.
|
|
100
87
|
* @param toSlot - Optional ending slot.
|
|
101
88
|
* @param options - Options for fetching signatures.
|
|
102
|
-
* @param forDerivedAddress - Whether to query events for the program or the derived address.
|
|
103
89
|
* @returns A promise that resolves to an array of all events with additional metadata.
|
|
104
90
|
*/
|
|
105
91
|
private async queryAllEvents(
|
|
106
92
|
fromSlot?: bigint,
|
|
107
93
|
toSlot?: bigint,
|
|
108
|
-
options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
|
|
109
|
-
|
|
110
|
-
): Promise<EventWithData[]> {
|
|
111
|
-
const addressToQuery = derivedAddress || this.programAddress;
|
|
94
|
+
options: GetSignaturesForAddressConfig = { limit: 1000, commitment: "confirmed" }
|
|
95
|
+
): Promise<EventWithData<EventData>[]> {
|
|
112
96
|
const allSignatures: GetSignaturesForAddressTransaction[] = [];
|
|
113
97
|
let hasMoreSignatures = true;
|
|
114
98
|
let currentOptions = options;
|
|
115
99
|
|
|
116
100
|
while (hasMoreSignatures) {
|
|
117
101
|
const signatures: GetSignaturesForAddressApiResponse = await this.rpc
|
|
118
|
-
.getSignaturesForAddress(
|
|
102
|
+
.getSignaturesForAddress(this.svmSpokeAddress, currentOptions)
|
|
119
103
|
.send();
|
|
120
104
|
// Signatures are sorted by slot in descending order.
|
|
121
105
|
allSignatures.push(...signatures);
|
|
@@ -178,9 +162,11 @@ export class SvmCpiEventsClient {
|
|
|
178
162
|
* @param txResult - The transaction result.
|
|
179
163
|
* @returns A promise that resolves to an array of events with their data and name.
|
|
180
164
|
*/
|
|
181
|
-
private processEventFromTx(
|
|
165
|
+
private processEventFromTx(
|
|
166
|
+
txResult: GetTransactionReturnType
|
|
167
|
+
): { program: Address; data: EventData; name: EventName }[] {
|
|
182
168
|
if (!txResult) return [];
|
|
183
|
-
const events: { program: Address; data:
|
|
169
|
+
const events: { program: Address; data: EventData; name: EventName }[] = [];
|
|
184
170
|
|
|
185
171
|
const accountKeys = txResult.transaction.message.accountKeys;
|
|
186
172
|
const messageAccountKeys = [...accountKeys];
|
|
@@ -196,26 +182,18 @@ export class SvmCpiEventsClient {
|
|
|
196
182
|
if (
|
|
197
183
|
ixProgramId !== undefined &&
|
|
198
184
|
singleIxAccount !== undefined &&
|
|
199
|
-
this.
|
|
200
|
-
this.
|
|
185
|
+
this.svmSpokeAddress === ixProgramId &&
|
|
186
|
+
this.svmSpokeEventAuthority === singleIxAccount
|
|
201
187
|
) {
|
|
202
188
|
const ixData = bs58.decode(ix.data);
|
|
203
189
|
// Skip the first 8 bytes (assumed header) and encode the rest.
|
|
204
190
|
const eventData = Buffer.from(ixData.slice(8)).toString("base64");
|
|
205
|
-
const { name, data } = decodeEvent(
|
|
206
|
-
events.push({ program: this.
|
|
191
|
+
const { name, data } = decodeEvent(SvmSpokeIdl, eventData);
|
|
192
|
+
events.push({ program: this.svmSpokeAddress, name, data });
|
|
207
193
|
}
|
|
208
194
|
}
|
|
209
195
|
}
|
|
210
196
|
|
|
211
197
|
return events;
|
|
212
198
|
}
|
|
213
|
-
|
|
214
|
-
public getProgramAddress(): Address {
|
|
215
|
-
return this.programAddress;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
public getRpc(): SVMProvider {
|
|
219
|
-
return this.rpc;
|
|
220
|
-
}
|
|
221
199
|
}
|
package/src/svm/index.ts
ADDED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
+
import { Signature, Address, UnixTimestamp } from "@solana/kit";
|
|
1
2
|
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";
|
|
13
3
|
|
|
14
4
|
export type EventData =
|
|
15
5
|
| SvmSpokeClient.BridgedToHubPool
|
|
@@ -46,19 +36,12 @@ export enum SVMEventNames {
|
|
|
46
36
|
|
|
47
37
|
export type EventName = keyof typeof SVMEventNames;
|
|
48
38
|
|
|
49
|
-
export type EventWithData = {
|
|
39
|
+
export type EventWithData<T extends EventData> = {
|
|
50
40
|
confirmationStatus: string | null;
|
|
51
41
|
blockTime: UnixTimestamp | null;
|
|
52
42
|
signature: Signature;
|
|
53
43
|
slot: bigint;
|
|
54
|
-
name:
|
|
55
|
-
data:
|
|
44
|
+
name: EventName;
|
|
45
|
+
data: T;
|
|
56
46
|
program: Address;
|
|
57
47
|
};
|
|
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,58 @@
|
|
|
1
|
+
import { BN, BorshEventCoder, Idl } from "@coral-xyz/anchor";
|
|
2
|
+
import { address } from "@solana/kit";
|
|
3
|
+
import { EventName, EventData, SVMEventNames } from "../types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parses event data from a transaction.
|
|
7
|
+
*/
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
export function parseEventData(eventData: any): any {
|
|
10
|
+
if (!eventData) return eventData;
|
|
11
|
+
|
|
12
|
+
if (Array.isArray(eventData)) {
|
|
13
|
+
return eventData.map(parseEventData);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (typeof eventData === "object") {
|
|
17
|
+
if (eventData.constructor.name === "PublicKey") {
|
|
18
|
+
return address(eventData.toString());
|
|
19
|
+
}
|
|
20
|
+
if (BN.isBN(eventData)) {
|
|
21
|
+
return BigInt(eventData.toString());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Convert each key from snake_case to camelCase and process the value recursively.
|
|
25
|
+
return Object.fromEntries(
|
|
26
|
+
Object.entries(eventData).map(([key, value]) => [snakeToCamel(key), parseEventData(value)])
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return eventData;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Decodes a raw event according to a supplied IDL.
|
|
35
|
+
*/
|
|
36
|
+
export function decodeEvent(idl: Idl, rawEvent: string): { data: EventData; name: EventName } {
|
|
37
|
+
const event = new BorshEventCoder(idl).decode(rawEvent);
|
|
38
|
+
if (!event) throw new Error(`Malformed rawEvent for IDL ${idl.address}: ${rawEvent}`);
|
|
39
|
+
return {
|
|
40
|
+
name: getEventName(event.name),
|
|
41
|
+
data: parseEventData(event.data),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Converts a snake_case string to camelCase.
|
|
47
|
+
*/
|
|
48
|
+
function snakeToCamel(s: string): string {
|
|
49
|
+
return s.replace(/(_\w)/g, (match) => match[1].toUpperCase());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Gets the event name from a raw name.
|
|
54
|
+
*/
|
|
55
|
+
export function getEventName(rawName: string): EventName {
|
|
56
|
+
if (Object.values(SVMEventNames).some((name) => rawName.includes(name))) return rawName as EventName;
|
|
57
|
+
throw new Error(`Unknown event name: ${rawName}`);
|
|
58
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import web3, { RpcTransport } from "@solana/kit";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper to determine if the current RPC network is devnet.
|
|
5
|
+
*/
|
|
6
|
+
export async function isDevnet(rpc: web3.Rpc<web3.SolanaRpcApiFromTransport<RpcTransport>>): Promise<boolean> {
|
|
7
|
+
const genesisHash = await rpc.getGenesisHash().send();
|
|
8
|
+
return genesisHash === "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG";
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./events";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { providers, utils } from "ethers";
|
|
2
2
|
import bs58 from "bs58";
|
|
3
|
-
import { Address as V2Address } from "@solana/kit";
|
|
4
3
|
import { BigNumber, chainIsEvm } from "./";
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -78,9 +77,9 @@ export function isValidEvmAddress(address: string): boolean {
|
|
|
78
77
|
* @returns a child `Address` type most fitting for the chain ID.
|
|
79
78
|
* @todo: Change this to `toAddress` once we remove the other `toAddress` function.
|
|
80
79
|
*/
|
|
81
|
-
export function toAddressType(address: string): Address | EvmAddress | SvmAddress {
|
|
80
|
+
export function toAddressType(address: string, chainId: number): Address | EvmAddress | SvmAddress {
|
|
82
81
|
try {
|
|
83
|
-
if (
|
|
82
|
+
if (chainIsEvm(chainId)) {
|
|
84
83
|
return EvmAddress.from(address);
|
|
85
84
|
}
|
|
86
85
|
return SvmAddress.from(address);
|
|
@@ -147,11 +146,6 @@ export class Address {
|
|
|
147
146
|
return this.toBytes32();
|
|
148
147
|
}
|
|
149
148
|
|
|
150
|
-
// Converts the address to a Buffer type.
|
|
151
|
-
toBuffer(): Buffer {
|
|
152
|
-
return Buffer.from(this.rawAddress);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
149
|
// Implements `Hexable` for `Address`. Needed for encoding purposes. This class is treated by default as a bytes32 primitive type, but can change for subclasses.
|
|
156
150
|
toHexString(): string {
|
|
157
151
|
return this.toBytes32();
|
|
@@ -191,16 +185,6 @@ export class Address {
|
|
|
191
185
|
return utils.stripZeros(this.rawAddress).length === 0;
|
|
192
186
|
}
|
|
193
187
|
|
|
194
|
-
// Forces `rawAddress` to become an SvmAddress type. This will only throw if `rawAddress.length > 32`.
|
|
195
|
-
forceSvmAddress(): SvmAddress {
|
|
196
|
-
return SvmAddress.from(this.toBase58());
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Forces `rawAddress` to become an EvmAddress type. This will throw if `rawAddress.length > 20`.
|
|
200
|
-
forceEvmAddress(): EvmAddress {
|
|
201
|
-
return EvmAddress.from(this.toEvmAddress());
|
|
202
|
-
}
|
|
203
|
-
|
|
204
188
|
// Checks if the other address is equivalent to this address.
|
|
205
189
|
eq(other: Address): boolean {
|
|
206
190
|
return this.toString() === other.toString();
|
|
@@ -239,20 +223,8 @@ export class EvmAddress extends Address {
|
|
|
239
223
|
}
|
|
240
224
|
|
|
241
225
|
// Constructs a new EvmAddress type.
|
|
242
|
-
static from(
|
|
243
|
-
|
|
244
|
-
return new this(utils.arrayify(address));
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const decodedAddress = bs58.decode(address);
|
|
248
|
-
const padding = decodedAddress.subarray(0, 12);
|
|
249
|
-
const evmAddress = decodedAddress.subarray(12);
|
|
250
|
-
|
|
251
|
-
if (padding.length !== 12 || utils.stripZeros(padding).length !== 0 || evmAddress.length !== 20) {
|
|
252
|
-
throw new Error(`Not a valid base58-encoded EVM address: ${address}`);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return new this(evmAddress);
|
|
226
|
+
static from(hexString: string): EvmAddress {
|
|
227
|
+
return new this(utils.arrayify(hexString));
|
|
256
228
|
}
|
|
257
229
|
}
|
|
258
230
|
|
|
@@ -269,27 +241,12 @@ export class SvmAddress extends Address {
|
|
|
269
241
|
return this.toBase58();
|
|
270
242
|
}
|
|
271
243
|
|
|
272
|
-
// Small utility to convert an SvmAddress to a Solana Kit branded type.
|
|
273
|
-
toV2Address(): V2Address<string> {
|
|
274
|
-
return this.toBase58() as V2Address<string>;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Forces an SvmAddress to an EVM address string by truncating the leading 12 bytes.
|
|
278
244
|
override toEvmAddress(): string {
|
|
279
245
|
return toAddress(`0x${this.toBytes32().slice(-40)}`);
|
|
280
246
|
}
|
|
281
247
|
|
|
282
248
|
// Constructs a new SvmAddress type.
|
|
283
|
-
static from(
|
|
284
|
-
|
|
285
|
-
return new this(bs58.decode(address));
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const decodedAddress = utils.arrayify(address);
|
|
289
|
-
if (decodedAddress.length !== 32) {
|
|
290
|
-
throw new Error(`Not a valid base16-encoded SVM address: ${address}`);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return new this(decodedAddress);
|
|
249
|
+
static from(bs58Address: string): SvmAddress {
|
|
250
|
+
return new this(bs58.decode(bs58Address));
|
|
294
251
|
}
|
|
295
252
|
}
|
package/src/utils/ArrayUtils.ts
CHANGED
|
@@ -168,15 +168,3 @@ export function includesAsync<T>(
|
|
|
168
168
|
export function isArrayOf<T>(array: unknown, predicate: (value: unknown) => value is T): array is T[] {
|
|
169
169
|
return Array.isArray(array) && array.every(predicate);
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Checks if a value is a Uint8Array.
|
|
174
|
-
* @param value The value to check.
|
|
175
|
-
* @returns True if the value is a Uint8Array, false otherwise.
|
|
176
|
-
*/
|
|
177
|
-
export function isUint8Array(value: unknown): value is Uint8Array {
|
|
178
|
-
return (
|
|
179
|
-
Array.isArray(value) &&
|
|
180
|
-
value.every((item) => typeof item === "number" && Number.isInteger(item) && item >= 0 && item < 256)
|
|
181
|
-
);
|
|
182
|
-
}
|
package/src/utils/EventUtils.ts
CHANGED
|
@@ -99,9 +99,9 @@ export function spreadEvent(args: Result | Record<string, unknown>): { [key: str
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export interface EventSearchConfig {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
fromBlock: number;
|
|
103
|
+
toBlock: number;
|
|
104
|
+
maxBlockLookBack?: number;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
export const eventToLog = (event: Event): Log => ({ ...event, event: event.event!, args: spreadEvent(event.args!) });
|
|
@@ -113,8 +113,8 @@ export async function paginatedEventQuery(
|
|
|
113
113
|
retryCount = 0
|
|
114
114
|
): Promise<Log[]> {
|
|
115
115
|
// If the max block look back is set to 0 then we dont need to do any pagination and can query over the whole range.
|
|
116
|
-
if (searchConfig.
|
|
117
|
-
const events = await contract.queryFilter(filter, searchConfig.
|
|
116
|
+
if (searchConfig.maxBlockLookBack === 0) {
|
|
117
|
+
const events = await contract.queryFilter(filter, searchConfig.fromBlock, searchConfig.toBlock);
|
|
118
118
|
return events.map(eventToLog);
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -132,7 +132,7 @@ export async function paginatedEventQuery(
|
|
|
132
132
|
)
|
|
133
133
|
.flat()
|
|
134
134
|
// Filter events by block number because ranges can include blocks that are outside the range specified for caching reasons.
|
|
135
|
-
.filter((event) => event.blockNumber >= searchConfig.
|
|
135
|
+
.filter((event) => event.blockNumber >= searchConfig.fromBlock && event.blockNumber <= searchConfig.toBlock)
|
|
136
136
|
.map(eventToLog)
|
|
137
137
|
);
|
|
138
138
|
} catch (error) {
|
|
@@ -159,11 +159,11 @@ export async function paginatedEventQuery(
|
|
|
159
159
|
* input range, but can include blocks outside of the desired range, so results should be filtered. Results
|
|
160
160
|
* are ordered from smallest to largest.
|
|
161
161
|
*/
|
|
162
|
-
export function getPaginatedBlockRanges({
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
export function getPaginatedBlockRanges({
|
|
163
|
+
fromBlock,
|
|
164
|
+
toBlock,
|
|
165
|
+
maxBlockLookBack,
|
|
166
|
+
}: EventSearchConfig): [number, number][] {
|
|
167
167
|
// If the maxBlockLookBack is undefined, we can look back as far as we like. Just return the entire range.
|
|
168
168
|
if (maxBlockLookBack === undefined) {
|
|
169
169
|
return [[fromBlock, toBlock]];
|
package/src/utils/JSONUtils.ts
CHANGED
|
@@ -33,8 +33,6 @@ export function stringifyJSONWithNumericString(obj: unknown): string {
|
|
|
33
33
|
return JSON.stringify(obj, (_key, value) => {
|
|
34
34
|
if (typeof value === "object" && value !== null && value.type === "BigNumber") {
|
|
35
35
|
return BigNumber.from(value).toString();
|
|
36
|
-
} else if (typeof value === "bigint" && value !== null) {
|
|
37
|
-
return value.toString();
|
|
38
36
|
}
|
|
39
37
|
return value;
|
|
40
38
|
});
|
package/src/utils/SpokeUtils.ts
CHANGED
|
@@ -4,8 +4,6 @@ import { Deposit, RelayData } from "../interfaces";
|
|
|
4
4
|
import { toBytes32 } from "./AddressUtils";
|
|
5
5
|
import { BigNumber } from "./BigNumberUtils";
|
|
6
6
|
import { isMessageEmpty } from "./DepositUtils";
|
|
7
|
-
import { chainIsSvm } from "./NetworkUtils";
|
|
8
|
-
import { svm } from "../arch";
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Produce the RelayData for a Deposit.
|
|
@@ -65,9 +63,7 @@ export function getRelayDataHash(relayData: RelayData, destinationChainId: numbe
|
|
|
65
63
|
outputToken: toBytes32(relayData.outputToken),
|
|
66
64
|
exclusiveRelayer: toBytes32(relayData.exclusiveRelayer),
|
|
67
65
|
};
|
|
68
|
-
|
|
69
|
-
return svm.getRelayDataHash(_relayData, destinationChainId);
|
|
70
|
-
}
|
|
66
|
+
|
|
71
67
|
return keccak256(encodeAbiParameters(abi, [_relayData, destinationChainId]));
|
|
72
68
|
}
|
|
73
69
|
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SvmAddress, BigNumber } from "../../utils";
|
|
2
|
-
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
3
|
-
import { SvmCpiEventsClient } from "./";
|
|
4
|
-
import { Deposit, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
|
|
5
|
-
import { Address, type TransactionSigner } from "@solana/kit";
|
|
6
|
-
import { Logger } from "winston";
|
|
7
|
-
import { SVMProvider } from "./types";
|
|
8
|
-
export declare function populateV3Relay(_spokePool: unknown, _deposit: Omit<Deposit, "messageHash">, _relayer: string, _repaymentChainId?: number): Promise<unknown>;
|
|
9
|
-
export declare function getTimestampForSlot(provider: SVMProvider, slotNumber: number): Promise<number>;
|
|
10
|
-
export declare function getFillDeadline(provider: SVMProvider, statePda: Address): Promise<number>;
|
|
11
|
-
export declare function getDepositIdAtBlock(_contract: unknown, _blockTag: number): Promise<BigNumber>;
|
|
12
|
-
export declare function findDepositBlock(_spokePool: unknown, depositId: BigNumber, _lowBlock: number, _highBlock?: number): Promise<number | undefined>;
|
|
13
|
-
export declare function relayFillStatus(programId: Address, relayData: RelayData, destinationChainId: number, svmEventsClient: SvmCpiEventsClient, atHeight?: number): Promise<FillStatus>;
|
|
14
|
-
export declare function fillStatusArray(programId: Address, relayData: RelayData[], destinationChainId: number, svmEventsClient: SvmCpiEventsClient, atHeight?: number, logger?: Logger): Promise<(FillStatus | undefined)[]>;
|
|
15
|
-
export declare function findFillEvent(relayData: RelayData, destinationChainId: number, svmEventsClient: SvmCpiEventsClient, fromSlot: number, toSlot?: number): Promise<FillWithBlock | undefined>;
|
|
16
|
-
export declare function fillRelayInstruction(spokePool: SvmAddress, deposit: Omit<Deposit, "messageHash">, relayer: TransactionSigner<string>, recipientTokenAccount: Address<string>, repaymentChainId?: number): Promise<SvmSpokeClient.FillRelayInstruction<Address<"JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq">, string, string, string, string, string, string, string, string, string, string, string, string, []>>;
|
|
17
|
-
export declare function createTokenAccountsInstruction(mint: SvmAddress, relayer: TransactionSigner<string>): SvmSpokeClient.CreateTokenAccountsInstruction;
|
|
18
|
-
export declare function createApproveInstruction(mint: SvmAddress, amount: BigNumber, relayer: SvmAddress, spokePool: SvmAddress, mintDecimals?: number): Promise<import("@solana-program/token").ApproveCheckedInstruction<Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">, string, string, string, string, []>>;
|
|
19
|
-
export declare function getAssociatedTokenAddress(owner: SvmAddress, mint: SvmAddress, tokenProgramId?: Address<string>): Promise<Address<string>>;
|
|
20
|
-
export declare function getRelayDataHash(relayData: RelayData, destinationChainId: number): string;
|