types

package
v0.45.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthMultisig        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMultisig          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupMultisig = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Address

type Address = occrypto.Address

type CompactBitArray

type CompactBitArray struct {
	ExtraBitsStored uint32 `protobuf:"varint,1,opt,name=extra_bits_stored,json=extraBitsStored,proto3" json:"extra_bits_stored,omitempty"`
	Elems           []byte `protobuf:"bytes,2,opt,name=elems,proto3" json:"elems,omitempty"`
}

CompactBitArray is an implementation of a space efficient bit array. This is used to ensure that the encoded data takes up a minimal amount of space after proto encoding. This is not thread safe, and is not intended for concurrent usage.

func CompactUnmarshal

func CompactUnmarshal(bz []byte) (*CompactBitArray, error)

CompactUnmarshal is a space efficient decoding for CompactBitArray. It is not amino compatible.

func NewCompactBitArray

func NewCompactBitArray(bits int) *CompactBitArray

NewCompactBitArray returns a new compact bit array. It returns nil if the number of bits is zero, or if there is any overflow in the arithmetic to encounter for the number of its elements: (bits+7)/8, or if the number of elements will be an unreasonably large number like > maxint32 aka >2**31.

func (*CompactBitArray) CompactMarshal

func (bA *CompactBitArray) CompactMarshal() []byte

CompactMarshal is a space efficient encoding for CompactBitArray. It is not amino compatible.

func (*CompactBitArray) Copy

func (bA *CompactBitArray) Copy() *CompactBitArray

Copy returns a copy of the provided bit array.

func (*CompactBitArray) Count

func (bA *CompactBitArray) Count() int

Count returns the number of bits in the bitarray

func (*CompactBitArray) Descriptor

func (*CompactBitArray) Descriptor() ([]byte, []int)

func (*CompactBitArray) GetElems

func (m *CompactBitArray) GetElems() []byte

func (*CompactBitArray) GetExtraBitsStored

func (m *CompactBitArray) GetExtraBitsStored() uint32

func (*CompactBitArray) GetIndex

func (bA *CompactBitArray) GetIndex(i int) bool

GetIndex returns the bit at index i within the bit array. The behavior is undefined if i >= bA.Count()

func (*CompactBitArray) Marshal

func (m *CompactBitArray) Marshal() (dAtA []byte, err error)

func (*CompactBitArray) MarshalJSON

func (bA *CompactBitArray) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface by marshaling bit array using a custom format: a string of '-' or 'x' where 'x' denotes the 1 bit.

func (*CompactBitArray) MarshalTo

func (m *CompactBitArray) MarshalTo(dAtA []byte) (int, error)

func (*CompactBitArray) MarshalToSizedBuffer

func (m *CompactBitArray) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CompactBitArray) NumTrueBitsBefore

func (bA *CompactBitArray) NumTrueBitsBefore(index int) int

NumTrueBitsBefore returns the number of bits set to true before the given index. e.g. if bA = _XX__XX, NumOfTrueBitsBefore(4) = 2, since there are two bits set to true before index 4.

func (*CompactBitArray) ProtoMessage

func (*CompactBitArray) ProtoMessage()

func (*CompactBitArray) Reset

func (m *CompactBitArray) Reset()

func (*CompactBitArray) SetIndex

func (bA *CompactBitArray) SetIndex(i int, v bool) bool

SetIndex sets the bit at index i within the bit array. The behavior is undefined if i >= bA.Count()

func (*CompactBitArray) Size

func (m *CompactBitArray) Size() (n int)

func (*CompactBitArray) String

func (bA *CompactBitArray) String() string

String returns a string representation of CompactBitArray: BA{<bit-string>}, where <bit-string> is a sequence of 'x' (1) and '_' (0). The <bit-string> includes spaces and newlines to help people. For a simple sequence of 'x' and '_' characters with no spaces or newlines, see the MarshalJSON() method. Example: "BA{_x_}" or "nil-BitArray" for nil.

func (*CompactBitArray) StringIndented

