@0xtorch/evm 0.0.1
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/README.md +15 -0
- package/dist/import/abis/erc1155.d.ts +245 -0
- package/dist/import/abis/erc1155.d.ts.map +1 -0
- package/dist/import/abis/erc20.d.ts +169 -0
- package/dist/import/abis/erc20.d.ts.map +1 -0
- package/dist/import/abis/erc721.d.ts +267 -0
- package/dist/import/abis/erc721.d.ts.map +1 -0
- package/dist/import/abis/index.d.ts +5 -0
- package/dist/import/abis/index.d.ts.map +1 -0
- package/dist/import/abis/weth.d.ts +214 -0
- package/dist/import/abis/weth.d.ts.map +1 -0
- package/dist/import/absoluteValue.d.mts +3 -0
- package/dist/import/absoluteValue.d.mts.map +1 -0
- package/dist/import/absoluteValue.d.ts +3 -0
- package/dist/import/absoluteValue.d.ts.map +1 -0
- package/dist/import/analyzer/analyze.d.ts +18 -0
- package/dist/import/analyzer/analyze.d.ts.map +1 -0
- package/dist/import/analyzer/analyzer.d.ts +4 -0
- package/dist/import/analyzer/analyzer.d.ts.map +1 -0
- package/dist/import/analyzer/axieMarketplace/analyze.d.ts +4 -0
- package/dist/import/analyzer/axieMarketplace/analyze.d.ts.map +1 -0
- package/dist/import/analyzer/axieMarketplace/index.d.ts +2 -0
- package/dist/import/analyzer/axieMarketplace/index.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/addLiquidity.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/addLiquidity.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/atomicArbitrage.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/atomicArbitrage.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/bridgeFrom.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/bridgeFrom.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/bridgeTo.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/bridgeTo.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/buyNft.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/buyNft.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/createAccountActionByAction.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/createAccountActionByAction.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/deposit.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/deposit.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/depositWithBond.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/depositWithBond.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/freeMintNft.d.ts +53 -0
- package/dist/import/analyzer/createAccountActionByAction/freeMintNft.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/index.d.ts +2 -0
- package/dist/import/analyzer/createAccountActionByAction/index.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/removeLiquidity.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/removeLiquidity.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/spam.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/spam.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/trade.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/trade.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/transactionFee.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/transactionFee.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/transfer.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/transfer.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/withdraw.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/withdraw.d.ts.map +1 -0
- package/dist/import/analyzer/createAccountActionByAction/withdrawWithBond.d.ts +59 -0
- package/dist/import/analyzer/createAccountActionByAction/withdrawWithBond.d.ts.map +1 -0
- package/dist/import/analyzer/gasFee/analyze.d.ts +4 -0
- package/dist/import/analyzer/gasFee/analyze.d.ts.map +1 -0
- package/dist/import/analyzer/gasFee/index.d.ts +2 -0
- package/dist/import/analyzer/gasFee/index.d.ts.map +1 -0
- package/dist/import/analyzer/index.d.ts +10 -0
- package/dist/import/analyzer/index.d.ts.map +1 -0
- package/dist/import/analyzer/json/analyze.d.ts +5 -0
- package/dist/import/analyzer/json/analyze.d.ts.map +1 -0
- package/dist/import/analyzer/json/generatorAnyLog.d.ts +55 -0
- package/dist/import/analyzer/json/generatorAnyLog.d.ts.map +1 -0
- package/dist/import/analyzer/json/generatorAnyTokenTransfer.d.ts +54 -0
- package/dist/import/analyzer/json/generatorAnyTokenTransfer.d.ts.map +1 -0
- package/dist/import/analyzer/json/generatorSpecificTokenTransfer.d.ts +55 -0
- package/dist/import/analyzer/json/generatorSpecificTokenTransfer.d.ts.map +1 -0
- package/dist/import/analyzer/json/index.d.ts +2 -0
- package/dist/import/analyzer/json/index.d.ts.map +1 -0
- package/dist/import/analyzer/json/types.d.ts +177 -0
- package/dist/import/analyzer/json/types.d.ts.map +1 -0
- package/dist/import/analyzer/seaport/analyze.d.ts +4 -0
- package/dist/import/analyzer/seaport/analyze.d.ts.map +1 -0
- package/dist/import/analyzer/seaport/index.d.ts +2 -0
- package/dist/import/analyzer/seaport/index.d.ts.map +1 -0
- package/dist/import/analyzer/seaport/orderFulfilled.d.ts +139 -0
- package/dist/import/analyzer/seaport/orderFulfilled.d.ts.map +1 -0
- package/dist/import/analyzer/spam/analyze.d.ts +4 -0
- package/dist/import/analyzer/spam/analyze.d.ts.map +1 -0
- package/dist/import/analyzer/spam/index.d.ts +2 -0
- package/dist/import/analyzer/spam/index.d.ts.map +1 -0
- package/dist/import/analyzer/swap/analyze.d.ts +4 -0
- package/dist/import/analyzer/swap/analyze.d.ts.map +1 -0
- package/dist/import/analyzer/swap/index.d.ts +2 -0
- package/dist/import/analyzer/swap/index.d.ts.map +1 -0
- package/dist/import/analyzer/swap/traderJoeLBPairSwap.d.ts +108 -0
- package/dist/import/analyzer/swap/traderJoeLBPairSwap.d.ts.map +1 -0
- package/dist/import/analyzer/swap/univ2PairSwap.d.ts +84 -0
- package/dist/import/analyzer/swap/univ2PairSwap.d.ts.map +1 -0
- package/dist/import/analyzer/swap/univ3PoolSwap.d.ts +96 -0
- package/dist/import/analyzer/swap/univ3PoolSwap.d.ts.map +1 -0
- package/dist/import/analyzer/swap/wrappedDeposit.d.ts +36 -0
- package/dist/import/analyzer/swap/wrappedDeposit.d.ts.map +1 -0
- package/dist/import/analyzer/swap/wrappedWithdrawal.d.ts +36 -0
- package/dist/import/analyzer/swap/wrappedWithdrawal.d.ts.map +1 -0
- package/dist/import/analyzer/transfer/analyze.d.ts +4 -0
- package/dist/import/analyzer/transfer/analyze.d.ts.map +1 -0
- package/dist/import/analyzer/transfer/index.d.ts +2 -0
- package/dist/import/analyzer/transfer/index.d.ts.map +1 -0
- package/dist/import/analyzer/types.d.ts +17 -0
- package/dist/import/analyzer/types.d.ts.map +1 -0
- package/dist/import/apps/index.d.ts +2 -0
- package/dist/import/apps/index.d.ts.map +1 -0
- package/dist/import/apps/types.d.ts +6 -0
- package/dist/import/apps/types.d.ts.map +1 -0
- package/dist/import/chains/definitions/arbitrumOne.d.ts +99 -0
- package/dist/import/chains/definitions/arbitrumOne.d.ts.map +1 -0
- package/dist/import/chains/definitions/astar.d.ts +64 -0
- package/dist/import/chains/definitions/astar.d.ts.map +1 -0
- package/dist/import/chains/definitions/avalancheC.d.ts +84 -0
- package/dist/import/chains/definitions/avalancheC.d.ts.map +1 -0
- package/dist/import/chains/definitions/base.d.ts +94 -0
- package/dist/import/chains/definitions/base.d.ts.map +1 -0
- package/dist/import/chains/definitions/bsc.d.ts +144 -0
- package/dist/import/chains/definitions/bsc.d.ts.map +1 -0
- package/dist/import/chains/definitions/defineChain.d.ts +3 -0
- package/dist/import/chains/definitions/defineChain.d.ts.map +1 -0
- package/dist/import/chains/definitions/ethereum.d.ts +129 -0
- package/dist/import/chains/definitions/ethereum.d.ts.map +1 -0
- package/dist/import/chains/definitions/fantom.d.ts +89 -0
- package/dist/import/chains/definitions/fantom.d.ts.map +1 -0
- package/dist/import/chains/definitions/index.d.ts +16 -0
- package/dist/import/chains/definitions/index.d.ts.map +1 -0
- package/dist/import/chains/definitions/linea.d.ts +69 -0
- package/dist/import/chains/definitions/linea.d.ts.map +1 -0
- package/dist/import/chains/definitions/mantle.d.ts +62 -0
- package/dist/import/chains/definitions/mantle.d.ts.map +1 -0
- package/dist/import/chains/definitions/metis.d.ts +52 -0
- package/dist/import/chains/definitions/metis.d.ts.map +1 -0
- package/dist/import/chains/definitions/moonbeam.d.ts +84 -0
- package/dist/import/chains/definitions/moonbeam.d.ts.map +1 -0
- package/dist/import/chains/definitions/moonriver.d.ts +64 -0
- package/dist/import/chains/definitions/moonriver.d.ts.map +1 -0
- package/dist/import/chains/definitions/optimism.d.ts +104 -0
- package/dist/import/chains/definitions/optimism.d.ts.map +1 -0
- package/dist/import/chains/definitions/polygonPos.d.ts +84 -0
- package/dist/import/chains/definitions/polygonPos.d.ts.map +1 -0
- package/dist/import/chains/definitions/ronin.d.ts +49 -0
- package/dist/import/chains/definitions/ronin.d.ts.map +1 -0
- package/dist/import/chains/externals/defillama/constants.d.ts +2 -0
- package/dist/import/chains/externals/defillama/constants.d.ts.map +1 -0
- package/dist/import/chains/externals/defillama/getBlockOfTimestamp.d.ts +10 -0
- package/dist/import/chains/externals/defillama/getBlockOfTimestamp.d.ts.map +1 -0
- package/dist/import/chains/externals/defillama/index.d.ts +2 -0
- package/dist/import/chains/externals/defillama/index.d.ts.map +1 -0
- package/dist/import/chains/externals/index.d.ts +2 -0
- package/dist/import/chains/externals/index.d.ts.map +1 -0
- package/dist/import/chains/index.d.ts +4 -0
- package/dist/import/chains/index.d.ts.map +1 -0
- package/dist/import/chains/types/chain.d.ts +22 -0
- package/dist/import/chains/types/chain.d.ts.map +1 -0
- package/dist/import/chains/types/index.d.ts +3 -0
- package/dist/import/chains/types/index.d.ts.map +1 -0
- package/dist/import/chains/types/rpc.d.ts +7 -0
- package/dist/import/chains/types/rpc.d.ts.map +1 -0
- package/dist/import/clients/definitions/defineClient.d.ts +3 -0
- package/dist/import/clients/definitions/defineClient.d.ts.map +1 -0
- package/dist/import/clients/definitions/index.d.ts +2 -0
- package/dist/import/clients/definitions/index.d.ts.map +1 -0
- package/dist/import/clients/definitions/viemClient.d.ts +59 -0
- package/dist/import/clients/definitions/viemClient.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/estimateFeesPerGas.d.ts +13 -0
- package/dist/import/clients/externals/viem/estimateFeesPerGas.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/getBalance.d.ts +15 -0
- package/dist/import/clients/externals/viem/getBalance.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/getBlock.d.ts +14 -0
- package/dist/import/clients/externals/viem/getBlock.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/getBlockNumber.d.ts +13 -0
- package/dist/import/clients/externals/viem/getBlockNumber.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/getEventLogs.d.ts +19 -0
- package/dist/import/clients/externals/viem/getEventLogs.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/getTransaction.d.ts +15 -0
- package/dist/import/clients/externals/viem/getTransaction.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/getTransactionCount.d.ts +15 -0
- package/dist/import/clients/externals/viem/getTransactionCount.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/getTransactionReceipt.d.ts +15 -0
- package/dist/import/clients/externals/viem/getTransactionReceipt.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/index.d.ts +11 -0
- package/dist/import/clients/externals/viem/index.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/middleware.d.ts +23 -0
- package/dist/import/clients/externals/viem/middleware.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/multicall.d.ts +14 -0
- package/dist/import/clients/externals/viem/multicall.d.ts.map +1 -0
- package/dist/import/clients/externals/viem/readContract.d.ts +14 -0
- package/dist/import/clients/externals/viem/readContract.d.ts.map +1 -0
- package/dist/import/clients/index.d.ts +3 -0
- package/dist/import/clients/index.d.ts.map +1 -0
- package/dist/import/clients/types.d.ts +64 -0
- package/dist/import/clients/types.d.ts.map +1 -0
- package/dist/import/createBigDecimal.d.mts +6 -0
- package/dist/import/createBigDecimal.d.mts.map +1 -0
- package/dist/import/createBigDecimal.d.ts +3 -0
- package/dist/import/createBigDecimal.d.ts.map +1 -0
- package/dist/import/creates/createEvmAccount.d.ts +5 -0
- package/dist/import/creates/createEvmAccount.d.ts.map +1 -0
- package/dist/import/decoder/decode.d.ts +3 -0
- package/dist/import/decoder/decode.d.ts.map +1 -0
- package/dist/import/decoder/decoder.d.ts +3 -0
- package/dist/import/decoder/decoder.d.ts.map +1 -0
- package/dist/import/decoder/index.d.ts +6 -0
- package/dist/import/decoder/index.d.ts.map +1 -0
- package/dist/import/decoder/parseErc1155TransferSingleLogs.d.ts +4 -0
- package/dist/import/decoder/parseErc1155TransferSingleLogs.d.ts.map +1 -0
- package/dist/import/decoder/parseErc20TransferLogs.d.ts +8 -0
- package/dist/import/decoder/parseErc20TransferLogs.d.ts.map +1 -0
- package/dist/import/decoder/parseErc721TransferLogs.d.ts +8 -0
- package/dist/import/decoder/parseErc721TransferLogs.d.ts.map +1 -0
- package/dist/import/decoder/types.d.ts +16 -0
- package/dist/import/decoder/types.d.ts.map +1 -0
- package/dist/import/divide.d.mts +8 -0
- package/dist/import/divide.d.mts.map +1 -0
- package/dist/import/divide.d.ts +3 -0
- package/dist/import/divide.d.ts.map +1 -0
- package/dist/import/equals.d.mts +3 -0
- package/dist/import/equals.d.mts.map +1 -0
- package/dist/import/equals.d.ts +3 -0
- package/dist/import/equals.d.ts.map +1 -0
- package/dist/import/explorers/definitions/blockscout.d.ts +60 -0
- package/dist/import/explorers/definitions/blockscout.d.ts.map +1 -0
- package/dist/import/explorers/definitions/defineExplorer.d.ts +3 -0
- package/dist/import/explorers/definitions/defineExplorer.d.ts.map +1 -0
- package/dist/import/explorers/definitions/etherscan.d.ts +61 -0
- package/dist/import/explorers/definitions/etherscan.d.ts.map +1 -0
- package/dist/import/explorers/definitions/index.d.ts +5 -0
- package/dist/import/explorers/definitions/index.d.ts.map +1 -0
- package/dist/import/explorers/definitions/roninExplorer.d.ts +62 -0
- package/dist/import/explorers/definitions/roninExplorer.d.ts.map +1 -0
- package/dist/import/explorers/definitions/routescan.d.ts +19 -0
- package/dist/import/explorers/definitions/routescan.d.ts.map +1 -0
- package/dist/import/explorers/externals/blockscout/getBlockNumberOfTimestamp.d.ts +11 -0
- package/dist/import/explorers/externals/blockscout/getBlockNumberOfTimestamp.d.ts.map +1 -0
- package/dist/import/explorers/externals/blockscout/getContractByAddress.d.ts +30 -0
- package/dist/import/explorers/externals/blockscout/getContractByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/blockscout/getInternalTransactionsByAddress.d.ts +62 -0
- package/dist/import/explorers/externals/blockscout/getInternalTransactionsByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/blockscout/getInternalTransactionsByTransactionHash.d.ts +54 -0
- package/dist/import/explorers/externals/blockscout/getInternalTransactionsByTransactionHash.d.ts.map +1 -0
- package/dist/import/explorers/externals/blockscout/getNormalTransactionsByAddress.d.ts +77 -0
- package/dist/import/explorers/externals/blockscout/getNormalTransactionsByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/blockscout/getTokenTransfersByAddress.d.ts +80 -0
- package/dist/import/explorers/externals/blockscout/getTokenTransfersByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/blockscout/index.d.ts +7 -0
- package/dist/import/explorers/externals/blockscout/index.d.ts.map +1 -0
- package/dist/import/explorers/externals/blockscout/middleware.d.ts +7 -0
- package/dist/import/explorers/externals/blockscout/middleware.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/getBlockNumberOfTimestamp.d.ts +12 -0
- package/dist/import/explorers/externals/etherscan/getBlockNumberOfTimestamp.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/getContractByAddress.d.ts +55 -0
- package/dist/import/explorers/externals/etherscan/getContractByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/getErc1155TokenTransfersByAddress.d.ts +83 -0
- package/dist/import/explorers/externals/etherscan/getErc1155TokenTransfersByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/getErc20TokenTransfersByAddress.d.ts +81 -0
- package/dist/import/explorers/externals/etherscan/getErc20TokenTransfersByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/getErc721TokenTransfersByAddress.d.ts +81 -0
- package/dist/import/explorers/externals/etherscan/getErc721TokenTransfersByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/getInternalTransactionsByAddress.d.ts +62 -0
- package/dist/import/explorers/externals/etherscan/getInternalTransactionsByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/getInternalTransactionsByTransactionHash.d.ts +55 -0
- package/dist/import/explorers/externals/etherscan/getInternalTransactionsByTransactionHash.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/getNormalTransactionsByAddress.d.ts +84 -0
- package/dist/import/explorers/externals/etherscan/getNormalTransactionsByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/index.d.ts +9 -0
- package/dist/import/explorers/externals/etherscan/index.d.ts.map +1 -0
- package/dist/import/explorers/externals/etherscan/middleware.d.ts +7 -0
- package/dist/import/explorers/externals/etherscan/middleware.d.ts.map +1 -0
- package/dist/import/explorers/externals/roninExplorer/getInternalTransactionByHash.d.ts +57 -0
- package/dist/import/explorers/externals/roninExplorer/getInternalTransactionByHash.d.ts.map +1 -0
- package/dist/import/explorers/externals/roninExplorer/getNormalTransactionsByAddress.d.ts +70 -0
- package/dist/import/explorers/externals/roninExplorer/getNormalTransactionsByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/roninExplorer/getTokenTransfersByAddress.d.ts +64 -0
- package/dist/import/explorers/externals/roninExplorer/getTokenTransfersByAddress.d.ts.map +1 -0
- package/dist/import/explorers/externals/roninExplorer/index.d.ts +4 -0
- package/dist/import/explorers/externals/roninExplorer/index.d.ts.map +1 -0
- package/dist/import/explorers/externals/roninExplorer/middleware.d.ts +5 -0
- package/dist/import/explorers/externals/roninExplorer/middleware.d.ts.map +1 -0
- package/dist/import/explorers/index.d.ts +3 -0
- package/dist/import/explorers/index.d.ts.map +1 -0
- package/dist/import/explorers/types.d.ts +43 -0
- package/dist/import/explorers/types.d.ts.map +1 -0
- package/dist/import/fix.d.mts +7 -0
- package/dist/import/fix.d.mts.map +1 -0
- package/dist/import/fix.d.ts +3 -0
- package/dist/import/fix.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/getAccountsTransactionFulls.d.ts +15 -0
- package/dist/import/getAccountsTransactionFulls/getAccountsTransactionFulls.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.d.ts +4 -0
- package/dist/import/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/getDecodedTransactionsPrices.d.ts +5 -0
- package/dist/import/getAccountsTransactionFulls/getDecodedTransactionsPrices.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/getHashesAndInternalTxs.d.ts +8 -0
- package/dist/import/getAccountsTransactionFulls/getHashesAndInternalTxs.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/getTransactionDetail.d.ts +5 -0
- package/dist/import/getAccountsTransactionFulls/getTransactionDetail.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/getTransactionDetails.d.ts +5 -0
- package/dist/import/getAccountsTransactionFulls/getTransactionDetails.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/getTransactionsApps.d.ts +8 -0
- package/dist/import/getAccountsTransactionFulls/getTransactionsApps.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/index.d.ts +3 -0
- package/dist/import/getAccountsTransactionFulls/index.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/types.d.ts +87 -0
- package/dist/import/getAccountsTransactionFulls/types.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/withD.d.ts +4 -0
- package/dist/import/getAccountsTransactionFulls/withD.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/withDA.d.ts +4 -0
- package/dist/import/getAccountsTransactionFulls/withDA.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/withP.d.ts +4 -0
- package/dist/import/getAccountsTransactionFulls/withP.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/withPD.d.ts +4 -0
- package/dist/import/getAccountsTransactionFulls/withPD.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/withPDA.d.ts +4 -0
- package/dist/import/getAccountsTransactionFulls/withPDA.d.ts.map +1 -0
- package/dist/import/getAccountsTransactionFulls/withUndefined.d.ts +4 -0
- package/dist/import/getAccountsTransactionFulls/withUndefined.d.ts.map +1 -0
- package/dist/import/getTransactionFull/getTransactionDetail.d.ts +5 -0
- package/dist/import/getTransactionFull/getTransactionDetail.d.ts.map +1 -0
- package/dist/import/getTransactionFull/getTransactionFull.d.ts +11 -0
- package/dist/import/getTransactionFull/getTransactionFull.d.ts.map +1 -0
- package/dist/import/getTransactionFull/getTransactionFullCustom.d.ts +4 -0
- package/dist/import/getTransactionFull/getTransactionFullCustom.d.ts.map +1 -0
- package/dist/import/getTransactionFull/index.d.ts +3 -0
- package/dist/import/getTransactionFull/index.d.ts.map +1 -0
- package/dist/import/getTransactionFull/types.d.ts +63 -0
- package/dist/import/getTransactionFull/types.d.ts.map +1 -0
- package/dist/import/getTransactionFull/withD.d.ts +4 -0
- package/dist/import/getTransactionFull/withD.d.ts.map +1 -0
- package/dist/import/getTransactionFull/withDA.d.ts +4 -0
- package/dist/import/getTransactionFull/withDA.d.ts.map +1 -0
- package/dist/import/getTransactionFull/withP.d.ts +4 -0
- package/dist/import/getTransactionFull/withP.d.ts.map +1 -0
- package/dist/import/getTransactionFull/withPD.d.ts +4 -0
- package/dist/import/getTransactionFull/withPD.d.ts.map +1 -0
- package/dist/import/getTransactionFull/withPDA.d.ts +4 -0
- package/dist/import/getTransactionFull/withPDA.d.ts.map +1 -0
- package/dist/import/getTransactionFull/withUndefined.d.ts +4 -0
- package/dist/import/getTransactionFull/withUndefined.d.ts.map +1 -0
- package/dist/import/greaterThan.d.mts +3 -0
- package/dist/import/greaterThan.d.mts.map +1 -0
- package/dist/import/greaterThan.d.ts +3 -0
- package/dist/import/greaterThan.d.ts.map +1 -0
- package/dist/import/index.d.mts +15 -0
- package/dist/import/index.d.mts.map +1 -0
- package/dist/import/index.d.ts +11 -0
- package/dist/import/index.d.ts.map +1 -0
- package/dist/import/index.mjs +1 -0
- package/dist/import/minus.d.mts +3 -0
- package/dist/import/minus.d.mts.map +1 -0
- package/dist/import/minus.d.ts +3 -0
- package/dist/import/minus.d.ts.map +1 -0
- package/dist/import/plus.d.mts +3 -0
- package/dist/import/plus.d.mts.map +1 -0
- package/dist/import/plus.d.ts +3 -0
- package/dist/import/plus.d.ts.map +1 -0
- package/dist/import/removeTrailingZeros.d.mts +6 -0
- package/dist/import/removeTrailingZeros.d.mts.map +1 -0
- package/dist/import/removeTrailingZeros.d.ts +3 -0
- package/dist/import/removeTrailingZeros.d.ts.map +1 -0
- package/dist/import/times.d.ts +3 -0
- package/dist/import/times.d.ts.map +1 -0
- package/dist/import/toStringBigDecimal.d.mts +6 -0
- package/dist/import/toStringBigDecimal.d.mts.map +1 -0
- package/dist/import/toStringBigDecimal.d.ts +3 -0
- package/dist/import/toStringBigDecimal.d.ts.map +1 -0
- package/dist/import/type.d.mts +5 -0
- package/dist/import/type.d.mts.map +1 -0
- package/dist/import/type.d.ts +5 -0
- package/dist/import/type.d.ts.map +1 -0
- package/dist/import/types/erc1155.d.ts +16 -0
- package/dist/import/types/erc1155.d.ts.map +1 -0
- package/dist/import/types/erc20.d.ts +19 -0
- package/dist/import/types/erc20.d.ts.map +1 -0
- package/dist/import/types/erc721.d.ts +18 -0
- package/dist/import/types/erc721.d.ts.map +1 -0
- package/dist/import/types/evmAccount.d.ts +10 -0
- package/dist/import/types/evmAccount.d.ts.map +1 -0
- package/dist/import/types/hex.d.ts +5 -0
- package/dist/import/types/hex.d.ts.map +1 -0
- package/dist/import/types/index.d.ts +12 -0
- package/dist/import/types/index.d.ts.map +1 -0
- package/dist/import/types/input.d.ts +26 -0
- package/dist/import/types/input.d.ts.map +1 -0
- package/dist/import/types/internalTransaction.d.ts +18 -0
- package/dist/import/types/internalTransaction.d.ts.map +1 -0
- package/dist/import/types/log.d.ts +118 -0
- package/dist/import/types/log.d.ts.map +1 -0
- package/dist/import/types/transaction.d.ts +44 -0
- package/dist/import/types/transaction.d.ts.map +1 -0
- package/dist/import/utils/bigint.d.ts +3 -0
- package/dist/import/utils/bigint.d.ts.map +1 -0
- package/dist/import/utils/index.d.ts +4 -0
- package/dist/import/utils/index.d.ts.map +1 -0
- package/dist/import/utils/timeout.d.ts +2 -0
- package/dist/import/utils/timeout.d.ts.map +1 -0
- package/dist/import/utils/types.d.ts +12 -0
- package/dist/import/utils/types.d.ts.map +1 -0
- package/dist/require/absoluteValue.d.ts +3 -0
- package/dist/require/absoluteValue.d.ts.map +1 -0
- package/dist/require/createBigDecimal.d.ts +6 -0
- package/dist/require/createBigDecimal.d.ts.map +1 -0
- package/dist/require/divide.d.ts +2 -0
- package/dist/require/divide.d.ts.map +1 -0
- package/dist/require/equals.d.ts +3 -0
- package/dist/require/equals.d.ts.map +1 -0
- package/dist/require/fix.d.ts +7 -0
- package/dist/require/fix.d.ts.map +1 -0
- package/dist/require/greaterThan.d.ts +3 -0
- package/dist/require/greaterThan.d.ts.map +1 -0
- package/dist/require/index.cjs +46 -0
- package/dist/require/index.d.cts +2 -0
- package/dist/require/index.d.cts.map +1 -0
- package/dist/require/index.d.ts +11 -0
- package/dist/require/index.d.ts.map +1 -0
- package/dist/require/minus.d.ts +3 -0
- package/dist/require/minus.d.ts.map +1 -0
- package/dist/require/plus.d.ts +3 -0
- package/dist/require/plus.d.ts.map +1 -0
- package/dist/require/removeTrailingZeros.d.ts +6 -0
- package/dist/require/removeTrailingZeros.d.ts.map +1 -0
- package/dist/require/times.d.ts +8 -0
- package/dist/require/times.d.ts.map +1 -0
- package/dist/require/toStringBigDecimal.d.ts +6 -0
- package/dist/require/toStringBigDecimal.d.ts.map +1 -0
- package/dist/require/type.d.ts +5 -0
- package/dist/require/type.d.ts.map +1 -0
- package/package.json +85 -0
- package/src/abis/erc1155.ts +314 -0
- package/src/abis/erc20.ts +222 -0
- package/src/abis/erc721.ts +346 -0
- package/src/abis/index.ts +4 -0
- package/src/abis/weth.ts +153 -0
- package/src/analyzer/analyze.ts +85 -0
- package/src/analyzer/analyzer.ts +5 -0
- package/src/analyzer/axieMarketplace/analyze.ts +326 -0
- package/src/analyzer/axieMarketplace/index.ts +1 -0
- package/src/analyzer/createAccountActionByAction/addLiquidity.ts +60 -0
- package/src/analyzer/createAccountActionByAction/atomicArbitrage.ts +115 -0
- package/src/analyzer/createAccountActionByAction/bridgeFrom.ts +61 -0
- package/src/analyzer/createAccountActionByAction/bridgeTo.ts +61 -0
- package/src/analyzer/createAccountActionByAction/buyNft.ts +106 -0
- package/src/analyzer/createAccountActionByAction/createAccountActionByAction.ts +181 -0
- package/src/analyzer/createAccountActionByAction/deposit.ts +64 -0
- package/src/analyzer/createAccountActionByAction/depositWithBond.ts +60 -0
- package/src/analyzer/createAccountActionByAction/freeMintNft.ts +54 -0
- package/src/analyzer/createAccountActionByAction/index.ts +1 -0
- package/src/analyzer/createAccountActionByAction/removeLiquidity.ts +60 -0
- package/src/analyzer/createAccountActionByAction/spam.ts +79 -0
- package/src/analyzer/createAccountActionByAction/trade.ts +105 -0
- package/src/analyzer/createAccountActionByAction/transactionFee.ts +51 -0
- package/src/analyzer/createAccountActionByAction/transfer.ts +95 -0
- package/src/analyzer/createAccountActionByAction/withdraw.ts +61 -0
- package/src/analyzer/createAccountActionByAction/withdrawWithBond.ts +60 -0
- package/src/analyzer/gasFee/analyze.test.ts +6 -0
- package/src/analyzer/gasFee/analyze.ts +72 -0
- package/src/analyzer/gasFee/index.ts +1 -0
- package/src/analyzer/index.ts +9 -0
- package/src/analyzer/json/analyze.test.ts +1819 -0
- package/src/analyzer/json/analyze.ts +536 -0
- package/src/analyzer/json/generatorAnyLog.ts +207 -0
- package/src/analyzer/json/generatorAnyTokenTransfer.ts +118 -0
- package/src/analyzer/json/generatorSpecificTokenTransfer.ts +425 -0
- package/src/analyzer/json/index.ts +1 -0
- package/src/analyzer/json/types.ts +239 -0
- package/src/analyzer/seaport/analyze.test.ts +2323 -0
- package/src/analyzer/seaport/analyze.ts +917 -0
- package/src/analyzer/seaport/index.ts +1 -0
- package/src/analyzer/seaport/orderFulfilled.ts +131 -0
- package/src/analyzer/spam/analyze.ts +219 -0
- package/src/analyzer/spam/index.ts +1 -0
- package/src/analyzer/swap/analyze.test.ts +2401 -0
- package/src/analyzer/swap/analyze.ts +939 -0
- package/src/analyzer/swap/index.ts +1 -0
- package/src/analyzer/swap/traderJoeLBPairSwap.ts +92 -0
- package/src/analyzer/swap/univ2PairSwap.ts +77 -0
- package/src/analyzer/swap/univ3PoolSwap.ts +83 -0
- package/src/analyzer/swap/wrappedDeposit.ts +51 -0
- package/src/analyzer/swap/wrappedWithdrawal.ts +53 -0
- package/src/analyzer/tests.ts +2 -0
- package/src/analyzer/transfer/analyze.test.ts +6 -0
- package/src/analyzer/transfer/analyze.ts +209 -0
- package/src/analyzer/transfer/index.ts +1 -0
- package/src/analyzer/types.ts +44 -0
- package/src/apps/index.ts +1 -0
- package/src/apps/types.ts +10 -0
- package/src/chains/definitions/arbitrumOne.test.ts +50 -0
- package/src/chains/definitions/arbitrumOne.ts +133 -0
- package/src/chains/definitions/astar.test.ts +51 -0
- package/src/chains/definitions/astar.ts +93 -0
- package/src/chains/definitions/avalancheC.test.ts +50 -0
- package/src/chains/definitions/avalancheC.ts +115 -0
- package/src/chains/definitions/base.test.ts +50 -0
- package/src/chains/definitions/base.ts +125 -0
- package/src/chains/definitions/bsc.test.ts +50 -0
- package/src/chains/definitions/bsc.ts +182 -0
- package/src/chains/definitions/defineChain.ts +7 -0
- package/src/chains/definitions/ethereum.test.ts +50 -0
- package/src/chains/definitions/ethereum.ts +169 -0
- package/src/chains/definitions/fantom.test.ts +50 -0
- package/src/chains/definitions/fantom.ts +123 -0
- package/src/chains/definitions/index.ts +88 -0
- package/src/chains/definitions/linea.test.ts +50 -0
- package/src/chains/definitions/linea.ts +95 -0
- package/src/chains/definitions/mantle.test.ts +50 -0
- package/src/chains/definitions/mantle.ts +75 -0
- package/src/chains/definitions/metis.test.ts +50 -0
- package/src/chains/definitions/metis.ts +60 -0
- package/src/chains/definitions/moonbeam.test.ts +50 -0
- package/src/chains/definitions/moonbeam.ts +117 -0
- package/src/chains/definitions/moonriver.test.ts +50 -0
- package/src/chains/definitions/moonriver.ts +94 -0
- package/src/chains/definitions/optimism.test.ts +50 -0
- package/src/chains/definitions/optimism.ts +139 -0
- package/src/chains/definitions/polygonPos.test.ts +50 -0
- package/src/chains/definitions/polygonPos.ts +121 -0
- package/src/chains/definitions/ronin.test.ts +50 -0
- package/src/chains/definitions/ronin.ts +75 -0
- package/src/chains/definitions/tests.ts +2884 -0
- package/src/chains/externals/defillama/constants.ts +1 -0
- package/src/chains/externals/defillama/getBlockOfTimestamp.test.ts +12 -0
- package/src/chains/externals/defillama/getBlockOfTimestamp.ts +26 -0
- package/src/chains/externals/defillama/index.ts +1 -0
- package/src/chains/externals/index.ts +1 -0
- package/src/chains/index.ts +62 -0
- package/src/chains/types/chain.ts +22 -0
- package/src/chains/types/index.ts +2 -0
- package/src/chains/types/rpc.ts +6 -0
- package/src/clients/definitions/defineClient.ts +7 -0
- package/src/clients/definitions/index.ts +1 -0
- package/src/clients/definitions/viemClient.ts +86 -0
- package/src/clients/externals/viem/estimateFeesPerGas.ts +23 -0
- package/src/clients/externals/viem/getBalance.ts +25 -0
- package/src/clients/externals/viem/getBlock.ts +29 -0
- package/src/clients/externals/viem/getBlockNumber.ts +23 -0
- package/src/clients/externals/viem/getEventLogs.test.ts +22 -0
- package/src/clients/externals/viem/getEventLogs.ts +40 -0
- package/src/clients/externals/viem/getTransaction.ts +25 -0
- package/src/clients/externals/viem/getTransactionCount.ts +25 -0
- package/src/clients/externals/viem/getTransactionReceipt.ts +25 -0
- package/src/clients/externals/viem/index.ts +10 -0
- package/src/clients/externals/viem/middleware.ts +437 -0
- package/src/clients/externals/viem/multicall.test.ts +26 -0
- package/src/clients/externals/viem/multicall.ts +27 -0
- package/src/clients/externals/viem/readContract.test.ts +20 -0
- package/src/clients/externals/viem/readContract.ts +38 -0
- package/src/clients/externals/viem/tests.ts +957 -0
- package/src/clients/index.ts +2 -0
- package/src/clients/types.ts +113 -0
- package/src/creates/createEvmAccount.ts +12 -0
- package/src/decoder/decode.test.ts +324 -0
- package/src/decoder/decode.ts +716 -0
- package/src/decoder/decoder.ts +6 -0
- package/src/decoder/index.ts +5 -0
- package/src/decoder/parseErc1155TransferSingleLogs.ts +40 -0
- package/src/decoder/parseErc20TransferLogs.ts +35 -0
- package/src/decoder/parseErc721TransferLogs.ts +40 -0
- package/src/decoder/tests.ts +502 -0
- package/src/decoder/types.ts +21 -0
- package/src/explorers/definitions/blockscout.test.ts +124 -0
- package/src/explorers/definitions/blockscout.ts +205 -0
- package/src/explorers/definitions/defineExplorer.ts +7 -0
- package/src/explorers/definitions/etherscan.test.ts +123 -0
- package/src/explorers/definitions/etherscan.ts +279 -0
- package/src/explorers/definitions/index.ts +4 -0
- package/src/explorers/definitions/roninExplorer.ts +150 -0
- package/src/explorers/definitions/routescan.ts +57 -0
- package/src/explorers/externals/blockscout/getBlockNumberOfTimestamp.ts +67 -0
- package/src/explorers/externals/blockscout/getContractByAddress.ts +81 -0
- package/src/explorers/externals/blockscout/getInternalTransactionsByAddress.ts +120 -0
- package/src/explorers/externals/blockscout/getInternalTransactionsByTransactionHash.ts +87 -0
- package/src/explorers/externals/blockscout/getNormalTransactionsByAddress.ts +116 -0
- package/src/explorers/externals/blockscout/getTokenTransfersByAddress.ts +127 -0
- package/src/explorers/externals/blockscout/index.ts +6 -0
- package/src/explorers/externals/blockscout/middleware.ts +56 -0
- package/src/explorers/externals/defillama/getBlockNumberOfTimestamp.ts +28 -0
- package/src/explorers/externals/defillama/index.ts +1 -0
- package/src/explorers/externals/etherscan/getBlockNumberOfTimestamp.ts +66 -0
- package/src/explorers/externals/etherscan/getContractByAddress.ts +86 -0
- package/src/explorers/externals/etherscan/getErc1155TokenTransfersByAddress.ts +133 -0
- package/src/explorers/externals/etherscan/getErc20TokenTransfersByAddress.ts +125 -0
- package/src/explorers/externals/etherscan/getErc721TokenTransfersByAddress.ts +125 -0
- package/src/explorers/externals/etherscan/getInternalTransactionsByAddress.ts +117 -0
- package/src/explorers/externals/etherscan/getInternalTransactionsByTransactionHash.ts +91 -0
- package/src/explorers/externals/etherscan/getNormalTransactionsByAddress.ts +122 -0
- package/src/explorers/externals/etherscan/index.ts +8 -0
- package/src/explorers/externals/etherscan/middleware.ts +77 -0
- package/src/explorers/externals/roninExplorer/getInternalTransactionByHash.ts +80 -0
- package/src/explorers/externals/roninExplorer/getNormalTransactionsByAddress.ts +79 -0
- package/src/explorers/externals/roninExplorer/getTokenTransfersByAddress.ts +81 -0
- package/src/explorers/externals/roninExplorer/index.ts +3 -0
- package/src/explorers/externals/roninExplorer/middleware.ts +49 -0
- package/src/explorers/index.ts +7 -0
- package/src/explorers/types.ts +56 -0
- package/src/getAccountsTransactionFulls/getAccountsTransactionFulls.test.ts +22 -0
- package/src/getAccountsTransactionFulls/getAccountsTransactionFulls.ts +46 -0
- package/src/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.ts +106 -0
- package/src/getAccountsTransactionFulls/getDecodedTransactionsPrices.ts +97 -0
- package/src/getAccountsTransactionFulls/getHashesAndInternalTxs.ts +65 -0
- package/src/getAccountsTransactionFulls/getTransactionDetail.ts +49 -0
- package/src/getAccountsTransactionFulls/getTransactionDetails.ts +39 -0
- package/src/getAccountsTransactionFulls/getTransactionsApps.ts +42 -0
- package/src/getAccountsTransactionFulls/index.ts +2 -0
- package/src/getAccountsTransactionFulls/types.ts +122 -0
- package/src/getAccountsTransactionFulls/withD.ts +80 -0
- package/src/getAccountsTransactionFulls/withDA.ts +112 -0
- package/src/getAccountsTransactionFulls/withP.ts +120 -0
- package/src/getAccountsTransactionFulls/withPD.ts +141 -0
- package/src/getAccountsTransactionFulls/withPDA.ts +167 -0
- package/src/getAccountsTransactionFulls/withUndefined.ts +88 -0
- package/src/getContractAbi.ts +15 -0
- package/src/getTransactionFull/getTransactionDetail.ts +47 -0
- package/src/getTransactionFull/getTransactionFull.test.ts +34 -0
- package/src/getTransactionFull/getTransactionFull.ts +30 -0
- package/src/getTransactionFull/getTransactionFullCustom.ts +91 -0
- package/src/getTransactionFull/index.ts +2 -0
- package/src/getTransactionFull/types.ts +98 -0
- package/src/getTransactionFull/withD.ts +57 -0
- package/src/getTransactionFull/withDA.ts +78 -0
- package/src/getTransactionFull/withP.ts +69 -0
- package/src/getTransactionFull/withPD.ts +119 -0
- package/src/getTransactionFull/withPDA.ts +147 -0
- package/src/getTransactionFull/withUndefined.ts +39 -0
- package/src/index.cts +1 -0
- package/src/index.mts +110 -0
- package/src/tests.ts +1 -0
- package/src/types/erc1155.ts +17 -0
- package/src/types/erc20.ts +22 -0
- package/src/types/erc721.ts +19 -0
- package/src/types/evmAccount.ts +12 -0
- package/src/types/hex.test.ts +10 -0
- package/src/types/hex.ts +9 -0
- package/src/types/index.ts +16 -0
- package/src/types/input.ts +27 -0
- package/src/types/internalTransaction.ts +19 -0
- package/src/types/log.ts +68 -0
- package/src/types/transaction.ts +78 -0
- package/src/utils/bigint.ts +5 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/timeout.ts +5 -0
- package/src/utils/types.ts +12 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import type { Logger } from '@0xtorch/core'
|
|
2
|
+
import type { InternalTransaction, LowerHex } from '../../types'
|
|
3
|
+
import {
|
|
4
|
+
getBlockNumberOfTimestamp,
|
|
5
|
+
getContractByAddress,
|
|
6
|
+
getErc1155TokenTransfersByAddress,
|
|
7
|
+
getErc20TokenTransfersByAddress,
|
|
8
|
+
getErc721TokenTransfersByAddress,
|
|
9
|
+
getInternalTransactionsByAddress,
|
|
10
|
+
getInternalTransactionsByTransactionHash,
|
|
11
|
+
getNormalTransactionsByAddress,
|
|
12
|
+
} from '../externals/etherscan'
|
|
13
|
+
import { defineExplorer } from './defineExplorer'
|
|
14
|
+
|
|
15
|
+
type CreateEtherscanExplorerParameters<
|
|
16
|
+
TName extends string,
|
|
17
|
+
TUrl extends string,
|
|
18
|
+
TApiUrl extends string,
|
|
19
|
+
> = {
|
|
20
|
+
readonly name: TName
|
|
21
|
+
readonly url: TUrl
|
|
22
|
+
readonly apiUrl: TApiUrl
|
|
23
|
+
readonly apiKey: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const createEtherscan = <
|
|
27
|
+
TName extends string,
|
|
28
|
+
TUrl extends string,
|
|
29
|
+
TApiUrl extends string,
|
|
30
|
+
>({
|
|
31
|
+
name,
|
|
32
|
+
url,
|
|
33
|
+
apiUrl,
|
|
34
|
+
apiKey,
|
|
35
|
+
}: CreateEtherscanExplorerParameters<TName, TUrl, TApiUrl>) =>
|
|
36
|
+
defineExplorer({
|
|
37
|
+
name,
|
|
38
|
+
url,
|
|
39
|
+
apiUrl,
|
|
40
|
+
getAddressTransactionHashes: async ({
|
|
41
|
+
address,
|
|
42
|
+
startBlock,
|
|
43
|
+
endBlock,
|
|
44
|
+
logger,
|
|
45
|
+
}) => {
|
|
46
|
+
const loop = true
|
|
47
|
+
const hashSet = new Set<LowerHex>()
|
|
48
|
+
let mut_startBlock = startBlock
|
|
49
|
+
while (loop) {
|
|
50
|
+
const transactions = await getNormalTransactionsByAddress({
|
|
51
|
+
apiEndpoint: apiUrl,
|
|
52
|
+
apiKey,
|
|
53
|
+
address,
|
|
54
|
+
startBlock: mut_startBlock,
|
|
55
|
+
endBlock,
|
|
56
|
+
logger,
|
|
57
|
+
})
|
|
58
|
+
for (const { hash } of transactions) {
|
|
59
|
+
hashSet.add(hash)
|
|
60
|
+
}
|
|
61
|
+
if (transactions.length < 10_000) {
|
|
62
|
+
break
|
|
63
|
+
}
|
|
64
|
+
const maxTxBlockNumber = transactions.reduce(
|
|
65
|
+
(max, { blockNumber }) =>
|
|
66
|
+
max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
|
|
67
|
+
0n,
|
|
68
|
+
)
|
|
69
|
+
if (maxTxBlockNumber === 0n || maxTxBlockNumber === mut_startBlock) {
|
|
70
|
+
break
|
|
71
|
+
}
|
|
72
|
+
mut_startBlock = maxTxBlockNumber
|
|
73
|
+
}
|
|
74
|
+
return [...hashSet]
|
|
75
|
+
},
|
|
76
|
+
getAddressInternalTransactions: async ({
|
|
77
|
+
address,
|
|
78
|
+
startBlock,
|
|
79
|
+
endBlock,
|
|
80
|
+
nativeCurrency,
|
|
81
|
+
logger,
|
|
82
|
+
}) => {
|
|
83
|
+
const loop = true
|
|
84
|
+
const mut_internalTransactions: InternalTransaction<undefined>[] = []
|
|
85
|
+
let mut_startBlock = startBlock
|
|
86
|
+
while (loop) {
|
|
87
|
+
const transactions = await getInternalTransactionsByAddress({
|
|
88
|
+
apiEndpoint: apiUrl,
|
|
89
|
+
apiKey,
|
|
90
|
+
address,
|
|
91
|
+
startBlock: mut_startBlock,
|
|
92
|
+
endBlock,
|
|
93
|
+
logger,
|
|
94
|
+
})
|
|
95
|
+
for (const transaction of transactions) {
|
|
96
|
+
if (
|
|
97
|
+
mut_internalTransactions.some(
|
|
98
|
+
({ transactionHash, from, to, value }) =>
|
|
99
|
+
transaction.hash === transactionHash &&
|
|
100
|
+
transaction.from === from &&
|
|
101
|
+
transaction.to === to &&
|
|
102
|
+
transaction.value === value,
|
|
103
|
+
)
|
|
104
|
+
) {
|
|
105
|
+
continue
|
|
106
|
+
}
|
|
107
|
+
mut_internalTransactions.push({
|
|
108
|
+
...transaction,
|
|
109
|
+
type: 'InternalTransaction',
|
|
110
|
+
transactionHash: transaction.hash,
|
|
111
|
+
to: transaction.to,
|
|
112
|
+
contractAddress: transaction.contractAddress,
|
|
113
|
+
txType: transaction.type,
|
|
114
|
+
currency: nativeCurrency,
|
|
115
|
+
price: undefined,
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
if (transactions.length < 10_000) {
|
|
119
|
+
break
|
|
120
|
+
}
|
|
121
|
+
const maxTxBlockNumber = transactions.reduce(
|
|
122
|
+
(max, { blockNumber }) =>
|
|
123
|
+
max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
|
|
124
|
+
0n,
|
|
125
|
+
)
|
|
126
|
+
if (maxTxBlockNumber === 0n || maxTxBlockNumber === mut_startBlock) {
|
|
127
|
+
break
|
|
128
|
+
}
|
|
129
|
+
mut_startBlock = maxTxBlockNumber
|
|
130
|
+
}
|
|
131
|
+
return mut_internalTransactions
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
getAddressTokenTransferHashes: async ({
|
|
135
|
+
address,
|
|
136
|
+
startBlock,
|
|
137
|
+
endBlock,
|
|
138
|
+
logger,
|
|
139
|
+
}) => {
|
|
140
|
+
const loop = true
|
|
141
|
+
const hashSet = new Set<LowerHex>()
|
|
142
|
+
|
|
143
|
+
// erc20 transfer
|
|
144
|
+
let mut_erc20StartBlock = startBlock
|
|
145
|
+
while (loop) {
|
|
146
|
+
const transfers = await getErc20TokenTransfersByAddress({
|
|
147
|
+
apiEndpoint: apiUrl,
|
|
148
|
+
apiKey,
|
|
149
|
+
address,
|
|
150
|
+
startBlock: mut_erc20StartBlock,
|
|
151
|
+
endBlock,
|
|
152
|
+
logger,
|
|
153
|
+
})
|
|
154
|
+
for (const { hash } of transfers) {
|
|
155
|
+
hashSet.add(hash)
|
|
156
|
+
}
|
|
157
|
+
if (transfers.length < 10_000) {
|
|
158
|
+
break
|
|
159
|
+
}
|
|
160
|
+
const maxTxBlockNumber = transfers.reduce(
|
|
161
|
+
(max, { blockNumber }) =>
|
|
162
|
+
max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
|
|
163
|
+
0n,
|
|
164
|
+
)
|
|
165
|
+
if (
|
|
166
|
+
maxTxBlockNumber === 0n ||
|
|
167
|
+
maxTxBlockNumber === mut_erc20StartBlock
|
|
168
|
+
) {
|
|
169
|
+
break
|
|
170
|
+
}
|
|
171
|
+
mut_erc20StartBlock = maxTxBlockNumber
|
|
172
|
+
}
|
|
173
|
+
// erc721 transfer
|
|
174
|
+
let mut_erc721StartBlock = startBlock
|
|
175
|
+
while (loop) {
|
|
176
|
+
const transfers = await getErc721TokenTransfersByAddress({
|
|
177
|
+
apiEndpoint: apiUrl,
|
|
178
|
+
apiKey,
|
|
179
|
+
address,
|
|
180
|
+
startBlock: mut_erc721StartBlock,
|
|
181
|
+
endBlock,
|
|
182
|
+
logger,
|
|
183
|
+
})
|
|
184
|
+
for (const { hash } of transfers) {
|
|
185
|
+
hashSet.add(hash)
|
|
186
|
+
}
|
|
187
|
+
if (transfers.length < 10_000) {
|
|
188
|
+
break
|
|
189
|
+
}
|
|
190
|
+
const maxTxBlockNumber = transfers.reduce(
|
|
191
|
+
(max, { blockNumber }) =>
|
|
192
|
+
max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
|
|
193
|
+
0n,
|
|
194
|
+
)
|
|
195
|
+
if (
|
|
196
|
+
maxTxBlockNumber === 0n ||
|
|
197
|
+
maxTxBlockNumber === mut_erc721StartBlock
|
|
198
|
+
) {
|
|
199
|
+
break
|
|
200
|
+
}
|
|
201
|
+
mut_erc721StartBlock = maxTxBlockNumber
|
|
202
|
+
}
|
|
203
|
+
// erc1155 transfer
|
|
204
|
+
let mut_erc1155StartBlock = startBlock
|
|
205
|
+
while (loop) {
|
|
206
|
+
const transfers = await getErc1155TokenTransfersByAddress({
|
|
207
|
+
apiEndpoint: apiUrl,
|
|
208
|
+
apiKey,
|
|
209
|
+
address,
|
|
210
|
+
startBlock: mut_erc1155StartBlock,
|
|
211
|
+
endBlock,
|
|
212
|
+
logger,
|
|
213
|
+
})
|
|
214
|
+
for (const { hash } of transfers) {
|
|
215
|
+
hashSet.add(hash)
|
|
216
|
+
}
|
|
217
|
+
if (transfers.length < 10_000) {
|
|
218
|
+
break
|
|
219
|
+
}
|
|
220
|
+
const maxTxBlockNumber = transfers.reduce(
|
|
221
|
+
(max, { blockNumber }) =>
|
|
222
|
+
max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
|
|
223
|
+
0n,
|
|
224
|
+
)
|
|
225
|
+
if (
|
|
226
|
+
maxTxBlockNumber === 0n ||
|
|
227
|
+
maxTxBlockNumber === mut_erc1155StartBlock
|
|
228
|
+
) {
|
|
229
|
+
break
|
|
230
|
+
}
|
|
231
|
+
mut_erc1155StartBlock = maxTxBlockNumber
|
|
232
|
+
}
|
|
233
|
+
return [...hashSet]
|
|
234
|
+
},
|
|
235
|
+
getBlockNumberOfTimestamp: async (timestamp, logger?: Logger) =>
|
|
236
|
+
await getBlockNumberOfTimestamp({
|
|
237
|
+
apiEndpoint: apiUrl,
|
|
238
|
+
apiKey,
|
|
239
|
+
timestamp,
|
|
240
|
+
logger,
|
|
241
|
+
}),
|
|
242
|
+
getContract: async (address, logger?: Logger) => {
|
|
243
|
+
const contract = await getContractByAddress({
|
|
244
|
+
apiEndpoint: apiUrl,
|
|
245
|
+
apiKey,
|
|
246
|
+
address,
|
|
247
|
+
logger,
|
|
248
|
+
})
|
|
249
|
+
if (contract === undefined) {
|
|
250
|
+
return
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
name: contract.ContractName,
|
|
254
|
+
abi: contract.ABI,
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
getInternalTransactionOfTransaction: async ({
|
|
258
|
+
hash,
|
|
259
|
+
nativeCurrency,
|
|
260
|
+
logger,
|
|
261
|
+
}) => {
|
|
262
|
+
const transactions = await getInternalTransactionsByTransactionHash({
|
|
263
|
+
apiEndpoint: apiUrl,
|
|
264
|
+
apiKey,
|
|
265
|
+
transactionHash: hash,
|
|
266
|
+
logger,
|
|
267
|
+
})
|
|
268
|
+
return transactions.map((transaction) => ({
|
|
269
|
+
...transaction,
|
|
270
|
+
type: 'InternalTransaction',
|
|
271
|
+
transactionHash: hash,
|
|
272
|
+
to: transaction.to,
|
|
273
|
+
contractAddress: transaction.contractAddress,
|
|
274
|
+
txType: transaction.type,
|
|
275
|
+
currency: nativeCurrency,
|
|
276
|
+
price: undefined,
|
|
277
|
+
}))
|
|
278
|
+
},
|
|
279
|
+
})
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { Hex } from 'viem'
|
|
2
|
+
import {
|
|
3
|
+
getInternalTransactionByHash,
|
|
4
|
+
getNormalTransactionsByAddress,
|
|
5
|
+
getTokenTransfersByAddress,
|
|
6
|
+
} from '../externals/roninExplorer'
|
|
7
|
+
import { defineExplorer } from './defineExplorer'
|
|
8
|
+
|
|
9
|
+
type CreateRoninExplorerParameters<
|
|
10
|
+
TName extends string,
|
|
11
|
+
TUrl extends string,
|
|
12
|
+
TApiUrl extends string,
|
|
13
|
+
> = {
|
|
14
|
+
readonly name: TName
|
|
15
|
+
readonly url: TUrl
|
|
16
|
+
readonly apiUrl: TApiUrl
|
|
17
|
+
readonly apiKey: string
|
|
18
|
+
readonly explorerApiUrl: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const createRoninExplorer = <
|
|
22
|
+
TName extends string,
|
|
23
|
+
TUrl extends string,
|
|
24
|
+
TApiUrl extends string,
|
|
25
|
+
>({
|
|
26
|
+
name,
|
|
27
|
+
url,
|
|
28
|
+
apiUrl,
|
|
29
|
+
apiKey,
|
|
30
|
+
explorerApiUrl,
|
|
31
|
+
}: CreateRoninExplorerParameters<TName, TUrl, TApiUrl>) =>
|
|
32
|
+
defineExplorer({
|
|
33
|
+
name,
|
|
34
|
+
url,
|
|
35
|
+
apiUrl,
|
|
36
|
+
getAddressTransactionHashes: async ({
|
|
37
|
+
address,
|
|
38
|
+
startBlock,
|
|
39
|
+
endBlock,
|
|
40
|
+
logger,
|
|
41
|
+
}) => {
|
|
42
|
+
const hashSet = new Set<Hex>()
|
|
43
|
+
let mut_from = 0
|
|
44
|
+
while (mut_from >= 0) {
|
|
45
|
+
const { total, transactions } = await getNormalTransactionsByAddress({
|
|
46
|
+
apiEndpoint: explorerApiUrl,
|
|
47
|
+
address,
|
|
48
|
+
size: 100,
|
|
49
|
+
from: mut_from,
|
|
50
|
+
logger,
|
|
51
|
+
})
|
|
52
|
+
for (const transaction of transactions) {
|
|
53
|
+
if (
|
|
54
|
+
startBlock !== undefined &&
|
|
55
|
+
BigInt(transaction.block_number) < startBlock
|
|
56
|
+
) {
|
|
57
|
+
return [...hashSet]
|
|
58
|
+
}
|
|
59
|
+
if (
|
|
60
|
+
endBlock === undefined ||
|
|
61
|
+
BigInt(transaction.block_number) <= endBlock
|
|
62
|
+
) {
|
|
63
|
+
hashSet.add(transaction.hash)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
mut_from += transactions.length
|
|
67
|
+
if (mut_from + transactions.length >= total) {
|
|
68
|
+
break
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return [...hashSet]
|
|
72
|
+
},
|
|
73
|
+
getAddressInternalTransactions: ({ logger }) => {
|
|
74
|
+
if (logger !== undefined) {
|
|
75
|
+
logger.info('getAddressInternalTransactions is not implemented')
|
|
76
|
+
}
|
|
77
|
+
return Promise.resolve([])
|
|
78
|
+
},
|
|
79
|
+
getAddressTokenTransferHashes: async ({
|
|
80
|
+
address,
|
|
81
|
+
startBlock,
|
|
82
|
+
endBlock,
|
|
83
|
+
logger,
|
|
84
|
+
}) => {
|
|
85
|
+
const hashSet = new Set<Hex>()
|
|
86
|
+
let mut_from = 0
|
|
87
|
+
while (mut_from >= 0) {
|
|
88
|
+
const { total, transfers } = await getTokenTransfersByAddress({
|
|
89
|
+
apiEndpoint: explorerApiUrl,
|
|
90
|
+
address,
|
|
91
|
+
size: 100,
|
|
92
|
+
from: mut_from,
|
|
93
|
+
logger,
|
|
94
|
+
})
|
|
95
|
+
for (const transfer of transfers) {
|
|
96
|
+
if (
|
|
97
|
+
startBlock !== undefined &&
|
|
98
|
+
BigInt(transfer.block_number) < startBlock
|
|
99
|
+
) {
|
|
100
|
+
return [...hashSet]
|
|
101
|
+
}
|
|
102
|
+
if (
|
|
103
|
+
endBlock === undefined ||
|
|
104
|
+
BigInt(transfer.block_number) <= endBlock
|
|
105
|
+
) {
|
|
106
|
+
hashSet.add(transfer.tx_hash)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
mut_from += transfers.length
|
|
110
|
+
if (mut_from + transfers.length >= total) {
|
|
111
|
+
break
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return [...hashSet]
|
|
115
|
+
},
|
|
116
|
+
getBlockNumberOfTimestamp: () => {
|
|
117
|
+
throw new Error('getBlockNumberOfTimestamp is not implemented')
|
|
118
|
+
},
|
|
119
|
+
getContract: (_, logger) => {
|
|
120
|
+
if (logger !== undefined) {
|
|
121
|
+
logger.info('getContract is not implemented')
|
|
122
|
+
}
|
|
123
|
+
return Promise.resolve(undefined)
|
|
124
|
+
},
|
|
125
|
+
getInternalTransactionOfTransaction: async ({
|
|
126
|
+
hash,
|
|
127
|
+
nativeCurrency,
|
|
128
|
+
logger,
|
|
129
|
+
}) => {
|
|
130
|
+
const { transactions } = await getInternalTransactionByHash({
|
|
131
|
+
apiEndpoint: apiUrl,
|
|
132
|
+
apiKey,
|
|
133
|
+
hash,
|
|
134
|
+
logger,
|
|
135
|
+
})
|
|
136
|
+
return transactions.map((transaction) => ({
|
|
137
|
+
...transaction,
|
|
138
|
+
type: 'InternalTransaction',
|
|
139
|
+
transactionHash: hash,
|
|
140
|
+
to: transaction.to,
|
|
141
|
+
contractAddress: undefined,
|
|
142
|
+
txType: transaction.tx_type,
|
|
143
|
+
gas: 0n,
|
|
144
|
+
gasUsed: 0n,
|
|
145
|
+
isError: transaction.success,
|
|
146
|
+
currency: nativeCurrency,
|
|
147
|
+
price: undefined,
|
|
148
|
+
}))
|
|
149
|
+
},
|
|
150
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineExplorer } from './defineExplorer'
|
|
2
|
+
|
|
3
|
+
type CreateRoutescanExplorerParameters<
|
|
4
|
+
TName extends string,
|
|
5
|
+
TUrl extends string,
|
|
6
|
+
TApiUrl extends string,
|
|
7
|
+
> = {
|
|
8
|
+
readonly name: TName
|
|
9
|
+
readonly url: TUrl
|
|
10
|
+
readonly apiUrl: TApiUrl
|
|
11
|
+
readonly apiKey: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const createRoutescan = <
|
|
15
|
+
TName extends string,
|
|
16
|
+
TUrl extends string,
|
|
17
|
+
TApiUrl extends string,
|
|
18
|
+
>({
|
|
19
|
+
name,
|
|
20
|
+
url,
|
|
21
|
+
apiUrl,
|
|
22
|
+
}: CreateRoutescanExplorerParameters<TName, TUrl, TApiUrl>) =>
|
|
23
|
+
defineExplorer({
|
|
24
|
+
name,
|
|
25
|
+
url,
|
|
26
|
+
apiUrl,
|
|
27
|
+
getAddressTransactionHashes: async () => {
|
|
28
|
+
// TODO implement
|
|
29
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
30
|
+
throw new Error('not implemented')
|
|
31
|
+
},
|
|
32
|
+
getAddressInternalTransactions: async () => {
|
|
33
|
+
// TODO implement
|
|
34
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
35
|
+
throw new Error('not implemented')
|
|
36
|
+
},
|
|
37
|
+
getAddressTokenTransferHashes: async () => {
|
|
38
|
+
// TODO implement
|
|
39
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
40
|
+
throw new Error('not implemented')
|
|
41
|
+
},
|
|
42
|
+
getBlockNumberOfTimestamp: async () => {
|
|
43
|
+
// TODO implement
|
|
44
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
45
|
+
throw new Error('not implemented')
|
|
46
|
+
},
|
|
47
|
+
getContract: async () => {
|
|
48
|
+
// TODO implement
|
|
49
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
50
|
+
throw new Error('not implemented')
|
|
51
|
+
},
|
|
52
|
+
getInternalTransactionOfTransaction: async () => {
|
|
53
|
+
// TODO implement
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
55
|
+
throw new Error('not implemented')
|
|
56
|
+
},
|
|
57
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Logger } from '@0xtorch/core'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
import { createBlockscoutClient } from './middleware'
|
|
4
|
+
|
|
5
|
+
type GetBlockNumberOfTimestampParameters = {
|
|
6
|
+
readonly apiEndpoint: string
|
|
7
|
+
readonly timestamp: number
|
|
8
|
+
readonly closest?: 'before' | 'after'
|
|
9
|
+
readonly logger?: Logger
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const responseSchema = z.object({
|
|
13
|
+
status: z.string(),
|
|
14
|
+
message: z.string(),
|
|
15
|
+
result: z
|
|
16
|
+
.union([
|
|
17
|
+
z.object({
|
|
18
|
+
blockNumber: z.string().regex(/^\d+$/).transform(BigInt),
|
|
19
|
+
}),
|
|
20
|
+
z.string(),
|
|
21
|
+
])
|
|
22
|
+
.nullable(),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/** {@link https://docs.blockscout.com/for-users/api/rpc-endpoints/block#get-block-number-by-time-stamp} */
|
|
26
|
+
export const getBlockNumberOfTimestamp = async ({
|
|
27
|
+
apiEndpoint,
|
|
28
|
+
timestamp,
|
|
29
|
+
closest = 'before',
|
|
30
|
+
logger,
|
|
31
|
+
}: GetBlockNumberOfTimestampParameters): Promise<bigint> => {
|
|
32
|
+
try {
|
|
33
|
+
const { status, message, result } = await createBlockscoutClient(
|
|
34
|
+
apiEndpoint,
|
|
35
|
+
).get(
|
|
36
|
+
'',
|
|
37
|
+
{
|
|
38
|
+
module: 'block',
|
|
39
|
+
action: 'getblocknobytime',
|
|
40
|
+
timestamp: timestamp.toString(),
|
|
41
|
+
closest,
|
|
42
|
+
},
|
|
43
|
+
responseSchema,
|
|
44
|
+
logger,
|
|
45
|
+
)
|
|
46
|
+
if (status !== '1' || result === null) {
|
|
47
|
+
const error =
|
|
48
|
+
typeof result === 'string' ? new Error(result) : new Error(message)
|
|
49
|
+
throw error
|
|
50
|
+
}
|
|
51
|
+
if (typeof result === 'string') {
|
|
52
|
+
throw new TypeError(result)
|
|
53
|
+
}
|
|
54
|
+
return result.blockNumber
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error instanceof Error && error.message === 'Max rate limit reached') {
|
|
57
|
+
await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
58
|
+
return await getBlockNumberOfTimestamp({
|
|
59
|
+
apiEndpoint,
|
|
60
|
+
timestamp,
|
|
61
|
+
closest,
|
|
62
|
+
logger,
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
throw error
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Logger } from '@0xtorch/core'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
import type { Hex } from '../../../types'
|
|
4
|
+
import { createBlockscoutClient } from './middleware'
|
|
5
|
+
|
|
6
|
+
type GetContractByAddressParameters = {
|
|
7
|
+
readonly apiEndpoint: string
|
|
8
|
+
readonly address: Hex
|
|
9
|
+
readonly logger?: Logger
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const sourceCodeSchema = z.object({
|
|
13
|
+
ABI: z.string(),
|
|
14
|
+
ContractName: z.string(),
|
|
15
|
+
CompilerVersion: z.string(),
|
|
16
|
+
OptimizationUsed: z.string(),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const responseSchema = z.object({
|
|
20
|
+
status: z.string(),
|
|
21
|
+
message: z.string(),
|
|
22
|
+
result: z
|
|
23
|
+
.union([
|
|
24
|
+
z.array(sourceCodeSchema),
|
|
25
|
+
z.array(z.object({})).transform(() => undefined),
|
|
26
|
+
z.string(),
|
|
27
|
+
])
|
|
28
|
+
.nullable(),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
type SourceCode = Readonly<z.infer<typeof sourceCodeSchema>>
|
|
32
|
+
type ReturnType = SourceCode | undefined
|
|
33
|
+
|
|
34
|
+
/** {@link https://docs.blockscout.com/for-users/api/rpc-endpoints/contract#get-contract-source-code-for-a-verified-contract} */
|
|
35
|
+
export const getContractByAddress = async ({
|
|
36
|
+
apiEndpoint,
|
|
37
|
+
address,
|
|
38
|
+
logger,
|
|
39
|
+
}: GetContractByAddressParameters): Promise<ReturnType> => {
|
|
40
|
+
try {
|
|
41
|
+
const { status, message, result } = await createBlockscoutClient(
|
|
42
|
+
apiEndpoint,
|
|
43
|
+
).get(
|
|
44
|
+
'',
|
|
45
|
+
{
|
|
46
|
+
module: 'contract',
|
|
47
|
+
action: 'getsourcecode',
|
|
48
|
+
address,
|
|
49
|
+
},
|
|
50
|
+
responseSchema,
|
|
51
|
+
logger,
|
|
52
|
+
)
|
|
53
|
+
if (status !== '1' || result === null) {
|
|
54
|
+
const error =
|
|
55
|
+
typeof result === 'string' ? new Error(result) : new Error(message)
|
|
56
|
+
throw error
|
|
57
|
+
}
|
|
58
|
+
if (typeof result === 'string') {
|
|
59
|
+
throw new TypeError(result)
|
|
60
|
+
}
|
|
61
|
+
if (result === undefined || result.length === 0) {
|
|
62
|
+
return undefined
|
|
63
|
+
}
|
|
64
|
+
const contract = result[0]
|
|
65
|
+
|
|
66
|
+
if (contract.ABI === 'Contract source code not verified') {
|
|
67
|
+
return undefined
|
|
68
|
+
}
|
|
69
|
+
return contract
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error instanceof Error && error.message === 'Max rate limit reached') {
|
|
72
|
+
await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
73
|
+
return await getContractByAddress({
|
|
74
|
+
apiEndpoint,
|
|
75
|
+
address,
|
|
76
|
+
logger,
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
throw error
|
|
80
|
+
}
|
|
81
|
+
}
|