Skip to content

Commit 9e139be

Browse files
authored
Merge pull request #93 from scrtlabs/cosmwasm-std-v1.1.11
cosmwasm-std v1.1.11
2 parents 6880cc3 + 1fdd258 commit 9e139be

File tree

14 files changed

+80
-50
lines changed

14 files changed

+80
-50
lines changed

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "LICENSE"
@@ -36,15 +36,15 @@ utils = ["secret-toolkit-utils"]
3636
viewing-key = ["secret-toolkit-viewing-key"]
3737

3838
[dependencies]
39-
secret-toolkit-crypto = { version = "0.9", path = "packages/crypto", optional = true }
40-
secret-toolkit-incubator = { version = "0.9", path = "packages/incubator", optional = true }
41-
secret-toolkit-permit = { version = "0.9", path = "packages/permit", optional = true }
42-
secret-toolkit-serialization = { version = "0.9", path = "packages/serialization", optional = true }
43-
secret-toolkit-snip20 = { version = "0.9", path = "packages/snip20", optional = true }
44-
secret-toolkit-snip721 = { version = "0.9", path = "packages/snip721", optional = true }
45-
secret-toolkit-storage = { version = "0.9", path = "packages/storage", optional = true }
46-
secret-toolkit-utils = { version = "0.9", path = "packages/utils", optional = true }
47-
secret-toolkit-viewing-key = { version = "0.9", path = "packages/viewing_key", optional = true }
39+
secret-toolkit-crypto = { version = "0.10.0", path = "packages/crypto", optional = true }
40+
secret-toolkit-incubator = { version = "0.10.0", path = "packages/incubator", optional = true }
41+
secret-toolkit-permit = { version = "0.10.0", path = "packages/permit", optional = true }
42+
secret-toolkit-serialization = { version = "0.10.0", path = "packages/serialization", optional = true }
43+
secret-toolkit-snip20 = { version = "0.10.0", path = "packages/snip20", optional = true }
44+
secret-toolkit-snip721 = { version = "0.10.0", path = "packages/snip721", optional = true }
45+
secret-toolkit-storage = { version = "0.10.0", path = "packages/storage", optional = true }
46+
secret-toolkit-utils = { version = "0.10.0", path = "packages/utils", optional = true }
47+
secret-toolkit-viewing-key = { version = "0.10.0", path = "packages/viewing_key", optional = true }
4848

4949

5050
[workspace]
@@ -57,7 +57,7 @@ members = ["packages/*"]
5757
[workspace.dependencies]
5858
schemars = { version = "0.8.11" }
5959
serde = { version = "1.0" }
60-
cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.1.10", features = [
60+
cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.1.11", features = [
6161
"random",
6262
] }
63-
cosmwasm-storage = { package = "secret-cosmwasm-storage", version = "1.1.10" }
63+
cosmwasm-storage = { package = "secret-cosmwasm-storage", version = "1.1.11" }

Releases.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
## Unreleased
44

