@across-protocol/sdk 4.3.137-alpha.3 → 4.3.137
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/src/addressAggregator/adapters/abstract.js +5 -9
- package/dist/cjs/src/addressAggregator/adapters/abstract.js.map +1 -1
- package/dist/cjs/src/apiClient/productionClient.js +23 -26
- package/dist/cjs/src/apiClient/productionClient.js.map +1 -1
- package/dist/cjs/src/arch/evm/index.d.ts +0 -1
- package/dist/cjs/src/arch/evm/index.js +0 -1
- package/dist/cjs/src/arch/evm/index.js.map +1 -1
- package/dist/cjs/src/arch/index.d.ts +0 -1
- package/dist/cjs/src/arch/index.js +1 -2
- package/dist/cjs/src/arch/index.js.map +1 -1
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js +2 -6
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +2 -9
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.js +12 -33
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/src/clients/SpokePoolClient/index.d.ts +0 -3
- package/dist/cjs/src/clients/SpokePoolClient/index.js +1 -7
- package/dist/cjs/src/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/cjs/src/clients/SpokePoolClient/types.d.ts +0 -1
- package/dist/cjs/src/clients/SpokePoolClient/types.js +1 -2
- package/dist/cjs/src/clients/SpokePoolClient/types.js.map +1 -1
- package/dist/cjs/src/clients/index.d.ts +1 -1
- package/dist/cjs/src/clients/index.js +1 -3
- package/dist/cjs/src/clients/index.js.map +1 -1
- package/dist/cjs/src/coingecko/Coingecko.js +8 -30
- package/dist/cjs/src/coingecko/Coingecko.js.map +1 -1
- package/dist/cjs/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/cjs/src/gasPriceOracle/oracle.d.ts +1 -3
- package/dist/cjs/src/gasPriceOracle/oracle.js +10 -15
- package/dist/cjs/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/src/gasPriceOracle/types.d.ts +1 -6
- package/dist/cjs/src/gasPriceOracle/types.js +0 -5
- package/dist/cjs/src/gasPriceOracle/types.js.map +1 -1
- package/dist/cjs/src/priceClient/adapters/baseAdapter.d.ts +2 -1
- package/dist/cjs/src/priceClient/adapters/baseAdapter.js +5 -10
- package/dist/cjs/src/priceClient/adapters/baseAdapter.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/factory.d.ts +152 -81
- package/dist/cjs/src/relayFeeCalculator/chain-queries/factory.js +0 -5
- package/dist/cjs/src/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/index.d.ts +0 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/index.js +0 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/relayFeeCalculator.d.ts +150 -77
- package/dist/cjs/src/utils/AddressUtils.d.ts +0 -11
- package/dist/cjs/src/utils/AddressUtils.js +1 -52
- package/dist/cjs/src/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/src/utils/CCTPUtils.js +12 -15
- package/dist/cjs/src/utils/CCTPUtils.js.map +1 -1
- package/dist/cjs/src/utils/FetchUtils.d.ts +5 -0
- package/dist/cjs/src/utils/FetchUtils.js +68 -0
- package/dist/cjs/src/utils/FetchUtils.js.map +1 -0
- package/dist/cjs/src/utils/IPFSUtils.js +2 -17
- package/dist/cjs/src/utils/IPFSUtils.js.map +1 -1
- package/dist/cjs/src/utils/Multicall.js +0 -1
- package/dist/cjs/src/utils/Multicall.js.map +1 -1
- package/dist/cjs/src/utils/NetworkUtils.d.ts +0 -1
- package/dist/cjs/src/utils/NetworkUtils.js +3 -9
- package/dist/cjs/src/utils/NetworkUtils.js.map +1 -1
- package/dist/cjs/src/utils/TokenUtils.d.ts +300 -154
- package/dist/cjs/src/utils/TypeGuards.d.ts +1 -3
- package/dist/cjs/src/utils/TypeGuards.js +0 -5
- package/dist/cjs/src/utils/TypeGuards.js.map +1 -1
- package/dist/cjs/src/utils/abi/typechain/factories/index.d.ts +0 -1
- package/dist/cjs/src/utils/abi/typechain/factories/index.js +2 -4
- package/dist/cjs/src/utils/abi/typechain/factories/index.js.map +1 -1
- package/dist/cjs/src/utils/abi/typechain/index.d.ts +0 -2
- package/dist/cjs/src/utils/abi/typechain/index.js +2 -4
- package/dist/cjs/src/utils/abi/typechain/index.js.map +1 -1
- package/dist/cjs/src/utils/index.d.ts +1 -0
- package/dist/cjs/src/utils/index.js +1 -0
- package/dist/cjs/src/utils/index.js.map +1 -1
- package/dist/esm/src/addressAggregator/adapters/abstract.js +5 -9
- package/dist/esm/src/addressAggregator/adapters/abstract.js.map +1 -1
- package/dist/esm/src/apiClient/productionClient.js +24 -27
- package/dist/esm/src/apiClient/productionClient.js.map +1 -1
- package/dist/esm/src/arch/evm/index.d.ts +0 -1
- package/dist/esm/src/arch/evm/index.js +0 -1
- package/dist/esm/src/arch/evm/index.js.map +1 -1
- package/dist/esm/src/arch/index.d.ts +0 -1
- package/dist/esm/src/arch/index.js +0 -2
- package/dist/esm/src/arch/index.js.map +1 -1
- package/dist/esm/src/caching/Arweave/ArweaveClient.js +3 -7
- package/dist/esm/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +2 -20
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.js +12 -44
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/src/clients/SpokePoolClient/index.d.ts +0 -8
- package/dist/esm/src/clients/SpokePoolClient/index.js +1 -10
- package/dist/esm/src/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/esm/src/clients/SpokePoolClient/types.d.ts +0 -1
- package/dist/esm/src/clients/SpokePoolClient/types.js +0 -1
- package/dist/esm/src/clients/SpokePoolClient/types.js.map +1 -1
- package/dist/esm/src/clients/index.d.ts +1 -1
- package/dist/esm/src/clients/index.js +1 -1
- package/dist/esm/src/clients/index.js.map +1 -1
- package/dist/esm/src/coingecko/Coingecko.js +11 -31
- package/dist/esm/src/coingecko/Coingecko.js.map +1 -1
- package/dist/esm/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/esm/src/gasPriceOracle/oracle.d.ts +1 -3
- package/dist/esm/src/gasPriceOracle/oracle.js +11 -17
- package/dist/esm/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/src/gasPriceOracle/types.d.ts +1 -6
- package/dist/esm/src/gasPriceOracle/types.js +0 -4
- package/dist/esm/src/gasPriceOracle/types.js.map +1 -1
- package/dist/esm/src/priceClient/adapters/baseAdapter.d.ts +2 -1
- package/dist/esm/src/priceClient/adapters/baseAdapter.js +5 -10
- package/dist/esm/src/priceClient/adapters/baseAdapter.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/factory.d.ts +152 -81
- package/dist/esm/src/relayFeeCalculator/chain-queries/factory.js +1 -6
- package/dist/esm/src/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/index.d.ts +0 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/index.js +0 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/relayFeeCalculator.d.ts +150 -77
- package/dist/esm/src/utils/AddressUtils.d.ts +0 -11
- package/dist/esm/src/utils/AddressUtils.js +1 -59
- package/dist/esm/src/utils/AddressUtils.js.map +1 -1
- package/dist/esm/src/utils/CCTPUtils.js +12 -15
- package/dist/esm/src/utils/CCTPUtils.js.map +1 -1
- package/dist/esm/src/utils/FetchUtils.d.ts +5 -0
- package/dist/esm/src/utils/FetchUtils.js +66 -0
- package/dist/esm/src/utils/FetchUtils.js.map +1 -0
- package/dist/esm/src/utils/IPFSUtils.js +2 -20
- package/dist/esm/src/utils/IPFSUtils.js.map +1 -1
- package/dist/esm/src/utils/Multicall.js +0 -1
- package/dist/esm/src/utils/Multicall.js.map +1 -1
- package/dist/esm/src/utils/NetworkUtils.d.ts +0 -6
- package/dist/esm/src/utils/NetworkUtils.js +3 -13
- package/dist/esm/src/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/src/utils/TokenUtils.d.ts +300 -154
- package/dist/esm/src/utils/TypeGuards.d.ts +1 -3
- package/dist/esm/src/utils/TypeGuards.js +0 -4
- package/dist/esm/src/utils/TypeGuards.js.map +1 -1
- package/dist/esm/src/utils/abi/typechain/factories/index.d.ts +0 -1
- package/dist/esm/src/utils/abi/typechain/factories/index.js +0 -1
- package/dist/esm/src/utils/abi/typechain/factories/index.js.map +1 -1
- package/dist/esm/src/utils/abi/typechain/index.d.ts +0 -2
- package/dist/esm/src/utils/abi/typechain/index.js +0 -1
- package/dist/esm/src/utils/abi/typechain/index.js.map +1 -1
- package/dist/esm/src/utils/index.d.ts +1 -0
- package/dist/esm/src/utils/index.js +1 -0
- package/dist/esm/src/utils/index.js.map +1 -1
- package/dist/types/src/addressAggregator/adapters/abstract.d.ts.map +1 -1
- package/dist/types/src/apiClient/productionClient.d.ts.map +1 -1
- package/dist/types/src/arch/evm/index.d.ts +0 -1
- package/dist/types/src/arch/evm/index.d.ts.map +1 -1
- package/dist/types/src/arch/index.d.ts +0 -1
- package/dist/types/src/arch/index.d.ts.map +1 -1
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts.map +1 -1
- package/dist/types/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +2 -20
- package/dist/types/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/src/clients/SpokePoolClient/index.d.ts +0 -8
- package/dist/types/src/clients/SpokePoolClient/index.d.ts.map +1 -1
- package/dist/types/src/clients/SpokePoolClient/types.d.ts +0 -1
- package/dist/types/src/clients/SpokePoolClient/types.d.ts.map +1 -1
- package/dist/types/src/clients/index.d.ts +1 -1
- package/dist/types/src/clients/index.d.ts.map +1 -1
- package/dist/types/src/coingecko/Coingecko.d.ts.map +1 -1
- package/dist/types/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/types/src/gasPriceOracle/index.d.ts.map +1 -1
- package/dist/types/src/gasPriceOracle/oracle.d.ts +1 -3
- package/dist/types/src/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/src/gasPriceOracle/types.d.ts +1 -6
- package/dist/types/src/gasPriceOracle/types.d.ts.map +1 -1
- package/dist/types/src/priceClient/adapters/baseAdapter.d.ts +2 -1
- package/dist/types/src/priceClient/adapters/baseAdapter.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/factory.d.ts +152 -81
- package/dist/types/src/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/index.d.ts +0 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/index.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/relayFeeCalculator.d.ts +150 -77
- package/dist/types/src/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/src/utils/AddressUtils.d.ts +0 -11
- package/dist/types/src/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/src/utils/CCTPUtils.d.ts.map +1 -1
- package/dist/types/src/utils/FetchUtils.d.ts +6 -0
- package/dist/types/src/utils/FetchUtils.d.ts.map +1 -0
- package/dist/types/src/utils/IPFSUtils.d.ts.map +1 -1
- package/dist/types/src/utils/Multicall.d.ts.map +1 -1
- package/dist/types/src/utils/NetworkUtils.d.ts +0 -6
- package/dist/types/src/utils/NetworkUtils.d.ts.map +1 -1
- package/dist/types/src/utils/TokenUtils.d.ts +300 -154
- package/dist/types/src/utils/TokenUtils.d.ts.map +1 -1
- package/dist/types/src/utils/TypeGuards.d.ts +1 -3
- package/dist/types/src/utils/TypeGuards.d.ts.map +1 -1
- package/dist/types/src/utils/abi/typechain/factories/index.d.ts +0 -1
- package/dist/types/src/utils/abi/typechain/factories/index.d.ts.map +1 -1
- package/dist/types/src/utils/abi/typechain/index.d.ts +0 -2
- package/dist/types/src/utils/abi/typechain/index.d.ts.map +1 -1
- package/dist/types/src/utils/index.d.ts +1 -0
- package/dist/types/src/utils/index.d.ts.map +1 -1
- package/package.json +3 -5
- package/src/addressAggregator/adapters/abstract.ts +3 -9
- package/src/apiClient/productionClient.ts +28 -18
- package/src/arch/evm/index.ts +0 -1
- package/src/arch/index.ts +0 -1
- package/src/caching/Arweave/ArweaveClient.ts +3 -4
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +18 -44
- package/src/clients/SpokePoolClient/index.ts +1 -12
- package/src/clients/SpokePoolClient/types.ts +0 -1
- package/src/clients/index.ts +0 -2
- package/src/coingecko/Coingecko.ts +10 -26
- package/src/gasPriceOracle/index.ts +1 -1
- package/src/gasPriceOracle/oracle.ts +3 -23
- package/src/gasPriceOracle/types.ts +1 -11
- package/src/priceClient/adapters/baseAdapter.ts +9 -9
- package/src/relayFeeCalculator/chain-queries/factory.ts +3 -18
- package/src/relayFeeCalculator/chain-queries/index.ts +0 -1
- package/src/utils/AddressUtils.ts +1 -61
- package/src/utils/CCTPUtils.ts +7 -9
- package/src/utils/FetchUtils.ts +66 -0
- package/src/utils/IPFSUtils.ts +9 -12
- package/src/utils/Multicall.ts +0 -1
- package/src/utils/NetworkUtils.ts +3 -13
- package/src/utils/TypeGuards.ts +1 -6
- package/src/utils/abi/typechain/factories/index.ts +0 -1
- package/src/utils/abi/typechain/index.ts +0 -2
- package/src/utils/index.ts +1 -0
- package/dist/cjs/src/arch/evm/UpgradeUtils.d.ts +0 -2
- package/dist/cjs/src/arch/evm/UpgradeUtils.js +0 -33
- package/dist/cjs/src/arch/evm/UpgradeUtils.js.map +0 -1
- package/dist/cjs/src/arch/tvm/BlockUtils.d.ts +0 -1
- package/dist/cjs/src/arch/tvm/BlockUtils.js +0 -7
- package/dist/cjs/src/arch/tvm/BlockUtils.js.map +0 -1
- package/dist/cjs/src/arch/tvm/MessageUtils.d.ts +0 -1
- package/dist/cjs/src/arch/tvm/MessageUtils.js +0 -5
- package/dist/cjs/src/arch/tvm/MessageUtils.js.map +0 -1
- package/dist/cjs/src/arch/tvm/ResourceUtils.d.ts +0 -14
- package/dist/cjs/src/arch/tvm/ResourceUtils.js +0 -69
- package/dist/cjs/src/arch/tvm/ResourceUtils.js.map +0 -1
- package/dist/cjs/src/arch/tvm/SpokeUtils.d.ts +0 -12
- package/dist/cjs/src/arch/tvm/SpokeUtils.js +0 -207
- package/dist/cjs/src/arch/tvm/SpokeUtils.js.map +0 -1
- package/dist/cjs/src/arch/tvm/TransactionUtils.d.ts +0 -7
- package/dist/cjs/src/arch/tvm/TransactionUtils.js +0 -43
- package/dist/cjs/src/arch/tvm/TransactionUtils.js.map +0 -1
- package/dist/cjs/src/arch/tvm/index.d.ts +0 -6
- package/dist/cjs/src/arch/tvm/index.js +0 -10
- package/dist/cjs/src/arch/tvm/index.js.map +0 -1
- package/dist/cjs/src/arch/tvm/types.d.ts +0 -2
- package/dist/cjs/src/arch/tvm/types.js +0 -3
- package/dist/cjs/src/arch/tvm/types.js.map +0 -1
- package/dist/cjs/src/arch/tvm/utils/address.d.ts +0 -3
- package/dist/cjs/src/arch/tvm/utils/address.js +0 -17
- package/dist/cjs/src/arch/tvm/utils/address.js.map +0 -1
- package/dist/cjs/src/arch/tvm/utils/index.d.ts +0 -2
- package/dist/cjs/src/arch/tvm/utils/index.js +0 -6
- package/dist/cjs/src/arch/tvm/utils/index.js.map +0 -1
- package/dist/cjs/src/arch/tvm/utils/wait.d.ts +0 -1
- package/dist/cjs/src/arch/tvm/utils/wait.js +0 -5
- package/dist/cjs/src/arch/tvm/utils/wait.js.map +0 -1
- package/dist/cjs/src/clients/SpokePoolClient/TVMSpokePoolClient.d.ts +0 -11
- package/dist/cjs/src/clients/SpokePoolClient/TVMSpokePoolClient.js +0 -47
- package/dist/cjs/src/clients/SpokePoolClient/TVMSpokePoolClient.js.map +0 -1
- package/dist/cjs/src/gasPriceOracle/adapters/tron.d.ts +0 -4
- package/dist/cjs/src/gasPriceOracle/adapters/tron.js +0 -58
- package/dist/cjs/src/gasPriceOracle/adapters/tron.js.map +0 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/tvmQuery.d.ts +0 -16
- package/dist/cjs/src/relayFeeCalculator/chain-queries/tvmQuery.js +0 -52
- package/dist/cjs/src/relayFeeCalculator/chain-queries/tvmQuery.js.map +0 -1
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.d.ts +0 -42
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.js +0 -3
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.js.map +0 -1
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +0 -26
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js +0 -43
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js.map +0 -1
- package/dist/esm/src/arch/evm/UpgradeUtils.d.ts +0 -9
- package/dist/esm/src/arch/evm/UpgradeUtils.js +0 -37
- package/dist/esm/src/arch/evm/UpgradeUtils.js.map +0 -1
- package/dist/esm/src/arch/tvm/BlockUtils.d.ts +0 -1
- package/dist/esm/src/arch/tvm/BlockUtils.js +0 -2
- package/dist/esm/src/arch/tvm/BlockUtils.js.map +0 -1
- package/dist/esm/src/arch/tvm/MessageUtils.d.ts +0 -1
- package/dist/esm/src/arch/tvm/MessageUtils.js +0 -2
- package/dist/esm/src/arch/tvm/MessageUtils.js.map +0 -1
- package/dist/esm/src/arch/tvm/ResourceUtils.d.ts +0 -32
- package/dist/esm/src/arch/tvm/ResourceUtils.js +0 -88
- package/dist/esm/src/arch/tvm/ResourceUtils.js.map +0 -1
- package/dist/esm/src/arch/tvm/SpokeUtils.d.ts +0 -48
- package/dist/esm/src/arch/tvm/SpokeUtils.js +0 -237
- package/dist/esm/src/arch/tvm/SpokeUtils.js.map +0 -1
- package/dist/esm/src/arch/tvm/TransactionUtils.d.ts +0 -20
- package/dist/esm/src/arch/tvm/TransactionUtils.js +0 -55
- package/dist/esm/src/arch/tvm/TransactionUtils.js.map +0 -1
- package/dist/esm/src/arch/tvm/index.d.ts +0 -6
- package/dist/esm/src/arch/tvm/index.js +0 -7
- package/dist/esm/src/arch/tvm/index.js.map +0 -1
- package/dist/esm/src/arch/tvm/types.d.ts +0 -2
- package/dist/esm/src/arch/tvm/types.js +0 -2
- package/dist/esm/src/arch/tvm/types.js.map +0 -1
- package/dist/esm/src/arch/tvm/utils/address.d.ts +0 -18
- package/dist/esm/src/arch/tvm/utils/address.js +0 -31
- package/dist/esm/src/arch/tvm/utils/address.js.map +0 -1
- package/dist/esm/src/arch/tvm/utils/index.d.ts +0 -2
- package/dist/esm/src/arch/tvm/utils/index.js +0 -3
- package/dist/esm/src/arch/tvm/utils/index.js.map +0 -1
- package/dist/esm/src/arch/tvm/utils/wait.d.ts +0 -1
- package/dist/esm/src/arch/tvm/utils/wait.js +0 -2
- package/dist/esm/src/arch/tvm/utils/wait.js.map +0 -1
- package/dist/esm/src/clients/SpokePoolClient/TVMSpokePoolClient.d.ts +0 -32
- package/dist/esm/src/clients/SpokePoolClient/TVMSpokePoolClient.js +0 -66
- package/dist/esm/src/clients/SpokePoolClient/TVMSpokePoolClient.js.map +0 -1
- package/dist/esm/src/gasPriceOracle/adapters/tron.d.ts +0 -10
- package/dist/esm/src/gasPriceOracle/adapters/tron.js +0 -68
- package/dist/esm/src/gasPriceOracle/adapters/tron.js.map +0 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/tvmQuery.d.ts +0 -32
- package/dist/esm/src/relayFeeCalculator/chain-queries/tvmQuery.js +0 -65
- package/dist/esm/src/relayFeeCalculator/chain-queries/tvmQuery.js.map +0 -1
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.d.ts +0 -42
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.js +0 -2
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.js.map +0 -1
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +0 -26
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js +0 -43
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js.map +0 -1
- package/dist/types/src/arch/evm/UpgradeUtils.d.ts +0 -10
- package/dist/types/src/arch/evm/UpgradeUtils.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/BlockUtils.d.ts +0 -2
- package/dist/types/src/arch/tvm/BlockUtils.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/MessageUtils.d.ts +0 -2
- package/dist/types/src/arch/tvm/MessageUtils.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/ResourceUtils.d.ts +0 -33
- package/dist/types/src/arch/tvm/ResourceUtils.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/SpokeUtils.d.ts +0 -49
- package/dist/types/src/arch/tvm/SpokeUtils.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/TransactionUtils.d.ts +0 -21
- package/dist/types/src/arch/tvm/TransactionUtils.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/index.d.ts +0 -7
- package/dist/types/src/arch/tvm/index.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/types.d.ts +0 -3
- package/dist/types/src/arch/tvm/types.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/utils/address.d.ts +0 -19
- package/dist/types/src/arch/tvm/utils/address.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/utils/index.d.ts +0 -3
- package/dist/types/src/arch/tvm/utils/index.d.ts.map +0 -1
- package/dist/types/src/arch/tvm/utils/wait.d.ts +0 -2
- package/dist/types/src/arch/tvm/utils/wait.d.ts.map +0 -1
- package/dist/types/src/clients/SpokePoolClient/TVMSpokePoolClient.d.ts +0 -33
- package/dist/types/src/clients/SpokePoolClient/TVMSpokePoolClient.d.ts.map +0 -1
- package/dist/types/src/gasPriceOracle/adapters/tron.d.ts +0 -11
- package/dist/types/src/gasPriceOracle/adapters/tron.d.ts.map +0 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/tvmQuery.d.ts +0 -33
- package/dist/types/src/relayFeeCalculator/chain-queries/tvmQuery.d.ts.map +0 -1
- package/dist/types/src/utils/abi/typechain/SP1AutoVerifier.d.ts +0 -43
- package/dist/types/src/utils/abi/typechain/SP1AutoVerifier.d.ts.map +0 -1
- package/dist/types/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +0 -27
- package/dist/types/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts.map +0 -1
- package/src/arch/evm/UpgradeUtils.ts +0 -18
- package/src/arch/tvm/BlockUtils.ts +0 -1
- package/src/arch/tvm/MessageUtils.ts +0 -1
- package/src/arch/tvm/ResourceUtils.ts +0 -92
- package/src/arch/tvm/SpokeUtils.ts +0 -225
- package/src/arch/tvm/TransactionUtils.ts +0 -62
- package/src/arch/tvm/index.ts +0 -6
- package/src/arch/tvm/types.ts +0 -2
- package/src/arch/tvm/utils/address.ts +0 -33
- package/src/arch/tvm/utils/index.ts +0 -2
- package/src/arch/tvm/utils/wait.ts +0 -1
- package/src/clients/SpokePoolClient/TVMSpokePoolClient.ts +0 -65
- package/src/gasPriceOracle/adapters/tron.ts +0 -50
- package/src/relayFeeCalculator/chain-queries/tvmQuery.ts +0 -88
- package/src/utils/abi/contracts/SP1AutoVerifier.json +0 -25
- package/src/utils/abi/typechain/SP1AutoVerifier.ts +0 -112
- package/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.ts +0 -49
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import axios, { AxiosError } from "axios";
|
|
2
1
|
import assert from "assert";
|
|
3
|
-
import
|
|
4
|
-
import { getCoingeckoTokenIdByAddress, retry } from "../utils";
|
|
2
|
+
import { fetchWithTimeout, getCoingeckoTokenIdByAddress, retry } from "../utils";
|
|
5
3
|
import { Logger } from "../relayFeeCalculator";
|
|
6
4
|
|
|
7
5
|
export function msToS(ms: number) {
|
|
@@ -386,19 +384,19 @@ export class Coingecko {
|
|
|
386
384
|
|
|
387
385
|
// If no pro api key, only send basic request:
|
|
388
386
|
if (this.apiKey === undefined) {
|
|
389
|
-
return
|
|
387
|
+
return await this._callBasic<T>(path);
|
|
390
388
|
}
|
|
391
389
|
|
|
392
390
|
// If pro api key, try basic and use pro as fallback.
|
|
393
391
|
try {
|
|
394
|
-
return
|
|
392
|
+
return await this._callBasic<T>(path, this.basicApiTimeout);
|
|
395
393
|
} catch (err) {
|
|
396
394
|
this.logger.debug({
|
|
397
395
|
at: "sdk/coingecko",
|
|
398
396
|
message: `Basic CG url request failed, falling back to CG PRO host ${proHost}`,
|
|
399
|
-
errMessage: (err as
|
|
397
|
+
errMessage: (err as Error).message,
|
|
400
398
|
});
|
|
401
|
-
return await this._callPro(path);
|
|
399
|
+
return await this._callPro<T>(path);
|
|
402
400
|
}
|
|
403
401
|
};
|
|
404
402
|
|
|
@@ -502,29 +500,15 @@ export class Coingecko {
|
|
|
502
500
|
}
|
|
503
501
|
}
|
|
504
502
|
|
|
505
|
-
private async _callBasic(path: string, timeout?: number) {
|
|
503
|
+
private async _callBasic<T>(path: string, timeout?: number): Promise<T> {
|
|
506
504
|
const url = `${this.host}/${path}`;
|
|
507
505
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
const result = await axios(url, { timeout });
|
|
511
|
-
return result.data;
|
|
512
|
-
} catch (err) {
|
|
513
|
-
const msg = get(err, "response.data.error", get(err, "response.statusText", (err as AxiosError).message));
|
|
514
|
-
throw new Error(msg);
|
|
515
|
-
}
|
|
506
|
+
// Don't use timeout if there is no pro API to fallback to.
|
|
507
|
+
return await fetchWithTimeout<T>(url, {}, {}, timeout);
|
|
516
508
|
}
|
|
517
509
|
|
|
518
|
-
private async _callPro(path: string) {
|
|
510
|
+
private async _callPro<T>(path: string): Promise<T> {
|
|
519
511
|
const url = `${this.proHost}/${path}`;
|
|
520
|
-
|
|
521
|
-
try {
|
|
522
|
-
// Don't use timeout if there is no pro API to fallback to.
|
|
523
|
-
const result = await axios(url, { params: { x_cg_pro_api_key: this.apiKey } });
|
|
524
|
-
return result.data;
|
|
525
|
-
} catch (err) {
|
|
526
|
-
const msg = get(err, "response.data.error", get(err, "response.statusText", (err as AxiosError).message));
|
|
527
|
-
throw new Error(msg);
|
|
528
|
-
}
|
|
512
|
+
return await fetchWithTimeout<T>(url, { x_cg_pro_api_key: this.apiKey });
|
|
529
513
|
}
|
|
530
514
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { getGasPriceEstimate, GasPriceEstimateOptions } from "./oracle";
|
|
2
|
-
export { GasPriceEstimate, EvmGasPriceEstimate, SvmGasPriceEstimate
|
|
2
|
+
export { GasPriceEstimate, EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
@@ -2,17 +2,15 @@ import assert from "assert";
|
|
|
2
2
|
import { Transport } from "viem";
|
|
3
3
|
import { providers } from "ethers";
|
|
4
4
|
import { CHAIN_IDs } from "../constants";
|
|
5
|
-
import { BigNumber, fixedPointAdjustment, isEvmProvider,
|
|
5
|
+
import { BigNumber, fixedPointAdjustment, isEvmProvider, toBNWei, isDefined } from "../utils";
|
|
6
6
|
import { SVMProvider as SolanaProvider } from "../arch/svm";
|
|
7
|
-
import {
|
|
8
|
-
import { EvmGasPriceEstimate, GasPriceEstimate, SvmGasPriceEstimate, TvmGasPriceEstimate } from "./types";
|
|
7
|
+
import { EvmGasPriceEstimate, GasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
9
8
|
import { getPublicClient } from "./util";
|
|
10
9
|
import * as arbitrum from "./adapters/arbitrum";
|
|
11
10
|
import * as ethereum from "./adapters/ethereum";
|
|
12
11
|
import * as polygon from "./adapters/polygon";
|
|
13
12
|
import * as lineaViem from "./adapters/linea-viem";
|
|
14
13
|
import * as solana from "./adapters/solana";
|
|
15
|
-
import * as tron from "./adapters/tron";
|
|
16
14
|
import { EvmProvider } from "../arch/evm/types";
|
|
17
15
|
|
|
18
16
|
export interface GasPriceEstimateOptions {
|
|
@@ -58,12 +56,6 @@ export async function getGasPriceEstimate(
|
|
|
58
56
|
opts?: Partial<GasPriceEstimateOptions>
|
|
59
57
|
): Promise<SvmGasPriceEstimate>;
|
|
60
58
|
|
|
61
|
-
// Overload For TVM providers
|
|
62
|
-
export async function getGasPriceEstimate(
|
|
63
|
-
provider: TronWeb,
|
|
64
|
-
opts?: Partial<GasPriceEstimateOptions>
|
|
65
|
-
): Promise<TvmGasPriceEstimate>;
|
|
66
|
-
|
|
67
59
|
/**
|
|
68
60
|
* Provide an estimate for the current gas price for a particular chain.
|
|
69
61
|
* @param provider A valid ethers provider.
|
|
@@ -71,24 +63,12 @@ export async function getGasPriceEstimate(
|
|
|
71
63
|
* @returns An object of type GasPriceEstimate.
|
|
72
64
|
*/
|
|
73
65
|
export async function getGasPriceEstimate(
|
|
74
|
-
provider: EvmProvider | SolanaProvider
|
|
66
|
+
provider: EvmProvider | SolanaProvider,
|
|
75
67
|
opts: Partial<GasPriceEstimateOptions> = {}
|
|
76
68
|
): Promise<GasPriceEstimate> {
|
|
77
69
|
const baseFeeMultiplier = opts.baseFeeMultiplier ?? toBNWei("1");
|
|
78
70
|
const priorityFeeMultiplier = opts.priorityFeeMultiplier ?? toBNWei("1");
|
|
79
71
|
|
|
80
|
-
// Exit here if we need to estimate on TRON.
|
|
81
|
-
if (isTvmProvider(provider)) {
|
|
82
|
-
const optsWithDefaults: GasPriceEstimateOptions = {
|
|
83
|
-
...GAS_PRICE_ESTIMATE_DEFAULTS,
|
|
84
|
-
baseFeeMultiplier,
|
|
85
|
-
priorityFeeMultiplier,
|
|
86
|
-
...opts,
|
|
87
|
-
chainId: opts.chainId ?? CHAIN_IDs.TRON,
|
|
88
|
-
};
|
|
89
|
-
return tron.gasPrices(provider, optsWithDefaults);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
72
|
// Exit here if we need to estimate on Solana.
|
|
93
73
|
if (!isEvmProvider(provider)) {
|
|
94
74
|
const optsWithDefaults: GasPriceEstimateOptions = {
|
|
@@ -2,7 +2,7 @@ import { type Chain, type Transport, PublicClient, FeeValuesEIP1559 } from "viem
|
|
|
2
2
|
import { BigNumber, bnZero, isDefined } from "../utils";
|
|
3
3
|
|
|
4
4
|
export type InternalGasPriceEstimate = FeeValuesEIP1559;
|
|
5
|
-
export type GasPriceEstimate = EvmGasPriceEstimate | SvmGasPriceEstimate
|
|
5
|
+
export type GasPriceEstimate = EvmGasPriceEstimate | SvmGasPriceEstimate;
|
|
6
6
|
|
|
7
7
|
export type EvmGasPriceEstimate = {
|
|
8
8
|
maxFeePerGas: BigNumber;
|
|
@@ -14,11 +14,6 @@ export type SvmGasPriceEstimate = {
|
|
|
14
14
|
microLamportsPerComputeUnit: BigNumber;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type TvmGasPriceEstimate = {
|
|
18
|
-
energyPrice: BigNumber;
|
|
19
|
-
bandwidthPrice: BigNumber;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
17
|
export interface GasPriceFeed {
|
|
23
18
|
(provider: PublicClient<Transport, Chain>, chainId: number): Promise<InternalGasPriceEstimate>;
|
|
24
19
|
}
|
|
@@ -40,8 +35,3 @@ export function isSVMGasPrice(gasPrice: GasPriceEstimate): gasPrice is SvmGasPri
|
|
|
40
35
|
const { baseFee, microLamportsPerComputeUnit } = gasPrice as SvmGasPriceEstimate;
|
|
41
36
|
return isDefined(baseFee) && isDefined(microLamportsPerComputeUnit);
|
|
42
37
|
}
|
|
43
|
-
|
|
44
|
-
export function isTVMGasPrice(gasPrice: GasPriceEstimate): gasPrice is TvmGasPriceEstimate {
|
|
45
|
-
const { energyPrice, bandwidthPrice } = gasPrice as TvmGasPriceEstimate;
|
|
46
|
-
return isDefined(energyPrice) && isDefined(bandwidthPrice);
|
|
47
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { fetchWithTimeout, FetchQueryParams } from "../../utils";
|
|
1
2
|
import assert from "assert";
|
|
2
|
-
import axios from "axios";
|
|
3
3
|
|
|
4
4
|
export type BaseHTTPAdapterArgs = {
|
|
5
5
|
timeout?: number;
|
|
@@ -37,21 +37,21 @@ export class BaseHTTPAdapter {
|
|
|
37
37
|
this.timeout = timeout; // ms
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
protected async query(path: string, urlArgs?:
|
|
40
|
+
protected async query(path: string, urlArgs?: FetchQueryParams): Promise<unknown> {
|
|
41
41
|
const url = `https://${this.host}/${path ?? ""}`;
|
|
42
|
-
const args = {
|
|
43
|
-
headers: { "User-Agent": process.env.ACROSS_USER_AGENT ?? "across-protocol" },
|
|
44
|
-
timeout: this.timeout,
|
|
45
|
-
params: urlArgs ?? {},
|
|
46
|
-
};
|
|
47
42
|
|
|
48
43
|
const errs: string[] = [];
|
|
49
44
|
let tries = 0;
|
|
50
45
|
do {
|
|
51
46
|
try {
|
|
52
|
-
return
|
|
47
|
+
return await fetchWithTimeout<unknown>(
|
|
48
|
+
url,
|
|
49
|
+
urlArgs ?? {},
|
|
50
|
+
{ "User-Agent": process.env.ACROSS_USER_AGENT ?? "across-protocol" },
|
|
51
|
+
this.timeout
|
|
52
|
+
);
|
|
53
53
|
} catch (err) {
|
|
54
|
-
const errMsg =
|
|
54
|
+
const errMsg = err instanceof Error ? err.message : "unknown error";
|
|
55
55
|
errs.push(errMsg);
|
|
56
56
|
if (++tries <= this.retries) await this.sleep(Math.pow(1.5, tries) * 1000); // simple backoff
|
|
57
57
|
}
|
|
@@ -3,15 +3,13 @@ import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
|
|
|
3
3
|
import { getDeployedAddress } from "@across-protocol/contracts";
|
|
4
4
|
import { asL2Provider } from "@eth-optimism/sdk";
|
|
5
5
|
import { providers } from "ethers";
|
|
6
|
-
import { TronWeb } from "tronweb";
|
|
7
6
|
import { CUSTOM_GAS_TOKENS } from "../../constants";
|
|
8
|
-
import { chainIsEvm, chainIsOPStack, isDefined, chainIsSvm,
|
|
7
|
+
import { chainIsEvm, chainIsOPStack, isDefined, chainIsSvm, SvmAddress } from "../../utils";
|
|
9
8
|
import { QueryBase } from "./baseQuery";
|
|
10
9
|
import { SVMProvider as svmProvider } from "../../arch/svm";
|
|
11
10
|
import { DEFAULT_LOGGER, getDefaultRelayer, Logger } from "../relayFeeCalculator";
|
|
12
11
|
import { CustomGasTokenQueries } from "./customGasToken";
|
|
13
12
|
import { SvmQuery } from "./svmQuery";
|
|
14
|
-
import { TvmQuery } from "./tvmQuery";
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* Some chains have a fixed gas price that is applied to the gas estimates. We should override
|
|
@@ -24,14 +22,14 @@ const fixedGasPrice = {
|
|
|
24
22
|
export class QueryBase__factory {
|
|
25
23
|
static create(
|
|
26
24
|
chainId: number,
|
|
27
|
-
provider: providers.Provider | svmProvider
|
|
25
|
+
provider: providers.Provider | svmProvider,
|
|
28
26
|
symbolMapping = TOKEN_SYMBOLS_MAP,
|
|
29
27
|
spokePoolAddress = getDeployedAddress("SpokePool", chainId),
|
|
30
28
|
relayerAddress = getDefaultRelayer(chainId),
|
|
31
29
|
coingeckoProApiKey?: string,
|
|
32
30
|
logger: Logger = DEFAULT_LOGGER,
|
|
33
31
|
coingeckoBaseCurrency = "eth"
|
|
34
|
-
): QueryBase | SvmQuery
|
|
32
|
+
): QueryBase | SvmQuery {
|
|
35
33
|
assert(isDefined(spokePoolAddress));
|
|
36
34
|
|
|
37
35
|
const customGasTokenSymbol = CUSTOM_GAS_TOKENS[chainId];
|
|
@@ -64,19 +62,6 @@ export class QueryBase__factory {
|
|
|
64
62
|
coingeckoBaseCurrency
|
|
65
63
|
);
|
|
66
64
|
}
|
|
67
|
-
if (chainIsTvm(chainId)) {
|
|
68
|
-
assert(relayerAddress.isEVM());
|
|
69
|
-
return new TvmQuery(
|
|
70
|
-
provider as TronWeb,
|
|
71
|
-
symbolMapping,
|
|
72
|
-
spokePoolAddress,
|
|
73
|
-
relayerAddress,
|
|
74
|
-
logger,
|
|
75
|
-
coingeckoProApiKey,
|
|
76
|
-
fixedGasPrice[chainId],
|
|
77
|
-
coingeckoBaseCurrency
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
65
|
|
|
81
66
|
// For OPStack chains, we need to wrap the provider in an L2Provider
|
|
82
67
|
provider = chainIsOPStack(chainId)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { isAddress } from "viem";
|
|
2
2
|
import { providers, utils } from "ethers";
|
|
3
3
|
import bs58 from "bs58";
|
|
4
|
-
import {
|
|
5
|
-
import { BigNumber, chainIsEvm, chainIsSvm, chainIsTvm } from "./";
|
|
4
|
+
import { BigNumber, chainIsEvm, chainIsSvm } from "./";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Verify whether an address' bytecode resembles an EIP-7702 delegation.
|
|
@@ -108,7 +107,6 @@ export function toAddressType(address: string, chainId: number): Address {
|
|
|
108
107
|
|
|
109
108
|
if (chainIsEvm(chainId) && EvmAddress.validate(rawAddress)) return new EvmAddress(rawAddress);
|
|
110
109
|
else if (chainIsSvm(chainId) && SvmAddress.validate(rawAddress)) return new SvmAddress(rawAddress);
|
|
111
|
-
else if (chainIsTvm(chainId)) return TvmAddress.from(address);
|
|
112
110
|
|
|
113
111
|
return new RawAddress(rawAddress);
|
|
114
112
|
}
|
|
@@ -189,7 +187,6 @@ export abstract class Address {
|
|
|
189
187
|
isValidOn(chainId: number): boolean {
|
|
190
188
|
if (chainIsEvm(chainId)) return EvmAddress.validate(this.rawAddress);
|
|
191
189
|
if (chainIsSvm(chainId)) return SvmAddress.validate(this.rawAddress);
|
|
192
|
-
if (chainIsTvm(chainId)) return TvmAddress.validate(this.rawAddress);
|
|
193
190
|
return false;
|
|
194
191
|
}
|
|
195
192
|
|
|
@@ -230,10 +227,6 @@ export abstract class Address {
|
|
|
230
227
|
isSVM(): this is SvmAddress {
|
|
231
228
|
return false;
|
|
232
229
|
}
|
|
233
|
-
|
|
234
|
-
isTVM(): this is TvmAddress {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
230
|
}
|
|
238
231
|
|
|
239
232
|
// Subclass of address which strictly deals with 20-byte addresses. These addresses are guaranteed to be valid EVM addresses, so `toAddress` will always succeed.
|
|
@@ -311,59 +304,6 @@ export class SvmAddress extends Address {
|
|
|
311
304
|
}
|
|
312
305
|
}
|
|
313
306
|
|
|
314
|
-
// Subclass of address which handles TRON (TVM) addresses. Internally stores a 20-byte address (same as EVM),
|
|
315
|
-
// but toNative() returns the TRON Base58Check-encoded address (T...).
|
|
316
|
-
export class TvmAddress extends Address {
|
|
317
|
-
private readonly _type = "tvm";
|
|
318
|
-
private nativeAddress: string | undefined = undefined;
|
|
319
|
-
|
|
320
|
-
constructor(rawAddress: Uint8Array) {
|
|
321
|
-
if (!TvmAddress.validate(rawAddress)) {
|
|
322
|
-
throw new Error(`${utils.hexlify(rawAddress)} is not a valid TVM address`);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
super(rawAddress);
|
|
326
|
-
this._type; // tsc noUnusedLocals appeasement.
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
static validate(rawAddress: Uint8Array): boolean {
|
|
330
|
-
return (
|
|
331
|
-
rawAddress.length == 20 || (rawAddress.length === 32 && rawAddress.slice(0, 12).every((field) => field === 0))
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
override isTVM(): this is TvmAddress {
|
|
336
|
-
return true;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Returns the TRON Base58Check-encoded address (T...).
|
|
340
|
-
override toNative(): string {
|
|
341
|
-
const computeNative = () => {
|
|
342
|
-
const hexString = utils.hexlify(this.rawAddress);
|
|
343
|
-
// Strip leading zeros to get the 20-byte portion, then convert to TRON format.
|
|
344
|
-
const evmHex = utils.hexZeroPad(utils.hexStripZeros(hexString), 20);
|
|
345
|
-
return TronWeb.address.fromHex(evmHex);
|
|
346
|
-
};
|
|
347
|
-
return (this.nativeAddress ??= computeNative());
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
override toHexString(): string {
|
|
351
|
-
return this.toEvmAddress();
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// Constructs a new TvmAddress from a string. Accepts both 0x-prefixed hex and TRON Base58Check addresses.
|
|
355
|
-
static from(address: string): TvmAddress {
|
|
356
|
-
if (address.startsWith("0x")) {
|
|
357
|
-
return new this(utils.arrayify(address));
|
|
358
|
-
}
|
|
359
|
-
// For base58 Tron addresses, convert via TronWeb to get the hex representation.
|
|
360
|
-
const hex = TronWeb.address.toHex(address);
|
|
361
|
-
// TronWeb returns hex with a 0x41 prefix (TRON's address byte). Strip 0x41 to get 20 bytes.
|
|
362
|
-
const rawHex = "0x" + hex.slice(2);
|
|
363
|
-
return new this(utils.arrayify(rawHex));
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
307
|
export class RawAddress extends Address {
|
|
368
308
|
private readonly _type = "raw";
|
|
369
309
|
|
package/src/utils/CCTPUtils.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PUBLIC_NETWORKS, CCTP_NO_DOMAIN, PRODUCTION_NETWORKS, TEST_NETWORKS } from "@across-protocol/constants";
|
|
2
|
+
import { fetchWithTimeout } from "./FetchUtils";
|
|
2
3
|
import { BigNumber, ethers } from "ethers";
|
|
3
4
|
|
|
4
5
|
import { Log } from "@ethersproject/abstract-provider";
|
|
5
6
|
import { isDefined } from "./TypeGuards";
|
|
6
|
-
import axios from "axios";
|
|
7
7
|
import { chainIsProd } from "./NetworkUtils";
|
|
8
8
|
import assert from "assert";
|
|
9
9
|
import { bnZero } from "./BigNumberUtils";
|
|
@@ -236,10 +236,10 @@ export async function hasCCTPMessageBeenProcessedEvm(nonceHash: string, contract
|
|
|
236
236
|
* @link https://developers.circle.com/api-reference/cctp/all/get-fast-burn-usdc-allowance
|
|
237
237
|
*/
|
|
238
238
|
export async function getV2FastBurnAllowance(isMainnet: boolean): Promise<string> {
|
|
239
|
-
const
|
|
239
|
+
const data = await fetchWithTimeout<CCTPV2APIGetFastBurnAllowanceResponse>(
|
|
240
240
|
`https://iris-api${isMainnet ? "" : "-sandbox"}.circle.com/v2/fastBurn/USDC/allowance`
|
|
241
241
|
);
|
|
242
|
-
return
|
|
242
|
+
return data.allowance.toString();
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
/**
|
|
@@ -261,13 +261,13 @@ export async function getV2MinTransferFees(
|
|
|
261
261
|
const endpoint = `https://iris-api${
|
|
262
262
|
isMainnet ? "" : "-sandbox"
|
|
263
263
|
}.circle.com/v2/burn/USDC/fees/${sourceDomain}/${destinationDomain}`;
|
|
264
|
-
const
|
|
265
|
-
const standardFee =
|
|
264
|
+
const data = await fetchWithTimeout<CCTPV2APIGetFeesResponse>(endpoint);
|
|
265
|
+
const standardFee = data.find((fee) => fee.finalityThreshold === CCTPV2_FINALITY_THRESHOLD_STANDARD);
|
|
266
266
|
assert(
|
|
267
267
|
isDefined(standardFee?.minimumFee),
|
|
268
268
|
`CCTPUtils#getTransferFees: Standard fee not found in API response: ${endpoint}`
|
|
269
269
|
);
|
|
270
|
-
const fastFee =
|
|
270
|
+
const fastFee = data.find((fee) => fee.finalityThreshold === CCTPV2_FINALITY_THRESHOLD_FAST);
|
|
271
271
|
assert(isDefined(fastFee?.minimumFee), `CCTPUtils#getTransferFees: Fast fee not found in API response: ${endpoint}`);
|
|
272
272
|
return {
|
|
273
273
|
standard: BigNumber.from(standardFee.minimumFee),
|
|
@@ -288,13 +288,11 @@ export async function fetchAttestationsForTxn(
|
|
|
288
288
|
transactionHash: string,
|
|
289
289
|
isMainnet: boolean
|
|
290
290
|
): Promise<CCTPV2APIGetAttestationResponse> {
|
|
291
|
-
|
|
291
|
+
return await fetchWithTimeout<CCTPV2APIGetAttestationResponse>(
|
|
292
292
|
`https://iris-api${
|
|
293
293
|
isMainnet ? "" : "-sandbox"
|
|
294
294
|
}.circle.com/v2/messages/${sourceDomainId}?transactionHash=${transactionHash}`
|
|
295
295
|
);
|
|
296
|
-
|
|
297
|
-
return httpResponse.data;
|
|
298
296
|
}
|
|
299
297
|
|
|
300
298
|
/**
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type FetchHeaders = { [key: string]: unknown };
|
|
2
|
+
export type FetchQueryParams = Record<string, unknown>;
|
|
3
|
+
|
|
4
|
+
const toStringRecord = (headers: FetchHeaders): Record<string, string> => {
|
|
5
|
+
const normalizedHeaders: Record<string, string> = {};
|
|
6
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
7
|
+
if (value !== undefined && value !== null) {
|
|
8
|
+
normalizedHeaders[key] = String(value);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return normalizedHeaders;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const applyQueryParams = (url: string, params: FetchQueryParams): string => {
|
|
15
|
+
if (Object.keys(params).length === 0) return url;
|
|
16
|
+
|
|
17
|
+
const parsedUrl = new URL(url);
|
|
18
|
+
for (const [key, value] of Object.entries(params)) {
|
|
19
|
+
if (value !== undefined && value !== null) {
|
|
20
|
+
parsedUrl.searchParams.append(key, String(value));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return parsedUrl.toString();
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export async function fetchWithTimeout<T = unknown>(
|
|
28
|
+
url: string,
|
|
29
|
+
params: FetchQueryParams = {},
|
|
30
|
+
headers: FetchHeaders = {},
|
|
31
|
+
timeout?: number,
|
|
32
|
+
responseType: "json" | "text" = "json"
|
|
33
|
+
): Promise<T> {
|
|
34
|
+
const fullUrl = applyQueryParams(url, params);
|
|
35
|
+
const response = await fetch(fullUrl, {
|
|
36
|
+
headers: toStringRecord(headers),
|
|
37
|
+
...(timeout && timeout > 0 && { signal: AbortSignal.timeout(timeout) }),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Read body as text first — body can only be consumed once, and we need
|
|
41
|
+
// the raw text for meaningful error messages if JSON parsing fails.
|
|
42
|
+
const text = await response.text();
|
|
43
|
+
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
let errorMessage: string | undefined;
|
|
46
|
+
try {
|
|
47
|
+
errorMessage = (JSON.parse(text) as { error?: string })?.error;
|
|
48
|
+
} catch {
|
|
49
|
+
// Response body wasn't JSON — fall through to default message.
|
|
50
|
+
}
|
|
51
|
+
throw new Error(errorMessage ?? `HTTP ${response.status}: ${response.statusText}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (responseType === "text") {
|
|
55
|
+
return text as T;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
return JSON.parse(text) as T;
|
|
60
|
+
} catch {
|
|
61
|
+
const contentType = response.headers.get("content-type") ?? "unknown";
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Expected JSON response from ${fullUrl} but received content-type: ${contentType} (body: ${text.slice(0, 256)})`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
package/src/utils/IPFSUtils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PinataClient from "@pinata/sdk";
|
|
2
|
-
import
|
|
2
|
+
import { fetchWithTimeout } from "./FetchUtils";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Build an IPFS client for interacting with the IPFS API
|
|
@@ -18,17 +18,14 @@ export function buildIPFSClient(APIKey: string, secretAPIKey: string): PinataCli
|
|
|
18
18
|
* @returns The value retrieved from the IPFS gateway
|
|
19
19
|
* @throws Error if the value could not be retrieved
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
transformResponse: (r) => r,
|
|
30
|
-
});
|
|
31
|
-
return result.data;
|
|
21
|
+
export function retrieveValueFromIPFS(contentHash: string, publicGatewayURL: string): Promise<string> {
|
|
22
|
+
return fetchWithTimeout<string>(
|
|
23
|
+
`${publicGatewayURL}/ipfs/${contentHash}`,
|
|
24
|
+
{},
|
|
25
|
+
{ Accept: "text/plain" },
|
|
26
|
+
undefined,
|
|
27
|
+
"text"
|
|
28
|
+
);
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
/**
|
package/src/utils/Multicall.ts
CHANGED
|
@@ -21,7 +21,6 @@ const MULTICALL_DEPLOYER = "0x05f32B3cC3888453ff71B01135B34FF8e41263F2";
|
|
|
21
21
|
|
|
22
22
|
const NON_DETERMINISTIC_MULTICALL_ADDRESSES = {
|
|
23
23
|
[CHAIN_IDs.LENS]: "0x6b6dEa4D80e3077D076733A04c48F63c3BA49320",
|
|
24
|
-
[CHAIN_IDs.TRON]: "0x32a4f47a74a6810bd0bf861cabab99656a75de9e", // @todo: Base58?
|
|
25
24
|
[CHAIN_IDs.ZK_SYNC]: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
|
|
26
25
|
[CHAIN_IDs.LENS_SEPOLIA]: "0x8A44EDE8a6843a997bC0Cc4659e4dB1Da8f91116",
|
|
27
26
|
};
|
|
@@ -134,15 +134,6 @@ export function chainIsSvm(chainId: number): boolean {
|
|
|
134
134
|
return PUBLIC_NETWORKS[chainId]?.family === ChainFamily.SVM;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
/**
|
|
138
|
-
* Determines whether a chain ID runs on a TVM-like execution layer (e.g. TRON).
|
|
139
|
-
* @param chainId Chain ID to evaluate.
|
|
140
|
-
* @returns True if chain corresponding to chainId has a TVM-like execution layer.
|
|
141
|
-
*/
|
|
142
|
-
export function chainIsTvm(chainId: number): boolean {
|
|
143
|
-
return PUBLIC_NETWORKS[chainId]?.family === ChainFamily.TVM;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
137
|
/**
|
|
147
138
|
* Determines whether a chain ID has a native gas token.
|
|
148
139
|
* @param chainId Chain ID to evaluate.
|
|
@@ -175,14 +166,13 @@ export function chainIsOFTEnabled(chainId: number): boolean {
|
|
|
175
166
|
// This is backwards vs. CCTP logic because Across support for OFTs is limited vs. OFT deployments.
|
|
176
167
|
const oftEnabled = [
|
|
177
168
|
CHAIN_IDs.ARBITRUM,
|
|
169
|
+
CHAIN_IDs.POLYGON,
|
|
178
170
|
CHAIN_IDs.HYPEREVM,
|
|
179
|
-
CHAIN_IDs.INK,
|
|
180
|
-
CHAIN_IDs.MEGAETH,
|
|
181
171
|
CHAIN_IDs.MONAD,
|
|
182
172
|
CHAIN_IDs.PLASMA,
|
|
183
|
-
CHAIN_IDs.
|
|
184
|
-
CHAIN_IDs.TRON, // tbd!!!
|
|
173
|
+
CHAIN_IDs.MEGAETH,
|
|
185
174
|
CHAIN_IDs.UNICHAIN,
|
|
175
|
+
CHAIN_IDs.INK,
|
|
186
176
|
];
|
|
187
177
|
return oftEnabled.includes(chainId) && PRODUCTION_NETWORKS[chainId]?.oftEid !== OFT_NO_EID;
|
|
188
178
|
}
|
package/src/utils/TypeGuards.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SVMProvider } from "../arch/svm/types";
|
|
2
2
|
import { EvmProvider } from "../arch/evm/types";
|
|
3
3
|
import { providers } from "ethers";
|
|
4
|
-
import { TronWeb } from "tronweb";
|
|
5
4
|
|
|
6
5
|
export function isPromiseFulfilled<T>(
|
|
7
6
|
promiseSettledResult: PromiseSettledResult<T>
|
|
@@ -19,10 +18,6 @@ export function isDefined<T>(input: T | null | undefined): input is T {
|
|
|
19
18
|
return input !== null && input !== undefined;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
export function
|
|
23
|
-
return typeof (provider as TronWeb)?.trx?.getEnergyPrices === "function";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function isEvmProvider(provider: EvmProvider | SVMProvider | TronWeb): provider is EvmProvider {
|
|
21
|
+
export function isEvmProvider(provider: EvmProvider | SVMProvider): provider is EvmProvider {
|
|
27
22
|
return provider instanceof providers.Provider;
|
|
28
23
|
}
|
|
@@ -254,7 +254,6 @@ export { ProxyAdmin__factory } from "./ProxyAdmin__factory";
|
|
|
254
254
|
export { ReentrancyGuard__factory } from "./ReentrancyGuard__factory";
|
|
255
255
|
export { ReentrancyGuardUpgradeable__factory } from "./ReentrancyGuardUpgradeable__factory";
|
|
256
256
|
export { Router_Adapter__factory } from "./Router_Adapter__factory";
|
|
257
|
-
export { SP1AutoVerifier__factory } from "./SP1AutoVerifier__factory";
|
|
258
257
|
export { SP1Helios__factory } from "./SP1Helios__factory";
|
|
259
258
|
export { SafeCast__factory } from "./SafeCast__factory";
|
|
260
259
|
export { SafeERC20__factory } from "./SafeERC20__factory";
|
|
@@ -254,7 +254,6 @@ export type { ProxyAdmin } from "./ProxyAdmin";
|
|
|
254
254
|
export type { ReentrancyGuard } from "./ReentrancyGuard";
|
|
255
255
|
export type { ReentrancyGuardUpgradeable } from "./ReentrancyGuardUpgradeable";
|
|
256
256
|
export type { Router_Adapter } from "./Router_Adapter";
|
|
257
|
-
export type { SP1AutoVerifier } from "./SP1AutoVerifier";
|
|
258
257
|
export type { SP1Helios } from "./SP1Helios";
|
|
259
258
|
export type { SafeCast } from "./SafeCast";
|
|
260
259
|
export type { SafeERC20 } from "./SafeERC20";
|
|
@@ -573,7 +572,6 @@ export { ShortStrings__factory } from "./factories/ShortStrings__factory";
|
|
|
573
572
|
export { SimpleContract__factory } from "./factories/SimpleContract__factory";
|
|
574
573
|
export { SkinnyOptimisticOracleInterface__factory } from "./factories/SkinnyOptimisticOracleInterface__factory";
|
|
575
574
|
export { Solana_Adapter__factory } from "./factories/Solana_Adapter__factory";
|
|
576
|
-
export { SP1AutoVerifier__factory } from "./factories/SP1AutoVerifier__factory";
|
|
577
575
|
export { SP1Helios__factory } from "./factories/SP1Helios__factory";
|
|
578
576
|
export { SpokePool__factory } from "./factories/SpokePool__factory";
|
|
579
577
|
export { SpokePoolEIP7702Test__factory } from "./factories/SpokePoolEIP7702Test__factory";
|
package/src/utils/index.ts
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.get1967Upgrades = get1967Upgrades;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var utils_1 = require("../../utils");
|
|
6
|
-
function get1967Upgrades(contract, startBlock, endBlock) {
|
|
7
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
8
|
-
var from, to, _a, events;
|
|
9
|
-
return tslib_1.__generator(this, function (_b) {
|
|
10
|
-
switch (_b.label) {
|
|
11
|
-
case 0:
|
|
12
|
-
from = startBlock !== null && startBlock !== void 0 ? startBlock : 0;
|
|
13
|
-
if (!(endBlock !== null && endBlock !== void 0)) return [3, 1];
|
|
14
|
-
_a = endBlock;
|
|
15
|
-
return [3, 3];
|
|
16
|
-
case 1: return [4, contract.provider.getBlockNumber()];
|
|
17
|
-
case 2:
|
|
18
|
-
_a = (_b.sent());
|
|
19
|
-
_b.label = 3;
|
|
20
|
-
case 3:
|
|
21
|
-
to = _a;
|
|
22
|
-
return [4, (0, utils_1.paginatedEventQuery)(contract, contract.filters.Upgraded(), { from: from, to: to })];
|
|
23
|
-
case 4:
|
|
24
|
-
events = _b.sent();
|
|
25
|
-
return [2, events.map(function (_a) {
|
|
26
|
-
var blockNumber = _a.blockNumber;
|
|
27
|
-
return blockNumber;
|
|
28
|
-
})];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=UpgradeUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UpgradeUtils.js","sourceRoot":"","sources":["../../../../../src/arch/evm/UpgradeUtils.ts"],"names":[],"mappings":";;AAUA,0CAOC;;AAhBD,qCAAkD;AASlD,SAAsB,eAAe,CAAC,QAAkB,EAAE,UAAmB,EAAE,QAAiB;;;;;;oBACxF,IAAI,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,CAAC,CAAC;0BAClB,QAAQ,aAAR,QAAQ;oBAAR,KAAA,QAAQ,CAAA;;wBAAK,WAAM,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAA;;oBAAzC,KAAA,CAAC,SAAwC,CAAC,CAAA;;;oBAA3D,EAAE,KAAyD;oBAElD,WAAM,IAAA,2BAAmB,EAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,MAAA,EAAE,EAAE,IAAA,EAAE,CAAC,EAAA;;oBAAvF,MAAM,GAAG,SAA8E;oBAE7F,WAAO,MAAM,CAAC,GAAG,CAAC,UAAC,EAAe;gCAAb,WAAW,iBAAA;4BAAO,OAAA,WAAW;wBAAX,CAAW,CAAC,EAAC;;;;CACrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { averageBlockTime, EVMBlockFinder as TVMBlockFinder } from "../evm/BlockUtils";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TVMBlockFinder = exports.averageBlockTime = void 0;
|
|
4
|
-
var BlockUtils_1 = require("../evm/BlockUtils");
|
|
5
|
-
Object.defineProperty(exports, "averageBlockTime", { enumerable: true, get: function () { return BlockUtils_1.averageBlockTime; } });
|
|
6
|
-
Object.defineProperty(exports, "TVMBlockFinder", { enumerable: true, get: function () { return BlockUtils_1.EVMBlockFinder; } });
|
|
7
|
-
//# sourceMappingURL=BlockUtils.js.map
|