extrinsic

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2020 ChainSafe Systems (ON) Corp. This file is part of gossamer.

The gossamer library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The gossamer library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the gossamer library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	AuthoritiesChangeType = 0
	TransferType          = 1
	IncludeDataType       = 2
	StorageChangeType     = 3
)

nolint

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthoritiesChangeExt

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

AuthoritiesChangeExt represents an Extrinsic::AuthoritiesChange

func NewAuthoritiesChangeExt

func NewAuthoritiesChangeExt(authorityIDs [][32]byte) *AuthoritiesChangeExt

NewAuthoritiesChangeExt returns an AuthoritiesChangeExt

func (*AuthoritiesChangeExt) Decode

func (e *AuthoritiesChangeExt) Decode(r io.Reader) error

Decode decodes the SCALE encoding into a AuthoritiesChangeExt

func (*AuthoritiesChangeExt) Encode

func (e *AuthoritiesChangeExt) Encode() ([]byte, error)

Encode returns the SCALE encoding of the AuthoritiesChangeExt

func (*AuthoritiesChangeExt) Type

func (e *AuthoritiesChangeExt) Type() int

Type returns AuthoritiesChangeType

type Extrinsic

type Extrinsic interface {
	Type() int
	Encode() ([]byte, error)
	Decode(r io.Reader) error
}

Extrinsic represents a runtime Extrinsic

func DecodeExtrinsic

func DecodeExtrinsic(r io.Reader) (Extrinsic, error)

DecodeExtrinsic decodes an Extrinsic from a Reader

type Function added in v0.2.0

type Function struct {
	Pall         Pallet
	PallFunc     PalletFunction
	FuncCallData interface{}
}

Function struct to represent extrinsic call function

func (*Function) Encode added in v0.2.0

func (f *Function) Encode() ([]byte, error)

Encode scale encode the UncheckedExtrinsic

type IncludeDataExt

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

IncludeDataExt represents an Extrinsic::IncludeData

func NewIncludeDataExt

func NewIncludeDataExt(data []byte) *IncludeDataExt

NewIncludeDataExt returns a IncludeDataExt

func (*IncludeDataExt) Decode

func (e *IncludeDataExt) Decode(r io.Reader) error

Decode decodes the SCALE encoding into a IncludeDataExt

func (*IncludeDataExt) Encode

func (e *IncludeDataExt) Encode() ([]byte, error)

Encode returns the SCALE encoding of the IncludeDataExt

func (*IncludeDataExt) Type

func (e *IncludeDataExt) Type() int

Type returns IncludeDataType

type Pallet added in v0.2.0

type Pallet byte

Pallet index for module extrinsic is calling

const (
	System Pallet = iota
	Utility
	Babe
	Timestamp
	Authorship
	Indices
	Balances
	Staking
	Session
)

consts for node_runtime Pallets

type PalletFunction added in v0.2.0

type PalletFunction byte

PalletFunction for function index within pallet

const (
	PB_Transfer PalletFunction = iota
	PB_Set_balance
	PB_Force_transfer
	PB_Transfer_keep_alive
)

pallet_balances function index

const (
	SYS_fill_block PalletFunction = iota
	SYS_remark
	SYS_set_heap_pages
	SYS_set_code
	SYS_set_storage
	SYS_kill_storage
	SYS_kill_prefix
)

pallet_system function index

const (
	SESS_set_keys PalletFunction = iota
)

session function index

type Signature added in v0.2.0

type Signature struct {
	Address []byte
	Sig     []byte
	Extra   []byte
}

Signature struct to represent signature parts

func (*Signature) Encode added in v0.2.0

func (s *Signature) Encode() ([]byte, error)

Encode to encode Signature type

type StorageChangeExt

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

StorageChangeExt represents an Extrinsic::StorageChange

func NewStorageChangeExt

func NewStorageChangeExt(key []byte, value *optional.Bytes) *StorageChangeExt

NewStorageChangeExt returns a StorageChangesExt

func (*StorageChangeExt) Decode

func (e *StorageChangeExt) Decode(r io.Reader) error

Decode decodes the SCALE encoding into a StorageChangeExt

func (*StorageChangeExt) Encode

func (e *StorageChangeExt) Encode() ([]byte, error)

Encode returns the SCALE encoding of the StorageChangeExt

func (*StorageChangeExt) Key

func (e *StorageChangeExt) Key() []byte

Key returns the extrinsic's key

func (*StorageChangeExt) Type

func (e *StorageChangeExt) Type() int

Type returns StorageChangeType

func (*StorageChangeExt) Value

func (e *StorageChangeExt) Value() *optional.Bytes

Value returns the extrinsic's value

type Transfer

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

Transfer represents a runtime Transfer

func NewTransfer

func NewTransfer(from, to [32]byte, amount, nonce uint64) *Transfer

NewTransfer returns a Transfer

func (*Transfer) AsSignedExtrinsic

func (t *Transfer) AsSignedExtrinsic(key *sr25519.PrivateKey) (*TransferExt, error)

AsSignedExtrinsic returns a TransferExt that includes the transfer and a signature.

func (*Transfer) Decode

func (t *Transfer) Decode(r io.Reader) (err error)

Decode decodes the SCALE encoding into a Transfer

func (*Transfer) Encode

func (t *Transfer) Encode() ([]byte, error)

Encode returns the SCALE encoding of the Transfer

type TransferExt

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

TransferExt represents an Extrinsic::Transfer

func NewTransferExt

func NewTransferExt(transfer *Transfer, signature [sr25519.SignatureLength]byte) *TransferExt

NewTransferExt returns a TransferExt

func (*TransferExt) Decode

func (e *TransferExt) Decode(r io.Reader) error

Decode decodes the SCALE encoding into a TransferExt

func (*TransferExt) Encode

func (e *TransferExt) Encode() ([]byte, error)

Encode returns the SCALE encoding of the TransferExt

func (*TransferExt) Type

func (e *TransferExt) Type() int

Type returns TransferType

type UncheckedExtrinsic added in v0.2.0

type UncheckedExtrinsic struct {
	Signature Signature
	Function  Function
}

UncheckedExtrinsic generic implementation of pre-verification extrinsic

func CreateUncheckedExtrinsic added in v0.2.0

func CreateUncheckedExtrinsic(fnc *Function, index *big.Int, signer crypto.Keypair, additional interface{}) (*UncheckedExtrinsic, error)

CreateUncheckedExtrinsic builds UncheckedExtrinsic given function interface, index, genesisHash and Keypair

func CreateUncheckedExtrinsicUnsigned added in v0.2.0

func CreateUncheckedExtrinsicUnsigned(fnc *Function) (*UncheckedExtrinsic, error)

CreateUncheckedExtrinsicUnsigned to build unsigned extrinsic

func (*UncheckedExtrinsic) Encode added in v0.2.0

func (ux *UncheckedExtrinsic) Encode() ([]byte, error)

Encode scale encode UncheckedExtrinsic

Jump to

Keyboard shortcuts

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