func (bA *CompactBitArray) StringIndented(indent string) string

StringIndented returns the same thing as String(), but applies the indent at every 10th bit, and twice at every 50th bit.

func (*CompactBitArray) Unmarshal

func (m *CompactBitArray) Unmarshal(dAtA []byte) error

func (*CompactBitArray) UnmarshalJSON

func (bA *CompactBitArray) UnmarshalJSON(bz []byte) error

UnmarshalJSON implements json.Unmarshaler interface by unmarshaling a custom JSON description.

func (*CompactBitArray) XXX_DiscardUnknown

func (m *CompactBitArray) XXX_DiscardUnknown()

func (*CompactBitArray) XXX_Marshal

func (m *CompactBitArray) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CompactBitArray) XXX_Merge

func (m *CompactBitArray) XXX_Merge(src proto.Message)

func (*CompactBitArray) XXX_Size

func (m *CompactBitArray) XXX_Size() int

func (*CompactBitArray) XXX_Unmarshal

func (m *CompactBitArray) XXX_Unmarshal(b []byte) error

type LedgerPrivKey

type LedgerPrivKey interface {
	Bytes() []byte
	Sign(msg []byte) ([]byte, error)
	PubKey() PubKey
	Equals(LedgerPrivKey) bool
	Type() string
}

LedgerPrivKey defines a private key that is not a proto message. For now, LedgerSecp256k1 keys are not converted to proto.Message yet, this is why they use LedgerPrivKey instead of PrivKey. All other keys must use PrivKey instead of LedgerPrivKey. TODO https://github.com/line/lbm-sdk/issues/7357.

type MultiSignature

type MultiSignature struct {
	Signatures       [][]byte `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"`
	XXX_unrecognized []byte   `json:"-"`
}

MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. See lbm.tx.v1betata1.ModeInfo.Multi for how to specify which signers signed and with which modes.

func (*MultiSignature) Descriptor

func (*MultiSignature) Descriptor() ([]byte, []int)

func (*MultiSignature) GetSignatures

func (m *MultiSignature) GetSignatures() [][]byte

func (*MultiSignature) Marshal

func (m *MultiSignature) Marshal() (dAtA []byte, err error)

func (*MultiSignature) MarshalTo

func (m *MultiSignature) MarshalTo(dAtA []byte) (int, error)

func (*MultiSignature) MarshalToSizedBuffer

func (m *MultiSignature) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MultiSignature) ProtoMessage

func (*MultiSignature) ProtoMessage()

func (*MultiSignature) Reset

func (m *MultiSignature) Reset()

func (*MultiSignature) Size

func (m *MultiSignature) Size() (n int)

func (*MultiSignature) String

func (m *MultiSignature) String() string

func (*MultiSignature) Unmarshal

func (m *MultiSignature) Unmarshal(dAtA []byte) error

func (*MultiSignature) XXX_DiscardUnknown

func (m *MultiSignature) XXX_DiscardUnknown()

func (*MultiSignature) XXX_Marshal

func (m *MultiSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MultiSignature) XXX_Merge

func (m *MultiSignature) XXX_Merge(src proto.Message)

func (*MultiSignature) XXX_Size

func (m *MultiSignature) XXX_Size() int

func (*MultiSignature) XXX_Unmarshal

func (m *MultiSignature) XXX_Unmarshal(b []byte) error

type PrivKey

type PrivKey interface {
	proto.Message
	LedgerPrivKey
}

PrivKey defines a private key and extends proto.Message. For now, it extends LedgerPrivKey (see godoc for LedgerPrivKey). Ultimately, we should remove LedgerPrivKey and add its methods here directly. TODO https://github.com/line/lbm-sdk/issues/7357.

type PubKey

type PubKey interface {
	proto.Message

	Address() Address
	Bytes() []byte
	VerifySignature(msg []byte, sig []byte) bool
	Equals(PubKey) bool
	Type() string
}

PubKey defines a public key and extends proto.Message.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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