feat(WalletConnect): Expose `emitSessionEvent` function from the WC js SDK
This commit exposes the `emitSessionEvent` function to qml
This commit is contained in:
parent
c7ddf16515
commit
78c131f19f
|
@ -89,6 +89,10 @@ WalletConnectSDKBase {
|
||||||
wcCalls.buildAuthObject(id, authPayload, signature, iss)
|
wcCalls.buildAuthObject(id, authPayload, signature, iss)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emitSessionEvent: function(topic, event, chainId) {
|
||||||
|
wcCalls.emitSessionEvent(topic, event, chainId)
|
||||||
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
|
||||||
|
@ -244,6 +248,18 @@ WalletConnectSDKBase {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function emitSessionEvent(topic, event, chainId) {
|
||||||
|
console.debug(`WC WalletConnectSDK.wcCall.emitSessionEvent; topic: ${topic}, event: ${JSON.stringify(event)}, chainId: ${chainId}`)
|
||||||
|
d.engine.runJavaScript(`
|
||||||
|
wc.emitSessionEvent("${topic}", ${JSON.stringify(event)}, "${chainId}")
|
||||||
|
.then((value) => {
|
||||||
|
wc.statusObject.echo("debug", " emitSessionEvent success")
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
wc.statusObject.echo("error", " emitSessionEvent error: " + e.message)
|
||||||
|
})`)
|
||||||
|
}
|
||||||
|
|
||||||
function disconnectPairing(topic) {
|
function disconnectPairing(topic) {
|
||||||
console.debug(`WC WalletConnectSDK.wcCall.disconnectPairing; topic: "${topic}"`)
|
console.debug(`WC WalletConnectSDK.wcCall.disconnectPairing; topic: "${topic}"`)
|
||||||
|
|
||||||
|
@ -348,6 +364,14 @@ WalletConnectSDKBase {
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function connected() {
|
||||||
|
console.debug(`WC WalletConnectSDK.wcCall.connected;`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function disconnected() {
|
||||||
|
console.debug(`WC WalletConnectSDK.wcCall.disconnected;`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
|
@ -82,4 +82,8 @@ Item {
|
||||||
property var rejectSessionAuthenticate: function(id, error) {
|
property var rejectSessionAuthenticate: function(id, error) {
|
||||||
console.error("rejectSessionAuthenticate not implemented")
|
console.error("rejectSessionAuthenticate not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property var emitSessionEvent: function(topic, event, chainId) {
|
||||||
|
console.error("emitSessionEvent not implemented")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -236,5 +236,9 @@ window.wc = {
|
||||||
id: id,
|
id: id,
|
||||||
reason: getSdkError('USER_REJECTED') // or choose a different reason if applicable
|
reason: getSdkError('USER_REJECTED') // or choose a different reason if applicable
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
emitSessionEvent: async function (topic, event, chainId) {
|
||||||
|
return await window.wc.walletKit.emitSessionEvent({topic, event, chainId});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue