chore(@desktop/wallet): Show option for in network (#12199)
This commit is contained in:
parent
82a5147bb5
commit
58ccb01b76
|
@ -64,17 +64,19 @@ StatusMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshShowOnActionsVisiblity(shortChainName) {
|
function refreshShowOnActionsVisiblity(shortChainNameList) {
|
||||||
switch(shortChainName.toLowerCase()) {
|
for (let i = 0 ; i < shortChainNameList.length ; i++) {
|
||||||
case Constants.networkShortChainNames.arbiscan.toLowerCase():
|
switch(shortChainNameList[i].toLowerCase()) {
|
||||||
showOnArbiscanAction.enabled = true
|
case Constants.networkShortChainNames.arbiscan.toLowerCase():
|
||||||
break
|
showOnArbiscanAction.enabled = true
|
||||||
case Constants.networkShortChainNames.optimism.toLowerCase():
|
break
|
||||||
showOnOptimismAction.enabled = true
|
case Constants.networkShortChainNames.optimism.toLowerCase():
|
||||||
break
|
showOnOptimismAction.enabled = true
|
||||||
default:
|
break
|
||||||
showOnEtherscanAction.enabled = true
|
default:
|
||||||
break
|
showOnEtherscanAction.enabled = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,17 +102,17 @@ StatusMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openSenderMenu(delegate, address, chainShortName = "") {
|
function openSenderMenu(delegate, address, chainShortNameList = []) {
|
||||||
d.addressType = TransactionAddressMenu.AddressType.Sender
|
d.addressType = TransactionAddressMenu.AddressType.Sender
|
||||||
openEthAddressMenu(delegate, address, chainShortName)
|
openEthAddressMenu(delegate, address, chainShortNameList)
|
||||||
}
|
}
|
||||||
|
|
||||||
function openReceiverMenu(delegate, address, chainShortName = "") {
|
function openReceiverMenu(delegate, address, chainShortNameList = []) {
|
||||||
d.addressType = TransactionAddressMenu.AddressType.Receiver
|
d.addressType = TransactionAddressMenu.AddressType.Receiver
|
||||||
openEthAddressMenu(delegate, address, chainShortName)
|
openEthAddressMenu(delegate, address, chainShortNameList)
|
||||||
}
|
}
|
||||||
|
|
||||||
function openEthAddressMenu(delegate, address, chainShortName = "") {
|
function openEthAddressMenu(delegate, address, chainShortNameList = []) {
|
||||||
d.selectedAddress = address
|
d.selectedAddress = address
|
||||||
|
|
||||||
address = address.toLowerCase()
|
address = address.toLowerCase()
|
||||||
|
@ -135,6 +137,7 @@ StatusMenu {
|
||||||
showOnEtherscanAction.enabled = true
|
showOnEtherscanAction.enabled = true
|
||||||
showOnArbiscanAction.enabled = address.includes(Constants.networkShortChainNames.arbiscan + ":")
|
showOnArbiscanAction.enabled = address.includes(Constants.networkShortChainNames.arbiscan + ":")
|
||||||
showOnOptimismAction.enabled = address.includes(Constants.networkShortChainNames.optimism + ":")
|
showOnOptimismAction.enabled = address.includes(Constants.networkShortChainNames.optimism + ":")
|
||||||
|
d.refreshShowOnActionsVisiblity(chainShortNameList)
|
||||||
saveAddressAction.enabled = d.addressName.length === 0
|
saveAddressAction.enabled = d.addressName.length === 0
|
||||||
editAddressAction.enabled = !isWalletAccount && !isContact && d.addressName.length > 0
|
editAddressAction.enabled = !isWalletAccount && !isContact && d.addressName.length > 0
|
||||||
sendToAddressAction.enabled = true
|
sendToAddressAction.enabled = true
|
||||||
|
@ -143,18 +146,18 @@ StatusMenu {
|
||||||
d.openMenu(delegate)
|
d.openMenu(delegate)
|
||||||
}
|
}
|
||||||
|
|
||||||
function openTxMenu(delegate, address, chainShortName="") {
|
function openTxMenu(delegate, address, chainShortNameList=[]) {
|
||||||
d.addressType = TransactionAddressMenu.AddressType.Tx
|
d.addressType = TransactionAddressMenu.AddressType.Tx
|
||||||
d.selectedAddress = address
|
d.selectedAddress = address
|
||||||
d.refreshShowOnActionsVisiblity(chainShortName)
|
d.refreshShowOnActionsVisiblity(chainShortNameList)
|
||||||
d.openMenu(delegate)
|
d.openMenu(delegate)
|
||||||
}
|
}
|
||||||
|
|
||||||
function openContractMenu(delegate, address, chainShortName="", name="") {
|
function openContractMenu(delegate, address, chainShortNameList=[], name="") {
|
||||||
d.addressType = TransactionAddressMenu.AddressType.Contract
|
d.addressType = TransactionAddressMenu.AddressType.Contract
|
||||||
d.contractName = name
|
d.contractName = name
|
||||||
d.selectedAddress = address
|
d.selectedAddress = address
|
||||||
d.refreshShowOnActionsVisiblity(chainShortName)
|
d.refreshShowOnActionsVisiblity(chainShortNameList)
|
||||||
d.openMenu(delegate)
|
d.openMenu(delegate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ Item {
|
||||||
readonly property int blockNumber: isDetailsValid ? details.blockNumber : 0
|
readonly property int blockNumber: isDetailsValid ? details.blockNumber : 0
|
||||||
readonly property int toBlockNumber: 0 // TODO fill when bridge data is implemented
|
readonly property int toBlockNumber: 0 // TODO fill when bridge data is implemented
|
||||||
readonly property string networkShortNameOut: networkShortName
|
readonly property string networkShortNameOut: networkShortName
|
||||||
readonly property string networkShortNameIn: transactionHeader.isMultiTransaction ? RootStore.getNetworkShortName(transaction.chainIdOut) : ""
|
readonly property string networkShortNameIn: transactionHeader.isMultiTransaction ? RootStore.getNetworkShortName(transaction.chainIdIn) : ""
|
||||||
readonly property string symbol: isTransactionValid ? transaction.symbol : ""
|
readonly property string symbol: isTransactionValid ? transaction.symbol : ""
|
||||||
readonly property string inSymbol: isTransactionValid ? transaction.inSymbol : ""
|
readonly property string inSymbol: isTransactionValid ? transaction.inSymbol : ""
|
||||||
readonly property string outSymbol: isTransactionValid ? transaction.outSymbol : ""
|
readonly property string outSymbol: isTransactionValid ? transaction.outSymbol : ""
|
||||||
|
@ -282,9 +282,9 @@ Item {
|
||||||
rootStore: WalletStores.RootStore
|
rootStore: WalletStores.RootStore
|
||||||
onButtonClicked: {
|
onButtonClicked: {
|
||||||
if (d.transactionType === Constants.TransactionType.Swap || d.transactionType === Constants.TransactionType.Bridge) {
|
if (d.transactionType === Constants.TransactionType.Swap || d.transactionType === Constants.TransactionType.Bridge) {
|
||||||
addressMenu.openEthAddressMenu(this, addresses[0], d.networkShortNameOut)
|
addressMenu.openEthAddressMenu(this, addresses[0], [d.networkShortNameIn, d.networkShortNameOut])
|
||||||
} else {
|
} else {
|
||||||
addressMenu.openSenderMenu(this, addresses[0], d.networkShortName)
|
addressMenu.openSenderMenu(this, addresses[0], [d.networkShortName])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ Item {
|
||||||
}
|
}
|
||||||
buttonIconName: hasValue ? "more" : ""
|
buttonIconName: hasValue ? "more" : ""
|
||||||
statusListItemSubTitle.customColor: hasValue ? Theme.palette.directColor1 : Theme.palette.directColor5
|
statusListItemSubTitle.customColor: hasValue ? Theme.palette.directColor1 : Theme.palette.directColor5
|
||||||
onButtonClicked: addressMenu.openContractMenu(this, d.details.contract, transactionHeader.networkName, d.symbol)
|
onButtonClicked: addressMenu.openContractMenu(this, d.details.contract, [d.networkShortName], d.symbol)
|
||||||
components: [
|
components: [
|
||||||
Loader {
|
Loader {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
@ -323,7 +323,7 @@ Item {
|
||||||
addresses: root.isTransactionValid && visible ? [root.transaction.recipient] : []
|
addresses: root.isTransactionValid && visible ? [root.transaction.recipient] : []
|
||||||
contactsStore: root.contactsStore
|
contactsStore: root.contactsStore
|
||||||
rootStore: WalletStores.RootStore
|
rootStore: WalletStores.RootStore
|
||||||
onButtonClicked: addressMenu.openReceiverMenu(this, addresses[0], d.networkShortName)
|
onButtonClicked: addressMenu.openReceiverMenu(this, addresses[0], [d.networkShortName])
|
||||||
visible: d.transactionType !== Constants.TransactionType.ContractDeployment && d.transactionType !== Constants.TransactionType.Swap && d.transactionType !== Constants.TransactionType.Bridge && d.transactionType !== Constants.TransactionType.Destroy
|
visible: d.transactionType !== Constants.TransactionType.ContractDeployment && d.transactionType !== Constants.TransactionType.Swap && d.transactionType !== Constants.TransactionType.Bridge && d.transactionType !== Constants.TransactionType.Destroy
|
||||||
}
|
}
|
||||||
TransactionDataTile {
|
TransactionDataTile {
|
||||||
|
@ -341,7 +341,7 @@ Item {
|
||||||
subTitle: d.isDetailsValid ? d.details.txHash : ""
|
subTitle: d.isDetailsValid ? d.details.txHash : ""
|
||||||
visible: !!subTitle
|
visible: !!subTitle
|
||||||
buttonIconName: "more"
|
buttonIconName: "more"
|
||||||
onButtonClicked: addressMenu.openTxMenu(this, subTitle, d.networkShortName)
|
onButtonClicked: addressMenu.openTxMenu(this, subTitle, [d.networkShortName])
|
||||||
}
|
}
|
||||||
TransactionDataTile {
|
TransactionDataTile {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -349,7 +349,7 @@ Item {
|
||||||
subTitle: "" // TODO fill tx hash for Bridge
|
subTitle: "" // TODO fill tx hash for Bridge
|
||||||
visible: !!subTitle
|
visible: !!subTitle
|
||||||
buttonIconName: "more"
|
buttonIconName: "more"
|
||||||
onButtonClicked: addressMenu.openTxMenu(this, subTitle, d.networkShortNameIn)
|
onButtonClicked: addressMenu.openTxMenu(this, subTitle, [d.networkShortNameIn])
|
||||||
}
|
}
|
||||||
TransactionContractTile {
|
TransactionContractTile {
|
||||||
// Used for Bridge and Swap to display 'From' network Protocol contract address
|
// Used for Bridge and Swap to display 'From' network Protocol contract address
|
||||||
|
|
|
@ -232,7 +232,7 @@ QtObject {
|
||||||
|
|
||||||
function getFeeEthValue(feeCurrency) {
|
function getFeeEthValue(feeCurrency) {
|
||||||
if (!feeCurrency || feeCurrency.symbol !== "Gwei")
|
if (!feeCurrency || feeCurrency.symbol !== "Gwei")
|
||||||
return qsTr("N/A")
|
return 0
|
||||||
return currencyStore.getGasEthValue(feeCurrency.amount / Math.pow(10, feeCurrency.displayDecimals), 1)
|
return currencyStore.getGasEthValue(feeCurrency.amount / Math.pow(10, feeCurrency.displayDecimals), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue