DelayedReveal
Delayed Reveal
Thirdweb's DelayedReveal
is a contract extension for base NFT contracts. It lets you create batches of 'delayed-reveal' NFTs. You can learn more about the usage of delayed reveal NFTs here - https://blog.thirdweb.com/delayed-reveal-nfts
Methods
encryptDecrypt
function encryptDecrypt(bytes data, bytes key) external pure returns (bytes result)
Encrypt/decrypt data on chain.
Encrypt/decrypt given data
with key
. Uses inline assembly. See: https://ethereum.stackexchange.com/questions/69825/decrypt-message-on-chain
Parameters
Name | Type | Description |
---|---|---|
data | bytes | Bytes of data to encrypt/decrypt. |
key | bytes | Secure key used by caller for encryption/decryption. |
Returns
Name | Type | Description |
---|---|---|
result | bytes | Output after encryption/decryption of given data. |
encryptedData
function encryptedData(uint256) external view returns (bytes)
Mapping from tokenId of a batch of tokens => to delayed reveal data.
Parameters
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bytes | undefined |
getRevealURI
function getRevealURI(uint256 _batchId, bytes _key) external view returns (string revealedURI)
Returns revealed URI for a batch of NFTs.
Reveal encrypted base URI for _batchId
with caller/admin's _key
used for encryption. Reverts if there's no encrypted URI for _batchId
. See {encryptDecrypt}.
Parameters
Name | Type | Description |
---|---|---|
_batchId | uint256 | ID of the batch for which URI is being revealed. |
_key | bytes | Secure key used by caller/admin for encryption of baseURI. |
Returns
Name | Type | Description |
---|---|---|
revealedURI | string | Decrypted base URI. |
isEncryptedBatch
function isEncryptedBatch(uint256 _batchId) external view returns (bool)
Returns whether the relvant batch of NFTs is subject to a delayed reveal.
Returns true
if _batchId
's base URI is encrypted.
Parameters
Name | Type | Description |
---|---|---|
_batchId | uint256 | ID of a batch of NFTs. |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
reveal
function reveal(uint256 identifier, bytes key) external nonpayable returns (string revealedURI)
Reveals a batch of delayed reveal NFTs.
Parameters
Name | Type | Description |
---|---|---|
identifier | uint256 | The ID for the batch of delayed-reveal NFTs to reveal. |
key | bytes | The key with which the base URI for the relevant batch of NFTs was encrypted. |
Returns
Name | Type | Description |
---|---|---|
revealedURI | string | undefined |
Events
TokenURIRevealed
event TokenURIRevealed(uint256 indexed index, string revealedURI)
Parameters
Name | Type | Description |
---|---|---|
index indexed | uint256 | undefined |
revealedURI | string | undefined |