-
Notifications
You must be signed in to change notification settings - Fork 341
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
Upstream useful helpers into @cosmjs/cli #385
Comments
Here is a list of simplifications to the code that can happen with CosmJS 0.32
One thing we could add is a faucet client, like https://github.com/iov-one/iov-core/blob/master/packages/iov-faucets/src/iovfaucet.ts, which would internalize networking and turn const hitFaucet = async (
faucetUrl: string,
address: string,
ticker: string
): Promise<void> => {
await axios.post(faucetUrl, { ticker, address });
}
// ...
// ensure we have some tokens
if (options.faucetUrl) {
const account = await client.getAccount();
if (!account) {
console.log(`Getting ${options.feeToken} from faucet`);
await hitFaucet(options.faucetUrl, client.senderAddress, options.faucetToken);
}
} into // ensure we have some tokens
if (options.faucetUrl) {
const account = await client.getAccount();
if (!account) {
console.log(`Getting ${options.feeToken} from faucet`);
await new FaucetClient(options.faucetUrl).credit(client.senderAddress, options.feeToken);
}
} |
Those all look like nice UX improvements, and would simplify most of I would also be interested in adding some of the interfaces to the cwXyz standard. Maybe just the execute ones for eg. cw20, cw3, cw721. We will need to have the cw3 (and likely the TBD cw4) interface to use multisigs for example. I am fine to skip the upload code and instantiate code parts from @cosmjs (which are implementation detail, not in the specs), and just support the handle and query messages as part of the specs and consistent among all contracts that implement those. |
The problem with
Yeah, those can be in @cosmjs/cosmwasm or @cosmjs/cw-interfaces, depending from where we need them. We'll figure it out when building the multisig client functionality. |
Fair enough. "faucet client business" sounds nice
Cool. They can easily be added in a 0.23.x patch release as well, just wanted to have them on your radar. |
Starting with 0.23.1, you can use a |
0.23.1 was just released, including the |
In CosmWasm/cw-plus#46 I went to make the easiest intro to using the cw20-base contract via
@cosmjs/cli
. However, the setup code we have by default wasn't the simplest, so I refactored this along the way.In particular, please look at this code section: https://github.com/CosmWasm/cosmwasm-plus/blob/master/contracts/cw20-base/helpers.ts#L19-L134
It allows us to simply
const client = await useOptions(coralnetOptions).setup(password);
and create or recover a password-encrypted key, configured with all chain-specific options. We can provide different options, likegaiaFlexOptions
for easy drop-in. I also worked to limit the number of top-level exports to avoid name-space pollution.However, I would rather not copy this code in each contract we support with helpers and wanted to upstream it to
@cosmjs/cli
. I was thinking to keep the actual concrete options in the contract helpers for now, until we figure out how to do mix ins (options from testnets dir, cw20-base bindings here, cw1-subkeys bindings here...).The text was updated successfully, but these errors were encountered: