aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[API][v1] Use `read_only` / `write_only` where appropriate

Open banool opened this issue 3 years ago • 0 comments

There are certain types that are only ever used in requests, and others that are only ever used in responses. For those we can use write only and read only respectively. We should do that to make our API more descriptive. Poem supports such annotations.

I audited this as part of developing the API and found the following.

Types that need to be fully described as they are used as POST input:

SubmitTransactionRequest UserTransactionRequest UserTransactionSignature Address TimestampSec TransactionPayload TransactionSignature Ed25519Signature MultiEd25519Signature MultiAgentSignature AccountSignature ScriptFunctionPayload ScriptPayload ModuleBundlePayload WriteSetPayload ScriptFunctionId MoveTypeTagId MoveValue MoveScript MoveModule MoveModuleABI WriteSet ScriptWriteSet DirectWriteSet WriteSetChange Event Script DeleteModule DeleteResource DeleteTableItem WriteModule WriteResource WriteTableItem

Types that are only used as GET output:

Transaction (AKA OnChainTransaction???) PendingTransaction OnChainTransaction GenesisTransaction UserTransaction BlockMetadataTransaction StateCheckpointTransaction OnChainTransactionInfo

banool avatar Jul 27 '22 21:07 banool