Skip to content

Commit

Permalink
Some PR cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Sep 28, 2020
1 parent b6f9ab8 commit 45f8b8b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/cw721-base/schema/tokens_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"properties": {
"tokens": {
"description": "Contains all token_ids in lexographical ordering If there are more than `limit`, use `start_from` in future queries to achieve pagination.",
"description": "Contains all token_ids in lexicographical ordering If there are more than `limit`, use `start_from` in future queries to achieve pagination.",
"type": "array",
"items": {
"type": "string"
Expand Down
5 changes: 4 additions & 1 deletion contracts/cw721-base/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ pub fn handle_mint<S: Storage, A: Api, Q: Querier>(
description: description.unwrap_or_default(),
image,
};
tokens(&mut deps.storage).save(token_id.as_bytes(), &token)?;
tokens(&mut deps.storage).update(token_id.as_bytes(), |old| match old {
Some(_) => Err(StdError::generic_err("token_id already claimed")),
None => Ok(token),
})?;

increment_tokens(&mut deps.storage)?;

Expand Down
2 changes: 1 addition & 1 deletion packages/cw721/schema/tokens_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"properties": {
"tokens": {
"description": "Contains all token_ids in lexographical ordering If there are more than `limit`, use `start_from` in future queries to achieve pagination.",
"description": "Contains all token_ids in lexicographical ordering If there are more than `limit`, use `start_from` in future queries to achieve pagination.",
"type": "array",
"items": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion packages/cw721/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub struct AllNftInfoResponse {

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
pub struct TokensResponse {
/// Contains all token_ids in lexographical ordering
/// Contains all token_ids in lexicographical ordering
/// If there are more than `limit`, use `start_from` in future queries
/// to achieve pagination.
pub tokens: Vec<String>,
Expand Down

0 comments on commit 45f8b8b

Please sign in to comment.