Documentation ¶
Overview ¶
Package sr25519 implements go-perun's wallet interface for the polkadot backend.
Index ¶
- Constants
- Variables
- func IsAcc(acc pwallet.Account) bool
- func IsAddr(addr pwallet.Address) bool
- type Account
- type Address
- func (a *Address) AccountID() types.AccountID
- func (a *Address) Bytes() []byte
- func (a *Address) Cmp(b pwallet.Address) int
- func (a *Address) Equal(b pwallet.Address) bool
- func (a *Address) MarshalBinary() (data []byte, err error)
- func (a *Address) String() string
- func (a *Address) UnmarshalBinary(data []byte) error
- type Backend
- type Wallet
Constants ¶
const AddressLen = 32
AddressLen is the length of an encoded Address in byte.
const (
// SignatureLen is the constant length of a signature in byte.
SignatureLen = 64
)
Variables ¶
var ( // ErrWrongAddrType is returned when the type of a Perun Address was not // of type Address. ErrWrongAddrType = errors.New("got wrong address type") // ErrAccountNotPresent is returned when no Account could be found for // a specific Address. ErrAccountNotPresent = errors.New("account is not present in the wallet") )
Functions ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account implements the Account interface. Can be used to sign arbitrary data and extrinsics.
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Address implements the Address interface.
func NewAddressFromPK ¶
func NewAddressFromPK(pk *schnorrkel.PublicKey) *Address
NewAddressFromPK returns a new Address from a public key.
func (*Address) Cmp ¶
Cmp returns 0 if a == b, -1 if a < b, and +1 if a > b. Where ==, < and > are an arbitrary but fixed total order over Address. Panics if the passed address is not of type Address. Needed by the Perun Address interface.
func (*Address) Equal ¶ added in v0.2.0
Equal returns whether the passed address is equal to the receiver. Panics if the passed address is not of type Address. Needed by the Perun Address interface.
func (*Address) MarshalBinary ¶ added in v0.2.0
MarshalBinary encodes the receiver into a binary form and returns the result.
func (*Address) String ¶
String returns the AccountID as hex string with 0x prefix. Needed by the Perun Address interface.
func (*Address) UnmarshalBinary ¶ added in v0.2.0
UnmarshalBinary decodes the form generated by MarshalBinary.
type Backend ¶
type Backend struct{}
Backend implements the Backend interface.
func (*Backend) NewAddress ¶ added in v0.2.0
NewAddress returns a variable of type Address, which can be used for unmarshalling an address from its binary representation.
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet implements the Perun Wallet interface. It uses sr25519 cryptography.
func (*Wallet) DecrementUsage ¶
DecrementUsage does nothing. Needed by the Perun Wallet interface.
func (*Wallet) IncrementUsage ¶
IncrementUsage does nothing. Needed by the Perun Wallet interface.