getRoyalties
which we designed. This method also has to be tagged as Safe
(read only).
Example in Python:@public(safe=True)
def getRoyalties(tokenId: bytes) -> bytes:
"""
Get a token royalties values.
:param tokenId: the token to get royalties values
:type tokenId: ByteString
:return: bytes of addresses and values for this token royalties.
:raise AssertionError: raised if any tokenId is not a valid NFT.
"""
royalties = get_royalties(tokenId)
return royalties
[{"address":"NNau7VyBMQno89H8aAyirVJTdyLVeRxHGy","value":"1000"}]
where NNau7VyBMQno89H8aAyirVJTdyLVeRxHGy
would be getting 10% of all sales as royalties.
Note that the value is in BPS (ie 10% is 1000). We support multiple royalties, up to a maximum combined of 50% royalties.
Once implemented in a contract, the method needs to be registered on our trading contract, as there is currently no way on Neo N3 to automate this part.
To do so, a transaction needs to be initiated on our trading contract and call a method with some parameters:
- Neo N3 MainNet trading contract: 0xcc638d55d99fc81295daccbaf722b84f179fb9c4
- Neo N3 TestNet trading contract: 0xa4276772f429fc31032c4cd8bf3c98c806318f3e
registerContract
- parameters: contract
(UInt160), and royaltyMethod
(string)royaltyMethod
is getRoyalties
(Z2V0Um95YWx0aWVz
in ByteString), and for contract
it's the hash of the contract to register.
Here's an example of the parameters in Javascript when calling this method to register a contract in order to enable support for per NFT royalties:0x913FbdC42a77edb0aEFFCEEAe00240C368d9B6b1
- Avalanche Testnet royalties contract: 0x92bf637c4FadEC1b698002cbA1583850e6EC97d3
0x1073e1d5977002d5db4F9E776482E8BF113C745c
- BSC Testnet trading royalties: 0x5EC6bFE900C140323C66FC9Fc53619631B46Cb69
0x7eD7Bff3bEfa9cEDf6A6d4768F4051fEd7fC1975
- Polygon Testnet royalties contract: 0x7E20461EcC3B27586EFEa0e3dB9E80bfbE55B9eB
0x3dA0bD10dfD98E96E04fbAa8e0512b2c413b096A
- Ethereum Testnet royalties contract: 0xca1284B5EEb97c31cc693c4b182C8E1075Dc57f9
setRoyaltiesByToken
- parameters: token
(address), and royalties
(array of account/value objects)0xcc638d55d99fc81295daccbaf722b84f179fb9c4
- Neo N3 TestNet trading contract: 0xa4276772f429fc31032c4cd8bf3c98c806318f3e
SetRoyaltiesForContract
- parameters: contract
(UInt160), and royalties
(array of Address/Value objects)
Important: this method requires a double Signer
, 1) the contract owner, and 2) the contract itself. So when calling it, you need to pass an array of those two Signers