chore(@desktop/wallet): SendModal: complete storybook flow

closes #12244
This commit is contained in:
Khushboo Mehta 2023-09-26 15:45:44 +02:00 committed by Khushboo-dev-cpp
parent d5317a91ba
commit d19e95cb5b
19 changed files with 834 additions and 218 deletions

View File

@ -279,6 +279,12 @@ QtObject:
return item.getChainName() return item.getChainName()
return "" return ""
proc getIconUrl*(self: NetworkModel, chainId: int): string =
for item in self.items:
if item.getChainId() == chainId:
return item.getIconURL()
return ""
proc toggleRouteDisabledChains*(self: NetworkModel, chainId: int) {.slot.} = proc toggleRouteDisabledChains*(self: NetworkModel, chainId: int) {.slot.} =
for i in 0 ..< self.items.len: for i in 0 ..< self.items.len:
if(self.items[i].getChainId() == chainId): if(self.items[i].getChainId() == chainId):

View File

@ -295,3 +295,6 @@ QtObject:
for shortName in chainShortNames.split(':'): for shortName in chainShortNames.split(':'):
preferredChains.add(self.fromNetworksModel.getNetworkChainId(shortName)) preferredChains.add(self.fromNetworksModel.getNetworkChainId(shortName))
return preferredChains.join(":") return preferredChains.join(":")
proc getIconUrl*(self: View, chainId: int): string {.slot.} =
return self.fromNetworksModel.getIconUrl(chainId)

View File

