wip: parse swap
This commit is contained in:
parent
558e99c990
commit
33da74a079
|
@ -137,10 +137,15 @@ proc `$`*(contactUrlDataDto: ContactUrlDataDto): string =
|
||||||
jsonObj["publicKey"] = %* contactUrlDataDto.publicKey
|
jsonObj["publicKey"] = %* contactUrlDataDto.publicKey
|
||||||
return $jsonObj
|
return $jsonObj
|
||||||
|
|
||||||
|
proc `%`*(transactionURLData: TransactionURLDataDto): JsonNode =
|
||||||
|
return %* [{
|
||||||
|
"txType": transactionURLData.txType,
|
||||||
|
"asset": transactionURLData.asset,
|
||||||
|
"amount": transactionURLData.amount,
|
||||||
|
"address": transactionURLData.address,
|
||||||
|
"chainId": transactionURLData.chainId,
|
||||||
|
"toAsset": transactionURLData.toAsset,
|
||||||
|
}]
|
||||||
|
|
||||||
proc `$`*(transactionURLData: TransactionURLDataDto): string =
|
proc `$`*(transactionURLData: TransactionURLDataDto): string =
|
||||||
var jsonObj = newJObject()
|
return $(%transactionURLData)
|
||||||
jsonObj["txType"] = %* transactionURLData.txType
|
|
||||||
jsonObj["asset"] = %* transactionURLData.asset
|
|
||||||
jsonObj["amount"] = %* transactionURLData.amount
|
|
||||||
jsonObj["address"] = %* transactionURLData.address
|
|
||||||
return $jsonObj
|
|
|
@ -151,7 +151,7 @@ StatusDialog {
|
||||||
id: shareButton
|
id: shareButton
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const url = root.swapAdaptor.getShareTransactionUrl(Constants.SendType.Swap,
|
const url = root.swapAdaptor.swapStore.getShareTransactionUrl(Constants.SendType.Swap,
|
||||||
root.swapInputParamsForm.fromTokensKey,
|
root.swapInputParamsForm.fromTokensKey,
|
||||||
root.swapInputParamsForm.fromTokenAmount,
|
root.swapInputParamsForm.fromTokenAmount,
|
||||||
root.swapInputParamsForm.selectedAccountAddress,
|
root.swapInputParamsForm.selectedAccountAddress,
|
||||||
|
|
|
@ -43,6 +43,7 @@ import AppLayouts.Chat.stores 1.0 as ChatStores
|
||||||
import AppLayouts.Communities.stores 1.0
|
import AppLayouts.Communities.stores 1.0
|
||||||
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
||||||
import AppLayouts.Wallet.popups 1.0 as WalletPopups
|
import AppLayouts.Wallet.popups 1.0 as WalletPopups
|
||||||
|
import AppLayouts.Wallet.popups.swap 1.0 as WalletSwapPopups
|
||||||
|
|
||||||
import mainui.activitycenter.stores 1.0
|
import mainui.activitycenter.stores 1.0
|
||||||
import mainui.activitycenter.popups 1.0
|
import mainui.activitycenter.popups 1.0
|
||||||
|
@ -386,7 +387,12 @@ Item {
|
||||||
console.log("=========== onShowTransactionModal txType:", txType, "asset:", asset, "amount:", amount, "address:", address, "chainId:", chainId, "toAsset:", toAsset)
|
console.log("=========== onShowTransactionModal txType:", txType, "asset:", asset, "amount:", amount, "address:", address, "chainId:", chainId, "toAsset:", toAsset)
|
||||||
|
|
||||||
if (txType === Constants.SendType.Swap) {
|
if (txType === Constants.SendType.Swap) {
|
||||||
// TODO_ES implement
|
d.swapFormData.fromTokensKey = asset
|
||||||
|
d.swapFormData.toTokenKey = toAsset
|
||||||
|
d.swapFormData.fromTokenAmount = amount
|
||||||
|
d.swapFormData.selectedAccountAddress = address
|
||||||
|
d.swapFormData.selectedNetworkChainId = chainId
|
||||||
|
Global.openSwapModalRequested(d.swapFormData)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,16 +406,12 @@ Item {
|
||||||
case Constants.SendType.ERC1155Transfer:
|
case Constants.SendType.ERC1155Transfer:
|
||||||
sendModal.preSelectedHoldingType = Constants.TokenType.ERC1155
|
sendModal.preSelectedHoldingType = Constants.TokenType.ERC1155
|
||||||
break
|
break
|
||||||
case Constants.SendType.Transfer:
|
case Constants.SendType.ENSRegister:
|
||||||
sendModal.preSelectedHoldingType = Constants.TokenType.ERC20
|
|
||||||
break
|
|
||||||
case Constants.SendType.ENSRegister: // TODO_ES test ens
|
|
||||||
case Constants.SendType.ENSSetPubKey:
|
case Constants.SendType.ENSSetPubKey:
|
||||||
case Constants.SendType.ENSRelease:
|
case Constants.SendType.ENSRelease:
|
||||||
sendModal.preSelectedHoldingType = Constants.TokenType.ENS
|
case Constants.SendType.Transfer:
|
||||||
break
|
|
||||||
case Constants.SendType.StickersBuy:
|
case Constants.SendType.StickersBuy:
|
||||||
// TOOD_ES handle
|
sendModal.preSelectedHoldingType = Constants.TokenType.ERC20
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -421,6 +423,10 @@ Item {
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
|
||||||
|
property WalletSwapPopups.SwapInputParamsForm swapFormData: WalletSwapPopups.SwapInputParamsForm {
|
||||||
|
selectedAccountAddress: WalletStores.RootStore.selectedAddress
|
||||||
|
}
|
||||||
|
|
||||||
property var activityCenterPopupObj: null
|
property var activityCenterPopupObj: null
|
||||||
|
|
||||||
function openActivityCenterPopup() {
|
function openActivityCenterPopup() {
|
||||||
|
|
Loading…
Reference in New Issue