rpc

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ReadContractCall      = "chain.read_contract"
	GetAccountNonceCall   = "chain.get_account_nonce"
	GetAccountRcCall      = "chain.get_account_rc"
	SubmitTransactionCall = "chain.submit_transaction"
	GetChainIDCall        = "chain.get_chain_id"
	GetContractMetaCall   = "contract_meta_store.get_contract_meta"
)

These are the rpc calls that the wallet uses

Variables

This section is empty.

Functions

This section is empty.

Types

type KoinosRPCClient

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

KoinosRPCClient is a wrapper around the jsonrpc client

func NewKoinosRPCClient

func NewKoinosRPCClient(url string) *KoinosRPCClient

NewKoinosRPCClient creates a new koinos rpc client

func (*KoinosRPCClient) Call

func (c *KoinosRPCClient) Call(ctx context.Context, method string, params proto.Message, returnType proto.Message) error

Call wraps the rpc client call and handles some of the boilerplate

func (*KoinosRPCClient) GetAccountBalance

func (c *KoinosRPCClient) GetAccountBalance(ctx context.Context, address []byte, contractID []byte, balanceOfEntry uint32) (uint64, error)

GetAccountBalance gets the balance of a given account

func (*KoinosRPCClient) GetAccountNonce

func (c *KoinosRPCClient) GetAccountNonce(ctx context.Context, address []byte) (uint64, error)

GetAccountNonce gets the nonce of a given account

func (*KoinosRPCClient) GetAccountRc

func (c *KoinosRPCClient) GetAccountRc(ctx context.Context, address []byte) (uint64, error)

GetAccountRc gets the rc of a given account

func (*KoinosRPCClient) GetChainID

func (c *KoinosRPCClient) GetChainID(ctx context.Context) ([]byte, error)

GetChainID gets the chain id

func (*KoinosRPCClient) GetContractMeta

func (c *KoinosRPCClient) GetContractMeta(ctx context.Context, contractID []byte) (*contract_meta_store.ContractMetaItem, error)

GetContractMeta gets the metadata of a given contract

func (*KoinosRPCClient) ReadContract

func (c *KoinosRPCClient) ReadContract(ctx context.Context, args []byte, contractID []byte, entryPoint uint32) (*chain.ReadContractResponse, error)

ReadContract reads from the given contract and returns the response

func (*KoinosRPCClient) SubmitTransaction

func (c *KoinosRPCClient) SubmitTransaction(ctx context.Context, ops []*protocol.Operation, key *util.KoinosKey, subParams *SubmissionParams, broadcast bool) (*protocol.TransactionReceipt, error)

SubmitTransaction creates and submits a transaction from a list of operations

func (*KoinosRPCClient) SubmitTransactionWithPayer

func (c *KoinosRPCClient) SubmitTransactionWithPayer(ctx context.Context, ops []*protocol.Operation, key *util.KoinosKey, subParams *SubmissionParams, payer []byte, broadcast bool) (*protocol.TransactionReceipt, error)

SubmitTransaction creates and submits a transaction from a list of operations with a specified payer

type KoinosRPCError

type KoinosRPCError struct {
	Logs []string
	// contains filtered or unexported fields
}

KoinosRPCError is a golang error that also contains log messages from a reverted transaction

func (KoinosRPCError) Error

func (e KoinosRPCError) Error() string

Error returns the error message

type SubmissionParams

type SubmissionParams struct {
	Nonce   uint64
	RCLimit uint64
}

SubmissionParams is the parameters for a transaction submission

Jump to

Keyboard shortcuts

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