Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strongly typed props? #33

Open
dzmitry-lahoda opened this issue Sep 8, 2022 · 0 comments
Open

strongly typed props? #33

dzmitry-lahoda opened this issue Sep 8, 2022 · 0 comments

Comments

@dzmitry-lahoda
Copy link

may be props1, props2, props3?

https://stackoverflow.com/questions/28250680/how-do-i-access-previous-promise-results-in-a-then-chain?noredirect=1&lq=1

https://stackoverflow.com/questions/28714298/how-to-chain-and-share-prior-results-with-promises?noredirect=1&lq=1

trying to simplify this, but being typed (no any)

const connect = async (): Promise<JunoConnection> =>
    DirectSecp256k1HdWallet.fromMnemonic(ALICE, {
        prefix: PREFIX,
    })
        .then(x =>
            identity({
                connection: SigningCosmWasmClient.connectWithSigner(RPC, x, {
                    gasPrice: GasPrice.fromString("0.02ujunox"),
                    prefix: PREFIX
                }),

                signer: x.getAccounts().then(x => x[0].address)
            })
        )
        // when handling [] TS degenerates to any
        .then((x) => Promise.all([x.connection, x.signer])) 
        .then(([connection, signer]) => { return { connection, signer } })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant