-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix sg-index-query README.md, and deploy royalty-registry to testnet
- Loading branch information
Showing
5 changed files
with
120 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,45 @@ | ||
# sg-marketplace-common | ||
# sg-index-query | ||
|
||
The `sg-marketplace-common` common package is used to manage functionality shared between marketplace contracts. The package is divided into the following modules: | ||
`sg-index-query` is a Rust crate providing a `QueryOptions` struct for use in CosmWasm smart contracts. | ||
It allows you to specify query parameters such as limit, order, and the min max of range queries. | ||
|
||
- `mod address`: functionality related to the `cosmwasm_std::Addr` type | ||
- `mod coin`: functionality related to the `cosmwasm_std::Coin` type | ||
- `mod nft`: functionality related to NFT data | ||
- `mod query`: functionality related to querying smart contracts | ||
- `mod sale`: functionality related to NFT sales | ||
## Features | ||
|
||
- `QueryOptions` struct for specifying query parameters such as limit, order, and range. | ||
- `unpack` function for converting `QueryOptions` into `QueryOptionsInternal`, which is used for range queries in `cw_storage_plus`. | ||
|
||
## Usage | ||
|
||
First, add the following to your `Cargo.toml`: | ||
|
||
```toml | ||
[dependencies] | ||
sg-index-query = "0.1.0" | ||
``` | ||
|
||
Then, you can use the `QueryOptions` struct in your code: | ||
|
||
```rust | ||
use sg_index_query::QueryOptions; | ||
|
||
let query_options = QueryOptions::<String>::default(); | ||
``` | ||
|
||
You can specify query parameters like so: | ||
|
||
```rust | ||
use sg_index_query::{QueryOptions, QueryBound}; | ||
|
||
let query_options = QueryOptions { | ||
descending: Some(true), | ||
limit: Some(20), | ||
min: Some(QueryBound::Inclusive("test".to_string())), | ||
max: Some(QueryBound::Exclusive("test2".to_string())), | ||
}; | ||
``` | ||
|
||
Then, you can unpack the `QueryOptions` into `QueryOptionsInternal`: | ||
|
||
```rust | ||
let query_options_internal = query_options.unpack(&|offset: &String| offset.to_string(), None, None); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
CODE_ID=2718 | ||
MSG=$(cat <<EOF | ||
{ | ||
"config": { | ||
"update_wait_period": 30, | ||
"max_share_delta": "0.02" | ||
} | ||
} | ||
EOF | ||
) | ||
|
||
FROM="hot-wallet" | ||
CHAIN_ID="elgafar-1" | ||
NODE="https://rpc.elgafar-1.stargaze-apis.com:443" | ||
|
||
starsd tx wasm instantiate $CODE_ID "$MSG" \ | ||
--label "stargaze-fair-burn" \ | ||
--from "$FROM" \ | ||
--chain-id "$CHAIN_ID" \ | ||
--node "$NODE" \ | ||
--gas-prices 1ustars \ | ||
--gas-adjustment 1.7 \ | ||
--gas auto \ | ||
--no-admin \ | ||
-b block \ | ||
-o json | jq . |