Optional
eventsDefinition of events
Optional
argument?: stringDeprecated, use type instead
Optional
description?: stringDescription of the event
Optional
type?: stringProtobuffer type for event
Optional
koilib_Protobuffers descriptor in JSON format. See https://www.npmjs.com/package/protobufjs#using-json-descriptors
Optional
argument?: stringProtobuffer type for argument
Optional
default_Default value when the output is undefined
Optional
description?: stringDescription of the method
Entry point ID
Optional
preformat_Optional function to preformat the argument
Optional
preformat_Optional function to preformat the returned value
Optional
read_Boolean to differentiate write methods (using transactions) from read methods (query the contract)
Optional
return?: stringProtobuffer type for returned value
Optional
typesProtobuffers descriptor in binary format encoded in base64url.
Generated using TypeDoc
Application Binary Interface (ABI)
ABIs are composed of 3 elements: methods, events, and types.
To generate the types is necessary to use the dependency protobufjs. The following example shows how to generate the protobuf descriptor from a .proto file.
Then this descriptor can be loaded to define the ABI:
Note that this example uses "default_output" for the method "balanceOf". This is used when the smart contract returns an empty response (for instance when there are no balance records for a specific address) and you require a default output in such cases.
Definition of events
There are 2 ways to define events in koinos:
Example:
Proto definition
Contract
Example
Proto definition
Contract
ABI