@ -2,7 +2,9 @@ import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import Models 1.0 import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import Storybook 1.0 import Storybook 1.0
import utils 1.0 import utils 1.0
@ -10,14 +12,87 @@ import shared.popups.send 1.0
import shared.stores 1.0 import shared.stores 1.0
import shared.stores.send 1.0 import shared.stores.send 1.0
import StatusQ.Core.Utils 0.1
SplitView { SplitView {
id: root id: root
orientation: Qt.Vertical orientation: Qt.Horizontal
TransactionStore {
id: txStore
}
QtObject {
id: dummyEventData
property ListModel toModel: ListModel {
ListElement {
chainId: 420
chainName: "Optimism"
iconUrl: "network/Network=Optimism"
amountOut: "3003845308235848343"
}
}
property var suggestesRoutes: [{
bridgeName:"Hop",
fromNetwork: 1,
toNetwork: 10,
maxAmountIn:"2649485258572837546",
amountIn:"200000000000000000",
amountOut:"200000000000000000",
gasAmount:501000,
gasFees: {
gasPrice:1.7e-08,
baseFee:1.0,
maxPriorityFeePerGas:2e-09,
maxFeePerGasL:1.1e-08,
maxFeePerGasM:1.0,
maxFeePerGasH:2.0,
eip1559Enabled:true
},
tokenFees:-0.004508663259772343,
cost:-6.39534887667951,
estimatedTime:1,
amountInLocked:false,
isFirstSimpleTx:true,
isFirstBridgeTx:true,
approvalRequired:false,
approvalGasFees:0.0,
approvalAmountRequired:"0",
approvalContractAddress:""
},
{
bridgeName:"Transfer",
fromNetwork: 10,
toNetwork:10,
maxAmountIn:"443890157817650036",
amountIn:"200000000000000000",
amountOut:"200000000000000000",
gasAmount:22000,
gasFees:{
gasPrice:0.10000005,
baseFee:4.4e-08,
maxPriorityFeePerGas:0.1,
maxFeePerGasL:5e-08,
maxFeePerGasM:0.1,
maxFeePerGasH:0.2,
eip1559Enabled:true
},
tokenFees:0.0,
bonderFees:"0x0",
cost:0.003510716,
estimatedTime:1,
amountInLocked:false,
isFirstSimpleTx:false,
isFirstBridgeTx:false,
approvalRequired:false,
approvalGasFees:0.0,
approvalAmountRequired:"0",
approvalContractAddress:""
}]
}
Item { Item {
anchors.left: parent.left
SplitView.fillWidth: true SplitView.fillWidth: true
SplitView.fillHeight: true SplitView.fillHeight: true
@ -29,6 +104,14 @@ SplitView {
Loader { Loader {
id: loader id: loader
property var preSelectedAccount: txStore.selectedSenderAccount
property string preSelectedHoldingID
property int preSelectedHoldingType
property int preSelectedSendType: Constants.SendType.Unknown
property bool onlyAssets: false
property string preDefinedAmountToSend
property string preSelectedRecipient
active: false active: false
sourceComponent: SendModal { sourceComponent: SendModal {
@ -36,170 +119,15 @@ SplitView {
modal: false modal: false
closePolicy: Popup.NoAutoClose closePolicy: Popup.NoAutoClose
onlyAssets: false onlyAssets: false
store: txStore
store: TransactionStore { preSelectedAccount: loader.preSelectedAccount
readonly property QtObject selectedSenderAccount: QtObject { preDefinedAmountToSend: loader.preDefinedAmountToSend
readonly property var assets: WalletAssetsModel {} preSelectedRecipient: loader.preSelectedRecipient
} preSelectedSendType: loader.preSelectedSendType
readonly property QtObject collectiblesModel: WalletCollectiblesModel {} preSelectedHoldingID: loader.preSelectedHoldingID
readonly property QtObject nestedCollectiblesModel: WalletNestedCollectiblesModel {} preSelectedHoldingType: loader.preSelectedHoldingType
readonly property QtObject walletSectionSendInst: QtObject {}
readonly property QtObject mainModuleInst: QtObject {}
readonly property var savedAddressesModel: ListModel {
Component.onCompleted: {
for (let i = 0; i < 10; i++)
append({
name: "some saved addr name " + i,
ens: [],
address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b4",
chainShortNames: "eth:arb"
})
}
}
function splitAndFormatAddressPrefix(textAddrss, updateInStore) {
return textAddrss
}
function resolveENS() {
return ""
}
function getAsset(assetsList, symbol) {
const idx = ModelUtils.indexOf(assetsList, "symbol", symbol)
if (idx < 0) {
return {}
}
return ModelUtils.get(assetsList, idx)
}
function getCollectible(uid) {
const idx = ModelUtils.indexOf(collectiblesModel, "uid", uid)
if (idx < 0) {
return {}
}
return ModelUtils.get(collectiblesModel, idx)
}
function getSelectorCollectible(uid) {
const idx = ModelUtils.indexOf(nestedCollectiblesModel, "uid", uid)
if (idx < 0) {
return {}
}
return ModelUtils.get(nestedCollectiblesModel, idx)
}
function getHolding(holdingId, holdingType) {
if (holdingType === Constants.HoldingType.Asset) {
return getAsset(selectedSenderAccount.assets, holdingId)
} else if (holdingType === Constants.HoldingType.Collectible) {
return getCollectible(holdingId)
} else {
return {}
}
}
function getSelectorHolding(holdingId, holdingType) {
if (holdingType === Constants.HoldingType.Asset) {
return getAsset(selectedSenderAccount.assets, holdingId)
} else if (holdingType === Constants.HoldingType.Collectible) {
return getSelectorCollectible(holdingId)
} else {
return {}
}
}
function assetToSelectorAsset(asset) {
return asset
}
function collectibleToSelectorCollectible(collectible) {
return {
uid: collectible.uid,
chainId: collectible.chainId,
name: collectible.name,
iconUrl: collectible.imageUrl,
collectionUid: collectible.collectionUid,
collectionName: collectible.collectionName,
isCollection: false
}
}
function holdingToSelectorHolding(holding, holdingType) {
if (holdingType === Constants.HoldingType.Asset) {
return assetToSelectorAsset(holding)
} else if (holdingType === Constants.HoldingType.Collectible) {
return collectibleToSelectorCollectible(holding)
} else {
return {}
}
}
readonly property string currentCurrency: "USD"
readonly property QtObject currencyStore: QtObject {
readonly property string currentCurrency: "USD"
function formatCurrencyAmount() {
return "42"
}
function getFiatValue() {
return "42.42"
}
}
function getAllNetworksSupportedString() {
return "OPT"
}
function plainText(text) {
return text
}
function prepareTransactionsForAddress(address) {
console.log("prepareTransactionsForAddress:", address)
}
function getTransactions() {
return transactions
}
readonly property var transactions_: ListModel {
id: transactions
Component.onCompleted: {
for (let i = 0; i < 10; i++)
append({
to: "to",
loadingTransaction: false,
value: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 3.234
},
timestamp: new Date()
})
}
}
function findTokenSymbolByAddress() {
return "ETH"
}
}
}
Component.onCompleted: {
RootStore.currencyStore = {
currentCurrencySymbol: "USD"
}
RootStore.getNetworkIcon = () => "network/Network=Optimism"
loader.active = true
} }
Component.onCompleted: loader.active = true
} }
} }
@ -207,7 +135,122 @@ SplitView {
SplitView.minimumHeight: 100 SplitView.minimumHeight: 100
SplitView.preferredHeight: 100 SplitView.preferredHeight: 100
SplitView.fillWidth: true
ColumnLayout {
width: parent.width
spacing: 20
ColumnLayout {
spacing: 0
Layout.topMargin: 20
width: parent.width
StatusBaseText {
Layout.maximumWidth: parent.width
text: "This button can be used as respons eot the suggestedROutes API called once a token and its amount is selected along with a valid recipient."
color: "orange"
wrapMode: Text.WrapAnywhere
}
StatusButton {
enabled: txStore.suggestedRoutesCalled
text: "emit suggestedRoutesReady"
onClicked: {
let txRoutes = {
suggestedRoutes: dummyEventData.suggestesRoutes,
gasTimeEstimate:{
totalFeesInEth:0.0005032000000000001,
totalTokenFees:-0.004508663259772343,
totalTime:2
},
amountToReceive: txStore.amountToSend - (txStore.amountToSend*5/100),
toNetworksModel: dummyEventData.toModel
}
txStore.fromNetworksModel.updateFromNetworks(dummyEventData.suggestesRoutes)
txStore.toNetworksModel.updateToNetworks(dummyEventData.suggestesRoutes)
txStore.walletSectionSendInst.suggestedRoutesReady(txRoutes)
txStore.suggestedRoutesCalled = false
}
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: "grey"
}
StatusBaseText {
Layout.maximumWidth: parent.width
text: "Note: After filling in the preSelected inputs you need to reload the SendModal as per current implementation"
color: "orange"
wrapMode: Text.WrapAnywhere
}
ColumnLayout {
spacing: 0
StatusBaseText {
text:"preSelectedAccount"
}
ComboBox {
textRole: "name"
model: txStore.senderAccounts
onCurrentIndexChanged: loader.preSelectedAccount = txStore.senderAccounts.get(currentIndex)
}
}
ColumnLayout {
spacing: 0
StatusBaseText {
text:"preSelectedHoldingType"
}
ComboBox {
id: tokenType
model: ["Unknown", "Asset", "Collectible"]
onCurrentIndexChanged: loader.preSelectedHoldingType = currentIndex
}
}
StatusInput {
enabled: tokenType.currentIndex !== 0
label: "preSelectedHoldingID (case sensitive)"
onTextChanged: loader.preSelectedHoldingID = text
}
StatusInput {
label: "preDefinedAmountToSend"
onTextChanged: loader.preDefinedAmountToSend = text
}
ColumnLayout {
spacing: 0
StatusBaseText {
text:"preSelectedSendType"
}
ComboBox {
model: ["Transfer",
"ENSRegister",
"ENSRelease",
"ENSSetPubKey",
"StickersBuy",
"Bridge",
"ERC721Transfer",
"Unknown"]
onCurrentIndexChanged: loader.preSelectedSendType = currentIndex
}
}
StatusInput {
label: "preSelectedRecipient"
onTextChanged: loader.preSelectedRecipient = text
}
StatusButton {
text: "Reload popup"
onClicked: {
loader.item.close()
loader.item.open()
}
}
}
} }
} }

View File

@ -294,4 +294,224 @@ QtObject {
} }
]) ])
} }
readonly property var sendFromNetworks: CustomNetworkModel {
function updateFromNetworks(paths){
reset()
for(let i=0; i<paths.length; i++) {
for(let k=0; k<count; k++) {
if(paths[i].fromNetwork.toString() === get(k).chainId.toString()) {
get(k).amountIn = paths[i].amountIn
get(k).toNetworks = get(k).toNetworks + ":" + paths[i].toNetwork
get(k).hasGas = true
get(k).locked = paths[i].amountInLocked
}
}
}
}
function reset() {
for( let j=0; j<count; j++) {
get(j).amountIn = ""
get(j).toNetworks = ""
get(j).hasGas = true
get(j).locked = false
}
}
Component.onCompleted: append([
{
chainId: 1,
chainName: "Ethereum Mainnet",
iconUrl: ModelsData.networks.ethereum,
chainColor: "blue",
shortName: "ETH",
layer: 1,
nativeCurrencyDecimals: 18,
nativeCurrencyName: "Ether",
nativeCurrencySymbol: "ETH",
isEnabled: true,
isPreferred: true,
hasGas: true,
tokenBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 23333213.234
}),
locked: false,
lockedAmount: "",
amountIn: "",
amountOut: "",
toNetworks: ""
},
{
chainId: 10,
chainName: "Optimism",
iconUrl: ModelsData.networks.optimism,
chainColor: "red",
shortName: "OPT",
layer: 2,
nativeCurrencyDecimals: 18,
nativeCurrencyName: "Ether",
nativeCurrencySymbol: "ETH",
isEnabled: true,
isPreferred: true,
hasGas: true,
tokenBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 23333213.234
}),
locked: false,
lockedAmount: "",
amountIn: "",
amountOut: "",
toNetworks: ""
},
{
chainId: 42161,
chainName: "Arbitrum",
iconUrl: ModelsData.networks.arbitrum,
isActive: false,
isEnabled: true,
shortName: "ARB",
chainColor: "purple",
layer: 2,
nativeCurrencyDecimals: 18,
nativeCurrencyName: "Ether",
nativeCurrencySymbol: "ETH",
isEnabled: true,
isPreferred: true,
hasGas: true,
tokenBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 23333213.234
}),
locked: false,
lockedAmount: "",
amountIn: "",
amountOut: "",
toNetworks: ""
}
])
}
readonly property var sendToNetworks: CustomNetworkModel {
function updateRoutePreferredChains(chainIds) {
for( let i=0; i<count; i++) {
get(i).isPreferred = false
get(i).isEnabled = false
if(chainIds.length === 0) {
if(get(i).layer() === 1) {
get(i).isPreferred = true
get(i).isEnabled = true
}
}
else {
for (let k =0;k<chainIds.split(":").length;k++) {
if(get(i).chainId.toString() === chainIds[k].toString()) {
get(i).isPreferred = true
get(i).isEnabled = true
}
}
}
}
}
function updateToNetworks(paths){
reset()
for(let i=0;i<paths.length;i++) {
for( let k=0; k<count; k++) {
if(paths[i].toNetwork.toString() === get(k).chainId.toString()) {
if(!!get(k).amountOut) {
let res = parseInt(get(k).amountOut) + parseInt(paths[i].amountOut)
get(k).amountOut = res.toString()
}
else {
get(k).amountOut = paths[i].amountOut
}
}
}
}
}
function reset() {
for( let j=0; j<count; j++) {
get(j).amountOut = ""
}
}
Component.onCompleted: append([
{
chainId: 1,
chainName: "Ethereum Mainnet",
iconUrl: ModelsData.networks.ethereum,
chainColor: "blue",
shortName: "ETH",
layer: 1,
nativeCurrencyDecimals: 18,
nativeCurrencyName: "Ether",
nativeCurrencySymbol: "ETH",
isEnabled: true,
isPreferred: true,
hasGas: true,
tokenBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 23333213.234
}),
locked: false,
lockedAmount: "",
amountIn: "",
amountOut: "",
toNetworks: ""
},
{
chainId: 10,
chainName: "Optimism",
iconUrl: ModelsData.networks.optimism,
chainColor: "red",
shortName: "OPT",
layer: 2,
nativeCurrencyDecimals: 18,
nativeCurrencyName: "Ether",
nativeCurrencySymbol: "ETH",
isEnabled: true,
isPreferred: true,
hasGas: true,
tokenBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 23333213.234
}),
locked: false,
lockedAmount: "",
amountIn: "",
amountOut: "",
toNetworks: ""
},
{
chainId: 42161,
chainName: "Arbitrum",
iconUrl: ModelsData.networks.arbitrum,
isActive: false,
isEnabled: true,
shortName: "ARB",
chainColor: "purple",
layer: 2,
nativeCurrencyDecimals: 18,
nativeCurrencyName: "Ether",
nativeCurrencySymbol: "ETH",
isEnabled: true,
isPreferred: true,
hasGas: true,
tokenBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 23333213.234
}),
locked: false,
lockedAmount: "",
amountIn: "",
amountOut: "",
toNetworks: ""
}
])
}
} }

