Skip to content

Commit

Permalink
Merge branch 'main' into 1498-key-only-iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort authored Aug 28, 2023
2 parents 4f68dd7 + 05ece0b commit 1002245
Show file tree
Hide file tree
Showing 45 changed files with 1,973 additions and 114 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ and this project adheres to
- cosmwasm-std: Make `abs_diff` const for `Uint{256,512}` and
`Int{64,128,256,512}`. It is now const for all integer types.
- cosmwasm-std: Implement `TryFrom<Decimal256>` for `Decimal` ([#1832])
- cosmwasm-std: Add `StdAck`. ([#1512])
- cosmwasm-std: Add new imports `db_next_{key, value}` for iterating storage
keys / values only and make `Storage::{range_keys, range_values}` more
efficient. This requires the `cosmwasm_1_4` feature to be enabled. ([#1834])

[#1512]: https://github.com/CosmWasm/cosmwasm/issues/1512
[#1799]: https://github.com/CosmWasm/cosmwasm/pull/1799
[#1806]: https://github.com/CosmWasm/cosmwasm/pull/1806
[#1832]: https://github.com/CosmWasm/cosmwasm/pull/1832
Expand Down
68 changes: 48 additions & 20 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "AcknowledgementMsgBalances",
"description": "A custom acknowledgement type. The success type `T` depends on the PacketMsg variant.\n\nThis could be refactored to use [StdAck] at some point. However, it has a different success variant name (\"ok\" vs. \"result\") and a JSON payload instead of a binary payload.\n\n[StdAck]: https://github.com/CosmWasm/cosmwasm/issues/1512",
"oneOf": [
{
"type": "object",
"required": [
"ok"
],
"properties": {
"ok": {
"$ref": "#/definitions/BalancesResponse"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "string"
}
},
"additionalProperties": false
}
],
"definitions": {
"BalancesResponse": {
"description": "This is the success response we send on ack for PacketMsg::Balance. Just acknowledge success or error",
"type": "object",
"required": [
"account",
"balances"
],
"properties": {
"account": {
"type": "string"
},
"balances": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
}
},
"Coin": {
"type": "object",
"required": [
"amount",
"denom"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
},
"denom": {
"type": "string"
}
}
},
"Uint128": {
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
"type": "string"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "AcknowledgementMsgDispatch",
"description": "A custom acknowledgement type. The success type `T` depends on the PacketMsg variant.\n\nThis could be refactored to use [StdAck] at some point. However, it has a different success variant name (\"ok\" vs. \"result\") and a JSON payload instead of a binary payload.\n\n[StdAck]: https://github.com/CosmWasm/cosmwasm/issues/1512",
"oneOf": [
{
"type": "object",
"required": [
"ok"
],
"properties": {
"ok": {
"type": "null"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "string"
}
},
"additionalProperties": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "AcknowledgementMsgWhoAmI",
"description": "A custom acknowledgement type. The success type `T` depends on the PacketMsg variant.\n\nThis could be refactored to use [StdAck] at some point. However, it has a different success variant name (\"ok\" vs. \"result\") and a JSON payload instead of a binary payload.\n\n[StdAck]: https://github.com/CosmWasm/cosmwasm/issues/1512",
"oneOf": [
{
"type": "object",
"required": [
"ok"
],
"properties": {
"ok": {
"$ref": "#/definitions/WhoAmIResponse"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "string"
}
},
"additionalProperties": false
}
],
"definitions": {
"WhoAmIResponse": {
"description": "This is the success response we send on ack for PacketMsg::WhoAmI. Return the caller's account address on the remote chain",
"type": "object",
"required": [
"account"
],
"properties": {
"account": {
"type": "string"
}
}
}
}
}
22 changes: 20 additions & 2 deletions contracts/ibc-reflect-send/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::env::current_dir;

use cosmwasm_schema::{export_schema, schema_for, write_api};
use cosmwasm_schema::{export_schema, export_schema_with_title, schema_for, write_api};

use ibc_reflect_send::ibc_msg::PacketMsg;
use ibc_reflect_send::ibc_msg::{
AcknowledgementMsg, BalancesResponse, DispatchResponse, PacketMsg, WhoAmIResponse,
};
use ibc_reflect_send::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
Expand All @@ -16,5 +18,21 @@ fn main() {
// Schemas for inter-contract communication
let mut out_dir = current_dir().unwrap();
out_dir.push("schema");
out_dir.push("ibc");
export_schema(&schema_for!(PacketMsg), &out_dir);
export_schema_with_title(
&schema_for!(AcknowledgementMsg<BalancesResponse>),
&out_dir,
"AcknowledgementMsgBalances",
);
export_schema_with_title(
&schema_for!(AcknowledgementMsg<DispatchResponse>),
&out_dir,
"AcknowledgementMsgDispatch",
);
export_schema_with_title(
&schema_for!(AcknowledgementMsg<WhoAmIResponse>),
&out_dir,
"AcknowledgementMsgWhoAmI",
);
}
Loading

0 comments on commit 1002245

Please sign in to comment.