Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 22 additions & 0 deletions docs/feature_snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,17 @@
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.erc1155claimable"
}
},
{
"name": "revealer",
"summary": "Delayed reveal\n\n",
"remarks": "\n\nCreate a batch of encrypted NFTs that can be revealed at a later time.\n\n",
"examples": {
"javascript": "// the real NFTs, these will be encrypted until you reveal them\nconst realNFTs = [{\n name: \"Common NFT #1\",\n description: \"Common NFT, one of many.\",\n image: fs.readFileSync(\"path/to/image.png\"),\n}, {\n name: \"Super Rare NFT #2\",\n description: \"You got a Super Rare NFT!\",\n image: fs.readFileSync(\"path/to/image.png\"),\n}];\n// A placeholder NFT that people will get immediately in their wallet, and will be converted to the real NFT at reveal time\nconst placeholderNFT = {\n name: \"Hidden NFT\",\n description: \"Will be revealed next week!\"\n};\n// Create and encrypt the NFTs\nawait contract.edition.drop.revealer.createDelayedRevealBatch(\n placeholderNFT,\n realNFTs,\n \"my secret password\",\n);\n// Whenever you're ready, reveal your NFTs at any time\nconst batchId = 0; // the batch to reveal\nawait contract.edition.drop.revealer.reveal(batchId, \"my secret password\");"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.delayedreveal"
}
}
],
"reference": {
Expand Down Expand Up @@ -839,6 +850,17 @@
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.erc721claimable"
}
},
{
"name": "revealer",
"summary": "Delayed reveal\n\n",
"remarks": "\n\nCreate a batch of encrypted NFTs that can be revealed at a later time.\n\n",
"examples": {
"javascript": "// the real NFTs, these will be encrypted until you reveal them\nconst realNFTs = [{\n name: \"Common NFT #1\",\n description: \"Common NFT, one of many.\",\n image: fs.readFileSync(\"path/to/image.png\"),\n}, {\n name: \"Super Rare NFT #2\",\n description: \"You got a Super Rare NFT!\",\n image: fs.readFileSync(\"path/to/image.png\"),\n}];\n// A placeholder NFT that people will get immediately in their wallet, and will be converted to the real NFT at reveal time\nconst placeholderNFT = {\n name: \"Hidden NFT\",\n description: \"Will be revealed next week!\"\n};\n// Create and encrypt the NFTs\nawait contract.nft.drop.revealer.createDelayedRevealBatch(\n placeholderNFT,\n realNFTs,\n \"my secret password\",\n);\n// Whenever you're ready, reveal your NFTs at any time\nconst batchId = 0; // the batch to reveal\nawait contract.nft.drop.revealer.reveal(batchId, \"my secret password\");"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.delayedreveal"
}
}
],
"reference": {
Expand Down
5 changes: 3 additions & 2 deletions docs/sdk.delayedreveal._constructor_.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ Constructs a new instance of the `DelayedReveal` class
<b>Signature:</b>

```typescript
constructor(erc721: Erc721, contractWrapper: ContractWrapper<T>, storage: IStorage);
constructor(contractWrapper: ContractWrapper<T>, storage: IStorage, fetureName: FeatureName, nextTokenIdToMintFn: () => Promise<BigNumber>);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| erc721 | [Erc721](./sdk.erc721.md) | |
| contractWrapper | ContractWrapper&lt;T&gt; | |
| storage | [IStorage](./sdk.istorage.md) | |
| fetureName | FeatureName | |
| nextTokenIdToMintFn | () =&gt; Promise&lt;BigNumber&gt; | |

2 changes: 1 addition & 1 deletion docs/sdk.delayedreveal.featurename.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
featureName: "ERC721Revealable";
featureName: "ERC721Burnable" | "ERC721Revealable" | "ERC721Claimable" | "ERC721Droppable" | "ERC721BatchMintable" | "ERC721Mintable" | "ERC721SignatureMint" | "ERC721Enumerable" | "ERC721Supply" | "ERC721" | "ERC20Droppable" | "ERC20Burnable" | "ERC20SignatureMintable" | "ERC20BatchMintable" | "ERC20Mintable" | "ERC20" | "ERC1155Burnable" | "ERC1155Claimable" | "ERC1155Droppable" | "ERC1155Revealable" | "ERC1155SignatureMintable" | "ERC1155BatchMintable" | "ERC1155Mintable" | "ERC1155Enumerable" | "ERC1155" | "Royalty" | "PrimarySale" | "PlatformFee" | "Permissions" | "ContractMetadata";
```
6 changes: 3 additions & 3 deletions docs/sdk.delayedreveal.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ Handles delayed reveal logic
<b>Signature:</b>

```typescript
export declare class DelayedReveal<T extends DropERC721 | BaseDelayedRevealERC721 | SignatureDrop>
export declare class DelayedReveal<T extends DropERC721 | BaseDelayedRevealERC721 | SignatureDrop | BaseDelayedRevealERC1155>
```

## Constructors

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(erc721, contractWrapper, storage)](./sdk.delayedreveal._constructor_.md) | | Constructs a new instance of the <code>DelayedReveal</code> class |
| [(constructor)(contractWrapper, storage, fetureName, nextTokenIdToMintFn)](./sdk.delayedreveal._constructor_.md) | | Constructs a new instance of the <code>DelayedReveal</code> class |

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [featureName](./sdk.delayedreveal.featurename.md) | | "ERC721Revealable" | |
| [featureName](./sdk.delayedreveal.featurename.md) | | "ERC721Burnable" \| "ERC721Revealable" \| "ERC721Claimable" \| "ERC721Droppable" \| "ERC721BatchMintable" \| "ERC721Mintable" \| "ERC721SignatureMint" \| "ERC721Enumerable" \| "ERC721Supply" \| "ERC721" \| "ERC20Droppable" \| "ERC20Burnable" \| "ERC20SignatureMintable" \| "ERC20BatchMintable" \| "ERC20Mintable" \| "ERC20" \| "ERC1155Burnable" \| "ERC1155Claimable" \| "ERC1155Droppable" \| "ERC1155Revealable" \| "ERC1155SignatureMintable" \| "ERC1155BatchMintable" \| "ERC1155Mintable" \| "ERC1155Enumerable" \| "ERC1155" \| "Royalty" \| "PrimarySale" \| "PlatformFee" \| "Permissions" \| "ContractMetadata" | |

