From 004d8809560657f2f02756cc6ed80d2e5e04091c Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Sat, 24 Jul 2021 23:44:39 +0200 Subject: [PATCH] Add field `ibcPortId` to `Contract` --- CHANGELOG.md | 2 ++ .../src/cosmwasmclient.spec.ts | 18 +++++++++--------- .../cosmwasm-stargate/src/cosmwasmclient.ts | 7 +++++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b4ca7e3..bd7aca98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts index 83647705..365d94af 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts @@ -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, + }); }); }); diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.ts index c0529b86..3a65bcfa 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.ts @@ -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, }; }