near

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const BmcContractMessageStateKey = "bWVzc2FnZQ=="

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func (*Client) Api

func (c *Client) Api() IApi

func (*Client) CloseMonitor

func (c *Client) CloseMonitor()

func (*Client) GetBalance

func (c *Client) GetBalance(accountId types.AccountId) (balance *big.Int, err error)

func (*Client) GetBlock

func (c *Client) GetBlock(param interface{}) (types.Block, error)

func (*Client) GetBlockByHash

func (c *Client) GetBlockByHash(blockHash types.CryptoHash) (types.Block, error)

func (*Client) GetBlockByHeight

func (c *Client) GetBlockByHeight(height int64) (types.Block, error)

func (*Client) GetBmcLinkStatus

func (c *Client) GetBmcLinkStatus(destination, source chain.BTPAddress) (*chain.BMCLinkStatus, error)

func (*Client) GetChainStatus

func (c *Client) GetChainStatus() (types.ChainStatus, error)

func (*Client) GetLatestBlockHash

func (c *Client) GetLatestBlockHash() (types.CryptoHash, error)

func (*Client) GetLatestBlockHeight

func (c *Client) GetLatestBlockHeight() (int64, error)

func (*Client) GetNonce

func (c *Client) GetNonce(publicKey types.PublicKey, accountId string) (int64, error)

func (*Client) GetReceipts

func (c *Client) GetReceipts(block *types.Block, accountId string) ([]*chain.Receipt, error)

func (*Client) GetTransactionResult

func (c *Client) GetTransactionResult(transactionId types.CryptoHash, senderId types.AccountId) (types.TransactionResult, error)

func (*Client) IsMonitorClosed

func (c *Client) IsMonitorClosed() bool

func (*Client) Logger

func (c *Client) Logger() log.Logger

func (*Client) MonitorBlockHeight

func (c *Client) MonitorBlockHeight(offset int64) rxgo.Observable

func (*Client) MonitorBlocks

func (c *Client) MonitorBlocks(height uint64, source string, concurrency uint, callback func(rxgo.Observable) error, subClient func() IClient) error

func (*Client) SendTransaction

func (c *Client) SendTransaction(payload string) (*types.CryptoHash, error)

type IApi

type IApi interface {
	Block(param interface{}) (response types.Block, err error)
	BroadcastTxCommit(param interface{}) (response types.TransactionResult, err error)
	BroadcastTxAsync(param interface{}) (response types.CryptoHash, err error)
	CallFunction(param interface{}) (response types.CallFunctionResponse, err error)
	Changes(param interface{}) (response types.ContractStateChange, err error)
	Chunk(param interface{}) (response types.ChunkHeader, err error)
	LightClientProof(param interface{}) (response types.ReceiptProof, err error)
	Status(param interface{}) (response types.ChainStatus, err error)
	Transaction(param interface{}) (response types.TransactionResult, err error)
	ViewAccessKey(param interface{}) (response types.AccessKeyResponse, err error)
	ViewAccount(param interface{}) (response types.Account, err error)
}

type IClient

type IClient interface {
	Api() IApi
	CloseMonitor()
	GetBalance(types.AccountId) (*big.Int, error)
	GetBlockByHash(types.CryptoHash) (types.Block, error)
	GetBlockByHeight(int64) (types.Block, error)
	GetBmcLinkStatus(destination, source chain.BTPAddress) (*chain.BMCLinkStatus, error)
	GetLatestBlockHash() (types.CryptoHash, error)
	GetNonce(publicKey types.PublicKey, accountId string) (int64, error)
	GetTransactionResult(types.CryptoHash, types.AccountId) (types.TransactionResult, error)
	GetReceipts(block *types.Block, accountId string) ([]*chain.Receipt, error)
	Logger() log.Logger
	MonitorBlocks(height uint64, source string, concurrency uint, callback func(rxgo.Observable) error, subClient func() IClient) error
	SendTransaction(payload string) (*types.CryptoHash, error)
	GetLatestBlockHeight() (int64, error)
	MonitorBlockHeight(offset int64) rxgo.Observable
	IsMonitorClosed() bool
}

func NewClient

func NewClient(endpoint string, logger log.Logger) (IClient, error)

type Receiver

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

func NewReceiver

func NewReceiver(config ReceiverConfig, logger log.Logger, clients ...IClient) (*Receiver, error)

func (*Receiver) ReceiveBlocks

func (r *Receiver) ReceiveBlocks(height uint64, source string, processBlockNotification func(blockNotification *types.BlockNotification)) error

func (*Receiver) StopReceivingBlocks

func (r *Receiver) StopReceivingBlocks()

func (*Receiver) Subscribe

func (r *Receiver) Subscribe(ctx context.Context, msgCh chan<- *chain.Message, opts chain.SubscribeOptions) (errCh <-chan error, err error)

type ReceiverConfig

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

type RelayTransaction

type RelayTransaction struct {
	Transaction types.Transaction
	// contains filtered or unexported fields
}

func NewRelayTransaction

func NewRelayTransaction(context context.Context, wallet *wallet.NearWallet, destination string, client IClient, actions []types.Action) *RelayTransaction

func (*RelayTransaction) ID

func (relayTx *RelayTransaction) ID() interface{}

func (*RelayTransaction) Receipt

func (relayTx *RelayTransaction) Receipt(ctx context.Context) (blockHeight uint64, err error)

func (*RelayTransaction) Send

func (relayTx *RelayTransaction) Send(ctx context.Context) (err error)

type Sender

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

func NewSender

func NewSender(config SenderConfig, logger log.Logger, clients ...IClient) (*Sender, error)

func (*Sender) Balance

func (s *Sender) Balance(ctx context.Context) (balance, threshold *big.Int, err error)

func (*Sender) Segment

func (s *Sender) Segment(ctx context.Context, msg *chain.Message) (tx chain.RelayTx, newMsg *chain.Message, err error)

func (*Sender) Status

func (s *Sender) Status(ctx context.Context) (*chain.BMCLinkStatus, error)

type SenderConfig

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

type Wallet

type Wallet interface {
	Address() string
	Sign(data []byte) ([]byte, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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