## Methods

Expand Down
1 change: 1 addition & 0 deletions docs/sdk.erc1155droppable.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export declare class Erc1155Droppable implements DetectableFeature
| --- | --- | --- | --- |
| [claim](./sdk.erc1155droppable.claim.md) | | Erc1155Claimable \| undefined | Claim tokens and configure claim conditions |
| [featureName](./sdk.erc1155droppable.featurename.md) | | "ERC1155Droppable" | |
| [revealer](./sdk.erc1155droppable.revealer.md) | | [DelayedReveal](./sdk.delayedreveal.md)<!-- -->&lt;BaseDelayedRevealERC1155&gt; \| undefined | Delayed reveal |

## Methods

Expand Down
48 changes: 48 additions & 0 deletions docs/sdk.erc1155droppable.revealer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [Erc1155Droppable](./sdk.erc1155droppable.md) &gt; [revealer](./sdk.erc1155droppable.revealer.md)

## Erc1155Droppable.revealer property

Delayed reveal

<b>Signature:</b>

```typescript
revealer: DelayedReveal<BaseDelayedRevealERC1155> | undefined;
```

## Remarks

Create a batch of encrypted NFTs that can be revealed at a later time.

## Example


```javascript
// the real NFTs, these will be encrypted until you reveal them
const realNFTs = [{
name: "Common NFT #1",
description: "Common NFT, one of many.",
image: fs.readFileSync("path/to/image.png"),
}, {
name: "Super Rare NFT #2",
description: "You got a Super Rare NFT!",
image: fs.readFileSync("path/to/image.png"),
}];
// A placeholder NFT that people will get immediately in their wallet, and will be converted to the real NFT at reveal time
const placeholderNFT = {
name: "Hidden NFT",
description: "Will be revealed next week!"
};
// Create and encrypt the NFTs
await contract.edition.drop.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
// Whenever you're ready, reveal your NFTs at any time
const batchId = 0; // the batch to reveal
await contract.edition.drop.revealer.reveal(batchId, "my secret password");
```

