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

Use macros for extending CW721 execute/query messages #91

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
update schema for cw2981
larry0x committed Oct 21, 2022
commit dbac3f56fcc9e503391a3b5f27744a66202f9e5c
3 changes: 2 additions & 1 deletion contracts/cw2981-royalties/schema/all_nft_info_response.json
Original file line number Diff line number Diff line change
@@ -91,7 +91,8 @@
],
"properties": {
"never": {
"type": "object"
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
52 changes: 0 additions & 52 deletions contracts/cw2981-royalties/schema/cw2981_query_msg.json

This file was deleted.

97 changes: 38 additions & 59 deletions contracts/cw2981-royalties/schema/execute_msg.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,20 @@
"description": "This is like Cw721ExecuteMsg but we add a Mint command for an owner to make this stand-alone. You will likely want to remove mint and use other control logic in any contract that inherits this.",
"oneOf": [
{
"description": "Transfer is a base message to move a token to another account without triggering actions",
"description": "Mint a new NFT, can only be called by the contract minter",
"type": "object",
"required": [
"mint"
],
"properties": {
"mint": {
"$ref": "#/definitions/MintMsg_for_Nullable_Empty"
}
},
"additionalProperties": false
},
{
"description": "Transfer is a base message to move a token to another account without triggering actions.",
"type": "object",
"required": [
"transfer_nft"
@@ -60,7 +73,7 @@
"additionalProperties": false
},
{
"description": "Allows operator to transfer / send the token from the owner's account. If expiration is set, then this allowance has a time/height limit",
"description": "Allows operator to transfer / send the token from the owner's account. If expiration is set, then this allowance has a time/height limit.",
"type": "object",
"required": [
"approve"
@@ -96,33 +109,7 @@
"additionalProperties": false
},
{
"description": "Remove previously granted Approval",
"type": "object",
"required": [
"revoke"
],
"properties": {
"revoke": {
"type": "object",
"required": [
"spender",
"token_id"
],
"properties": {
"spender": {
"type": "string"
},
"token_id": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Allows operator to transfer / send any token from the owner's account. If expiration is set, then this allowance has a time/height limit",
"description": "Allows operator to transfer / send any token from the owner's account. If expiration is set, then this allowance has a time/height limit.",
"type": "object",
"required": [
"approve_all"
@@ -154,19 +141,23 @@
"additionalProperties": false
},
{
"description": "Remove previously granted ApproveAll permission",
"description": "Remove previously granted Approval",
"type": "object",
"required": [
"revoke_all"
"revoke"
],
"properties": {
"revoke_all": {
"revoke": {
"type": "object",
"required": [
"operator"
"spender",
"token_id"
],
"properties": {
"operator": {
"spender": {
"type": "string"
},
"token_id": {
"type": "string"
}
},
@@ -176,32 +167,19 @@
"additionalProperties": false
},
{
"description": "Mint a new NFT, can only be called by the contract minter",
"type": "object",
"required": [
"mint"
],
"properties": {
"mint": {
"$ref": "#/definitions/MintMsg_for_Nullable_Empty"
}
},
"additionalProperties": false
},
{
"description": "Burn an NFT the sender has access to",
"description": "Remove previously granted ApproveAll permission",
"type": "object",
"required": [
"burn"
"revoke_all"
],
"properties": {
"burn": {
"revoke_all": {
"type": "object",
"required": [
"token_id"
"operator"
],
"properties": {
"token_id": {
"operator": {
"type": "string"
}
},
@@ -211,20 +189,20 @@
"additionalProperties": false
},
{
"description": "Extension msg",
"description": "Burn an NFT the sender has access to",
"type": "object",
"required": [
"extension"
"burn"
],
"properties": {
"extension": {
"burn": {
"type": "object",
"required": [
"msg"
"token_id"
],
"properties": {
"msg": {
"$ref": "#/definitions/Empty"
"token_id": {
"type": "string"
}
},
"additionalProperties": false
@@ -281,7 +259,8 @@
],
"properties": {
"never": {
"type": "object"
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
3 changes: 2 additions & 1 deletion contracts/cw2981-royalties/schema/operators_response.json
Original file line number Diff line number Diff line change
@@ -76,7 +76,8 @@
],
"properties": {
"never": {
"type": "object"
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
3 changes: 2 additions & 1 deletion contracts/cw2981-royalties/schema/owner_of_response.json
Original file line number Diff line number Diff line change
@@ -82,7 +82,8 @@
],
"properties": {
"never": {
"type": "object"
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
Original file line number Diff line number Diff line change
@@ -1,7 +1,47 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg_for_Cw2981QueryMsg",
"title": "QueryMsg",
"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
}
},
"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
}
},
"additionalProperties": false
},
{
"description": "Return the owner of the given token, error if token does not exist Return type: OwnerOfResponse",
"type": "object",
@@ -16,7 +56,6 @@
],
"properties": {
"include_expired": {
"description": "unset or false will filter out expired approvals, you must set to true to see them",
"type": [
"boolean",
"null"
@@ -105,7 +144,6 @@
],
"properties": {
"include_expired": {
"description": "unset or false will filter out expired items, you must set to true to see them",
"type": [
"boolean",
"null"
@@ -198,7 +236,6 @@
],
"properties": {
"include_expired": {
"description": "unset or false will filter out expired approvals, you must set to true to see them",
"type": [
"boolean",
"null"
@@ -278,88 +315,9 @@
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"minter"
],
"properties": {
"minter": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Extension query",
"type": "object",
"required": [
"extension"
],
"properties": {
"extension": {
"type": "object",
"required": [
"msg"
],
"properties": {
"msg": {
"$ref": "#/definitions/Cw2981QueryMsg"
}
},
"additionalProperties": false
}
},
"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
}
},
"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
}
},
"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"