2021-10-05 20:50:22 +00:00
|
|
|
pragma Singleton
|
|
|
|
|
|
|
|
import QtQuick 2.13
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var currentAccount: walletModel.accountsView.currentAccount
|
2021-10-20 13:17:49 +00:00
|
|
|
property var accounts: walletSectionAccounts.model
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
property string defaultCurrency: walletModel.balanceView.defaultCurrency
|
|
|
|
property string totalFiatBalance: walletModel.balanceView.totalFiatBalance
|
|
|
|
|
|
|
|
property var transactions: walletModel.transactionsView.transactions
|
|
|
|
|
2021-10-20 12:37:44 +00:00
|
|
|
property var defaultTokenList: walletSectionAllTokens.default
|
|
|
|
property var customTokenList: walletSectionAllTokens.custom
|
|
|
|
property var tokens: walletSectionAllTokens.all
|
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
property var assets: walletModel.tokensView.assets
|
|
|
|
|
|
|
|
property string signingPhrase: walletModel.utilsView.signingPhrase
|
|
|
|
|
|
|
|
property bool mnemonicBackedUp: profileModel.mnemonic.isBackedUp
|
|
|
|
|
|
|
|
property var collectiblesList: walletModel.collectiblesView.collectiblesLists
|
|
|
|
|
|
|
|
property var historyView: walletModel.historyView
|
|
|
|
|
2021-10-14 08:04:15 +00:00
|
|
|
// This should be exposed to the UI via "walletModule", WalletModule should use
|
2021-10-17 11:41:12 +00:00
|
|
|
// Accounts Service which keeps the info about that (isFirstTimeAccountLogin).
|
|
|
|
// Then in the View of WalletModule we may have either QtProperty or
|
|
|
|
// Q_INVOKABLE function (proc marked as slot) depends on logic/need.
|
|
|
|
// The only need for onboardingModel here is actually to check if an account
|
|
|
|
// has been just created or an old one.
|
2021-10-14 08:04:15 +00:00
|
|
|
|
2021-10-17 11:41:12 +00:00
|
|
|
//property bool firstTimeLogin: onboardingModel.isFirstTimeLogin
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
// example wallet model
|
|
|
|
property ListModel exampleWalletModel: ListModel {
|
|
|
|
ListElement {
|
|
|
|
name: "Status account"
|
|
|
|
address: "0xcfc9f08bbcbcb80760e8cb9a3c1232d19662fc6f"
|
|
|
|
balance: "12.00 USD"
|
|
|
|
iconColor: "#7CDA00"
|
|
|
|
}
|
|
|
|
|
|
|
|
ListElement {
|
|
|
|
name: "Test account 1"
|
|
|
|
address: "0x2Ef1...E0Ba"
|
|
|
|
balance: "12.00 USD"
|
|
|
|
iconColor: "#FA6565"
|
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
name: "Status account"
|
|
|
|
address: "0x2Ef1...E0Ba"
|
|
|
|
balance: "12.00 USD"
|
|
|
|
iconColor: "#7CDA00"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
property ListModel exampleAssetModel: ListModel {
|
|
|
|
ListElement {
|
|
|
|
value: "123 USD"
|
|
|
|
symbol: "ETH"
|
|
|
|
fullTokenName: "Ethereum"
|
|
|
|
fiatBalanceDisplay: "3423 ETH"
|
|
|
|
image: "token-icons/eth"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getLatestBlockNumber() {
|
|
|
|
return walletModel.getLatestBlockNumber()
|
|
|
|
}
|
|
|
|
|
|
|
|
function isNonArchivalNode() {
|
|
|
|
return walletModel.isNonArchivalNode
|
|
|
|
}
|
|
|
|
|
|
|
|
function setCurrentAccountByIndex(newIndex) {
|
|
|
|
walletModel.setCurrentAccountByIndex(newIndex)
|
|
|
|
}
|
|
|
|
|
|
|
|
function setInitialRange() {
|
|
|
|
walletModel.setInitialRange()
|
|
|
|
}
|
|
|
|
|
|
|
|
function generateNewAccount(password , accountName, color) {
|
|
|
|
return walletModel.accountsView.generateNewAccount(password, accountName, color)
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeAccountSettings(address, accountName, color) {
|
|
|
|
return walletModel.accountsView.changeAccountSettings(address, accountName, color)
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteAccount(address) {
|
|
|
|
return walletModel.accountsView.deleteAccount(address)
|
|
|
|
}
|
|
|
|
|
|
|
|
function addAccountsFromPrivateKey(privateKey, password, accountName, color) {
|
|
|
|
return walletModel.accountsView.addAccountsFromPrivateKey(privateKey, password, accountName, color)
|
|
|
|
}
|
|
|
|
|
|
|
|
function addAccountsFromSeed(seedPhrase, password, accountName, color) {
|
|
|
|
return walletModel.accountsView.addAccountsFromSeed(seedPhrase, password, accountName, color)
|
|
|
|
}
|
|
|
|
|
|
|
|
function addWatchOnlyAccount(address, accountName, color) {
|
|
|
|
return walletModel.accountsView.addWatchOnlyAccount(address, accountName, color)
|
|
|
|
}
|
|
|
|
|
|
|
|
function setDefaultCurrency(key) {
|
|
|
|
walletModel.balanceView.setDefaultCurrency(key)
|
|
|
|
}
|
|
|
|
|
|
|
|
function addCustomToken(address, name, symbol, decimals) {
|
|
|
|
return walletModel.tokensView.addCustomToken(address, name, symbol, decimals)
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleAsset(symbol) {
|
|
|
|
walletModel.tokensView.toggleAsset(symbol)
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeCustomToken(address) {
|
|
|
|
walletModel.tokensView.removeCustomToken(address)
|
|
|
|
}
|
|
|
|
|
|
|
|
function getQrCode(address) {
|
|
|
|
return profileModel.qrCode(address)
|
|
|
|
}
|
|
|
|
|
|
|
|
function hex2Dec(value) {
|
|
|
|
return utilsModel.hex2Dec(value)
|
|
|
|
}
|
|
|
|
|
|
|
|
function hex2Eth(value) {
|
|
|
|
return utilsModel.hex2Eth(value)
|
|
|
|
}
|
|
|
|
|
|
|
|
function reloadCollectible(collectibleType) {
|
|
|
|
walletModel.collectiblesView.reloadCollectible(collectibleType)
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkRecentHistory() {
|
|
|
|
walletModel.transactionsView.checkRecentHistory()
|
|
|
|
}
|
|
|
|
|
|
|
|
function isFetchingHistory() {
|
|
|
|
return walletModel.historyView.isFetchingHistory(walletModel.accountsView.currentAccount.address)
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadTransactionsForAccount(pageSize) {
|
|
|
|
walletModel.historyView.loadTransactionsForAccount(walletModel.accountsView.currentAccount.address,
|
|
|
|
walletModel.transactionsView.transactions.getLastTxBlockNumber(),
|
|
|
|
pageSize, true)
|
|
|
|
}
|
|
|
|
}
|