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
73 changes: 70 additions & 3 deletions docs/feature_snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,41 @@
"examples": {
"javascript": "const contract = await sdk.getContract(\"{{contract_address}}\");\nconst metadata = await contract.metadata.get();\nawait contract.metadata.set({\n name: \"My Contract\",\n description: \"My contract description\"\n})"
},
"methods": [],
"methods": [
{
"name": "get",
"summary": "Get the metadata of a contract\n\n",
"remarks": "\n\nGet the metadata of a contract\n\n",
"examples": {
"javascript": "const metadata = await contract.metadata.get();"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractMetadata.get"
}
},
{
"name": "set",
"summary": "Set the metadata of a contract\n\n",
"remarks": "\n\nOVERWRITE the metadata of a contract\n\n",
"examples": {
"javascript": "await contract.metadata.set({\n name: \"My Contract\",\n description: \"My contract description\"\n})"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractMetadata.set"
}
},
{
"name": "update",
"summary": "Update the metadata of a contract\n\n",
"remarks": "\n\nUpdate the metadata of a contract\n\n",
"examples": {
"javascript": "await contract.metadata.update({\n name: \"My Contract\",\n description: \"My contract description\"\n})"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractMetadata.update"
}
}
],
"properties": [],
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractMetadata"
Expand Down Expand Up @@ -51,18 +85,51 @@
"summary": "Call this to get a list of addresses that are members of a specific role.\n\n",
"remarks": "\n\nSee {@link ContractRoles.getAll} to get get a list of addresses for all supported roles on the contract.\n\n",
"examples": {
"javascript": "const minterAddresses: string[] = await contract.getRoleMemberList(\"minter\");"
"javascript": "const minterAddresses = await contract.roles.get(\"minter\");"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractRoles.get"
}
},
{
"name": "getAll",
"summary": "Call this to get get a list of addresses for all supported roles on the contract.\n\n",
"remarks": "\n\nSee {@link ContractRoles.get} to get a list of addresses that are members of a specific role.\n\n",
"examples": {
"javascript": "const rolesAndMembers = await contract.roles.getAll();"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractRoles.getAll"
}
},
{
"name": "grant",
"summary": "Call this to grant a role to a specific address.\n\n",
"remarks": "\n\nMake sure you are sure you want to grant the role to the address.\n\n",
"examples": {
"javascript": "await contract.roles.grant(\"minter\", \"0x1234567890123456789012345678901234567890\");"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractRoles.grant"
}
},
{
"name": "revoke",
"summary": "Call this to revoke a role from a specific address.\n\n",
"remarks": "\n\n-- Caution --\n\nThis will let you remove yourself from the role, too. If you remove yourself from the admin role, you will no longer be able to administer the contract. There is no way to recover from this.\n\n",
"examples": {
"javascript": "await contract.roles.revoke(\"minter\", \"0x1234567890123456789012345678901234567890\");"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractRoles.revoke"
}
},
{
"name": "setAll",
"summary": "Call this to OVERWRITE the list of addresses that are members of specific roles.\n\nEvery role in the list will be overwritten with the new list of addresses provided with them. If you want to add or remove addresses for a single address use {@link ContractRoles.grant} and {@link ContractRoles.revoke} respectively instead.\n\n",
"remarks": null,
"examples": {
"javascript": "const minterAddresses: string[] = await contract.getRoleMemberList(\"minter\");\nawait contract.setAll({\n minter: []\n});\nconsole.log(await contract.getRoleMemberList(\"minter\")); // No matter what members had the role before, the new list will be set to []"
"javascript": "const minterAddresses = await contract.roles.get(\"minter\");\nawait contract.roles.setAll({\n minter: []\n});\nconsole.log(await contract.roles.get(\"minter\")); // No matter what members had the role before, the new list will be set to []"
},
"reference": {
"javascript": "https://docs.thirdweb.com/typescript/sdk.ContractRoles.setAll"
Expand Down
4 changes: 4 additions & 0 deletions docs/sdk.contractevents.listentoallevents.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ listenToAllEvents(listener: (event: ContractEvent) => void): void;

void

## Remarks

Remove a listener that was added with addEventListener

## Example


Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.contractevents.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export declare class ContractEvents<TContract extends BaseContract>
| [addTransactionListener(listener)](./sdk.contractevents.addtransactionlistener.md) | | Subscribe to transactions in this contract. |
| [listenToAllEvents(listener)](./sdk.contractevents.listentoallevents.md) | | Listen to all events emitted from this contract |
| [removeAllListeners()](./sdk.contractevents.removealllisteners.md) | | Remove all listeners on this contract |
| [removeEventListener(eventName, listener)](./sdk.contractevents.removeeventlistener.md) | | |
| [removeEventListener(eventName, listener)](./sdk.contractevents.removeeventlistener.md) | | Remove an event listener from this contract |
| [removeTransactionListener(listener)](./sdk.contractevents.removetransactionlistener.md) | | Remove a transaction listener |

11 changes: 11 additions & 0 deletions docs/sdk.contractevents.removealllisteners.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ removeAllListeners(): void;

void

## Remarks

Remove all listeners from a contract

## Example


```javascript
contract.events.removeAllListeners();
```

15 changes: 15 additions & 0 deletions docs/sdk.contractevents.removeeventlistener.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## ContractEvents.removeEventListener() method

Remove an event listener from this contract

<b>Signature:</b>

```typescript
Expand All @@ -21,3 +23,16 @@ removeEventListener(eventName: keyof TContract["filters"] | (string & {}), liste

void

## Remarks

Remove a listener that was added with addEventListener

## Example


```javascript
contract.events.removeEventListener("TokensMinted", (event) => {
console.log(event);
});
```

13 changes: 13 additions & 0 deletions docs/sdk.contractevents.removetransactionlistener.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,16 @@ removeTransactionListener(listener: ListenerFn): void;

void

## Remarks

Remove a listener that was added with addTransactionListener

## Example


```javascript
contract.events.removeTransactionListener((event) => {
console.log(event);
}
```

13 changes: 13 additions & 0 deletions docs/sdk.contractmetadata.get.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## ContractMetadata.get() method

Get the metadata of a contract

<b>Signature:</b>

```typescript
Expand All @@ -15,3 +17,14 @@ Promise&lt;z.output&lt;TSchema\["output"\]&gt;&gt;

the metadata of the given contract

## Remarks

Get the metadata of a contract

## Example


```javascript
const metadata = await contract.metadata.get();
```

6 changes: 3 additions & 3 deletions docs/sdk.contractmetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ await contract.metadata.set({

| Method | Modifiers | Description |
| --- | --- | --- |
| [get()](./sdk.contractmetadata.get.md) | | |
| [set(metadata)](./sdk.contractmetadata.set.md) | | |
| [update(metadata)](./sdk.contractmetadata.update.md) | | |
| [get()](./sdk.contractmetadata.get.md) | | Get the metadata of a contract |
| [set(metadata)](./sdk.contractmetadata.set.md) | | Set the metadata of a contract |
| [update(metadata)](./sdk.contractmetadata.update.md) | | Update the metadata of a contract |

16 changes: 16 additions & 0 deletions docs/sdk.contractmetadata.set.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## ContractMetadata.set() method

Set the metadata of a contract

<b>Signature:</b>

```typescript
Expand All @@ -27,3 +29,17 @@ set(metadata: z.input<TSchema["input"]>): Promise<((<A>() => A extends never ? 1
Promise&lt;((&lt;A&gt;() =&gt; A extends never ? 1 : 0) extends &lt;A\_1&gt;() =&gt; A\_1 extends z.output&lt;TSchema\["output"\]&gt; ? 1 : 0 ? 1 : 0) extends infer T ? T extends ((&lt;A&gt;() =&gt; A extends never ? 1 : 0) extends &lt;A\_1&gt;() =&gt; A\_1 extends z.output&lt;TSchema\["output"\]&gt; ? 1 : 0 ? 1 : 0) ? T extends 1 ? Omit&lt;{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () =&gt; Promise&lt;unknown&gt;; }, "data"&gt; : { receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () =&gt; Promise&lt;z.output&lt;TSchema\["output"\]&gt;&gt;; } : never : never&gt;


## Remarks

OVERWRITE the metadata of a contract

## Example


```javascript
await contract.metadata.set({
name: "My Contract",
description: "My contract description"
})
```

18 changes: 17 additions & 1 deletion docs/sdk.contractmetadata.update.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## ContractMetadata.update() method

Update the metadata of a contract

<b>Signature:</b>

```typescript
Expand All @@ -20,9 +22,23 @@ update(metadata: Partial<z.input<TSchema["input"]>>): Promise<((<A>() => A exten

| Parameter | Type | Description |
| --- | --- | --- |
| metadata | Partial&lt;z.input&lt;TSchema\["input"\]&gt;&gt; | |
| metadata | Partial&lt;z.input&lt;TSchema\["input"\]&gt;&gt; | the metadata to update |

<b>Returns:</b>

Promise&lt;((&lt;A&gt;() =&gt; A extends never ? 1 : 0) extends &lt;A\_1&gt;() =&gt; A\_1 extends z.output&lt;TSchema\["output"\]&gt; ? 1 : 0 ? 1 : 0) extends infer T ? T extends ((&lt;A&gt;() =&gt; A extends never ? 1 : 0) extends &lt;A\_1&gt;() =&gt; A\_1 extends z.output&lt;TSchema\["output"\]&gt; ? 1 : 0 ? 1 : 0) ? T extends 1 ? Omit&lt;{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () =&gt; Promise&lt;unknown&gt;; }, "data"&gt; : { receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () =&gt; Promise&lt;z.output&lt;TSchema\["output"\]&gt;&gt;; } : never : never&gt;

## Remarks

Update the metadata of a contract

## Example


```javascript
await contract.metadata.update({
name: "My Contract",
description: "My contract description"
})
```

2 changes: 1 addition & 1 deletion docs/sdk.contractroles.get.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ See [ContractRoles.getAll()](./sdk.contractroles.getall.md) to get get a list of
Say you want to get the list of addresses that are members of the minter role.

```javascript
const minterAddresses: string[] = await contract.getRoleMemberList("minter");
const minterAddresses = await contract.roles.get("minter");
```

7 changes: 7 additions & 0 deletions docs/sdk.contractroles.getall.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ If the contract does not support roles this will throw an error.

See [ContractRoles.get()](./sdk.contractroles.get.md) to get a list of addresses that are members of a specific role.

## Example


```javascript
const rolesAndMembers = await contract.roles.getAll();
```

7 changes: 7 additions & 0 deletions docs/sdk.contractroles.grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ If you are trying to grant does not exist on the contract this will throw an err

Make sure you are sure you want to grant the role to the address.

## Example


```javascript
await contract.roles.grant("minter", "0x1234567890123456789012345678901234567890");
```

9 changes: 8 additions & 1 deletion docs/sdk.contractroles.revoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,12 @@ If you are trying to revoke does not exist on the module this will throw an erro

-- Caution --

This will let you remove yourself from the role, too. If you remove yourself from the admin role, you will no longer be able to administer the module. There is no way to recover from this.
This will let you remove yourself from the role, too. If you remove yourself from the admin role, you will no longer be able to administer the contract. There is no way to recover from this.

## Example


```javascript
await contract.roles.revoke("minter", "0x1234567890123456789012345678901234567890");
```

6 changes: 3 additions & 3 deletions docs/sdk.contractroles.setall.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ If you are requestiong a role that does not exist on the contract this will thro
Say you want to overwrite the list of addresses that are members of the minter role.

```javascript
const minterAddresses: string[] = await contract.getRoleMemberList("minter");
await contract.setAll({
const minterAddresses = await contract.roles.get("minter");
await contract.roles.setAll({
minter: []
});
console.log(await contract.getRoleMemberList("minter")); // No matter what members had the role before, the new list will be set to []
console.log(await contract.roles.get("minter")); // No matter what members had the role before, the new list will be set to []
```

4 changes: 4 additions & 0 deletions docs/sdk.delayedreveal.createdelayedrevealbatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ createDelayedRevealBatch(placeholder: NFTMetadataInput, metadatas: NFTMetadataIn

Promise&lt;[TransactionResultWithId](./sdk.transactionresultwithid.md)<!-- -->\[\]&gt;

## Remarks

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

## Example


Expand Down
11 changes: 11 additions & 0 deletions docs/sdk.delayedreveal.getbatchestoreveal.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ getBatchesToReveal(): Promise<BatchToReveal[]>;

Promise&lt;[BatchToReveal](./sdk.batchtoreveal.md)<!-- -->\[\]&gt;

## Remarks

Gets the list of unrevealed NFT batches.

## Example


```javascript
const batches = await contract.revealer.getBatchesToReveal();
```

14 changes: 14 additions & 0 deletions docs/sdk.delayedreveal.reveal.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,17 @@ reveal(batchId: BigNumberish, password: string): Promise<TransactionResult>;

Promise&lt;[TransactionResult](./sdk.transactionresult.md)<!-- -->&gt;

## Remarks

Reveal the NFTs of a batch using the password.

## Example


```javascript
// the batch to reveal
const batchId = 0;
// reveal the batch
await contract.revealer.reveal(batchId, "my secret password");
```

13 changes: 13 additions & 0 deletions docs/sdk.gascostestimator.currentgaspriceingwei.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@ currentGasPriceInGwei(): Promise<string>;

Promise&lt;string&gt;

the current gas price in gwei

## Remarks

Get the current gas price in gwei

## Example


```javascript
const gasCostInGwei = await contract.estimator.currentGasPriceInGwei();
```

Loading