client

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 29 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ChainTypeStafi    = "stafi"
	ChainTypePolkadot = "polkadot"

	AddressTypeAccountId    = "AccountId"
	AddressTypeMultiAddress = "MultiAddress"
)

Variables

View Source
var (
	ErrorTerminated           = errors.New("terminated")
	ErrorBondEqualToUnbond    = errors.New("ErrorBondEqualToUnbond")
	ErrorDiffSmallerThanLeast = errors.New("ErrorDiffSmallerThanLeast")
)

Functions

func OpaqueCall added in v1.3.0

func OpaqueCall(ext interface{}) (*submodel.MultiOpaqueCall, error)

func TransformHasher added in v1.3.0

func TransformHasher(Hasher string) types.StorageHasherV10

Types

type ChainExtrinsic added in v1.3.0

type ChainExtrinsic struct {
	ID                 uint            `gorm:"primary_key"`
	ExtrinsicIndex     string          `json:"extrinsic_index" sql:"default: null;size:100"`
	BlockNum           int             `json:"block_num" `
	BlockTimestamp     int             `json:"block_timestamp"`
	ExtrinsicLength    string          `json:"extrinsic_length"`
	VersionInfo        string          `json:"version_info"`
	CallCode           string          `json:"call_code"`
	CallModuleFunction string          `json:"call_module_function"  sql:"size:100"`
	CallModule         string          `json:"call_module"  sql:"size:100"`
	Params             interface{}     `json:"params" sql:"type:MEDIUMTEXT;" `
	AccountId          string          `json:"account_id"`
	Signature          string          `json:"signature"`
	Nonce              int             `json:"nonce"`
	Era                string          `json:"era"`
	ExtrinsicHash      string          `json:"extrinsic_hash" sql:"default: null" `
	IsSigned           bool            `json:"is_signed"`
	Success            bool            `json:"success"`
	Fee                decimal.Decimal `json:"fee" sql:"type:decimal(30,0);"`
	BatchIndex         int             `json:"-" gorm:"-"`
}

type GsrpcClient added in v1.3.0

type GsrpcClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewGsrpcClient added in v1.3.0

func NewGsrpcClient(chainType, endpoint, typesPath, addressType string, key *signature.KeyringPair, log Logger, stop <-chan int) (*GsrpcClient, error)

func (*GsrpcClient) AccountInfo added in v1.3.0

func (sc *GsrpcClient) AccountInfo(who []byte) (*types.AccountInfo, error)

func (*GsrpcClient) Address added in v1.3.0

func (sc *GsrpcClient) Address() string

func (*GsrpcClient) BatchTransfer added in v1.3.0

func (sc *GsrpcClient) BatchTransfer(receives []*submodel.Receive) error

func (*GsrpcClient) BondOrUnbondCall added in v1.3.0

func (sc *GsrpcClient) BondOrUnbondCall(bond, unbond *big.Int) (*submodel.MultiOpaqueCall, error)

func (*GsrpcClient) ExistentialDeposit added in v1.3.0

func (sc *GsrpcClient) ExistentialDeposit() (types.U128, error)

func (*GsrpcClient) FindCallIndex added in v1.3.0

func (sc *GsrpcClient) FindCallIndex(call string) (types.CallIndex, error)

func (*GsrpcClient) FindStorageEntryMetadata added in v1.3.0

func (sc *GsrpcClient) FindStorageEntryMetadata(module string, fn string) (types.StorageEntryMetadata, error)

func (*GsrpcClient) FlashApi added in v1.3.0

func (sc *GsrpcClient) FlashApi() (*gsrpc.RPCS, error)

func (*GsrpcClient) FreeBalance added in v1.3.0

func (sc *GsrpcClient) FreeBalance(who []byte) (types.U128, error)

func (*GsrpcClient) GetAccountInfo added in v1.3.0

func (sc *GsrpcClient) GetAccountInfo() (*types.AccountInfo, error)

func (*GsrpcClient) GetBlock added in v1.3.0

func (sc *GsrpcClient) GetBlock(blockHash string) (*rpc.Block, error)

func (*GsrpcClient) GetBlockHash added in v1.3.0

func (sc *GsrpcClient) GetBlockHash(blockNum uint64) (string, error)

func (*GsrpcClient) GetBlockNumber added in v1.3.0

func (sc *GsrpcClient) GetBlockNumber(blockHash types.Hash) (uint64, error)