2 changes: 1 addition & 1 deletion docs/sdk.erc721droppable.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ await contract.drop.claim(quantity);
| --- | --- | --- | --- |
| [claim](./sdk.erc721droppable.claim.md) | | [Erc721Claimable](./sdk.erc721claimable.md) \| undefined | Claim tokens and configure claim conditions |
| [featureName](./sdk.erc721droppable.featurename.md) | | "ERC721Droppable" | |
| [revealer](./sdk.erc721droppable.revealer.md) | | [DelayedReveal](./sdk.delayedreveal.md)<!-- -->&lt;BaseDelayedRevealERC721&gt; \| undefined | |
| [revealer](./sdk.erc721droppable.revealer.md) | | [DelayedReveal](./sdk.delayedreveal.md)<!-- -->&lt;BaseDelayedRevealERC721&gt; \| undefined | Delayed reveal |

## Methods

Expand Down
37 changes: 37 additions & 0 deletions docs/sdk.erc721droppable.revealer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,45 @@

## Erc721Droppable.revealer property

Delayed reveal

<b>Signature:</b>

```typescript
revealer: DelayedReveal<BaseDelayedRevealERC721> | undefined;
```

## Remarks

Create a batch of encrypted NFTs that can be revealed at a later time.

## Example


```javascript
// the real NFTs, these will be encrypted until you reveal them
const realNFTs = [{
name: "Common NFT #1",
description: "Common NFT, one of many.",
image: fs.readFileSync("path/to/image.png"),
}, {
name: "Super Rare NFT #2",
description: "You got a Super Rare NFT!",
image: fs.readFileSync("path/to/image.png"),
}];
// A placeholder NFT that people will get immediately in their wallet, and will be converted to the real NFT at reveal time
const placeholderNFT = {
name: "Hidden NFT",
description: "Will be revealed next week!"
};
// Create and encrypt the NFTs
await contract.nft.drop.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
// Whenever you're ready, reveal your NFTs at any time
const batchId = 0; // the batch to reveal
await contract.nft.drop.revealer.reveal(batchId, "my secret password");
```

