Skip to content

Bug signing messages Blazor Wasm. #1080

@baramustafa

Description

@baramustafa

Ive had an issue when trying to sign messages where the from address here is invalid. The function getSelectedOrRequestAddress() returns a JSON stringified rpc response but the method call to eip6963WalletRequest(..) params and from parameters require the fromAddress to be a simple string.

const from = await this.getSelectedOrRequestAddress();

For now Ive manually implemented the following into my code which has resolved the issue but not sure if there is a cleaner/more appropriate way of doing this. I'm also not sure what happens if the getSelectedOrRequestAddress() returns multiple account results.

try { const from = await this.getSelectedOrRequestAddress(); log("Signing from: " + from); const parsedFrom = JSON.parse(from); const fromAddress = parsedFrom.result[0]; const params = [utf8HexMsg, fromAddress]; const method = 'personal_sign'; const rpcResponse = await this.eip6963WalletRequest({ method, params, fromAddress }); return JSON.stringify(rpcResponse); } catch (e) { log("Error signing: " + e); return JSON.stringify({ jsonrpc: "2.0", id: null, error: e }); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions