contract

package
v0.0.0-...-e8018c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultModule = "plugin"

Variables

View Source
var ContractConfig = &PluginConfig{
	Name:                  "send",
	Id:                    1,
	Version:               1,
	SupportedTransactions: []string{"send"},
}

PluginConfig: the configuration of the contract

View Source
var File_account_proto protoreflect.FileDescriptor
View Source
var File_plugin_proto protoreflect.FileDescriptor

Functions

func JoinLenPrefix

func JoinLenPrefix(toAppend ...[]byte) []byte

JoinLenPrefix() appends the items together separated by a single byte to represent the length of the segment

func KeyForAccount

func KeyForAccount(addr []byte) []byte

KeyForAccount() returns the state database key for an account

func KeyForFeeParams

func KeyForFeeParams() []byte

KeyForFeeParams() returns the state database key for governance controlled 'fee parameters'

func KeyForFeePool

func KeyForFeePool(chainId uint64) []byte

KeyForFeeParams() returns the state database key for governance controlled 'fee parameters'

func StartPlugin

func StartPlugin(c Config)

StartPlugin() creates and starts a plguin

Types

type Account

type Account struct {

	// address: the short version of a public key
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// amount: the balance of funds the account has
	Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` // NOTE: CAN EXTEND FUNCTIONALITY BY ADDING ADDITIONAL FIELDS
	// contains filtered or unexported fields
}

An account is a structure that holds funds and can send or receive transactions using a crypto key pair Each account has a unique address and a balance, think a bank account - but managed by the blockchain instead of a bank

func (*Account) Descriptor deprecated

func (*Account) Descriptor() ([]byte, []int)

Deprecated: Use Account.ProtoReflect.Descriptor instead.

func (*Account) GetAddress

func (x *Account) GetAddress() []byte

func (*Account) GetAmount

func (x *Account) GetAmount() uint64

func (*Account) ProtoMessage

func (*Account) ProtoMessage()

func (*Account) ProtoReflect

func (x *Account) ProtoReflect() protoreflect.Message

func (*Account) Reset

func (x *Account) Reset()

func (*Account) String

func (x *Account) String() string

type Config

type Config struct {
	ChainId     uint64 `json:"chainId"`
	DataDirPath string `json:"dataDirPath"`
}

func DefaultConfig

func DefaultConfig() Config

DefaultConfig() returns the default configuration

func NewConfigFromFile

func NewConfigFromFile(filepath string) (Config, error)

NewConfigFromFile() populates a Config object from a JSON file

type Contract

type Contract struct {
	Config    Config
	FSMConfig *PluginFSMConfig // fsm configuration
	// contains filtered or unexported fields
}

Contract() defines the smart contract that implements the extended logic of the nested chain

func (*Contract) BeginBlock

func (c *Contract) BeginBlock(_ *PluginBeginRequest) *PluginBeginResponse

BeginBlock() is code that is executed at the start of `applying` the block

func (*Contract) CheckMessageSend

func (c *Contract) CheckMessageSend(msg *MessageSend) *PluginCheckResponse

CheckMessageSend() statelessly validates a 'send' message

func (*Contract) CheckTx

func (c *Contract) CheckTx(request *PluginCheckRequest) *PluginCheckResponse

CheckTx() is code that is executed to statelessly validate a transaction

func (*Contract) DeliverMessageSend

func (c *Contract) DeliverMessageSend(msg *MessageSend, fee uint64) *PluginDeliverResponse

DeliverMessageSend() handles a 'send' message

func (*Contract) DeliverTx

func (c *Contract) DeliverTx(request *PluginDeliverRequest) *PluginDeliverResponse

DeliverTx() is code that is executed to apply a transaction

func (*Contract) EndBlock

func (c *Contract) EndBlock(_ *PluginEndRequest) *PluginEndResponse

EndBlock() is code that is executed at the end of 'applying' a block

func (*Contract) Genesis

Genesis() implements logic to import a json file to create the state at height 0 and export the state at any height

type FSMToPlugin

type FSMToPlugin struct {

	// id: the unique ID of the request
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// payload: the payload of the message
	//
	// Types that are valid to be assigned to Payload:
	//
	//	*FSMToPlugin_Config
	//	*FSMToPlugin_Genesis
	//	*FSMToPlugin_Begin
	//	*FSMToPlugin_Check
	//	*FSMToPlugin_Deliver
	//	*FSMToPlugin_End
	//	*FSMToPlugin_StateRead
	//	*FSMToPlugin_StateWrite
	//	*FSMToPlugin_Error
	Payload isFSMToPlugin_Payload `protobuf_oneof:"payload"`
	// contains filtered or unexported fields
}

FSMToPlugin is the outbound message to the plugin from the main FSM (fsm -> plugin)

func (*FSMToPlugin) Descriptor deprecated

func (*FSMToPlugin) Descriptor() ([]byte, []int)

Deprecated: Use FSMToPlugin.ProtoReflect.Descriptor instead.

func (*FSMToPlugin) GetBegin

func (x *FSMToPlugin) GetBegin() *PluginBeginRequest

func (*FSMToPlugin) GetCheck

func (x *FSMToPlugin) GetCheck() *PluginCheckRequest

func (*FSMToPlugin) GetConfig

func (x *FSMToPlugin) GetConfig() *PluginFSMConfig

func (*FSMToPlugin) GetDeliver

func (x *FSMToPlugin) GetDeliver() *PluginDeliverRequest

func (*FSMToPlugin) GetEnd

func (x *FSMToPlugin) GetEnd() *PluginEndRequest

func (*FSMToPlugin) GetError

func (x *FSMToPlugin) GetError() *PluginError

func (*FSMToPlugin) GetGenesis

func (x *FSMToPlugin) GetGenesis() *PluginGenesisRequest

func (*FSMToPlugin) GetId

func (x *FSMToPlugin) GetId() uint64

func (*FSMToPlugin) GetPayload

func (x *FSMToPlugin) GetPayload() isFSMToPlugin_Payload

func (*FSMToPlugin) GetStateRead

func (x *FSMToPlugin) GetStateRead() *PluginStateReadResponse

func (*FSMToPlugin) GetStateWrite

func (x *FSMToPlugin) GetStateWrite() *PluginStateWriteResponse

func (*FSMToPlugin) ProtoMessage

func (*FSMToPlugin) ProtoMessage()

func (*FSMToPlugin) ProtoReflect

func (x *FSMToPlugin) ProtoReflect() protoreflect.Message

func (*FSMToPlugin) Reset

func (x *FSMToPlugin) Reset()

func (*FSMToPlugin) String

func (x *FSMToPlugin) String() string

type FSMToPlugin_Begin

type FSMToPlugin_Begin struct {
	// begin: request to execute 'begin block' logic on the plugin
	Begin *PluginBeginRequest `protobuf:"bytes,4,opt,name=begin,proto3,oneof"`
}

type FSMToPlugin_Check

type FSMToPlugin_Check struct {
	// check: request to execute minimum logic to validate the transaction
	Check *PluginCheckRequest `protobuf:"bytes,5,opt,name=check,proto3,oneof"`
}

type FSMToPlugin_Config

type FSMToPlugin_Config struct {
	// config: the response to the plugin config message
	Config *PluginFSMConfig `protobuf:"bytes,2,opt,name=config,proto3,oneof"`
}

type FSMToPlugin_Deliver

type FSMToPlugin_Deliver struct {
	// deliver: request to execute 'deliver tx' logic on the plugin
	Deliver *PluginDeliverRequest `protobuf:"bytes,6,opt,name=deliver,proto3,oneof"`
}

type FSMToPlugin_End

type FSMToPlugin_End struct {
	// end: request to execute 'end block' logic on the plugin
	End *PluginEndRequest `protobuf:"bytes,7,opt,name=end,proto3,oneof"`
}

type FSMToPlugin_Error

type FSMToPlugin_Error struct {
	// error: any error returned by the FSM
	Error *PluginError `protobuf:"bytes,99,opt,name=error,proto3,oneof"`
}

type FSMToPlugin_Genesis

type FSMToPlugin_Genesis struct {
	// genesis: request to execute genesis logic on the plugin
	Genesis *PluginGenesisRequest `protobuf:"bytes,3,opt,name=genesis,proto3,oneof"`
}

type FSMToPlugin_StateRead

type FSMToPlugin_StateRead struct {
	// state_read: response with read state data
	StateRead *PluginStateReadResponse `protobuf:"bytes,8,opt,name=state_read,json=stateRead,proto3,oneof"`
}

type FSMToPlugin_StateWrite

type FSMToPlugin_StateWrite struct {
	// state_write: acknowledgment of write operation
	StateWrite *PluginStateWriteResponse `protobuf:"bytes,9,opt,name=state_write,json=stateWrite,proto3,oneof"`
}

type FeeParams

type FeeParams struct {

	// send_fee: is the fee amount (in uCNPY) for Message Send
	SendFee uint64 `protobuf:"varint,1,opt,name=send_fee,json=sendFee,proto3" json:"sendFee"` // @gotags: json:"sendFee"
	// contains filtered or unexported fields
}

FeeParams is the parameter space that defines various amounts for transaction fees

func (*FeeParams) Descriptor deprecated

func (*FeeParams) Descriptor() ([]byte, []int)

Deprecated: Use FeeParams.ProtoReflect.Descriptor instead.

func (*FeeParams) GetSendFee

func (x *FeeParams) GetSendFee() uint64

func (*FeeParams) ProtoMessage

func (*FeeParams) ProtoMessage()

func (*FeeParams) ProtoReflect

func (x *FeeParams) ProtoReflect() protoreflect.Message

func (*FeeParams) Reset

func (x *FeeParams) Reset()

func (*FeeParams) String

func (x *FeeParams) String() string

type MessageSend

type MessageSend struct {

	// from_address: is the sender of the funds
	FromAddress []byte `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"fromAddress"` // @gotags: json:"fromAddress"
	// to_address: is the recipient of the funds
	ToAddress []byte `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"toAddress"` // @gotags: json:"toAddress"
	// amount: is the amount of tokens in micro-denomination (uCNPY)
	Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
	// contains filtered or unexported fields
}

MessageSend is a standard transfer transaction, taking tokens from the sender and transferring them to the recipient

func (*MessageSend) Descriptor deprecated

func (*MessageSend) Descriptor() ([]byte, []int)

Deprecated: Use MessageSend.ProtoReflect.Descriptor instead.

func (*MessageSend) GetAmount

func (x *MessageSend) GetAmount() uint64

func (*MessageSend) GetFromAddress

func (x *MessageSend) GetFromAddress() []byte

func (*MessageSend) GetToAddress

func (x *MessageSend) GetToAddress() []byte

func (*MessageSend) ProtoMessage

func (*MessageSend) ProtoMessage()

func (*MessageSend) ProtoReflect

func (x *MessageSend) ProtoReflect() protoreflect.Message

func (*MessageSend) Reset

func (x *MessageSend) Reset()

func (*MessageSend) String

func (x *MessageSend) String() string

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin defines the 'VM-less' extension of the Finite State Machine

func (*Plugin) Handshake

func (p *Plugin) Handshake() *PluginError

Handshake() sends the contract configuration to the FSM and awaits a reply

func (*Plugin) ListenForInbound

func (p *Plugin) ListenForInbound()

ListenForInbound() routes inbound requests from the plugin

func (*Plugin) StateRead

Genesis() is the fsm calling the genesis function of the plugin

func (*Plugin) StateWrite

type PluginBeginRequest

type PluginBeginRequest struct {
	// contains filtered or unexported fields
}

PluginBeginRequest signals start of a new block

func (*PluginBeginRequest) Descriptor deprecated

func (*PluginBeginRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginBeginRequest.ProtoReflect.Descriptor instead.

func (*PluginBeginRequest) ProtoMessage

func (*PluginBeginRequest) ProtoMessage()

func (*PluginBeginRequest) ProtoReflect

func (x *PluginBeginRequest) ProtoReflect() protoreflect.Message

func (*PluginBeginRequest) Reset

func (x *PluginBeginRequest) Reset()

func (*PluginBeginRequest) String

func (x *PluginBeginRequest) String() string

type PluginBeginResponse

type PluginBeginResponse struct {
	Error *PluginError `protobuf:"bytes,99,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

PluginBeginResponse acknowledges begin block execution

func (*PluginBeginResponse) Descriptor deprecated

func (*PluginBeginResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginBeginResponse.ProtoReflect.Descriptor instead.

func (*PluginBeginResponse) GetError

func (x *PluginBeginResponse) GetError() *PluginError

func (*PluginBeginResponse) ProtoMessage

func (*PluginBeginResponse) ProtoMessage()

func (*PluginBeginResponse) ProtoReflect

func (x *PluginBeginResponse) ProtoReflect() protoreflect.Message

func (*PluginBeginResponse) Reset

func (x *PluginBeginResponse) Reset()

func (*PluginBeginResponse) String

func (x *PluginBeginResponse) String() string

type PluginCheckRequest

type PluginCheckRequest struct {
	Tx *Transaction `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
	// contains filtered or unexported fields
}

PluginCheckRequest carries a transaction to be checked

func (*PluginCheckRequest) Descriptor deprecated

func (*PluginCheckRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginCheckRequest.ProtoReflect.Descriptor instead.

func (*PluginCheckRequest) GetTx

func (x *PluginCheckRequest) GetTx() *Transaction

func (*PluginCheckRequest) ProtoMessage

func (*PluginCheckRequest) ProtoMessage()

func (*PluginCheckRequest) ProtoReflect

func (x *PluginCheckRequest) ProtoReflect() protoreflect.Message

func (*PluginCheckRequest) Reset

func (x *PluginCheckRequest) Reset()

func (*PluginCheckRequest) String

func (x *PluginCheckRequest) String() string

type PluginCheckResponse

type PluginCheckResponse struct {

	// authorized_signers: addresses who are authorized to sign the transaction
	AuthorizedSigners [][]byte `protobuf:"bytes,1,rep,name=authorized_signers,json=authorizedSigners,proto3" json:"authorizedSigners"` // @gotags: json:"authorizedSigners"
	// recipient: address of the recipient of the transaction (nil if not applicable)
	Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// error: an error occurred when checking the transaction
	Error *PluginError `protobuf:"bytes,99,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

PluginCheckResponse acknowledges transaction check

func (*PluginCheckResponse) Descriptor deprecated

func (*PluginCheckResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginCheckResponse.ProtoReflect.Descriptor instead.

func (*PluginCheckResponse) GetAuthorizedSigners

func (x *PluginCheckResponse) GetAuthorizedSigners() [][]byte

func (*PluginCheckResponse) GetError

func (x *PluginCheckResponse) GetError() *PluginError

func (*PluginCheckResponse) GetRecipient

func (x *PluginCheckResponse) GetRecipient() []byte

func (*PluginCheckResponse) ProtoMessage

func (*PluginCheckResponse) ProtoMessage()

func (*PluginCheckResponse) ProtoReflect

func (x *PluginCheckResponse) ProtoReflect() protoreflect.Message

func (*PluginCheckResponse) Reset

func (x *PluginCheckResponse) Reset()

func (*PluginCheckResponse) String

func (x *PluginCheckResponse) String() string

type PluginConfig

type PluginConfig struct {

	// name: the name of the plugin
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// id: the unique identifier of the plugin
	Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	// version: the version of the plugin
	Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
	// supported_transactions: a list of custom transaction names that are supported
	SupportedTransactions []string `protobuf:"bytes,4,rep,name=supported_transactions,json=supportedTransactions,proto3" json:"supported_transactions,omitempty"`
	// contains filtered or unexported fields
}

PluginConfig is the identity information of the plugin that is communicated to the fsm

func (*PluginConfig) Descriptor deprecated

func (*PluginConfig) Descriptor() ([]byte, []int)

Deprecated: Use PluginConfig.ProtoReflect.Descriptor instead.

func (*PluginConfig) GetId

func (x *PluginConfig) GetId() uint64

func (*PluginConfig) GetName

func (x *PluginConfig) GetName() string

func (*PluginConfig) GetSupportedTransactions

func (x *PluginConfig) GetSupportedTransactions() []string

func (*PluginConfig) GetVersion

func (x *PluginConfig) GetVersion() uint64

func (*PluginConfig) ProtoMessage

func (*PluginConfig) ProtoMessage()

func (*PluginConfig) ProtoReflect

func (x *PluginConfig) ProtoReflect() protoreflect.Message

func (*PluginConfig) Reset

func (x *PluginConfig) Reset()

func (*PluginConfig) String

func (x *PluginConfig) String() string

type PluginDeleteOp

type PluginDeleteOp struct {

	// key: is the 'key' associated with the value in the KV pair for the delete op
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

PluginDeleteOp represents a key to delete from state

func (*PluginDeleteOp) Descriptor deprecated

func (*PluginDeleteOp) Descriptor() ([]byte, []int)

Deprecated: Use PluginDeleteOp.ProtoReflect.Descriptor instead.

func (*PluginDeleteOp) GetKey

func (x *PluginDeleteOp) GetKey() []byte

func (*PluginDeleteOp) ProtoMessage

func (*PluginDeleteOp) ProtoMessage()

func (*PluginDeleteOp) ProtoReflect

func (x *PluginDeleteOp) ProtoReflect() protoreflect.Message

func (*PluginDeleteOp) Reset

func (x *PluginDeleteOp) Reset()

func (*PluginDeleteOp) String

func (x *PluginDeleteOp) String() string

type PluginDeliverRequest

type PluginDeliverRequest struct {
	Tx *Transaction `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
	// contains filtered or unexported fields
}

PluginDeliverRequest carries a transaction to be processed

func (*PluginDeliverRequest) Descriptor deprecated

func (*PluginDeliverRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginDeliverRequest.ProtoReflect.Descriptor instead.

func (*PluginDeliverRequest) GetTx

func (x *PluginDeliverRequest) GetTx() *Transaction

func (*PluginDeliverRequest) ProtoMessage

func (*PluginDeliverRequest) ProtoMessage()

func (*PluginDeliverRequest) ProtoReflect

func (x *PluginDeliverRequest) ProtoReflect() protoreflect.Message

func (*PluginDeliverRequest) Reset

func (x *PluginDeliverRequest) Reset()

func (*PluginDeliverRequest) String

func (x *PluginDeliverRequest) String() string

type PluginDeliverResponse

type PluginDeliverResponse struct {
	Error *PluginError `protobuf:"bytes,99,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

PluginDeliverResponse acknowledges transaction delivery

func (*PluginDeliverResponse) Descriptor deprecated

func (*PluginDeliverResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginDeliverResponse.ProtoReflect.Descriptor instead.

func (*PluginDeliverResponse) GetError

func (x *PluginDeliverResponse) GetError() *PluginError

func (*PluginDeliverResponse) ProtoMessage

func (*PluginDeliverResponse) ProtoMessage()

func (*PluginDeliverResponse) ProtoReflect

func (x *PluginDeliverResponse) ProtoReflect() protoreflect.Message

func (*PluginDeliverResponse) Reset

func (x *PluginDeliverResponse) Reset()

func (*PluginDeliverResponse) String

func (x *PluginDeliverResponse) String() string

type PluginEndRequest

type PluginEndRequest struct {
	ProposerAddress []byte `protobuf:"bytes,1,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"`
	// contains filtered or unexported fields
}

PluginEndRequest signals end of the current block

func (*PluginEndRequest) Descriptor deprecated

func (*PluginEndRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginEndRequest.ProtoReflect.Descriptor instead.

func (*PluginEndRequest) GetProposerAddress

func (x *PluginEndRequest) GetProposerAddress() []byte

func (*PluginEndRequest) ProtoMessage

func (*PluginEndRequest) ProtoMessage()

func (*PluginEndRequest) ProtoReflect

func (x *PluginEndRequest) ProtoReflect() protoreflect.Message

func (*PluginEndRequest) Reset

func (x *PluginEndRequest) Reset()

func (*PluginEndRequest) String

func (x *PluginEndRequest) String() string

type PluginEndResponse

type PluginEndResponse struct {
	Error *PluginError `protobuf:"bytes,99,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

PluginEndResponse acknowledges end block execution

func (*PluginEndResponse) Descriptor deprecated

func (*PluginEndResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginEndResponse.ProtoReflect.Descriptor instead.

func (*PluginEndResponse) GetError

func (x *PluginEndResponse) GetError() *PluginError

func (*PluginEndResponse) ProtoMessage

func (*PluginEndResponse) ProtoMessage()

func (*PluginEndResponse) ProtoReflect

func (x *PluginEndResponse) ProtoReflect() protoreflect.Message

func (*PluginEndResponse) Reset

func (x *PluginEndResponse) Reset()

func (*PluginEndResponse) String

func (x *PluginEndResponse) String() string

type PluginError

type PluginError struct {
	Code   uint64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`    // error code
	Module string `protobuf:"bytes,2,opt,name=module,proto3" json:"module,omitempty"` // error module
	Msg    string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"`       // error message
	// contains filtered or unexported fields
}

PluginError carries error details from plugin or FSM

func ErrFailedPluginRead

func ErrFailedPluginRead(err error) *PluginError

func ErrFailedPluginWrite

func ErrFailedPluginWrite(err error) *PluginError

func ErrFromAny

func ErrFromAny(err error) *PluginError

func ErrInsufficientFunds

func ErrInsufficientFunds() *PluginError

func ErrInvalidAddress

func ErrInvalidAddress() *PluginError

func ErrInvalidAmount

func ErrInvalidAmount() *PluginError

func ErrInvalidFSMToPluginMMessage

func ErrInvalidFSMToPluginMMessage(t reflect.Type) *PluginError

func ErrInvalidMessageCast

func ErrInvalidMessageCast() *PluginError

func ErrInvalidPluginRespId

func ErrInvalidPluginRespId() *PluginError

func ErrMarshal

func ErrMarshal(err error) *PluginError

func ErrPluginTimeout

func ErrPluginTimeout() *PluginError

func ErrTxFeeBelowStateLimit

func ErrTxFeeBelowStateLimit() *PluginError

func ErrUnexpectedFSMToPlugin

func ErrUnexpectedFSMToPlugin(t reflect.Type) *PluginError

func ErrUnmarshal

func ErrUnmarshal(err error) *PluginError

func FromAny

func FromAny(any *anypb.Any) (proto.Message, *PluginError)

FromAny() converts an anypb.Any type back into a proto.Message

func Marshal

func Marshal(message any) ([]byte, *PluginError)

Marshal() serializes a proto.Message into a byte slice

func NewError

func NewError(code uint64, module, message string) *PluginError

NewError() creates a plugin error

func Unmarshal

func Unmarshal(protoBytes []byte, ptr any) *PluginError

Unmarshal() deserializes a byte slice into a proto.Message

func (*PluginError) Descriptor deprecated

func (*PluginError) Descriptor() ([]byte, []int)

Deprecated: Use PluginError.ProtoReflect.Descriptor instead.

func (*PluginError) Error

func (p *PluginError) Error() string

Error() implements the errors interface

func (*PluginError) GetCode

func (x *PluginError) GetCode() uint64

func (*PluginError) GetModule

func (x *PluginError) GetModule() string

func (*PluginError) GetMsg

func (x *PluginError) GetMsg() string

func (*PluginError) ProtoMessage

func (*PluginError) ProtoMessage()

func (*PluginError) ProtoReflect

func (x *PluginError) ProtoReflect() protoreflect.Message

func (*PluginError) Reset

func (x *PluginError) Reset()

func (*PluginError) String

func (x *PluginError) String() string

type PluginFSMConfig

type PluginFSMConfig struct {
	// contains filtered or unexported fields
}

PluginFSMConfig is the identity information of the plugin that is communicated from the fsm to the plugin

func (*PluginFSMConfig) Descriptor deprecated

func (*PluginFSMConfig) Descriptor() ([]byte, []int)

Deprecated: Use PluginFSMConfig.ProtoReflect.Descriptor instead.

func (*PluginFSMConfig) ProtoMessage

func (*PluginFSMConfig) ProtoMessage()

func (*PluginFSMConfig) ProtoReflect

func (x *PluginFSMConfig) ProtoReflect() protoreflect.Message

func (*PluginFSMConfig) Reset

func (x *PluginFSMConfig) Reset()

func (*PluginFSMConfig) String

func (x *PluginFSMConfig) String() string

type PluginGenesisRequest

type PluginGenesisRequest struct {
	GenesisJson []byte `protobuf:"bytes,1,opt,name=genesis_json,json=genesisJson,proto3" json:"genesis_json,omitempty"`
	// contains filtered or unexported fields
}

PluginGenesisRequest carries genesis JSON data for initialization

func (*PluginGenesisRequest) Descriptor deprecated

func (*PluginGenesisRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginGenesisRequest.ProtoReflect.Descriptor instead.

func (*PluginGenesisRequest) GetGenesisJson

func (x *PluginGenesisRequest) GetGenesisJson() []byte

func (*PluginGenesisRequest) ProtoMessage

func (*PluginGenesisRequest) ProtoMessage()

func (*PluginGenesisRequest) ProtoReflect

func (x *PluginGenesisRequest) ProtoReflect() protoreflect.Message

func (*PluginGenesisRequest) Reset

func (x *PluginGenesisRequest) Reset()

func (*PluginGenesisRequest) String

func (x *PluginGenesisRequest) String() string

type PluginGenesisResponse

type PluginGenesisResponse struct {
	Error *PluginError `protobuf:"bytes,99,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

PluginGenesisResponse acknowledges genesis execution completion

func (*PluginGenesisResponse) Descriptor deprecated

func (*PluginGenesisResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginGenesisResponse.ProtoReflect.Descriptor instead.

func (*PluginGenesisResponse) GetError

func (x *PluginGenesisResponse) GetError() *PluginError

func (*PluginGenesisResponse) ProtoMessage

func (*PluginGenesisResponse) ProtoMessage()

func (*PluginGenesisResponse) ProtoReflect

func (x *PluginGenesisResponse) ProtoReflect() protoreflect.Message

func (*PluginGenesisResponse) Reset

func (x *PluginGenesisResponse) Reset()

func (*PluginGenesisResponse) String

func (x *PluginGenesisResponse) String() string

type PluginKeyRead

type PluginKeyRead struct {

	// query_id to correlate requests and responses
	QueryId uint64 `protobuf:"varint,1,opt,name=query_id,json=queryId,proto3" json:"queryId"` // @gotags: json:"queryId"
	// key to read from state
	Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

PluginKeyRead requests a single key read, identified by query_id

func (*PluginKeyRead) Descriptor deprecated

func (*PluginKeyRead) Descriptor() ([]byte, []int)

Deprecated: Use PluginKeyRead.ProtoReflect.Descriptor instead.

func (*PluginKeyRead) GetKey

func (x *PluginKeyRead) GetKey() []byte

func (*PluginKeyRead) GetQueryId

func (x *PluginKeyRead) GetQueryId() uint64

func (*PluginKeyRead) ProtoMessage

func (*PluginKeyRead) ProtoMessage()

func (*PluginKeyRead) ProtoReflect

func (x *PluginKeyRead) ProtoReflect() protoreflect.Message

func (*PluginKeyRead) Reset

func (x *PluginKeyRead) Reset()

func (*PluginKeyRead) String

func (x *PluginKeyRead) String() string

type PluginRangeRead

type PluginRangeRead struct {

	// query_id to correlate requests and responses
	QueryId uint64 `protobuf:"varint,1,opt,name=query_id,json=queryId,proto3" json:"queryId"` // @gotags: json:"queryId"
	// prefix: the prefix to iterate over
	Prefix []byte `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"`
	// limit: maximum number of entries to return
	Limit uint64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
	// reverse: whether to iterate in reverse order
	Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"`
	// contains filtered or unexported fields
}

PluginRangeRead requests an iteration over a key range with optional limits and direction

func (*PluginRangeRead) Descriptor deprecated

func (*PluginRangeRead) Descriptor() ([]byte, []int)

Deprecated: Use PluginRangeRead.ProtoReflect.Descriptor instead.

func (*PluginRangeRead) GetLimit

func (x *PluginRangeRead) GetLimit() uint64

func (*PluginRangeRead) GetPrefix

func (x *PluginRangeRead) GetPrefix() []byte

func (*PluginRangeRead) GetQueryId

func (x *PluginRangeRead) GetQueryId() uint64

func (*PluginRangeRead) GetReverse

func (x *PluginRangeRead) GetReverse() bool

func (*PluginRangeRead) ProtoMessage

func (*PluginRangeRead) ProtoMessage()

func (*PluginRangeRead) ProtoReflect

func (x *PluginRangeRead) ProtoReflect() protoreflect.Message

func (*PluginRangeRead) Reset

func (x *PluginRangeRead) Reset()

func (*PluginRangeRead) String

func (x *PluginRangeRead) String() string

type PluginReadResult

type PluginReadResult struct {

	// query_id: matching the original read request
	QueryId uint64 `protobuf:"varint,1,opt,name=query_id,json=queryId,proto3" json:"queryId"` // @gotags: json:"queryId"
	// entries: returned for this query
	Entries []*PluginStateEntry `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"`
	// contains filtered or unexported fields
}

PluginReadResult holds the result entries for a specific read query

func (*PluginReadResult) Descriptor deprecated

func (*PluginReadResult) Descriptor() ([]byte, []int)

Deprecated: Use PluginReadResult.ProtoReflect.Descriptor instead.

func (*PluginReadResult) GetEntries

func (x *PluginReadResult) GetEntries() []*PluginStateEntry

func (*PluginReadResult) GetQueryId

func (x *PluginReadResult) GetQueryId() uint64

func (*PluginReadResult) ProtoMessage

func (*PluginReadResult) ProtoMessage()

func (*PluginReadResult) ProtoReflect

func (x *PluginReadResult) ProtoReflect() protoreflect.Message

func (*PluginReadResult) Reset

func (x *PluginReadResult) Reset()

func (*PluginReadResult) String

func (x *PluginReadResult) String() string

type PluginSetOp

type PluginSetOp struct {

	// key: is the 'key' associated with the value in the KV pair for the set op
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// key: is the 'value' associated with the value in the KV pair for the set op
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

PluginSetOp represents a key/value pair to set in state

func (*PluginSetOp) Descriptor deprecated

func (*PluginSetOp) Descriptor() ([]byte, []int)

Deprecated: Use PluginSetOp.ProtoReflect.Descriptor instead.

func (*PluginSetOp) GetKey

func (x *PluginSetOp) GetKey() []byte

func (*PluginSetOp) GetValue

func (x *PluginSetOp) GetValue() []byte

func (*PluginSetOp) ProtoMessage

func (*PluginSetOp) ProtoMessage()

func (*PluginSetOp) ProtoReflect

func (x *PluginSetOp) ProtoReflect() protoreflect.Message

func (*PluginSetOp) Reset

func (x *PluginSetOp) Reset()

func (*PluginSetOp) String

func (x *PluginSetOp) String() string

type PluginStateEntry

type PluginStateEntry struct {

	// key: is the 'key' associated with the value in the KV pair for the 'get' op
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// value: is the 'value' associated with the value in the KV pair for the 'get' op
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

PluginStateEntry represents a key/value pair returned in read results

func (*PluginStateEntry) Descriptor deprecated

func (*PluginStateEntry) Descriptor() ([]byte, []int)

Deprecated: Use PluginStateEntry.ProtoReflect.Descriptor instead.

func (*PluginStateEntry) GetKey

func (x *PluginStateEntry) GetKey() []byte

func (*PluginStateEntry) GetValue

func (x *PluginStateEntry) GetValue() []byte

func (*PluginStateEntry) ProtoMessage

func (*PluginStateEntry) ProtoMessage()

func (*PluginStateEntry) ProtoReflect

func (x *PluginStateEntry) ProtoReflect() protoreflect.Message

func (*PluginStateEntry) Reset

func (x *PluginStateEntry) Reset()

func (*PluginStateEntry) String

func (x *PluginStateEntry) String() string

type PluginStateReadRequest

type PluginStateReadRequest struct {

	// keys: explicit keys to read
	Keys []*PluginKeyRead `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
	// ranges: key ranges to iterate over and read
	Ranges []*PluginRangeRead `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"`
	// contains filtered or unexported fields
}

PluginStateReadRequest allows batching multiple key or range reads in one call

func (*PluginStateReadRequest) Descriptor deprecated

func (*PluginStateReadRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginStateReadRequest.ProtoReflect.Descriptor instead.

func (*PluginStateReadRequest) GetKeys

func (x *PluginStateReadRequest) GetKeys() []*PluginKeyRead

func (*PluginStateReadRequest) GetRanges

func (x *PluginStateReadRequest) GetRanges() []*PluginRangeRead

func (*PluginStateReadRequest) ProtoMessage

func (*PluginStateReadRequest) ProtoMessage()

func (*PluginStateReadRequest) ProtoReflect

func (x *PluginStateReadRequest) ProtoReflect() protoreflect.Message

func (*PluginStateReadRequest) Reset

func (x *PluginStateReadRequest) Reset()

func (*PluginStateReadRequest) String

func (x *PluginStateReadRequest) String() string

type PluginStateReadResponse

type PluginStateReadResponse struct {

	// results hold multiple query results matching requests by query_id
	Results []*PluginReadResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	// error: if an error occurred during the request execution
	Error *PluginError `protobuf:"bytes,99,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

PluginStateReadResponse returns the results for the read requests

func (*PluginStateReadResponse) Descriptor deprecated

func (*PluginStateReadResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginStateReadResponse.ProtoReflect.Descriptor instead.

func (*PluginStateReadResponse) GetError

func (x *PluginStateReadResponse) GetError() *PluginError

func (*PluginStateReadResponse) GetResults

func (x *PluginStateReadResponse) GetResults() []*PluginReadResult

func (*PluginStateReadResponse) ProtoMessage

func (*PluginStateReadResponse) ProtoMessage()

func (*PluginStateReadResponse) ProtoReflect

func (x *PluginStateReadResponse) ProtoReflect() protoreflect.Message

func (*PluginStateReadResponse) Reset

func (x *PluginStateReadResponse) Reset()

func (*PluginStateReadResponse) String

func (x *PluginStateReadResponse) String() string

type PluginStateWriteRequest

type PluginStateWriteRequest struct {

	// sets: keys and values to write to state
	Sets []*PluginSetOp `protobuf:"bytes,1,rep,name=sets,proto3" json:"sets,omitempty"`
	// deletes: keys to remove from state
	Deletes []*PluginDeleteOp `protobuf:"bytes,2,rep,name=deletes,proto3" json:"deletes,omitempty"`
	// contains filtered or unexported fields
}

PluginStateWriteRequest batches multiple set and delete operations in one call

func (*PluginStateWriteRequest) Descriptor deprecated

func (*PluginStateWriteRequest) Descriptor() ([]byte, []int)

Deprecated: Use PluginStateWriteRequest.ProtoReflect.Descriptor instead.

func (*PluginStateWriteRequest) GetDeletes

func (x *PluginStateWriteRequest) GetDeletes() []*PluginDeleteOp

func (*PluginStateWriteRequest) GetSets

func (x *PluginStateWriteRequest) GetSets() []*PluginSetOp

func (*PluginStateWriteRequest) ProtoMessage

func (*PluginStateWriteRequest) ProtoMessage()

func (*PluginStateWriteRequest) ProtoReflect

func (x *PluginStateWriteRequest) ProtoReflect() protoreflect.Message

func (*PluginStateWriteRequest) Reset

func (x *PluginStateWriteRequest) Reset()

func (*PluginStateWriteRequest) String

func (x *PluginStateWriteRequest) String() string

type PluginStateWriteResponse

type PluginStateWriteResponse struct {

	// error: if an error occurred during the request execution
	Error *PluginError `protobuf:"bytes,99,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

PluginStateWriteResponse acknowledges successful write operations

func (*PluginStateWriteResponse) Descriptor deprecated

func (*PluginStateWriteResponse) Descriptor() ([]byte, []int)

Deprecated: Use PluginStateWriteResponse.ProtoReflect.Descriptor instead.

func (*PluginStateWriteResponse) GetError

func (x *PluginStateWriteResponse) GetError() *PluginError

func (*PluginStateWriteResponse) ProtoMessage

func (*PluginStateWriteResponse) ProtoMessage()

func (*PluginStateWriteResponse) ProtoReflect

func (x *PluginStateWriteResponse) ProtoReflect() protoreflect.Message

func (*PluginStateWriteResponse) Reset

func (x *PluginStateWriteResponse) Reset()

func (*PluginStateWriteResponse) String

func (x *PluginStateWriteResponse) String() string

type PluginToFSM

type PluginToFSM struct {

	// id: the unique ID of the request
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// payload: the payload of the message
	//
	// Types that are valid to be assigned to Payload:
	//
	//	*PluginToFSM_Config
	//	*PluginToFSM_Genesis
	//	*PluginToFSM_Begin
	//	*PluginToFSM_Check
	//	*PluginToFSM_Deliver
	//	*PluginToFSM_End
	//	*PluginToFSM_StateRead
	//	*PluginToFSM_StateWrite
	Payload isPluginToFSM_Payload `protobuf_oneof:"payload"`
	// contains filtered or unexported fields
}

PluginToFSM is the outbound message from the plugin to the FSM (plugin -> fsm)

func (*PluginToFSM) Descriptor deprecated

func (*PluginToFSM) Descriptor() ([]byte, []int)

Deprecated: Use PluginToFSM.ProtoReflect.Descriptor instead.

func (*PluginToFSM) GetBegin

func (x *PluginToFSM) GetBegin() *PluginBeginResponse

func (*PluginToFSM) GetCheck

func (x *PluginToFSM) GetCheck() *PluginCheckResponse

func (*PluginToFSM) GetConfig

func (x *PluginToFSM) GetConfig() *PluginConfig

func (*PluginToFSM) GetDeliver

func (x *PluginToFSM) GetDeliver() *PluginDeliverResponse

func (*PluginToFSM) GetEnd

func (x *PluginToFSM) GetEnd() *PluginEndResponse

func (*PluginToFSM) GetGenesis

func (x *PluginToFSM) GetGenesis() *PluginGenesisResponse

func (*PluginToFSM) GetId

func (x *PluginToFSM) GetId() uint64

func (*PluginToFSM) GetPayload

func (x *PluginToFSM) GetPayload() isPluginToFSM_Payload

func (*PluginToFSM) GetStateRead

func (x *PluginToFSM) GetStateRead() *PluginStateReadRequest

func (*PluginToFSM) GetStateWrite

func (x *PluginToFSM) GetStateWrite() *PluginStateWriteRequest

func (*PluginToFSM) ProtoMessage

func (*PluginToFSM) ProtoMessage()

func (*PluginToFSM) ProtoReflect

func (x *PluginToFSM) ProtoReflect() protoreflect.Message

func (*PluginToFSM) Reset

func (x *PluginToFSM) Reset()

func (*PluginToFSM) String

func (x *PluginToFSM) String() string

type PluginToFSM_Begin

type PluginToFSM_Begin struct {
	// begin: response to the begin block request
	Begin *PluginBeginResponse `protobuf:"bytes,4,opt,name=begin,proto3,oneof"`
}

type PluginToFSM_Check

type PluginToFSM_Check struct {
	// check: response to the check tx request
	Check *PluginCheckResponse `protobuf:"bytes,5,opt,name=check,proto3,oneof"`
}

type PluginToFSM_Config

type PluginToFSM_Config struct {
	// config: the request to initialize the plugin
	Config *PluginConfig `protobuf:"bytes,2,opt,name=config,proto3,oneof"`
}

type PluginToFSM_Deliver

type PluginToFSM_Deliver struct {
	// deliver: response to the deliver tx request
	Deliver *PluginDeliverResponse `protobuf:"bytes,6,opt,name=deliver,proto3,oneof"`
}

type PluginToFSM_End

type PluginToFSM_End struct {
	// end: response to the end block request
	End *PluginEndResponse `protobuf:"bytes,7,opt,name=end,proto3,oneof"`
}

type PluginToFSM_Genesis

type PluginToFSM_Genesis struct {
	// genesis: response to the genesis request
	Genesis *PluginGenesisResponse `protobuf:"bytes,3,opt,name=genesis,proto3,oneof"`
}

type PluginToFSM_StateRead

type PluginToFSM_StateRead struct {
	// state_read: request to read plugin state from the FSM
	StateRead *PluginStateReadRequest `protobuf:"bytes,8,opt,name=state_read,json=stateRead,proto3,oneof"`
}

type PluginToFSM_StateWrite

type PluginToFSM_StateWrite struct {
	// state_write: request to write plugin state to the FSM
	StateWrite *PluginStateWriteRequest `protobuf:"bytes,9,opt,name=state_write,json=stateWrite,proto3,oneof"`
}

type Pool

type Pool struct {

	// id: the unique identifier of the pool
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// amount: the balance of funds the pool has
	Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// contains filtered or unexported fields
}

A pool is like an account without an owner, holding funds that are managed directly by the blockchain protocol It's very similar to an account but instead of an address it has a unique ID and operates based on predefined blockchain rules rather than individual control

func (*Pool) Descriptor deprecated

func (*Pool) Descriptor() ([]byte, []int)

Deprecated: Use Pool.ProtoReflect.Descriptor instead.

func (*Pool) GetAmount

func (x *Pool) GetAmount() uint64

func (*Pool) GetId

func (x *Pool) GetId() uint64

func (*Pool) ProtoMessage

func (*Pool) ProtoMessage()

func (*Pool) ProtoReflect

func (x *Pool) ProtoReflect() protoreflect.Message

func (*Pool) Reset

func (x *Pool) Reset()

func (*Pool) String

func (x *Pool) String() string

type Signature

type Signature struct {

	// public_key: is a cryptographic code shared openly, used to verify digital signatures
	PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"publicKey"` // @gotags: json:"publicKey"
	// signature: the bytes of the signature output from a private key which may be verified with the message and public
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

A Signature is a digital signature is a cryptographic "fingerprint" created with a private key, allowing others to verify the authenticity and integrity of a message using the corresponding public key

func (*Signature) Descriptor deprecated

func (*Signature) Descriptor() ([]byte, []int)

Deprecated: Use Signature.ProtoReflect.Descriptor instead.

func (*Signature) GetPublicKey

func (x *Signature) GetPublicKey() []byte

func (*Signature) GetSignature

func (x *Signature) GetSignature() []byte

func (*Signature) ProtoMessage

func (*Signature) ProtoMessage()

func (*Signature) ProtoReflect

func (x *Signature) ProtoReflect() protoreflect.Message

func (*Signature) Reset

func (x *Signature) Reset()

func (*Signature) String

func (x *Signature) String() string

type Transaction

type Transaction struct {

	// message_type: The type of the transaction like 'send' or 'stake'
	MessageType string `protobuf:"bytes,1,opt,name=message_type,json=messageType,proto3" json:"messageType"` // @gotags: json:"messageType"
	// msg: The actual transaction message payload, which is encapsulated in a generic message format
	Msg *anypb.Any `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// fee: The fee associated with processing the transaction
	Fee uint64 `protobuf:"varint,6,opt,name=fee,proto3" json:"fee,omitempty"`
	// contains filtered or unexported fields
}

Transaction represents a request or action submitted to the network like transfer assets or perform other operations within the blockchain system

func (*Transaction) Descriptor deprecated

func (*Transaction) Descriptor() ([]byte, []int)

Deprecated: Use Transaction.ProtoReflect.Descriptor instead.

func (*Transaction) GetFee

func (x *Transaction) GetFee() uint64

func (*Transaction) GetMessageType

func (x *Transaction) GetMessageType() string

func (*Transaction) GetMsg

func (x *Transaction) GetMsg() *anypb.Any

func (*Transaction) ProtoMessage

func (*Transaction) ProtoMessage()

func (*Transaction) ProtoReflect

func (x *Transaction) ProtoReflect() protoreflect.Message

func (*Transaction) Reset

func (x *Transaction) Reset()

func (*Transaction) String

func (x *Transaction) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL