Repository: CosmWasm/cosmwasm
Pull request #2386 (2025-02-19 13:42:40)

Add EurekaPort to ContractInfoResponse


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a6525013..18f7a4e79 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ and this project adheres to
 - cosmwasm-std: Added new `EurekaMsg` and `CosmosMsg::Eureka` variant ([#2340])
 - cosmwasm-std: Implement downcasting for `Api` trait. This allows using
   `MockApi::addr_make` from `DepsMut`. ([#2383])
+- cosmwasm-std: Added `eureka_port` to `ContractInfoResponse`. ([#2390])
 
 ## Changed
 
@@ -48,6 +49,7 @@ and this project adheres to
 [#2374]: https://github.com/CosmWasm/cosmwasm/issues/2374
 [#2378]: https://github.com/CosmWasm/cosmwasm/issues/2378
 [#2383]: https://github.com/CosmWasm/cosmwasm/issues/2383
+[#2390]: https://github.com/CosmWasm/cosmwasm/issues/2390
 
 ## [2.2.0] - 2024-12-17
 
diff --git a/packages/std/src/query/wasm.rs b/packages/std/src/query/wasm.rs
index b05ba32d4..de6ac9142 100644
--- a/packages/std/src/query/wasm.rs
+++ b/packages/std/src/query/wasm.rs
@@ -44,6 +44,8 @@ pub struct ContractInfoResponse {
     pub pinned: bool,
     /// set if this contract has bound an IBC port
     pub ibc_port: Option<String>,
+    /// set if this contract has bound an Eureka port
+    pub eureka_port: Option<String>,
 }
 
 impl QueryResponseType for ContractInfoResponse {}
@@ -54,7 +56,8 @@ impl_response_constructor!(
     creator: Addr,
     admin: Option<Addr>,
     pinned: bool,
-    ibc_port: Option<String>
+    ibc_port: Option<String>,
+    eureka_port: Option<String>
 );
 
 /// The essential data from wasmd's [CodeInfo]/[CodeInfoResponse].
@@ -119,11 +122,12 @@ mod tests {
             admin: Some(Addr::unchecked("king")),
             pinned: true,
             ibc_port: Some("wasm.123".to_string()),
+            eureka_port: Some("wasm.123".to_string()),
         };
         let json = to_json_binary(&response).unwrap();
         assert_eq!(
             String::from_utf8_lossy(&json),
-            r#"{"code_id":67,"creator":"jane","admin":"king","pinned":true,"ibc_port":"wasm.123"}"#,
+            r#"{"code_id":67,"creator":"jane","admin":"king","pinned":true,"ibc_port":"wasm.123","eureka_port":"wasm.123"}"#,
         );
     }
 
diff --git a/packages/std/src/traits.rs b/packages/std/src/traits.rs
index 7fcc6c15f..2a64e1e50 100644
--- a/packages/std/src/traits.rs
+++ b/packages/std/src/traits.rs
@@ -737,6 +737,7 @@ mod tests {
                 admin: None,
                 pinned: false,
                 ibc_port: None,
+                eureka_port: None,
             }
         }
 
@@ -768,6 +769,7 @@ mod tests {
                 admin: None,
                 pinned: false,
                 ibc_port: None,
+                eureka_port: None,
             }
         }
 


Test patch:
diff --git a/packages/go-gen/tests/cosmwasm_std__ContractInfoResponse.go b/packages/go-gen/tests/cosmwasm_std__ContractInfoResponse.go
index 55ae866f5..c81b24df6 100644
--- a/packages/go-gen/tests/cosmwasm_std__ContractInfoResponse.go
+++ b/packages/go-gen/tests/cosmwasm_std__ContractInfoResponse.go
@@ -1,9 +1,13 @@
 type ContractInfoResponse struct {
-	// Set to the admin who can migrate contract, if any
-	Admin   string `json:"admin,omitempty"`
-	CodeID  uint64 `json:"code_id"`
-	Creator string `json:"creator"`
-	// Set if the contract is IBC enabled
-	IBCPort string `json:"ibc_port,omitempty"`
-	Pinned  bool   `json:"pinned"`
-}
\ No newline at end of file
+    // admin who can run migrations (if any)
+    Admin string `json:"admin,omitempty"`
+    CodeID uint64 `json:"code_id"`
+    // address that instantiated this contract
+    Creator string `json:"creator"`
+    // set if this contract has bound an Eureka port
+    EurekaPort string `json:"eureka_port,omitempty"`
+    // set if this contract has bound an IBC port
+    IBCPort string `json:"ibc_port,omitempty"`
+    // if set, the contract is pinned to the cache, and thus uses less gas when called
+    Pinned bool `json:"pinned"`
+}
diff --git a/packages/std/src/testing/mock.rs b/packages/std/src/testing/mock.rs
index 7981fa3c5..23cb1d989 100644
--- a/packages/std/src/testing/mock.rs
+++ b/packages/std/src/testing/mock.rs
@@ -2576,6 +2576,7 @@ mod tests {
                             admin: None,
                             pinned: false,
                             ibc_port: None,
+                            eureka_port: None,
                         };
                         SystemResult::Ok(ContractResult::Ok(to_json_binary(&response).unwrap()))
                     } else {
@@ -2656,7 +2657,7 @@ mod tests {
         match result {
             SystemResult::Ok(ContractResult::Ok(value)) => assert_eq!(
                 value,
-                br#"{"code_id":4,"creator":"lalala","admin":null,"pinned":false,"ibc_port":null}"#
+                br#"{"code_id":4,"creator":"lalala","admin":null,"pinned":false,"ibc_port":null,"eureka_port":null}"#
                     as &[u8]
             ),
             res => panic!("Unexpected result: {res:?}"),