fix(WC): Fix property names collisions

to squash - property names collisions
This commit is contained in:
Alex Jbanca 2024-10-18 23:36:10 +03:00
parent 80b5d7e9a8
commit a398d348a4
No known key found for this signature in database
GPG Key ID: 6004079575C21C5D
6 changed files with 37 additions and 36 deletions

View File

@ -51,7 +51,7 @@ Item {
const requestItem = testCase.createTemporaryObject(sessionRequestComponent, root, {
event: requestObj,
topic,
id: requestObj.id,
requestId: requestObj.id,
method: Constants.personal_sign,
accountAddress: account,
chainId: network,
@ -314,7 +314,7 @@ Item {
compare(handler.store.authenticateUserCalls.length, 1, "expected a call to store.authenticateUser")
let store = handler.store
store.userAuthenticated(td.topic, td.request.id, "hello world", "")
store.userAuthenticated(td.topic, td.request.requestId, "hello world", "")
compare(store.signMessageCalls.length, 1, "expected a call to store.signMessage")
compare(store.signMessageCalls[0].message, td.request.data)
}

View File

@ -297,7 +297,7 @@ DappsComboBox {
return
}
requestHandled = true
root.signRequestRejected(request.topic, request.id)
root.signRequestRejected(request.topic, request.requestId)
}
parent: root
@ -347,7 +347,7 @@ DappsComboBox {
hasExpiryDate: !!request.expirationTimestamp
onOpened: {
root.subscribeForFeeUpdates(request.topic, request.id)
root.subscribeForFeeUpdates(request.topic, request.requestId)
}
onClosed: {
@ -356,7 +356,7 @@ DappsComboBox {
onAccepted: {
requestHandled = true
root.signRequestAccepted(request.topic, request.id)
root.signRequestAccepted(request.topic, request.requestId)
}
onRejected: {

View File

@ -309,7 +309,7 @@ SQUtils.QObject {
let obj = sessionRequestComponent.createObject(null, {
event,
topic: event.topic,
id: event.id,
requestId: event.id,
method,
accountAddress,
chainId,
@ -317,7 +317,6 @@ SQUtils.QObject {
preparedData: interpreted.preparedData,
maxFeesText: "?",
maxFeesEthText: "?",
enoughFunds: enoughFunds,
expirationTimestamp: requestExpiry
})
if (obj === null) {
@ -338,7 +337,7 @@ SQUtils.QObject {
}
obj.resolveDappInfoFromSession(session)
root.sessionRequest(obj.id)
root.sessionRequest(obj.requestId)
d.updateFeesParamsToPassedObj(obj)
})
@ -498,24 +497,24 @@ SQUtils.QObject {
function executeSessionRequest(request, password, pin, payload) {
if (!SessionRequest.getSupportedMethods().includes(request.method)) {
console.error("Unsupported method to execute: ", request.method)
return
return false
}
if (password === "") {
console.error("No password provided to sign message")
return
return false
}
if (request.method === SessionRequest.methods.sign.name) {
store.signMessageUnsafe(request.topic,
request.id,
request.requestId,
request.accountAddress,
SessionRequest.methods.personalSign.getMessageFromData(request.data),
password,
pin)
} else if (request.method === SessionRequest.methods.personalSign.name) {
store.signMessage(request.topic,
request.id,
request.requestId,
request.accountAddress,
SessionRequest.methods.personalSign.getMessageFromData(request.data),
password,
@ -525,7 +524,7 @@ SQUtils.QObject {
{
let legacy = request.method === SessionRequest.methods.signTypedData.name
store.safeSignTypedData(request.topic,
request.id,
request.requestId,
request.accountAddress,
SessionRequest.methods.signTypedData.getMessageFromData(request.data),
request.chainId,
@ -554,7 +553,7 @@ SQUtils.QObject {
if (request.method === SessionRequest.methods.signTransaction.name) {
store.signTransaction(request.topic,
request.id,
request.requestId,
request.accountAddress,
request.chainId,
txObj,
@ -563,7 +562,7 @@ SQUtils.QObject {
} else if (request.method === SessionRequest.methods.sendTransaction.name) {
store.sendTransaction(
request.topic,
request.id,
request.requestId,
request.accountAddress,
request.chainId,
txObj,
@ -571,6 +570,8 @@ SQUtils.QObject {
pin)
}
}
return true
}
// Returns Constants.TransactionEstimatedTime

View File

@ -86,7 +86,7 @@ WalletConnectSDKBase {
let obj = sessionRequestComponent.createObject(null, {
event,
topic: event.topic,
id: event.id,
requestId: event.id,
method,
accountAddress,
chainId,
@ -94,7 +94,7 @@ WalletConnectSDKBase {
preparedData: interpreted.preparedData,
maxFeesText: "?",
maxFeesEthText: "?",
enoughFunds: enoughFunds
haveEnoughFunds: enoughFunds
})
if (obj === null) {
@ -133,14 +133,14 @@ WalletConnectSDKBase {
let maxFeesString = maxFees.toString()
obj.maxFeesText = maxFeesString
obj.maxFeesEthText = maxFeesString
obj.enoughFunds = true
obj.haveEnoughFunds = true
} else {
let gasPrice = hexToGwei(tx.gasPrice)
let maxFees = BigOps.times(gasLimit, gasPrice)
let maxFeesString = maxFees.toString()
obj.maxFeesText = maxFeesString
obj.maxFeesEthText = maxFeesString
obj.enoughFunds = true
obj.haveEnoughFunds = true
}
}
@ -364,14 +364,14 @@ WalletConnectSDKBase {
if (request.method === SessionRequest.methods.sign.name) {
store.signMessageUnsafe(request.topic,
request.id,
request.requestId,
request.accountAddress,
SessionRequest.methods.personalSign.getMessageFromData(request.data),
password,
pin)
} else if (request.method === SessionRequest.methods.personalSign.name) {
store.signMessage(request.topic,
request.id,
request.requestId,
request.accountAddress,
SessionRequest.methods.personalSign.getMessageFromData(request.data),
password,
@ -381,7 +381,7 @@ WalletConnectSDKBase {
{
let legacy = request.method === SessionRequest.methods.signTypedData.name
store.safeSignTypedData(request.topic,
request.id,
request.requestId,
request.accountAddress,
SessionRequest.methods.signTypedData.getMessageFromData(request.data),
request.chainId,
@ -391,7 +391,7 @@ WalletConnectSDKBase {
} else if (request.method === SessionRequest.methods.signTransaction.name) {
let txObj = SessionRequest.methods.signTransaction.getTxObjFromData(request.data)
store.signTransaction(request.topic,
request.id,
request.requestId,
request.accountAddress,
request.chainId,
txObj,
@ -399,9 +399,9 @@ WalletConnectSDKBase {
pin)
} else if (request.method === SessionRequest.methods.sendTransaction.name) {
store.sendTransaction(request.topic,
request.id,
request.account.address,
request.network.chainId,
request.requestId,
request.accountAddress,
request.chainId,
request.data.tx,
password,
pin)
@ -445,7 +445,7 @@ WalletConnectSDKBase {
}
function authenticate(request) {
return store.authenticateUser(request.topic, request.id, request.account.address)
return store.authenticateUser(request.topic, request.requestId, request.accountAddress)
}
}
@ -545,14 +545,14 @@ WalletConnectSDKBase {
id: dappRequestModal
objectName: "connectorDappsRequestModal"
readonly property var account: accountEntry.available ? accountEntry.model : {
readonly property var account: accountEntry.available ? accountEntry.item : {
"address": "",
"name": "",
"emoji": "",
"colorId": 0
}
readonly property var network: networkEntry.available ? networkEntry.model : {
readonly property var network: networkEntry.available ? networkEntry.item : {
"chainId": 0,
"chainName": "",
"iconUrl": ""
@ -580,8 +580,8 @@ WalletConnectSDKBase {
estimatedTime: ""
feesLoading: !request.maxFeesText || !request.maxFeesEthText
hasFees: signingTransaction
enoughFundsForTransaction: request.enoughFunds
enoughFundsForFees: request.enoughFunds
enoughFundsForTransaction: request.haveEnoughFunds
enoughFundsForFees: request.haveEnoughFunds
signingTransaction: request.method === SessionRequest.methods.signTransaction.name || request.method === SessionRequest.methods.sendTransaction.name

View File

@ -17,7 +17,7 @@ QObject {
/// dApp request data
required property string topic
required property string id
required property string requestId
required property string method
required property string accountAddress
required property string chainId

View File

@ -5,7 +5,7 @@ ListModel {
id: root
function enqueue(request) {
root.append({requestId: request.id, requestItem: request});
root.append({requestId: request.requestId, requestItem: request});
}
function dequeue() {
@ -20,7 +20,7 @@ ListModel {
function removeRequest(topic, id) {
for (var i = 0; i < root.count; i++) {
let entry = root.get(i).requestItem
if (entry.topic == topic && entry.id == id) {
if (entry.topic == topic && entry.requestId == id) {
root.remove(i, 1);
return;
}
@ -31,7 +31,7 @@ ListModel {
function findRequest(topic, id) {
for (var i = 0; i < root.count; i++) {
let entry = root.get(i).requestItem
if (entry.topic == topic && entry.id == id) {
if (entry.topic == topic && entry.requestId == id) {
return entry;
}
}
@ -42,7 +42,7 @@ ListModel {
function findById(id) {
for (var i = 0; i < root.count; i++) {
let entry = root.get(i).requestItem
if (entry.id == id) {
if (entry.requestId == id) {
return entry;
}
}