wallet

package
v0.0.0-...-e5993db Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptFromDb

func DecryptFromDb(value []byte) ([]byte, error)

func DecryptWithKey

func DecryptWithKey(value []byte, key []byte) ([]byte, error)

DecryptWithKey see: https://golang.org/pkg/crypto/cipher/#example_NewCFBDecrypter

func EncryptForDb

func EncryptForDb(value []byte) ([]byte, error)

func EncryptWithKey

func EncryptWithKey(value []byte, key []byte) ([]byte, error)

EncryptWithKey see: https://golang.org/pkg/crypto/cipher/#example_NewCFBEncrypter

func FundTwitterAddress

func FundTwitterAddress(utxo memo.UTXO, key wallet.PrivateKey, address wallet.Address, historyNum int, botExists bool) error

func GenerateEncryptionKeyFromPassword

func GenerateEncryptionKeyFromPassword(password string) ([]byte, error)

GenerateEncryptionKeyFromPassword see: https://godoc.org/golang.org/x/crypto/scrypt#example-package

func GetProfile

func GetProfile(address string, date time.Time, client *graphql.Client) (*graph.Profiles, error)

func MakePost

func MakePost(wlt Wallet, message string) (chainhash.Hash, error)

func MakeReply

func MakeReply(wallet Wallet, parentHash []byte, message string) (chainhash.Hash, error)

func SendToTwitterAddress

func SendToTwitterAddress(utxo memo.UTXO, key wallet.PrivateKey, address wallet.Address, errorMsg string) error

func SetDbEncryptionKey

func SetDbEncryptionKey(encryptionKey []byte)

func SetSalt

func SetSalt(newSalt []byte)

func UpdateName

func UpdateName(wlt Wallet, name string) error

func UpdateProfilePic

func UpdateProfilePic(wlt Wallet, url string) error

func UpdateProfileText

func UpdateProfileText(wlt Wallet, profile string) error

func WithdrawAll

func WithdrawAll(utxos []memo.UTXO, key wallet.PrivateKey, address wallet.Address) error

func WithdrawAmount

func WithdrawAmount(utxos []memo.UTXO, key wallet.PrivateKey, address wallet.Address, amount int64) error

Types

type Address

type Address struct {
	Outputs []Output `json:"outputs"`
}

type Database

type Database struct{}

func (*Database) GetAddressBalance

func (d *Database) GetAddressBalance(addresses []wallet.Addr) (*lib.Balance, error)

func (*Database) GetAddressLastUpdate

func (d *Database) GetAddressLastUpdate(addresses []wallet.Addr) ([]graph.AddressUpdate, error)

func (*Database) GetUtxos

func (d *Database) GetUtxos(addresses []wallet.Addr) ([]graph.Output, error)

func (*Database) SaveTxs

func (d *Database) SaveTxs(txs []graph.Tx) error

func (*Database) SetAddressLastUpdate

func (d *Database) SetAddressLastUpdate(addressUpdates []graph.AddressUpdate) error

type Input

type Input struct {
	Hash  string `json:"hash"`
	Index int    `json:"index"`
}

type InputGetter

type InputGetter struct {
	Address wallet.Address
	UTXOs   []memo.UTXO
	// contains filtered or unexported fields
}

func (*InputGetter) AddChangeUTXO

func (g *InputGetter) AddChangeUTXO(new memo.UTXO)

func (*InputGetter) GetUTXOs

func (g *InputGetter) GetUTXOs(*memo.UTXORequest) ([]memo.UTXO, error)

func (*InputGetter) MarkUTXOsUsed

func (g *InputGetter) MarkUTXOsUsed(used []memo.UTXO)

func (*InputGetter) NewTx

func (g *InputGetter) NewTx()

func (*InputGetter) SetPkHashesToUse

func (g *InputGetter) SetPkHashesToUse([][]byte)

type Output

type Output struct {
	Tx     Tx      `json:"tx"`
	Hash   string  `json:"hash"`
	Index  int     `json:"index"`
	Amount int64   `json:"amount"`
	Spends []Input `json:"spends"`
}

type Profile

type Profile struct {
	Name        string
	Description string
	ProfilePic  string
}

type Tx

type Tx struct {
	Seen time.Time `json:"seen"`
}

type Wallet

type Wallet struct {
	Address wallet.Address
	Key     wallet.PrivateKey
	Getter  gen.InputGetter
}

func NewWallet

func NewWallet(address wallet.Address, key wallet.PrivateKey) Wallet

Jump to

Keyboard shortcuts

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