View File

@ -10,7 +10,7 @@ ListModel {
amount: 323.3, amount: 323.3,
symbol: "ETH" symbol: "ETH"
}), }),
decimals: 2, decimals: 18,
totalCurrencyBalance: ({ totalCurrencyBalance: ({
displayDecimals: true, displayDecimals: true,
stripTrailingZeroes: true, stripTrailingZeroes: true,
@ -21,7 +21,7 @@ ListModel {
name: "Ethereum", name: "Ethereum",
balances: [ balances: [
{ {
chainId: "chain_1_id", chainId: "1",
balance: { balance: {
displayDecimals: true, displayDecimals: true,
stripTrailingZeroes: true, stripTrailingZeroes: true,
@ -40,7 +40,7 @@ ListModel {
amount: 324343.3, amount: 324343.3,
symbol: "SNT" symbol: "SNT"
}), }),
decimals: 2, decimals: 18,
totalCurrencyBalance: ({ totalCurrencyBalance: ({
displayDecimals: true, displayDecimals: true,
stripTrailingZeroes: true, stripTrailingZeroes: true,
@ -51,7 +51,7 @@ ListModel {
name: "Status", name: "Status",
balances: [ balances: [
{ {
chainId: "chain_1_id", chainId: "1",
balance: { balance: {
displayDecimals: true, displayDecimals: true,
stripTrailingZeroes: true, stripTrailingZeroes: true,
@ -62,6 +62,36 @@ ListModel {
checked: true, checked: true,
allChecked: true allChecked: true
}, },
{
totalRawBalance: "12434330",
totalBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 124343.3,
symbol: "DAI"
}),
decimals: 18,
totalCurrencyBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 53333213.234
}),
visibleForNetwork: true,
symbol: "DAI",
name: "DAI Stablecoin",
balances: [
{
chainId: "1",
balance: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 124343.3
}
}
],
checked: true,
allChecked: true
}
] ]
Component.onCompleted: append(data) Component.onCompleted: append(data)

View File

@ -0,0 +1,61 @@
import QtQuick 2.15
import utils 1.0
ListModel {
property ListModel assetsModel: WalletAssetsModel {}
readonly property var data: [
{
name: "helloworld",
emoji: "😋",
colorId: Constants.walletAccountColors.primary,
color: "#2A4AF5",
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
walletType: "",
position: 0,
assets: assetsModel
},
{
name: "Hot wallet (generated)",
emoji: "🚗",
colorId: Constants.walletAccountColors.army,
color: "#216266",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
walletType: Constants.generatedWalletType,
position: 3,
assets: assetsModel
},
{
name: "Family (seed)",
emoji: "🎨",
colorId: Constants.walletAccountColors.magenta,
color: "#EC266C",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
walletType: Constants.seedWalletType,
position: 1,
assets: assetsModel
},
{
name: "Tag Heuer (watch)",
emoji: "⌚",
colorId: Constants.walletAccountColors.copper,
color: "#CB6256",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883",
walletType: Constants.watchWalletType,
position: 2,
assets: []
},
{
name: "Fab (key)",
emoji: "⌚",
colorId: Constants.walletAccountColors.camel,
color: "#C78F67",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
walletType: Constants.keyWalletType,
position: 4,
assets: assetsModel
}
]
Component.onCompleted: append(data)
}

View File

@ -18,3 +18,4 @@ WalletNestedCollectiblesModel 1.0 WalletNestedCollectiblesModel.qml
singleton ModelsData 1.0 ModelsData.qml singleton ModelsData 1.0 ModelsData.qml
singleton NetworksModel 1.0 NetworksModel.qml singleton NetworksModel 1.0 NetworksModel.qml
singleton PermissionsModel 1.0 PermissionsModel.qml singleton PermissionsModel 1.0 PermissionsModel.qml
WalletSendAccountsModel 1.0 WalletSendAccountsModel.qml

View File

@ -1,3 +1,14 @@
import QtQuick 2.15 import QtQuick 2.15
QtObject {} QtObject {
readonly property string currentCurrency: "USD"
property string currentCurrencySymbol: "$"
function formatCurrencyAmount(amount, symbol, options = null, locale = null) {
return amount
}
function getFiatValue(balance, cryptoSymbol, fiatSymbol) {
return balance
}
}

View File

@ -1,3 +1,257 @@
import QtQuick 2.15 import QtQuick 2.15
QtObject {} import Models 1.0
import utils 1.0
import StatusQ.Core.Utils 0.1
import shared.stores 1.0
QtObject {
id: root
readonly property var currencyStore: CurrenciesStore{}
readonly property var senderAccounts: WalletSendAccountsModel {
Component.onCompleted: selectedSenderAccount = senderAccounts.get(0)
}
property var accounts: senderAccounts
property QtObject tmpActivityController: QtObject {
property ListModel model: ListModel{}
}
property var fromNetworksModel: NetworksModel.sendFromNetworks
property var toNetworksModel: NetworksModel.sendToNetworks
property var selectedSenderAccount: senderAccounts.get(0)
readonly property QtObject collectiblesModel: WalletCollectiblesModel {}
readonly property QtObject nestedCollectiblesModel: WalletNestedCollectiblesModel {}
readonly property QtObject walletSectionSendInst: QtObject {
signal transactionSent(var chainId, var txHash, var uuid, var error)
signal suggestedRoutesReady(var txRoutes)
}
readonly property QtObject mainModuleInst: QtObject {
signal resolvedENS(var resolvedPubKey, var resolvedAddress, var uuid)
}
property string selectedAssetSymbol
property bool showUnPreferredChains: false
property int sendType: Constants.SendType.Transfer
property string selectedRecipient
readonly property var savedAddressesModel: ListModel {
Component.onCompleted: {
for (let i = 0; i < 10; i++)
append({
name: "some saved addr name " + i,
ens: [],
address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b4",
chainShortNames: "eth:arb"
})
}
}
function splitAndFormatAddressPrefix(textAddrss, updateInStore) {
return textAddrss
}
function resolveENS() {
return ""
}
function getAsset(assetsList, symbol) {
const idx = ModelUtils.indexOf(assetsList, "symbol", symbol)
if (idx < 0) {
return {}
}
return ModelUtils.get(assetsList, idx)
}
function getCollectible(uid) {
const idx = ModelUtils.indexOf(collectiblesModel, "uid", uid)
if (idx < 0) {
return {}
}
return ModelUtils.get(collectiblesModel, idx)
}
function getSelectorCollectible(uid) {
const idx = ModelUtils.indexOf(nestedCollectiblesModel, "uid", uid)
if (idx < 0) {
return {}
}
return ModelUtils.get(nestedCollectiblesModel, idx)
}
function getHolding(holdingId, holdingType) {
if (holdingType === Constants.HoldingType.Asset) {
return getAsset(selectedSenderAccount.assets, holdingId)
} else if (holdingType === Constants.HoldingType.Collectible) {
return getCollectible(holdingId)
} else {
return {}
}
}
function getSelectorHolding(holdingId, holdingType) {
if (holdingType === Constants.HoldingType.Asset) {
return getAsset(selectedSenderAccount.assets, holdingId)
} else if (holdingType === Constants.HoldingType.Collectible) {
return getSelectorCollectible(holdingId)
} else {
return {}
}
}
function assetToSelectorAsset(asset) {
return asset
}
function collectibleToSelectorCollectible(collectible) {
return {
uid: collectible.uid,
chainId: collectible.chainId,
name: collectible.name,
iconUrl: collectible.imageUrl,
collectionUid: collectible.collectionUid,
collectionName: collectible.collectionName,
isCollection: false
}
}
function holdingToSelectorHolding(holding, holdingType) {
if (holdingType === Constants.HoldingType.Asset) {
return assetToSelectorAsset(holding)
} else if (holdingType === Constants.HoldingType.Collectible) {
return collectibleToSelectorCollectible(holding)
} else {
return {}
}
}
readonly property string currentCurrency: "USD"
function getAllNetworksSupportedString() {
return "OPT"
}
function plainText(text) {
return text
}
function prepareTransactionsForAddress(address) {
console.log("prepareTransactionsForAddress:", address)
}
function getTransactions() {
return transactions
}
readonly property var transactions_: ListModel {
id: transactions
Component.onCompleted: {
for (let i = 0; i < 10; i++)
append({
to: "to",
loadingTransaction: false,
value: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 3.234
},
timestamp: new Date()
})
}
}
function findTokenSymbolByAddress() {
return "ETH"
}
function switchSenderAccount(index) {
selectedSenderAccount = senderAccounts.get(index)
}
function getNetworkShortNames(chainIds) {
return ""
}
function getShortChainIds(chainIds) {
let listOfChains = chainIds.split(":")
let listOfChainIds = []
for (let k =0;k<listOfChains.length;k++) {
listOfChainIds.push(ModelUtils.getByKey(NetworksModel.allNetworks, "shortName", listOfChains[k], "chainId"))
}
return listOfChainIds
}
function setSendType(sendType) {
root.sendType = sendType
}
function setSelectedRecipient(recipientAddress) {
root.selectedRecipient = recipientAddress
}
function setSelectedAssetSymbol(symbol) {
root.selectedAssetSymbol = symbol
}
function getWei2Eth(wei, decimals) {
return wei/(10**decimals)
}
function updateRoutePreferredChains(chainIds) {
root.toNetworksModel.updateRoutePreferredChains(chainIds)
}
function toggleShowUnPreferredChains() {
root.showUnPreferredChains = !root.showUnPreferredChains
}
property string amountToSend
property bool suggestedRoutesCalled: false
function suggestedRoutes(amount) {
root.amountToSend = amount
root.suggestedRoutesCalled = true
}
enum EstimatedTime {
Unknown = 0,
LessThanOneMin,
LessThanThreeMins,
LessThanFiveMins,
MoreThanFiveMins
}
function getLabelForEstimatedTxTime(estimatedFlag) {
switch(estimatedFlag) {
case TransactionStore.EstimatedTime.Unknown:
return qsTr("~ Unknown")
case TransactionStore.EstimatedTime.LessThanOneMin :
return qsTr("< 1 minute")
case TransactionStore.EstimatedTime.LessThanThreeMins :
return qsTr("< 3 minutes")
case TransactionStore.EstimatedTime.LessThanFiveMins:
return qsTr("< 5 minutes")
default:
return qsTr("> 5 minutes")
}
}
function getNetworkIcon(chainId) {
return ModelUtils.getByKey(NetworksModel.allNetworks, "chainId", Number(chainId), "iconUrl")
}
function resetStoredProperties() {
root.amountToSend = ""
root.sendType = Constants.SendType.Transfer
root.selectedRecipient = ""
root.selectedAssetSymbol = ""
root.showUnPreferredChains = false
root.fromNetworksModel.reset()
root.toNetworksModel.reset()
}
function getNetworkName(chainId) {
return ModelUtils.getByKey(NetworksModel.allNetworks, "chainId", chainId, "chainName")
}
}

View File

@ -63,7 +63,7 @@ StatusSectionLayout {
property Component sendTransactionModalComponent: SendModal { property Component sendTransactionModalComponent: SendModal {
anchors.centerIn: parent anchors.centerIn: parent
preSelectedHolding: store.getAsset(WalletStore.dappBrowserAccount.assets, "ETH") preSelectedHoldingID: "ETH"
preSelectedHoldingType: Constants.HoldingType.Asset preSelectedHoldingType: Constants.HoldingType.Asset
} }

View File

@ -111,14 +111,7 @@ StatusDialog {
// Pre-populated dialog with the relevant Owner token info: // Pre-populated dialog with the relevant Owner token info:
root.sendModalPopup.preSelectedSendType = Constants.SendType.Transfer root.sendModalPopup.preSelectedSendType = Constants.SendType.Transfer
root.sendModalPopup.preSelectedAccount = ModelUtils.getByKey(root.accounts, "address", token.accountAddress) root.sendModalPopup.preSelectedAccount = ModelUtils.getByKey(root.accounts, "address", token.accountAddress)
root.sendModalPopup.preSelectedHolding = { root.sendModalPopup.preSelectedHoldingID = token.key
uid : token.key,
chainId: token.chainId,
name: token.name,
imageUrl: token.artworkSource,
collectionUid: "",
collectionName: ""
}
root.sendModalPopup.preSelectedHoldingType = Constants.HoldingType.Collectible root.sendModalPopup.preSelectedHoldingType = Constants.HoldingType.Collectible
root.sendModalPopup.open() root.sendModalPopup.open()
close() close()

View File

@ -121,7 +121,7 @@ Item {
preSelectedSendType: Constants.SendType.ENSRelease preSelectedSendType: Constants.SendType.ENSRelease
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress() preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0) preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
preSelectedHolding: store.getAsset(releaseEnsModal.store.assets, Constants.ethToken) preSelectedHoldingID: Constants.ethToken
preSelectedHoldingType: Constants.HoldingType.Asset preSelectedHoldingType: Constants.HoldingType.Asset
sendTransaction: function() { sendTransaction: function() {
if(bestRoutes.count === 1) { if(bestRoutes.count === 1) {

View File

@ -66,7 +66,7 @@ Item {
preSelectedSendType: Constants.SendType.ENSSetPubKey preSelectedSendType: Constants.SendType.ENSSetPubKey
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress() preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0) preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
preSelectedHolding: store.getAsset(connectEnsModal.store.assets, Constants.ethToken) preSelectedHoldingID: Constants.ethToken
preSelectedHoldingType: Constants.HoldingType.Asset preSelectedHoldingType: Constants.HoldingType.Asset
sendTransaction: function() { sendTransaction: function() {
if(bestRoutes.count === 1) { if(bestRoutes.count === 1) {

View File

@ -51,7 +51,7 @@ Item {
preSelectedSendType: Constants.SendType.ENSRegister preSelectedSendType: Constants.SendType.ENSRegister
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress() preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(10) preDefinedAmountToSend: LocaleUtils.numberToLocaleString(10)
preSelectedHolding: store.getAsset(buyEnsModal.store.assets, JSON.parse(root.stickersStore.getStatusToken()).symbol) preSelectedHoldingID: JSON.parse(root.stickersStore.getStatusToken()).symbol
preSelectedHoldingType: Constants.HoldingType.Asset preSelectedHoldingType: Constants.HoldingType.Asset
sendTransaction: function() { sendTransaction: function() {
if(bestRoutes.count === 1) { if(bestRoutes.count === 1) {

View File

@ -1381,7 +1381,6 @@ Item {
property var preSelectedAccount property var preSelectedAccount
property var preSelectedRecipient property var preSelectedRecipient
property int preSelectedRecipientType property int preSelectedRecipientType
property var preSelectedHolding
property string preSelectedHoldingID property string preSelectedHoldingID
property int preSelectedHoldingType property int preSelectedHoldingType
property int preSelectedSendType: Constants.SendType.Unknown property int preSelectedSendType: Constants.SendType.Unknown
@ -1395,7 +1394,6 @@ Item {
sendModal.preSelectedSendType = Constants.SendType.Unknown sendModal.preSelectedSendType = Constants.SendType.Unknown
sendModal.preSelectedHoldingID = "" sendModal.preSelectedHoldingID = ""
sendModal.preSelectedHoldingType = Constants.HoldingType.Unknown sendModal.preSelectedHoldingType = Constants.HoldingType.Unknown
sendModal.preSelectedHolding = undefined
sendModal.preSelectedAccount = undefined sendModal.preSelectedAccount = undefined
sendModal.preSelectedRecipient = undefined sendModal.preSelectedRecipient = undefined
sendModal.preDefinedAmountToSend = "" sendModal.preDefinedAmountToSend = ""
@ -1416,9 +1414,6 @@ Item {
item.preSelectedHoldingID = sendModal.preSelectedHoldingID item.preSelectedHoldingID = sendModal.preSelectedHoldingID
item.preSelectedHoldingType = sendModal.preSelectedHoldingType item.preSelectedHoldingType = sendModal.preSelectedHoldingType
} }
if(!!preSelectedHolding) {
item.preSelectedHolding = preSelectedHolding
}
if(preDefinedAmountToSend != "") { if(preDefinedAmountToSend != "") {
item.preDefinedAmountToSend = preDefinedAmountToSend item.preDefinedAmountToSend = preDefinedAmountToSend
} }

View File

@ -6,7 +6,6 @@ import QtGraphicalEffects 1.0
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
import utils 1.0 import utils 1.0
import shared.stores 1.0
import shared.stores.send 1.0 import shared.stores.send 1.0
import StatusQ.Components 0.1 import StatusQ.Components 0.1
@ -24,25 +23,22 @@ import "./views"
StatusDialog { StatusDialog {
id: popup id: popup
property var preSelectedAccount: store.selectedSenderAccount
// expected content depends on the preSelectedRecipientType value. // expected content depends on the preSelectedRecipientType value.
// If type Address this must be a string else it expects an object. See RecipientView.selectedRecipientType // If type Address this must be a string else it expects an object. See RecipientView.selectedRecipientType
property var preSelectedRecipient property var preSelectedRecipient
property int preSelectedRecipientType: TabAddressSelectorView.Type.Address property int preSelectedRecipientType: TabAddressSelectorView.Type.Address
property string preDefinedAmountToSend property string preDefinedAmountToSend
// requires to have assigned an item from assets model
property var preSelectedHolding
// token symbol // token symbol
property string preSelectedHoldingID property string preSelectedHoldingID
property int preSelectedHoldingType property int preSelectedHoldingType
property int preSelectedSendType property int preSelectedSendType
property bool interactive: true property bool interactive: true
property alias onlyAssets: holdingSelector.onlyAssets property alias onlyAssets: holdingSelector.onlyAssets
property var preSelectedAccount: store.selectedSenderAccount
property alias modalHeader: modalHeader.text property alias modalHeader: modalHeader.text
property TransactionStore store: TransactionStore {} property TransactionStore store: TransactionStore {}
property CurrenciesStore currencyStore: store.currencyStore
property var collectiblesModel: store.collectiblesModel property var collectiblesModel: store.collectiblesModel
property var nestedCollectiblesModel: store.nestedCollectiblesModel property var nestedCollectiblesModel: store.nestedCollectiblesModel
property var bestRoutes property var bestRoutes
@ -70,6 +66,7 @@ StatusDialog {
QtObject { QtObject {
id: d id: d
readonly property var currencyStore: store.currencyStore
readonly property int errorType: !amountToSendInput.input.valid && !isERC721Transfer ? Constants.SendAmountExceedsBalance : readonly property int errorType: !amountToSendInput.input.valid && !isERC721Transfer ? Constants.SendAmountExceedsBalance :
(popup.bestRoutes && popup.bestRoutes.count === 0 && (popup.bestRoutes && popup.bestRoutes.count === 0 &&
!!amountToSendInput.input.text && recipientLoader.ready && !popup.isLoading) ? !!amountToSendInput.input.text && recipientLoader.ready && !popup.isLoading) ?
@ -77,7 +74,7 @@ StatusDialog {
readonly property double maxFiatBalance: isSelectedHoldingValidAsset ? selectedHolding.totalCurrencyBalance.amount : 0 readonly property double maxFiatBalance: isSelectedHoldingValidAsset ? selectedHolding.totalCurrencyBalance.amount : 0
readonly property double maxCryptoBalance: isSelectedHoldingValidAsset ? selectedHolding.totalBalance.amount : 0 readonly property double maxCryptoBalance: isSelectedHoldingValidAsset ? selectedHolding.totalBalance.amount : 0
readonly property double maxInputBalance: amountToSendInput.inputIsFiat ? maxFiatBalance : maxCryptoBalance readonly property double maxInputBalance: amountToSendInput.inputIsFiat ? maxFiatBalance : maxCryptoBalance
readonly property string inputSymbol: amountToSendInput.inputIsFiat ? popup.currencyStore.currentCurrency : store.selectedAssetSymbol readonly property string inputSymbol: amountToSendInput.inputIsFiat ? currencyStore.currentCurrency : store.selectedAssetSymbol
readonly property bool errorMode: popup.isLoading || !recipientLoader.ready ? false : errorType !== Constants.NoError || networkSelector.errorMode || !amountToSendInput.inputNumberValid readonly property bool errorMode: popup.isLoading || !recipientLoader.ready ? false : errorType !== Constants.NoError || networkSelector.errorMode || !amountToSendInput.inputNumberValid
readonly property string uuid: Utils.uuid() readonly property string uuid: Utils.uuid()
property bool isPendingTx: false property bool isPendingTx: false
@ -149,9 +146,7 @@ StatusDialog {
if (popup.preSelectedHoldingType !== Constants.HoldingType.Unknown) { if (popup.preSelectedHoldingType !== Constants.HoldingType.Unknown) {
tokenListRect.browsingHoldingType = popup.preSelectedHoldingType tokenListRect.browsingHoldingType = popup.preSelectedHoldingType
if(!!popup.preSelectedHolding) { if (!!popup.preSelectedHoldingID) {
d.setSelectedHolding(popup.preSelectedHolding, popup.preSelectedHoldingType)
} else if (!!popup.preSelectedHoldingID) {
d.setSelectedHoldingId(popup.preSelectedHoldingID, popup.preSelectedHoldingType) d.setSelectedHoldingId(popup.preSelectedHoldingID, popup.preSelectedHoldingType)
} }
} }
@ -252,11 +247,11 @@ StatusDialog {
Layout.fillHeight: true Layout.fillHeight: true
assetsModel: popup.preSelectedAccount && popup.preSelectedAccount.assets ? popup.preSelectedAccount.assets : null assetsModel: popup.preSelectedAccount && popup.preSelectedAccount.assets ? popup.preSelectedAccount.assets : null
collectiblesModel: popup.preSelectedAccount ? popup.nestedCollectiblesModel : null collectiblesModel: popup.preSelectedAccount ? popup.nestedCollectiblesModel : null
currentCurrencySymbol: RootStore.currencyStore.currentCurrencySymbol currentCurrencySymbol: d.currencyStore.currentCurrencySymbol
visible: (!!d.selectedHolding && d.selectedHoldingType !== Constants.HoldingType.Unknown) || visible: (!!d.selectedHolding && d.selectedHoldingType !== Constants.HoldingType.Unknown) ||
(!!d.hoveredHolding && d.hoveredHoldingType !== Constants.HoldingType.Unknown) (!!d.hoveredHolding && d.hoveredHoldingType !== Constants.HoldingType.Unknown)
getNetworkIcon: function(chainId){ getNetworkIcon: function(chainId){
return RootStore.getNetworkIcon(chainId) return popup.store.getNetworkIcon(chainId)
} }
onItemSelected: { onItemSelected: {
d.setSelectedHoldingId(holdingId, holdingType) d.setSelectedHoldingId(holdingId, holdingType)
@ -269,12 +264,12 @@ StatusDialog {
visible: d.isSelectedHoldingValidAsset || d.isHoveredHoldingValidAsset && !d.isERC721Transfer visible: d.isSelectedHoldingValidAsset || d.isHoveredHoldingValidAsset && !d.isERC721Transfer
title: { title: {
if(d.isHoveredHoldingValidAsset && !!d.hoveredHolding.symbol) { if(d.isHoveredHoldingValidAsset && !!d.hoveredHolding.symbol) {
const balance = popup.currencyStore.formatCurrencyAmount((amountToSendInput.inputIsFiat ? d.hoveredHolding.totalCurrencyBalance.amount : d.hoveredHolding.totalBalance.amount) , d.hoveredHolding.symbol) const balance = d.currencyStore.formatCurrencyAmount((amountToSendInput.inputIsFiat ? d.hoveredHolding.totalCurrencyBalance.amount : d.hoveredHolding.totalBalance.amount) , d.hoveredHolding.symbol)
return qsTr("Max: %1").arg(balance) return qsTr("Max: %1").arg(balance)
} }
if (d.maxInputBalance <= 0) if (d.maxInputBalance <= 0)
return qsTr("No balances active") return qsTr("No balances active")
const balance = popup.currencyStore.formatCurrencyAmount(d.maxInputBalance, d.inputSymbol) const balance = d.currencyStore.formatCurrencyAmount(d.maxInputBalance, d.inputSymbol)
return qsTr("Max: %1").arg(balance) return qsTr("Max: %1").arg(balance)
} }
tagClickable: true tagClickable: true
@ -283,7 +278,7 @@ StatusDialog {
bgColor: amountToSendInput.input.valid || !amountToSendInput.input.text ? Theme.palette.primaryColor3 : Theme.palette.dangerColor2 bgColor: amountToSendInput.input.valid || !amountToSendInput.input.text ? Theme.palette.primaryColor3 : Theme.palette.dangerColor2
titleText.color: amountToSendInput.input.valid || !amountToSendInput.input.text ? Theme.palette.primaryColor1 : Theme.palette.dangerColor1 titleText.color: amountToSendInput.input.valid || !amountToSendInput.input.text ? Theme.palette.primaryColor1 : Theme.palette.dangerColor1
onTagClicked: { onTagClicked: {
amountToSendInput.input.text = popup.currencyStore.formatCurrencyAmount(d.maxInputBalance, d.inputSymbol, {noSymbol: true, rawAmount: true}, LocaleUtils.userInputLocale) amountToSendInput.input.text = d.currencyStore.formatCurrencyAmount(d.maxInputBalance, d.inputSymbol, {noSymbol: true, rawAmount: true}, LocaleUtils.userInputLocale)
} }
} }
} }
@ -297,21 +292,21 @@ StatusDialog {
interactive: popup.interactive interactive: popup.interactive
selectedSymbol: store.selectedAssetSymbol selectedSymbol: store.selectedAssetSymbol
maxInputBalance: d.maxInputBalance maxInputBalance: d.maxInputBalance
currentCurrency: popup.currencyStore.currentCurrency currentCurrency: d.currencyStore.currentCurrency
multiplierIndex: holdingSelector.selectedItem multiplierIndex: holdingSelector.selectedItem
? holdingSelector.selectedItem.decimals ? holdingSelector.selectedItem.decimals
: 0 : 0
getFiatValue: function(cryptoValue) { getFiatValue: function(cryptoValue) {
return selectedSymbol ? popup.currencyStore.getFiatValue(cryptoValue, selectedSymbol, currentCurrency) : 0.0 return selectedSymbol ? d.currencyStore.getFiatValue(cryptoValue, selectedSymbol, currentCurrency) : 0.0
} }
getCryptoValue: function(fiatValue) { getCryptoValue: function(fiatValue) {
return selectedSymbol ? popup.currencyStore.getCryptoValue(fiatValue, selectedSymbol, currentCurrency) : 0.0 return selectedSymbol ? d.currencyStore.getCryptoValue(fiatValue, selectedSymbol, currentCurrency) : 0.0
} }
formatCurrencyAmount: popup.currencyStore.formatCurrencyAmount formatCurrencyAmount: d.currencyStore.formatCurrencyAmount
onReCalculateSuggestedRoute: popup.recalculateRoutesAndFees() onReCalculateSuggestedRoute: popup.recalculateRoutesAndFees()
} }
@ -331,11 +326,11 @@ StatusDialog {
inputIsFiat: amountToSendInput.inputIsFiat inputIsFiat: amountToSendInput.inputIsFiat
minCryptoDecimals: amountToSendInput.minReceiveCryptoDecimals minCryptoDecimals: amountToSendInput.minReceiveCryptoDecimals
minFiatDecimals: amountToSendInput.minReceiveFiatDecimals minFiatDecimals: amountToSendInput.minReceiveFiatDecimals
currentCurrency: popup.currencyStore.currentCurrency currentCurrency: d.currencyStore.currentCurrency
getFiatValue: function(cryptoValue) { getFiatValue: function(cryptoValue) {
return popup.currencyStore.getFiatValue(cryptoValue, selectedSymbol, currentCurrency) return d.currencyStore.getFiatValue(cryptoValue, selectedSymbol, currentCurrency)
} }
formatCurrencyAmount: popup.currencyStore.formatCurrencyAmount formatCurrencyAmount: d.currencyStore.formatCurrencyAmount
} }
} }
} }
@ -383,7 +378,7 @@ StatusDialog {
return store.findTokenSymbolByAddress(address) return store.findTokenSymbolByAddress(address)
} }
getNetworkIcon: function(chainId){ getNetworkIcon: function(chainId){
return RootStore.getNetworkIcon(chainId) return popup.store.getNetworkIcon(chainId)
} }
onTokenSelected: { onTokenSelected: {
d.setSelectedHoldingId(symbol, holdingType) d.setSelectedHoldingId(symbol, holdingType)
@ -486,7 +481,7 @@ StatusDialog {
footer: SendModalFooter { footer: SendModalFooter {
width: parent.width width: parent.width
nextButtonText: d.isBridgeTx ? qsTr("Bridge") : qsTr("Send") nextButtonText: d.isBridgeTx ? qsTr("Bridge") : qsTr("Send")
maxFiatFees: popup.isLoading ? "..." : popup.currencyStore.formatCurrencyAmount(d.totalFeesInFiat, popup.currencyStore.currentCurrency) maxFiatFees: popup.isLoading ? "..." : d.currencyStore.formatCurrencyAmount(d.totalFeesInFiat, d.currencyStore.currentCurrency)
totalTimeEstimate: popup.isLoading? "..." : d.totalTimeEstimate totalTimeEstimate: popup.isLoading? "..." : d.totalTimeEstimate
pending: d.isPendingTx || popup.isLoading pending: d.isPendingTx || popup.isLoading
visible: recipientLoader.ready && amountToSendInput.inputNumberValid && !d.errorMode visible: recipientLoader.ready && amountToSendInput.inputNumberValid && !d.errorMode
@ -499,8 +494,8 @@ StatusDialog {
popup.bestRoutes = txRoutes.suggestedRoutes popup.bestRoutes = txRoutes.suggestedRoutes
let gasTimeEstimate = txRoutes.gasTimeEstimate let gasTimeEstimate = txRoutes.gasTimeEstimate
d.totalTimeEstimate = popup.store.getLabelForEstimatedTxTime(gasTimeEstimate.totalTime) d.totalTimeEstimate = popup.store.getLabelForEstimatedTxTime(gasTimeEstimate.totalTime)
d.totalFeesInFiat = popup.currencyStore.getFiatValue( gasTimeEstimate.totalFeesInEth, "ETH", popup.currencyStore.currentCurrency) + d.totalFeesInFiat = d.currencyStore.getFiatValue( gasTimeEstimate.totalFeesInEth, "ETH", d.currencyStore.currentCurrency) +
popup.currencyStore.getFiatValue(gasTimeEstimate.totalTokenFees, fees.selectedTokenSymbol, popup.currencyStore.currentCurrency) d.currencyStore.getFiatValue(gasTimeEstimate.totalTokenFees, fees.selectedTokenSymbol, d.currencyStore.currentCurrency)
d.totalAmountToReceive = popup.store.getWei2Eth(txRoutes.amountToReceive, d.selectedHolding.decimals) d.totalAmountToReceive = popup.store.getWei2Eth(txRoutes.amountToReceive, d.selectedHolding.decimals)
networkSelector.toNetworksList = txRoutes.toNetworksModel networkSelector.toNetworksList = txRoutes.toNetworksModel
popup.isLoading = false popup.isLoading = false

View File

@ -203,7 +203,7 @@ Item {
preSelectedSendType: Constants.SendType.StickersBuy preSelectedSendType: Constants.SendType.StickersBuy
preSelectedRecipient: root.store.stickersStore.getStickersMarketAddress() preSelectedRecipient: root.store.stickersStore.getStickersMarketAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price)) preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
preSelectedHolding: store.getAsset(buyStickersModal.store.assets, JSON.parse(root.store.stickersStore.getStatusToken()).symbol) preSelectedHoldingID: JSON.parse(root.store.stickersStore.getStatusToken()).symbol
preSelectedHoldingType: Constants.HoldingType.Asset preSelectedHoldingType: Constants.HoldingType.Asset
sendTransaction: function() { sendTransaction: function() {
if(bestRoutes.count === 1) { if(bestRoutes.count === 1) {

View File

@ -72,7 +72,7 @@ ModalPopup {
preSelectedSendType: Constants.SendType.StickersBuy preSelectedSendType: Constants.SendType.StickersBuy
preSelectedRecipient: stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress() preSelectedRecipient: stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price)) preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
preSelectedHolding: store.getAsset(buyStickersPackModal.store.assets, JSON.parse(stickerPackDetailsPopup.store.stickersStore.getStatusToken()).symbol) preSelectedHoldingID: JSON.parse(stickerPackDetailsPopup.store.stickersStore.getStatusToken()).symbol
preSelectedHoldingType: Constants.HoldingType.Asset preSelectedHoldingType: Constants.HoldingType.Asset
sendTransaction: function() { sendTransaction: function() {
if(bestRoutes.count === 1) { if(bestRoutes.count === 1) {

View File

@ -246,4 +246,8 @@ QtObject {
function getShortChainIds(chainShortNames) { function getShortChainIds(chainShortNames) {
return walletSectionSendInst.getShortChainIds(chainShortNames) return walletSectionSendInst.getShortChainIds(chainShortNames)
} }
function getNetworkIcon(chainId) {
return walletSectionSendInst.getIconUrl(chainId)
}
} }