13 changes: 7 additions & 6 deletions etc/sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1715,20 +1715,21 @@ export const DEFAULT_QUERY_ALL_COUNT = 100;
// Warning: (ae-forgotten-export) The symbol "DropERC721" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "BaseDelayedRevealERC721" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "SignatureDrop" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "BaseDelayedRevealERC1155" needs to be exported by the entry point index.d.ts
//
// @public
export class DelayedReveal<T extends DropERC721 | BaseDelayedRevealERC721 | SignatureDrop_2> {
constructor(erc721: Erc721, contractWrapper: ContractWrapper<T>, storage: IStorage);
export class DelayedReveal<T extends DropERC721 | BaseDelayedRevealERC721 | SignatureDrop_2 | BaseDelayedRevealERC1155> {
// Warning: (ae-forgotten-export) The symbol "FeatureName" needs to be exported by the entry point index.d.ts
constructor(contractWrapper: ContractWrapper<T>, storage: IStorage, fetureName: FeatureName, nextTokenIdToMintFn: () => Promise<BigNumber>);
createDelayedRevealBatch(placeholder: NFTMetadataInput, metadatas: NFTMetadataInput[], password: string, options?: {
onProgress: (event: UploadProgressEvent) => void;
}): Promise<TransactionResultWithId[]>;
// (undocumented)
featureName: "ERC721Revealable";
featureName: "ERC721Burnable" | "ERC721Revealable" | "ERC721Claimable" | "ERC721Droppable" | "ERC721BatchMintable" | "ERC721Mintable" | "ERC721SignatureMint" | "ERC721Enumerable" | "ERC721Supply" | "ERC721" | "ERC20Droppable" | "ERC20Burnable" | "ERC20SignatureMintable" | "ERC20BatchMintable" | "ERC20Mintable" | "ERC20" | "ERC1155Burnable" | "ERC1155Claimable" | "ERC1155Droppable" | "ERC1155Revealable" | "ERC1155SignatureMintable" | "ERC1155BatchMintable" | "ERC1155Mintable" | "ERC1155Enumerable" | "ERC1155" | "Royalty" | "PrimarySale" | "PlatformFee" | "Permissions" | "ContractMetadata";
getBatchesToReveal(): Promise<BatchToReveal[]>;
reveal(batchId: BigNumberish, password: string): Promise<TransactionResult>;
}

// Warning: (ae-forgotten-export) The symbol "FeatureName" needs to be exported by the entry point index.d.ts
// Warning: (ae-internal-missing-underscore) The name "detectContractFeature" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
Expand Down Expand Up @@ -1770,7 +1771,7 @@ export class DropClaimConditions<TContract extends DropERC721 | DropERC20 | Base
getAll(): Promise<ClaimCondition[]>;
getClaimIneligibilityReasons(quantity: Amount, addressToCheck?: string): Promise<ClaimEligibility[]>;
// @internal
prepareClaim(quantity: BigNumberish, checkERC20Allowance: boolean): Promise<ClaimVerification>;
prepareClaim(quantity: BigNumberish, checkERC20Allowance: boolean, decimals?: number): Promise<ClaimVerification>;
set(claimConditionInputs: ClaimConditionInput[], resetClaimEligibilityForAll?: boolean): Promise<TransactionResult>;
update(index: number, claimConditionInput: ClaimConditionInput): Promise<TransactionResult>;
}
Expand Down Expand Up @@ -2473,6 +2474,7 @@ export class Erc1155Droppable implements DetectableFeature {
lazyMint(metadatas: NFTMetadataOrUri[], options?: {
onProgress: (event: UploadProgressEvent) => void;
}): Promise<TransactionResultWithId<NFTMetadata>[]>;
revealer: DelayedReveal<BaseDelayedRevealERC1155> | undefined;
}

// @public
Expand Down Expand Up @@ -2692,7 +2694,6 @@ export class Erc721Droppable implements DetectableFeature {
lazyMint(metadatas: NFTMetadataOrUri[], options?: {
onProgress: (event: UploadProgressEvent) => void;
}): Promise<TransactionResultWithId<NFTMetadata>[]>;
// (undocumented)
revealer: DelayedReveal<BaseDelayedRevealERC721> | undefined;
}

