@0xtorch/evm 0.0.11 → 0.0.12
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 +774 -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 +279 -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 +825 -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 +340 -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 +56942 -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/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 +1166 -0
- package/analyzer/json/index.ts +1 -0
- package/analyzer/json/schemas/generator.ts +387 -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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { CryptoCurrencyPrice } from '@0xtorch/core'
|
|
2
|
+
import type { TransactionDecoded } from '../../../types'
|
|
3
|
+
import type { LogArgumentRawComponent, Target } from '../types'
|
|
4
|
+
|
|
5
|
+
type GetLogArgumentRawComponentParameters<
|
|
6
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
7
|
+
> = {
|
|
8
|
+
readonly component: LogArgumentRawComponent
|
|
9
|
+
readonly transaction: TransactionDecoded<Price>
|
|
10
|
+
} & Target<Price>
|
|
11
|
+
|
|
12
|
+
export const getLogArgumentRawComponent = <
|
|
13
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
14
|
+
>({
|
|
15
|
+
component,
|
|
16
|
+
transaction,
|
|
17
|
+
targetsLog = [],
|
|
18
|
+
}: GetLogArgumentRawComponentParameters<Price>): unknown => {
|
|
19
|
+
const logs = component.target === true ? targetsLog : transaction.logs
|
|
20
|
+
const filteredLogs = logs.filter((log) => {
|
|
21
|
+
if (
|
|
22
|
+
component.signature !== undefined &&
|
|
23
|
+
component.signature !== log.log.topics[0]
|
|
24
|
+
) {
|
|
25
|
+
return false
|
|
26
|
+
}
|
|
27
|
+
if (
|
|
28
|
+
component.indexedCount !== undefined &&
|
|
29
|
+
component.indexedCount !== log.log.topics.length - 1
|
|
30
|
+
) {
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
33
|
+
if (component.args !== undefined) {
|
|
34
|
+
for (const { index, value } of component.args) {
|
|
35
|
+
if (log.type !== 'decoded' || log.log.args.length <= index) {
|
|
36
|
+
return false
|
|
37
|
+
}
|
|
38
|
+
const argument = String(log.log.args[index].value).toLowerCase()
|
|
39
|
+
if (argument !== value) {
|
|
40
|
+
return false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return true
|
|
45
|
+
})
|
|
46
|
+
if (filteredLogs.length <= component.index) {
|
|
47
|
+
throw new Error('filteredLogs.length <= condition.index')
|
|
48
|
+
}
|
|
49
|
+
const log = filteredLogs[component.index]
|
|
50
|
+
if (log.type !== 'decoded') {
|
|
51
|
+
throw new Error('log is not decoded')
|
|
52
|
+
}
|
|
53
|
+
if (log.log.args.length <= component.argIndex) {
|
|
54
|
+
throw new Error('log.log.args.length <= condition.argIndex')
|
|
55
|
+
}
|
|
56
|
+
return log.log.args[component.argIndex].value
|
|
57
|
+
}
|
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import type { BigDecimal } from '@0xtorch/big-decimal'
|
|
2
|
+
import { createBigDecimal, plus } from '@0xtorch/big-decimal'
|
|
3
|
+
import type {
|
|
4
|
+
CryptoCurrency,
|
|
5
|
+
CryptoCurrencyPrice,
|
|
6
|
+
Nft,
|
|
7
|
+
Transfer,
|
|
8
|
+
} from '@0xtorch/core'
|
|
9
|
+
import type { Chain } from '../../../chains'
|
|
10
|
+
import type { LowerHex, TransactionDecoded } from '../../../types'
|
|
11
|
+
import { isHex, toLowerHex } from '../../../types'
|
|
12
|
+
import { createEvmAddressId } from '../../../utils'
|
|
13
|
+
import type {
|
|
14
|
+
Target,
|
|
15
|
+
TransferComponent,
|
|
16
|
+
TransferCustomAddressComponent,
|
|
17
|
+
TransferCustomAmountComponent,
|
|
18
|
+
TransferCustomAssetComponent,
|
|
19
|
+
} from '../types'
|
|
20
|
+
import { getErc1155Component } from './erc1155'
|
|
21
|
+
import { getErc20Component } from './erc20'
|
|
22
|
+
import { getErc721Component } from './erc721'
|
|
23
|
+
import { getInternalComponent } from './internal'
|
|
24
|
+
import { getLogArgumentComponent } from './logArgument'
|
|
25
|
+
|
|
26
|
+
type CreateTransfersByTransferComponentParameters<
|
|
27
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
28
|
+
> = {
|
|
29
|
+
readonly component: TransferComponent
|
|
30
|
+
readonly transaction: TransactionDecoded<Price>
|
|
31
|
+
readonly chain: Chain
|
|
32
|
+
} & Target<Price>
|
|
33
|
+
|
|
34
|
+
export const createTransfersByTransferComponent = <
|
|
35
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
36
|
+
>({
|
|
37
|
+
component,
|
|
38
|
+
transaction,
|
|
39
|
+
chain,
|
|
40
|
+
targetsErc20 = [],
|
|
41
|
+
targetsErc721 = [],
|
|
42
|
+
targetsErc1155 = [],
|
|
43
|
+
targetsInternal = [],
|
|
44
|
+
targetsLog = [],
|
|
45
|
+
}: CreateTransfersByTransferComponentParameters<Price>): readonly Transfer[] => {
|
|
46
|
+
switch (component.type) {
|
|
47
|
+
case 'value': {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
from: createEvmAddressId({
|
|
51
|
+
chainId: chain.id,
|
|
52
|
+
address: toLowerHex(transaction.from),
|
|
53
|
+
}),
|
|
54
|
+
to:
|
|
55
|
+
transaction.to === null
|
|
56
|
+
? undefined
|
|
57
|
+
: createEvmAddressId({
|
|
58
|
+
chainId: chain.id,
|
|
59
|
+
address: toLowerHex(transaction.to),
|
|
60
|
+
}),
|
|
61
|
+
asset: chain.nativeToken.currency,
|
|
62
|
+
amount: createBigDecimal(
|
|
63
|
+
transaction.value,
|
|
64
|
+
chain.nativeToken.decimals,
|
|
65
|
+
),
|
|
66
|
+
price: transaction.nativeTokenPrice,
|
|
67
|
+
direction: component.direction,
|
|
68
|
+
},
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
case 'internal': {
|
|
72
|
+
const internals = getInternalComponent({
|
|
73
|
+
component,
|
|
74
|
+
transaction,
|
|
75
|
+
targetsErc20,
|
|
76
|
+
targetsErc721,
|
|
77
|
+
targetsErc1155,
|
|
78
|
+
targetsInternal,
|
|
79
|
+
targetsLog,
|
|
80
|
+
})
|
|
81
|
+
return internals.map((internal) => ({
|
|
82
|
+
from: createEvmAddressId({
|
|
83
|
+
chainId: chain.id,
|
|
84
|
+
address: internal.from,
|
|
85
|
+
}),
|
|
86
|
+
to:
|
|
87
|
+
internal.to === undefined
|
|
88
|
+
? undefined
|
|
89
|
+
: createEvmAddressId({
|
|
90
|
+
chainId: chain.id,
|
|
91
|
+
address: internal.to,
|
|
92
|
+
}),
|
|
93
|
+
asset: chain.nativeToken.currency,
|
|
94
|
+
amount: createBigDecimal(internal.value, chain.nativeToken.decimals),
|
|
95
|
+
price: transaction.nativeTokenPrice,
|
|
96
|
+
direction: component.direction,
|
|
97
|
+
}))
|
|
98
|
+
}
|
|
99
|
+
case 'erc20': {
|
|
100
|
+
const transfers = getErc20Component({
|
|
101
|
+
component,
|
|
102
|
+
transaction,
|
|
103
|
+
targetsErc20,
|
|
104
|
+
targetsErc721,
|
|
105
|
+
targetsErc1155,
|
|
106
|
+
targetsInternal,
|
|
107
|
+
targetsLog,
|
|
108
|
+
})
|
|
109
|
+
return transfers.map((transfer) => ({
|
|
110
|
+
from: createEvmAddressId({
|
|
111
|
+
chainId: chain.id,
|
|
112
|
+
address: transfer.from,
|
|
113
|
+
}),
|
|
114
|
+
to: createEvmAddressId({
|
|
115
|
+
chainId: chain.id,
|
|
116
|
+
address: transfer.to,
|
|
117
|
+
}),
|
|
118
|
+
asset: transfer.token.currency,
|
|
119
|
+
amount: createBigDecimal(transfer.value, transfer.token.decimals),
|
|
120
|
+
price: transfer.price,
|
|
121
|
+
direction: component.direction,
|
|
122
|
+
}))
|
|
123
|
+
}
|
|
124
|
+
case 'erc721': {
|
|
125
|
+
const transfers = getErc721Component({
|
|
126
|
+
component,
|
|
127
|
+
transaction,
|
|
128
|
+
targetsErc20,
|
|
129
|
+
targetsErc721,
|
|
130
|
+
targetsErc1155,
|
|
131
|
+
targetsInternal,
|
|
132
|
+
targetsLog,
|
|
133
|
+
})
|
|
134
|
+
return transfers.map((transfer) => ({
|
|
135
|
+
from: createEvmAddressId({
|
|
136
|
+
chainId: chain.id,
|
|
137
|
+
address: transfer.from,
|
|
138
|
+
}),
|
|
139
|
+
to: createEvmAddressId({
|
|
140
|
+
chainId: chain.id,
|
|
141
|
+
address: transfer.to,
|
|
142
|
+
}),
|
|
143
|
+
asset: transfer.nft,
|
|
144
|
+
amount: createBigDecimal(1n),
|
|
145
|
+
price: undefined,
|
|
146
|
+
direction: component.direction,
|
|
147
|
+
}))
|
|
148
|
+
}
|
|
149
|
+
case 'erc1155': {
|
|
150
|
+
const transfers = getErc1155Component({
|
|
151
|
+
component,
|
|
152
|
+
transaction,
|
|
153
|
+
targetsErc20,
|
|
154
|
+
targetsErc721,
|
|
155
|
+
targetsErc1155,
|
|
156
|
+
targetsInternal,
|
|
157
|
+
targetsLog,
|
|
158
|
+
})
|
|
159
|
+
return transfers.map((transfer) => ({
|
|
160
|
+
from: createEvmAddressId({
|
|
161
|
+
chainId: chain.id,
|
|
162
|
+
address: transfer.from,
|
|
163
|
+
}),
|
|
164
|
+
to: createEvmAddressId({
|
|
165
|
+
chainId: chain.id,
|
|
166
|
+
address: transfer.to,
|
|
167
|
+
}),
|
|
168
|
+
asset: transfer.nft,
|
|
169
|
+
amount: createBigDecimal(transfer.value),
|
|
170
|
+
price: undefined,
|
|
171
|
+
direction: component.direction,
|
|
172
|
+
}))
|
|
173
|
+
}
|
|
174
|
+
case 'custom': {
|
|
175
|
+
const from = getAddressByTransferCustomAddressComponent({
|
|
176
|
+
component: component.from,
|
|
177
|
+
transaction,
|
|
178
|
+
targetsErc20,
|
|
179
|
+
targetsErc721,
|
|
180
|
+
targetsErc1155,
|
|
181
|
+
targetsInternal,
|
|
182
|
+
targetsLog,
|
|
183
|
+
})
|
|
184
|
+
const to = getAddressByTransferCustomAddressComponent({
|
|
185
|
+
component: component.to,
|
|
186
|
+
transaction,
|
|
187
|
+
targetsErc20,
|
|
188
|
+
targetsErc721,
|
|
189
|
+
targetsErc1155,
|
|
190
|
+
targetsInternal,
|
|
191
|
+
targetsLog,
|
|
192
|
+
})
|
|
193
|
+
const asset = getAssetByTransferCustomAssetComponent({
|
|
194
|
+
component: component.asset,
|
|
195
|
+
transaction,
|
|
196
|
+
chain,
|
|
197
|
+
targetsErc20,
|
|
198
|
+
targetsErc721,
|
|
199
|
+
targetsErc1155,
|
|
200
|
+
targetsInternal,
|
|
201
|
+
targetsLog,
|
|
202
|
+
})
|
|
203
|
+
const amount = component.amount
|
|
204
|
+
.map((item) =>
|
|
205
|
+
getAmountByTransferCustomAmountComponent({
|
|
206
|
+
component: item,
|
|
207
|
+
transaction,
|
|
208
|
+
chain,
|
|
209
|
+
targetsErc20,
|
|
210
|
+
targetsErc721,
|
|
211
|
+
targetsErc1155,
|
|
212
|
+
targetsInternal,
|
|
213
|
+
targetsLog,
|
|
214
|
+
}),
|
|
215
|
+
)
|
|
216
|
+
.reduce((a, b) => plus(a, b), createBigDecimal(0n))
|
|
217
|
+
return [
|
|
218
|
+
{
|
|
219
|
+
from: createEvmAddressId({
|
|
220
|
+
chainId: chain.id,
|
|
221
|
+
address: from,
|
|
222
|
+
}),
|
|
223
|
+
to: createEvmAddressId({
|
|
224
|
+
chainId: chain.id,
|
|
225
|
+
address: to,
|
|
226
|
+
}),
|
|
227
|
+
asset,
|
|
228
|
+
amount,
|
|
229
|
+
price: getPrice(asset, transaction),
|
|
230
|
+
direction: component.direction,
|
|
231
|
+
},
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const getPrice = <Price extends CryptoCurrencyPrice | undefined>(
|
|
238
|
+
asset: CryptoCurrency | Nft,
|
|
239
|
+
transaction: TransactionDecoded<Price>,
|
|
240
|
+
): CryptoCurrencyPrice | undefined => {
|
|
241
|
+
switch (asset.type) {
|
|
242
|
+
case 'CryptoCurrency': {
|
|
243
|
+
const transfer = transaction.erc20Transfers.find(
|
|
244
|
+
(transfer) => transfer.token.currency.id === asset.id,
|
|
245
|
+
)
|
|
246
|
+
return transfer === undefined
|
|
247
|
+
? transaction.nativeTokenPrice
|
|
248
|
+
: transfer.price
|
|
249
|
+
}
|
|
250
|
+
case 'Nft': {
|
|
251
|
+
return undefined
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const getAddressByTransferCustomAddressComponent = <
|
|
257
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
258
|
+
>({
|
|
259
|
+
component,
|
|
260
|
+
transaction,
|
|
261
|
+
targetsErc20 = [],
|
|
262
|
+
targetsErc721 = [],
|
|
263
|
+
targetsErc1155 = [],
|
|
264
|
+
targetsInternal = [],
|
|
265
|
+
targetsLog = [],
|
|
266
|
+
}: {
|
|
267
|
+
readonly component: TransferCustomAddressComponent
|
|
268
|
+
readonly transaction: TransactionDecoded<Price>
|
|
269
|
+
} & Target<Price>): LowerHex => {
|
|
270
|
+
if (typeof component === 'string') {
|
|
271
|
+
return component
|
|
272
|
+
}
|
|
273
|
+
switch (component.type) {
|
|
274
|
+
case 'from': {
|
|
275
|
+
return toLowerHex(transaction.from)
|
|
276
|
+
}
|
|
277
|
+
case 'to': {
|
|
278
|
+
return transaction.to === null ? '0x' : toLowerHex(transaction.to)
|
|
279
|
+
}
|
|
280
|
+
case 'erc20': {
|
|
281
|
+
const [transfer] = getErc20Component({
|
|
282
|
+
component,
|
|
283
|
+
transaction,
|
|
284
|
+
targetsErc20,
|
|
285
|
+
targetsErc721,
|
|
286
|
+
targetsErc1155,
|
|
287
|
+
targetsInternal,
|
|
288
|
+
targetsLog,
|
|
289
|
+
})
|
|
290
|
+
switch (component.key) {
|
|
291
|
+
case 'from': {
|
|
292
|
+
return transfer.from
|
|
293
|
+
}
|
|
294
|
+
case 'to': {
|
|
295
|
+
return transfer.to
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
throw new Error('Not reachable')
|
|
299
|
+
}
|
|
300
|
+
case 'erc721': {
|
|
301
|
+
const [transfer] = getErc721Component({
|
|
302
|
+
component,
|
|
303
|
+
transaction,
|
|
304
|
+
targetsErc20,
|
|
305
|
+
targetsErc721,
|
|
306
|
+
targetsErc1155,
|
|
307
|
+
targetsInternal,
|
|
308
|
+
targetsLog,
|
|
309
|
+
})
|
|
310
|
+
switch (component.key) {
|
|
311
|
+
case 'from': {
|
|
312
|
+
return transfer.from
|
|
313
|
+
}
|
|
314
|
+
case 'to': {
|
|
315
|
+
return transfer.to
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
throw new Error('Not reachable')
|
|
319
|
+
}
|
|
320
|
+
case 'erc1155': {
|
|
321
|
+
const [transfer] = getErc1155Component({
|
|
322
|
+
component,
|
|
323
|
+
transaction,
|
|
324
|
+
targetsErc20,
|
|
325
|
+
targetsErc721,
|
|
326
|
+
targetsErc1155,
|
|
327
|
+
targetsInternal,
|
|
328
|
+
targetsLog,
|
|
329
|
+
})
|
|
330
|
+
switch (component.key) {
|
|
331
|
+
case 'from': {
|
|
332
|
+
return transfer.from
|
|
333
|
+
}
|
|
334
|
+
case 'to': {
|
|
335
|
+
return transfer.to
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
throw new Error('Not reachable')
|
|
339
|
+
}
|
|
340
|
+
case 'internal': {
|
|
341
|
+
const [internal] = getInternalComponent({
|
|
342
|
+
component,
|
|
343
|
+
transaction,
|
|
344
|
+
targetsErc20,
|
|
345
|
+
targetsErc721,
|
|
346
|
+
targetsErc1155,
|
|
347
|
+
targetsInternal,
|
|
348
|
+
targetsLog,
|
|
349
|
+
})
|
|
350
|
+
switch (component.key) {
|
|
351
|
+
case 'from': {
|
|
352
|
+
return internal.from
|
|
353
|
+
}
|
|
354
|
+
case 'to': {
|
|
355
|
+
return internal.to ?? '0x'
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
throw new Error('Not reachable')
|
|
359
|
+
}
|
|
360
|
+
case 'log': {
|
|
361
|
+
const [argument] = getLogArgumentComponent({
|
|
362
|
+
component,
|
|
363
|
+
transaction,
|
|
364
|
+
targetsLog,
|
|
365
|
+
})
|
|
366
|
+
const address = String(argument)
|
|
367
|
+
if (!isHex(address)) {
|
|
368
|
+
throw new Error(`Invalid address: ${address}`)
|
|
369
|
+
}
|
|
370
|
+
return toLowerHex(address)
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const getAssetByTransferCustomAssetComponent = <
|
|
376
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
377
|
+
>({
|
|
378
|
+
component,
|
|
379
|
+
transaction,
|
|
380
|
+
chain,
|
|
381
|
+
targetsErc20 = [],
|
|
382
|
+
targetsErc721 = [],
|
|
383
|
+
targetsErc1155 = [],
|
|
384
|
+
targetsInternal = [],
|
|
385
|
+
targetsLog = [],
|
|
386
|
+
}: {
|
|
387
|
+
readonly component: TransferCustomAssetComponent
|
|
388
|
+
readonly transaction: TransactionDecoded<Price>
|
|
389
|
+
readonly chain: Chain
|
|
390
|
+
} & Target<Price>): CryptoCurrency | Nft => {
|
|
391
|
+
if (typeof component === 'string' && component === 'native') {
|
|
392
|
+
return chain.nativeToken.currency
|
|
393
|
+
}
|
|
394
|
+
switch (component.type) {
|
|
395
|
+
case 'erc20': {
|
|
396
|
+
const [transfer] = getErc20Component({
|
|
397
|
+
component,
|
|
398
|
+
transaction,
|
|
399
|
+
targetsErc20,
|
|
400
|
+
targetsErc721,
|
|
401
|
+
targetsErc1155,
|
|
402
|
+
targetsInternal,
|
|
403
|
+
targetsLog,
|
|
404
|
+
})
|
|
405
|
+
return transfer.token.currency
|
|
406
|
+
}
|
|
407
|
+
case 'erc721': {
|
|
408
|
+
const [transfer] = getErc721Component({
|
|
409
|
+
component,
|
|
410
|
+
transaction,
|
|
411
|
+
targetsErc20,
|
|
412
|
+
targetsErc721,
|
|
413
|
+
targetsErc1155,
|
|
414
|
+
targetsInternal,
|
|
415
|
+
targetsLog,
|
|
416
|
+
})
|
|
417
|
+
return transfer.nft
|
|
418
|
+
}
|
|
419
|
+
case 'erc1155': {
|
|
420
|
+
const [transfer] = getErc1155Component({
|
|
421
|
+
component,
|
|
422
|
+
transaction,
|
|
423
|
+
targetsErc20,
|
|
424
|
+
targetsErc721,
|
|
425
|
+
targetsErc1155,
|
|
426
|
+
targetsInternal,
|
|
427
|
+
targetsLog,
|
|
428
|
+
})
|
|
429
|
+
return transfer.nft
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const getAmountByTransferCustomAmountComponent = <
|
|
435
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
436
|
+
>({
|
|
437
|
+
component,
|
|
438
|
+
transaction,
|
|
439
|
+
chain,
|
|
440
|
+
targetsErc20 = [],
|
|
441
|
+
targetsErc721 = [],
|
|
442
|
+
targetsErc1155 = [],
|
|
443
|
+
targetsInternal = [],
|
|
444
|
+
targetsLog = [],
|
|
445
|
+
}: {
|
|
446
|
+
readonly component: TransferCustomAmountComponent
|
|
447
|
+
readonly transaction: TransactionDecoded<Price>
|
|
448
|
+
readonly chain: Chain
|
|
449
|
+
} & Target<Price>): BigDecimal => {
|
|
450
|
+
const { plus, value } = component
|
|
451
|
+
if ('decimals' in value) {
|
|
452
|
+
return plus
|
|
453
|
+
? value
|
|
454
|
+
: {
|
|
455
|
+
value: value.value * -1n,
|
|
456
|
+
decimals: value.decimals,
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
switch (value.type) {
|
|
460
|
+
case 'value': {
|
|
461
|
+
const amount = createBigDecimal(
|
|
462
|
+
transaction.value,
|
|
463
|
+
chain.nativeToken.decimals,
|
|
464
|
+
)
|
|
465
|
+
return plus
|
|
466
|
+
? amount
|
|
467
|
+
: {
|
|
468
|
+
value: amount.value * -1n,
|
|
469
|
+
decimals: amount.decimals,
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
case 'internal': {
|
|
473
|
+
const [internal] = getInternalComponent({
|
|
474
|
+
component: value,
|
|
475
|
+
transaction,
|
|
476
|
+
targetsErc20,
|
|
477
|
+
targetsErc721,
|
|
478
|
+
targetsErc1155,
|
|
479
|
+
targetsInternal,
|
|
480
|
+
targetsLog,
|
|
481
|
+
})
|
|
482
|
+
const amount = createBigDecimal(
|
|
483
|
+
internal.value,
|
|
484
|
+
chain.nativeToken.decimals,
|
|
485
|
+
)
|
|
486
|
+
return plus
|
|
487
|
+
? amount
|
|
488
|
+
: {
|
|
489
|
+
value: amount.value * -1n,
|
|
490
|
+
decimals: amount.decimals,
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
case 'erc20': {
|
|
494
|
+
const [transfer] = getErc20Component({
|
|
495
|
+
component: value,
|
|
496
|
+
transaction,
|
|
497
|
+
targetsErc20,
|
|
498
|
+
targetsErc721,
|
|
499
|
+
targetsErc1155,
|
|
500
|
+
targetsInternal,
|
|
501
|
+
targetsLog,
|
|
502
|
+
})
|
|
503
|
+
const amount = createBigDecimal(transfer.value, transfer.token.decimals)
|
|
504
|
+
return plus
|
|
505
|
+
? amount
|
|
506
|
+
: {
|
|
507
|
+
value: amount.value * -1n,
|
|
508
|
+
decimals: amount.decimals,
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
case 'erc1155': {
|
|
512
|
+
const [transfer] = getErc1155Component({
|
|
513
|
+
component: value,
|
|
514
|
+
transaction,
|
|
515
|
+
targetsErc20,
|
|
516
|
+
targetsErc721,
|
|
517
|
+
targetsErc1155,
|
|
518
|
+
targetsInternal,
|
|
519
|
+
targetsLog,
|
|
520
|
+
})
|
|
521
|
+
const amount = createBigDecimal(transfer.value)
|
|
522
|
+
return plus
|
|
523
|
+
? amount
|
|
524
|
+
: {
|
|
525
|
+
value: amount.value * -1n,
|
|
526
|
+
decimals: amount.decimals,
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
throw new Error('Not reachable')
|
|
531
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { CryptoCurrencyPrice } from '@0xtorch/core'
|
|
2
|
+
import type { LowerHex, TransactionDecoded } from '../../../types'
|
|
3
|
+
import { isHex, toLowerHex } from '../../../types'
|
|
4
|
+
import { getErc1155RawComponent } from '../components/erc1155Raw'
|
|
5
|
+
import { getErc20RawComponent } from '../components/erc20Raw'
|
|
6
|
+
import { getErc721RawComponent } from '../components/erc721Raw'
|
|
7
|
+
import { getInternalRawComponent } from '../components/internalRaw'
|
|
8
|
+
import { getLogArgumentRawComponent } from '../components/logArgumentRaw'
|
|
9
|
+
import type { AddressCondition, Target } from '../types'
|
|
10
|
+
|
|
11
|
+
type GetAddressByAddressCondition<
|
|
12
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
13
|
+
> = {
|
|
14
|
+
readonly condition: AddressCondition
|
|
15
|
+
readonly transaction: TransactionDecoded<Price>
|
|
16
|
+
} & Target<Price>
|
|
17
|
+
|
|
18
|
+
export const getAddressByAddressCondition = <
|
|
19
|
+
Price extends CryptoCurrencyPrice | undefined,
|
|
20
|
+
>({
|
|
21
|
+
condition,
|
|
22
|
+
transaction,
|
|
23
|
+
targetsErc20 = [],
|
|
24
|
+
targetsErc721 = [],
|
|
25
|
+
targetsErc1155 = [],
|
|
26
|
+
targetsInternal = [],
|
|
27
|
+
targetsLog = [],
|
|
28
|
+
}: GetAddressByAddressCondition<Price>): LowerHex => {
|
|
29
|
+
if (typeof condition === 'string') {
|
|
30
|
+
return condition
|
|
31
|
+
}
|
|
32
|
+
switch (condition.type) {
|
|
33
|
+
case 'from': {
|
|
34
|
+
return toLowerHex(transaction.from)
|
|
35
|
+
}
|
|
36
|
+
case 'to': {
|
|
37
|
+
if (transaction.to === null) {
|
|
38
|
+
throw new Error('transaction.to is null')
|
|
39
|
+
}
|
|
40
|
+
return toLowerHex(transaction.to)
|
|
41
|
+
}
|
|
42
|
+
case 'erc20': {
|
|
43
|
+
const transfer = getErc20RawComponent({
|
|
44
|
+
component: condition,
|
|
45
|
+
transaction,
|
|
46
|
+
targetsErc20,
|
|
47
|
+
})
|
|
48
|
+
switch (condition.key) {
|
|
49
|
+
case 'from': {
|
|
50
|
+
return transfer.from
|
|
51
|
+
}
|
|
52
|
+
case 'to': {
|
|
53
|
+
return transfer.to
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
throw new Error('Not reached')
|
|
57
|
+
}
|
|
58
|
+
case 'erc721': {
|
|
59
|
+
const transfer = getErc721RawComponent({
|
|
60
|
+
component: condition,
|
|
61
|
+
transaction,
|
|
62
|
+
targetsErc721,
|
|
63
|
+
})
|
|
64
|
+
switch (condition.key) {
|
|
65
|
+
case 'from': {
|
|
66
|
+
return transfer.from
|
|
67
|
+
}
|
|
68
|
+
case 'to': {
|
|
69
|
+
return transfer.to
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
throw new Error('Not reached')
|
|
73
|
+
}
|
|
74
|
+
case 'erc1155': {
|
|
75
|
+
const transfer = getErc1155RawComponent({
|
|
76
|
+
component: condition,
|
|
77
|
+
transaction,
|
|
78
|
+
targetsErc1155,
|
|
79
|
+
})
|
|
80
|
+
switch (condition.key) {
|
|
81
|
+
case 'from': {
|
|
82
|
+
return transfer.from
|
|
83
|
+
}
|
|
84
|
+
case 'to': {
|
|
85
|
+
return transfer.to
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
throw new Error('Not reached')
|
|
89
|
+
}
|
|
90
|
+
case 'internal': {
|
|
91
|
+
const internal = getInternalRawComponent({
|
|
92
|
+
component: condition,
|
|
93
|
+
transaction,
|
|
94
|
+
targetsInternal,
|
|
95
|
+
})
|
|
96
|
+
switch (condition.key) {
|
|
97
|
+
case 'from': {
|
|
98
|
+
return toLowerHex(internal.from)
|
|
99
|
+
}
|
|
100
|
+
case 'to': {
|
|
101
|
+
if (internal.to === undefined) {
|
|
102
|
+
throw new Error(
|
|
103
|
+
'filteredInternalTransactions[condition.index].to is null',
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
return internal.to
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
throw new Error('Not reached')
|
|
110
|
+
}
|
|
111
|
+
case 'log': {
|
|
112
|
+
const argumentValue = getLogArgumentRawComponent({
|
|
113
|
+
component: condition,
|
|
114
|
+
transaction,
|
|
115
|
+
targetsLog,
|
|
116
|
+
})
|
|
117
|
+
const argument = String(argumentValue)
|
|
118
|
+
if (!isHex(argument)) {
|
|
119
|
+
throw new Error('argument is not address')
|
|
120
|
+
}
|
|
121
|
+
return toLowerHex(argument)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|