Add label to SigningCosmWasmClient.instantiate
This commit is contained in:
parent
36d557a4ef
commit
365c1a0e66
@ -538,7 +538,7 @@ describe("CosmWasmClient", () => {
|
||||
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
|
||||
const { codeId } = await client.upload(getRandomizedHackatom());
|
||||
const initMsg = { verifier: makeRandomAddress(), beneficiary: makeRandomAddress() };
|
||||
const contractAddress = await client.instantiate(codeId, initMsg);
|
||||
const contractAddress = await client.instantiate(codeId, initMsg, "random hackatom");
|
||||
contract = { initMsg: initMsg, address: contractAddress };
|
||||
}
|
||||
});
|
||||
@ -589,7 +589,7 @@ describe("CosmWasmClient", () => {
|
||||
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
|
||||
const { codeId } = await client.upload(getRandomizedHackatom());
|
||||
const initMsg = { verifier: makeRandomAddress(), beneficiary: makeRandomAddress() };
|
||||
const contractAddress = await client.instantiate(codeId, initMsg);
|
||||
const contractAddress = await client.instantiate(codeId, initMsg, "a different hackatom");
|
||||
contract = { initMsg: initMsg, address: contractAddress };
|
||||
}
|
||||
});
|
||||
|
||||
@ -108,6 +108,7 @@ async function instantiateContract(
|
||||
value: {
|
||||
sender: faucet.address,
|
||||
code_id: codeId.toString(),
|
||||
label: "my escrow",
|
||||
init_msg: {
|
||||
verifier: faucet.address,
|
||||
beneficiary: beneficiaryAddress,
|
||||
|
||||
@ -76,7 +76,8 @@ describe("SigningCosmWasmClient", () => {
|
||||
verifier: faucet.address,
|
||||
beneficiary: beneficiaryAddress,
|
||||
},
|
||||
"Let's see",
|
||||
"My cool label",
|
||||
"Let's see if the memo is used",
|
||||
transferAmount,
|
||||
);
|
||||
|
||||
@ -91,14 +92,22 @@ describe("SigningCosmWasmClient", () => {
|
||||
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
|
||||
const { codeId } = await client.upload(getRandomizedHackatom());
|
||||
|
||||
const contractAddress1 = await client.instantiate(codeId, {
|
||||
verifier: faucet.address,
|
||||
beneficiary: makeRandomAddress(),
|
||||
});
|
||||
const contractAddress2 = await client.instantiate(codeId, {
|
||||
verifier: faucet.address,
|
||||
beneficiary: makeRandomAddress(),
|
||||
});
|
||||
const contractAddress1 = await client.instantiate(
|
||||
codeId,
|
||||
{
|
||||
verifier: faucet.address,
|
||||
beneficiary: makeRandomAddress(),
|
||||
},
|
||||
"contract 1",
|
||||
);
|
||||
const contractAddress2 = await client.instantiate(
|
||||
codeId,
|
||||
{
|
||||
verifier: faucet.address,
|
||||
beneficiary: makeRandomAddress(),
|
||||
},
|
||||
"contract 2",
|
||||
);
|
||||
expect(contractAddress1).not.toEqual(contractAddress2);
|
||||
});
|
||||
});
|
||||
@ -128,6 +137,7 @@ describe("SigningCosmWasmClient", () => {
|
||||
verifier: faucet.address,
|
||||
beneficiary: beneficiaryAddress,
|
||||
},
|
||||
"amazing random contract",
|
||||
undefined,
|
||||
transferAmount,
|
||||
);
|
||||
|
||||
@ -134,6 +134,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
public async instantiate(
|
||||
codeId: number,
|
||||
initMsg: object,
|
||||
label: string,
|
||||
memo = "",
|
||||
transferAmount?: readonly Coin[],
|
||||
): Promise<string> {
|
||||
@ -143,6 +144,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
sender: this.senderAddress,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
code_id: codeId.toString(),
|
||||
label: label,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
init_msg: initMsg,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
|
||||
@ -70,6 +70,8 @@ export interface MsgInstantiateContract extends MsgTemplate {
|
||||
readonly sender: string;
|
||||
/** ID of the Wasm code that was uploaded before */
|
||||
readonly code_id: string;
|
||||
/** Human-readable label for this contract */
|
||||
readonly label: string;
|
||||
/** Init message as JavaScript object */
|
||||
readonly init_msg: object;
|
||||
readonly init_funds: ReadonlyArray<Coin>;
|
||||
|
||||
@ -44,6 +44,7 @@ export declare class SigningCosmWasmClient extends CosmWasmClient {
|
||||
instantiate(
|
||||
codeId: number,
|
||||
initMsg: object,
|
||||
label: string,
|
||||
memo?: string,
|
||||
transferAmount?: readonly Coin[],
|
||||
): Promise<string>;
|
||||
|
||||
2
packages/sdk/types/types.d.ts
vendored
2
packages/sdk/types/types.d.ts
vendored
@ -55,6 +55,8 @@ export interface MsgInstantiateContract extends MsgTemplate {
|
||||
readonly sender: string;
|
||||
/** ID of the Wasm code that was uploaded before */
|
||||
readonly code_id: string;
|
||||
/** Human-readable label for this contract */
|
||||
readonly label: string;
|
||||
/** Init message as JavaScript object */
|
||||
readonly init_msg: object;
|
||||
readonly init_funds: ReadonlyArray<Coin>;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user