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

Elaborate on instantiate2Address API #1571

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/cosmwasm-stargate/src/instantiate2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ export function _instantiate2AddressIntermediate(
/**
* Predictable address generation for the MsgInstantiateContract2
* introduced with wasmd 0.29.
*
* With `checksum`, `creator` and `salt`, the instantiate 2 address is
* generated in binary form. The `bech32Prefix` is then used for the bech32 representation.
* Chains using address formats other than bech32 are not supported by this API.
*/
export function instantiate2Address(
checksum: Uint8Array,
creator: string,
salt: Uint8Array,
prefix: string,
bech32Prefix: string,
): string {
// Non-empty msg values are discouraged.
// See https://medium.com/cosmwasm/dev-note-3-limitations-of-instantiate2-and-how-to-deal-with-them-a3f946874230.
const msg = null;
return _instantiate2AddressIntermediate(checksum, creator, salt, msg, prefix).address;
return _instantiate2AddressIntermediate(checksum, creator, salt, msg, bech32Prefix).address;
}
Loading