Skip to content

Commit 961bdd8

Browse files
authored
Merge pull request #2386 from CosmWasm/contract-info-eureka-port
Add EurekaPort to ContractInfoResponse
2 parents ac8339a + 5b2480d commit 961bdd8

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to
1818
- cosmwasm-std: Added new `EurekaMsg` and `CosmosMsg::Eureka` variant ([#2340])
1919
- cosmwasm-std: Implement downcasting for `Api` trait. This allows using
2020
`MockApi::addr_make` from `DepsMut`. ([#2383])
21+
- cosmwasm-std: Added `eureka_port` to `ContractInfoResponse`. ([#2390])
2122

2223
## Changed
2324

@@ -51,6 +52,7 @@ and this project adheres to
5152
[#2374]: https://github.com/CosmWasm/cosmwasm/issues/2374
5253
[#2378]: https://github.com/CosmWasm/cosmwasm/issues/2378
5354
[#2383]: https://github.com/CosmWasm/cosmwasm/issues/2383
55+
[#2390]: https://github.com/CosmWasm/cosmwasm/issues/2390
5456

5557
## [2.2.0] - 2024-12-17
5658

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
type ContractInfoResponse struct {
2-
// Set to the admin who can migrate contract, if any
3-
Admin string `json:"admin,omitempty"`
4-
CodeID uint64 `json:"code_id"`
5-
Creator string `json:"creator"`
6-
// Set if the contract is IBC enabled
7-
IBCPort string `json:"ibc_port,omitempty"`
8-
Pinned bool `json:"pinned"`
9-
}
2+
// admin who can run migrations (if any)
3+
Admin string `json:"admin,omitempty"`
4+
CodeID uint64 `json:"code_id"`
5+
// address that instantiated this contract
6+
Creator string `json:"creator"`
7+
// set if this contract has bound an Eureka port
8+
EurekaPort string `json:"eureka_port,omitempty"`
9+
// set if this contract has bound an IBC port
10+
IBCPort string `json:"ibc_port,omitempty"`
11+
// if set, the contract is pinned to the cache, and thus uses less gas when called
12+
Pinned bool `json:"pinned"`
13+
}

packages/std/src/query/wasm.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ pub struct ContractInfoResponse {
4444
pub pinned: bool,
4545
/// set if this contract has bound an IBC port
4646
pub ibc_port: Option<String>,
47+
/// set if this contract has bound an Eureka port
48+
pub eureka_port: Option<String>,
4749
}
4850

4951
impl QueryResponseType for ContractInfoResponse {}
@@ -54,7 +56,8 @@ impl_response_constructor!(
5456
creator: Addr,
5557
admin: Option<Addr>,
5658
pinned: bool,
57-
ibc_port: Option<String>
59+
ibc_port: Option<String>,
60+
eureka_port: Option<String>
5861
);
5962

6063
/// The essential data from wasmd's [CodeInfo]/[CodeInfoResponse].
@@ -119,11 +122,12 @@ mod tests {
119122
admin: Some(Addr::unchecked("king")),
120123
pinned: true,
121124
ibc_port: Some("wasm.123".to_string()),
125+
eureka_port: Some("wasm.123".to_string()),
122126
};
123127
let json = to_json_binary(&response).unwrap();
124128
assert_eq!(
125129
String::from_utf8_lossy(&json),
126-
r#"{"code_id":67,"creator":"jane","admin":"king","pinned":true,"ibc_port":"wasm.123"}"#,
130+
r#"{"code_id":67,"creator":"jane","admin":"king","pinned":true,"ibc_port":"wasm.123","eureka_port":"wasm.123"}"#,
127131
);
128132
}
129133

packages/std/src/testing/mock.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2576,6 +2576,7 @@ mod tests {
25762576
admin: None,
25772577
pinned: false,
25782578
ibc_port: None,
2579+
eureka_port: None,
25792580
};
25802581
SystemResult::Ok(ContractResult::Ok(to_json_binary(&response).unwrap()))
25812582
} else {
@@ -2656,7 +2657,7 @@ mod tests {
26562657
match result {
26572658
SystemResult::Ok(ContractResult::Ok(value)) => assert_eq!(
26582659
value,
2659-
br#"{"code_id":4,"creator":"lalala","admin":null,"pinned":false,"ibc_port":null}"#
2660+
br#"{"code_id":4,"creator":"lalala","admin":null,"pinned":false,"ibc_port":null,"eureka_port":null}"#
26602661
as &[u8]
26612662
),
26622663
res => panic!("Unexpected result: {res:?}"),

packages/std/src/traits.rs

+2
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ mod tests {
737737
admin: None,
738738
pinned: false,
739739
ibc_port: None,
740+
eureka_port: None,
740741
}
741742
}
742743

@@ -768,6 +769,7 @@ mod tests {
768769
admin: None,
769770
pinned: false,
770771
ibc_port: None,
772+
eureka_port: None,
771773
}
772774
}
773775

0 commit comments

Comments
 (0)