Skip to content

Commit

Permalink
Fix sg-index-query README.md, and deploy royalty-registry to testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
tasiov committed Jul 26, 2023
1 parent 0c09797 commit f15cea7
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 12 deletions.
8 changes: 4 additions & 4 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 packages/sg-index-query/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sg-index-query"
version = "0.1.0"
version = "0.1.1"
authors = ["Tasio Victoria <tasiovictoria@ujulabs.com>"]
description = "A package that holds common functionality for dealing with cw-storage-plus indices."
edition = { workspace = true }
Expand Down
50 changes: 43 additions & 7 deletions packages/sg-index-query/README.md
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);
```
46 changes: 46 additions & 0 deletions packages/sg-index-query/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
//! # sg-index-query
//!
//! `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 range.
//!
//! ## 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);
//! ```

use cosmwasm_schema::cw_serde;
use cosmwasm_std::Order;
use cw_storage_plus::{Bound, PrimaryKey};
Expand Down
26 changes: 26 additions & 0 deletions scripts/royalty-registry/instantiate.sh
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 .

0 comments on commit f15cea7

Please sign in to comment.