Documentation ¶
Index ¶
- Constants
- Variables
- type AddressInfo
- type Balance
- type NodeInfo
- type Status
- type Transaction
- type TransactionResult
- type Transactions
- type Transfer
- type Wallet
- type WalletAPI
- func (wAPI WalletAPI) Addresses() ([]string, error)
- func (wAPI WalletAPI) CloseWallet() error
- func (wAPI WalletAPI) CreateAddress() (map[string]string, error)
- func (wAPI WalletAPI) CreateIntegratedAddress(address, paymentID string) (string, error)
- func (wAPI WalletAPI) CreateWallet(wallet *Wallet) error
- func (wAPI WalletAPI) DeleteAddress(address string) error
- func (wAPI WalletAPI) DeletePreparedTransaction(hash string) error
- func (wAPI WalletAPI) GetAddressBalance(address string) (bal *Balance, err error)
- func (wAPI WalletAPI) GetAddressTransactionsByStartHeight(address string, startHeight uint64) (txs *[]Transaction, err error)
- func (wAPI WalletAPI) GetAddressTransactionsInRange(address string, start, end uint64) (txs *[]Transaction, err error)
- func (wAPI WalletAPI) GetAllTransactions() (txs *[]Transaction, err error)
- func (wAPI WalletAPI) GetBalance() (unlocked, locked uint64, err error)
- func (wAPI WalletAPI) GetBalances() ([]Balance, error)
- func (wAPI WalletAPI) GetKeys(address string) (publicSpendKey, privateSpendKey string, err error)
- func (wAPI WalletAPI) GetMnemonic(address string) (string, error)
- func (wAPI WalletAPI) GetTransactionByHash(hash string) (tx *Transaction, err error)
- func (wAPI WalletAPI) GetTransactionPrivateKey(hash string) (string, error)
- func (wAPI WalletAPI) GetTransactionsByStartHeight(startHeight uint64) (txs *[]Transaction, err error)
- func (wAPI WalletAPI) GetTransactionsInRange(start, end uint64) (txs *[]Transaction, err error)
- func (wAPI WalletAPI) GetUnconfirmedTransactions() (txs *[]Transaction, err error)
- func (wAPI WalletAPI) GetUnconfirmedTransactionsByAddress(address string) (txs *[]Transaction, err error)
- func (wAPI WalletAPI) ImportAddress(spendKey string, scanHeight uint64) (string, error)
- func (wAPI WalletAPI) ImportKey(wallet *Wallet, viewKey, spendKey string, scanHeight uint64) error
- func (wAPI WalletAPI) ImportSeed(wallet *Wallet, mnemonicSeed string, scanHeight uint64) error
- func (wAPI WalletAPI) ImportView(wallet *Wallet, viewKey, address string, scanHeight uint64) error
- func (wAPI WalletAPI) ImportViewAddress(spendKey string, scanHeight uint64) (string, error)
- func (wAPI WalletAPI) Node() (*NodeInfo, error)
- func (wAPI WalletAPI) OpenWallet(wallet *Wallet) error
- func (wAPI WalletAPI) PrepareTransactionAdvanced(destinations []map[string]interface{}, ...) (tx *TransactionResult, err error)
- func (wAPI WalletAPI) PrepareTransactionBasic(destination string, amount uint64, paymentID string) (*TransactionResult, error)
- func (wAPI WalletAPI) PrimaryAddress() (string, error)
- func (wAPI WalletAPI) Reset(scanHeight uint64) error
- func (wAPI WalletAPI) Save() error
- func (wAPI WalletAPI) SendFusionAdvanced(sourceAddresses []string, destination string) (string, error)
- func (wAPI WalletAPI) SendFusionBasic() (string, error)
- func (wAPI WalletAPI) SendPreparedTransaction(hash string) (string, error)
- func (wAPI WalletAPI) SendTransactionAdvanced(destinations []map[string]interface{}, ...) (tx *TransactionResult, err error)
- func (wAPI WalletAPI) SendTransactionBasic(destination, paymentID string, amount uint64) (string, error)
- func (wAPI WalletAPI) SetNode(daemonHost string, daemonPort int) error
- func (wAPI WalletAPI) Status() (*Status, error)
- func (wAPI WalletAPI) ValidateAddress(address string) (*AddressInfo, error)
- func (wAPI WalletAPI) ViewKey() (string, error)
Constants ¶
const ( MIXIN = 3 FEE = 10 )
Constants
Variables ¶
var ERRORS = map[int]string{
400: "A parse error occurred, or an error occurred processing your request.",
401: "API key is missing or invalid.",
403: "This operation requires a wallet to be open, and one has not been opened.",
404: "The transaction hash was not found.",
500: "An exception was thrown whilst processing the request.",
}
ERRORS - wallet-api errors
Functions ¶
This section is empty.
Types ¶
type AddressInfo ¶
type AddressInfo struct { IsIntegrated bool PaymentID string ActualAddress string PublicSpendKey string PublicViewKey string }
AddressInfo - response from validate address
type Balance ¶
type Balance struct { Unlocked uint64 `json:"unlocked"` Locked uint64 `json:"locked"` Address string `json:"address"` }
Balance - represents a wallet balance
type NodeInfo ¶
type NodeInfo struct { DaemonHost string `json:"daemonHost"` DaemonPort int64 `json:"daemonPort"` NodeFee int64 `json:"nodeFee"` NodeAddress string `json:"nodeAddress"` }
NodeInfo - node response
type Status ¶
type Status struct { NetworkBlockCount uint64 `json:"networkBlockCount"` WalletBlockCount uint64 `json:"walletBlockCount"` LocalBlockCount uint64 `json:"localDaemonBlockCount"` PeerCount uint64 `json:"peerCount"` Hashrate uint64 `json:"hashrate"` IsViewWallet bool `json:"isViewWallet"` SubWalletCount uint64 `json:"subWalletCount"` }
Status - represents a status object
type Transaction ¶
type Transaction struct { BlockHeight uint64 `json:"blockHeight"` Fee uint64 `json:"fee"` FeePerByte uint64 `json:"feePerByte"` Hash string `json:"hash"` IsCoinbaseTransaction bool `json:"isCoinbaseTransaction"` PaymentID string `json:"paymentID"` Timestamp uint64 `json:"timestamp"` UnlockTime uint64 `json:"unlockTime"` Transfers []Transfer `json:"transfers"` }
Transaction - represents a transaction object
type TransactionResult ¶
type TransactionResult struct { TransactionHash string `json:"transactionHash"` Fee uint64 `json:"fee"` RelayedToNetwork bool `json:"relayedToNetwork"` }
TransactionResult - represents the result of a sent / prepared transaction
type Transactions ¶
type Transactions struct { Transactions []Transaction `json:"transactions"` Transaction Transaction `json:"transaction"` }
Transactions - represents a transactions object
type WalletAPI ¶
WalletAPI - communicates with wallet-api
func InitWalletAPI ¶
InitWalletAPI - initializes wallet-api connection
func (WalletAPI) CloseWallet ¶
CloseWallet - saves and closes the wallet
func (WalletAPI) CreateAddress ¶
CreateAddress - creates a new random address in the wallet container
func (WalletAPI) CreateIntegratedAddress ¶
CreateIntegratedAddress - creates an integrated address from and address and paymentID
func (WalletAPI) CreateWallet ¶
CreateWallet - creates a new wallet
func (WalletAPI) DeleteAddress ¶
DeleteAddress - deletes a subwallet in the wallet container
func (WalletAPI) DeletePreparedTransaction ¶
DeletePreparedTransaction - removes a previously created prepared transaction
func (WalletAPI) GetAddressBalance ¶
GetAddressBalance - gets the balance for the specified wallet address
func (WalletAPI) GetAddressTransactionsByStartHeight ¶
func (wAPI WalletAPI) GetAddressTransactionsByStartHeight(address string, startHeight uint64) (txs *[]Transaction, err error)
GetAddressTransactionsByStartHeight - gets 1000 transactions for the address starting at startHeight
func (WalletAPI) GetAddressTransactionsInRange ¶
func (wAPI WalletAPI) GetAddressTransactionsInRange(address string, start, end uint64) (txs *[]Transaction, err error)
GetAddressTransactionsInRange - gets transactions for the address given a range of block heights
func (WalletAPI) GetAllTransactions ¶
func (wAPI WalletAPI) GetAllTransactions() (txs *[]Transaction, err error)
GetAllTransactions - gets all the transactions in the wallet container
func (WalletAPI) GetBalance ¶
GetBalance - gets the balance for the entire wallet container
func (WalletAPI) GetBalances ¶
GetBalances - gets the balance for the every wallet address
func (WalletAPI) GetMnemonic ¶
GetMnemonic - gets the mnemonic seed for the given address
func (WalletAPI) GetTransactionByHash ¶
func (wAPI WalletAPI) GetTransactionByHash(hash string) (tx *Transaction, err error)
GetTransactionByHash - gets the transaction with the given hash in the wallet container
func (WalletAPI) GetTransactionPrivateKey ¶
GetTransactionPrivateKey - gets the private key of a transaction with the given hash
func (WalletAPI) GetTransactionsByStartHeight ¶
func (wAPI WalletAPI) GetTransactionsByStartHeight(startHeight uint64) (txs *[]Transaction, err error)
GetTransactionsByStartHeight - gets 1000 transactions for the wallet starting at startHeight
func (WalletAPI) GetTransactionsInRange ¶
func (wAPI WalletAPI) GetTransactionsInRange(start, end uint64) (txs *[]Transaction, err error)
GetTransactionsInRange - gets transactions for the wallet given a range of block heights
func (WalletAPI) GetUnconfirmedTransactions ¶
func (wAPI WalletAPI) GetUnconfirmedTransactions() (txs *[]Transaction, err error)
GetUnconfirmedTransactions - gets all unconfirmed outgoing transactions
func (WalletAPI) GetUnconfirmedTransactionsByAddress ¶
func (wAPI WalletAPI) GetUnconfirmedTransactionsByAddress(address string) (txs *[]Transaction, err error)
GetUnconfirmedTransactionsByAddress - gets all unconfirmed outgoing transactions for a given address
func (WalletAPI) ImportAddress ¶
ImportAddress - import a subwallet with the given private spend key
func (WalletAPI) ImportSeed ¶
ImportSeed - imports a wallet using a mnemonic seed
func (WalletAPI) ImportView ¶
ImportView - imports a view only wallet using
func (WalletAPI) ImportViewAddress ¶
ImportViewAddress - import a view only subwallet with the given public spend key
func (WalletAPI) OpenWallet ¶
OpenWallet - opens an existing wallet
func (WalletAPI) PrepareTransactionAdvanced ¶
func (wAPI WalletAPI) PrepareTransactionAdvanced( destinations []map[string]interface{}, mixin, fee, feePerByte, sourceAddresses, paymentID, changeAddress, unlockTime interface{}) (tx *TransactionResult, err error)
PrepareTransactionAdvanced - creates a transaction but does not relay it to the network
func (WalletAPI) PrepareTransactionBasic ¶
func (wAPI WalletAPI) PrepareTransactionBasic(destination string, amount uint64, paymentID string) (*TransactionResult, error)
PrepareTransactionBasic - creates a transaction but does not relay it to the network
func (WalletAPI) PrimaryAddress ¶
PrimaryAddress - gets the primary address in the wallet container
func (WalletAPI) SendFusionAdvanced ¶
func (wAPI WalletAPI) SendFusionAdvanced(sourceAddresses []string, destination string) (string, error)
SendFusionAdvanced - sends a fusion transaction
func (WalletAPI) SendFusionBasic ¶
SendFusionBasic - sends a fusion transaction
func (WalletAPI) SendPreparedTransaction ¶
SendPreparedTransaction - sends a previously created prepared transaction
func (WalletAPI) SendTransactionAdvanced ¶
func (wAPI WalletAPI) SendTransactionAdvanced( destinations []map[string]interface{}, mixin, fee, feePerByte, sourceAddresses, paymentID, changeAddress, unlockTime interface{}) (tx *TransactionResult, err error)
SendTransactionAdvanced - sends a transaction
func (WalletAPI) SendTransactionBasic ¶
func (wAPI WalletAPI) SendTransactionBasic(destination, paymentID string, amount uint64) (string, error)
SendTransactionBasic - sends a transaction
func (WalletAPI) ValidateAddress ¶
func (wAPI WalletAPI) ValidateAddress(address string) (*AddressInfo, error)
ValidateAddress - validates an address