orbs

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: MIT Imports: 13 Imported by: 18

Documentation

Index

Constants

View Source
const (
	SHA256_HASH_SIZE_BYTES       = 32
	CLIENT_ADDRESS_SIZE_BYTES    = 20
	CLIENT_ADDRESS_SHA256_OFFSET = SHA256_HASH_SIZE_BYTES - CLIENT_ADDRESS_SIZE_BYTES
)
View Source
const (
	SEND_TRANSACTION_URL              = "/api/v1/send-transaction"
	SEND_TRANSACTION_ASYNC_URL        = "/api/v1/send-transaction-async"
	CALL_METHOD_URL                   = "/api/v1/run-query"
	GET_TRANSACTION_STATUS_URL        = "/api/v1/get-transaction-status"
	GET_TRANSACTION_RECEIPT_PROOF_URL = "/api/v1/get-transaction-receipt-proof"
	GET_BLOCK_URL                     = "/api/v1/get-block"
)
View Source
const CONTENT_TYPE_MEMBUFFERS = "application/membuffers"
View Source
const PROCESSOR_TYPE_JAVASCRIPT = ProcessorType(2)
View Source
const PROCESSOR_TYPE_NATIVE = ProcessorType(1)
View Source
const PROTOCOL_VERSION = 1

Variables

View Source
var NoConnectionError = errors.New("cannot connect to server")

TODO: streamline these errors

Functions

func AddressToBytes

func AddressToBytes(address string) []byte

func AddressValidate

func AddressValidate(address string) error

func BytesToAddress

func BytesToAddress(rawAddress []byte) string

func ReadSourcesFromDir added in v0.8.0

func ReadSourcesFromDir(dirname string) ([][]byte, error)

provides functionality required for CreateDeployTransaction

Types

type EventProcessingCallback added in v0.15.0

type EventProcessingCallback func(event *codec.Event, blockHeight uint64, transactionHash []byte, transactionId []byte, eventIndex uint64) error

EventIndex helps looking for the events of a certain transaction

type OrbsAccount

type OrbsAccount struct {
	PublicKey  []byte
	PrivateKey []byte
	Address    string // hex string starting with 0x
}

func CreateAccount

func CreateAccount() (*OrbsAccount, error)

func (*OrbsAccount) AddressAsBytes

func (oa *OrbsAccount) AddressAsBytes() []byte

type OrbsClient

type OrbsClient struct {
	Endpoint       string
	VirtualChainId uint32
	NetworkType    codec.NetworkType
}

func NewClient

func NewClient(endpoint string, virtualChainId uint32, networkType codec.NetworkType) *OrbsClient

func (*OrbsClient) CreateDeployTransaction added in v0.8.0

func (c *OrbsClient) CreateDeployTransaction(publicKey []byte, privateKey []byte, contractName string, processorType ProcessorType, code ...[]byte) (rawTransaction []byte, txId string, err error)

func (*OrbsClient) CreateQuery

func (c *OrbsClient) CreateQuery(publicKey []byte, contractName string, methodName string, inputArguments ...interface{}) (rawQuery []byte, err error)

func (*OrbsClient) CreateTransaction

func (c *OrbsClient) CreateTransaction(publicKey []byte, privateKey []byte, contractName string, methodName string, inputArguments ...interface{}) (rawTransaction []byte, txId string, err error)

func (*OrbsClient) GetBlock added in v0.7.0

func (c *OrbsClient) GetBlock(blockHeight uint64) (response *codec.GetBlockResponse, err error)

func (*OrbsClient) GetBlockHeight added in v0.15.0

func (c *OrbsClient) GetBlockHeight(publicKey []byte) (uint64, error)

func (*OrbsClient) GetTransactionReceiptProof

func (c *OrbsClient) GetTransactionReceiptProof(txId string) (response *codec.GetTransactionReceiptProofResponse, err error)

func (*OrbsClient) GetTransactionStatus

func (c *OrbsClient) GetTransactionStatus(txId string) (response *codec.GetTransactionStatusResponse, err error)

func (*OrbsClient) SendQuery

func (c *OrbsClient) SendQuery(rawQuery []byte) (response *codec.RunQueryResponse, err error)

func (*OrbsClient) SendTransaction

func (c *OrbsClient) SendTransaction(rawTransaction []byte) (response *codec.SendTransactionResponse, err error)

func (*OrbsClient) SendTransactionAsync added in v0.7.0

func (c *OrbsClient) SendTransactionAsync(rawTransaction []byte) (response *codec.SendTransactionResponse, err error)

func (*OrbsClient) Subscribe added in v0.15.0

func (c *OrbsClient) Subscribe(ctx context.Context, publicKey []byte, contractName string, eventNames []string,
	pollingInterval time.Duration, callback EventProcessingCallback) (blockHeight uint64, eventIndex uint64, err error)

type ProcessorType added in v0.8.0

type ProcessorType uint32

Jump to

Keyboard shortcuts

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