Open cp-byungsun opened 6 months ago
Hey! Does changing from String to Any for the data field solve your issue?
@jakubuid maybe I think it will probably be resolved. Currently, cannot change the address in wallet.
This is part of the code for a dApp using walletconnect-monorepo - UniversalProvider. When the "accountsChanged" event is received, it calls isValidArray from the data. This is a function that validates whether the data is an Array.
if (event.name === "accountsChanged") {
const accounts = event.data;
if (accounts && isValidArray(accounts))
this.events.emit("accountsChanged", accounts.map(parseCaip10Account));
}
In WalletConnectKotlinV2, the Event data class is as follows:
data class SessionEvent(
val name: String,
val data: String,
) : Model()
Because it is in String format, it cannot trigger the accountsChanged event.
I've tried sending it as JSON and also as a String like "["0xAccount"]", but the event does not trigger because it is not an ArrayString.
@Jimyeol @cp-byungsun Did you try this form?
"[\"0xAccount\"]"
@jakubuid I've tried it, It doesn't work.
@Jimyeol Regarding this issue, I'll come back to you shortly with the follow up 🙏
@jakubuid I'd like to know what's going on.
Apologies for the delay! Which dapp should I connect to reproduce?
Describe the bug When send accountchanged to sessionevnet in Kotlin version, only string type can be send, but in case of js, accountchanged checks array.
SDK Version
To Reproduce Sign.kt data class SessionEvent( val name: String, val data: String, ) : Model()
Expected behavior A clear and concise description of what you expected to happen.
Screenshots swift or flutter data is dynamic type
Additional context Is there another way to send accountsChanged sesstionevent in kotlin?