Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
woodyjon committed Jun 21, 2018
2 parents 7eebf64 + ebf4781 commit d6fdb07
Show file tree
Hide file tree
Showing 14 changed files with 595 additions and 103 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ moc.h
*darwin_amd64.go
*windows_386.go
walletd
settings.db
settings.db
\.vs/
2 changes: 1 addition & 1 deletion constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

const (
versionNest = "0.22"
versionNest = "0.23"
urlCryptoCompareTRTL = "https://min-api.cryptocompare.com/data/price?fsym=TRTL&tsyms=USD"
defaultRemoteDaemonAddress = "public.turtlenode.io"
defaultRemoteDaemonPort = "11898"
Expand Down
105 changes: 54 additions & 51 deletions docs/functional-tests.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,56 @@
Functional tests to be done on windows, mac and linux before merging to master and deploying a release.

\# | Action | Result
---|---|---
1.1 | Open wallet by clicking on the "Open" button | busy indicator for a few seconds then wallet opens and display balance, etc..., sync is ok
1.2 | Open wallet by typing return key while in password field | busy indicator for a few seconds then wallet opens and display balance, etc..., sync is ok
2 | Click on button to backup keys | backup keys are displayed (check the window is large enough)
3 | Click on button to copy keys to clipboard | Keys are copied to clipboard
4.1 | Click create wallet | dialog to confirm the password
4.2 | Click create wallet and enter wrong password confirmation | error
4.3 | Create wallet | busy indicator for a few seconds, then the wallet should be created in app folder and wallet open and display backup keys
5 | Create wallet with name already exist in folder | error: same filename already exist
6 | Open wallet -> Close wallet | Wallet closes
7.1 | Import wallet from keys | dialog to confirm the password
7.2 | Import wallet from keys and enter wrong password confirmation | error
7.3 | Import wallet from keys | wallet created in app folder. Check backup keys, address, balance.
8 | Open existing wallet -> close Nest -> reopen Nest | path to previously opened wallet should appear. Test opening it again without changing path.
9 | Button copy address | Pop up "Copied!" and address should be copied to clipboard.
10 | Button copy tr. id | Pop up "Copied!" and tr. id should be copied to clipboard.
11 | Button explore transaction | Trtl explorer opens in default browser with the right transacton.
12 | Receive trtl | Balance updates automatically and new confirmed transaction added to list previous transactions
13 | Send TRTL, address diff. than 99 chars | error: address invalid
14 | Send TRTL, address not start by TRTL | error: address invalid
15 | Send TRTL, amount is 0 or less | error: amount should be greater than 0
16 | Send TRTL, amount is not a number | error: amount invalid
17 | Send TRTL, amount + fee is more than available balance | error: available balance is insufficient
18 | Send TRTL, small valid amount | dialog for confirming transfer. After confirmation, popup TRTL sent. amount is received on the other end
19 | Send TRTL, more than 5M | error: split in smaller portions of 5M max
20 | Send TRTL, invalid payment id | error: wrong payment id format
21 | Send TRTL, valid payment id | popup TRTL sent. amount is received on the other end with correct payment id
22 | select the option local blockchain, restart | local blockchain should still be selected
23 | Test using the wallet with local blockchain selected |
24 | Test using the wallet with remote node selected |
25 | Reduce window height and test scrolling |
26 | Check wallet filename is displayed above address |
27 | Click Settings | Settings screen appears
28 | Close Settings | Settings screen disappears
29 | Settings: Enable display in USD -> Close Nest -> Reopen | Setting is still enabled
30 | Display in USD enabled -> Open a wallet| Balance is displayed in USD (under TRTL balance)
31 | Display in USD enabled -> type an amount to be transfered| Value is displayed in USD
32 | Settings: change remote node address and port -> click save -> close and reopen Nest | new address in remote node radio button and in settings
33 | Settings: click remote node reset to default -> close and reopen Nest | default address in remote node radio button and in settings
34 | Win only: open a wallet | no black window (walletd) should open next to the nest window
35 | Win & Mac only: check executable file | its icon is the nest icon
36 | Win & Mac only: launch nest | icon in taskbar should be nest icon
37 | launch on a small screen or resolution (800 x 600) | possibility to click full screen and to scroll in the full window
38 | Click button to send full balance | Full balance - fee is automatically displayed in transfer amount field
39 | Transfer with different fee | Check transfer was made with proper fee
40 | Modify transfer fee and mixin, then click "default values" | Default values should be displayed in corresponding field
41 | List transactions | 20 transactions are displayed
42 | Switch to display "all transactions" then switch back | Proper number of transactions are displayed
43 | Start application and check log file | version of Nest in "application started" log should be correct
44 | Connect to wrong remote node | error message about connection problem
| | Action | Result
|---|---|---
| <ul><li>[ ] </li></ul> | Open wallet by clicking on the "Open" button | busy indicator for a few seconds then wallet opens and display balance, etc..., sync is ok
| <ul><li>[ ] </li></ul> | Open wallet by typing return key while in password field | busy indicator for a few seconds then wallet opens and display balance, etc..., sync is ok
| <ul><li>[ ] </li></ul> | Click on button to backup keys | backup keys are displayed (check the window is large enough)
| <ul><li>[ ] </li></ul> | Click on button to copy keys to clipboard | Keys are copied to clipboard
| <ul><li>[ ] </li></ul> | Click create wallet | dialog to confirm the password
| <ul><li>[ ] </li></ul> | Click create wallet and enter wrong password confirmation | error
| <ul><li>[ ] </li></ul> | Create wallet | busy indicator for a few seconds, then the wallet should be created in app folder and wallet open and display backup keys
| <ul><li>[ ] </li></ul> | Create wallet with name already exist in folder | error: same filename already exist
| <ul><li>[ ] </li></ul> | Open wallet -> Close wallet | Wallet closes
| <ul><li>[ ] </li></ul> | Import wallet from keys | dialog to confirm the password
| <ul><li>[ ] </li></ul> | Import wallet from keys and enter wrong password confirmation | error
| <ul><li>[ ] </li></ul> | Import wallet from keys | wallet created in app folder. Check backup keys, address, balance.
| <ul><li>[ ] </li></ul> | Open existing wallet -> close Nest -> reopen Nest | path to previously opened wallet should appear. Test opening it again without changing path.
| <ul><li>[ ] </li></ul> | Button copy address | Pop up "Copied!" and address should be copied to clipboard.
| <ul><li>[ ] </li></ul> | Button copy tr. id | Pop up "Copied!" and tr. id should be copied to clipboard.
| <ul><li>[ ] </li></ul> | Button explore transaction | Trtl explorer opens in default browser with the right transacton.
| <ul><li>[ ] </li></ul> | Receive trtl | Balance updates automatically and new confirmed transaction added to list previous transactions
| <ul><li>[ ] </li></ul> | Send TRTL, address diff. than 99 chars | error: address invalid
| <ul><li>[ ] </li></ul> | Send TRTL, address not start by TRTL | error: address invalid
| <ul><li>[ ] </li></ul> | Send TRTL, amount is 0 or less | error: amount should be greater than 0
| <ul><li>[ ] </li></ul> | Send TRTL, amount is not a number | error: amount invalid
| <ul><li>[ ] </li></ul> | Send TRTL, amount + fee is more than available balance | error: available balance is insufficient
| <ul><li>[ ] </li></ul> | Send TRTL, small valid amount | dialog for confirming transfer. After confirmation, popup TRTL sent. amount is received on the other end
| <ul><li>[ ] </li></ul> | Send TRTL, invalid payment id | error: wrong payment id format
| <ul><li>[ ] </li></ul> | Send TRTL, valid payment id | popup TRTL sent. amount is received on the other end with correct payment id
| <ul><li>[ ] </li></ul> | select the option local blockchain, restart | local blockchain should still be selected
| <ul><li>[ ] </li></ul> | Test using the wallet with local blockchain selected |
| <ul><li>[ ] </li></ul> | Test using the wallet with remote node selected |
| <ul><li>[ ] </li></ul> | Reduce window height and test scrolling |
| <ul><li>[ ] </li></ul> | Check wallet filename is displayed above address |
| <ul><li>[ ] </li></ul> | Click Settings | Settings screen appears
| <ul><li>[ ] </li></ul> | Close Settings | Settings screen disappears
| <ul><li>[ ] </li></ul> | Settings: Enable display in USD -> Close Nest -> Reopen | Setting is still enabled
| <ul><li>[ ] </li></ul> | Display in USD enabled -> Open a wallet| Balance is displayed in USD (under TRTL balance)
| <ul><li>[ ] </li></ul> | Display in USD enabled -> type an amount to be transfered| Value is displayed in USD
| <ul><li>[ ] </li></ul> | Settings: change remote node address and port -> click save -> close and reopen Nest | new address in remote node radio button and in settings
| <ul><li>[ ] </li></ul> | Settings: click remote node reset to default -> close and reopen Nest | default address in remote node radio button and in settings
| <ul><li>[ ] </li></ul> | Win only: open a wallet | no black window (walletd) should open next to the nest window
| <ul><li>[ ] </li></ul> | Win & Mac only: check executable file | its icon is the nest icon
| <ul><li>[ ] </li></ul> | Win & Mac only: launch nest | icon in taskbar should be nest icon
| <ul><li>[ ] </li></ul> | Launch on a small screen or resolution (800 x 600) | possibility to click full screen and to scroll in the full window
| <ul><li>[ ] </li></ul> | Click button to send full balance | Full balance - fee is automatically displayed in transfer amount field
| <ul><li>[ ] </li></ul> | Transfer with different fee | Check transfer was made with proper fee
| <ul><li>[ ] </li></ul> | Modify transfer fee and mixin, then click "default values" | Default values should be displayed in corresponding field
| <ul><li>[ ] </li></ul> | List transactions | 20 transactions are displayed
| <ul><li>[ ] </li></ul> | Switch to display "all transactions" then switch back | Proper number of transactions are displayed
| <ul><li>[ ] </li></ul> | Start application and check log file | version of Nest in "application started" log should be correct
| <ul><li>[ ] </li></ul> | Connect to wrong remote node | error message about connection problem
| <ul><li>[ ] </li></ul> | Click "?" to open Info screen from main screen | info dialog opens, check version
| <ul><li>[ ] </li></ul> | Click "?" to open Info screen from wallet screen | info dialog opens
| <ul><li>[ ] </li></ul> | Open info dialog, click link to chat | browser opens on chat url
| <ul><li>[ ] </li></ul> | Open info dialog, click copy donation address | donation address copied to clipboard
75 changes: 52 additions & 23 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var (
transfers []turtlecoinwalletdrpcgo.Transfer
tickerRefreshWalletData *time.Ticker
tickerRefreshConnectionInfo *time.Ticker
tickerSaveWallet *time.Ticker
db *sql.DB
useRemoteNode = true
displayFiatConversion = false
Expand Down Expand Up @@ -92,9 +93,11 @@ type QmlBridge struct {
// qml to go
_ func(msg string) `slot:"log"`
_ func(transactionID string) `slot:"clickedButtonExplorer"`
_ func(url string) `slot:"goToWebsite"`
_ func(transactionID string) `slot:"clickedButtonCopyTx"`
_ func() `slot:"clickedButtonCopyAddress"`
_ func() `slot:"clickedButtonCopyKeys"`
_ func(stringToCopy string) `slot:"clickedButtonCopy"`
_ func(transferAddress string,
transferAmount string,
transferPaymentID string,
Expand Down Expand Up @@ -122,6 +125,7 @@ type QmlBridge struct {
_ func(transferFee string) `slot:"getFullBalanceAndDisplayInTransferAmount"`
_ func() `slot:"getDefaultFeeAndMixinAndDisplay"`
_ func(limit bool) `slot:"limitDisplayTransactions"`
_ func() string `slot:"getVersion"`

_ func(object *core.QObject) `slot:"registerToGo"`
_ func(objectName string) `slot:"deregisterToGo"`
Expand Down Expand Up @@ -227,6 +231,10 @@ func connectQMLToGOFunctions() {
clipboard.WriteAll(stringBackupKeys)
})

qmlBridge.ConnectClickedButtonCopy(func(stringToCopy string) {
clipboard.WriteAll(stringToCopy)
})

qmlBridge.ConnectClickedButtonCopyTx(func(transactionID string) {
clipboard.WriteAll(transactionID)
qmlBridge.DisplayPopup("Copied!", 1500)
Expand All @@ -240,6 +248,13 @@ func connectQMLToGOFunctions() {
}
})

qmlBridge.ConnectGoToWebsite(func(url string) {
successOpenBrowser := openBrowser(url)
if !successOpenBrowser {
log.Error("failure opening browser, url: " + url)
}
})

qmlBridge.ConnectClickedButtonSend(func(transferAddress string, transferAmount string, transferPaymentID string, transferFee string, transferMixin string) {
transfer(transferAddress, transferAmount, transferPaymentID, transferFee, transferMixin)
})
Expand Down Expand Up @@ -276,7 +291,7 @@ func connectQMLToGOFunctions() {
})

qmlBridge.ConnectChoseRemote(func(remote bool) {
useRemoteNode = remote
// useRemoteNode = remote
recordUseRemoteToDB(useRemoteNode)
})

Expand Down Expand Up @@ -314,6 +329,10 @@ func connectQMLToGOFunctions() {
limitDisplayedTransactions = limit
getAndDisplayListTransactions(true)
})

qmlBridge.ConnectGetVersion(func() string {
return versionNest
})
}

func startDisplayWalletInfo() {
Expand All @@ -338,6 +357,13 @@ func startDisplayWalletInfo() {
getAndDisplayConnectionInfo()
}
}()

go func() {
tickerSaveWallet = time.NewTicker(time.Second * 289) // every 5 or so minutes
for range tickerSaveWallet.C {
walletdmanager.SaveWallet()
}
}()
}

