Skip to content

Commit

Permalink
Use Addr in responses
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Oct 6, 2023
1 parent 0659b5a commit fc99133
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions packages/std/src/query/wasm.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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<String>,
pub admin: Option<Addr>,
/// 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
Expand Down Expand Up @@ -68,15 +68,15 @@ 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,
}

impl_response_constructor!(
CodeInfoResponse,
code_id: u64,
creator: String,
creator: Addr,
checksum: HexBinary
);

Expand Down Expand Up @@ -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()),
};
Expand All @@ -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",
)
Expand Down
4 changes: 2 additions & 2 deletions packages/std/src/testing/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
)
Expand Down
4 changes: 2 additions & 2 deletions packages/std/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -598,7 +598,7 @@ mod tests {
fn mock_resp() -> ContractInfoResponse {
ContractInfoResponse {
code_id: 0,
creator: "creator".to_string(),
creator: Addr::unchecked("creator"),

Check warning on line 601 in packages/std/src/traits.rs

View check run for this annotation

Codecov / codecov/patch

packages/std/src/traits.rs#L601

Added line #L601 was not covered by tests
admin: None,
pinned: false,
ibc_port: None,
Expand Down

0 comments on commit fc99133

Please sign in to comment.