From 3edfed9918c4e25ee7a37075e4fdbbe8d1ff40d5 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Mon, 11 Mar 2024 10:00:50 +0100 Subject: [PATCH] Elaborate on instantiate2Address API --- packages/cosmwasm-stargate/src/instantiate2.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cosmwasm-stargate/src/instantiate2.ts b/packages/cosmwasm-stargate/src/instantiate2.ts index dd7d232f8d..a1049395f8 100644 --- a/packages/cosmwasm-stargate/src/instantiate2.ts +++ b/packages/cosmwasm-stargate/src/instantiate2.ts @@ -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; }