5+
## v0.10.0
6+
7+
### Features
8+
9+
- Bumped `cosmwasm-std` version to `v1.1.11` ([#93]).
10+
11+
### Breaking
12+
13+
- Added optional `admin` field to `utils::InitCallback::to_cosmos_msg` ([#93]).
14+
15+
### Bug fixes
16+
17+
- Only padding encrypted attributes in `utils::pad_handle_result` ([#92]).
18+
- Support `backtraces` feature for `KeyMap` and `KeySet` ([#90]).
19+
20+
[#90]: https://github.com/scrtlabs/secret-toolkit/pull/90
21+
[#92]: https://github.com/scrtlabs/secret-toolkit/pull/92
22+
[#93]: https://github.com/scrtlabs/secret-toolkit/pull/93
23+
524
## v0.9.0
625

726
### Features

packages/crypto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-crypto"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "../../LICENSE"

packages/crypto/Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Add the following to your `cargo.toml` file:
1111

1212
```toml
1313
[dependencies]
14-
secret-toolkit = { version = "0.9.0", features = ["crypto"] }
15-
secret-toolkit-crypto = { version = "0.9.0", features = ["hash", "rand", "ecc-secp256k1"] }
14+
secret-toolkit = { version = "0.10.0", features = ["crypto"] }
15+
secret-toolkit-crypto = { version = "0.10.0", features = ["hash", "rand", "ecc-secp256k1"] }
1616
```
1717

1818
## Example usage

packages/incubator/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-incubator"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "../../LICENSE"
@@ -16,7 +16,7 @@ all-features = true
1616
[dependencies]
1717
serde = { workspace = true, optional = true }
1818
cosmwasm-std = { workspace = true, optional = true }
19-
secret-toolkit-serialization = { version = "0.9", path = "../serialization", optional = true }
19+
secret-toolkit-serialization = { version = "0.10.0", path = "../serialization", optional = true }
2020

2121
[features]
2222
generational-store = ["secret-toolkit-serialization", "serde", "cosmwasm-std"]

packages/permit/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-permit"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "../../LICENSE"
@@ -20,6 +20,6 @@ ripemd = { version = "0.1.3", default-features = false }
2020
schemars = { workspace = true }
2121
bech32 = "0.9.1"
2222
remain = "0.2.8"
23-
secret-toolkit-crypto = { version = "0.9.0", path = "../crypto", features = [
23+
secret-toolkit-crypto = { version = "0.10.0", path = "../crypto", features = [
2424
"hash",
2525
] }

packages/serialization/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-serialization"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "../../LICENSE"

packages/snip20/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-snip20"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "../../LICENSE"
@@ -17,4 +17,4 @@ all-features = true
1717
serde = { workspace = true }
1818
schemars = { workspace = true }
1919
cosmwasm-std = { workspace = true }
20-
secret-toolkit-utils = { version = "0.9", path = "../utils" }
20+
secret-toolkit-utils = { version = "0.10.0", path = "../utils" }

packages/snip721/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-snip721"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "../../LICENSE"
@@ -17,4 +17,4 @@ all-features = true
1717
serde = { workspace = true }
1818
schemars = { workspace = true }
1919
cosmwasm-std = { workspace = true }
20-
secret-toolkit-utils = { version = "0.9", path = "../utils" }
20+
secret-toolkit-utils = { version = "0.10.0", path = "../utils" }

packages/storage/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-storage"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "../../LICENSE"
@@ -17,4 +17,4 @@ all-features = true
1717
serde = { workspace = true }
1818
cosmwasm-std = { workspace = true }
1919
cosmwasm-storage = { workspace = true }
20-
secret-toolkit-serialization = { version = "0.9", path = "../serialization" }
20+
secret-toolkit-serialization = { version = "0.10.0", path = "../serialization" }

packages/utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secret-toolkit-utils"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
authors = ["SCRT Labs <info@scrtlabs.com>"]
66
license-file = "../../LICENSE"

packages/utils/Readme.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ elsewhere. There isn't an overarching theme for the items in this package.
1313

1414
## Calls module
1515

16-
This module contains traits used to call another contract. Do not forget to add the `use` statement for the traits you want.
16+
This module contains traits used to call another contract. Do not forget to add the `use` statement for the traits you want.
1717

1818
```ignore
1919
use secret_toolkit::utils::{InitCallback, HandleCallback};
@@ -23,7 +23,7 @@ Also, don't forget to add the toolkit dependency to your Cargo.toml
2323

2424
### Instantiating another contract
2525

26-
If you want to instantiate another contract, you should first copy/paste the InitMsg of that contract. For example, if you wanted to create an instance of the counter contract at <https://github.com/enigmampc/secret-template>
26+
If you want to instantiate another contract, you should first copy/paste the InitMsg of that contract. For example, if you wanted to create an instance of the counter contract at <https://github.com/enigmampc/secret-template>
2727

2828
```rust
2929
# use secret_toolkit_utils::InitCallback;
@@ -40,7 +40,7 @@ impl InitCallback for CounterInitMsg {
4040
}
4141
```
4242

43-
You would copy/paste its InitMsg, and rename it so that it does not conflict with the InitMsg you have defined for your own contract. Then you would implement the `InitCallback` trait as above, setting the BLOCK_SIZE constant to the size of the blocks you want your instantiation message padded to.
43+
You would copy/paste its InitMsg, and rename it so that it does not conflict with the InitMsg you have defined for your own contract. Then you would implement the `InitCallback` trait as above, setting the BLOCK_SIZE constant to the size of the blocks you want your instantiation message padded to.
4444

4545
```rust
4646
# use secret_toolkit_utils::InitCallback;
@@ -60,10 +60,11 @@ You would copy/paste its InitMsg, and rename it so that it does not conflict wit
6060
# let response: StdResult<Response>;
6161
#
6262
let counter_init_msg = CounterInitMsg {
63-
count: 100
63+
count: 100
6464
};
6565

6666
let cosmos_msg = counter_init_msg.to_cosmos_msg(
67+
None,
6768
"new_contract_label".to_string(),
6869
123,
6970
"CODE_HASH_OF_CONTRACT_YOU_WANT_TO_INSTANTIATE".to_string(),
@@ -74,11 +75,11 @@ response = Ok(Response::new().add_message(cosmos_msg));
7475
# Ok::<(), StdError>(())
7576
```
7677

77-
Next, in the init or handle function that will instantiate the other contract, you will create an instance of the CounterInitMsg, call its `to_cosmos_msg`, and place the resulting CosmosMsg in the `messages` Vec of the InitResponse or HandleResponse that your function is returning. In this example, we are pretending that the code id of the counter contract is 123. Also, in this example, you are not sending any SCRT with the InitMsg, but if you needed to send 1 SCRT, you would replace the None in the `to_cosmos_msg` call with `Some(Uint128(1000000))`. The amount sent is in uscrt. Any CosmosMsg placed in the `messages` Vec will be executed after your contract has finished its own processing.
78+
Next, in the init or handle function that will instantiate the other contract, you will create an instance of the CounterInitMsg, call its `to_cosmos_msg`, and place the resulting CosmosMsg in the `messages` Vec of the InitResponse or HandleResponse that your function is returning. In this example, we are pretending that the code id of the counter contract is 123. Also, in this example, you are not sending any SCRT with the InitMsg, but if you needed to send 1 SCRT, you would replace the None in the `to_cosmos_msg` call with `Some(Uint128(1000000))`. The amount sent is in uscrt. Any CosmosMsg placed in the `messages` Vec will be executed after your contract has finished its own processing.
7879

7980
### Calling a handle function of another contract
8081

81-
You should first copy/paste the specific HandleMsg(s) you want to call. For example, if you wanted to reset the counter you instantiated above
82+
You should first copy/paste the specific HandleMsg(s) you want to call. For example, if you wanted to reset the counter you instantiated above
8283

8384
```rust
8485
# use secret_toolkit_utils::HandleCallback;
@@ -95,7 +96,7 @@ impl HandleCallback for CounterHandleMsg {
9596
}
9697
```
9798

98-
You would copy/paste the Reset variant of its HandleMsg enum, and rename the enum so that it does not conflict with the HandleMsg enum you have defined for your own contract. Then you would implement the `HandleCallback` trait as above, setting the BLOCK_SIZE constant to the size of the blocks you want your Reset message padded to. If you need to call multiple different Handle messages, even if they are to different contracts, you can include all the Handle messages as variants in the same enum (you can not have two variants with the same name within the same enum, though).
99+
You would copy/paste the Reset variant of its HandleMsg enum, and rename the enum so that it does not conflict with the HandleMsg enum you have defined for your own contract. Then you would implement the `HandleCallback` trait as above, setting the BLOCK_SIZE constant to the size of the blocks you want your Reset message padded to. If you need to call multiple different Handle messages, even if they are to different contracts, you can include all the Handle messages as variants in the same enum (you can not have two variants with the same name within the same enum, though).
99100

100101
```rust
101102
# use secret_toolkit_utils::HandleCallback;
@@ -107,7 +108,7 @@ You would copy/paste the Reset variant of its HandleMsg enum, and rename the enu
107108
# pub enum CounterHandleMsg {
108109
# Reset { count: i32 },
109110
# }
110-
#
111+
#
111112
# impl HandleCallback for CounterHandleMsg {
112113
# const BLOCK_SIZE: usize = 256;
113114
# }
@@ -128,11 +129,11 @@ response = Ok(Response::new().add_message(cosmos_msg));
128129
# Ok::<(), StdError>(())
129130
```
130131

131-
Next, in the init or handle function that will call the other contract, you will create an instance of the CounterHandleMsg::Reset variant, call its `to_cosmos_msg`, and place the resulting CosmosMsg in the `messages` Vec of the InitResponse or HandleResponse that your function is returning. In this example, you are not sending any SCRT with the Reset message, but if you needed to send 1 SCRT, you would replace the None in the `to_cosmos_msg` call with `Some(Uint128(1000000))`. The amount sent is in uscrt. Any CosmosMsg placed in the `messages` Vec will be executed after your contract has finished its own processing.
132+
Next, in the init or handle function that will call the other contract, you will create an instance of the CounterHandleMsg::Reset variant, call its `to_cosmos_msg`, and place the resulting CosmosMsg in the `messages` Vec of the InitResponse or HandleResponse that your function is returning. In this example, you are not sending any SCRT with the Reset message, but if you needed to send 1 SCRT, you would replace the None in the `to_cosmos_msg` call with `Some(Uint128(1000000))`. The amount sent is in uscrt. Any CosmosMsg placed in the `messages` Vec will be executed after your contract has finished its own processing.
132133

133134
### Querying another contract
134135

135-
You should first copy/paste the specific QueryMsg(s) you want to call. For example, if you wanted to get the count of the counter you instantiated above
136+
You should first copy/paste the specific QueryMsg(s) you want to call. For example, if you wanted to get the count of the counter you instantiated above
136137

137138
```rust
138139
# use secret_toolkit_utils::Query;
@@ -150,7 +151,7 @@ impl Query for CounterQueryMsg {
150151
}
151152
```
152153

153-
You would copy/paste the GetCount variant of its QueryMsg enum, and rename the enum so that it does not conflict with the QueryMsg enum you have defined for your own contract. Then you would implement the `Query` trait as above, setting the BLOCK_SIZE constant to the size of the blocks you want your query message padded to. If you need to perform multiple different queries, even if they are to different contracts, you can include all the Query messages as variants in the same enum (you can not have two variants with the same name within the same enum, though).
154+
You would copy/paste the GetCount variant of its QueryMsg enum, and rename the enum so that it does not conflict with the QueryMsg enum you have defined for your own contract. Then you would implement the `Query` trait as above, setting the BLOCK_SIZE constant to the size of the blocks you want your query message padded to. If you need to perform multiple different queries, even if they are to different contracts, you can include all the Query messages as variants in the same enum (you can not have two variants with the same name within the same enum, though).
154155

155156
```rust
156157
# use secret_toolkit_utils::Query;
@@ -163,9 +164,9 @@ pub struct CountResponse {
163164
}
164165
```
165166

166-
Next, you will copy/paste the response of the query. If the other contract defines its response to the query with a struct, you are good to go.
167+
Next, you will copy/paste the response of the query. If the other contract defines its response to the query with a struct, you are good to go.
167168

168-
If, however, the other contract returns an enum variant, one approach is to copy the fields of the variant and place them in a struct. Because an enum variant gets serialized with the name of the variant, you will then also want to create a wrapper struct whose only field has the name of the variant, and whose type is the struct you defined with the variant's fields. For example, if you wanted to do a token_info query of the [SNIP20 reference implementation](https://github.com/enigmampc/snip20-reference-impl), I would recommend using the SNIP20 toolkit function, but just for the sake of example, let's say you forgot that toolkit existed.
169+
If, however, the other contract returns an enum variant, one approach is to copy the fields of the variant and place them in a struct. Because an enum variant gets serialized with the name of the variant, you will then also want to create a wrapper struct whose only field has the name of the variant, and whose type is the struct you defined with the variant's fields. For example, if you wanted to do a token_info query of the [SNIP20 reference implementation](https://github.com/enigmampc/snip20-reference-impl), I would recommend using the SNIP20 toolkit function, but just for the sake of example, let's say you forgot that toolkit existed.
169170

170171
```rust
171172
# use secret_toolkit_utils::Query;
@@ -187,7 +188,7 @@ pub struct TokenInfoResponse {
187188
}
188189
```
189190

190-
You would copy the QueryAnswer::TokenInfo enum variant and create a TokenInfo struct with those fields. You should make all those fields public if you need to access them. Then you would create the TokenInfoResponse wrapper struct, which has only one field whose name is the name of the QueryAnswer variant in snake case (token_info). As a reminder, you only need to do this to properly deserialize the response if it was defined as an enum in the other contract.
191+
You would copy the QueryAnswer::TokenInfo enum variant and create a TokenInfo struct with those fields. You should make all those fields public if you need to access them. Then you would create the TokenInfoResponse wrapper struct, which has only one field whose name is the name of the QueryAnswer variant in snake case (token_info). As a reminder, you only need to do this to properly deserialize the response if it was defined as an enum in the other contract.
191192

192193
Now to perform the query
193194

@@ -202,7 +203,7 @@ Now to perform the query
202203
# pub enum CounterQueryMsg {
203204
# GetCount {},
204205
# }
205-
#
206+
#
206207
# impl Query for CounterQueryMsg {
207208
# const BLOCK_SIZE: usize = 256;
208209
# }
@@ -228,7 +229,7 @@ let count_response: StdResult<CountResponse> = get_count.query(
228229
# Ok::<(), StdError>(())
229230
```
230231

231-
You create an instance of the CounterQueryMsg::GetCount variant, and call its `query` function, returning its value to a variable of the response type. If you were doing a token_info query, you would write `let token_info_resp: TokenInfoResponse = ...`. You MUST use explicit type annotation here.
232+
You create an instance of the CounterQueryMsg::GetCount variant, and call its `query` function, returning its value to a variable of the response type. If you were doing a token_info query, you would write `let token_info_resp: TokenInfoResponse = ...`. You MUST use explicit type annotation here.
232233

233234
## Feature Toggle
234235

@@ -274,7 +275,7 @@ pub fn instantiate(
274275
],
275276
vec![info.sender], // Can put more than one pauser
276277
)?;
277-
278+
278279
Ok(Response::new())
279280
}
280281
```
@@ -327,7 +328,7 @@ fn redeem(
327328
amount: Option<u128>,
328329
) -> StdResult<Response> {
329330
FeatureToggle::require_not_paused(deps.as_ref().storage, vec![Features::Redeem])?;
330-
331+
331332
// Continue with function's operation
332333
Ok(Response::new())
333334
}

0 commit comments

Comments
 (0)