lbrynet

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Client is a LBRY SDK jsonrpc client instance

View Source
var ExampleStreamCreateRequest = `` /* 482-byte string literal not displayed */
View Source
var ExampleStreamCreateResponse = `` /* 4723-byte string literal not displayed */
View Source
var Logger = monitor.NewModuleLogger("lbrynet")

Functions

func AddWallet added in v0.9.0

func AddWallet(uid int) (*ljsonrpc.Wallet, error)

AddWallet loads an existing wallet in the SDK. May return errors:

WalletAlreadyLoaded - wallet is already loaded and operational
WalletNotFound - wallet file does not exist and won't be loaded.

func CreateAccount

func CreateAccount(UID int) (*ljsonrpc.Account, error)

CreateAccount creates a new account with the SDK. Will return an error if account with this UID already exists.

func CreateWallet added in v0.9.0

func CreateWallet(uid int) (*ljsonrpc.Wallet, error)

CreateWallet creates a new wallet with the SDK. Returned error doesn't necessarily mean that the wallet is not operational:

	if errors.Is(err, lbrynet.WalletExists) {
	 // Okay to proceed with the account
 }

	if errors.Is(err, lbrynet.WalletNeedsLoading) {
	 // AddWallet() needs to be called before the wallet can be used
 }

func GetAccount

func GetAccount(uid int) (*ljsonrpc.Account, error)

GetAccount finds account in account_list by UID

func InitializeWallet added in v0.9.0

func InitializeWallet(uid int) (string, error)

InitializeWallet creates a wallet that can be immediately used in subsequent commands. It can recover from errors like existing wallets, but if a wallet is known to exist (eg. a wallet ID stored in the database already), AddWallet should be called instead.

func MakeAccountName

func MakeAccountName(uid int) string

MakeAccountName formats user ID to use as an SDK account name.

func MakeWalletID added in v0.9.0

func MakeWalletID(uid int) string

MakeWalletID formats user ID to use as an SDK wallet ID.

func NewWalletError added in v0.9.0

func NewWalletError(uid int, err error) error

NewWalletError converts plain SDK error to the typed one

func RemoveAccount

func RemoveAccount(UID int) (*ljsonrpc.Account, error)

RemoveAccount removes an account from the SDK by uid

func Resolve

func Resolve(url string) (*ljsonrpc.Claim, error)

Resolve calls resolve method on the daemon and handles *frequent* SDK response format changes with grace instead of panicking.

func WalletRemove added in v0.9.0

func WalletRemove(uid int) (*ljsonrpc.Wallet, error)

WalletRemove loads an existing wallet in the SDK. May return errors:

WalletAlreadyLoaded - wallet is already loaded and operational
WalletNotFound - wallet file does not exist and won't be loaded.

Types

type AccountConflict

type AccountConflict struct {
	UID int
	Err error
}

func (AccountConflict) Error

func (e AccountConflict) Error() string

type AccountNotFound

type AccountNotFound struct {
	UID int
	Err error
}

func (AccountNotFound) Error

func (e AccountNotFound) Error() string

type WalletAlreadyLoaded added in v0.9.0

type WalletAlreadyLoaded struct {
	WalletError
}

func (WalletAlreadyLoaded) Error added in v0.9.0

func (e WalletAlreadyLoaded) Error() string

type WalletError added in v0.9.0

type WalletError struct {
	UID int
	Err error
	// contains filtered or unexported fields
}

func (WalletError) Error added in v0.9.0

func (e WalletError) Error() string

func (WalletError) Unwrap added in v0.9.0

func (e WalletError) Unwrap() error

type WalletExists added in v0.9.0

type WalletExists struct {
	WalletError
}

func (WalletExists) Error added in v0.9.0

func (e WalletExists) Error() string

type WalletNeedsLoading added in v0.9.0

type WalletNeedsLoading struct {
	WalletError
}

func (WalletNeedsLoading) Error added in v0.9.0

func (e WalletNeedsLoading) Error() string

type WalletNotFound added in v0.9.0

type WalletNotFound struct {
	WalletError
}

type WalletNotLoaded added in v0.9.0

type WalletNotLoaded struct {
	WalletError
}

func (WalletNotLoaded) Error added in v0.9.0

func (e WalletNotLoaded) Error() string

Jump to

Keyboard shortcuts

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