question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How about adding main signer address data into SigningCosmWasmClient?

See original GitHub issue

Currently there’s no field to hold a signer address data or method to get that kind of data in SigningCosmWasmClient class. But, considering the usage of that class, why don’t we add an address string data into the class or some addresses to make it more complement class for a literally signing client?

@ethanfrey @webmaster128

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
webmaster128commented, Sep 5, 2022

Indeed, the client can have one signer address which can be changed. A big API change would still result from making the client a one-address client.

We could try creating a SimpleSigningCosmWasmClient to test if that works well.

0reactions
ethanfreycommented, Sep 6, 2022

In ts-relayer, I made a simple wrapper that had this hardcoded address. That would not work if used in a web-app using Keplr, where you change account.

The fact that the wallet is completely hidden inside the signing client has been an annoying client side DevX for a while. But adding one more fixed field is not a proper solution. I would propose adding two more methods here:

// also in SigningCosmosClient
class SigningCosmWasmClient {
    public getAccounts(): Promise<readonly AccountData[]> {
        return this.wallet.getAccounts();
    } 

    // return address of the first account
    public async mainSigner(): Promise<string> {
        const accounts = await this.wallet.getAccounts();
        return accounts[0].address;
    } 
}

This means you can simply pass around a SigningClient, without needing to pass along either the wallet or an address to know how to sign it.

I agree with requiring the senderAddress in all the functions still, but at least this way we can find the proper address much easier. Other wrappers (outside of CosmJS) could then auto-fill in this field if they want, but this is the only change I would make in CosmJS to enable ease of use.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · cosmos/cosmjs - GitHub
The Swiss Army knife to power JavaScript based client solutions ranging from Web ... How about adding main signer address data into SigningCosmWasmClient?...
Read more >
CosmWasmClient Part 2: Writing - Medium
In the first part of this duology, we saw how to use the class CosmWasmClient from CosmWasm JS for reading data from a...
Read more >
Signers - ethers
A Signer in ethers is an abstraction of an Ethereum Account, which can be used to sign messages ... Returns a Promise that...
Read more >
SigningCosmWasmClient | @cosmjs/cosmwasm-stargate ...
Creates a transaction with the given messages, fee and memo. Then signs and broadcasts the transaction. Parameters. signerAddress: string. The address that will ......
Read more >
Waves Signer | Waves documentation
Authenticates user with his/her account; creates account if it don't exist. login();. Returns: Promise of user data: address and public key ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found