Skip to content

Fix cw20-base helpers.ts and point to heldernet#201

Merged
ethanfrey merged 2 commits intomasterfrom
fix-cw20-helper
Dec 22, 2020
Merged

Fix cw20-base helpers.ts and point to heldernet#201
ethanfrey merged 2 commits intomasterfrom
fix-cw20-helper

Conversation

@orkunkl
Copy link
Copy Markdown
Contributor

@orkunkl orkunkl commented Dec 21, 2020

This change is required for coralnet to heldernet update in docs.

Copy link
Copy Markdown
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please double-check the cosmjs version and update the header if needed.

Otherwise, feel free to merge and I will look into InitMsg later

readonly networkId: string
readonly feeToken: string
readonly gasPrice: number
readonly gasPrice: GasPrice
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changed. Is this using 0.22 still? or 0.23?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for v0.23.0

// label is the public name of the contract in listing
// if you set admin, you can run migrations on this contract (likely client.senderAddress)
instantiate: (codeId: number, initMsg: InitMsg, label: string, admin?: string) => Promise<CW20Instance>
instantiate: (codeId: number, initMsg: Record<string, unknown>, label: string, admin?: string) => Promise<CW20Instance>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TS compiler forces this on you?

Ideally it would auto downcast InitMsg to this more general Record<string, unknown>. And nice to have the clarity in the contract-specific API. If you have TS issues, leave it and I can look into it later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the error I get with v0.23:

../../../../../.npm/_npx/10245/lib/node_modules/@cosmjs/cli/[eval].ts:307:53 - error TS2345: Argument of type 'InitMsg' is not assignable to parameter of type 'Record<string, unknown>'.
  Index signature is missing in type 'InitMsg'.

307     const result = await client.instantiate(codeId, initMsg, label, { memo: `Init ${label}`, admin});
                                                        ~~~~~~~

Copy link
Copy Markdown
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and can you update https://github.com/CosmWasm/cosmwasm-plus/tree/v0.2.1/contracts/cw20-base to v0.3.2?

I think it is the same public interface, but good to keep using the most recent versions. I have done some minor bug fixes on that contract

@orkunkl orkunkl changed the title Fix cw20-base helper.ts and point to heldernet Fix cw20-base helpers.ts and point to heldernet Dec 22, 2020
@orkunkl
Copy link
Copy Markdown
Contributor Author

orkunkl commented Dec 22, 2020

@ethanfrey I don't know which version of rust-optimizer is used to build v0.3.2. Maybe we could do a minor release with v0.10.7 to make sure it is updated?

@ethanfrey
Copy link
Copy Markdown
Contributor

I'll merge this (doesn't have to be correct) and update shortly with the v0.4.0 release

@ethanfrey ethanfrey merged commit e4ef2df into master Dec 22, 2020
@ethanfrey ethanfrey deleted the fix-cw20-helper branch December 22, 2020 20:48
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

Successfully merging this pull request may close these issues.

2 participants