fix(Browser): Add new send modal

Closes: #5475
This commit is contained in:
Boris Melnik 2022-04-12 12:10:55 +03:00
parent 630c2359d2
commit 991e04ef95
2 changed files with 35 additions and 23 deletions

View File

@ -152,28 +152,28 @@ Rectangle {
return _internal.accessDialogComponent.createObject(browserWindow) return _internal.accessDialogComponent.createObject(browserWindow)
} }
createSendTransactionModalComponent: function(request) { createSendTransactionModalComponent: function(request) {
return _internal.sendTransactionModalComponent.createObject(browserWindow, { browserWindow.sendTransactionModal.selectedAccount = {
trxData: request.payload.params[0].data || "", name: WalletStore.dappBrowserAccount.name,
selectedAccount: { address: request.payload.params[0].from,
name: WalletStore.dappBrowserAccount.name, iconColor: WalletStore.dappBrowserAccount.color,
address: request.payload.params[0].from, assets: WalletStore.dappBrowserAccount.assets
iconColor: WalletStore.dappBrowserAccount.color, }
assets: WalletStore.dappBrowserAccount.assets browserWindow.sendTransactionModal.selectedRecipient = {
}, address: request.payload.params[0].to,
selectedRecipient: { identicon: "",
address: request.payload.params[0].to, name: RootStore.activeChannelName,
identicon: "", type: RecipientSelector.Type.Address
name: RootStore.activeChannelName, }
type: RecipientSelector.Type.Address
}, browserWindow.sendTransactionModal.selectedAmountAsset = {
selectedAsset: { name: "ETH",
name: "ETH", symbol: "ETH",
symbol: "ETH", address: Constants.zeroAddress
address: Constants.zeroAddress }
}, browserWindow.sendTransactionModal.selectedAmount = RootStore.getWei2Eth(request.payload.params[0].value, 18)
selectedFiatAmount: "42", // TODO calculate that
selectedAmount: RootStore.getWei2Eth(request.payload.params[0].value, 18)
}) browserWindow.sendTransactionModal.open()
} }
createSignMessageModalComponent: function(request) { createSignMessageModalComponent: function(request) {
return _internal.signMessageModalComponent.createObject(browserWindow, { return _internal.signMessageModalComponent.createObject(browserWindow, {

View File

@ -800,6 +800,9 @@ Item {
this.active = false this.active = false
} }
property var selectedAccount property var selectedAccount
property var selectedRecipient
property var selectedAmount
property var selectedAmountAsset
sourceComponent: SendModal { sourceComponent: SendModal {
anchors.centerIn: parent anchors.centerIn: parent
store: appMain.rootStore store: appMain.rootStore
@ -813,9 +816,18 @@ Item {
} }
} }
onLoaded: { onLoaded: {
if(!!sendModal.selectedAccount) { if (!!sendModal.selectedAccount) {
item.preSelectedAccount = sendModal.selectedAccount item.preSelectedAccount = sendModal.selectedAccount
} }
if (!!sendModal.selectedRecipient) {
item.preSelectedRecipient = sendModal.selectedRecipient
}
if (!!sendModal.selectedAmount) {
item.advancedHeader.amountToSendInput.text = sendModal.selectedAmount
}
if (!!sendModal.selectedAmountAsset) {
item.advancedHeader.assetSelector.selectedAsset = sendModal.selectedAmountAsset
}
} }
} }