Documentation
¶
Overview ¶
Package client implements "samavm" client SDK.
Index ¶
- Variables
- func PPActivity(a []*chain.Activity) error
- func SignIssueRawTx(ctx context.Context, cli Client, utx chain.UnsignedTransaction, ...) (txID ids.ID, cost uint64, err error)
- func SignIssueTx(ctx context.Context, cli Client, input *chain.Input, priv *ecdsa.PrivateKey, ...) (txID ids.ID, cost uint64, err error)
- type Client
- type Op
- type OpOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIntegrityFailure = errors.New("received file that does not match hash")
Functions ¶
func PPActivity ¶
func PPActivity(a []*chain.Activity) error
func SignIssueRawTx ¶
func SignIssueRawTx(
ctx context.Context,
cli Client,
utx chain.UnsignedTransaction,
priv *ecdsa.PrivateKey,
opts ...OpOption,
) (txID ids.ID, cost uint64, err error)
Signs and issues the transaction (local construction).
func SignIssueTx ¶
func SignIssueTx(
ctx context.Context,
cli Client,
input *chain.Input,
priv *ecdsa.PrivateKey,
opts ...OpOption,
) (txID ids.ID, cost uint64, err error)
Signs and issues the transaction (node construction).
Types ¶
type Client ¶
type Client interface {
// Pings the VM.
Ping(ctx context.Context) (bool, error)
// Network information about this instance of the VM
Network(ctx context.Context) (uint32, ids.ID, ids.ID, error)
// Returns the VM genesis.
Genesis(ctx context.Context) (*chain.Genesis, error)
// Accepted fetches the ID of the last accepted block.
Accepted(ctx context.Context) (ids.ID, error)
// Balance returns the balance of an account
Balance(ctx context.Context, addr common.Address) (bal uint64, err error)
// Resolve returns the value associated with a path
Resolve(ctx context.Context, key common.Hash) (exists bool, value []byte, valueMeta *chain.ValueMeta, err error)
// Requests the suggested price and cost from VM.
SuggestedRawFee(ctx context.Context) (uint64, uint64, error)
// Issues the transaction and returns the transaction ID.
IssueRawTx(ctx context.Context, d []byte) (ids.ID, error)
// Requests the suggested price and cost from VM, returns the input as
// TypedData.
SuggestedFee(ctx context.Context, i *chain.Input) (*tdata.TypedData, uint64, error)
// Issues a human-readable transaction and returns the transaction ID.
IssueTx(ctx context.Context, td *tdata.TypedData, sig []byte) (ids.ID, error)
// Checks the status of the transaction, and returns "true" if confirmed.
HasTx(ctx context.Context, id ids.ID) (bool, error)
// Polls the transactions until its status is confirmed.
PollTx(ctx context.Context, txID ids.ID) (confirmed bool, err error)
// Recent actions on the network (sorted from recent to oldest)
RecentActivity(ctx context.Context) ([]*chain.Activity, error)
CalcReward(ctx context.Context, stakerType uint64, endTime uint64, address common.Address) (uint64, uint64, uint64, error)
GetUserFee(ctx context.Context, userType uint64, startTime uint64, endTime uint64) (uint64, error)
GetStakerType(ctx context.Context, address common.Address) (uint64, error)
GetChainCreateTime(ctx context.Context) (uint64, error)
GetNodes(ctx context.Context, address common.Address) (vm.APINode, error)
CreateShortID(ctx context.Context) (ids.ShortID, error)
ImportKey(ctx context.Context, userName string, userPass string, privateKey string) error
GetLocalParams(ctx context.Context, address common.Address) (*vm.LocalParams, error)
}
Client defines samavm client operations.
Click to show internal directories.
Click to hide internal directories.