From 2bf7329a1518993f4a54227d6b784010e9b65e2c Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 18 May 2020 14:37:38 +0300 Subject: [PATCH] interop/input|output: update documentation --- pkg/interop/input/input.go | 17 +++++++++++------ pkg/interop/output/output.go | 20 +++++++++++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/pkg/interop/input/input.go b/pkg/interop/input/input.go index 047637226..e577f2815 100644 --- a/pkg/interop/input/input.go +++ b/pkg/interop/input/input.go @@ -1,17 +1,22 @@ +/* +Package input provides functions dealing with transaction inputs. +*/ package input -// Package input provides function signatures that can be used inside -// smart contracts that are written in the neo-go framework. - -// Input stubs the input of a NEO transaction. +// Input is an opaque data structure that can only be created by +// transaction.GetInputs and it represents transaction's input. It's similar +// to Neo .net framework's TransactionInput. type Input struct{} -// GetHash returns the hash of the given input. +// GetHash returns the hash stored in the given input (which also is a +// transaction ID represented as 32 byte slice containing 256 bit BE value). +// It uses `Neo.Input.GetHash` syscall. func GetHash(in Input) []byte { return nil } -// GetIndex returns the index of the given input. +// GetIndex returns the index stored in the given input (which is a +// transaction's output number). It uses `Neo.Input.GetIndex` syscall. func GetIndex(in Input) int { return 0 } diff --git a/pkg/interop/output/output.go b/pkg/interop/output/output.go index 6f40ac544..01ad0c828 100644 --- a/pkg/interop/output/output.go +++ b/pkg/interop/output/output.go @@ -1,22 +1,28 @@ +/* +Package output provides functions dealing with transaction outputs. +*/ package output -// Package output provides function signatures that can be used inside -// smart contracts that are written in the neo-go framework. - -// Output stubs the output of a NEO transaction. +// Output is an opaque data structure that can only be created by +// transaction.GetOutputs and it represents transaction's output. It's similar +// to Neo .net framework's TransactionOutput. type Output struct{} -// GetAssetID returns the asset id of the given output. +// GetAssetID returns the asset ID (256 bit BE value in a 32 byte slice) of the +// given output. It uses `Neo.Output.GetAssetId` syscall. func GetAssetID(out Output) []byte { return nil } -// GetValue returns the value of the given output. +// GetValue returns the value (asset quantity) of the given output. It uses +// `Neo.Output.GetValue` syscall. func GetValue(out Output) int { return 0 } -// GetScriptHash returns the script hash of the given output. +// GetScriptHash returns the script hash (receiver's address represented as +// 20 byte slice containing 160 bit BE value) of the given output. It uses +// `Neo.Output.GetScriptHash` syscall. func GetScriptHash(out Output) []byte { return nil }