client

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when backend responded with 404 status code.
	ErrNotFound = errors.New("not found")
)

Functions

func WeiToAlpha

func WeiToAlpha(wei *big.Int) uint64

WeiToAlpha - converts from alpha to wei, assuming 1:1 exchange 1 "alpha" is equal to "1 eth". 1 wei = wei * 10^10 / 10^18

Types

type CallAttributes

type CallAttributes struct {
	From  []byte
	To    []byte
	Data  []byte
	Value *big.Int
	Gas   uint64
	// contains filtered or unexported fields
}

type EvmClient

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

func New

func New(abAddr url.URL) *EvmClient

New creates REST API client for token wallet backend. The "abAddr" is address of the backend, Scheme and Host fields must be assigned.

func (*EvmClient) Call

func (e *EvmClient) Call(ctx context.Context, callAttr *CallAttributes) (*ProcessingDetails, error)

Call execute smart contract tx without storing the result in blockchain. Can be used to simulate tx or to read state.

func (*EvmClient) GetBalance

func (e *EvmClient) GetBalance(ctx context.Context, ethAddr []byte) (string, []byte, error)

GetBalance - reads account balance

func (*EvmClient) GetFeeCreditBill

func (e *EvmClient) GetFeeCreditBill(ctx context.Context, unitID types.UnitID) (*sdk.Bill, error)

GetFeeCreditBill - simulates fee credit bill on EVM

func (*EvmClient) GetGasPrice

func (e *EvmClient) GetGasPrice(ctx context.Context) (string, error)

GetGasPrice returns gas price

func (*EvmClient) GetRoundNumber

func (e *EvmClient) GetRoundNumber(ctx context.Context) (*sdk.RoundNumber, error)

GetRoundNumber returns node round number

func (*EvmClient) GetTransactionCount

func (e *EvmClient) GetTransactionCount(ctx context.Context, ethAddr []byte) (uint64, error)

GetTransactionCount reads account nonce

func (*EvmClient) GetTxProof

func (e *EvmClient) GetTxProof(ctx context.Context, _ types.UnitID, txHash sdk.TxHash) (*sdk.Proof, error)

GetTxProof - get transaction proof for tx hash. NB! node must be configured to run with indexer.

func (*EvmClient) PostTransaction

func (e *EvmClient) PostTransaction(ctx context.Context, tx *types.TransactionOrder) error

PostTransaction post node transaction

type ProcessingDetails

type ProcessingDetails struct {
	ErrorDetails string
	ReturnData   []byte
	ContractAddr common.Address
	Logs         []*statedb.LogEntry
	// contains filtered or unexported fields
}

type Result

type Result struct {
	Success   bool
	ActualFee uint64
	Details   *ProcessingDetails
}

type TxAttributes

type TxAttributes struct {
	From  []byte
	To    []byte
	Data  []byte
	Value *big.Int
	Gas   uint64
	Nonce uint64
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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