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
69 changes: 40 additions & 29 deletions docs/feature_snippets.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/sdk.contractplatformfee.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Configure platform fees for a contract, which can be applied on certain paid tra


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
const feeInfo = await contract.platformFee.get();
await contract.platformFee.set({
platform_fee_basis_points: 100, // 1% fee
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.contractprimarysale.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Configure primary sale recipients for an entire contract.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
const salesRecipient = await contract.sales.getRecipient();
await contract.roles.setRecipient(recipientWalletAddress);
```
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.contractroles.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Configure roles and permissions for a contract, to restrict certain actions.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
const rolesAndMembers = await contract.roles.getAll();
await contract.roles.grantRole("admin", "0x...");
```
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.contractroyalty.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Configure royalties for an entire contract or a particular token.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
const royaltyInfo = await contract.royalties.getDefaultRoyaltyInfo();
await contract.roles.setTokenRoyaltyInfo(tokenId, {
seller_fee_basis_points: 100, // 1% royalty fee
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc1155.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Basic functionality for a ERC1155 contract that handles IPFS storage for you.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.edition.transfer(walletAddress, tokenId, quantity);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc1155batchmintable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ NFT batch minting functionality that handles IPFS storage for you.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.edition.mint.batch.to(walletAddress, [nftMetadataWithSupply1, nftMetadataWithSupply2, ...]);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc1155enumerable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Easily list all the NFTs in a ERC1155 contract.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
const nfts = await contract.edition.query.all();
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc1155mintable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ NFT minting functionality that handles IPFS storage for you.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.edition.mint.to(walletAddress, nftMetadata);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc20.allowance.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ Get the allowance of a 'spender' wallet over the connected wallet's funds - the
```javascript
// Address of the wallet to check token allowance
const spenderAddress = "0x...";
const allowance = await contract.allowanceOf(otherAddress);
const allowance = await contract.token.allowance(spenderAddress);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc20.allowanceof.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ Get the allowance of one wallet over another wallet's funds - the allowance of a
const owner = "{{wallet_address}}";
// Address of the wallet to check token allowance
const spender = "0x...";
const allowance = await contract.allowanceOf(owner, spender);
const allowance = await contract.token.allowanceOf(owner, spender);
```

3 changes: 1 addition & 2 deletions docs/sdk.erc20.balance.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Get a wallets token balance.


```javascript
const balance = await contract.balance();
console.log(balance);
const balance = await contract.token.balance();
```

2 changes: 1 addition & 1 deletion docs/sdk.erc20.balanceof.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ Get a wallets token balance.
```javascript
// Address of the wallet to check token balance
const walletAddress = "{{wallet_address}}";
const balance = await contract.balanceOf(walletAddress);
const balance = await contract.token.balanceOf(walletAddress);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc20.get.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ The token metadata


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

2 changes: 1 addition & 1 deletion docs/sdk.erc20.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Basic functionality for a ERC20 contract that handles all unit transformation fo


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.token.transfer(walletAddress, amount);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc20.setallowance.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ Promise&lt;[TransactionResult](./sdk.transactionresult.md)<!-- -->&gt;
const spenderAddress = "0x...";
// The number of tokens to give as allowance
const amount = 100
await contract.setAllowance(spenderAddress, amount);
await contract.token.setAllowance(spenderAddress, amount);
```

11 changes: 11 additions & 0 deletions docs/sdk.erc20.totalsupply.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ totalSupply(): Promise<CurrencyValue>;

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

## Remarks

Get how much supply has been minted

## Example


```javascript
const balance = await contract.token.balanceOf(walletAddress);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc20.transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Transfer tokens from the connected wallet to another wallet.
const toAddress = "0x...";
// The amount of tokens you want to send
const amount = 0.1;
await contract.transfer(toAddress, amount);
await contract.token.transfer(toAddress, amount);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc20.transferbatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ const data = [
}
]

await contract.transferBatch(data);
await contract.token.transferBatch(data);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc20.transferfrom.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ const toAddress = "0x...";
// The number of tokens you want to send
const amount = 1.2
// Note that the connected wallet must have approval to transfer the tokens of the fromAddress
await contract.transferFrom(fromAddress, toAddress, amount);
await contract.token.transferFrom(fromAddress, toAddress, amount);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc20batchmintable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Token batch minting functionality that handles unit parsing for you.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.token.mint.batch.to(walletAddress, [nftMetadata1, nftMetadata2, ...]);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc20mintable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Token minting functionality that handles unit parsing for you.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.nft.mint.to(walletAddress, nftMetadata);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc721.balanceof.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Get a wallets NFT balance (number of NFTs in this contract owned by the wallet).

```javascript
const walletAddress = "{{wallet_address}}";
const balance = await contract.balanceOf(walletAddress);
const balance = await contract.nft.balanceOf(walletAddress);
console.log(balance);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc721.get.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ The NFT metadata

```javascript
const tokenId = 0;
const nft = await contract.get(tokenId);
const nft = await contract.nft.get(tokenId);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc721.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Basic functionality for a ERC721 contract that handles IPFS storage for you.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.nft.transfer(walletAddress, tokenId);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc721.transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ Transfer an NFT from the connected wallet to another wallet.
```javascript
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.transfer(walletAddress, tokenId);
await contract.nft.transfer(walletAddress, tokenId);
```

2 changes: 1 addition & 1 deletion docs/sdk.erc721batchmintable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ NFT batch minting functionality that handles IPFS storage for you.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.nft.mint.batch.to(walletAddress, [nftMetadata1, nftMetadata2, ...]);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc721batchmintable.to.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const metadatas = [{
image: fs.readFileSync("path/to/other/image.png"),
}];

const tx = await contract.mintBatchTo(walletAddress, metadatas);
const tx = await contract.mint.batch.to(walletAddress, metadatas);
const receipt = tx[0].receipt; // same transaction receipt for all minted NFTs
const firstTokenId = tx[0].id; // token id of the first minted NFT
const firstNFT = await tx[0].data(); // (optional) fetch details of the first minted NFT
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc721enumerable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Easily list all the NFTs from a ERC721 contract, owned by a certain wallet.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
const walletAddress = "0x...";
const ownedNFTs = await contract.nft.query.owned.all(walletAddress);
```
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc721mintable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ NFT minting functionality that handles IPFS storage for you.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
await contract.nft.mint.to(walletAddress, nftMetadata);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.erc721supply.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Easily list all the NFTs in a ERC721 contract.


```javascript
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
const nfts = await contract.nft.query.all();
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdk.smartcontract.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ThirdwebSDK } from "@thirdweb-dev/sdk";

// You can switch out this provider with any wallet or provider setup you like.
const sdk = new ThirdwebSDK(provider);
const contract = sdk.getContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");

// call any function in your contract
await contract.functions.myCustomFunction(params);
Expand Down
Loading