@0xtorch/evm 0.0.10 → 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 +166 -158
- 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 +167 -158
- 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 +3 -3
- 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 +229 -196
- 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 +3 -3
- 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,774 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateActionsByGenerator = void 0;
|
|
4
|
+
const core_1 = require("@0xtorch/core");
|
|
5
|
+
const comment_1 = require("./components/comment");
|
|
6
|
+
const erc1155_1 = require("./components/erc1155");
|
|
7
|
+
const erc20_1 = require("./components/erc20");
|
|
8
|
+
const erc721_1 = require("./components/erc721");
|
|
9
|
+
const id_1 = require("./components/id");
|
|
10
|
+
const internal_1 = require("./components/internal");
|
|
11
|
+
const logArgument_1 = require("./components/logArgument");
|
|
12
|
+
const transfer_1 = require("./components/transfer");
|
|
13
|
+
const generateActionsByGenerator = ({ generator, chain, transaction, }) => {
|
|
14
|
+
const { target } = generator;
|
|
15
|
+
if (target === undefined) {
|
|
16
|
+
return [
|
|
17
|
+
generateActionByGeneratorWithTargets({
|
|
18
|
+
generator,
|
|
19
|
+
chain,
|
|
20
|
+
transaction,
|
|
21
|
+
}),
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
const mut_erc20Transfers = [...transaction.erc20Transfers];
|
|
25
|
+
const mut_erc721Transfers = [...transaction.erc721Transfers];
|
|
26
|
+
const mut_erc1155Transfers = [...transaction.erc1155Transfers];
|
|
27
|
+
const mut_internalTransactions = [...transaction.internalTransactions];
|
|
28
|
+
const mut_logs = [...transaction.logs];
|
|
29
|
+
const mut_targets = [];
|
|
30
|
+
let repeat = true;
|
|
31
|
+
while (repeat) {
|
|
32
|
+
const mut_targetsErc20 = [];
|
|
33
|
+
const mut_targetsErc721 = [];
|
|
34
|
+
const mut_targetsErc1155 = [];
|
|
35
|
+
const mut_targetsInternal = [];
|
|
36
|
+
const mut_targetsLog = [];
|
|
37
|
+
for (const component of target) {
|
|
38
|
+
switch (component.type) {
|
|
39
|
+
case 'erc20': {
|
|
40
|
+
const erc20Index = mut_erc20Transfers.findIndex((transfer) => (0, erc20_1.isMatchErc20Component)({
|
|
41
|
+
component: {
|
|
42
|
+
...component,
|
|
43
|
+
index: 0,
|
|
44
|
+
},
|
|
45
|
+
transfer,
|
|
46
|
+
transaction,
|
|
47
|
+
}));
|
|
48
|
+
if (erc20Index === -1) {
|
|
49
|
+
repeat = false;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
mut_targetsErc20.push(mut_erc20Transfers[erc20Index]);
|
|
53
|
+
mut_erc20Transfers.splice(erc20Index, 1);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 'erc721': {
|
|
57
|
+
const erc721Index = mut_erc721Transfers.findIndex((transfer) => (0, erc721_1.isMatchErc721Component)({
|
|
58
|
+
component: {
|
|
59
|
+
...component,
|
|
60
|
+
index: 0,
|
|
61
|
+
},
|
|
62
|
+
transfer,
|
|
63
|
+
transaction,
|
|
64
|
+
}));
|
|
65
|
+
if (erc721Index === -1) {
|
|
66
|
+
repeat = false;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
mut_targetsErc721.push(mut_erc721Transfers[erc721Index]);
|
|
70
|
+
mut_erc721Transfers.splice(erc721Index, 1);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case 'erc1155': {
|
|
74
|
+
const erc1155Index = mut_erc1155Transfers.findIndex((transfer) => (0, erc1155_1.isMatchErc1155Component)({
|
|
75
|
+
component: {
|
|
76
|
+
...component,
|
|
77
|
+
index: 0,
|
|
78
|
+
},
|
|
79
|
+
transfer,
|
|
80
|
+
transaction,
|
|
81
|
+
}));
|
|
82
|
+
if (erc1155Index === -1) {
|
|
83
|
+
repeat = false;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
mut_targetsErc1155.push(mut_erc1155Transfers[erc1155Index]);
|
|
87
|
+
mut_erc1155Transfers.splice(erc1155Index, 1);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case 'internal': {
|
|
91
|
+
const internalIndex = mut_internalTransactions.findIndex((internal) => (0, internal_1.isMatchInternalComponent)({
|
|
92
|
+
component: {
|
|
93
|
+
...component,
|
|
94
|
+
index: 0,
|
|
95
|
+
},
|
|
96
|
+
internal,
|
|
97
|
+
transaction,
|
|
98
|
+
}));
|
|
99
|
+
if (internalIndex === -1) {
|
|
100
|
+
repeat = false;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
mut_targetsInternal.push(mut_internalTransactions[internalIndex]);
|
|
104
|
+
mut_internalTransactions.splice(internalIndex, 1);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case 'log': {
|
|
108
|
+
const logIndex = mut_logs.findIndex((log) => (0, logArgument_1.isMatchLogArgumentComponent)({
|
|
109
|
+
component: {
|
|
110
|
+
...component,
|
|
111
|
+
index: 0,
|
|
112
|
+
argIndex: 0,
|
|
113
|
+
valueType: 'other',
|
|
114
|
+
},
|
|
115
|
+
log,
|
|
116
|
+
transaction,
|
|
117
|
+
}));
|
|
118
|
+
if (logIndex === -1) {
|
|
119
|
+
repeat = false;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
mut_targetsLog.push(mut_logs[logIndex]);
|
|
123
|
+
mut_logs.splice(logIndex, 1);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (!repeat) {
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (!repeat) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
mut_targets.push({
|
|
135
|
+
targetsErc20: mut_targetsErc20,
|
|
136
|
+
targetsErc721: mut_targetsErc721,
|
|
137
|
+
targetsErc1155: mut_targetsErc1155,
|
|
138
|
+
targetsInternal: mut_targetsInternal,
|
|
139
|
+
targetsLog: mut_targetsLog,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const actions = mut_targets.map((target) => generateActionByGeneratorWithTargets({
|
|
143
|
+
generator,
|
|
144
|
+
chain,
|
|
145
|
+
transaction,
|
|
146
|
+
...target,
|
|
147
|
+
}));
|
|
148
|
+
return actions;
|
|
149
|
+
};
|
|
150
|
+
exports.generateActionsByGenerator = generateActionsByGenerator;
|
|
151
|
+
const generateActionByGeneratorWithTargets = ({ generator, chain, transaction, targetsErc20, targetsErc721, targetsErc1155, targetsInternal, targetsLog, }) => {
|
|
152
|
+
const action = {
|
|
153
|
+
type: 'NormalAction',
|
|
154
|
+
action: generator.action,
|
|
155
|
+
evidence: 'contract',
|
|
156
|
+
timestamp: Number(transaction.block.timestamp) * 1000,
|
|
157
|
+
comment: generator.comment === undefined
|
|
158
|
+
? undefined
|
|
159
|
+
: generator.comment
|
|
160
|
+
.map((component) => (0, comment_1.createCommentByCommentComponent)({
|
|
161
|
+
component,
|
|
162
|
+
transaction,
|
|
163
|
+
chain,
|
|
164
|
+
targetsLog,
|
|
165
|
+
}))
|
|
166
|
+
.join(''),
|
|
167
|
+
app: transaction.app,
|
|
168
|
+
transfers: generator.transfers.flatMap((component) => (0, transfer_1.createTransfersByTransferComponent)({
|
|
169
|
+
component,
|
|
170
|
+
transaction,
|
|
171
|
+
chain,
|
|
172
|
+
targetsErc20,
|
|
173
|
+
targetsErc721,
|
|
174
|
+
targetsErc1155,
|
|
175
|
+
targetsInternal,
|
|
176
|
+
targetsLog,
|
|
177
|
+
})),
|
|
178
|
+
crossId: generator.crossId === undefined
|
|
179
|
+
? undefined
|
|
180
|
+
: generator.crossId
|
|
181
|
+
.map((component) => (0, id_1.createIdByIdComponent)({
|
|
182
|
+
component,
|
|
183
|
+
transaction,
|
|
184
|
+
chain,
|
|
185
|
+
targetsLog,
|
|
186
|
+
}))
|
|
187
|
+
.join(''),
|
|
188
|
+
loanId: generator.loanId === undefined
|
|
189
|
+
? undefined
|
|
190
|
+
: generator.loanId
|
|
191
|
+
.map((component) => (0, id_1.createIdByIdComponent)({
|
|
192
|
+
component,
|
|
193
|
+
transaction,
|
|
194
|
+
chain,
|
|
195
|
+
targetsLog,
|
|
196
|
+
}))
|
|
197
|
+
.join(''),
|
|
198
|
+
};
|
|
199
|
+
switch (action.action) {
|
|
200
|
+
case 'add-liquidity': {
|
|
201
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
202
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
203
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
204
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
205
|
+
if (transfers.length !== action.transfers.length) {
|
|
206
|
+
throw new Error('Invalid action.transfers for add-liquidity');
|
|
207
|
+
}
|
|
208
|
+
if (action.loanId === undefined) {
|
|
209
|
+
throw new Error('action.loandId is required for add-liquidity');
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
...action,
|
|
213
|
+
type: 'LoanNormalAction',
|
|
214
|
+
action: 'add-liquidity',
|
|
215
|
+
loanId: action.loanId,
|
|
216
|
+
transfers,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
case 'approve': {
|
|
220
|
+
if (action.transfers.length > 0) {
|
|
221
|
+
throw new Error('Invalid action.transfers for approve');
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
...action,
|
|
225
|
+
type: 'NormalAction',
|
|
226
|
+
action: 'approve',
|
|
227
|
+
transfers: [],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
case 'atomic-arbitrage': {
|
|
231
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
232
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer));
|
|
233
|
+
if (transfers.length !== action.transfers.length) {
|
|
234
|
+
throw new Error('Invalid action.transfers for atomic-arbitrage');
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
...action,
|
|
238
|
+
type: 'NormalAction',
|
|
239
|
+
action: 'atomic-arbitrage',
|
|
240
|
+
transfers,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
case 'borrow': {
|
|
244
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) || (0, core_1.isTransferNftIn)(transfer));
|
|
245
|
+
if (transfers.length !== action.transfers.length) {
|
|
246
|
+
throw new Error('Invalid action.transfers for borrow');
|
|
247
|
+
}
|
|
248
|
+
if (action.loanId === undefined) {
|
|
249
|
+
throw new Error('action.loandId is required for borrow');
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
...action,
|
|
253
|
+
type: 'LoanNormalAction',
|
|
254
|
+
action: 'borrow',
|
|
255
|
+
loanId: action.loanId,
|
|
256
|
+
transfers,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
case 'borrow-with-debt': {
|
|
260
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
261
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
262
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
263
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
264
|
+
if (transfers.length !== action.transfers.length) {
|
|
265
|
+
throw new Error('Invalid action.transfers for borrow-with-debt');
|
|
266
|
+
}
|
|
267
|
+
if (action.loanId === undefined) {
|
|
268
|
+
throw new Error('action.loandId is required for borrow-with-debt');
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
...action,
|
|
272
|
+
type: 'LoanNormalAction',
|
|
273
|
+
action: 'borrow-with-debt',
|
|
274
|
+
loanId: action.loanId,
|
|
275
|
+
transfers,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
case 'bridge-from': {
|
|
279
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyOut)(transfer) || (0, core_1.isTransferNftOut)(transfer));
|
|
280
|
+
if (transfers.length !== action.transfers.length) {
|
|
281
|
+
throw new Error('Invalid action.transfers for bridge-from');
|
|
282
|
+
}
|
|
283
|
+
if (action.crossId === undefined) {
|
|
284
|
+
throw new Error('action.crossId is required for bridge-from');
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
...action,
|
|
288
|
+
type: 'CrossNormalAction',
|
|
289
|
+
action: 'bridge-from',
|
|
290
|
+
crossId: action.crossId,
|
|
291
|
+
transfers,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
case 'bridge-to': {
|
|
295
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) || (0, core_1.isTransferNftIn)(transfer));
|
|
296
|
+
if (transfers.length !== action.transfers.length) {
|
|
297
|
+
throw new Error('Invalid action.transfers for bridge-to');
|
|
298
|
+
}
|
|
299
|
+
if (action.crossId === undefined) {
|
|
300
|
+
throw new Error('action.crossId is required for bridge-to');
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
...action,
|
|
304
|
+
type: 'CrossNormalAction',
|
|
305
|
+
action: 'bridge-to',
|
|
306
|
+
crossId: action.crossId,
|
|
307
|
+
transfers,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
case 'buy-crypto': {
|
|
311
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
312
|
+
(0, core_1.isTransferFiatCurrencyOut)(transfer));
|
|
313
|
+
if (transfers.length !== action.transfers.length) {
|
|
314
|
+
throw new Error('Invalid action.transfers for buy-crypto');
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
...action,
|
|
318
|
+
type: 'NormalAction',
|
|
319
|
+
action: 'buy-crypto',
|
|
320
|
+
transfers,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
case 'buy-nft': {
|
|
324
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferNftIn)(transfer) ||
|
|
325
|
+
(0, core_1.isTransferFiatCurrencyOut)(transfer) ||
|
|
326
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer));
|
|
327
|
+
if (transfers.length !== action.transfers.length) {
|
|
328
|
+
throw new Error('Invalid action.transfers for buy-nft');
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
...action,
|
|
332
|
+
type: 'NormalAction',
|
|
333
|
+
action: 'buy-nft',
|
|
334
|
+
transfers,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
case 'cross-replace': {
|
|
338
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
339
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
340
|
+
(0, core_1.isTransferFiatCurrencyIn)(transfer) ||
|
|
341
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
342
|
+
(0, core_1.isTransferNftOut)(transfer) ||
|
|
343
|
+
(0, core_1.isTransferFiatCurrencyOut)(transfer));
|
|
344
|
+
if (transfers.length !== action.transfers.length) {
|
|
345
|
+
throw new Error('Invalid action.transfers for cross-replace');
|
|
346
|
+
}
|
|
347
|
+
if (action.crossId === undefined) {
|
|
348
|
+
throw new Error('action.crossId is required for cross-replace');
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
...action,
|
|
352
|
+
type: 'CrossNormalAction',
|
|
353
|
+
action: 'cross-replace',
|
|
354
|
+
crossId: action.crossId,
|
|
355
|
+
transfers,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
case 'deposit': {
|
|
359
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyOut)(transfer) || (0, core_1.isTransferNftOut)(transfer));
|
|
360
|
+
if (transfers.length !== action.transfers.length) {
|
|
361
|
+
throw new Error('Invalid action.transfers for deposit');
|
|
362
|
+
}
|
|
363
|
+
if (action.loanId === undefined) {
|
|
364
|
+
throw new Error('action.loandId is required for deposit');
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
...action,
|
|
368
|
+
type: 'LoanNormalAction',
|
|
369
|
+
action: 'deposit',
|
|
370
|
+
loanId: action.loanId,
|
|
371
|
+
transfers,
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
case 'cross-trade': {
|
|
375
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
376
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
377
|
+
(0, core_1.isTransferFiatCurrencyIn)(transfer) ||
|
|
378
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
379
|
+
(0, core_1.isTransferNftOut)(transfer) ||
|
|
380
|
+
(0, core_1.isTransferFiatCurrencyOut)(transfer));
|
|
381
|
+
if (transfers.length !== action.transfers.length) {
|
|
382
|
+
throw new Error('Invalid action.transfers for cross-trade');
|
|
383
|
+
}
|
|
384
|
+
if (action.crossId === undefined) {
|
|
385
|
+
throw new Error('action.crossId is required for cross-trade');
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
...action,
|
|
389
|
+
type: 'CrossNormalAction',
|
|
390
|
+
action: 'cross-trade',
|
|
391
|
+
crossId: action.crossId,
|
|
392
|
+
transfers,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
case 'deposit-with-bond': {
|
|
396
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
397
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
398
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
399
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
400
|
+
if (transfers.length !== action.transfers.length) {
|
|
401
|
+
throw new Error('Invalid action.transfers for deposit-with-bond');
|
|
402
|
+
}
|
|
403
|
+
if (action.loanId === undefined) {
|
|
404
|
+
throw new Error('action.loandId is required for deposit-with-bond');
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
...action,
|
|
408
|
+
type: 'LoanNormalAction',
|
|
409
|
+
action: 'deposit-with-bond',
|
|
410
|
+
loanId: action.loanId,
|
|
411
|
+
transfers,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
case 'fail-tx': {
|
|
415
|
+
if (action.transfers.length > 0) {
|
|
416
|
+
throw new Error('Invalid action.transfers for fail-tx');
|
|
417
|
+
}
|
|
418
|
+
return {
|
|
419
|
+
...action,
|
|
420
|
+
type: 'NormalAction',
|
|
421
|
+
action: 'fail-tx',
|
|
422
|
+
transfers: [],
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
case 'fee': {
|
|
426
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
427
|
+
(0, core_1.isTransferFiatCurrencyOut)(transfer));
|
|
428
|
+
if (transfers.length !== action.transfers.length) {
|
|
429
|
+
throw new Error('Invalid action.transfers for fee');
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
...action,
|
|
433
|
+
type: 'NormalAction',
|
|
434
|
+
action: 'fee',
|
|
435
|
+
transfers,
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
case 'free-mint-nft': {
|
|
439
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferNftIn)(transfer));
|
|
440
|
+
if (transfers.length !== action.transfers.length) {
|
|
441
|
+
throw new Error('Invalid action.transfers for free-mint-nft');
|
|
442
|
+
}
|
|
443
|
+
return {
|
|
444
|
+
...action,
|
|
445
|
+
type: 'NormalAction',
|
|
446
|
+
action: 'free-mint-nft',
|
|
447
|
+
transfers,
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
case 'income': {
|
|
451
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
452
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
453
|
+
(0, core_1.isTransferFiatCurrencyIn)(transfer));
|
|
454
|
+
if (transfers.length !== action.transfers.length) {
|
|
455
|
+
throw new Error('Invalid action.transfers for income');
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
...action,
|
|
459
|
+
type: 'NormalAction',
|
|
460
|
+
action: 'income',
|
|
461
|
+
transfers,
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
case 'mint-nft': {
|
|
465
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferNftIn)(transfer) ||
|
|
466
|
+
(0, core_1.isTransferFiatCurrencyOut)(transfer) ||
|
|
467
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer));
|
|
468
|
+
if (transfers.length !== action.transfers.length) {
|
|
469
|
+
throw new Error('Invalid action.transfers for mint-nft');
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
...action,
|
|
473
|
+
type: 'NormalAction',
|
|
474
|
+
action: 'mint-nft',
|
|
475
|
+
transfers,
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
case 'receive-from-cex': {
|
|
479
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) || (0, core_1.isTransferNftIn)(transfer));
|
|
480
|
+
if (transfers.length !== action.transfers.length) {
|
|
481
|
+
throw new Error('Invalid action.transfers for receive-from-cex');
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
...action,
|
|
485
|
+
type: 'NormalAction',
|
|
486
|
+
action: 'receive-from-cex',
|
|
487
|
+
transfers,
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
case 'remove-liquidity': {
|
|
491
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
492
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
493
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
494
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
495
|
+
if (transfers.length !== action.transfers.length) {
|
|
496
|
+
throw new Error('Invalid action.transfers for remove-liquidity');
|
|
497
|
+
}
|
|
498
|
+
if (action.loanId === undefined) {
|
|
499
|
+
throw new Error('action.loandId is required for remove-liquidity');
|
|
500
|
+
}
|
|
501
|
+
return {
|
|
502
|
+
...action,
|
|
503
|
+
type: 'LoanNormalAction',
|
|
504
|
+
action: 'remove-liquidity',
|
|
505
|
+
loanId: action.loanId,
|
|
506
|
+
transfers,
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
case 'repayment': {
|
|
510
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyOut)(transfer) || (0, core_1.isTransferNftOut)(transfer));
|
|
511
|
+
if (transfers.length !== action.transfers.length) {
|
|
512
|
+
throw new Error('Invalid action.transfers for repayment');
|
|
513
|
+
}
|
|
514
|
+
if (action.loanId === undefined) {
|
|
515
|
+
throw new Error('action.loandId is required for repayment');
|
|
516
|
+
}
|
|
517
|
+
return {
|
|
518
|
+
...action,
|
|
519
|
+
type: 'LoanNormalAction',
|
|
520
|
+
action: 'repayment',
|
|
521
|
+
loanId: action.loanId,
|
|
522
|
+
transfers,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
case 'repayment-with-debt': {
|
|
526
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
527
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
528
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
529
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
530
|
+
if (transfers.length !== action.transfers.length) {
|
|
531
|
+
throw new Error('Invalid action.transfers for repayment-with-debt');
|
|
532
|
+
}
|
|
533
|
+
if (action.loanId === undefined) {
|
|
534
|
+
throw new Error('action.loandId is required for repayment-with-debt');
|
|
535
|
+
}
|
|
536
|
+
return {
|
|
537
|
+
...action,
|
|
538
|
+
type: 'LoanNormalAction',
|
|
539
|
+
action: 'repayment-with-debt',
|
|
540
|
+
loanId: action.loanId,
|
|
541
|
+
transfers,
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
case 'replace': {
|
|
545
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
546
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
547
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
548
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
549
|
+
if (transfers.length !== action.transfers.length) {
|
|
550
|
+
throw new Error('Invalid action.transfers for replace');
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
...action,
|
|
554
|
+
type: 'NormalAction',
|
|
555
|
+
action: 'replace',
|
|
556
|
+
transfers,
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
case 'revoke': {
|
|
560
|
+
if (action.transfers.length > 0) {
|
|
561
|
+
throw new Error('Invalid action.transfers for revoke');
|
|
562
|
+
}
|
|
563
|
+
return {
|
|
564
|
+
...action,
|
|
565
|
+
type: 'NormalAction',
|
|
566
|
+
action: 'revoke',
|
|
567
|
+
transfers: [],
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
case 'sell-crypto': {
|
|
571
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferFiatCurrencyIn)(transfer) ||
|
|
572
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer));
|
|
573
|
+
if (transfers.length !== action.transfers.length) {
|
|
574
|
+
throw new Error('Invalid action.transfers for sell-crypto');
|
|
575
|
+
}
|
|
576
|
+
return {
|
|
577
|
+
...action,
|
|
578
|
+
type: 'NormalAction',
|
|
579
|
+
action: 'sell-crypto',
|
|
580
|
+
transfers,
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
case 'sell-nft': {
|
|
584
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferFiatCurrencyIn)(transfer) ||
|
|
585
|
+
(0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
586
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
587
|
+
if (transfers.length !== action.transfers.length) {
|
|
588
|
+
throw new Error('Invalid action.transfers for sell-nft');
|
|
589
|
+
}
|
|
590
|
+
return {
|
|
591
|
+
...action,
|
|
592
|
+
type: 'NormalAction',
|
|
593
|
+
action: 'sell-nft',
|
|
594
|
+
transfers,
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
case 'send-to-cex': {
|
|
598
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyOut)(transfer) || (0, core_1.isTransferNftOut)(transfer));
|
|
599
|
+
if (transfers.length !== action.transfers.length) {
|
|
600
|
+
throw new Error('Invalid action.transfers for send-to-cex');
|
|
601
|
+
}
|
|
602
|
+
return {
|
|
603
|
+
...action,
|
|
604
|
+
type: 'NormalAction',
|
|
605
|
+
action: 'send-to-cex',
|
|
606
|
+
transfers,
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
case 'spam': {
|
|
610
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
611
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
612
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
613
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
614
|
+
if (transfers.length !== action.transfers.length) {
|
|
615
|
+
throw new Error('Invalid action.transfers for spam');
|
|
616
|
+
}
|
|
617
|
+
return {
|
|
618
|
+
...action,
|
|
619
|
+
type: 'NormalAction',
|
|
620
|
+
action: 'spam',
|
|
621
|
+
transfers,
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
case 'stake': {
|
|
625
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyOut)(transfer) || (0, core_1.isTransferNftOut)(transfer));
|
|
626
|
+
if (transfers.length !== action.transfers.length) {
|
|
627
|
+
throw new Error('Invalid action.transfers for stake');
|
|
628
|
+
}
|
|
629
|
+
if (action.loanId === undefined) {
|
|
630
|
+
throw new Error('action.loandId is required for stake');
|
|
631
|
+
}
|
|
632
|
+
return {
|
|
633
|
+
...action,
|
|
634
|
+
type: 'LoanNormalAction',
|
|
635
|
+
action: 'stake',
|
|
636
|
+
loanId: action.loanId,
|
|
637
|
+
transfers,
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
case 'swap-nft': {
|
|
641
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferNftIn)(transfer) || (0, core_1.isTransferNftOut)(transfer));
|
|
642
|
+
if (transfers.length !== action.transfers.length) {
|
|
643
|
+
throw new Error('Invalid action.transfers for swap-nft');
|
|
644
|
+
}
|
|
645
|
+
return {
|
|
646
|
+
...action,
|
|
647
|
+
type: 'NormalAction',
|
|
648
|
+
action: 'swap-nft',
|
|
649
|
+
transfers,
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
case 'trade': {
|
|
653
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
654
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
655
|
+
(0, core_1.isTransferFiatCurrencyIn)(transfer) ||
|
|
656
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
657
|
+
(0, core_1.isTransferNftOut)(transfer) ||
|
|
658
|
+
(0, core_1.isTransferFiatCurrencyOut)(transfer));
|
|
659
|
+
if (transfers.length !== action.transfers.length) {
|
|
660
|
+
throw new Error('Invalid action.transfers for trade');
|
|
661
|
+
}
|
|
662
|
+
return {
|
|
663
|
+
...action,
|
|
664
|
+
type: 'NormalAction',
|
|
665
|
+
action: 'trade',
|
|
666
|
+
transfers,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
case 'transaction-fee': {
|
|
670
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyOut)(transfer));
|
|
671
|
+
if (transfers.length !== action.transfers.length) {
|
|
672
|
+
throw new Error('Invalid action.transfers for transaction-fee');
|
|
673
|
+
}
|
|
674
|
+
return {
|
|
675
|
+
...action,
|
|
676
|
+
type: 'NormalAction',
|
|
677
|
+
action: 'transaction-fee',
|
|
678
|
+
transfers,
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
case 'transfer': {
|
|
682
|
+
return {
|
|
683
|
+
...action,
|
|
684
|
+
type: 'NormalAction',
|
|
685
|
+
action: 'transfer',
|
|
686
|
+
transfers: [...action.transfers],
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
case 'unstake': {
|
|
690
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) || (0, core_1.isTransferNftIn)(transfer));
|
|
691
|
+
if (transfers.length !== action.transfers.length) {
|
|
692
|
+
throw new Error('Invalid action.transfers for unstake');
|
|
693
|
+
}
|
|
694
|
+
if (action.loanId === undefined) {
|
|
695
|
+
throw new Error('action.loandId is required for unstake');
|
|
696
|
+
}
|
|
697
|
+
return {
|
|
698
|
+
...action,
|
|
699
|
+
type: 'LoanNormalAction',
|
|
700
|
+
action: 'unstake',
|
|
701
|
+
loanId: action.loanId,
|
|
702
|
+
transfers,
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
case 'unwrap': {
|
|
706
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
707
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer));
|
|
708
|
+
if (transfers.length !== action.transfers.length) {
|
|
709
|
+
throw new Error('Invalid action.transfers for unwrap');
|
|
710
|
+
}
|
|
711
|
+
return {
|
|
712
|
+
...action,
|
|
713
|
+
type: 'NormalAction',
|
|
714
|
+
action: 'unwrap',
|
|
715
|
+
transfers,
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
case 'wrap': {
|
|
719
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
720
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer));
|
|
721
|
+
if (transfers.length !== action.transfers.length) {
|
|
722
|
+
throw new Error('Invalid action.transfers for wrap');
|
|
723
|
+
}
|
|
724
|
+
return {
|
|
725
|
+
...action,
|
|
726
|
+
type: 'NormalAction',
|
|
727
|
+
action: 'wrap',
|
|
728
|
+
transfers,
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
case 'valuedown': {
|
|
732
|
+
throw new Error('Not implemented for valuedown');
|
|
733
|
+
}
|
|
734
|
+
case 'valueup': {
|
|
735
|
+
throw new Error('Not implemented for valueup');
|
|
736
|
+
}
|
|
737
|
+
case 'withdraw': {
|
|
738
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) || (0, core_1.isTransferNftIn)(transfer));
|
|
739
|
+
if (transfers.length !== action.transfers.length) {
|
|
740
|
+
throw new Error('Invalid action.transfers for withdraw');
|
|
741
|
+
}
|
|
742
|
+
if (action.loanId === undefined) {
|
|
743
|
+
throw new Error('action.loandId is required for withdraw');
|
|
744
|
+
}
|
|
745
|
+
return {
|
|
746
|
+
...action,
|
|
747
|
+
type: 'LoanNormalAction',
|
|
748
|
+
action: 'withdraw',
|
|
749
|
+
loanId: action.loanId,
|
|
750
|
+
transfers,
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
case 'withdraw-with-bond': {
|
|
754
|
+
const transfers = action.transfers.filter((transfer) => (0, core_1.isTransferCryptoCurrencyIn)(transfer) ||
|
|
755
|
+
(0, core_1.isTransferNftIn)(transfer) ||
|
|
756
|
+
(0, core_1.isTransferCryptoCurrencyOut)(transfer) ||
|
|
757
|
+
(0, core_1.isTransferNftOut)(transfer));
|
|
758
|
+
if (transfers.length !== action.transfers.length) {
|
|
759
|
+
throw new Error('Invalid action.transfers for withdraw-with-bond');
|
|
760
|
+
}
|
|
761
|
+
if (action.loanId === undefined) {
|
|
762
|
+
throw new Error('action.loandId is required for withdraw-with-bond');
|
|
763
|
+
}
|
|
764
|
+
return {
|
|
765
|
+
...action,
|
|
766
|
+
type: 'LoanNormalAction',
|
|
767
|
+
action: 'withdraw-with-bond',
|
|
768
|
+
loanId: action.loanId,
|
|
769
|
+
transfers,
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
//# sourceMappingURL=generator.js.map
|