@0xtorch/evm 0.0.11 → 0.0.13
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/.DS_Store +0 -0
- package/_cjs/analyzer/analyze.js.map +1 -1
- package/_cjs/analyzer/axieMarketplace/analyze.js +37 -130
- package/_cjs/analyzer/axieMarketplace/analyze.js.map +1 -1
- package/_cjs/analyzer/gasFee/analyze.js +22 -21
- package/_cjs/analyzer/gasFee/analyze.js.map +1 -1
- package/_cjs/analyzer/index.js +2 -1
- package/_cjs/analyzer/index.js.map +1 -1
- package/_cjs/analyzer/json/analyze.js +21 -29
- package/_cjs/analyzer/json/analyze.js.map +1 -1
- package/_cjs/analyzer/json/components/comment.js +47 -0
- package/_cjs/analyzer/json/components/comment.js.map +1 -0
- package/_cjs/analyzer/json/components/erc1155.js +93 -0
- package/_cjs/analyzer/json/components/erc1155.js.map +1 -0
- package/_cjs/analyzer/json/components/erc1155Raw.js +31 -0
- package/_cjs/analyzer/json/components/erc1155Raw.js.map +1 -0
- package/_cjs/analyzer/json/components/erc20.js +90 -0
- package/_cjs/analyzer/json/components/erc20.js.map +1 -0
- package/_cjs/analyzer/json/components/erc20Raw.js +28 -0
- package/_cjs/analyzer/json/components/erc20Raw.js.map +1 -0
- package/_cjs/analyzer/json/components/erc721.js +78 -0
- package/_cjs/analyzer/json/components/erc721.js.map +1 -0
- package/_cjs/analyzer/json/components/erc721Raw.js +29 -0
- package/_cjs/analyzer/json/components/erc721Raw.js.map +1 -0
- package/_cjs/analyzer/json/components/id.js +47 -0
- package/_cjs/analyzer/json/components/id.js.map +1 -0
- package/_cjs/analyzer/json/components/internal.js +78 -0
- package/_cjs/analyzer/json/components/internal.js.map +1 -0
- package/_cjs/analyzer/json/components/internalRaw.js +26 -0
- package/_cjs/analyzer/json/components/internalRaw.js.map +1 -0
- package/_cjs/analyzer/json/components/logArgument.js +67 -0
- package/_cjs/analyzer/json/components/logArgument.js.map +1 -0
- package/_cjs/analyzer/json/components/logArgumentRaw.js +41 -0
- package/_cjs/analyzer/json/components/logArgumentRaw.js.map +1 -0
- package/_cjs/analyzer/json/components/transfer.js +435 -0
- package/_cjs/analyzer/json/components/transfer.js.map +1 -0
- package/_cjs/analyzer/json/condition/address.js +106 -0
- package/_cjs/analyzer/json/condition/address.js.map +1 -0
- package/_cjs/analyzer/json/condition/argumentValue.js +31 -0
- package/_cjs/analyzer/json/condition/argumentValue.js.map +1 -0
- package/_cjs/analyzer/json/condition/index.js +10 -0
- package/_cjs/analyzer/json/condition/index.js.map +1 -0
- package/_cjs/analyzer/json/condition/value.js +65 -0
- package/_cjs/analyzer/json/condition/value.js.map +1 -0
- package/_cjs/analyzer/json/generator.js +791 -0
- package/_cjs/analyzer/json/generator.js.map +1 -0
- package/_cjs/analyzer/json/index.js +3 -1
- package/_cjs/analyzer/json/index.js.map +1 -1
- package/_cjs/analyzer/json/schemas/generator.js +280 -0
- package/_cjs/analyzer/json/schemas/generator.js.map +1 -0
- package/_cjs/analyzer/json/schemas/index.js +303 -0
- package/_cjs/analyzer/json/schemas/index.js.map +1 -0
- package/_cjs/analyzer/json/schemas/utils.js +14 -0
- package/_cjs/analyzer/json/schemas/utils.js.map +1 -0
- package/_cjs/analyzer/parsers/transfer.js +149 -0
- package/_cjs/analyzer/parsers/transfer.js.map +1 -0
- package/_cjs/analyzer/seaport/analyze.js +165 -157
- package/_cjs/analyzer/seaport/analyze.js.map +1 -1
- package/_cjs/analyzer/spam/analyze.js +61 -90
- package/_cjs/analyzer/spam/analyze.js.map +1 -1
- package/_cjs/analyzer/swap/analyze.js +50 -75
- package/_cjs/analyzer/swap/analyze.js.map +1 -1
- package/_cjs/analyzer/transfer/analyze.js +37 -84
- package/_cjs/analyzer/transfer/analyze.js.map +1 -1
- package/_cjs/index.js +3 -2
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/create.js +28 -0
- package/_cjs/utils/create.js.map +1 -0
- package/_cjs/utils/index.js +3 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_esm/analyzer/analyze.js.map +1 -1
- package/_esm/analyzer/axieMarketplace/analyze.js +37 -130
- package/_esm/analyzer/axieMarketplace/analyze.js.map +1 -1
- package/_esm/analyzer/gasFee/analyze.js +23 -21
- package/_esm/analyzer/gasFee/analyze.js.map +1 -1
- package/_esm/analyzer/index.js +1 -1
- package/_esm/analyzer/index.js.map +1 -1
- package/_esm/analyzer/json/analyze.js +22 -29
- package/_esm/analyzer/json/analyze.js.map +1 -1
- package/_esm/analyzer/json/components/comment.js +43 -0
- package/_esm/analyzer/json/components/comment.js.map +1 -0
- package/_esm/analyzer/json/components/erc1155.js +88 -0
- package/_esm/analyzer/json/components/erc1155.js.map +1 -0
- package/_esm/analyzer/json/components/erc1155Raw.js +27 -0
- package/_esm/analyzer/json/components/erc1155Raw.js.map +1 -0
- package/_esm/analyzer/json/components/erc20.js +85 -0
- package/_esm/analyzer/json/components/erc20.js.map +1 -0
- package/_esm/analyzer/json/components/erc20Raw.js +24 -0
- package/_esm/analyzer/json/components/erc20Raw.js.map +1 -0
- package/_esm/analyzer/json/components/erc721.js +73 -0
- package/_esm/analyzer/json/components/erc721.js.map +1 -0
- package/_esm/analyzer/json/components/erc721Raw.js +25 -0
- package/_esm/analyzer/json/components/erc721Raw.js.map +1 -0
- package/_esm/analyzer/json/components/id.js +43 -0
- package/_esm/analyzer/json/components/id.js.map +1 -0
- package/_esm/analyzer/json/components/internal.js +73 -0
- package/_esm/analyzer/json/components/internal.js.map +1 -0
- package/_esm/analyzer/json/components/internalRaw.js +22 -0
- package/_esm/analyzer/json/components/internalRaw.js.map +1 -0
- package/_esm/analyzer/json/components/logArgument.js +62 -0
- package/_esm/analyzer/json/components/logArgument.js.map +1 -0
- package/_esm/analyzer/json/components/logArgumentRaw.js +37 -0
- package/_esm/analyzer/json/components/logArgumentRaw.js.map +1 -0
- package/_esm/analyzer/json/components/transfer.js +431 -0
- package/_esm/analyzer/json/components/transfer.js.map +1 -0
- package/_esm/analyzer/json/condition/address.js +102 -0
- package/_esm/analyzer/json/condition/address.js.map +1 -0
- package/_esm/analyzer/json/condition/argumentValue.js +27 -0
- package/_esm/analyzer/json/condition/argumentValue.js.map +1 -0
- package/_esm/analyzer/json/condition/index.js +4 -0
- package/_esm/analyzer/json/condition/index.js.map +1 -0
- package/_esm/analyzer/json/condition/value.js +61 -0
- package/_esm/analyzer/json/condition/value.js.map +1 -0
- package/_esm/analyzer/json/generator.js +842 -0
- package/_esm/analyzer/json/generator.js.map +1 -0
- package/_esm/analyzer/json/index.js +1 -0
- package/_esm/analyzer/json/index.js.map +1 -1
- package/_esm/analyzer/json/schemas/generator.js +341 -0
- package/_esm/analyzer/json/schemas/generator.js.map +1 -0
- package/_esm/analyzer/json/schemas/index.js +299 -0
- package/_esm/analyzer/json/schemas/index.js.map +1 -0
- package/_esm/analyzer/json/schemas/utils.js +11 -0
- package/_esm/analyzer/json/schemas/utils.js.map +1 -0
- package/_esm/analyzer/parsers/transfer.js +129 -0
- package/_esm/analyzer/parsers/transfer.js.map +1 -0
- package/_esm/analyzer/seaport/analyze.js +166 -157
- package/_esm/analyzer/seaport/analyze.js.map +1 -1
- package/_esm/analyzer/spam/analyze.js +62 -92
- package/_esm/analyzer/spam/analyze.js.map +1 -1
- package/_esm/analyzer/swap/analyze.js +51 -75
- package/_esm/analyzer/swap/analyze.js.map +1 -1
- package/_esm/analyzer/transfer/analyze.js +38 -86
- package/_esm/analyzer/transfer/analyze.js.map +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/utils/create.js +21 -0
- package/_esm/utils/create.js.map +1 -0
- package/_esm/utils/index.js +1 -0
- package/_esm/utils/index.js.map +1 -1
- package/_types/analyzer/analyze.d.ts +11 -16
- package/_types/analyzer/analyze.d.ts.map +1 -1
- package/_types/analyzer/analyzer.d.ts +9 -1
- package/_types/analyzer/analyzer.d.ts.map +1 -1
- package/_types/analyzer/axieMarketplace/analyze.d.ts +9 -2
- package/_types/analyzer/axieMarketplace/analyze.d.ts.map +1 -1
- package/_types/analyzer/gasFee/analyze.d.ts +9 -2
- package/_types/analyzer/gasFee/analyze.d.ts.map +1 -1
- package/_types/analyzer/index.d.ts +1 -1
- package/_types/analyzer/index.d.ts.map +1 -1
- package/_types/analyzer/json/analyze.d.ts +9 -2
- package/_types/analyzer/json/analyze.d.ts.map +1 -1
- package/_types/analyzer/json/components/comment.d.ts +20 -0
- package/_types/analyzer/json/components/comment.d.ts.map +1 -0
- package/_types/analyzer/json/components/erc1155.d.ts +32 -0
- package/_types/analyzer/json/components/erc1155.d.ts.map +1 -0
- package/_types/analyzer/json/components/erc1155Raw.d.ts +18 -0
- package/_types/analyzer/json/components/erc1155Raw.d.ts.map +1 -0
- package/_types/analyzer/json/components/erc20.d.ts +32 -0
- package/_types/analyzer/json/components/erc20.d.ts.map +1 -0
- package/_types/analyzer/json/components/erc20Raw.d.ts +18 -0
- package/_types/analyzer/json/components/erc20Raw.d.ts.map +1 -0
- package/_types/analyzer/json/components/erc721.d.ts +32 -0
- package/_types/analyzer/json/components/erc721.d.ts.map +1 -0
- package/_types/analyzer/json/components/erc721Raw.d.ts +18 -0
- package/_types/analyzer/json/components/erc721Raw.d.ts.map +1 -0
- package/_types/analyzer/json/components/id.d.ts +20 -0
- package/_types/analyzer/json/components/id.d.ts.map +1 -0
- package/_types/analyzer/json/components/internal.d.ts +32 -0
- package/_types/analyzer/json/components/internal.d.ts.map +1 -0
- package/_types/analyzer/json/components/internalRaw.d.ts +18 -0
- package/_types/analyzer/json/components/internalRaw.d.ts.map +1 -0
- package/_types/analyzer/json/components/logArgument.d.ts +32 -0
- package/_types/analyzer/json/components/logArgument.d.ts.map +1 -0
- package/_types/analyzer/json/components/logArgumentRaw.d.ts +18 -0
- package/_types/analyzer/json/components/logArgumentRaw.d.ts.map +1 -0
- package/_types/analyzer/json/components/transfer.d.ts +20 -0
- package/_types/analyzer/json/components/transfer.d.ts.map +1 -0
- package/_types/analyzer/json/condition/address.d.ts +18 -0
- package/_types/analyzer/json/condition/address.d.ts.map +1 -0
- package/_types/analyzer/json/condition/argumentValue.d.ts +18 -0
- package/_types/analyzer/json/condition/argumentValue.d.ts.map +1 -0
- package/_types/analyzer/json/condition/index.d.ts +4 -0
- package/_types/analyzer/json/condition/index.d.ts.map +1 -0
- package/_types/analyzer/json/condition/value.d.ts +18 -0
- package/_types/analyzer/json/condition/value.d.ts.map +1 -0
- package/_types/analyzer/json/generator.d.ts +20 -0
- package/_types/analyzer/json/generator.d.ts.map +1 -0
- package/_types/analyzer/json/index.d.ts +1 -0
- package/_types/analyzer/json/index.d.ts.map +1 -1
- package/_types/analyzer/json/schemas/generator.d.ts +56943 -0
- package/_types/analyzer/json/schemas/generator.d.ts.map +1 -0
- package/_types/analyzer/json/schemas/index.d.ts +1348 -0
- package/_types/analyzer/json/schemas/index.d.ts.map +1 -0
- package/_types/analyzer/json/schemas/utils.d.ts +4 -0
- package/_types/analyzer/json/schemas/utils.d.ts.map +1 -0
- package/_types/analyzer/json/types.d.ts +42 -172
- package/_types/analyzer/json/types.d.ts.map +1 -1
- package/_types/analyzer/parsers/transfer.d.ts +46 -0
- package/_types/analyzer/parsers/transfer.d.ts.map +1 -0
- package/_types/analyzer/seaport/analyze.d.ts +9 -2
- package/_types/analyzer/seaport/analyze.d.ts.map +1 -1
- package/_types/analyzer/seaport/orderFulfilled.d.ts +8 -8
- package/_types/analyzer/spam/analyze.d.ts +9 -2
- package/_types/analyzer/spam/analyze.d.ts.map +1 -1
- package/_types/analyzer/swap/analyze.d.ts +9 -2
- package/_types/analyzer/swap/analyze.d.ts.map +1 -1
- package/_types/analyzer/transfer/analyze.d.ts +9 -2
- package/_types/analyzer/transfer/analyze.d.ts.map +1 -1
- package/_types/analyzer/types.d.ts +6 -6
- package/_types/analyzer/types.d.ts.map +1 -1
- package/_types/decoder/tests.d.ts +2 -2
- package/_types/explorers/definitions/blockscout.d.ts +60 -4
- package/_types/explorers/definitions/blockscout.d.ts.map +1 -1
- package/_types/explorers/definitions/etherscan.d.ts +60 -4
- package/_types/explorers/definitions/etherscan.d.ts.map +1 -1
- package/_types/explorers/definitions/roninExplorer.d.ts +60 -4
- package/_types/explorers/definitions/roninExplorer.d.ts.map +1 -1
- package/_types/explorers/externals/blockscout/getInternalTransactionsByAddress.d.ts +2 -2
- package/_types/getAccountsTransactionFulls/getAccountsTransactionFulls.d.ts +9 -1
- package/_types/getAccountsTransactionFulls/getAccountsTransactionFulls.d.ts.map +1 -1
- package/_types/getTransactionFull/getTransactionFull.d.ts +9 -1
- package/_types/getTransactionFull/getTransactionFull.d.ts.map +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/types/log.d.ts +6 -6
- package/_types/types/transaction.d.ts +3 -4
- package/_types/types/transaction.d.ts.map +1 -1
- package/_types/utils/create.d.ts +23 -0
- package/_types/utils/create.d.ts.map +1 -0
- package/_types/utils/index.d.ts +1 -0
- package/_types/utils/index.d.ts.map +1 -1
- package/analyzer/.DS_Store +0 -0
- package/analyzer/analyze.ts +6 -30
- package/analyzer/axieMarketplace/analyze.ts +67 -150
- package/analyzer/gasFee/analyze.ts +29 -36
- package/analyzer/index.ts +1 -1
- package/analyzer/json/analyze.ts +32 -53
- package/analyzer/json/components/comment.ts +62 -0
- package/analyzer/json/components/erc1155.ts +132 -0
- package/analyzer/json/components/erc1155Raw.ts +46 -0
- package/analyzer/json/components/erc20.ts +129 -0
- package/analyzer/json/components/erc20Raw.ts +43 -0
- package/analyzer/json/components/erc721.ts +117 -0
- package/analyzer/json/components/erc721Raw.ts +46 -0
- package/analyzer/json/components/id.ts +62 -0
- package/analyzer/json/components/internal.ts +117 -0
- package/analyzer/json/components/internalRaw.ts +39 -0
- package/analyzer/json/components/logArgument.ts +99 -0
- package/analyzer/json/components/logArgumentRaw.ts +57 -0
- package/analyzer/json/components/transfer.ts +531 -0
- package/analyzer/json/condition/address.ts +124 -0
- package/analyzer/json/condition/argumentValue.ts +43 -0
- package/analyzer/json/condition/index.ts +3 -0
- package/analyzer/json/condition/value.ts +76 -0
- package/analyzer/json/generator.ts +1184 -0
- package/analyzer/json/index.ts +1 -0
- package/analyzer/json/schemas/generator.ts +389 -0
- package/analyzer/json/schemas/index.ts +363 -0
- package/analyzer/json/schemas/utils.ts +12 -0
- package/analyzer/json/types.ts +111 -207
- package/analyzer/parsers/transfer.ts +301 -0
- package/analyzer/seaport/analyze.ts +228 -195
- package/analyzer/spam/analyze.ts +79 -112
- package/analyzer/swap/analyze.ts +67 -101
- package/analyzer/transfer/analyze.ts +54 -100
- package/analyzer/types.ts +5 -21
- package/index.ts +1 -0
- package/package.json +2 -2
- package/types/transaction.ts +2 -14
- package/utils/create.ts +57 -0
- package/utils/index.ts +1 -0
- package/_cjs/analyzer/createAccountActionByAction/addLiquidity.js +0 -28
- package/_cjs/analyzer/createAccountActionByAction/addLiquidity.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/atomicArbitrage.js +0 -79
- package/_cjs/analyzer/createAccountActionByAction/atomicArbitrage.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/bridgeFrom.js +0 -38
- package/_cjs/analyzer/createAccountActionByAction/bridgeFrom.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/bridgeTo.js +0 -38
- package/_cjs/analyzer/createAccountActionByAction/bridgeTo.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/buyNft.js +0 -59
- package/_cjs/analyzer/createAccountActionByAction/buyNft.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/createAccountActionByAction.js +0 -69
- package/_cjs/analyzer/createAccountActionByAction/createAccountActionByAction.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/deposit.js +0 -41
- package/_cjs/analyzer/createAccountActionByAction/deposit.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/depositWithBond.js +0 -28
- package/_cjs/analyzer/createAccountActionByAction/depositWithBond.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/freeMintNft.js +0 -32
- package/_cjs/analyzer/createAccountActionByAction/freeMintNft.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/index.js +0 -6
- package/_cjs/analyzer/createAccountActionByAction/index.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/removeLiquidity.js +0 -28
- package/_cjs/analyzer/createAccountActionByAction/removeLiquidity.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/spam.js +0 -58
- package/_cjs/analyzer/createAccountActionByAction/spam.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/trade.js +0 -59
- package/_cjs/analyzer/createAccountActionByAction/trade.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/transactionFee.js +0 -29
- package/_cjs/analyzer/createAccountActionByAction/transactionFee.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/transfer.js +0 -74
- package/_cjs/analyzer/createAccountActionByAction/transfer.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/withdraw.js +0 -38
- package/_cjs/analyzer/createAccountActionByAction/withdraw.js.map +0 -1
- package/_cjs/analyzer/createAccountActionByAction/withdrawWithBond.js +0 -28
- package/_cjs/analyzer/createAccountActionByAction/withdrawWithBond.js.map +0 -1
- package/_cjs/analyzer/json/generatorAnyLog.js +0 -163
- package/_cjs/analyzer/json/generatorAnyLog.js.map +0 -1
- package/_cjs/analyzer/json/generatorAnyTokenTransfer.js +0 -102
- package/_cjs/analyzer/json/generatorAnyTokenTransfer.js.map +0 -1
- package/_cjs/analyzer/json/generatorSpecificTokenTransfer.js +0 -343
- package/_cjs/analyzer/json/generatorSpecificTokenTransfer.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/addLiquidity.js +0 -24
- package/_esm/analyzer/createAccountActionByAction/addLiquidity.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/atomicArbitrage.js +0 -79
- package/_esm/analyzer/createAccountActionByAction/atomicArbitrage.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/bridgeFrom.js +0 -34
- package/_esm/analyzer/createAccountActionByAction/bridgeFrom.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/bridgeTo.js +0 -34
- package/_esm/analyzer/createAccountActionByAction/bridgeTo.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/buyNft.js +0 -59
- package/_esm/analyzer/createAccountActionByAction/buyNft.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/createAccountActionByAction.js +0 -80
- package/_esm/analyzer/createAccountActionByAction/createAccountActionByAction.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/deposit.js +0 -38
- package/_esm/analyzer/createAccountActionByAction/deposit.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/depositWithBond.js +0 -24
- package/_esm/analyzer/createAccountActionByAction/depositWithBond.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/freeMintNft.js +0 -28
- package/_esm/analyzer/createAccountActionByAction/freeMintNft.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/index.js +0 -2
- package/_esm/analyzer/createAccountActionByAction/index.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/removeLiquidity.js +0 -24
- package/_esm/analyzer/createAccountActionByAction/removeLiquidity.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/spam.js +0 -54
- package/_esm/analyzer/createAccountActionByAction/spam.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/trade.js +0 -59
- package/_esm/analyzer/createAccountActionByAction/trade.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/transactionFee.js +0 -25
- package/_esm/analyzer/createAccountActionByAction/transactionFee.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/transfer.js +0 -70
- package/_esm/analyzer/createAccountActionByAction/transfer.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/withdraw.js +0 -34
- package/_esm/analyzer/createAccountActionByAction/withdraw.js.map +0 -1
- package/_esm/analyzer/createAccountActionByAction/withdrawWithBond.js +0 -24
- package/_esm/analyzer/createAccountActionByAction/withdrawWithBond.js.map +0 -1
- package/_esm/analyzer/json/generatorAnyLog.js +0 -159
- package/_esm/analyzer/json/generatorAnyLog.js.map +0 -1
- package/_esm/analyzer/json/generatorAnyTokenTransfer.js +0 -98
- package/_esm/analyzer/json/generatorAnyTokenTransfer.js.map +0 -1
- package/_esm/analyzer/json/generatorSpecificTokenTransfer.js +0 -339
- package/_esm/analyzer/json/generatorSpecificTokenTransfer.js.map +0 -1
- package/_types/analyzer/createAccountActionByAction/addLiquidity.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/addLiquidity.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/atomicArbitrage.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/atomicArbitrage.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/bridgeFrom.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/bridgeFrom.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/bridgeTo.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/bridgeTo.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/buyNft.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/buyNft.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/createAccountActionByAction.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/createAccountActionByAction.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/deposit.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/deposit.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/depositWithBond.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/depositWithBond.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/freeMintNft.d.ts +0 -53
- package/_types/analyzer/createAccountActionByAction/freeMintNft.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/index.d.ts +0 -2
- package/_types/analyzer/createAccountActionByAction/index.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/removeLiquidity.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/removeLiquidity.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/spam.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/spam.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/trade.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/trade.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/transactionFee.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/transactionFee.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/transfer.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/transfer.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/withdraw.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/withdraw.d.ts.map +0 -1
- package/_types/analyzer/createAccountActionByAction/withdrawWithBond.d.ts +0 -59
- package/_types/analyzer/createAccountActionByAction/withdrawWithBond.d.ts.map +0 -1
- package/_types/analyzer/json/generatorAnyLog.d.ts +0 -55
- package/_types/analyzer/json/generatorAnyLog.d.ts.map +0 -1
- package/_types/analyzer/json/generatorAnyTokenTransfer.d.ts +0 -54
- package/_types/analyzer/json/generatorAnyTokenTransfer.d.ts.map +0 -1
- package/_types/analyzer/json/generatorSpecificTokenTransfer.d.ts +0 -55
- package/_types/analyzer/json/generatorSpecificTokenTransfer.d.ts.map +0 -1
- package/analyzer/createAccountActionByAction/addLiquidity.ts +0 -60
- package/analyzer/createAccountActionByAction/atomicArbitrage.ts +0 -115
- package/analyzer/createAccountActionByAction/bridgeFrom.ts +0 -61
- package/analyzer/createAccountActionByAction/bridgeTo.ts +0 -61
- package/analyzer/createAccountActionByAction/buyNft.ts +0 -106
- package/analyzer/createAccountActionByAction/createAccountActionByAction.ts +0 -181
- package/analyzer/createAccountActionByAction/deposit.ts +0 -64
- package/analyzer/createAccountActionByAction/depositWithBond.ts +0 -60
- package/analyzer/createAccountActionByAction/freeMintNft.ts +0 -54
- package/analyzer/createAccountActionByAction/index.ts +0 -1
- package/analyzer/createAccountActionByAction/removeLiquidity.ts +0 -60
- package/analyzer/createAccountActionByAction/spam.ts +0 -79
- package/analyzer/createAccountActionByAction/trade.ts +0 -105
- package/analyzer/createAccountActionByAction/transactionFee.ts +0 -51
- package/analyzer/createAccountActionByAction/transfer.ts +0 -95
- package/analyzer/createAccountActionByAction/withdraw.ts +0 -61
- package/analyzer/createAccountActionByAction/withdrawWithBond.ts +0 -60
- package/analyzer/json/generatorAnyLog.ts +0 -207
- package/analyzer/json/generatorAnyTokenTransfer.ts +0 -118
- package/analyzer/json/generatorSpecificTokenTransfer.ts +0 -425
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AccountAction,
|
|
3
|
-
AccountActionType,
|
|
4
|
-
CryptoCurrencyPrice,
|
|
5
|
-
NormalActionTrade,
|
|
6
|
-
} from '@0xtorch/core'
|
|
7
|
-
import type {
|
|
8
|
-
EvmAccount,
|
|
9
|
-
LowerHex,
|
|
10
|
-
TransactionDecoded,
|
|
11
|
-
TransactionSource,
|
|
12
|
-
} from '../../types'
|
|
13
|
-
import { toLowerHex } from '../../types'
|
|
14
|
-
|
|
15
|
-
export const createAccountActionByActionTrade = <
|
|
16
|
-
Price extends CryptoCurrencyPrice | undefined,
|
|
17
|
-
>(
|
|
18
|
-
action: NormalActionTrade<EvmAccount, Price>,
|
|
19
|
-
transaction: TransactionDecoded<Price>,
|
|
20
|
-
accountAddresses: readonly LowerHex[],
|
|
21
|
-
):
|
|
22
|
-
| AccountAction<
|
|
23
|
-
AccountActionType,
|
|
24
|
-
TransactionSource,
|
|
25
|
-
EvmAccount | undefined,
|
|
26
|
-
Price
|
|
27
|
-
>
|
|
28
|
-
| undefined => {
|
|
29
|
-
const transfersIn = action.transfers.filter(
|
|
30
|
-
(transfer) => transfer.direction === 'in',
|
|
31
|
-
)
|
|
32
|
-
const transfersOut = action.transfers.filter(
|
|
33
|
-
(transfer) => transfer.direction === 'out',
|
|
34
|
-
)
|
|
35
|
-
if (transfersIn.length === 0 || transfersOut.length === 0) {
|
|
36
|
-
throw new Error('invalid action')
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const source =
|
|
40
|
-
`evm_${transaction.chainId}_${toLowerHex(transaction.transactionHash)}` as const
|
|
41
|
-
if (
|
|
42
|
-
transfersIn.every((transfer) =>
|
|
43
|
-
accountAddresses.includes(transfer.to.address),
|
|
44
|
-
) &&
|
|
45
|
-
transfersOut.every((transfer) =>
|
|
46
|
-
accountAddresses.includes(transfer.from.address),
|
|
47
|
-
)
|
|
48
|
-
) {
|
|
49
|
-
// transfers の両側全てが自分の address の場合は trade として扱う
|
|
50
|
-
return {
|
|
51
|
-
type: 'AccountAction',
|
|
52
|
-
action: 'trade',
|
|
53
|
-
source,
|
|
54
|
-
evidence: action.evidence,
|
|
55
|
-
timestamp: action.timestamp,
|
|
56
|
-
order: 0,
|
|
57
|
-
comment: action.comment,
|
|
58
|
-
app: action.app,
|
|
59
|
-
transfers: action.transfers,
|
|
60
|
-
}
|
|
61
|
-
} else if (
|
|
62
|
-
transfersIn.every((transfer) =>
|
|
63
|
-
accountAddresses.includes(transfer.to.address),
|
|
64
|
-
) &&
|
|
65
|
-
transfersOut.every(
|
|
66
|
-
(transfer) => !accountAddresses.includes(transfer.from.address),
|
|
67
|
-
)
|
|
68
|
-
) {
|
|
69
|
-
// transfers の in 側全て自分の address , out側全てが自分の address でない場合は swap-income として扱う
|
|
70
|
-
return {
|
|
71
|
-
type: 'AccountAction',
|
|
72
|
-
action: 'swap-income',
|
|
73
|
-
source,
|
|
74
|
-
evidence: action.evidence,
|
|
75
|
-
timestamp: action.timestamp,
|
|
76
|
-
order: 0,
|
|
77
|
-
comment: action.comment,
|
|
78
|
-
app: action.app,
|
|
79
|
-
transfers: transfersIn,
|
|
80
|
-
}
|
|
81
|
-
} else if (
|
|
82
|
-
transfersOut.every((transfer) =>
|
|
83
|
-
accountAddresses.includes(transfer.from.address),
|
|
84
|
-
) &&
|
|
85
|
-
transfersIn.every(
|
|
86
|
-
(transfer) => !accountAddresses.includes(transfer.to.address),
|
|
87
|
-
)
|
|
88
|
-
) {
|
|
89
|
-
// transfers の out 側全てが自分の address , in 側全てが自分の address でない場合は swap-transfer として扱う
|
|
90
|
-
return {
|
|
91
|
-
type: 'AccountAction',
|
|
92
|
-
action: 'swap-transfer',
|
|
93
|
-
source,
|
|
94
|
-
evidence: action.evidence,
|
|
95
|
-
timestamp: action.timestamp,
|
|
96
|
-
order: 0,
|
|
97
|
-
comment: action.comment,
|
|
98
|
-
app: action.app,
|
|
99
|
-
transfers: transfersOut,
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
// それ以外の場合は分析不能として undefined を返す
|
|
103
|
-
return undefined
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AccountAction,
|
|
3
|
-
AccountActionType,
|
|
4
|
-
CryptoCurrencyPrice,
|
|
5
|
-
NormalActionTransactionFee,
|
|
6
|
-
} from '@0xtorch/core'
|
|
7
|
-
import type {
|
|
8
|
-
EvmAccount,
|
|
9
|
-
LowerHex,
|
|
10
|
-
TransactionDecoded,
|
|
11
|
-
TransactionSource,
|
|
12
|
-
} from '../../types'
|
|
13
|
-
import { toLowerHex } from '../../types'
|
|
14
|
-
|
|
15
|
-
export const createAccountActionByActionTransactionFee = <
|
|
16
|
-
Price extends CryptoCurrencyPrice | undefined,
|
|
17
|
-
>(
|
|
18
|
-
action: NormalActionTransactionFee<EvmAccount | undefined, Price>,
|
|
19
|
-
transaction: TransactionDecoded<Price>,
|
|
20
|
-
accountAddresses: readonly LowerHex[],
|
|
21
|
-
):
|
|
22
|
-
| AccountAction<
|
|
23
|
-
AccountActionType,
|
|
24
|
-
TransactionSource,
|
|
25
|
-
EvmAccount | undefined,
|
|
26
|
-
Price
|
|
27
|
-
>
|
|
28
|
-
| undefined => {
|
|
29
|
-
if (action.transfers.length !== 1) {
|
|
30
|
-
return undefined
|
|
31
|
-
}
|
|
32
|
-
const transferFrom = action.transfers[0].from?.address
|
|
33
|
-
if (transferFrom === undefined) {
|
|
34
|
-
return undefined
|
|
35
|
-
}
|
|
36
|
-
if (!accountAddresses.includes(transferFrom)) {
|
|
37
|
-
return undefined
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
type: 'AccountAction',
|
|
42
|
-
action: 'transaction-fee',
|
|
43
|
-
source: `evm_${transaction.chainId}_${toLowerHex(transaction.hash)}`,
|
|
44
|
-
evidence: action.evidence,
|
|
45
|
-
timestamp: action.timestamp,
|
|
46
|
-
order: 0,
|
|
47
|
-
comment: action.comment,
|
|
48
|
-
app: action.app,
|
|
49
|
-
transfers: action.transfers,
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AccountAction,
|
|
3
|
-
AccountActionType,
|
|
4
|
-
CryptoCurrencyPrice,
|
|
5
|
-
NormalActionTransfer,
|
|
6
|
-
} from '@0xtorch/core'
|
|
7
|
-
import type {
|
|
8
|
-
EvmAccount,
|
|
9
|
-
LowerHex,
|
|
10
|
-
TransactionDecoded,
|
|
11
|
-
TransactionSource,
|
|
12
|
-
} from '../../types'
|
|
13
|
-
import { toLowerHex } from '../../types'
|
|
14
|
-
|
|
15
|
-
export const createAccountActionByActionTransfer = <
|
|
16
|
-
Price extends CryptoCurrencyPrice | undefined,
|
|
17
|
-
>(
|
|
18
|
-
action: NormalActionTransfer<EvmAccount, Price>,
|
|
19
|
-
transaction: TransactionDecoded<Price>,
|
|
20
|
-
accountAddresses: readonly LowerHex[],
|
|
21
|
-
):
|
|
22
|
-
| AccountAction<
|
|
23
|
-
AccountActionType,
|
|
24
|
-
TransactionSource,
|
|
25
|
-
EvmAccount | undefined,
|
|
26
|
-
Price
|
|
27
|
-
>
|
|
28
|
-
| undefined => {
|
|
29
|
-
if (action.transfers.length !== 1) {
|
|
30
|
-
throw new Error('invalid action')
|
|
31
|
-
}
|
|
32
|
-
const source =
|
|
33
|
-
`evm_${transaction.chainId}_${toLowerHex(transaction.transactionHash)}` as const
|
|
34
|
-
const transfer = action.transfers[0]
|
|
35
|
-
if (
|
|
36
|
-
accountAddresses.includes(transfer.from.address) &&
|
|
37
|
-
accountAddresses.includes(transfer.to.address)
|
|
38
|
-
) {
|
|
39
|
-
return {
|
|
40
|
-
type: 'AccountAction',
|
|
41
|
-
action: 'move',
|
|
42
|
-
source,
|
|
43
|
-
evidence: 'system-rule',
|
|
44
|
-
timestamp: action.timestamp,
|
|
45
|
-
order: 0,
|
|
46
|
-
comment: action.comment,
|
|
47
|
-
app: action.app,
|
|
48
|
-
transfers: [
|
|
49
|
-
{
|
|
50
|
-
...transfer,
|
|
51
|
-
target: '',
|
|
52
|
-
direction: 'none',
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
}
|
|
56
|
-
} else if (accountAddresses.includes(transfer.from.address)) {
|
|
57
|
-
return {
|
|
58
|
-
type: 'AccountAction',
|
|
59
|
-
action: 'transfer',
|
|
60
|
-
source,
|
|
61
|
-
evidence: action.evidence,
|
|
62
|
-
timestamp: action.timestamp,
|
|
63
|
-
order: 0,
|
|
64
|
-
comment: action.comment,
|
|
65
|
-
app: action.app,
|
|
66
|
-
transfers: [
|
|
67
|
-
{
|
|
68
|
-
...transfer,
|
|
69
|
-
target: transfer.from.address,
|
|
70
|
-
direction: 'out',
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
}
|
|
74
|
-
} else if (accountAddresses.includes(transfer.to.address)) {
|
|
75
|
-
return {
|
|
76
|
-
type: 'AccountAction',
|
|
77
|
-
action: 'income',
|
|
78
|
-
source,
|
|
79
|
-
evidence: action.evidence,
|
|
80
|
-
timestamp: action.timestamp,
|
|
81
|
-
order: 0,
|
|
82
|
-
comment: action.comment,
|
|
83
|
-
app: action.app,
|
|
84
|
-
transfers: [
|
|
85
|
-
{
|
|
86
|
-
...transfer,
|
|
87
|
-
target: transfer.to.address,
|
|
88
|
-
direction: 'in',
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
return undefined
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AccountAction,
|
|
3
|
-
AccountActionType,
|
|
4
|
-
CryptoCurrencyPrice,
|
|
5
|
-
NormalActionWithdraw,
|
|
6
|
-
} from '@0xtorch/core'
|
|
7
|
-
import type {
|
|
8
|
-
EvmAccount,
|
|
9
|
-
LowerHex,
|
|
10
|
-
TransactionDecoded,
|
|
11
|
-
TransactionSource,
|
|
12
|
-
} from '../../types'
|
|
13
|
-
import { toLowerHex } from '../../types'
|
|
14
|
-
|
|
15
|
-
export const createAccountActionByActionWithdraw = <
|
|
16
|
-
Price extends CryptoCurrencyPrice | undefined,
|
|
17
|
-
>(
|
|
18
|
-
action: NormalActionWithdraw<EvmAccount, Price>,
|
|
19
|
-
transaction: TransactionDecoded<Price>,
|
|
20
|
-
accountAddresses: readonly LowerHex[],
|
|
21
|
-
):
|
|
22
|
-
| AccountAction<
|
|
23
|
-
AccountActionType,
|
|
24
|
-
TransactionSource,
|
|
25
|
-
EvmAccount | undefined,
|
|
26
|
-
Price
|
|
27
|
-
>
|
|
28
|
-
| undefined => {
|
|
29
|
-
if (action.transfers.length !== 1) {
|
|
30
|
-
throw new Error('invalid action')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const transfer = action.transfers[0]
|
|
34
|
-
if (
|
|
35
|
-
accountAddresses.includes(transfer.from.address) &&
|
|
36
|
-
accountAddresses.includes(transfer.to.address)
|
|
37
|
-
) {
|
|
38
|
-
return undefined
|
|
39
|
-
} else if (accountAddresses.includes(transfer.to.address)) {
|
|
40
|
-
return {
|
|
41
|
-
type: 'AccountAction',
|
|
42
|
-
action: 'withdraw',
|
|
43
|
-
source:
|
|
44
|
-
`evm_${transaction.chainId}_${toLowerHex(transaction.transactionHash)}` as const,
|
|
45
|
-
evidence: action.evidence,
|
|
46
|
-
timestamp: action.timestamp,
|
|
47
|
-
order: 0,
|
|
48
|
-
comment: action.comment,
|
|
49
|
-
app: action.app,
|
|
50
|
-
transfers: [
|
|
51
|
-
{
|
|
52
|
-
...transfer,
|
|
53
|
-
target: transfer.to.address,
|
|
54
|
-
direction: 'in',
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
return undefined
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AccountAction,
|
|
3
|
-
AccountActionType,
|
|
4
|
-
CryptoCurrencyPrice,
|
|
5
|
-
NormalActionWithdrawWithBond,
|
|
6
|
-
} from '@0xtorch/core'
|
|
7
|
-
import type {
|
|
8
|
-
EvmAccount,
|
|
9
|
-
LowerHex,
|
|
10
|
-
TransactionDecoded,
|
|
11
|
-
TransactionSource,
|
|
12
|
-
} from '../../types'
|
|
13
|
-
import { toLowerHex } from '../../types'
|
|
14
|
-
|
|
15
|
-
export const createAccountActionByActionWithdrawWithBond = <
|
|
16
|
-
Price extends CryptoCurrencyPrice | undefined,
|
|
17
|
-
>(
|
|
18
|
-
action: NormalActionWithdrawWithBond<EvmAccount, Price>,
|
|
19
|
-
transaction: TransactionDecoded<Price>,
|
|
20
|
-
accountAddresses: readonly LowerHex[],
|
|
21
|
-
):
|
|
22
|
-
| AccountAction<
|
|
23
|
-
AccountActionType,
|
|
24
|
-
TransactionSource,
|
|
25
|
-
EvmAccount | undefined,
|
|
26
|
-
Price
|
|
27
|
-
>
|
|
28
|
-
| undefined => {
|
|
29
|
-
const transfersIn = action.transfers.filter(
|
|
30
|
-
(transfer) => transfer.direction === 'in',
|
|
31
|
-
)
|
|
32
|
-
const transfersOut = action.transfers.filter(
|
|
33
|
-
(transfer) => transfer.direction === 'out',
|
|
34
|
-
)
|
|
35
|
-
if (transfersIn.length === 0 || transfersOut.length === 0) {
|
|
36
|
-
throw new Error('invalid action')
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const source =
|
|
40
|
-
`evm_${transaction.chainId}_${toLowerHex(transaction.transactionHash)}` as const
|
|
41
|
-
|
|
42
|
-
return transfersIn.every((transfer) =>
|
|
43
|
-
accountAddresses.includes(transfer.to.address),
|
|
44
|
-
) &&
|
|
45
|
-
transfersOut.every((transfer) =>
|
|
46
|
-
accountAddresses.includes(transfer.from.address),
|
|
47
|
-
)
|
|
48
|
-
? {
|
|
49
|
-
type: 'AccountAction',
|
|
50
|
-
action: 'withdraw-with-bond',
|
|
51
|
-
source,
|
|
52
|
-
evidence: action.evidence,
|
|
53
|
-
timestamp: action.timestamp,
|
|
54
|
-
order: 0,
|
|
55
|
-
comment: action.comment,
|
|
56
|
-
app: action.app,
|
|
57
|
-
transfers: action.transfers,
|
|
58
|
-
}
|
|
59
|
-
: undefined
|
|
60
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { createBigDecimal } from '@0xtorch/big-decimal'
|
|
2
|
-
import type {
|
|
3
|
-
ActionType,
|
|
4
|
-
CryptoCurrencyPrice,
|
|
5
|
-
NormalAction,
|
|
6
|
-
} from '@0xtorch/core'
|
|
7
|
-
import type { Chain } from '../../chains'
|
|
8
|
-
import { createEvmAccount } from '../../creates/createEvmAccount'
|
|
9
|
-
import type {
|
|
10
|
-
EvmAccount,
|
|
11
|
-
LogData,
|
|
12
|
-
LowerHex,
|
|
13
|
-
TransactionDecoded,
|
|
14
|
-
} from '../../types'
|
|
15
|
-
import { isHex, toLowerHex } from '../../types'
|
|
16
|
-
import type {
|
|
17
|
-
ActionGeneratorAnyLog,
|
|
18
|
-
ActionGeneratorAnyLogAddress,
|
|
19
|
-
ActionGeneratorAnyLogAmount,
|
|
20
|
-
} from './types'
|
|
21
|
-
|
|
22
|
-
export const generateActionsByAnyLogGenerator = <
|
|
23
|
-
Price extends CryptoCurrencyPrice | undefined,
|
|
24
|
-
>(
|
|
25
|
-
generator: ActionGeneratorAnyLog,
|
|
26
|
-
chain: Chain,
|
|
27
|
-
transaction: TransactionDecoded<Price>,
|
|
28
|
-
): NormalAction<ActionType, EvmAccount, Price>[] => {
|
|
29
|
-
const { chainId, block, app, nativeTokenPrice, logs } = transaction
|
|
30
|
-
|
|
31
|
-
const getTarget = (from: LowerHex, to: LowerHex) => {
|
|
32
|
-
switch (generator.target) {
|
|
33
|
-
case 'from': {
|
|
34
|
-
return from
|
|
35
|
-
}
|
|
36
|
-
case 'to': {
|
|
37
|
-
return to
|
|
38
|
-
}
|
|
39
|
-
case 'none': {
|
|
40
|
-
return ''
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const getDirection = () => {
|
|
45
|
-
switch (generator.target) {
|
|
46
|
-
case 'from': {
|
|
47
|
-
return 'out'
|
|
48
|
-
}
|
|
49
|
-
case 'to': {
|
|
50
|
-
return 'in'
|
|
51
|
-
}
|
|
52
|
-
case 'none': {
|
|
53
|
-
return 'none'
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const direction = getDirection()
|
|
58
|
-
|
|
59
|
-
const targetLogs = logs.filter(
|
|
60
|
-
(log) =>
|
|
61
|
-
log.log.topics[0] === generator.signature &&
|
|
62
|
-
log.log.topics.length - 1 === generator.indexedCount,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
switch (generator.token.token) {
|
|
66
|
-
case 'native': {
|
|
67
|
-
return targetLogs.map((log) => {
|
|
68
|
-
const from = getAddress(generator.from, log, transaction)
|
|
69
|
-
const to = getAddress(generator.to, log, transaction)
|
|
70
|
-
return {
|
|
71
|
-
type: 'NormalAction',
|
|
72
|
-
action: generator.action,
|
|
73
|
-
evidence: 'contract',
|
|
74
|
-
timestamp: Number(block.timestamp) * 1000,
|
|
75
|
-
comment: generator.comment,
|
|
76
|
-
app,
|
|
77
|
-
transfers: [
|
|
78
|
-
{
|
|
79
|
-
target: getTarget(from, to),
|
|
80
|
-
direction,
|
|
81
|
-
from: createEvmAccount({ address: from, chainId }),
|
|
82
|
-
to: createEvmAccount({ address: to, chainId }),
|
|
83
|
-
asset: chain.nativeToken.currency,
|
|
84
|
-
amount: createBigDecimal(
|
|
85
|
-
getAmount(generator.amount, log, transaction),
|
|
86
|
-
chain.nativeToken.decimals,
|
|
87
|
-
),
|
|
88
|
-
price: nativeTokenPrice,
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const getAddress = <Price extends CryptoCurrencyPrice | undefined>(
|
|
98
|
-
generator: ActionGeneratorAnyLogAddress,
|
|
99
|
-
targetLog: LogData,
|
|
100
|
-
transaction: TransactionDecoded<Price>,
|
|
101
|
-
): LowerHex => {
|
|
102
|
-
switch (generator.type) {
|
|
103
|
-
case 'from': {
|
|
104
|
-
return toLowerHex(transaction.from)
|
|
105
|
-
}
|
|
106
|
-
case 'to': {
|
|
107
|
-
if (transaction.to === null) {
|
|
108
|
-
throw new Error('Transaction.to is null')
|
|
109
|
-
}
|
|
110
|
-
return toLowerHex(transaction.to)
|
|
111
|
-
}
|
|
112
|
-
case 'fix-value': {
|
|
113
|
-
return generator.value
|
|
114
|
-
}
|
|
115
|
-
case 'target': {
|
|
116
|
-
if (
|
|
117
|
-
targetLog.type === 'LogOriginal' ||
|
|
118
|
-
targetLog.log.args.length <= generator.argIndex
|
|
119
|
-
) {
|
|
120
|
-
throw new Error('Invalid target log')
|
|
121
|
-
}
|
|
122
|
-
const value = String(targetLog.log.args[generator.argIndex].value)
|
|
123
|
-
if (isHex(value)) {
|
|
124
|
-
return toLowerHex(value)
|
|
125
|
-
} else {
|
|
126
|
-
throw new Error('Invalid target log')
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
case 'log': {
|
|
130
|
-
const log = transaction.logs.filter(
|
|
131
|
-
(log) =>
|
|
132
|
-
log.log.topics[0] === generator.signature &&
|
|
133
|
-
log.log.topics.length - 1 === generator.indexedCount,
|
|
134
|
-
)[generator.index]
|
|
135
|
-
if (
|
|
136
|
-
log === undefined ||
|
|
137
|
-
log.type === 'LogOriginal' ||
|
|
138
|
-
log.log.args.length <= generator.argIndex
|
|
139
|
-
) {
|
|
140
|
-
throw new Error('Invalid log')
|
|
141
|
-
}
|
|
142
|
-
const value = String(log.log.args[generator.argIndex].value)
|
|
143
|
-
if (isHex(value)) {
|
|
144
|
-
return toLowerHex(value)
|
|
145
|
-
} else {
|
|
146
|
-
throw new Error('Invalid log')
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const getAmount = <Price extends CryptoCurrencyPrice | undefined>(
|
|
153
|
-
generator: ActionGeneratorAnyLogAmount,
|
|
154
|
-
targetLog: LogData,
|
|
155
|
-
transaction: TransactionDecoded<Price>,
|
|
156
|
-
): bigint => {
|
|
157
|
-
switch (generator.type) {
|
|
158
|
-
case 'value': {
|
|
159
|
-
return transaction.value
|
|
160
|
-
}
|
|
161
|
-
case 'fix-value': {
|
|
162
|
-
return generator.value
|
|
163
|
-
}
|
|
164
|
-
case 'target': {
|
|
165
|
-
if (
|
|
166
|
-
targetLog.type === 'LogOriginal' ||
|
|
167
|
-
targetLog.log.args.length <= generator.argIndex
|
|
168
|
-
) {
|
|
169
|
-
throw new Error('Invalid target log')
|
|
170
|
-
}
|
|
171
|
-
const value = targetLog.log.args[generator.argIndex].value
|
|
172
|
-
if (typeof value === 'bigint') {
|
|
173
|
-
return value
|
|
174
|
-
} else if (typeof value === 'string') {
|
|
175
|
-
return BigInt(value)
|
|
176
|
-
} else if (typeof value === 'number') {
|
|
177
|
-
return BigInt(value)
|
|
178
|
-
} else {
|
|
179
|
-
throw new TypeError('Invalid target log')
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
case 'log': {
|
|
183
|
-
const log = transaction.logs.filter(
|
|
184
|
-
(log) =>
|
|
185
|
-
log.log.topics[0] === generator.signature &&
|
|
186
|
-
log.log.topics.length - 1 === generator.indexedCount,
|
|
187
|
-
)[generator.index]
|
|
188
|
-
if (
|
|
189
|
-
log === undefined ||
|
|
190
|
-
log.type === 'LogOriginal' ||
|
|
191
|
-
log.log.args.length <= generator.argIndex
|
|
192
|
-
) {
|
|
193
|
-
throw new Error('Invalid log')
|
|
194
|
-
}
|
|
195
|
-
const value = log.log.args[generator.argIndex].value
|
|
196
|
-
if (typeof value === 'bigint') {
|
|
197
|
-
return value
|
|
198
|
-
} else if (typeof value === 'string') {
|
|
199
|
-
return BigInt(value)
|
|
200
|
-
} else if (typeof value === 'number') {
|
|
201
|
-
return BigInt(value)
|
|
202
|
-
} else {
|
|
203
|
-
throw new TypeError('Invalid log')
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { createBigDecimal } from '@0xtorch/big-decimal'
|
|
2
|
-
import type {
|
|
3
|
-
ActionType,
|
|
4
|
-
CryptoCurrencyPrice,
|
|
5
|
-
NormalAction,
|
|
6
|
-
} from '@0xtorch/core'
|
|
7
|
-
import { createEvmAccount } from '../../creates/createEvmAccount'
|
|
8
|
-
import type { EvmAccount, LowerHex, TransactionDecoded } from '../../types'
|
|
9
|
-
import type { ActionGeneratorAnyTokenTransfer } from './types'
|
|
10
|
-
|
|
11
|
-
export const generateActionsByAnyTokenTransferGenerator = <
|
|
12
|
-
Price extends CryptoCurrencyPrice | undefined,
|
|
13
|
-
>(
|
|
14
|
-
generator: ActionGeneratorAnyTokenTransfer,
|
|
15
|
-
transaction: TransactionDecoded<Price>,
|
|
16
|
-
): NormalAction<ActionType, EvmAccount, Price>[] => {
|
|
17
|
-
const {
|
|
18
|
-
chainId,
|
|
19
|
-
block,
|
|
20
|
-
app,
|
|
21
|
-
erc20Transfers,
|
|
22
|
-
erc721Transfers,
|
|
23
|
-
erc1155Transfers,
|
|
24
|
-
} = transaction
|
|
25
|
-
const getTarget = (from: LowerHex, to: LowerHex) => {
|
|
26
|
-
switch (generator.target) {
|
|
27
|
-
case 'from': {
|
|
28
|
-
return from
|
|
29
|
-
}
|
|
30
|
-
case 'to': {
|
|
31
|
-
return to
|
|
32
|
-
}
|
|
33
|
-
case 'none': {
|
|
34
|
-
return ''
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const getDirection = () => {
|
|
39
|
-
switch (generator.target) {
|
|
40
|
-
case 'from': {
|
|
41
|
-
return 'out'
|
|
42
|
-
}
|
|
43
|
-
case 'to': {
|
|
44
|
-
return 'in'
|
|
45
|
-
}
|
|
46
|
-
case 'none': {
|
|
47
|
-
return 'none'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const direction = getDirection()
|
|
52
|
-
|
|
53
|
-
switch (generator.token) {
|
|
54
|
-
case 'erc1155': {
|
|
55
|
-
return erc1155Transfers.map((transfer) => ({
|
|
56
|
-
type: 'NormalAction',
|
|
57
|
-
action: generator.action,
|
|
58
|
-
evidence: 'contract',
|
|
59
|
-
timestamp: Number(block.timestamp) * 1000,
|
|
60
|
-
comment: generator.comment,
|
|
61
|
-
app,
|
|
62
|
-
transfers: [
|
|
63
|
-
{
|
|
64
|
-
target: getTarget(transfer.from, transfer.to),
|
|
65
|
-
direction,
|
|
66
|
-
from: createEvmAccount({ address: transfer.from, chainId }),
|
|
67
|
-
to: createEvmAccount({ address: transfer.to, chainId }),
|
|
68
|
-
asset: transfer.nft,
|
|
69
|
-
amount: createBigDecimal(transfer.value),
|
|
70
|
-
price: undefined as Price,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
}))
|
|
74
|
-
}
|
|
75
|
-
case 'erc20': {
|
|
76
|
-
return erc20Transfers.map((transfer) => ({
|
|
77
|
-
type: 'NormalAction',
|
|
78
|
-
action: generator.action,
|
|
79
|
-
evidence: 'contract',
|
|
80
|
-
timestamp: Number(block.timestamp) * 1000,
|
|
81
|
-
comment: generator.comment,
|
|
82
|
-
app,
|
|
83
|
-
transfers: [
|
|
84
|
-
{
|
|
85
|
-
target: getTarget(transfer.from, transfer.to),
|
|
86
|
-
direction,
|
|
87
|
-
from: createEvmAccount({ address: transfer.from, chainId }),
|
|
88
|
-
to: createEvmAccount({ address: transfer.to, chainId }),
|
|
89
|
-
asset: transfer.token.currency,
|
|
90
|
-
amount: createBigDecimal(transfer.value, transfer.token.decimals),
|
|
91
|
-
price: transfer.price,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
}))
|
|
95
|
-
}
|
|
96
|
-
case 'erc721': {
|
|
97
|
-
return erc721Transfers.map((transfer) => ({
|
|
98
|
-
type: 'NormalAction',
|
|
99
|
-
action: generator.action,
|
|
100
|
-
evidence: 'contract',
|
|
101
|
-
timestamp: Number(block.timestamp) * 1000,
|
|
102
|
-
comment: generator.comment,
|
|
103
|
-
app,
|
|
104
|
-
transfers: [
|
|
105
|
-
{
|
|
106
|
-
target: getTarget(transfer.from, transfer.to),
|
|
107
|
-
direction,
|
|
108
|
-
from: createEvmAccount({ address: transfer.from, chainId }),
|
|
109
|
-
to: createEvmAccount({ address: transfer.to, chainId }),
|
|
110
|
-
asset: transfer.nft,
|
|
111
|
-
amount: createBigDecimal(1n),
|
|
112
|
-
price: undefined as Price,
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
}))
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|