Skip to content

Commit

Permalink
set toolkit rev
Browse files Browse the repository at this point in the history
  • Loading branch information
baedrik committed Nov 15, 2020
1 parent 092b0b1 commit a8a358d
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 41 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ serde = { version = "1.0.103", default-features = false, features = ["derive"] }
serde-json-wasm = "0.2.1"
snafu = { version = "0.6.3" }
chrono = { version = "0.4.19" }
secret-toolkit = { git = "https://github.com/baedrik/secret-toolkit", branch = "add-snip20-calls" }
secret-toolkit = { git = "https://github.com/baedrik/secret-toolkit", rev = "2042950" }
24 changes: 12 additions & 12 deletions WALKTHROUGH.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ First define an enum that matches the HandleMsg enum of the function you want to
impl ExampleHandleMsg {
pub fn to_cosmos_msg(
&self,
callback_code_hash: &str,
contract_addr: &HumanAddr,
callback_code_hash: String,
contract_addr: HumanAddr,
send_amount: Option<Uint128>,
) -> StdResult<CosmosMsg> {
let mut msg = to_binary(self)?;
Expand All @@ -408,8 +408,8 @@ impl ExampleHandleMsg {
}
let execute = WasmMsg::Execute {
msg,
contract_addr: contract_addr.clone(),
callback_code_hash: callback_code_hash.to_string(),
contract_addr,
callback_code_hash,
send,
};
Ok(execute.into())
Expand All @@ -421,15 +421,15 @@ Then implement a function to turn the HandleMsg enum into a callback message you
impl ExampleHandleMsg {
pub fn to_cosmos_msg(
&self,
callback_code_hash: &str,
contract_addr: &HumanAddr,
callback_code_hash: String,
contract_addr: HumanAddr,
) -> StdResult<CosmosMsg> {
let mut msg = to_binary(self)?;
space_pad(&mut msg.0, PADDING_BLOCK_SIZE);
let execute = WasmMsg::Execute {
msg,
contract_addr: contract_addr.clone(),
callback_code_hash: callback_code_hash.to_string(),
contract_addr,
callback_code_hash,
send: vec![],
};
Ok(execute.into())
Expand Down Expand Up @@ -694,15 +694,15 @@ impl ExampleQueryMsg {
pub fn query<S: Storage, A: Api, Q: Querier, T: DeserializeOwned>(
&self,
deps: &Extern<S, A, Q>,
callback_code_hash: &str,
contract_addr: &HumanAddr,
callback_code_hash: String,
contract_addr: HumanAddr,
) -> StdResult<T> {
let mut msg = to_binary(self)?;
space_pad(&mut msg.0, QUERY_BLOCK_SIZE);
deps.querier
.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: contract_addr.clone(),
callback_code_hash: callback_code_hash.to_string(),
contract_addr,
callback_code_hash,
msg,
}))
.map_err(|err| {
Expand Down
60 changes: 53 additions & 7 deletions schema/handle_answer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "HandleAnswer",
"description": "Responses from handle functions",
"anyOf": [
{
"description": "response from consign attempt",
"type": "object",
"required": [
"consign"
Expand All @@ -16,6 +18,7 @@
],
"properties": {
"amount_consigned": {
"description": "Optional amount consigned",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -26,6 +29,7 @@
]
},
"amount_needed": {
"description": "Optional amount that still needs to be consigned",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -36,6 +40,7 @@
]
},
"amount_returned": {
"description": "Optional amount of tokens returned from escrow",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -46,16 +51,23 @@
]
},
"message": {
"description": "execution description",
"type": "string"
},
"status": {
"$ref": "#/definitions/ResponseStatus"
"description": "success or failure",
"allOf": [
{
"$ref": "#/definitions/ResponseStatus"
}
]
}
}
}
}
},
{
"description": "response from bid attempt",
"type": "object",
"required": [
"bid"
Expand All @@ -69,6 +81,7 @@
],
"properties": {
"amount_bid": {
"description": "Optional amount bid",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -79,6 +92,7 @@
]
},
"amount_returned": {
"description": "Optional amount of tokens returned from escrow",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -89,9 +103,11 @@
]
},
"message": {
"description": "execution description",
"type": "string"
},
"previous_bid": {
"description": "Optional amount of previous bid returned from escrow",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -102,13 +118,19 @@
]
},
"status": {
"$ref": "#/definitions/ResponseStatus"
"description": "success or failure",
"allOf": [
{
"$ref": "#/definitions/ResponseStatus"
}
]
}
}
}
}
},
{
"description": "response from closing the auction",
"type": "object",
"required": [
"close_auction"
Expand All @@ -122,6 +144,7 @@
],
"properties": {
"amount_returned": {
"description": "Optional amount of tokens returned form escrow",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -132,12 +155,19 @@
]
},
"message": {
"description": "execution description",
"type": "string"
},
"status": {
"$ref": "#/definitions/ResponseStatus"
"description": "success or failure",
"allOf": [
{
"$ref": "#/definitions/ResponseStatus"
}
]
},
"winning_bid": {
"description": "Optional amount of winning bid",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -152,6 +182,7 @@
}
},
{
"description": "response from attempt to retract bid",
"type": "object",
"required": [
"retract_bid"
Expand All @@ -165,6 +196,7 @@
],
"properties": {
"amount_returned": {
"description": "Optional amount of tokens returned from escrow",
"anyOf": [
{
"$ref": "#/definitions/Uint128"
Expand All @@ -175,16 +207,23 @@
]
},
"message": {
"description": "execution description",
"type": "string"
},
"status": {
"$ref": "#/definitions/ResponseStatus"
"description": "success or failure",
"allOf": [
{
"$ref": "#/definitions/ResponseStatus"
}
]
}
}
}
}
},
{
"description": "generic status response",
"type": "object",
"required": [
"status"
Expand All @@ -198,10 +237,16 @@
],
"properties": {
"message": {
"description": "execution description",
"type": "string"
},
"status": {
"$ref": "#/definitions/ResponseStatus"
"description": "success or failure",
"allOf": [
{
"$ref": "#/definitions/ResponseStatus"
}
]
}
}
}
Expand All @@ -210,10 +255,11 @@
],
"definitions": {
"ResponseStatus": {
"description": "success or failure response",
"type": "string",
"enum": [
"success",
"failure"
"Success",
"Failure"
]
},
"Uint128": {
Expand Down
Loading

0 comments on commit a8a358d

Please sign in to comment.