walletdrpc

package
v0.0.0-...-62d5d67 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package walletdrpc handles the the rpc connection between your app and walletd

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDeposit

func CreateDeposit(sourceAddress string, amount float64, term int, rpcPassword string) (transactionHash string, err error)

CreateDeposit creates a new deposit using an address, the amount and term expressed in blocks. i.e: term = 21900 means 21900 Blocks which is 1 Month on the Blockchain.

func EstimateFusion

func EstimateFusion(threshold int, addresses []string, rpcPassword string) (fusionReadyCount int, totalOutputCount int, err error)

EstimateFusion counts the number of unspent outputs of the specified addresses and returns how many of those outputs can be optimized. This method is used to understand if a fusion transaction can be created. If fusionReadyCount returns a value = 0, then a fusion transaction cannot be created. threshold is the value that determines which outputs will be optimized. Only the outputs, lesser than the threshold value, will be included into a fusion transaction (threshold is expressed in CCX, not 0.001 CCX). fusionReadyCount is the number of outputs that can be optimized. totalOutputCount is the total number of unspent outputs of the specified addresses.

func GetDeposit

func GetDeposit(id string, rpcPassword string) (amount float64, height int, intrest float64, locked bool, term int, unlockHeight int, err error)

GetDeposit shows the details of a deposit given the depositId.

func GetSpendKeys

func GetSpendKeys(address string, rpcPassword string) (spendSecretKey string, spendPublicKey string, err error)

GetSpendKeys provides the private and public spend keys

func GetViewKey

func GetViewKey(rpcPassword string) (privateViewKey string, err error)

GetViewKey provides the private view key

func RequestAddress

func RequestAddress(rpcPassword string) (address string, err error)

RequestAddress provides the address of the current wallet

func RequestBalance

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

RequestBalance provides the available and locked balances of the current wallet returned balances are expressed in CCX, not in 0.001 CCX

func RequestStatus

func RequestStatus(rpcPassword string) (walletBlockCount int, knownBlockCount int, peerCount int, err error)

RequestStatus requests walletd connection and sync status

func SaveWallet

func SaveWallet(rpcPassword string) (err error)

SaveWallet saves the sync info in the wallet

func SendFusionTransaction

func SendFusionTransaction(threshold int, addresses []string, destinationAddress string, rpcPassword string) (transactionHash string, err error)

SendFusionTransaction allows you to send a fusion transaction, by taking funds from selected addresses and transferring them to the destination address. threshold is the value that determines which outputs will be optimized. Only the outputs, lesser than the threshold value, will be included into a fusion transaction (threshold is expressed in CCX, not 0.001 CCX). parameters amount and fee are expressed in CCX, not 0.001 CCX

func SendTransaction

func SendTransaction(addressRecipient string, amount float64, paymentID string, fee float64, rpcPassword string) (transactionHash string, err error)

SendTransaction makes a transfer with the provided information. parameters amount and fee are expressed in CCX, not 0.001 CCX

Types

type Transfer

type Transfer struct {
	PaymentID              string
	TxID                   string
	Timestamp              time.Time
	Amount                 float64
	Fee                    float64
	Block                  int
	Confirmations          int
	IsRecievingTransaction bool
}

Transfer contains all the information about a specific transfer

func RequestListTransactions

func RequestListTransactions(blockCount int, firstBlockIndex int, addresses []string, rpcPassword string) (transfers []Transfer, err error)

RequestListTransactions provides the list of transactions of current wallet

Jump to

Keyboard shortcuts

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