walletdmanager

package
v0.0.0-...-3caa860 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package walletdmanager handles the management of the wallet and the communication with the core wallet software

Index

Constants

View Source
const (
	// DefaultTransferFee is the default fee. It is expressed in TRTL
	DefaultTransferFee float64 = 0.1
)

Variables

View Source
var (
	// WalletAvailableBalance is the available balance
	WalletAvailableBalance float64

	// WalletAddress is the wallet address
	WalletAddress string

	// WalletFilename is the filename of the opened wallet
	WalletFilename = ""

	// WalletdOpenAndRunning is true when turtle-service is running with a wallet open
	WalletdOpenAndRunning = false

	// WalletdSynced is true when wallet is synced and transfer is allowed
	WalletdSynced = false

	// fee to be paid to node per transaction
	NodeFee float64
)

Functions

func CreateWallet

func CreateWallet(walletFilename string, walletPassword string, walletPasswordConfirmation string, privateViewKey string, privateSpendKey string, mnemonicSeed string, scanHeight string) (err error)

CreateWallet calls turtle-service to create a new wallet. If privateViewKey, privateSpendKey and mnemonicSeed are empty strings, a new wallet will be generated. If they are not empty, a wallet will be generated from those keys or from the seed (import) walletFilename is the filename chosen by the user. The created wallet file will be located in the same folder as turtle-service. walletPassword is the password of the new wallet. walletPasswordConfirmation is the repeat of the password for confirmation that the password was correctly entered. privateViewKey is the private view key of the wallet. privateSpendKey is the private spend key of the wallet. mnemonicSeed is the mnemonic seed for generating the wallet

func GetPrivateKeys

func GetPrivateKeys() (isDeterministicWallet bool, mnemonicSeed string, privateViewKey string, privateSpendKey string, err error)

GetPrivateKeys provides the private view and spend keys of the current wallet, and the mnemonic seed if the wallet is deterministic

func GracefullyQuitTurtleCoind

func GracefullyQuitTurtleCoind()

GracefullyQuitTurtleCoind stops the TurtleCoind daemon

func GracefullyQuitWalletd

func GracefullyQuitWalletd()

GracefullyQuitWalletd stops the walletd daemon

func OptimizeWalletWithFusion

func OptimizeWalletWithFusion() (transactionHash string, err error)

OptimizeWalletWithFusion sends a fusion transaction to optimize the wallet

func RequestAddress

func RequestAddress() (address string, err error)

RequestAddress provides the address of the current wallet

func RequestAvailableBalanceToBeSpent

func RequestAvailableBalanceToBeSpent(transferFeeString string) (availableBalance float64, err error)

RequestAvailableBalanceToBeSpent returns the available balance minus the fee

func RequestBalance

func RequestBalance() (availableBalance float64, lockedBalance float64, totalBalance float64, err error)

RequestBalance provides the available and locked balances of the current wallet

func RequestConnectionInfo

func RequestConnectionInfo() (syncing string, walletBlockCount int, knownBlockCount int, localDaemonBlockCount int, peerCount int, err error)

RequestConnectionInfo provides the blockchain sync status and the number of connected peers

func RequestFeeinfo

func RequestFeeinfo() (nodeFee float64, err error)

RequestFeeinfo provides the additional fee requested by the remote node for each transaction

func RequestListTransactions

func RequestListTransactions() (transfers []turtlecoinwalletdrpcgo.Transfer, err error)

RequestListTransactions provides the list of transactions of current wallet

func SaveWallet

func SaveWallet() (err error)

SaveWallet saves the sync status of the wallet. To be done regularly so when turtle-service crashes, sync is not lost

func SendTransaction

func SendTransaction(transferAddress string, transferAmountString string, transferPaymentID string, transferFeeString string) (transactionHash string, err error)

SendTransaction makes a transfer with the provided information

func Setup

func Setup(platform string)

Setup sets up some settings. It must be called at least once at the beginning of your program. platform should be set based on your platform. The choices are "linux", "darwin", "windows"

func StartWalletd

func StartWalletd(walletPath string, walletPassword string, useRemoteNode bool, useCheckpoints bool, daemonAddress string, daemonPort string) (err error)

StartWalletd starts the turtle-service daemon with the set wallet info walletPath is the full path to the wallet walletPassword is the wallet password useRemoteNode is true if remote node, false if local useCheckpoints is true if TurtleCoind should be run with "--load-checkpoints"

Types

This section is empty.

Jump to

Keyboard shortcuts

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