@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,716 @@
|
|
|
1
|
+
import type { Config } from '@0xtorch/core'
|
|
2
|
+
import { rest } from '@0xtorch/core'
|
|
3
|
+
import type { Log } from 'viem'
|
|
4
|
+
import {
|
|
5
|
+
decodeFunctionData,
|
|
6
|
+
getAbiItem,
|
|
7
|
+
parseEventLogs,
|
|
8
|
+
zeroAddress,
|
|
9
|
+
} from 'viem'
|
|
10
|
+
import { z } from 'zod'
|
|
11
|
+
import { erc1155Abi, erc20Abi, erc721Abi, wethAbi } from '../abis'
|
|
12
|
+
import type { Chain } from '../chains'
|
|
13
|
+
import type {
|
|
14
|
+
Erc1155Transfer,
|
|
15
|
+
Erc20Token,
|
|
16
|
+
Erc20Transfer,
|
|
17
|
+
Erc721Token,
|
|
18
|
+
Erc721Transfer,
|
|
19
|
+
Hex,
|
|
20
|
+
InputData,
|
|
21
|
+
LogData,
|
|
22
|
+
LowerHex,
|
|
23
|
+
TransactionDecoded,
|
|
24
|
+
} from '../types'
|
|
25
|
+
import { parsedLogSchema, toLowerHex } from '../types'
|
|
26
|
+
import { checkTimeout } from '../utils'
|
|
27
|
+
import { parseErc1155TransferSingleLogs } from './parseErc1155TransferSingleLogs'
|
|
28
|
+
import { parseErc20TransferLogs } from './parseErc20TransferLogs'
|
|
29
|
+
import { parseErc721TransferLogs } from './parseErc721TransferLogs'
|
|
30
|
+
import type { Decode } from './types'
|
|
31
|
+
|
|
32
|
+
export const decode: Decode = async (
|
|
33
|
+
{ chain, transactions },
|
|
34
|
+
config?: Config,
|
|
35
|
+
) => {
|
|
36
|
+
const timeoutTimestamp =
|
|
37
|
+
Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
|
|
38
|
+
|
|
39
|
+
// transactions の erc20,721,1155 transfer 生成
|
|
40
|
+
const txsTransfers = transactions.map(({ logs }) =>
|
|
41
|
+
getErcTransfers(chain, logs),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
// erc20 token 情報を取得する
|
|
45
|
+
const erc20TokenAddresses = [
|
|
46
|
+
...new Set(
|
|
47
|
+
txsTransfers.flatMap(({ erc20Transfers }) =>
|
|
48
|
+
erc20Transfers.map(({ contractAddress }) => contractAddress),
|
|
49
|
+
),
|
|
50
|
+
),
|
|
51
|
+
]
|
|
52
|
+
const coins =
|
|
53
|
+
erc20TokenAddresses.length > 0
|
|
54
|
+
? await getCoingeckoCoinsList({
|
|
55
|
+
logger: config?.logger,
|
|
56
|
+
timeout: timeoutTimestamp - Date.now(),
|
|
57
|
+
})
|
|
58
|
+
: []
|
|
59
|
+
const timeoutForGetErc20Tokens = timeoutTimestamp - Date.now()
|
|
60
|
+
const erc20Tokens = await Promise.all(
|
|
61
|
+
erc20TokenAddresses.map((address) =>
|
|
62
|
+
getErc20Token(chain, address, coins, {
|
|
63
|
+
timeout: timeoutForGetErc20Tokens,
|
|
64
|
+
logger: config?.logger,
|
|
65
|
+
}),
|
|
66
|
+
),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
// erc721 token 情報を取得する
|
|
70
|
+
const erc721TokenAddresses = [
|
|
71
|
+
...new Set(
|
|
72
|
+
txsTransfers.flatMap(({ erc721Transfers }) =>
|
|
73
|
+
erc721Transfers.map(({ contractAddress }) => contractAddress),
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
]
|
|
77
|
+
const timeoutForGetErc721Tokens = timeoutTimestamp - Date.now()
|
|
78
|
+
const erc721Tokens = await Promise.all(
|
|
79
|
+
erc721TokenAddresses.map((address) =>
|
|
80
|
+
getErc721Token(chain, address, {
|
|
81
|
+
timeout: timeoutForGetErc721Tokens,
|
|
82
|
+
logger: config?.logger,
|
|
83
|
+
}),
|
|
84
|
+
),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
// transactions から contract address を抽出
|
|
88
|
+
const addresses = [
|
|
89
|
+
...new Set(
|
|
90
|
+
transactions.flatMap(({ to, logs }) => [
|
|
91
|
+
...(to === null ? [] : [toLowerHex(to)]),
|
|
92
|
+
...logs.map(({ address }) => toLowerHex(address)),
|
|
93
|
+
]),
|
|
94
|
+
),
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
// contract address から abi を取得
|
|
98
|
+
const contracts = await getContracts(chain, addresses, {
|
|
99
|
+
timeout: timeoutTimestamp - Date.now(),
|
|
100
|
+
logger: config?.logger,
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
const transactionDecodeds = transactions.map(
|
|
104
|
+
(transaction, index): TransactionDecoded<undefined> => {
|
|
105
|
+
const { to, input, logs } = transaction
|
|
106
|
+
const { erc20Transfers, erc721Transfers, erc1155Transfers } =
|
|
107
|
+
txsTransfers[index]
|
|
108
|
+
const inputData =
|
|
109
|
+
to === null
|
|
110
|
+
? undefined
|
|
111
|
+
: {
|
|
112
|
+
address: to,
|
|
113
|
+
data: input,
|
|
114
|
+
}
|
|
115
|
+
const decodedInput =
|
|
116
|
+
inputData === undefined
|
|
117
|
+
? undefined
|
|
118
|
+
: decodeInput(
|
|
119
|
+
inputData,
|
|
120
|
+
contracts[addresses.indexOf(toLowerHex(inputData.address))],
|
|
121
|
+
)
|
|
122
|
+
return {
|
|
123
|
+
...transaction,
|
|
124
|
+
function:
|
|
125
|
+
decodedInput?.type === 'decoded' ? decodedInput.function : undefined,
|
|
126
|
+
erc20Transfers: erc20Transfers
|
|
127
|
+
.filter((transfer) =>
|
|
128
|
+
erc20Tokens.some(
|
|
129
|
+
(token) => token?.contractAddress === transfer.contractAddress,
|
|
130
|
+
),
|
|
131
|
+
)
|
|
132
|
+
.map((transfer) => ({
|
|
133
|
+
type: transfer.type,
|
|
134
|
+
logIndex: transfer.logIndex,
|
|
135
|
+
token: erc20Tokens.find(
|
|
136
|
+
(token) => token?.contractAddress === transfer.contractAddress,
|
|
137
|
+
)!,
|
|
138
|
+
from: transfer.from,
|
|
139
|
+
to: transfer.to,
|
|
140
|
+
value: transfer.value,
|
|
141
|
+
price: undefined,
|
|
142
|
+
})),
|
|
143
|
+
erc721Transfers: erc721Transfers
|
|
144
|
+
.filter((transfer) =>
|
|
145
|
+
erc721Tokens.some(
|
|
146
|
+
(token) => token?.contractAddress === transfer.contractAddress,
|
|
147
|
+
),
|
|
148
|
+
)
|
|
149
|
+
.map((transfer) => ({
|
|
150
|
+
type: transfer.type,
|
|
151
|
+
logIndex: transfer.logIndex,
|
|
152
|
+
token: erc721Tokens.find(
|
|
153
|
+
(token) => token?.contractAddress === transfer.contractAddress,
|
|
154
|
+
)!,
|
|
155
|
+
from: transfer.from,
|
|
156
|
+
to: transfer.to,
|
|
157
|
+
tokenId: transfer.tokenId,
|
|
158
|
+
nft: transfer.nft,
|
|
159
|
+
})),
|
|
160
|
+
erc1155Transfers,
|
|
161
|
+
logs: logs.map((log) =>
|
|
162
|
+
decodeLog(log, contracts[addresses.indexOf(toLowerHex(log.address))]),
|
|
163
|
+
),
|
|
164
|
+
app: undefined,
|
|
165
|
+
nativeTokenPrice: undefined,
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
transactions: transactionDecodeds,
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
type ContractByExplorer =
|
|
176
|
+
| {
|
|
177
|
+
readonly name: string
|
|
178
|
+
readonly abi: unknown[]
|
|
179
|
+
}
|
|
180
|
+
| undefined
|
|
181
|
+
|
|
182
|
+
const getContracts = async (
|
|
183
|
+
chain: Chain,
|
|
184
|
+
addresses: readonly LowerHex[],
|
|
185
|
+
config?: Config,
|
|
186
|
+
): Promise<readonly ContractByExplorer[]> => {
|
|
187
|
+
const timeoutTimestamp =
|
|
188
|
+
Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
|
|
189
|
+
|
|
190
|
+
const mut_contracts: ContractByExplorer[] = []
|
|
191
|
+
for (const address of addresses) {
|
|
192
|
+
const contract = await chain.explorer.getContract(address, config?.logger)
|
|
193
|
+
checkTimeout(timeoutTimestamp)
|
|
194
|
+
if (contract === undefined) {
|
|
195
|
+
mut_contracts.push(undefined)
|
|
196
|
+
continue
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const abi = z.array(z.unknown()).parse(JSON.parse(contract.abi))
|
|
200
|
+
mut_contracts.push({
|
|
201
|
+
name: contract.name,
|
|
202
|
+
abi,
|
|
203
|
+
})
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.debug(error)
|
|
206
|
+
mut_contracts.push(undefined)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return mut_contracts
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const getErcTransfers = (
|
|
213
|
+
chain: Chain,
|
|
214
|
+
logs: readonly Log<bigint, number, false>[],
|
|
215
|
+
): {
|
|
216
|
+
readonly erc20Transfers: readonly (Omit<Erc20Transfer, 'token'> & {
|
|
217
|
+
readonly contractAddress: LowerHex
|
|
218
|
+
})[]
|
|
219
|
+
readonly erc721Transfers: readonly (Omit<Erc721Transfer, 'token'> & {
|
|
220
|
+
readonly contractAddress: LowerHex
|
|
221
|
+
})[]
|
|
222
|
+
readonly erc1155Transfers: readonly Erc1155Transfer[]
|
|
223
|
+
} => {
|
|
224
|
+
const erc20Logs = parseErc20TransferLogs(logs)
|
|
225
|
+
const erc721Logs = parseErc721TransferLogs(chain.id, logs)
|
|
226
|
+
const erc1155SingleLogs = parseErc1155TransferSingleLogs(chain.id, logs)
|
|
227
|
+
const transferBatchSignature =
|
|
228
|
+
'0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb'
|
|
229
|
+
const erc1155BatchLogs = parseEventLogs({
|
|
230
|
+
abi: erc1155Abi,
|
|
231
|
+
logs: logs.filter((log) => log.topics[0] === transferBatchSignature),
|
|
232
|
+
eventName: ['TransferBatch'],
|
|
233
|
+
})
|
|
234
|
+
// wrapped token の deposit , withdraw を ERC20 transfer として処理できるようにする
|
|
235
|
+
const wrappedLogs = parseEventLogs({
|
|
236
|
+
abi: wethAbi,
|
|
237
|
+
logs: logs.filter((log) => isWrappedTokenLog(chain, log)),
|
|
238
|
+
eventName: ['Deposit', 'Withdrawal'],
|
|
239
|
+
})
|
|
240
|
+
return {
|
|
241
|
+
erc20Transfers: [
|
|
242
|
+
...erc20Logs,
|
|
243
|
+
...wrappedLogs.map((log) =>
|
|
244
|
+
log.eventName === 'Deposit'
|
|
245
|
+
? {
|
|
246
|
+
type: 'Erc20Transfer' as const,
|
|
247
|
+
logIndex: log.logIndex,
|
|
248
|
+
contractAddress: toLowerHex(log.address),
|
|
249
|
+
from: zeroAddress,
|
|
250
|
+
to: toLowerHex(log.args.dst),
|
|
251
|
+
value: log.args.wad,
|
|
252
|
+
price: undefined,
|
|
253
|
+
}
|
|
254
|
+
: {
|
|
255
|
+
type: 'Erc20Transfer' as const,
|
|
256
|
+
logIndex: log.logIndex,
|
|
257
|
+
contractAddress: toLowerHex(log.address),
|
|
258
|
+
from: toLowerHex(log.args.src),
|
|
259
|
+
to: zeroAddress,
|
|
260
|
+
value: log.args.wad,
|
|
261
|
+
price: undefined,
|
|
262
|
+
},
|
|
263
|
+
),
|
|
264
|
+
].sort((a, b) => a.logIndex - b.logIndex),
|
|
265
|
+
erc721Transfers: erc721Logs,
|
|
266
|
+
erc1155Transfers: [
|
|
267
|
+
...erc1155SingleLogs,
|
|
268
|
+
...erc1155BatchLogs.flatMap((log) =>
|
|
269
|
+
log.args.ids.map(
|
|
270
|
+
(id, index): Erc1155Transfer => ({
|
|
271
|
+
type: 'Erc1155Transfer',
|
|
272
|
+
logIndex: log.logIndex,
|
|
273
|
+
token: {
|
|
274
|
+
contractAddress: toLowerHex(log.address),
|
|
275
|
+
},
|
|
276
|
+
from: toLowerHex(log.args.from),
|
|
277
|
+
to: toLowerHex(log.args.to),
|
|
278
|
+
id: id,
|
|
279
|
+
value: log.args.values[index],
|
|
280
|
+
nft: {
|
|
281
|
+
type: 'Nft',
|
|
282
|
+
id: `evm_${chain.id}_${toLowerHex(log.address)}_${id.toString()}`,
|
|
283
|
+
},
|
|
284
|
+
}),
|
|
285
|
+
),
|
|
286
|
+
),
|
|
287
|
+
],
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const isWrappedTokenLog = (
|
|
292
|
+
chain: Chain,
|
|
293
|
+
log: Log<bigint, number, false>,
|
|
294
|
+
): boolean => {
|
|
295
|
+
switch (chain.id) {
|
|
296
|
+
// Ethereum
|
|
297
|
+
case 1: {
|
|
298
|
+
return (
|
|
299
|
+
log.address.toLowerCase() ===
|
|
300
|
+
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
// Optimism
|
|
304
|
+
case 10: {
|
|
305
|
+
return (
|
|
306
|
+
log.address.toLowerCase() ===
|
|
307
|
+
'0x4200000000000000000000000000000000000006'
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
// BNB Smart Chain
|
|
311
|
+
case 56: {
|
|
312
|
+
return (
|
|
313
|
+
log.address.toLowerCase() ===
|
|
314
|
+
'0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
// Polygon PoS
|
|
318
|
+
case 137: {
|
|
319
|
+
return (
|
|
320
|
+
log.address.toLowerCase() ===
|
|
321
|
+
'0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
// Fantom
|
|
325
|
+
case 250: {
|
|
326
|
+
return (
|
|
327
|
+
log.address.toLowerCase() ===
|
|
328
|
+
'0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83'
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
// Astar (EVM)
|
|
332
|
+
case 592: {
|
|
333
|
+
return (
|
|
334
|
+
log.address.toLowerCase() ===
|
|
335
|
+
'0xaeaaf0e2c81af264101b9129c00f4440ccf0f720'
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
// Metis
|
|
339
|
+
case 1088: {
|
|
340
|
+
return (
|
|
341
|
+
log.address.toLowerCase() ===
|
|
342
|
+
'0x75cb093e4d61d2a2e65d8e0bbb01de8d89b53481'
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
// Moonbeam
|
|
346
|
+
case 1284: {
|
|
347
|
+
return (
|
|
348
|
+
log.address.toLowerCase() ===
|
|
349
|
+
'0xacc15dc74880c9944775448304b263d191c6077f'
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
// Moonriver
|
|
353
|
+
case 1285: {
|
|
354
|
+
return (
|
|
355
|
+
log.address.toLowerCase() ===
|
|
356
|
+
'0x98878b06940ae243284ca214f92bb71a2b032b8a'
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
// Ronin
|
|
360
|
+
case 2020: {
|
|
361
|
+
return (
|
|
362
|
+
log.address.toLowerCase() ===
|
|
363
|
+
'0xe514d9deb7966c8be0ca922de8a064264ea6bcd4'
|
|
364
|
+
)
|
|
365
|
+
}
|
|
366
|
+
// Mantle
|
|
367
|
+
case 5000: {
|
|
368
|
+
return (
|
|
369
|
+
log.address.toLowerCase() ===
|
|
370
|
+
'0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8'
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
// Base
|
|
374
|
+
case 8453: {
|
|
375
|
+
return (
|
|
376
|
+
log.address.toLowerCase() ===
|
|
377
|
+
'0x4200000000000000000000000000000000000006'
|
|
378
|
+
)
|
|
379
|
+
}
|
|
380
|
+
// Arbitrum One
|
|
381
|
+
case 42_161: {
|
|
382
|
+
return (
|
|
383
|
+
log.address.toLowerCase() ===
|
|
384
|
+
'0x82af49447d8a07e3bd95bd0d56f35241523fbab1'
|
|
385
|
+
)
|
|
386
|
+
}
|
|
387
|
+
// Avalanche C-Chain
|
|
388
|
+
case 43_114: {
|
|
389
|
+
return (
|
|
390
|
+
log.address.toLowerCase() ===
|
|
391
|
+
'0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'
|
|
392
|
+
)
|
|
393
|
+
}
|
|
394
|
+
// Linea
|
|
395
|
+
case 59_144: {
|
|
396
|
+
return (
|
|
397
|
+
log.address.toLowerCase() ===
|
|
398
|
+
'0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f'
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
default: {
|
|
402
|
+
return false
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
const coingeckoCoinSchema = z.object({
|
|
408
|
+
id: z.string(),
|
|
409
|
+
symbol: z.string(),
|
|
410
|
+
name: z.string(),
|
|
411
|
+
platforms: z.record(z.string()),
|
|
412
|
+
})
|
|
413
|
+
const coingeckoCoinsSchema = z.array(coingeckoCoinSchema)
|
|
414
|
+
type CoingeckoCoin = Readonly<z.infer<typeof coingeckoCoinSchema>>
|
|
415
|
+
|
|
416
|
+
const getCoingeckoCoinsList = async (config?: Config) =>
|
|
417
|
+
await rest(
|
|
418
|
+
'https://api.coingecko.com/api/v3/coins/list?include_platform=true',
|
|
419
|
+
{
|
|
420
|
+
schema: coingeckoCoinsSchema,
|
|
421
|
+
timeout: config?.timeout,
|
|
422
|
+
logger: config?.logger,
|
|
423
|
+
},
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
const getErc20Token = async (
|
|
427
|
+
chain: Chain,
|
|
428
|
+
address: LowerHex,
|
|
429
|
+
coingeckoCoins: readonly CoingeckoCoin[],
|
|
430
|
+
config?: Config,
|
|
431
|
+
): Promise<Erc20Token | undefined> => {
|
|
432
|
+
const [nameData, symbolData, decimalsData] = await chain.client.multicall(
|
|
433
|
+
{
|
|
434
|
+
contracts: [
|
|
435
|
+
{
|
|
436
|
+
address,
|
|
437
|
+
abi: erc20Abi,
|
|
438
|
+
functionName: 'name',
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
address,
|
|
442
|
+
abi: erc20Abi,
|
|
443
|
+
functionName: 'symbol',
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
address,
|
|
447
|
+
abi: erc20Abi,
|
|
448
|
+
functionName: 'decimals',
|
|
449
|
+
},
|
|
450
|
+
],
|
|
451
|
+
},
|
|
452
|
+
config,
|
|
453
|
+
)
|
|
454
|
+
if (nameData.status === 'failure') {
|
|
455
|
+
if (config?.logger !== undefined) {
|
|
456
|
+
config.logger.info(
|
|
457
|
+
`Failed to get erc20 token info of ${address} (chain: ${chain.name})`,
|
|
458
|
+
)
|
|
459
|
+
}
|
|
460
|
+
if (
|
|
461
|
+
nameData.error.message.includes('The contract function "name" reverted.')
|
|
462
|
+
) {
|
|
463
|
+
return undefined
|
|
464
|
+
}
|
|
465
|
+
throw nameData.error
|
|
466
|
+
}
|
|
467
|
+
if (symbolData.status === 'failure') {
|
|
468
|
+
if (config?.logger !== undefined) {
|
|
469
|
+
config.logger.info(
|
|
470
|
+
`Failed to get erc20 token info of ${address} (chain: ${chain.name})`,
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
if (
|
|
474
|
+
symbolData.error.message.includes(
|
|
475
|
+
'The contract function "symbol" reverted.',
|
|
476
|
+
)
|
|
477
|
+
) {
|
|
478
|
+
return undefined
|
|
479
|
+
}
|
|
480
|
+
throw symbolData.error
|
|
481
|
+
}
|
|
482
|
+
if (decimalsData.status === 'failure') {
|
|
483
|
+
if (config?.logger !== undefined) {
|
|
484
|
+
config.logger.info(
|
|
485
|
+
`Failed to get erc20 token info of ${address} (chain: ${chain.name})`,
|
|
486
|
+
)
|
|
487
|
+
}
|
|
488
|
+
if (
|
|
489
|
+
decimalsData.error.message.includes(
|
|
490
|
+
'The contract function "decimals" reverted.',
|
|
491
|
+
)
|
|
492
|
+
) {
|
|
493
|
+
return undefined
|
|
494
|
+
}
|
|
495
|
+
if (
|
|
496
|
+
!decimalsData.error.message.includes(
|
|
497
|
+
'The contract function "decimals" returned no data ("0x").',
|
|
498
|
+
)
|
|
499
|
+
) {
|
|
500
|
+
throw decimalsData.error
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
const name = nameData.result
|
|
504
|
+
const symbol = symbolData.result
|
|
505
|
+
const decimals = decimalsData.result ?? 0
|
|
506
|
+
|
|
507
|
+
const coin =
|
|
508
|
+
chain.coingeckoId === undefined
|
|
509
|
+
? undefined
|
|
510
|
+
: coingeckoCoins.find(
|
|
511
|
+
({ platforms }) =>
|
|
512
|
+
platforms[chain.coingeckoId!] !== undefined &&
|
|
513
|
+
platforms[chain.coingeckoId!].toLowerCase() === address,
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
return {
|
|
517
|
+
contractAddress: address,
|
|
518
|
+
name,
|
|
519
|
+
symbol,
|
|
520
|
+
decimals,
|
|
521
|
+
currency: {
|
|
522
|
+
type: 'CryptoCurrency',
|
|
523
|
+
id: coin?.id ?? `evm_${chain.id}_${address}`,
|
|
524
|
+
name: coin?.name ?? name,
|
|
525
|
+
symbol: coin?.symbol.toUpperCase() ?? symbol,
|
|
526
|
+
icon: undefined,
|
|
527
|
+
market: {
|
|
528
|
+
coingeckoId: coin?.id,
|
|
529
|
+
marketCapUsd: undefined,
|
|
530
|
+
},
|
|
531
|
+
updatedAt: Date.now(),
|
|
532
|
+
},
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const getErc721Token = async (
|
|
537
|
+
chain: Chain,
|
|
538
|
+
address: LowerHex,
|
|
539
|
+
config?: Config,
|
|
540
|
+
): Promise<Erc721Token | undefined> => {
|
|
541
|
+
const [nameData, symbolData] = await chain.client.multicall(
|
|
542
|
+
{
|
|
543
|
+
contracts: [
|
|
544
|
+
{
|
|
545
|
+
address,
|
|
546
|
+
abi: erc721Abi,
|
|
547
|
+
functionName: 'name',
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
address,
|
|
551
|
+
abi: erc721Abi,
|
|
552
|
+
functionName: 'symbol',
|
|
553
|
+
},
|
|
554
|
+
],
|
|
555
|
+
},
|
|
556
|
+
config,
|
|
557
|
+
)
|
|
558
|
+
if (nameData.status === 'failure') {
|
|
559
|
+
if (config?.logger !== undefined) {
|
|
560
|
+
config.logger.info(
|
|
561
|
+
`Failed to get erc721 token info of ${address} (chain: ${chain.name})`,
|
|
562
|
+
)
|
|
563
|
+
}
|
|
564
|
+
if (
|
|
565
|
+
nameData.error.message.includes('The contract function "name" reverted.')
|
|
566
|
+
) {
|
|
567
|
+
return undefined
|
|
568
|
+
}
|
|
569
|
+
throw nameData.error
|
|
570
|
+
}
|
|
571
|
+
if (symbolData.status === 'failure') {
|
|
572
|
+
if (config?.logger !== undefined) {
|
|
573
|
+
config.logger.info(
|
|
574
|
+
`Failed to get erc721 token info of ${address} (chain: ${chain.name})`,
|
|
575
|
+
)
|
|
576
|
+
}
|
|
577
|
+
if (
|
|
578
|
+
symbolData.error.message.includes(
|
|
579
|
+
'The contract function "symbol" reverted.',
|
|
580
|
+
)
|
|
581
|
+
) {
|
|
582
|
+
return undefined
|
|
583
|
+
}
|
|
584
|
+
throw symbolData.error
|
|
585
|
+
}
|
|
586
|
+
const name = nameData.result
|
|
587
|
+
const symbol = symbolData.result
|
|
588
|
+
return {
|
|
589
|
+
contractAddress: address,
|
|
590
|
+
name,
|
|
591
|
+
symbol,
|
|
592
|
+
baseUri: undefined,
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const decodeInput = (
|
|
597
|
+
{
|
|
598
|
+
address,
|
|
599
|
+
data,
|
|
600
|
+
}: {
|
|
601
|
+
readonly address: Hex
|
|
602
|
+
readonly data: Hex
|
|
603
|
+
},
|
|
604
|
+
contract: ContractByExplorer | undefined,
|
|
605
|
+
): InputData => {
|
|
606
|
+
const lowerAddress = toLowerHex(address)
|
|
607
|
+
if (contract === undefined) {
|
|
608
|
+
return {
|
|
609
|
+
type: 'original',
|
|
610
|
+
address: lowerAddress,
|
|
611
|
+
data,
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
try {
|
|
615
|
+
const { functionName, args } = decodeFunctionData({
|
|
616
|
+
abi: contract.abi,
|
|
617
|
+
data,
|
|
618
|
+
})
|
|
619
|
+
const abiItem = getAbiItem({
|
|
620
|
+
abi: contract.abi,
|
|
621
|
+
name: functionName,
|
|
622
|
+
})
|
|
623
|
+
if (abiItem?.type !== 'function') {
|
|
624
|
+
return {
|
|
625
|
+
type: 'original',
|
|
626
|
+
address: lowerAddress,
|
|
627
|
+
data,
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return {
|
|
631
|
+
type: 'decoded',
|
|
632
|
+
address: lowerAddress,
|
|
633
|
+
data,
|
|
634
|
+
function: {
|
|
635
|
+
name: functionName,
|
|
636
|
+
args:
|
|
637
|
+
args === undefined
|
|
638
|
+
? undefined
|
|
639
|
+
: args.map((value, index) => ({
|
|
640
|
+
name: abiItem.inputs[index].name ?? '',
|
|
641
|
+
type: abiItem.inputs[index].type,
|
|
642
|
+
value,
|
|
643
|
+
})),
|
|
644
|
+
},
|
|
645
|
+
source: lowerAddress,
|
|
646
|
+
}
|
|
647
|
+
} catch (error) {
|
|
648
|
+
console.debug(error)
|
|
649
|
+
return {
|
|
650
|
+
type: 'original',
|
|
651
|
+
address: lowerAddress,
|
|
652
|
+
data,
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
const decodeLog = (
|
|
658
|
+
log: Log<bigint, number, false>,
|
|
659
|
+
contract: ContractByExplorer | undefined,
|
|
660
|
+
): LogData => {
|
|
661
|
+
const originalLog = {
|
|
662
|
+
type: 'LogOriginal',
|
|
663
|
+
log,
|
|
664
|
+
} as const
|
|
665
|
+
const lowerAddress = toLowerHex(log.address)
|
|
666
|
+
if (contract === undefined) {
|
|
667
|
+
return originalLog
|
|
668
|
+
}
|
|
669
|
+
const parsedLogs = parseEventLogs({
|
|
670
|
+
abi: contract.abi,
|
|
671
|
+
logs: [log],
|
|
672
|
+
})
|
|
673
|
+
if (parsedLogs.length === 0) {
|
|
674
|
+
return originalLog
|
|
675
|
+
}
|
|
676
|
+
try {
|
|
677
|
+
const parsedLog = parsedLogSchema.parse(parsedLogs[0])
|
|
678
|
+
const abiItem = getAbiItem({
|
|
679
|
+
abi: contract.abi,
|
|
680
|
+
name: parsedLog.eventName,
|
|
681
|
+
})
|
|
682
|
+
if (abiItem?.type !== 'event') {
|
|
683
|
+
return originalLog
|
|
684
|
+
}
|
|
685
|
+
const arguments_ = Object.entries(parsedLog.args).map(([name, value]) => {
|
|
686
|
+
const index = abiItem.inputs.findIndex((input) => input.name === name)
|
|
687
|
+
const event = abiItem.inputs[index]
|
|
688
|
+
return {
|
|
689
|
+
name,
|
|
690
|
+
type: event.type,
|
|
691
|
+
value,
|
|
692
|
+
index,
|
|
693
|
+
indexed: event.indexed ?? false,
|
|
694
|
+
}
|
|
695
|
+
})
|
|
696
|
+
return {
|
|
697
|
+
type: 'decoded',
|
|
698
|
+
log: {
|
|
699
|
+
...parsedLog,
|
|
700
|
+
type: 'DecodedLog',
|
|
701
|
+
args: arguments_
|
|
702
|
+
.toSorted((a, b) => a.index - b.index)
|
|
703
|
+
.map((argument) => ({
|
|
704
|
+
indexed: argument.indexed,
|
|
705
|
+
name: argument.name,
|
|
706
|
+
type: argument.type,
|
|
707
|
+
value: argument.value,
|
|
708
|
+
})),
|
|
709
|
+
},
|
|
710
|
+
source: lowerAddress,
|
|
711
|
+
}
|
|
712
|
+
} catch (error) {
|
|
713
|
+
console.debug(error)
|
|
714
|
+
return originalLog
|
|
715
|
+
}
|
|
716
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { decoder } from './decoder'
|
|
2
|
+
export { parseErc1155TransferSingleLogs } from './parseErc1155TransferSingleLogs'
|
|
3
|
+
export { parseErc20TransferLogs } from './parseErc20TransferLogs'
|
|
4
|
+
export { parseErc721TransferLogs } from './parseErc721TransferLogs'
|
|
5
|
+
export type { Decoder } from './types'
|