Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to update cw-nft to add custom query and custom execute. #42

Merged
merged 18 commits into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions contracts/cw2981-royalties/examples/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::env::current_dir;
use std::fs::create_dir_all;

use cosmwasm_schema::{export_schema, export_schema_with_title, remove_schemas, schema_for};
use cosmwasm_std::Empty;

use cw721::{
AllNftInfoResponse, ContractInfoResponse, NftInfoResponse, NumTokensResponse,
Expand All @@ -18,8 +19,12 @@ fn main() {
remove_schemas(&out_dir).unwrap();

export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema_with_title(&schema_for!(ExecuteMsg<Extension>), &out_dir, "ExecuteMsg");
export_schema(&schema_for!(QueryMsg), &out_dir);
export_schema_with_title(
&schema_for!(ExecuteMsg<Extension, Empty>),
&out_dir,
"ExecuteMsg",
);
export_schema(&schema_for!(QueryMsg<Cw2981QueryMsg>), &out_dir);
export_schema_with_title(
&schema_for!(AllNftInfoResponse<Extension>),
&out_dir,
Expand Down
209 changes: 0 additions & 209 deletions contracts/cw2981-royalties/schema/cw2981_query_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,215 +39,6 @@
}
},
"additionalProperties": false
},
{
"description": "Return the owner of the given token, error if token does not exist Return type: OwnerOfResponse",
"type": "object",
"required": [
"owner_of"
],
"properties": {
"owner_of": {
"type": "object",
"required": [
"token_id"
],
"properties": {
"include_expired": {
"description": "unset or false will filter out expired approvals, you must set to true to see them",
"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",
"type": [
"boolean",
"null"
]
},
"limit": {
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0.0
},
"owner": {
"type": "string"
},
"start_after": {
"type": [
"string",
"null"
]
}
}
}
},
"additionalProperties": false
},
{
"description": "Total number of tokens issued",
"type": "object",
"required": [
"num_tokens"
],
"properties": {
"num_tokens": {
"type": "object"
}
},
"additionalProperties": false
},
{
"description": "With MetaData Extension. Returns top-level metadata about the contract: `ContractInfoResponse`",
"type": "object",
"required": [
"contract_info"
],
"properties": {
"contract_info": {
"type": "object"
}
},
"additionalProperties": false
},
{
"description": "With MetaData Extension. Returns metadata about one particular token, based on *ERC721 Metadata JSON Schema* but directly from the contract: `NftInfoResponse`",
"type": "object",
"required": [
"nft_info"
],
"properties": {
"nft_info": {
"type": "object",
"required": [
"token_id"
],
"properties": {
"token_id": {
"type": "string"
}
}
}
},
"additionalProperties": false
},
{
"description": "With MetaData Extension. Returns the result of both `NftInfo` and `OwnerOf` as one query as an optimization for clients: `AllNftInfo`",
"type": "object",
"required": [
"all_nft_info"
],
"properties": {
"all_nft_info": {
"type": "object",
"required": [
"token_id"
],
"properties": {
"include_expired": {
"description": "unset or false will filter out expired approvals, you must set to true to see them",
"type": [
"boolean",
"null"
]
},
"token_id": {
"type": "string"
}
}
}
},
"additionalProperties": false
},
{
"description": "With Enumerable extension. Returns all tokens owned by the given address, [] if unset. Return type: TokensResponse.",
"type": "object",
"required": [
"tokens"
],
"properties": {
"tokens": {
"type": "object",
"required": [
"owner"
],
"properties": {
"limit": {
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0.0
},
"owner": {
"type": "string"
},
"start_after": {
"type": [
"string",
"null"
]
}
}
}
},
"additionalProperties": false
},
{
"description": "With Enumerable extension. Requires pagination. Lists all token_ids controlled by the contract. Return type: TokensResponse.",
"type": "object",
"required": [
"all_tokens"
],
"properties": {
"all_tokens": {
"type": "object",
"properties": {
"limit": {
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0.0
},
"start_after": {
"type": [
"string",
"null"
]
}
}
}
},
"additionalProperties": false
}
],
"definitions": {
Expand Down
21 changes: 21 additions & 0 deletions contracts/cw2981-royalties/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,27 @@
}
},
"additionalProperties": false
},
{
"description": "Extension msg",
"type": "object",
"required": [
"extension"
],
"properties": {
"extension": {
"type": "object",
"required": [
"msg"
],
"properties": {
"msg": {
"$ref": "#/definitions/Empty"
}
}
}
},
"additionalProperties": false
}
],
"definitions": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"title": "QueryMsg_for_Cw2981QueryMsg",
"oneOf": [
{
"description": "Return the owner of the given token, error if token does not exist Return type: OwnerOfResponse",
Expand Down Expand Up @@ -280,6 +280,75 @@
}
},
"additionalProperties": false
},
{
"description": "Extension query",
"type": "object",
"required": [
"extension"
],
"properties": {
"extension": {
"type": "object",
"required": [
"msg"
],
"properties": {
"msg": {
"$ref": "#/definitions/Cw2981QueryMsg"
}
}
}
},
"additionalProperties": false
}
],
"definitions": {
"Cw2981QueryMsg": {
"oneOf": [
{
"description": "Should be called on sale to see if royalties are owed by the marketplace selling the NFT, if CheckRoyalties returns true See https://eips.ethereum.org/EIPS/eip-2981",
"type": "object",
"required": [
"royalty_info"
],
"properties": {
"royalty_info": {
"type": "object",
"required": [
"sale_price",
"token_id"
],
"properties": {
"sale_price": {
"$ref": "#/definitions/Uint128"
},
"token_id": {
"type": "string"
}
}
}
},
"additionalProperties": false
},
{
"description": "Called against contract to determine if this NFT implements royalties. Should return a boolean as part of CheckRoyaltiesResponse - default can simply be true if royalties are implemented at token level (i.e. always check on sale)",
"type": "object",
"required": [
"check_royalties"
],
"properties": {
"check_royalties": {
"type": "object"
}
},
"additionalProperties": false
}
]
},
"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"
}
]
}
}
Loading