wallet_manager

package
v0.0.0-...-a44c12d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseOpenedWallet

func CloseOpenedWallet()

func CreateRandomWallet

func CreateRandomWallet(name string, password string) error

func CreateWalletFromData

func CreateWalletFromData(name string, password string, data []byte) error

func CreateWalletFromHexSeed

func CreateWalletFromHexSeed(name string, password, hexSeed string) error

func CreateWalletFromPath

func CreateWalletFromPath(name string, password string, path string) error

func CreateWalletFromSeed

func CreateWalletFromSeed(name string, password string, seed string) error

func DeleteWallet

func DeleteWallet(addr string) error

func GetSC

func GetSC(scId string) (result rpc.GetSC_Result, cached bool, err error)

func OpenWallet

func OpenWallet(addr string, password string) error

func RPCCall

func RPCCall(method string, params interface{}, result interface{}) error

func StoreRegistrationTx

func StoreRegistrationTx(addr string, tx *transaction.Transaction) error

Types

type Contact

type Contact struct {
	Name      string        `json:"name"`
	Addr      string        `json:"addr"`
	Note      string        `json:"note"`
	Timestamp int64         `json:"timestamp"`
	ListOrder sql.NullInt32 `json:"list_order"`
}

type Entry

type Entry struct {
	rpc.Entry
	SCID crypto.Hash
}

type GetContactsParams

type GetContactsParams struct {
}

type GetEntriesParams

type GetEntriesParams struct {
	In                       sql.NullBool
	Out                      sql.NullBool
	Coinbase                 sql.NullBool
	Sender                   sql.NullString
	Receiver                 sql.NullString
	BurnGreaterOrEqualThan   sql.NullInt64
	AmountGreaterOrEqualThan sql.NullInt64
	TXID                     sql.NullString
	BlockHash                sql.NullString
	SC_CALL                  *SCCallParams
	Offset                   sql.NullInt64
	Limit                    sql.NullInt64
}

type GetOutgoingTxsParams

type GetOutgoingTxsParams struct {
	Descending bool
	OrderBy    string
	Limit      uint64
	TxType     *transaction.TransactionType
}

type GetTokensParams

type GetTokensParams struct {
	Descending bool
	OrderBy    string
	IsFavorite sql.NullBool
	FolderId   *sql.NullInt64
	IsNFT      sql.NullBool
}

type OutgoingTx

type OutgoingTx struct {
	TxId        string
	HeightBuilt sql.NullInt64
	Timestamp   sql.NullInt64
	Status      sql.NullString
	TxType      sql.NullInt32
	HexData     sql.NullString
	BlockHeight sql.NullInt64
	Description sql.NullString
}

type SCCallParams

type SCCallParams struct {
	SCID       sql.NullString
	Entrypoint sql.NullString
}

type Settings

type Settings struct {
	AskToStoreDEXTokens               bool `json:"ask_to_store_dex_tokens"`
	NotifyXSWDMobileBackgroundService bool `json:"notify_xswd_mobile_background_service"`
}

type Token

type Token struct {
	ID                int64
	SCID              string
	Name              string
	MaxSupply         sql.NullInt64 // 1 is an NFT
	TotalSupply       sql.NullInt64
	Decimals          int64 // native dero decimals is 5
	StandardType      sc.SCType
	Metadata          sql.NullString
	IsFavorite        bool
	ListOrderFavorite int
	ImageUrl          sql.NullString
	Symbol            sql.NullString
	FolderId          sql.NullInt64
	CreatedTimestamp  sql.NullInt64 // date created on the blockchain
	AddedTimestamp    sql.NullInt64 // date added to the sql table
	// contains filtered or unexported fields
}

func DeroToken

func DeroToken() *Token

func GetTokenBySCID

func GetTokenBySCID(scId string) (token *Token, err error)

func (*Token) DataDirPath

func (token *Token) DataDirPath() (string, error)

func (*Token) GetHash

func (token *Token) GetHash() crypto.Hash

func (*Token) GetImageOp

func (token *Token) GetImageOp() (imgOp paint.ImageOp, err error)

func (*Token) LoadImageOp

func (token *Token) LoadImageOp() paint.ImageOp

func (*Token) Parse

func (token *Token) Parse(scId string, scResult rpc.GetSC_Result) error

func (*Token) RefreshImageOp

func (token *Token) RefreshImageOp()

type TokenFolder

type TokenFolder struct {
	ID       int64
	Name     string
	ParentId sql.NullInt64
}

type Wallet

type Wallet struct {
	Info       app_db.WalletInfo
	Memory     *walletapi.Wallet_Disk
	DB         *sql.DB
	ServerXSWD *xswd.XSWD
	FolderPath string
	Settings   Settings
}
var OpenedWallet *Wallet

func (*Wallet) ChangePassword