func (*GsrpcClient) GetChainEvents added in v1.3.0

func (sc *GsrpcClient) GetChainEvents(blockHash string) ([]*submodel.ChainEvent, error)

func (*GsrpcClient) GetConst added in v1.3.0

func (sc *GsrpcClient) GetConst(prefix, name string, res interface{}) error

func (*GsrpcClient) GetEvents added in v1.3.0

func (sc *GsrpcClient) GetEvents(blockNum uint64) ([]*submodel.ChainEvent, error)

func (*GsrpcClient) GetExtrinsics added in v1.3.0

func (sc *GsrpcClient) GetExtrinsics(blockHash string) ([]*submodel.Transaction, error)

func (*GsrpcClient) GetFinalizedBlockNumber added in v1.3.0

func (sc *GsrpcClient) GetFinalizedBlockNumber() (uint64, error)

func (*GsrpcClient) GetFinalizedHead added in v1.3.0

func (sc *GsrpcClient) GetFinalizedHead() (types.Hash, error)

func (*GsrpcClient) GetHeader added in v1.3.0

func (sc *GsrpcClient) GetHeader(blockHash types.Hash) (*types.Header, error)

func (*GsrpcClient) GetHeaderLatest added in v1.3.0

func (sc *GsrpcClient) GetHeaderLatest() (*types.Header, error)

func (*GsrpcClient) GetLatestBlockNumber added in v1.3.0

func (sc *GsrpcClient) GetLatestBlockNumber() (uint64, error)

func (*GsrpcClient) GetLatestNonce added in v1.3.0

func (sc *GsrpcClient) GetLatestNonce() (types.U32, error)

func (*GsrpcClient) GetLatestRuntimeVersion added in v1.3.0

func (sc *GsrpcClient) GetLatestRuntimeVersion() (*types.RuntimeVersion, error)

func (*GsrpcClient) GetPaymentQueryInfo added in v1.3.0

func (sc *GsrpcClient) GetPaymentQueryInfo(encodedExtrinsic string) (paymentInfo *rpc.PaymentQueryInfo, err error)

func (*GsrpcClient) NewUnsignedExtrinsic added in v1.3.0

func (sc *GsrpcClient) NewUnsignedExtrinsic(callMethod string, args ...interface{}) (interface{}, error)

func (*GsrpcClient) NewVersionAccountInfo added in v1.3.0

func (sc *GsrpcClient) NewVersionAccountInfo(who []byte) (*submodel.AccountInfo, error)

func (*GsrpcClient) NominateCall added in v1.3.0

func (sc *GsrpcClient) NominateCall(validators []types.Bytes) (*submodel.MultiOpaqueCall, error)

func (*GsrpcClient) PublicKey added in v1.3.0

func (sc *GsrpcClient) PublicKey() []byte

func (*GsrpcClient) QueryStorage added in v1.3.0

func (sc *GsrpcClient) QueryStorage(prefix, method string, arg1, arg2 []byte, result interface{}) (bool, error)

queryStorage performs a storage lookup. Arguments may be nil, result must be a pointer.

func (*GsrpcClient) SignAndSubmitTx added in v1.3.0

func (sc *GsrpcClient) SignAndSubmitTx(ext interface{}) error

func (*GsrpcClient) SingleTransferTo added in v1.3.1

func (sc *GsrpcClient) SingleTransferTo(accountId []byte, value types.UCompact) error

func (*GsrpcClient) StakingLedger added in v1.3.0

func (sc *GsrpcClient) StakingLedger(ac types.AccountID) (*submodel.StakingLedger, error)

func (*GsrpcClient) TransferCall added in v1.3.0

func (sc *GsrpcClient) TransferCall(accountId []byte, value types.UCompact) (*submodel.MultiOpaqueCall, error)

func (*GsrpcClient) WithdrawCall added in v1.3.0

func (sc *GsrpcClient) WithdrawCall() (*submodel.MultiOpaqueCall, error)

type Logger added in v1.3.0

type Logger interface {
	// Log a message at the given level with context key/value pairs
	Trace(msg string, ctx ...interface{})
	Debug(msg string, ctx ...interface{})
	Info(msg string, ctx ...interface{})
	Warn(msg string, ctx ...interface{})
	Error(msg string, ctx ...interface{})
}

func NewLog added in v1.3.0

func NewLog(field ...interface{}) Logger

Jump to

Keyboard shortcuts

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