Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeAccountIDToSS58(account AccountID) (string, error)
- func GetDefaultSS58Prefix() []byte
- func NewCompactBalance(amount uint64) types.UCompact
- func NewCompactBalanceByInt(amount *big.Int) types.UCompact
- func NewCompactGas(gas Gas) types.UCompact
- func SetDefaultSS58Prefix(p []byte)
- type AccountID
- type AccountInfo
- type Address
- type Balance
- type Bytes
- type ChainStatus
- type CodeHash
- type CompactBalance
- type CompactGas
- type Extrinsic
- type ExtrinsicEra
- type Gas
- type Hash
- type Metadata
- type Option
- type OptionAccountID
- func (o *OptionAccountID) Decode(decoder scale.Decoder) error
- func (o OptionAccountID) Encode(encoder scale.Encoder) error
- func (o *OptionAccountID) SetNone()
- func (o *OptionAccountID) SetSome(value AccountID)
- func (o OptionAccountID) String() string
- func (o OptionAccountID) Unwrap() (ok bool, value AccountID)
- type OptionValue
- type SS58Codec
- type Schedule
- type SignatureOptions
- type U128
- type U32
- type U64
- type UCompact
Constants ¶
const (
ExtrinsicVersion4 = types.ExtrinsicVersion4
)
Variables ¶
var ( NewBool = types.NewBool NewU8 = types.NewU8 NewU16 = types.NewU16 NewU32 = types.NewU32 NewU64 = types.NewU64 NewU128 = types.NewU128 NewI8 = types.NewI8 NewI16 = types.NewI16 NewI32 = types.NewI32 NewI64 = types.NewI64 NewI128 = types.NewI128 )
var ( // NewHash creates a new Hash type NewHash = types.NewHash // NewHashFromHexString creates a new Hash type from a hex string NewHashFromHexString = types.NewHashFromHexString )
var ( // NewAddressFromHexAccountID creates an Address from the given hex string that contains an AccountID (public key) NewAddressFromHexAccountID = types.NewAddressFromHexAccountID // NewAddressFromAccountID creates an Address from the given AccountID (public key) NewAddressFromAccountID = types.NewAddressFromAccountID )
var ( // CreateStorageKey uses the given metadata and to derive the right hashing of method, prefix as well as arguments to // create a hashed StorageKey CreateStorageKey = types.CreateStorageKey // HexDecodeString decodes bytes from a hex string. Contrary to hex.DecodeString, this function does not error if "0x" // is prefixed, and adds an extra 0 if the hex string has an odd length. HexDecodeString = types.HexDecodeString // MustHexDecodeString panics if str cannot be decoded MustHexDecodeString = types.MustHexDecodeString // HexEncodeToString HexEncode encodes bytes to a hex string. // Contrary to hex.EncodeToString, this function prefixes the hex string with "0x" HexEncodeToString = types.HexEncodeToString )
var ( NewExtrinsic = types.NewExtrinsic NewCall = types.NewCall )
var (
EncodeToBytes = types.EncodeToBytes
)
var ( // NewAccountID creates a new AccountID type NewAccountID = types.NewAccountID )
var ( // NewUCompactFromUInt create a compact big int from uint64 NewUCompactFromUInt = types.NewUCompactFromUInt )
Functions ¶
func EncodeAccountIDToSS58 ¶
EncodeAccountIDToSS58 encode accountID to ss58 format
func GetDefaultSS58Prefix ¶ added in v0.2.0
func GetDefaultSS58Prefix() []byte
GetDefaultSS58Prefix get default ss58 prefix
func NewCompactBalance ¶
NewCompactBalance create a new CompactBalance
func NewCompactBalanceByInt ¶
NewCompactBalanceByInt create a new CompactBalance
func NewCompactGas ¶
NewCompactGas creates a new compact of gas
func SetDefaultSS58Prefix ¶ added in v0.2.0
func SetDefaultSS58Prefix(p []byte)
SetDefaultSS58Prefix set default ss58 prefix
Types ¶
type AccountID ¶
AccountID represents a public key (an 32 byte array)
func DecodeAccountIDFromSS58 ¶
DecodeAccountIDFromSS58 encode address SS58 to AccountID
type AccountInfo ¶
type AccountInfo = types.AccountInfo
type Address ¶
Address is a wrapper around an AccountId or an AccountIndex. It is encoded with a prefix in case of an AccountID. Basically the Address is encoded as `[ <prefix-byte>, ...publicKey/...bytes ]` as per spec
func MustAddressFromHexAccount ¶
MustAddressFromHexAccount address from hex account, panic if invalid
type Bytes ¶ added in v0.2.0
Bytes represents byte slices. Bytes has a variable length, it is encoded with a scale prefix
type ChainStatus ¶
type ExtrinsicEra ¶
type ExtrinsicEra = types.ExtrinsicEra
type Hash ¶
Hash is the default hash that is used across the system. It is just a thin wrapper around H256
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
func (*Option) SetHasValue ¶
type OptionAccountID ¶
OptionAccountID is a structure that can store a AccountID or a missing value
func NewOptionAccountID ¶
func NewOptionAccountID(value AccountID) OptionAccountID
NewOptionAccountID creates an OptionAccountID with a value
func NewOptionAccountIDEmpty ¶
func NewOptionAccountIDEmpty() OptionAccountID
NewOptionAccountIDEmpty creates an OptionAccountID without a value
func (*OptionAccountID) SetNone ¶
func (o *OptionAccountID) SetNone()
SetNone removes a value and marks it as missing
func (*OptionAccountID) SetSome ¶
func (o *OptionAccountID) SetSome(value AccountID)
SetSome sets a value
func (OptionAccountID) String ¶
func (o OptionAccountID) String() string
func (OptionAccountID) Unwrap ¶
func (o OptionAccountID) Unwrap() (ok bool, value AccountID)
Unwrap returns a flag that indicates whether a value is present and the stored value
type OptionValue ¶
type OptionValue struct { Option // contains filtered or unexported fields }
OptionValue is a structure that can store a Value or a missing value
func NewOptionValue ¶
func NewOptionValue(value interface{}) OptionValue
NewOptionValue creates an OptionValue with a value
func NewOptionValueEmpty ¶
func NewOptionValueEmpty() OptionValue
NewOptionValueEmpty creates an OptionValue without a value
func (*OptionValue) SetNone ¶
func (o *OptionValue) SetNone()
SetNone removes a value and marks it as missing
func (OptionValue) Unwrap ¶
func (o OptionValue) Unwrap() (ok bool, value interface{})
Unwrap returns a flag that indicates whether a value is present and the stored value
type SS58Codec ¶ added in v0.2.0
type SS58Codec struct {
// contains filtered or unexported fields
}
func GetDefaultSS58Codec ¶ added in v0.2.0
func GetDefaultSS58Codec() *SS58Codec
GetDefaultSS58Codec get default ss58 codec
func NewSS58Codec ¶ added in v0.2.0
func (SS58Codec) DecodeAccountID ¶ added in v0.2.0
DecodeAccountID decode address SS58 to AccountID
func (SS58Codec) EncodeAccountID ¶ added in v0.2.0
type Schedule ¶
type Schedule struct { // Version of the schedule. Version uint32 `scale:"version"` // PutCodePerByteCost Cost of putting a byte of code into storage. PutCodePerByteCost Gas `scale:"put_code_per_byte_cost"` // GrowMemCost Gas cost of a growing memory by single page. GrowMemCost Gas `scale:"grow_mem_cost"` // RegularOpCost Gas cost of a regular operation. RegularOpCost Gas `scale:"regular_op_cost"` // ReturnDataPerByteCost Gas cost per one byte returned. ReturnDataPerByteCost Gas `scale:"return_data_per_byte_cost"` // EventDataPerByteCost Gas cost to deposit an event; the per-byte portion. EventDataPerByteCost Gas `scale:"event_data_per_byte_cost"` // EventPerTopicCost Gas cost to deposit an event; the cost per topic. EventPerTopicCost Gas `scale:"event_per_topic_cost"` // EventBaseCost Gas cost to deposit an event; the base. EventBaseCost Gas `scale:"event_base_cost"` // CallBaseCost Base gas cost to call into a contract. CallBaseCost Gas `scale:"call_base_cost"` // InstantiateBaseCost Base gas cost to instantiate a contract. InstantiateBaseCost Gas `scale:"instantiate_base_cost"` // DispatchBaseCost Base gas cost to dispatch a runtime call. DispatchBaseCost Gas `scale:"dispatch_base_cost"` // SandboxDataReadCost Gas cost per one byte read from the sandbox memory. SandboxDataReadCost Gas `scale:"sandbox_data_read_cost"` // SandboxDataWriteCost Gas cost per one byte written to the sandbox memory. SandboxDataWriteCost Gas `scale:"sandbox_data_write_cost"` // TransferCost Cost for a simple balance transfer. TransferCost Gas `scale:"transfer_cost"` // InstantiateCost Cost for instantiating a new contract. InstantiateCost Gas `scale:"instantiate_cost"` // MaxEventTopics The maximum number of topics supported by an event. MaxEventTopics uint32 `scale:"max_event_topics"` // MaxStackHeight Maximum allowed stack height. // // See https://wiki.parity.io/WebAssembly-StackHeight to find out // how the stack frame cost is calculated. MaxStackHeight uint32 `scale:"max_stack_height"` // MaxMemoryPages Maximum number of memory pages allowed for a contract. MaxMemoryPages uint32 `scale:"max_memory_pages"` // MaxTableSize Maximum allowed size of a declared table. MaxTableSize uint32 `scale:"max_table_size"` // EnablePrintln Whether the `seal_println` function is allowed to be used contracts. // MUST only be enabled for `dev` chains, NOT for production chains EnablePrintln bool `scale:"enable_println"` // MaxSubjectLen The maximum length of a subject used for PRNG generation. MaxSubjectLen uint32 `scale:"max_subject_len"` // MaxCodeSize The maximum length of a contract code in bytes. This limit applies to the uninstrumented // and pristine form of the code as supplied to `put_code`. MaxCodeSize uint32 `scale:"max_code_size"` }
Schedule Definition of the cost schedule and other parameterizations for wasm vm.
type SignatureOptions ¶
type SignatureOptions = types.SignatureOptions
type U128 ¶
U128 is an unsigned 128-bit integer, it is represented as a big.Int in Go.
func NewBalanceByU64 ¶
NewBalanceByU64 new balance from uint64