Add field ibcPortId to Contract

This commit is contained in:
Simon Warta 2021-07-24 23:44:39 +02:00
parent ae1a81dc4d
commit 004d880956
3 changed files with 18 additions and 9 deletions

View File

@ -24,8 +24,10 @@ and this project adheres to
and remove dependency on @cosmjs/cosmwasm-launchpad.
- @cosmjs/faucet: Add new configuration variable `FAUCET_PATH_PATTERN` to
configure the HD path of the faucet accounts ([#832]).
- @cosmjs/cosmwasm-stargate: Add field `ibcPortId` to `Contract` ([#836]).
[#832]: https://github.com/cosmos/cosmjs/issues/832
[#836]: https://github.com/cosmos/cosmjs/issues/836
### Changed

View File

@ -291,6 +291,7 @@ describe("CosmWasmClient", () => {
creator: alice.address0,
label: deployedHackatom.instances[0].label,
admin: undefined,
ibcPortId: undefined,
});
});
@ -298,15 +299,14 @@ describe("CosmWasmClient", () => {
pendingWithoutWasmd();
const client = await CosmWasmClient.connect(wasmd.endpoint);
const two = await client.getContract(deployedHackatom.instances[2].address);
expect(two).toEqual(
jasmine.objectContaining({
address: deployedHackatom.instances[2].address,
codeId: deployedHackatom.codeId,
creator: alice.address0,
label: deployedHackatom.instances[2].label,
admin: alice.address1,
}),
);
expect(two).toEqual({
address: deployedHackatom.instances[2].address,
codeId: deployedHackatom.codeId,
creator: alice.address0,
label: deployedHackatom.instances[2].label,
admin: alice.address1,
ibcPortId: undefined,
});
});
});

View File

@ -67,6 +67,12 @@ export interface Contract {
/** Bech32-encoded admin address */
readonly admin: string | undefined;
readonly label: string;
/**
* The IBC port ID assigned to this contract by wasmd.
*
* This is set for all IBC contracts (https://github.com/CosmWasm/wasmd/blob/v0.16.0/x/wasm/keeper/keeper.go#L299-L306).
*/
readonly ibcPortId: string | undefined;
}
export interface ContractCodeHistoryEntry {
@ -360,6 +366,7 @@ export class CosmWasmClient {
creator: contractInfo.creator,
admin: contractInfo.admin || undefined,
label: contractInfo.label,
ibcPortId: contractInfo.ibcPortId || undefined,
};
}