Documentation
¶
Overview ¶
Package wallet provides the necessary components to use Stellar accounts for Perun payment channels.
Index ¶
- Constants
- Variables
- func NewRandomAddress(rng *rand.Rand) wallet.Address
- type Account
- type EphemeralWallet
- func (e *EphemeralWallet) AddAccount(acc *Account) error
- func (e *EphemeralWallet) AddNewAccount(rng *rand.Rand) (*Account, *keypair.Full, error)
- func (e *EphemeralWallet) DecrementUsage(address wallet.Address)
- func (e *EphemeralWallet) IncrementUsage(address wallet.Address)
- func (e *EphemeralWallet) LockAll()
- func (e *EphemeralWallet) Unlock(a wallet.Address) (wallet.Account, error)
Constants ¶
const SignatureLength = 64
SignatureLength is the length of a signature in bytes.
Variables ¶
var Backend = backend{}
Functions ¶
Types ¶
type Account ¶
type Account struct { // ParticipantAddress references the ParticipantAddress of the Participant this account belongs to. ParticipantAddress keypair.FromAddress // CCAddr is the cross-chain address of the participant. CCAddr [types.CCAddressLength]byte // contains filtered or unexported fields }
Account is used for signing channel state.
func NewAccount ¶ added in v0.3.0
func NewAccount(privateKey string, addr keypair.FromAddress, ccAddr [types.CCAddressLength]byte) *Account
NewAccount creates a new account with the given private key and addresses.
func NewRandomAccount ¶
NewRandomAccount creates a new account with a random private key. It also creates a random key pair, using its address as the account'privateKey Account.ParticipantAddress.
func NewRandomAccountWithAddress ¶
NewRandomAccountWithAddress creates a new account with a random private key and the given address as Account.ParticipantAddress.
func (Account) Participant ¶
func (a Account) Participant() *types.Participant
Participant returns the Participant this account belongs to.
type EphemeralWallet ¶
type EphemeralWallet struct {
// contains filtered or unexported fields
}
EphemeralWallet is a wallet that stores accounts in memory.
func NewEphemeralWallet ¶
func NewEphemeralWallet() *EphemeralWallet
NewEphemeralWallet creates a new EphemeralWallet instance.
func (*EphemeralWallet) AddAccount ¶
func (e *EphemeralWallet) AddAccount(acc *Account) error
AddAccount adds the given account to the wallet.
func (*EphemeralWallet) AddNewAccount ¶
AddNewAccount generates a new account and adds it to the wallet.
func (*EphemeralWallet) DecrementUsage ¶
func (e *EphemeralWallet) DecrementUsage(address wallet.Address)
DecrementUsage decrements the usage counter of the account associated with the given address.
func (*EphemeralWallet) IncrementUsage ¶
func (e *EphemeralWallet) IncrementUsage(address wallet.Address)
IncrementUsage increments the usage counter of the account associated with the given address.