2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2020-06-01 14:59:46 +00:00
|
|
|
import "../../../../shared"
|
2020-11-16 13:15:39 +00:00
|
|
|
import "../../../../shared/status"
|
2020-06-01 14:59:46 +00:00
|
|
|
import "../../../../imports"
|
|
|
|
|
2020-11-16 13:15:39 +00:00
|
|
|
StatusRoundButton {
|
2020-06-24 03:23:49 +00:00
|
|
|
id: btnAdd
|
2020-11-16 13:15:39 +00:00
|
|
|
icon.name: "plusSign"
|
|
|
|
pressedIconRotation: 45
|
|
|
|
size: "medium"
|
2021-03-16 19:19:48 +00:00
|
|
|
type: "secondary"
|
2020-11-16 13:15:39 +00:00
|
|
|
width: 36
|
|
|
|
height: 36
|
fix: loading of wallet history, display of tx datetime
Fixes: #2539.
Transaction history is now correctly being fetched from status-go as per mobile. Firstly, when accounts are added (ie as watch accounts), `wallet_checkRecentHistory` must be called first so that the status-go db is populated. After that, `wallet_getTransfersByAddress` can be called. On app load, when we run the `initBalance` logic, we are calling `wallet_getTransfersByAddress`, asking for the last 20 transactions with the `loadMore` parameter set to false. When the user navigates to the Wallet > History tab, they can then click “Load More” to fetch more transactions from status-go. Once the number of transactions returns false below the expected amount, the remaining transactions to fetch have been exhausted and the “Load More” button is disabled.
feat: add non-archival node warning to the UI to indicate to the user that they may not have complete results
feat: set active account to the added account
Once an account is added to the wallet, that newly added account is selected as the active account.
1. The “load more” button is active when new transactions that aren’t already displayed are returned from `wallet_getTransfersByAddress`. This is the only way to enable or disable the “Load more” button as status-go is not able to return information regarding whether or not there are more transactions to be fetched. The downside to this is that lets say the last page of transactions is returned, but there are no more pages left. These returned txs are not currently displayed, so the “load more” button will still be enabled. However, the next click of the button will return 0 results, thus disabling it. It’s effectively an extra click to get to the disabled state.
2. For more information on how the `toBlock` parameter operates for the `wallet_getTransfersForAddress` RPC call, see https://notes.status.im/XmENTrVRRaqhwE4gK0m8Mg?view.
2021-05-31 14:03:41 +00:00
|
|
|
readonly property var onAfterAddAccount: function() {
|
|
|
|
walletInfoContainer.changeSelectedAccount(walletModel.accounts.rowCount() - 1)
|
|
|
|
}
|
2020-11-16 13:15:39 +00:00
|
|
|
|
2020-06-24 03:23:49 +00:00
|
|
|
onClicked: {
|
2021-04-01 18:22:08 +00:00
|
|
|
if (newAccountMenu.opened) {
|
|
|
|
newAccountMenu.close()
|
|
|
|
} else {
|
|
|
|
let x = btnAdd.iconX + btnAdd.icon.width / 2 - newAccountMenu.width / 2
|
|
|
|
newAccountMenu.popup(x, btnAdd.height + 4)
|
|
|
|
}
|
2020-06-01 14:59:46 +00:00
|
|
|
}
|
|
|
|
|
2020-06-24 03:23:49 +00:00
|
|
|
GenerateAccountModal {
|
|
|
|
id: generateAccountModal
|
fix: loading of wallet history, display of tx datetime
Fixes: #2539.
Transaction history is now correctly being fetched from status-go as per mobile. Firstly, when accounts are added (ie as watch accounts), `wallet_checkRecentHistory` must be called first so that the status-go db is populated. After that, `wallet_getTransfersByAddress` can be called. On app load, when we run the `initBalance` logic, we are calling `wallet_getTransfersByAddress`, asking for the last 20 transactions with the `loadMore` parameter set to false. When the user navigates to the Wallet > History tab, they can then click “Load More” to fetch more transactions from status-go. Once the number of transactions returns false below the expected amount, the remaining transactions to fetch have been exhausted and the “Load More” button is disabled.
feat: add non-archival node warning to the UI to indicate to the user that they may not have complete results
feat: set active account to the added account
Once an account is added to the wallet, that newly added account is selected as the active account.
1. The “load more” button is active when new transactions that aren’t already displayed are returned from `wallet_getTransfersByAddress`. This is the only way to enable or disable the “Load more” button as status-go is not able to return information regarding whether or not there are more transactions to be fetched. The downside to this is that lets say the last page of transactions is returned, but there are no more pages left. These returned txs are not currently displayed, so the “load more” button will still be enabled. However, the next click of the button will return 0 results, thus disabling it. It’s effectively an extra click to get to the disabled state.
2. For more information on how the `toBlock` parameter operates for the `wallet_getTransfersForAddress` RPC call, see https://notes.status.im/XmENTrVRRaqhwE4gK0m8Mg?view.
2021-05-31 14:03:41 +00:00
|
|
|
onAfterAddAccount: function() { btnAdd.onAfterAddAccount() }
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
AddAccountWithSeed {
|
|
|
|
id: addAccountWithSeedModal
|
fix: loading of wallet history, display of tx datetime
Fixes: #2539.
Transaction history is now correctly being fetched from status-go as per mobile. Firstly, when accounts are added (ie as watch accounts), `wallet_checkRecentHistory` must be called first so that the status-go db is populated. After that, `wallet_getTransfersByAddress` can be called. On app load, when we run the `initBalance` logic, we are calling `wallet_getTransfersByAddress`, asking for the last 20 transactions with the `loadMore` parameter set to false. When the user navigates to the Wallet > History tab, they can then click “Load More” to fetch more transactions from status-go. Once the number of transactions returns false below the expected amount, the remaining transactions to fetch have been exhausted and the “Load More” button is disabled.
feat: add non-archival node warning to the UI to indicate to the user that they may not have complete results
feat: set active account to the added account
Once an account is added to the wallet, that newly added account is selected as the active account.
1. The “load more” button is active when new transactions that aren’t already displayed are returned from `wallet_getTransfersByAddress`. This is the only way to enable or disable the “Load more” button as status-go is not able to return information regarding whether or not there are more transactions to be fetched. The downside to this is that lets say the last page of transactions is returned, but there are no more pages left. These returned txs are not currently displayed, so the “load more” button will still be enabled. However, the next click of the button will return 0 results, thus disabling it. It’s effectively an extra click to get to the disabled state.
2. For more information on how the `toBlock` parameter operates for the `wallet_getTransfersForAddress` RPC call, see https://notes.status.im/XmENTrVRRaqhwE4gK0m8Mg?view.
2021-05-31 14:03:41 +00:00
|
|
|
onAfterAddAccount: function() { btnAdd.onAfterAddAccount() }
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
AddAccountWithPrivateKey {
|
|
|
|
id: addAccountWithPrivateKeydModal
|
fix: loading of wallet history, display of tx datetime
Fixes: #2539.
Transaction history is now correctly being fetched from status-go as per mobile. Firstly, when accounts are added (ie as watch accounts), `wallet_checkRecentHistory` must be called first so that the status-go db is populated. After that, `wallet_getTransfersByAddress` can be called. On app load, when we run the `initBalance` logic, we are calling `wallet_getTransfersByAddress`, asking for the last 20 transactions with the `loadMore` parameter set to false. When the user navigates to the Wallet > History tab, they can then click “Load More” to fetch more transactions from status-go. Once the number of transactions returns false below the expected amount, the remaining transactions to fetch have been exhausted and the “Load More” button is disabled.
feat: add non-archival node warning to the UI to indicate to the user that they may not have complete results
feat: set active account to the added account
Once an account is added to the wallet, that newly added account is selected as the active account.
1. The “load more” button is active when new transactions that aren’t already displayed are returned from `wallet_getTransfersByAddress`. This is the only way to enable or disable the “Load more” button as status-go is not able to return information regarding whether or not there are more transactions to be fetched. The downside to this is that lets say the last page of transactions is returned, but there are no more pages left. These returned txs are not currently displayed, so the “load more” button will still be enabled. However, the next click of the button will return 0 results, thus disabling it. It’s effectively an extra click to get to the disabled state.
2. For more information on how the `toBlock` parameter operates for the `wallet_getTransfersForAddress` RPC call, see https://notes.status.im/XmENTrVRRaqhwE4gK0m8Mg?view.
2021-05-31 14:03:41 +00:00
|
|
|
onAfterAddAccount: function() { btnAdd.onAfterAddAccount() }
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
AddWatchOnlyAccount {
|
|
|
|
id: addWatchOnlyAccountModal
|
fix: loading of wallet history, display of tx datetime
Fixes: #2539.
Transaction history is now correctly being fetched from status-go as per mobile. Firstly, when accounts are added (ie as watch accounts), `wallet_checkRecentHistory` must be called first so that the status-go db is populated. After that, `wallet_getTransfersByAddress` can be called. On app load, when we run the `initBalance` logic, we are calling `wallet_getTransfersByAddress`, asking for the last 20 transactions with the `loadMore` parameter set to false. When the user navigates to the Wallet > History tab, they can then click “Load More” to fetch more transactions from status-go. Once the number of transactions returns false below the expected amount, the remaining transactions to fetch have been exhausted and the “Load More” button is disabled.
feat: add non-archival node warning to the UI to indicate to the user that they may not have complete results
feat: set active account to the added account
Once an account is added to the wallet, that newly added account is selected as the active account.
1. The “load more” button is active when new transactions that aren’t already displayed are returned from `wallet_getTransfersByAddress`. This is the only way to enable or disable the “Load more” button as status-go is not able to return information regarding whether or not there are more transactions to be fetched. The downside to this is that lets say the last page of transactions is returned, but there are no more pages left. These returned txs are not currently displayed, so the “load more” button will still be enabled. However, the next click of the button will return 0 results, thus disabling it. It’s effectively an extra click to get to the disabled state.
2. For more information on how the `toBlock` parameter operates for the `wallet_getTransfersForAddress` RPC call, see https://notes.status.im/XmENTrVRRaqhwE4gK0m8Mg?view.
2021-05-31 14:03:41 +00:00
|
|
|
onAfterAddAccount: function() { btnAdd.onAfterAddAccount() }
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
2020-06-04 14:53:10 +00:00
|
|
|
|
2020-06-24 03:23:49 +00:00
|
|
|
PopupMenu {
|
|
|
|
id: newAccountMenu
|
2020-12-01 18:21:44 +00:00
|
|
|
width: 260
|
2021-04-01 18:22:08 +00:00
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
2020-06-24 03:23:49 +00:00
|
|
|
Action {
|
2020-07-06 20:39:55 +00:00
|
|
|
//% "Generate an account"
|
|
|
|
text: qsTrId("generate-a-new-account")
|
2020-06-24 03:23:49 +00:00
|
|
|
icon.source: "../../../img/generate_account.svg"
|
2020-12-01 18:21:44 +00:00
|
|
|
icon.width: 19
|
|
|
|
icon.height: 19
|
2020-06-24 03:23:49 +00:00
|
|
|
onTriggered: {
|
|
|
|
generateAccountModal.open()
|
2020-06-01 14:59:46 +00:00
|
|
|
}
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
Action {
|
2020-07-06 20:39:55 +00:00
|
|
|
//% "Add a watch-only address"
|
|
|
|
text: qsTrId("add-a-watch-account")
|
2021-05-28 17:35:21 +00:00
|
|
|
icon.source: "../../../img/eye.svg"
|
2020-12-01 18:21:44 +00:00
|
|
|
icon.width: 19
|
|
|
|
icon.height: 19
|
2020-06-24 03:23:49 +00:00
|
|
|
onTriggered: {
|
|
|
|
addWatchOnlyAccountModal.open()
|
2020-06-01 14:59:46 +00:00
|
|
|
}
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
Action {
|
2020-07-06 20:39:55 +00:00
|
|
|
//% "Enter a seed phrase"
|
|
|
|
text: qsTrId("enter-a-seed-phrase")
|
2020-06-24 03:23:49 +00:00
|
|
|
icon.source: "../../../img/enter_seed_phrase.svg"
|
2020-12-01 18:21:44 +00:00
|
|
|
icon.width: 19
|
|
|
|
icon.height: 19
|
2020-06-24 03:23:49 +00:00
|
|
|
onTriggered: {
|
|
|
|
addAccountWithSeedModal.open()
|
2020-06-01 14:59:46 +00:00
|
|
|
}
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
|
|
|
Action {
|
2020-07-06 20:39:55 +00:00
|
|
|
//% "Enter a private key"
|
|
|
|
text: qsTrId("enter-a-private-key")
|
2020-06-24 03:23:49 +00:00
|
|
|
icon.source: "../../../img/enter_private_key.svg"
|
2020-12-01 18:21:44 +00:00
|
|
|
icon.width: 19
|
|
|
|
icon.height: 19
|
2020-06-24 03:23:49 +00:00
|
|
|
onTriggered: {
|
|
|
|
addAccountWithPrivateKeydModal.open()
|
2020-06-01 14:59:46 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-01 18:22:08 +00:00
|
|
|
onAboutToShow: {
|
|
|
|
btnAdd.state = "pressed"
|
|
|
|
}
|
|
|
|
|
2020-06-24 03:23:49 +00:00
|
|
|
onAboutToHide: {
|
2020-11-16 13:15:39 +00:00
|
|
|
btnAdd.state = "default"
|
2020-06-24 03:23:49 +00:00
|
|
|
}
|
2020-06-01 14:59:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
2020-06-04 14:53:10 +00:00
|
|
|
D{i:0;height:36;width:36}
|
2020-06-01 14:59:46 +00:00
|
|
|
}
|
|
|
|
##^##*/
|