diff --git a/contracts/cw721-base/src/msg.rs b/contracts/cw721-base/src/msg.rs index 6d2994e7b..7b3540d8c 100644 --- a/contracts/cw721-base/src/msg.rs +++ b/contracts/cw721-base/src/msg.rs @@ -81,7 +81,6 @@ pub enum QueryMsg { /// unset or false will filter out expired approvals, you must set to true to see them include_expired: Option, }, - /// Return operator that can access all of the owner's tokens. /// Return type: `ApprovalResponse` Approval { @@ -89,14 +88,12 @@ pub enum QueryMsg { spender: String, include_expired: Option, }, - /// Return approvals that a token has /// Return type: `ApprovalsResponse` Approvals { token_id: String, include_expired: Option, }, - /// List all operators that can access all of the owner's tokens /// Return type: `OperatorsResponse` AllOperators { diff --git a/packages/cw721/README.md b/packages/cw721/README.md index 250fd034e..883809f04 100644 --- a/packages/cw721/README.md +++ b/packages/cw721/README.md @@ -53,15 +53,26 @@ to the given `operator`. ### Queries -`OwnerOf{token_id}` - Returns the owner of the given token, -as well as anyone with approval on this particular token. -If the token is unknown, returns an error. Return type is -`OwnerResponse{owner}`. - -`ApprovedForAll{owner, include_expired}` - List all operators that can -access all of the owner's tokens. Return type is `ApprovedForAllResponse`. -If `include_expired` is set, show expired owners in the results, otherwise, -ignore them. +`OwnerOf{token_id, include_expired}` - Returns the owner of the given token, +as well as anyone with approval on this particular token. If the token is +unknown, returns an error. Return type is `OwnerOfResponse`. If +`include_expired` is set, show expired owners in the results, otherwise, ignore +them. + +`Approval{token_id, spender, include_expired}` - Return an approval of `spender` +about the given `token_id`. Return type is `ApprovalResponse`. If +`include_expired` is set, show expired owners in the results, otherwise, ignore +them. + +`Approvals{token_id, include_expired}` - Return all approvals that owner given +access to. Return type is `ApprovalsResponse`. If `include_expired` is set, show +expired owners in the results, otherwise, ignore them. + +`AllOperators{owner, include_expired, start_after, limit}` - List all +operators that can access all of the owner's tokens. Return type is +`OperatorsResponse`. If `include_expired` is set, show expired owners in the +results, otherwise, ignore them. If `start_after` is set, then it returns the +first `limit` operators *after* the given one. `NumTokens{}` - Total number of tokens issued diff --git a/packages/cw721/schema/cw721_query_msg.json b/packages/cw721/schema/cw721_query_msg.json index 383e1b437..b7dc6e0d0 100644 --- a/packages/cw721/schema/cw721_query_msg.json +++ b/packages/cw721/schema/cw721_query_msg.json @@ -31,23 +31,29 @@ "additionalProperties": false }, { - "description": "Return operator that can access all of the owner's tokens. Return type: `ApprovedResponse`", + "description": "Return operator that can access all of the owner's tokens. Return type: `ApprovalResponse`", "type": "object", "required": [ - "approved" + "approval" ], "properties": { - "approved": { + "approval": { "type": "object", "required": [ - "operator", - "owner" + "spender", + "token_id" ], "properties": { - "operator": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "spender": { "type": "string" }, - "owner": { + "token_id": { "type": "string" } } @@ -56,20 +62,47 @@ "additionalProperties": false }, { - "description": "List all operators that can access all of the owner's tokens. Return type: `ApprovedForAllResponse`", + "description": "Return approvals that a token has Return type: `ApprovalsResponse`", "type": "object", "required": [ - "approved_for_all" + "approvals" ], "properties": { - "approved_for_all": { + "approvals": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "List all operators that can access all of the owner's tokens Return type: `OperatorsResponse`", + "type": "object", + "required": [ + "all_operators" + ], + "properties": { + "all_operators": { "type": "object", "required": [ "owner" ], "properties": { "include_expired": { - "description": "unset or false will filter out expired approvals, you must set to true to see them", + "description": "unset or false will filter out expired items, you must set to true to see them", "type": [ "boolean", "null" diff --git a/packages/cw721/src/query.rs b/packages/cw721/src/query.rs index f5453f9f1..42d0e8040 100644 --- a/packages/cw721/src/query.rs +++ b/packages/cw721/src/query.rs @@ -13,16 +13,24 @@ pub enum Cw721QueryMsg { /// unset or false will filter out expired approvals, you must set to true to see them include_expired: Option, }, - /// Return operator that can access all of the owner's tokens. - /// Return type: `ApprovedResponse` - Approved { owner: String, operator: String }, - - /// List all operators that can access all of the owner's tokens. - /// Return type: `ApprovedForAllResponse` - ApprovedForAll { + /// Return type: `ApprovalResponse` + Approval { + token_id: String, + spender: String, + include_expired: Option, + }, + /// Return approvals that a token has + /// Return type: `ApprovalsResponse` + Approvals { + token_id: String, + include_expired: Option, + }, + /// List all operators that can access all of the owner's tokens + /// Return type: `OperatorsResponse` + AllOperators { owner: String, - /// unset or false will filter out expired approvals, you must set to true to see them + /// unset or false will filter out expired items, you must set to true to see them include_expired: Option, start_after: Option, limit: Option,