func (w *Wallet) ChangePassword(password string, newPassword string) error

func (*Wallet) CheckRegistrationTx

func (w *Wallet) CheckRegistrationTx(tx transaction.Transaction) (rpc.GetEncryptedBalance_Result, bool, error)

func (*Wallet) ClearOutgoingTxs

func (w *Wallet) ClearOutgoingTxs() error

func (*Wallet) CloseXSWD

func (w *Wallet) CloseXSWD()

func (*Wallet) DelContact

func (w *Wallet) DelContact(addr string) error

func (*Wallet) DelOutgoingTx

func (w *Wallet) DelOutgoingTx(txId string) error

func (*Wallet) DelToken

func (w *Wallet) DelToken(id int64) error

func (*Wallet) DelTokenFolder

func (w *Wallet) DelTokenFolder(id int64) error

func (*Wallet) Delete

func (w *Wallet) Delete() error

func (*Wallet) FolderTokenExists

func (w *Wallet) FolderTokenExists(folder TokenFolder) (bool, error)

func (*Wallet) GetContact

func (w *Wallet) GetContact(addr string) (*Contact, error)

func (*Wallet) GetContacts

func (w *Wallet) GetContacts(params GetContactsParams) ([]Contact, error)

func (*Wallet) GetEntries

func (w *Wallet) GetEntries(SCID *crypto.Hash, params GetEntriesParams) []Entry

func (*Wallet) GetFavTokenLastOrder

func (w *Wallet) GetFavTokenLastOrder() (int64, error)

func (*Wallet) GetOutgoingTxs

func (w *Wallet) GetOutgoingTxs(params GetOutgoingTxsParams) ([]OutgoingTx, error)

func (*Wallet) GetRandomAddress

func (w *Wallet) GetRandomAddress(scId crypto.Hash) (string, error)

func (*Wallet) GetRandomAddresses

func (w *Wallet) GetRandomAddresses(scId crypto.Hash) ([]string, error)

func (*Wallet) GetToken

func (w *Wallet) GetToken(id int64) (*Token, error)

func (*Wallet) GetTokenCount

func (w *Wallet) GetTokenCount(folderId sql.NullInt64) (int, error)

func (*Wallet) GetTokenFolder

func (w *Wallet) GetTokenFolder(id int64) (*TokenFolder, error)

func (*Wallet) GetTokenFolderFolders

func (w *Wallet) GetTokenFolderFolders(id sql.NullInt64) ([]TokenFolder, error)

func (*Wallet) GetTokenFolderPath

func (w *Wallet) GetTokenFolderPath(id sql.NullInt64) (string, error)

func (*Wallet) GetTokens

func (w *Wallet) GetTokens(params GetTokensParams) ([]Token, error)

func (*Wallet) GetTxDestination

func (w *Wallet) GetTxDestination(entry Entry) string

func (*Wallet) GetTxSender

func (w *Wallet) GetTxSender(entry Entry) string

func (*Wallet) InsertDexTokensFolder

func (w *Wallet) InsertDexTokensFolder() error

This function is unused but we can keep it. I opted to insert tokens from DEX page instead of this hardcoded version. Check askToCreateFolderTokens() in dex_pairs.go

func (*Wallet) InsertFolderToken

func (w *Wallet) InsertFolderToken(folder TokenFolder) (int64, error)

func (*Wallet) InsertOutgoingTx

func (w *Wallet) InsertOutgoingTx(tx *transaction.Transaction, description string) error

func (*Wallet) InsertToken

func (w *Wallet) InsertToken(token Token) error

func (*Wallet) LoadSettings

func (w *Wallet) LoadSettings() error

func (*Wallet) OpenXSWD

func (w *Wallet) OpenXSWD(appHandler func(appData *xswd.ApplicationData) bool, reqHandler xswd.RequestHandlerFunc) error

func (*Wallet) RefreshInfo

func (w *Wallet) RefreshInfo() error

func (*Wallet) Rename

func (w *Wallet) Rename(newName string) error

func (*Wallet) ResetBalanceResult

func (w *Wallet) ResetBalanceResult(scId string)

func (*Wallet) SaveSettings

func (w *Wallet) SaveSettings() error

func (*Wallet) StoreContact

func (w *Wallet) StoreContact(contact Contact) error

func (*Wallet) UpdateFolderToken

func (w *Wallet) UpdateFolderToken(folder TokenFolder) error

func (*Wallet) UpdateOugoingTx

func (w *Wallet) UpdateOugoingTx(txId string, status string, blockHeight int64) error

func (*Wallet) UpdatePendingOutgoingTxs

func (w *Wallet) UpdatePendingOutgoingTxs() (int, error)

func (*Wallet) UpdateToken

func (w *Wallet) UpdateToken(token Token) error

Jump to

Keyboard shortcuts

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