func getAndDisplayBalances() {
Expand Down Expand Up @@ -515,6 +541,7 @@ func closeWallet() {

tickerRefreshWalletData.Stop()
tickerRefreshConnectionInfo.Stop()
tickerSaveWallet.Stop()

stringBackupKeys = ""
transfers = nil
Expand Down Expand Up @@ -637,33 +664,35 @@ func recordPathWalletToDB(path string) {

func getUseRemoteFromDB() bool {

rows, err := db.Query("SELECT useRemote FROM remoteNode ORDER BY id DESC LIMIT 1")
if err != nil {
log.Fatal("error querying useRemote from remoteNode table. err: ", err)
}
defer rows.Close()
for rows.Next() {
useRemote := true
err = rows.Scan(&useRemote)
if err != nil {
log.Fatal("error reading item from remoteNode table. err: ", err)
}
useRemoteNode = useRemote
}
return true

return useRemoteNode
// rows, err := db.Query("SELECT useRemote FROM remoteNode ORDER BY id DESC LIMIT 1")
// if err != nil {
// log.Fatal("error querying useRemote from remoteNode table. err: ", err)
// }
// defer rows.Close()
// for rows.Next() {
// useRemote := true
// err = rows.Scan(&useRemote)
// if err != nil {
// log.Fatal("error reading item from remoteNode table. err: ", err)
// }
// useRemoteNode = useRemote
// }

// return useRemoteNode
}

func recordUseRemoteToDB(useRemote bool) {

stmt, err := db.Prepare(`INSERT INTO remoteNode(useRemote) VALUES(?)`)
if err != nil {
log.Fatal("error preparing to insert useRemoteNode into db. err: ", err)
}
_, err = stmt.Exec(useRemote)
if err != nil {
log.Fatal("error inserting useRemoteNode into db. err: ", err)
}
// stmt, err := db.Prepare(`INSERT INTO remoteNode(useRemote) VALUES(?)`)
// if err != nil {
// log.Fatal("error preparing to insert useRemoteNode into db. err: ", err)
// }
// _, err = stmt.Exec(useRemote)
// if err != nil {
// log.Fatal("error inserting useRemoteNode into db. err: ", err)
// }
}

func getRemoteDaemonInfoFromDB() (daemonAddress string, daemonPort string) {
Expand Down
Loading

0 comments on commit d6fdb07

Please sign in to comment.