From fc99133702607764e6da8f640ec9d27416e188e7 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Wed, 4 Oct 2023 13:38:39 +0200 Subject: [PATCH] Use Addr in responses --- packages/std/src/query/wasm.rs | 16 ++++++++-------- packages/std/src/testing/mock.rs | 4 ++-- packages/std/src/traits.rs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/std/src/query/wasm.rs b/packages/std/src/query/wasm.rs index f4fcc9f57f..75cbec3378 100644 --- a/packages/std/src/query/wasm.rs +++ b/packages/std/src/query/wasm.rs @@ -1,7 +1,7 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use crate::{Binary, HexBinary}; +use crate::{Addr, Binary, HexBinary}; use super::query_response::QueryResponseType; @@ -36,9 +36,9 @@ pub enum WasmQuery { pub struct ContractInfoResponse { pub code_id: u64, /// address that instantiated this contract - pub creator: String, + pub creator: Addr, /// admin who can run migrations (if any) - pub admin: Option, + pub admin: Option, /// if set, the contract is pinned to the cache, and thus uses less gas when called pub pinned: bool, /// set if this contract has bound an IBC port @@ -68,7 +68,7 @@ impl QueryResponseType for ContractInfoResponse {} pub struct CodeInfoResponse { pub code_id: u64, /// The address that initially stored the code - pub creator: String, + pub creator: Addr, /// The hash of the Wasm blob pub checksum: HexBinary, } @@ -76,7 +76,7 @@ pub struct CodeInfoResponse { impl_response_constructor!( CodeInfoResponse, code_id: u64, - creator: String, + creator: Addr, checksum: HexBinary ); @@ -114,8 +114,8 @@ mod tests { fn contract_info_response_serialization() { let response = ContractInfoResponse { code_id: 67, - creator: "jane".to_string(), - admin: Some("king".to_string()), + creator: Addr::unchecked("jane"), + admin: Some(Addr::unchecked("king")), pinned: true, ibc_port: Some("wasm.123".to_string()), }; @@ -133,7 +133,7 @@ mod tests { let response = CodeInfoResponse { code_id: 67, - creator: "jane".to_string(), + creator: Addr::unchecked("jane"), checksum: HexBinary::from_hex( "f7bb7b18fb01bbf425cf4ed2cd4b7fb26a019a7fc75a4dc87e8a0b768c501f00", ) diff --git a/packages/std/src/testing/mock.rs b/packages/std/src/testing/mock.rs index d2ca6d65f6..6027d8caaf 100644 --- a/packages/std/src/testing/mock.rs +++ b/packages/std/src/testing/mock.rs @@ -2148,7 +2148,7 @@ mod tests { if *contract_addr == constract1 { let response = ContractInfoResponse { code_id: 4, - creator: "lalala".into(), + creator: Addr::unchecked("lalala"), admin: None, pinned: false, ibc_port: None, @@ -2167,7 +2167,7 @@ mod tests { if code_id == 4 { let response = CodeInfoResponse { code_id, - creator: "lalala".into(), + creator: Addr::unchecked("lalala"), checksum: HexBinary::from_hex( "84cf20810fd429caf58898c3210fcb71759a27becddae08dbde8668ea2f4725d", ) diff --git a/packages/std/src/traits.rs b/packages/std/src/traits.rs index de44b1bd87..59644a05e0 100644 --- a/packages/std/src/traits.rs +++ b/packages/std/src/traits.rs @@ -567,7 +567,7 @@ mod tests { fn mock_resp() -> ContractInfoResponse { ContractInfoResponse { code_id: 0, - creator: "creator".to_string(), + creator: Addr::unchecked("creator"), admin: None, pinned: false, ibc_port: None, @@ -598,7 +598,7 @@ mod tests { fn mock_resp() -> ContractInfoResponse { ContractInfoResponse { code_id: 0, - creator: "creator".to_string(), + creator: Addr::unchecked("creator"), admin: None, pinned: false, ibc_port: None,