feat(wallet): Add metrics for Send / Bridge / Swap (#16400)
This commit is contained in:
parent
2e249f9941
commit
83d7c03585
|
@ -369,6 +369,8 @@ QtObject:
|
|||
self.events.emit(SIGNAL_TRANSACTION_SENT, TransactionSentArgs(uuid: uuid, error: err, txType: txType,
|
||||
fromAddress: fromAddr, toAddress: toAddr, fromTokenKey: fromTokenKey, fromAmount: fromAmount,
|
||||
toTokenKey: toTokenKey, toAmount: toAmount))
|
||||
if txType == SendType.Swap:
|
||||
singletonInstance.globalEvents.addCentralizedMetricIfEnabled("swap", $(%*{"subEvent": "tx error"}))
|
||||
elif response.result{"hashes"} != nil:
|
||||
for route in routes:
|
||||
for hash in response.result["hashes"][$route.fromNetwork.chainID]:
|
||||
|
@ -382,6 +384,9 @@ QtObject:
|
|||
let metadata = TokenTransferMetadata(tokenName: tokenName, isOwnerToken: isOwnerToken)
|
||||
self.watchTransaction(hash.getStr, fromAddr, toAddr, $PendingTransactionTypeDto.WalletTransfer, $(%metadata), route.fromNetwork.chainID,
|
||||
fromTokenKey, fromAmount, toTokenKey, toAmount, txType)
|
||||
|
||||
if txType == SendType.Swap:
|
||||
singletonInstance.globalEvents.addCentralizedMetricIfEnabled("swap", $(%*{"subEvent": "tx success"}))
|
||||
|
||||
proc isCollectiblesTransfer(self: Service, sendType: SendType): bool =
|
||||
return sendType == ERC721Transfer or sendType == ERC1155Transfer
|
||||
|
@ -446,6 +451,7 @@ QtObject:
|
|||
|
||||
if sendType == SendType.Swap:
|
||||
mtCommand.toAmount = "0x" & totalAmountToReceive.toHex
|
||||
singletonInstance.globalEvents.addCentralizedMetricIfEnabled("swap", $(%*{"subEvent": "send tx"}))
|
||||
|
||||
let response = transactions.createMultiTransaction(
|
||||
mtCommand,
|
||||
|
@ -562,6 +568,7 @@ QtObject:
|
|||
mtCommand.fromAmount = "0x" & totalAmountToSend.toHex
|
||||
if sendType == SendType.Swap:
|
||||
mtCommand.toAmount = "0x" & totalAmountToReceive.toHex
|
||||
singletonInstance.globalEvents.addCentralizedMetricIfEnabled("swap", $(%*{"subEvent": "send tx"}))
|
||||
|
||||
let response = transactions.createMultiTransaction(mtCommand, paths, password)
|
||||
|
||||
|
|
|
@ -68,6 +68,10 @@ StatusDialog {
|
|||
selectedNetworkChainId: root.swapInputParamsForm.selectedNetworkChainId
|
||||
selectedTokenKey: root.swapInputParamsForm.fromTokensKey
|
||||
}
|
||||
|
||||
function addMetricsEvent(subEventName) {
|
||||
Global.addCentralizedMetricIfEnabled("swap", {subEvent: subEventName})
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
@ -111,10 +115,14 @@ StatusDialog {
|
|||
NumberAnimation { duration: 1000; easing.type: Easing.OutExpo; alwaysRunToEnd: true}
|
||||
}
|
||||
|
||||
onOpened: payPanel.forceActiveFocus()
|
||||
onOpened: {
|
||||
payPanel.forceActiveFocus()
|
||||
d.addMetricsEvent("popup opened")
|
||||
}
|
||||
onClosed: {
|
||||
root.swapAdaptor.stopUpdatesForSuggestedRoute()
|
||||
root.swapAdaptor.reset()
|
||||
d.addMetricsEvent("popup closed")
|
||||
}
|
||||
|
||||
header: Item {
|
||||
|
@ -431,6 +439,7 @@ StatusDialog {
|
|||
!root.swapAdaptor.approvalPending
|
||||
onClicked: {
|
||||
if (root.swapAdaptor.validSwapProposalReceived) {
|
||||
d.addMetricsEvent("next button pressed")
|
||||
if (root.swapAdaptor.swapOutputData.approvalNeeded)
|
||||
Global.openPopup(swapApproveModalComponent)
|
||||
else
|
||||
|
@ -485,7 +494,9 @@ StatusDialog {
|
|||
serviceProviderContractAddress: root.swapAdaptor.swapOutputData.approvalContractAddress
|
||||
serviceProviderHostname: Constants.swap.paraswapHostname
|
||||
|
||||
onRejected: d.addMetricsEvent("rejected approve")
|
||||
onAccepted: {
|
||||
d.addMetricsEvent("send approve tx")
|
||||
root.swapAdaptor.sendApproveTx()
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +546,9 @@ StatusDialog {
|
|||
serviceProviderURL: Constants.swap.paraswapUrl // TODO https://github.com/status-im/status-desktop/issues/15329
|
||||
serviceProviderTandCUrl: Constants.swap.paraswapTermsAndConditionUrl // TODO https://github.com/status-im/status-desktop/issues/15329
|
||||
|
||||
onRejected: d.addMetricsEvent("rejected sign")
|
||||
onAccepted: {
|
||||
d.addMetricsEvent("send swap tx")
|
||||
root.swapAdaptor.sendSwapTx()
|
||||
root.close()
|
||||
}
|
||||
|
|
|
@ -23,6 +23,21 @@ QtObject {
|
|||
RecentsAddress // Recent addresses object got from transactions history
|
||||
}
|
||||
|
||||
function recipientAddressObjectTypeToString(type) {
|
||||
switch (type) {
|
||||
case RecipientAddressObjectType.Address:
|
||||
return "Address"
|
||||
case RecipientAddressObjectType.Account:
|
||||
return "Account"
|
||||
case RecipientAddressObjectType.SavedAddress:
|
||||
return "SavedAddress"
|
||||
case RecipientAddressObjectType.RecentsAddress:
|
||||
return "RecentsAddress"
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
function createSendModalRequirements() {
|
||||
return {
|
||||
preSelectedAccount: null,
|
||||
|
|
|
@ -173,6 +173,10 @@ StatusDialog {
|
|||
|
||||
recalculateRoutesAndFees()
|
||||
}
|
||||
|
||||
function addMetricsEvent(subEventName) {
|
||||
Global.addCentralizedMetricIfEnabled(d.isBridgeTx ? "bridge" : "send", {subEvent: subEventName})
|
||||
}
|
||||
}
|
||||
|
||||
LeftJoinModel {
|
||||
|
@ -276,11 +280,14 @@ StatusDialog {
|
|||
.arg(Constants.suggestedRoutesExtraParamsProperties.publicKey)
|
||||
.arg(popup.publicKey)
|
||||
}
|
||||
|
||||
d.addMetricsEvent("popup opened")
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
popup.store.stopUpdatesForSuggestedRoute()
|
||||
popup.store.resetStoredProperties()
|
||||
d.addMetricsEvent("popup closed")
|
||||
}
|
||||
|
||||
header: Item {
|
||||
|
@ -751,6 +758,7 @@ StatusDialog {
|
|||
onNextButtonClicked: {
|
||||
d.sendError = ""
|
||||
popup.sendTransaction()
|
||||
d.addMetricsEvent("next button clicked")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -788,8 +796,10 @@ StatusDialog {
|
|||
return
|
||||
}
|
||||
d.sendError = error
|
||||
d.addMetricsEvent("tx send error")
|
||||
return
|
||||
}
|
||||
d.addMetricsEvent("tx send successful")
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ Item {
|
|||
property double totalFeesInFiat
|
||||
property bool showCustomRoutingMode
|
||||
|
||||
readonly property int currentIndex: tabBar.currentIndex
|
||||
|
||||
property string routerError: ""
|
||||
property string routerErrorDetails: ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue