Documentation ¶
Index ¶
- Constants
- func GetAddressOrMetachainAddr(address string) []byte
- func GetBigIntBytesFromStr(val string) ([]byte, error)
- func GetBigIntBytesSliceFromStringSlice(in []string) ([][]byte, error)
- func GetBytes(val *big.Int) []byte
- func MetaChainShardAddress() []byte
- func StringSliceToByteSlice(in []string) [][]byte
- func UInt32SliceToInt32Slice(in []uint32) []int32
- func UIntSliceToIntSlice(in []uint64) []int64
- type AvroMarshaller
Constants ¶
const MetachainShardName = "metachain"
MetachainShardName is the string identifier of the metachain shard
Variables ¶
This section is empty.
Functions ¶
func GetAddressOrMetachainAddr ¶
GetAddressOrMetachainAddr checks if the corresponding address is metachain. This func should only be used for sender addresses. If so, it returns a 62 byte array address(by padding with zeros), otherwise converts the address string to byte slice.
func GetBigIntBytesFromStr ¶
GetBigIntBytesFromStr returns the big int bytes representation of a string input if not empty, otherwise returns []byte{}
func GetBigIntBytesSliceFromStringSlice ¶
GetBigIntBytesSliceFromStringSlice converts the input string slice in a big int byte array slice
func GetBytes ¶
GetBytes returns the bytes representation of a big int input if not nil, otherwise returns []byte{}
func MetaChainShardAddress ¶
func MetaChainShardAddress() []byte
MetaChainShardAddress returns core.MetachainShardId as a 62 byte array address(by padding with zeros). This is needed, since all addresses from avro schema are required to be 62 fixed byte array
func StringSliceToByteSlice ¶
StringSliceToByteSlice converts the input string slice to a byte slice
func UInt32SliceToInt32Slice ¶
UInt32SliceToInt32Slice outputs the int32 slice representation of a uint32 slice input
func UIntSliceToIntSlice ¶
UIntSliceToIntSlice outputs the int64 slice representation of a uint64 slice input
Types ¶
type AvroMarshaller ¶
type AvroMarshaller struct { }
AvroMarshaller can marshall/unmarshall avro records
func (*AvroMarshaller) Decode ¶
func (av *AvroMarshaller) Decode(record avro.AvroRecord, buffer []byte) error
Decode tries to decode a data buffer, read it and store it on the input record. If successfully, the record is filled with data from the buffer, otherwise an error might be returned
func (*AvroMarshaller) Encode ¶
func (av *AvroMarshaller) Encode(record avro.AvroRecord) ([]byte, error)
Encode returns a byte slice representing the binary encoding of the input avro record