@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,917 @@
|
|
|
1
|
+
import { createBigDecimal } from '@0xtorch/big-decimal'
|
|
2
|
+
import type {
|
|
3
|
+
AccountActionBuyNft,
|
|
4
|
+
AccountActionNftRoyalty,
|
|
5
|
+
AccountActionSellNft,
|
|
6
|
+
AccountActionSwapNft,
|
|
7
|
+
AccountActionTrade,
|
|
8
|
+
CryptoCurrencyPrice,
|
|
9
|
+
NormalActionTrade,
|
|
10
|
+
} from '@0xtorch/core'
|
|
11
|
+
import type { Chain } from '../../chains'
|
|
12
|
+
import { createEvmAccount } from '../../creates/createEvmAccount'
|
|
13
|
+
import type {
|
|
14
|
+
DecodedLog,
|
|
15
|
+
Erc1155Transfer,
|
|
16
|
+
Erc20Transfer,
|
|
17
|
+
Erc721Transfer,
|
|
18
|
+
EvmAccount,
|
|
19
|
+
InternalTransaction,
|
|
20
|
+
LowerHex,
|
|
21
|
+
TransactionDecoded,
|
|
22
|
+
TransactionSource,
|
|
23
|
+
} from '../../types'
|
|
24
|
+
import { toLowerHex } from '../../types'
|
|
25
|
+
import { analyzeAsSpam } from '../spam'
|
|
26
|
+
import type { AnalyzeParameters, AnalyzeReturnType } from '../types'
|
|
27
|
+
import type { OrderFulfilledLog } from './orderFulfilled'
|
|
28
|
+
import { parseToOrderFulfilledLog } from './orderFulfilled'
|
|
29
|
+
|
|
30
|
+
export const analyzeSeaport = async <
|
|
31
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
32
|
+
>({
|
|
33
|
+
chain,
|
|
34
|
+
transaction,
|
|
35
|
+
accountAddresses,
|
|
36
|
+
}: AnalyzeParameters<Price>): Promise<AnalyzeReturnType<Price> | undefined> => {
|
|
37
|
+
const {
|
|
38
|
+
transactionHash,
|
|
39
|
+
value,
|
|
40
|
+
from,
|
|
41
|
+
to,
|
|
42
|
+
contractAddress,
|
|
43
|
+
logs,
|
|
44
|
+
erc20Transfers,
|
|
45
|
+
erc721Transfers,
|
|
46
|
+
erc1155Transfers,
|
|
47
|
+
internalTransactions,
|
|
48
|
+
nativeTokenPrice,
|
|
49
|
+
} = transaction
|
|
50
|
+
|
|
51
|
+
// internal transaction に native token trnasfer を追加する
|
|
52
|
+
const allInternalTransactions = [
|
|
53
|
+
...(value > 0n
|
|
54
|
+
? [
|
|
55
|
+
{
|
|
56
|
+
type: 'InternalTransaction' as const,
|
|
57
|
+
transactionHash,
|
|
58
|
+
from: toLowerHex(from),
|
|
59
|
+
to: to === null ? undefined : toLowerHex(to),
|
|
60
|
+
contractAddress:
|
|
61
|
+
contractAddress === null
|
|
62
|
+
? undefined
|
|
63
|
+
: toLowerHex(contractAddress),
|
|
64
|
+
txType: '',
|
|
65
|
+
value,
|
|
66
|
+
gas: 0n,
|
|
67
|
+
gasUsed: 0n,
|
|
68
|
+
isError: false,
|
|
69
|
+
input: undefined,
|
|
70
|
+
currency: chain.nativeToken.currency,
|
|
71
|
+
price: nativeTokenPrice,
|
|
72
|
+
},
|
|
73
|
+
]
|
|
74
|
+
: []),
|
|
75
|
+
...internalTransactions,
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
// OrderFulfilled event が 1 つでない場合は処理しない
|
|
79
|
+
// offerer と recipient が同一の OrderFulfilled event は除外する
|
|
80
|
+
const decodedLogs = logs
|
|
81
|
+
.map((log) => (log.type === 'decoded' ? log.log : undefined))
|
|
82
|
+
.filter((log): log is DecodedLog => log !== undefined)
|
|
83
|
+
const orderFulfilledLogs = decodedLogs
|
|
84
|
+
.map((log) => parseToOrderFulfilledLog(log))
|
|
85
|
+
.filter((log): log is OrderFulfilledLog => log !== undefined)
|
|
86
|
+
.filter((log) => log.args[1].value !== log.args[3].value)
|
|
87
|
+
if (orderFulfilledLogs.length !== 1) {
|
|
88
|
+
return undefined
|
|
89
|
+
}
|
|
90
|
+
const orderFulfilledLog = orderFulfilledLogs[0]
|
|
91
|
+
const orderOfferer = orderFulfilledLog.args[1].value
|
|
92
|
+
const orderRecipient = orderFulfilledLog.args[3].value
|
|
93
|
+
|
|
94
|
+
// orderFulfilled.offer の item 毎に item の token が order の ofeerer から order の recipient へ transfer される
|
|
95
|
+
// offer に含まれる ERC20,721,1155 token が指定された recipient に transfer されない動きをしている場合、 transaction を spam として処理
|
|
96
|
+
const mut_offerTransfers: (
|
|
97
|
+
| Erc20Transfer<Price>
|
|
98
|
+
| Erc721Transfer
|
|
99
|
+
| Erc1155Transfer
|
|
100
|
+
| InternalTransaction<Price>
|
|
101
|
+
)[] = []
|
|
102
|
+
let mut_isSpam = false
|
|
103
|
+
let mut_includeNativeToken = false
|
|
104
|
+
for (const offerItem of orderFulfilledLog.args[4].value) {
|
|
105
|
+
switch (offerItem.itemType) {
|
|
106
|
+
case 0: {
|
|
107
|
+
// native token
|
|
108
|
+
// internal transaction の場合は from に制約を付けない
|
|
109
|
+
// offer に native token があって、 recipient にもある場合、相殺する
|
|
110
|
+
const considerationAmount = orderFulfilledLog.args[5].value
|
|
111
|
+
.filter((item) => item.itemType === 0)
|
|
112
|
+
.reduce((accumulator, item) => accumulator + item.amount, 0n)
|
|
113
|
+
const amount = offerItem.amount - considerationAmount
|
|
114
|
+
const internalTransfers = allInternalTransactions.filter(
|
|
115
|
+
(internal) =>
|
|
116
|
+
internal.value === amount && internal.to === orderRecipient,
|
|
117
|
+
)
|
|
118
|
+
if (internalTransfers.length <= 1) {
|
|
119
|
+
// 合致する internal transfer が 1 つ以下の場合は includeNativeToken を true にする
|
|
120
|
+
mut_includeNativeToken = true
|
|
121
|
+
break
|
|
122
|
+
} else {
|
|
123
|
+
// 合致する internal transfer が複数の場合は pattern 不一致として undefined を返す
|
|
124
|
+
return undefined
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
case 1: {
|
|
128
|
+
// ERC20
|
|
129
|
+
// offer に ERC20 があって、同一 token が recipient にもある場合、相殺する
|
|
130
|
+
const considerationAmount = orderFulfilledLog.args[5].value
|
|
131
|
+
.filter(
|
|
132
|
+
(item) => item.itemType === 1 && item.token === offerItem.token,
|
|
133
|
+
)
|
|
134
|
+
.reduce((accumulator, item) => accumulator + item.amount, 0n)
|
|
135
|
+
const amount = offerItem.amount - considerationAmount
|
|
136
|
+
const erc20OfferTransfers = erc20Transfers.filter(
|
|
137
|
+
(transfer) =>
|
|
138
|
+
transfer.token.contractAddress === offerItem.token &&
|
|
139
|
+
transfer.value === amount &&
|
|
140
|
+
transfer.from === orderOfferer &&
|
|
141
|
+
transfer.to === orderRecipient,
|
|
142
|
+
)
|
|
143
|
+
if (erc20OfferTransfers.length === 1) {
|
|
144
|
+
// 合致する ERC20 transfer が 1 つの場合は mut_offerTransfers に追加
|
|
145
|
+
mut_offerTransfers.push(erc20OfferTransfers[0])
|
|
146
|
+
break
|
|
147
|
+
} else if (erc20OfferTransfers.length > 1) {
|
|
148
|
+
// 合致する ERC20 transfer が複数の場合は pattern 不一致として undefined を返す
|
|
149
|
+
return undefined
|
|
150
|
+
} else {
|
|
151
|
+
// 合致する ERC20 transfer がない場合、同一 token に対する別の transfer が存在すれば spam として処理・なければ pattern 不一致として undefined を返す
|
|
152
|
+
if (
|
|
153
|
+
erc20Transfers.some(
|
|
154
|
+
(transfer) =>
|
|
155
|
+
transfer.token.contractAddress === offerItem.token &&
|
|
156
|
+
transfer.value === amount,
|
|
157
|
+
)
|
|
158
|
+
) {
|
|
159
|
+
mut_isSpam = true
|
|
160
|
+
} else {
|
|
161
|
+
return undefined
|
|
162
|
+
}
|
|
163
|
+
break
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
case 2: {
|
|
167
|
+
// ERC721
|
|
168
|
+
const erc721OfferTransfers = erc721Transfers.filter(
|
|
169
|
+
(transfer) =>
|
|
170
|
+
transfer.token.contractAddress === offerItem.token &&
|
|
171
|
+
transfer.tokenId === offerItem.identifier &&
|
|
172
|
+
transfer.from === orderOfferer &&
|
|
173
|
+
transfer.to === orderRecipient,
|
|
174
|
+
)
|
|
175
|
+
if (erc721OfferTransfers.length === 1) {
|
|
176
|
+
// 合致する ERC721 transfer が 1 つの場合は mut_offerTransfers に追加
|
|
177
|
+
mut_offerTransfers.push(erc721OfferTransfers[0])
|
|
178
|
+
break
|
|
179
|
+
} else if (erc721OfferTransfers.length > 1) {
|
|
180
|
+
// 合致する ERC721 transfer が複数の場合は pattern 不一致として undefined を返す
|
|
181
|
+
return undefined
|
|
182
|
+
} else {
|
|
183
|
+
// 合致する ERC721 transfer がない場合、同一 token に対する別の transfer が存在すれば spam として処理・なければ pattern 不一致として undefined を返す
|
|
184
|
+
if (
|
|
185
|
+
erc721Transfers.some(
|
|
186
|
+
(transfer) =>
|
|
187
|
+
transfer.token.contractAddress === offerItem.token &&
|
|
188
|
+
transfer.tokenId === offerItem.identifier,
|
|
189
|
+
)
|
|
190
|
+
) {
|
|
191
|
+
mut_isSpam = true
|
|
192
|
+
} else {
|
|
193
|
+
return undefined
|
|
194
|
+
}
|
|
195
|
+
break
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
case 3: {
|
|
199
|
+
// ERC1155
|
|
200
|
+
const erc1155OfferTransfers = erc1155Transfers.filter(
|
|
201
|
+
(transfer) =>
|
|
202
|
+
transfer.token.contractAddress === offerItem.token &&
|
|
203
|
+
transfer.id === offerItem.identifier &&
|
|
204
|
+
transfer.value === offerItem.amount &&
|
|
205
|
+
transfer.from === orderOfferer &&
|
|
206
|
+
transfer.to === orderRecipient,
|
|
207
|
+
)
|
|
208
|
+
if (erc1155OfferTransfers.length === 1) {
|
|
209
|
+
// 合致する ERC1155 transfer が 1 つの場合は mut_offerTransfers に追加
|
|
210
|
+
mut_offerTransfers.push(erc1155OfferTransfers[0])
|
|
211
|
+
break
|
|
212
|
+
} else if (erc1155OfferTransfers.length > 1) {
|
|
213
|
+
// 合致する ERC1155 transfer が複数の場合は pattern 不一致として undefined を返す
|
|
214
|
+
return undefined
|
|
215
|
+
} else {
|
|
216
|
+
// 合致する ERC1155 transfer がない場合、同一 token に対する別の transfer が存在すれば spam として処理・なければ pattern 不一致として undefined を返す
|
|
217
|
+
if (
|
|
218
|
+
erc1155Transfers.some(
|
|
219
|
+
(transfer) =>
|
|
220
|
+
transfer.token.contractAddress === offerItem.token &&
|
|
221
|
+
transfer.id === offerItem.identifier,
|
|
222
|
+
)
|
|
223
|
+
) {
|
|
224
|
+
mut_isSpam = true
|
|
225
|
+
} else {
|
|
226
|
+
return undefined
|
|
227
|
+
}
|
|
228
|
+
break
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// orderFulfilled.consideration の item 毎に item の token が order の recipient から item の recipient へ transfer されている
|
|
235
|
+
// consideration , offer に含まれる ERC20,721,1155 token が指定された recipient に transfer されない動きをしている場合、 transaction を spam として処理
|
|
236
|
+
const mut_considerationTransfers: (
|
|
237
|
+
| Erc20Transfer<Price>
|
|
238
|
+
| Erc721Transfer
|
|
239
|
+
| Erc1155Transfer
|
|
240
|
+
| InternalTransaction<Price>
|
|
241
|
+
)[] = []
|
|
242
|
+
for (const considerationItem of orderFulfilledLog.args[5].value) {
|
|
243
|
+
if (orderRecipient === considerationItem.recipient) {
|
|
244
|
+
continue
|
|
245
|
+
}
|
|
246
|
+
switch (considerationItem.itemType) {
|
|
247
|
+
case 0: {
|
|
248
|
+
// native token
|
|
249
|
+
// internal transaction の場合は from に制約を付けない
|
|
250
|
+
const internalTransfers = allInternalTransactions.filter(
|
|
251
|
+
(internal) =>
|
|
252
|
+
internal.value === considerationItem.amount &&
|
|
253
|
+
internal.to === considerationItem.recipient,
|
|
254
|
+
)
|
|
255
|
+
if (internalTransfers.length <= 1) {
|
|
256
|
+
// 合致する internal transfer が 1 つ以下の場合は includeNativeToken を true にする
|
|
257
|
+
mut_includeNativeToken = true
|
|
258
|
+
break
|
|
259
|
+
} else {
|
|
260
|
+
// 合致する internal transfer が複数の場合は pattern 不一致として undefined を返す
|
|
261
|
+
return undefined
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
case 1: {
|
|
265
|
+
// ERC20
|
|
266
|
+
// offer に ERC20 があって、同一 token が recipient にもある場合、from を offerer にする
|
|
267
|
+
const from = orderFulfilledLog.args[4].value.some(
|
|
268
|
+
(item) =>
|
|
269
|
+
item.itemType === 1 && item.token === considerationItem.token,
|
|
270
|
+
)
|
|
271
|
+
? orderOfferer
|
|
272
|
+
: orderRecipient
|
|
273
|
+
const erc20ConsiderationTransfers = erc20Transfers.filter(
|
|
274
|
+
(transfer) =>
|
|
275
|
+
transfer.token.contractAddress === considerationItem.token &&
|
|
276
|
+
transfer.value === considerationItem.amount &&
|
|
277
|
+
transfer.from === from &&
|
|
278
|
+
transfer.to === considerationItem.recipient,
|
|
279
|
+
)
|
|
280
|
+
if (erc20ConsiderationTransfers.length === 1) {
|
|
281
|
+
// 合致する ERC20 transfer が 1 つの場合は mut_considerationTransfers に追加
|
|
282
|
+
mut_considerationTransfers.push(erc20ConsiderationTransfers[0])
|
|
283
|
+
break
|
|
284
|
+
} else if (erc20ConsiderationTransfers.length > 1) {
|
|
285
|
+
// 合致する ERC20 transfer が複数の場合は pattern 不一致として undefined を返す
|
|
286
|
+
return undefined
|
|
287
|
+
} else {
|
|
288
|
+
// 合致する ERC20 transfer がない場合、同一 token に対する別の transfer が存在すれば spam として処理・なければ pattern 不一致として undefined を返す
|
|
289
|
+
if (
|
|
290
|
+
erc20Transfers.some(
|
|
291
|
+
(transfer) =>
|
|
292
|
+
transfer.token.contractAddress === considerationItem.token &&
|
|
293
|
+
transfer.value === considerationItem.amount,
|
|
294
|
+
)
|
|
295
|
+
) {
|
|
296
|
+
mut_isSpam = true
|
|
297
|
+
} else {
|
|
298
|
+
return undefined
|
|
299
|
+
}
|
|
300
|
+
break
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
case 2: {
|
|
304
|
+
// ERC721
|
|
305
|
+
const erc721ConsiderationTransfers = erc721Transfers.filter(
|
|
306
|
+
(transfer) =>
|
|
307
|
+
transfer.token.contractAddress === considerationItem.token &&
|
|
308
|
+
transfer.tokenId === considerationItem.identifier &&
|
|
309
|
+
transfer.from === orderRecipient &&
|
|
310
|
+
transfer.to === considerationItem.recipient,
|
|
311
|
+
)
|
|
312
|
+
if (erc721ConsiderationTransfers.length === 1) {
|
|
313
|
+
// 合致する ERC721 transfer が 1 つの場合は mut_considerationTransfers に追加
|
|
314
|
+
mut_considerationTransfers.push(erc721ConsiderationTransfers[0])
|
|
315
|
+
break
|
|
316
|
+
} else if (erc721ConsiderationTransfers.length > 1) {
|
|
317
|
+
// 合致する ERC721 transfer が複数の場合は pattern 不一致として undefined を返す
|
|
318
|
+
return undefined
|
|
319
|
+
} else {
|
|
320
|
+
// 合致する ERC721 transfer がない場合、同一 token に対する別の transfer が存在すれば spam として処理・なければ pattern 不一致として undefined を返す
|
|
321
|
+
if (
|
|
322
|
+
erc721Transfers.some(
|
|
323
|
+
(transfer) =>
|
|
324
|
+
transfer.token.contractAddress === considerationItem.token &&
|
|
325
|
+
transfer.tokenId === considerationItem.identifier,
|
|
326
|
+
)
|
|
327
|
+
) {
|
|
328
|
+
mut_isSpam = true
|
|
329
|
+
} else {
|
|
330
|
+
return undefined
|
|
331
|
+
}
|
|
332
|
+
break
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
case 3: {
|
|
336
|
+
// ERC1155
|
|
337
|
+
const erc1155ConsiderationTransfers = erc1155Transfers.filter(
|
|
338
|
+
(transfer) =>
|
|
339
|
+
transfer.token.contractAddress === considerationItem.token &&
|
|
340
|
+
transfer.id === considerationItem.identifier &&
|
|
341
|
+
transfer.value === considerationItem.amount &&
|
|
342
|
+
transfer.from === orderRecipient &&
|
|
343
|
+
transfer.to === considerationItem.recipient,
|
|
344
|
+
)
|
|
345
|
+
if (erc1155ConsiderationTransfers.length === 1) {
|
|
346
|
+
// 合致する ERC1155 transfer が 1 つの場合は mut_considerationTransfers に追加
|
|
347
|
+
mut_considerationTransfers.push(erc1155ConsiderationTransfers[0])
|
|
348
|
+
break
|
|
349
|
+
} else if (erc1155ConsiderationTransfers.length > 1) {
|
|
350
|
+
// 合致する ERC1155 transfer が複数の場合は pattern 不一致として undefined を返す
|
|
351
|
+
return undefined
|
|
352
|
+
} else {
|
|
353
|
+
// 合致する ERC1155 transfer がない場合、同一 token に対する別の transfer が存在すれば spam として処理・なければ pattern 不一致として undefined を返す
|
|
354
|
+
if (
|
|
355
|
+
erc1155Transfers.some(
|
|
356
|
+
(transfer) =>
|
|
357
|
+
transfer.token.contractAddress === considerationItem.token &&
|
|
358
|
+
transfer.id === considerationItem.identifier,
|
|
359
|
+
)
|
|
360
|
+
) {
|
|
361
|
+
mut_isSpam = true
|
|
362
|
+
} else {
|
|
363
|
+
return undefined
|
|
364
|
+
}
|
|
365
|
+
break
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// spam としての処理
|
|
372
|
+
if (mut_isSpam) {
|
|
373
|
+
return await analyzeAsSpam({ chain, transaction, accountAddresses })
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// それ以外の transfer が含まれる場合は処理しない
|
|
377
|
+
if (
|
|
378
|
+
erc20Transfers.some(
|
|
379
|
+
(transfer) =>
|
|
380
|
+
mut_offerTransfers.every(
|
|
381
|
+
(offerTransfer) =>
|
|
382
|
+
offerTransfer.type !== 'Erc20Transfer' ||
|
|
383
|
+
transfer.logIndex !== offerTransfer.logIndex,
|
|
384
|
+
) &&
|
|
385
|
+
mut_considerationTransfers.every(
|
|
386
|
+
(considerationTransfer) =>
|
|
387
|
+
considerationTransfer.type !== 'Erc20Transfer' ||
|
|
388
|
+
transfer.logIndex !== considerationTransfer.logIndex,
|
|
389
|
+
),
|
|
390
|
+
) ||
|
|
391
|
+
erc721Transfers.some(
|
|
392
|
+
(transfer) =>
|
|
393
|
+
mut_offerTransfers.every(
|
|
394
|
+
(offerTransfer) =>
|
|
395
|
+
offerTransfer.type !== 'Erc721Transfer' ||
|
|
396
|
+
transfer.logIndex !== offerTransfer.logIndex,
|
|
397
|
+
) &&
|
|
398
|
+
mut_considerationTransfers.every(
|
|
399
|
+
(considerationTransfer) =>
|
|
400
|
+
considerationTransfer.type !== 'Erc721Transfer' ||
|
|
401
|
+
transfer.logIndex !== considerationTransfer.logIndex,
|
|
402
|
+
),
|
|
403
|
+
) ||
|
|
404
|
+
erc1155Transfers.some(
|
|
405
|
+
(transfer) =>
|
|
406
|
+
mut_offerTransfers.every(
|
|
407
|
+
(offerTransfer) =>
|
|
408
|
+
offerTransfer.type !== 'Erc1155Transfer' ||
|
|
409
|
+
transfer.logIndex !== offerTransfer.logIndex,
|
|
410
|
+
) &&
|
|
411
|
+
mut_considerationTransfers.every(
|
|
412
|
+
(considerationTransfer) =>
|
|
413
|
+
considerationTransfer.type !== 'Erc1155Transfer' ||
|
|
414
|
+
transfer.logIndex !== considerationTransfer.logIndex,
|
|
415
|
+
),
|
|
416
|
+
)
|
|
417
|
+
) {
|
|
418
|
+
return undefined
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// normal action は recipient を基準に作成
|
|
422
|
+
const normalAction = generateNormalAction(
|
|
423
|
+
chain,
|
|
424
|
+
transaction,
|
|
425
|
+
orderFulfilledLog,
|
|
426
|
+
mut_offerTransfers,
|
|
427
|
+
mut_considerationTransfers,
|
|
428
|
+
mut_includeNativeToken ? allInternalTransactions : [],
|
|
429
|
+
accountAddresses,
|
|
430
|
+
)
|
|
431
|
+
if (normalAction === undefined) {
|
|
432
|
+
return undefined
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// account action 作成
|
|
436
|
+
const accountActions = generateAccountActions(
|
|
437
|
+
chain,
|
|
438
|
+
transaction,
|
|
439
|
+
accountAddresses,
|
|
440
|
+
normalAction,
|
|
441
|
+
)
|
|
442
|
+
if (accountActions === undefined) {
|
|
443
|
+
return undefined
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return {
|
|
447
|
+
actions: [normalAction],
|
|
448
|
+
accountActions:
|
|
449
|
+
accountActions as AnalyzeReturnType<Price>['accountActions'],
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
const generateNormalAction = <Price extends CryptoCurrencyPrice | undefined>(
|
|
454
|
+
chain: Chain,
|
|
455
|
+
{ app, block, nativeTokenPrice }: TransactionDecoded<Price>,
|
|
456
|
+
orderFulfilledLog: OrderFulfilledLog,
|
|
457
|
+
offerTransfers: (
|
|
458
|
+
| Erc20Transfer<Price>
|
|
459
|
+
| Erc721Transfer
|
|
460
|
+
| Erc1155Transfer
|
|
461
|
+
| InternalTransaction<Price>
|
|
462
|
+
)[],
|
|
463
|
+
considerationTransfers: (
|
|
464
|
+
| Erc20Transfer<Price>
|
|
465
|
+
| Erc721Transfer
|
|
466
|
+
| Erc1155Transfer
|
|
467
|
+
| InternalTransaction<Price>
|
|
468
|
+
)[],
|
|
469
|
+
internalTransactions: InternalTransaction<Price>[],
|
|
470
|
+
accountAddresses: readonly LowerHex[],
|
|
471
|
+
): NormalActionTrade<EvmAccount, Price> | undefined => {
|
|
472
|
+
const offerer = orderFulfilledLog.args[1].value
|
|
473
|
+
const recipient = orderFulfilledLog.args[3].value
|
|
474
|
+
// offer transfer , consideration transfer を recipient を基準にまとめて trade action 作成
|
|
475
|
+
// recipient が含まれない transfer がある場合、 offerer を基準にまとめて trade action 作成
|
|
476
|
+
// offerer 基準でも offerer が含まれない transfer がある場合、 undefined を返す (pattern 不一致)
|
|
477
|
+
// undefined を返す (pattern 不一致)
|
|
478
|
+
let mut_existNoRecipientTransfer =
|
|
479
|
+
!accountAddresses.includes(recipient) && accountAddresses.includes(offerer)
|
|
480
|
+
const mut_recipientTransfers: NormalActionTrade<
|
|
481
|
+
EvmAccount,
|
|
482
|
+
Price
|
|
483
|
+
>['transfers'][number][] = []
|
|
484
|
+
for (const transfer of [
|
|
485
|
+
...offerTransfers,
|
|
486
|
+
...considerationTransfers,
|
|
487
|
+
...internalTransactions,
|
|
488
|
+
]) {
|
|
489
|
+
if (mut_existNoRecipientTransfer) {
|
|
490
|
+
break
|
|
491
|
+
}
|
|
492
|
+
if (transfer.from === recipient && transfer.to === recipient) {
|
|
493
|
+
continue
|
|
494
|
+
} else if (transfer.from === recipient || transfer.to === recipient) {
|
|
495
|
+
const direction = transfer.from === recipient ? 'out' : 'in'
|
|
496
|
+
switch (transfer.type) {
|
|
497
|
+
case 'InternalTransaction': {
|
|
498
|
+
if (transfer.to === undefined) {
|
|
499
|
+
return undefined
|
|
500
|
+
}
|
|
501
|
+
mut_recipientTransfers.push({
|
|
502
|
+
target: recipient,
|
|
503
|
+
direction,
|
|
504
|
+
from: createEvmAccount({
|
|
505
|
+
address: transfer.from,
|
|
506
|
+
chainId: chain.id,
|
|
507
|
+
}),
|
|
508
|
+
to: createEvmAccount({
|
|
509
|
+
address: transfer.to,
|
|
510
|
+
chainId: chain.id,
|
|
511
|
+
}),
|
|
512
|
+
asset: chain.nativeToken.currency,
|
|
513
|
+
amount: createBigDecimal(
|
|
514
|
+
transfer.value,
|
|
515
|
+
chain.nativeToken.decimals,
|
|
516
|
+
),
|
|
517
|
+
price: nativeTokenPrice,
|
|
518
|
+
})
|
|
519
|
+
break
|
|
520
|
+
}
|
|
521
|
+
case 'Erc20Transfer': {
|
|
522
|
+
mut_recipientTransfers.push({
|
|
523
|
+
target: recipient,
|
|
524
|
+
direction,
|
|
525
|
+
from: createEvmAccount({
|
|
526
|
+
address: transfer.from,
|
|
527
|
+
chainId: chain.id,
|
|
528
|
+
}),
|
|
529
|
+
to: createEvmAccount({
|
|
530
|
+
address: transfer.to,
|
|
531
|
+
chainId: chain.id,
|
|
532
|
+
}),
|
|
533
|
+
asset: transfer.token.currency,
|
|
534
|
+
amount: createBigDecimal(transfer.value, transfer.token.decimals),
|
|
535
|
+
price: transfer.price,
|
|
536
|
+
})
|
|
537
|
+
break
|
|
538
|
+
}
|
|
539
|
+
case 'Erc721Transfer': {
|
|
540
|
+
mut_recipientTransfers.push({
|
|
541
|
+
target: recipient,
|
|
542
|
+
direction,
|
|
543
|
+
from: createEvmAccount({
|
|
544
|
+
address: transfer.from,
|
|
545
|
+
chainId: chain.id,
|
|
546
|
+
}),
|
|
547
|
+
to: createEvmAccount({
|
|
548
|
+
address: transfer.to,
|
|
549
|
+
chainId: chain.id,
|
|
550
|
+
}),
|
|
551
|
+
asset: transfer.nft,
|
|
552
|
+
amount: createBigDecimal(1n),
|
|
553
|
+
price: undefined as Price,
|
|
554
|
+
})
|
|
555
|
+
break
|
|
556
|
+
}
|
|
557
|
+
case 'Erc1155Transfer': {
|
|
558
|
+
mut_recipientTransfers.push({
|
|
559
|
+
target: recipient,
|
|
560
|
+
direction,
|
|
561
|
+
from: createEvmAccount({
|
|
562
|
+
address: transfer.from,
|
|
563
|
+
chainId: chain.id,
|
|
564
|
+
}),
|
|
565
|
+
to: createEvmAccount({
|
|
566
|
+
address: transfer.to,
|
|
567
|
+
chainId: chain.id,
|
|
568
|
+
}),
|
|
569
|
+
asset: transfer.nft,
|
|
570
|
+
amount: createBigDecimal(transfer.value),
|
|
571
|
+
price: undefined as Price,
|
|
572
|
+
})
|
|
573
|
+
break
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
} else if (transfer.type === 'InternalTransaction') {
|
|
577
|
+
continue
|
|
578
|
+
} else {
|
|
579
|
+
mut_existNoRecipientTransfer = true
|
|
580
|
+
break
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (!mut_existNoRecipientTransfer) {
|
|
585
|
+
return {
|
|
586
|
+
type: 'NormalAction',
|
|
587
|
+
action: 'trade',
|
|
588
|
+
evidence: 'contract',
|
|
589
|
+
timestamp: Number(block.timestamp) * 1000,
|
|
590
|
+
comment: undefined,
|
|
591
|
+
app,
|
|
592
|
+
transfers: mut_recipientTransfers,
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const mut_offererTransfers: NormalActionTrade<
|
|
597
|
+
EvmAccount,
|
|
598
|
+
Price
|
|
599
|
+
>['transfers'][number][] = []
|
|
600
|
+
for (const transfer of [
|
|
601
|
+
...offerTransfers,
|
|
602
|
+
...considerationTransfers,
|
|
603
|
+
...internalTransactions,
|
|
604
|
+
]) {
|
|
605
|
+
if (transfer.from === offerer && transfer.to === offerer) {
|
|
606
|
+
continue
|
|
607
|
+
} else if (transfer.from === offerer || transfer.to === offerer) {
|
|
608
|
+
const direction = transfer.from === offerer ? 'out' : 'in'
|
|
609
|
+
switch (transfer.type) {
|
|
610
|
+
case 'InternalTransaction': {
|
|
611
|
+
if (transfer.to === undefined) {
|
|
612
|
+
return undefined
|
|
613
|
+
}
|
|
614
|
+
mut_offererTransfers.push({
|
|
615
|
+
target: offerer,
|
|
616
|
+
direction,
|
|
617
|
+
from: createEvmAccount({
|
|
618
|
+
address: transfer.from,
|
|
619
|
+
chainId: chain.id,
|
|
620
|
+
}),
|
|
621
|
+
to: createEvmAccount({
|
|
622
|
+
address: transfer.to,
|
|
623
|
+
chainId: chain.id,
|
|
624
|
+
}),
|
|
625
|
+
asset: chain.nativeToken.currency,
|
|
626
|
+
amount: createBigDecimal(
|
|
627
|
+
transfer.value,
|
|
628
|
+
chain.nativeToken.decimals,
|
|
629
|
+
),
|
|
630
|
+
price: nativeTokenPrice,
|
|
631
|
+
})
|
|
632
|
+
break
|
|
633
|
+
}
|
|
634
|
+
case 'Erc20Transfer': {
|
|
635
|
+
mut_offererTransfers.push({
|
|
636
|
+
target: offerer,
|
|
637
|
+
direction,
|
|
638
|
+
from: createEvmAccount({
|
|
639
|
+
address: transfer.from,
|
|
640
|
+
chainId: chain.id,
|
|
641
|
+
}),
|
|
642
|
+
to: createEvmAccount({
|
|
643
|
+
address: transfer.to,
|
|
644
|
+
chainId: chain.id,
|
|
645
|
+
}),
|
|
646
|
+
asset: transfer.token.currency,
|
|
647
|
+
amount: createBigDecimal(transfer.value, transfer.token.decimals),
|
|
648
|
+
price: transfer.price,
|
|
649
|
+
})
|
|
650
|
+
break
|
|
651
|
+
}
|
|
652
|
+
case 'Erc721Transfer': {
|
|
653
|
+
mut_offererTransfers.push({
|
|
654
|
+
target: offerer,
|
|
655
|
+
direction,
|
|
656
|
+
from: createEvmAccount({
|
|
657
|
+
address: transfer.from,
|
|
658
|
+
chainId: chain.id,
|
|
659
|
+
}),
|
|
660
|
+
to: createEvmAccount({
|
|
661
|
+
address: transfer.to,
|
|
662
|
+
chainId: chain.id,
|
|
663
|
+
}),
|
|
664
|
+
asset: transfer.nft,
|
|
665
|
+
amount: createBigDecimal(1n),
|
|
666
|
+
price: undefined as Price,
|
|
667
|
+
})
|
|
668
|
+
break
|
|
669
|
+
}
|
|
670
|
+
case 'Erc1155Transfer': {
|
|
671
|
+
mut_offererTransfers.push({
|
|
672
|
+
target: offerer,
|
|
673
|
+
direction,
|
|
674
|
+
from: createEvmAccount({
|
|
675
|
+
address: transfer.from,
|
|
676
|
+
chainId: chain.id,
|
|
677
|
+
}),
|
|
678
|
+
to: createEvmAccount({
|
|
679
|
+
address: transfer.to,
|
|
680
|
+
chainId: chain.id,
|
|
681
|
+
}),
|
|
682
|
+
asset: transfer.nft,
|
|
683
|
+
amount: createBigDecimal(transfer.value),
|
|
684
|
+
price: undefined as Price,
|
|
685
|
+
})
|
|
686
|
+
break
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
} else if (transfer.type === 'InternalTransaction') {
|
|
690
|
+
continue
|
|
691
|
+
} else {
|
|
692
|
+
return undefined
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
return {
|
|
697
|
+
type: 'NormalAction',
|
|
698
|
+
action: 'trade',
|
|
699
|
+
evidence: 'contract',
|
|
700
|
+
timestamp: Number(block.timestamp) * 1000,
|
|
701
|
+
comment: undefined,
|
|
702
|
+
app,
|
|
703
|
+
transfers: mut_offererTransfers,
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
const generateAccountActions = <Price extends CryptoCurrencyPrice | undefined>(
|
|
708
|
+
chain: Chain,
|
|
709
|
+
{ transactionHash }: TransactionDecoded<Price>,
|
|
710
|
+
accountAddresses: readonly LowerHex[],
|
|
711
|
+
action: NormalActionTrade<EvmAccount, Price>,
|
|
712
|
+
):
|
|
713
|
+
| readonly (
|
|
714
|
+
| AccountActionTrade<EvmAccount, TransactionSource, Price>
|
|
715
|
+
| AccountActionBuyNft<EvmAccount, TransactionSource, Price>
|
|
716
|
+
| AccountActionSellNft<EvmAccount, TransactionSource, Price>
|
|
717
|
+
| AccountActionSwapNft<EvmAccount, TransactionSource, undefined>
|
|
718
|
+
| AccountActionNftRoyalty<EvmAccount, TransactionSource, Price>
|
|
719
|
+
)[]
|
|
720
|
+
| undefined => {
|
|
721
|
+
const source = `evm_${chain.id}_${toLowerHex(transactionHash)}` as const
|
|
722
|
+
|
|
723
|
+
// account address に関係のある transfer を抽出
|
|
724
|
+
const transfers = action.transfers.filter(
|
|
725
|
+
(transfer) =>
|
|
726
|
+
accountAddresses.includes(transfer.from.address) ||
|
|
727
|
+
accountAddresses.includes(transfer.to.address),
|
|
728
|
+
)
|
|
729
|
+
|
|
730
|
+
if (
|
|
731
|
+
transfers.some(
|
|
732
|
+
(transfer) =>
|
|
733
|
+
accountAddresses.includes(transfer.from.address) &&
|
|
734
|
+
accountAddresses.includes(transfer.to.address),
|
|
735
|
+
)
|
|
736
|
+
) {
|
|
737
|
+
// direction: none が含まれる場合は undefined を返す
|
|
738
|
+
return undefined
|
|
739
|
+
} else if (
|
|
740
|
+
transfers.every(
|
|
741
|
+
(transfer) =>
|
|
742
|
+
accountAddresses.includes(transfer.to.address) &&
|
|
743
|
+
transfer.asset.type === 'CryptoCurrency',
|
|
744
|
+
)
|
|
745
|
+
) {
|
|
746
|
+
// in 側 全て CryptoCurrency / out 側なしの場合は nft-royalty action 作成
|
|
747
|
+
return transfers.map((transfer) => {
|
|
748
|
+
if (transfer.asset.type !== 'CryptoCurrency') {
|
|
749
|
+
throw new Error('invalid transfer')
|
|
750
|
+
}
|
|
751
|
+
return {
|
|
752
|
+
type: 'AccountAction',
|
|
753
|
+
action: 'nft-royalty',
|
|
754
|
+
source,
|
|
755
|
+
evidence: 'contract',
|
|
756
|
+
timestamp: action.timestamp,
|
|
757
|
+
order: 0,
|
|
758
|
+
comment: action.comment,
|
|
759
|
+
app: action.app,
|
|
760
|
+
transfers: [
|
|
761
|
+
{
|
|
762
|
+
...transfer,
|
|
763
|
+
target: transfer.to.address,
|
|
764
|
+
direction: 'in',
|
|
765
|
+
asset: transfer.asset,
|
|
766
|
+
},
|
|
767
|
+
],
|
|
768
|
+
}
|
|
769
|
+
})
|
|
770
|
+
} else if (
|
|
771
|
+
transfers.every((transfer) =>
|
|
772
|
+
accountAddresses.includes(transfer.from.address),
|
|
773
|
+
) ||
|
|
774
|
+
transfers.every((transfer) =>
|
|
775
|
+
accountAddresses.includes(transfer.to.address),
|
|
776
|
+
)
|
|
777
|
+
) {
|
|
778
|
+
// それ以外で in , out のどちらかがからの場合は undefined を返す
|
|
779
|
+
return undefined
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
const inTransfers = transfers.filter((transfer) =>
|
|
783
|
+
accountAddresses.includes(transfer.to.address),
|
|
784
|
+
)
|
|
785
|
+
const outTransfers = transfers.filter((transfer) =>
|
|
786
|
+
accountAddresses.includes(transfer.from.address),
|
|
787
|
+
)
|
|
788
|
+
|
|
789
|
+
// in / out 全て NFT の場合は swap-nft action 作成
|
|
790
|
+
if (
|
|
791
|
+
inTransfers.every((transfer) => transfer.asset.type === 'Nft') &&
|
|
792
|
+
outTransfers.every((transfer) => transfer.asset.type === 'Nft')
|
|
793
|
+
) {
|
|
794
|
+
return [
|
|
795
|
+
{
|
|
796
|
+
type: 'AccountAction',
|
|
797
|
+
action: 'swap-nft',
|
|
798
|
+
source,
|
|
799
|
+
evidence: 'contract',
|
|
800
|
+
timestamp: action.timestamp,
|
|
801
|
+
order: 0,
|
|
802
|
+
comment: action.comment,
|
|
803
|
+
app: action.app,
|
|
804
|
+
transfers: [
|
|
805
|
+
...inTransfers.map((transfer) => {
|
|
806
|
+
if (transfer.asset.type !== 'Nft') {
|
|
807
|
+
throw new Error('invalid transfer')
|
|
808
|
+
}
|
|
809
|
+
return {
|
|
810
|
+
...transfer,
|
|
811
|
+
target: transfer.to.address,
|
|
812
|
+
direction: 'in' as const,
|
|
813
|
+
asset: transfer.asset,
|
|
814
|
+
price: undefined,
|
|
815
|
+
}
|
|
816
|
+
}),
|
|
817
|
+
...outTransfers.map((transfer) => {
|
|
818
|
+
if (transfer.asset.type !== 'Nft') {
|
|
819
|
+
throw new Error('invalid transfer')
|
|
820
|
+
}
|
|
821
|
+
return {
|
|
822
|
+
...transfer,
|
|
823
|
+
target: transfer.from.address,
|
|
824
|
+
direction: 'out' as const,
|
|
825
|
+
asset: transfer.asset,
|
|
826
|
+
price: undefined,
|
|
827
|
+
}
|
|
828
|
+
}),
|
|
829
|
+
],
|
|
830
|
+
},
|
|
831
|
+
]
|
|
832
|
+
} else if (
|
|
833
|
+
inTransfers.every((transfer) => transfer.asset.type === 'Nft') &&
|
|
834
|
+
outTransfers.every((transfer) => transfer.asset.type === 'CryptoCurrency')
|
|
835
|
+
) {
|
|
836
|
+
// in 側全て NFT , out 側全て CryptoCurrency の場合は buy-nft action 作成
|
|
837
|
+
return [
|
|
838
|
+
{
|
|
839
|
+
type: 'AccountAction',
|
|
840
|
+
action: 'buy-nft',
|
|
841
|
+
source,
|
|
842
|
+
evidence: 'contract',
|
|
843
|
+
timestamp: action.timestamp,
|
|
844
|
+
order: 0,
|
|
845
|
+
comment: action.comment,
|
|
846
|
+
app: action.app,
|
|
847
|
+
transfers: [
|
|
848
|
+
...inTransfers.map((transfer) => ({
|
|
849
|
+
...transfer,
|
|
850
|
+
target: transfer.to.address,
|
|
851
|
+
direction: 'in' as const,
|
|
852
|
+
})),
|
|
853
|
+
...outTransfers.map((transfer) => ({
|
|
854
|
+
...transfer,
|
|
855
|
+
target: transfer.from.address,
|
|
856
|
+
direction: 'out' as const,
|
|
857
|
+
})),
|
|
858
|
+
],
|
|
859
|
+
},
|
|
860
|
+
]
|
|
861
|
+
} else if (
|
|
862
|
+
inTransfers.every((transfer) => transfer.asset.type === 'CryptoCurrency') &&
|
|
863
|
+
outTransfers.every((transfer) => transfer.asset.type === 'Nft')
|
|
864
|
+
) {
|
|
865
|
+
// in 側全て CryptoCurrency , out 側全て NFT の場合は sell-nft action 作成
|
|
866
|
+
return [
|
|
867
|
+
{
|
|
868
|
+
type: 'AccountAction',
|
|
869
|
+
action: 'sell-nft',
|
|
870
|
+
source,
|
|
871
|
+
evidence: 'contract',
|
|
872
|
+
timestamp: action.timestamp,
|
|
873
|
+
order: 0,
|
|
874
|
+
comment: action.comment,
|
|
875
|
+
app: action.app,
|
|
876
|
+
transfers: [
|
|
877
|
+
...inTransfers.map((transfer) => ({
|
|
878
|
+
...transfer,
|
|
879
|
+
target: transfer.to.address,
|
|
880
|
+
direction: 'in' as const,
|
|
881
|
+
})),
|
|
882
|
+
...outTransfers.map((transfer) => ({
|
|
883
|
+
...transfer,
|
|
884
|
+
target: transfer.from.address,
|
|
885
|
+
direction: 'out' as const,
|
|
886
|
+
})),
|
|
887
|
+
],
|
|
888
|
+
},
|
|
889
|
+
]
|
|
890
|
+
} else {
|
|
891
|
+
// それ以外の場合は trade action 作成
|
|
892
|
+
return [
|
|
893
|
+
{
|
|
894
|
+
type: 'AccountAction',
|
|
895
|
+
action: 'trade',
|
|
896
|
+
source,
|
|
897
|
+
evidence: 'contract',
|
|
898
|
+
timestamp: action.timestamp,
|
|
899
|
+
order: 0,
|
|
900
|
+
comment: action.comment,
|
|
901
|
+
app: action.app,
|
|
902
|
+
transfers: [
|
|
903
|
+
...inTransfers.map((transfer) => ({
|
|
904
|
+
...transfer,
|
|
905
|
+
target: transfer.to.address,
|
|
906
|
+
direction: 'in' as const,
|
|
907
|
+
})),
|
|
908
|
+
...outTransfers.map((transfer) => ({
|
|
909
|
+
...transfer,
|
|
910
|
+
target: transfer.from.address,
|
|
911
|
+
direction: 'out' as const,
|
|
912
|
+
})),
|
|
913
|
+
],
|
|
914
|
+
},
|
|
915
|
+
]
|
|
916
|
+
}
|
|
917
|
+
}
|