account

package
v0.0.0-...-ddeaac2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: CC0-1.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

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

func NewAccount

func NewAccount(config *endpoint.EngineConfig) (*Account, error)

func (*Account) Call

func (a *Account) Call(txn []byte, bn *int64, fromArchival bool) (*string, error)

func (*Account) ChainId

func (a *Account) ChainId() (*common.Uint256, error)

func (*Account) Close

func (a *Account) Close()

Close gracefully stops the underlying TxnProcessor, also see TxnProcessor.Close()

func (*Account) GetBalance

func (a *Account) GetBalance(addr []byte, bn *int64, fromArchival bool) (*common.Uint256, error)

func (*Account) GetCode

func (a *Account) GetCode(addr []byte, bn *int64, fromArchival bool) (*string, error)

func (*Account) GetStorageAt

func (a *Account) GetStorageAt(args []byte, bn *int64, fromArchival bool) (*string, error)

func (*Account) GetTransactionCount

func (a *Account) GetTransactionCount(addr []byte, bn *int64, fromArchival bool) (*common.Uint256, error)

func (*Account) SendRawTransaction

func (a *Account) SendRawTransaction(txn []byte) (*string, error)

type CRC32Mapper

type CRC32Mapper struct{}

CRC32Mapper is a signer to key mapper implementation that uses crc32 hash to consistently distributes signers to keys. This ensures that same signers are mapped to same key

func (CRC32Mapper) Map

func (m CRC32Mapper) Map(sender string, totalNumKeys int) int

type RoundRobinMapper

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

RoundRobinMapper is a signer to key mapper implementation that equally distributes signers to keys

func (RoundRobinMapper) Map

func (m RoundRobinMapper) Map(_ string, totalNumKeys int) int

type TxnMapper

type TxnMapper interface {
	Map(sender string, totalNumKeys int) (keyIndex int)
}

type TxnProcessor

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

func NewTxnProcessor

func NewTxnProcessor(config *endpoint.EngineConfig, account *near.Account, archivalAccount *near.Account) (*TxnProcessor, error)

NewTxnProcessor creates and starts transaction processor which is responsible for sending received Eth transaction to Near in a controlled fashion. Also see, TxnProcessor.Submit(*TxnReq)

func (*TxnProcessor) Close

func (tp *TxnProcessor) Close()

Close gracefully stops TxnProcessor, i.e.: waits for all received transactions to be completed.

func (*TxnProcessor) NewTxnReq

func (tp *TxnProcessor) NewTxnReq(rawTxn []byte) (*TxnReq, error)

NewTxnReq creates a new TxnReq from the raw transaction bytes. It also performs Sender Address, Gas Limit and Gas Price validations.

func (*TxnProcessor) Submit

func (tp *TxnProcessor) Submit(req *TxnReq) *TxnResp

Submit starts the transaction processing for TxnReq. It returns a pointer to TxnResp which is a handle to get actual transaction response. Also see, TxnResp.Get()

type TxnQ

type TxnQ[T any] struct {
	// contains filtered or unexported fields
}

func NewTxnQ

func NewTxnQ[T any](capacity int) (*TxnQ[T], error)

NewTxnQ creates a new transaction queue with the given capacity

func (*TxnQ[T]) Cancel

func (q *TxnQ[T]) Cancel()

Cancel closes the underlying Q without waiting for workers to drain the Q

func (*TxnQ[T]) Close

func (q *TxnQ[T]) Close()

Close closes the underlying Q but waits for workers to drain the Q

func (*TxnQ[T]) Enqueue

func (q *TxnQ[T]) Enqueue(data *T)

Enqueue pushes data to Q, if Q is full it blocks until a worker pops a data from Q

func (*TxnQ[T]) StartWorker

func (q *TxnQ[T]) StartWorker(worker func(*T))

StartWorker attaches the given function as a consumer of the TxnQ. Whenever a new data present on the Q this function, with data as function parameter, runs. Multiple workers which consume the same Q, can be started by calling this function.

func (*TxnQ[T]) TryEnqueue

func (q *TxnQ[T]) TryEnqueue(txnData *T) bool

TryEnqueue tries to push data to Q, if Q is full it returns false, otherwise true

type TxnReq

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

func (*TxnReq) Expired

func (req *TxnReq) Expired() bool

Expired returns true if transaction request time plus account.timeoutSeconds is greater than the current time, otherwise false

func (*TxnReq) Hash

func (req *TxnReq) Hash() string

func (*TxnReq) Respond

func (req *TxnReq) Respond(resp interface{}, err error)

func (*TxnReq) RespondWithStatus

func (req *TxnReq) RespondWithStatus(status txnStatus)

type TxnResp

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

func (*TxnResp) Get

func (resp *TxnResp) Get() (interface{}, error)

Get is a blocking call which waits for transaction response with timeout. It returns the transaction response or error. Successive Get calls on same TxnResp returns same result which was received at first call

func (*TxnResp) Notify

func (resp *TxnResp) Notify()

func (*TxnResp) Set

func (resp *TxnResp) Set(txnResp *txnResp)

func (*TxnResp) SetWithStatus

func (resp *TxnResp) SetWithStatus(status txnStatus)

Jump to

Keyboard shortcuts

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