Expand Down
2 changes: 2 additions & 0 deletions src/constants/contract-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
FEATURE_EDITION_DROPPABLE,
FEATURE_EDITION_ENUMERABLE,
FEATURE_EDITION_MINTABLE,
FEATURE_EDITION_REVEALABLE,
FEATURE_EDITION_SIGNATURE_MINTABLE,
} from "./erc1155-features";
import {
Expand Down Expand Up @@ -61,6 +62,7 @@ export type Feature =
| typeof FEATURE_EDITION_MINTABLE
| typeof FEATURE_EDITION_CLAIMABLE
| typeof FEATURE_EDITION_DROPPABLE
| typeof FEATURE_EDITION_REVEALABLE
| typeof FEATURE_EDITION_BATCH_MINTABLE
| typeof FEATURE_EDITION_BURNABLE
| typeof FEATURE_EDITION_SIGNATURE_MINTABLE
Expand Down
13 changes: 13 additions & 0 deletions src/constants/erc1155-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ISignatureMintERC1155Abi from "../../abis/ISignatureMintERC1155.json";
import ILazyMintAbi from "../../abis/ILazyMint.json";
import IBurnableERC1155Abi from "../../abis/IBurnableERC1155.json";
import DropSinglePhase1155 from "../../abis/DropSinglePhase1155.json";
import DelayedRevealAbi from "../../abis/DelayedReveal.json";

export const FEATURE_EDITION_BURNABLE = {
name: "ERC1155Burnable",
Expand Down Expand Up @@ -42,6 +43,17 @@ export const FEATURE_EDITION_DROPPABLE = {
},
} as const;

export const FEATURE_EDITION_REVEALABLE = {
name: "ERC1155Revealable",
namespace: "edition.drop.revealer",
docLinks: {
sdk: "sdk.drop.delayedreveal",
contracts: "DelayedReveal",
},
abis: [Erc1155Abi, ILazyMintAbi, DelayedRevealAbi],
features: {},
} as const;

export const FEATURE_EDITION_SIGNATURE_MINTABLE = {
name: "ERC1155SignatureMintable",
namespace: "edition.signature",
Expand Down Expand Up @@ -101,6 +113,7 @@ export const FEATURE_EDITION = {
[FEATURE_EDITION_ENUMERABLE.name]: FEATURE_EDITION_ENUMERABLE,
[FEATURE_EDITION_MINTABLE.name]: FEATURE_EDITION_MINTABLE,
[FEATURE_EDITION_DROPPABLE.name]: FEATURE_EDITION_DROPPABLE,
[FEATURE_EDITION_REVEALABLE.name]: FEATURE_EDITION_REVEALABLE,
[FEATURE_EDITION_SIGNATURE_MINTABLE.name]:
FEATURE_EDITION_SIGNATURE_MINTABLE,
},
Expand Down
4 changes: 3 additions & 1 deletion src/contracts/nft-drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { UploadProgressEvent } from "../types/events";
import { uploadOrExtractURIs } from "../common/nft";
import { TransactionTask } from "../core/classes/TransactionTask";
import { Erc721Burnable } from "../core/classes/erc-721-burnable";
import { FEATURE_NFT_REVEALABLE } from "../constants/erc721-features";

/**
* Setup a collection of one-of-one NFTs that are minted as users claim them.
Expand Down Expand Up @@ -184,9 +185,10 @@ export class NFTDrop extends Erc721<DropERC721> {
this.events = new ContractEvents(this.contractWrapper);
this.platformFees = new ContractPlatformFee(this.contractWrapper);
this.revealer = new DelayedReveal<DropERC721>(
this,
this.contractWrapper,
this.storage,
FEATURE_NFT_REVEALABLE.name,
() => this.nextTokenIdToMint(),
);
this.interceptor = new ContractInterceptor(this.contractWrapper);
}
Expand Down
8 changes: 7 additions & 1 deletion src/contracts/signature-drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
import { Erc721WithQuantitySignatureMintable } from "../core/classes/erc-721-with-quantity-signature-mintable";
import { TransactionTask } from "../core/classes/TransactionTask";
import { Erc721Burnable } from "../core/classes/erc-721-burnable";
import { FEATURE_NFT_REVEALABLE } from "../constants/erc721-features";

/**
* Setup a collection of NFTs where when it comes to minting, you can authorize
Expand Down Expand Up @@ -202,7 +203,12 @@ export class SignatureDrop extends Erc721<SignatureDropContract> {
this.events = new ContractEvents(this.contractWrapper);
this.platformFees = new ContractPlatformFee(this.contractWrapper);
this.interceptor = new ContractInterceptor(this.contractWrapper);
this.revealer = new DelayedReveal(this, this.contractWrapper, this.storage);
this.revealer = new DelayedReveal(
this.contractWrapper,
this.storage,
FEATURE_NFT_REVEALABLE.name,
() => this.nextTokenIdToMint(),
);
this.signature = new Erc721WithQuantitySignatureMintable(
this.contractWrapper,
this.storage,
Expand Down
Loading