Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Add pack contract implementation #469

Merged
merged 15 commits into from
Jun 15, 2022
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
14 changes: 0 additions & 14 deletions docs/sdk.ipackbatchargs.amount.md

This file was deleted.

23 changes: 0 additions & 23 deletions docs/sdk.ipackbatchargs.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/sdk.ipackbatchargs.tokenid.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/sdk.ipackcreateargs.assetcontract.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/sdk.ipackcreateargs.assets.md

This file was deleted.

22 changes: 0 additions & 22 deletions docs/sdk.ipackcreateargs.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/sdk.ipackcreateargs.metadata.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/sdk.ipackcreateargs.rewardsperopen.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/sdk.ipackcreateargs.secondsuntilopenstart.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
| [EventType](./sdk.eventtype.md) | |
| [ListingType](./sdk.listingtype.md) | |
| [ProposalState](./sdk.proposalstate.md) | |
| [UnderlyingType](./sdk.underlyingtype.md) | |
| [VoteType](./sdk.votetype.md) | |

## Functions
Expand All @@ -85,8 +84,6 @@
| [BatchToReveal](./sdk.batchtoreveal.md) | |
| [DirectListing](./sdk.directlisting.md) | Represents a marketplace direct listing. |
| [GaslessTransaction](./sdk.gaslesstransaction.md) | transaction message contains information that's needed to execute a gasless transaction |
| [IPackBatchArgs](./sdk.ipackbatchargs.md) | <b><i>(BETA)</i></b> |
| [IPackCreateArgs](./sdk.ipackcreateargs.md) | |
| [IStorage](./sdk.istorage.md) | Interface for any storage provider |
| [MarketplaceContractDeployMetadata](./sdk.marketplacecontractdeploymetadata.md) | Options for deploying a Marketplace contract |
| [MarketplaceFilter](./sdk.marketplacefilter.md) | |
Expand All @@ -96,9 +93,6 @@
| [NewDirectListing](./sdk.newdirectlisting.md) | Represents a new marketplace direct listing. |
| [NFTContractDeployMetadata](./sdk.nftcontractdeploymetadata.md) | Options for deploying an NFT contract |
| [Offer](./sdk.offer.md) | |
| [PackMetadata](./sdk.packmetadata.md) | |
| [PackMetadataWithBalance](./sdk.packmetadatawithbalance.md) | |
| [PackNFTMetadata](./sdk.packnftmetadata.md) | |
| [Proposal](./sdk.proposal.md) | |
| [ProposalExecutable](./sdk.proposalexecutable.md) | |
| [ProposalVote](./sdk.proposalvote.md) | |
Expand Down
22 changes: 0 additions & 22 deletions docs/sdk.pack.balance.md

This file was deleted.

42 changes: 0 additions & 42 deletions docs/sdk.pack.balanceof.md

This file was deleted.

52 changes: 16 additions & 36 deletions docs/sdk.pack.create.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,32 @@ Create Pack
<b>Signature:</b>

```typescript
create(args: IPackCreateArgs): Promise<TransactionResultWithId<PackMetadata>>;
create(metadataWithRewards: PackMetadataInput): Promise<TransactionResultWithId<{
metadata: {
[x: string]: import("../core/types").Json;
name?: string | undefined;
description?: string | null | undefined;
image?: string | null | undefined;
external_url?: string | null | undefined;
animation_url?: string | null | undefined;
uri: string;
id: BigNumber;
};
supply: BigNumber;
}>>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| args | [IPackCreateArgs](./sdk.ipackcreateargs.md) | Args for the pack creation |
| metadataWithRewards | PackMetadataInput | the metadata and rewards to include in the pack |

<b>Returns:</b>

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

- The newly created pack metadata
Promise&lt;[TransactionResultWithId](./sdk.transactionresultwithid.md)<!-- -->&lt;{ metadata: { \[x: string\]: import("../core/types").[Json](./sdk.json.md)<!-- -->; name?: string \| undefined; description?: string \| null \| undefined; image?: string \| null \| undefined; external\_url?: string \| null \| undefined; animation\_url?: string \| null \| undefined; uri: string; id: BigNumber; }; supply: BigNumber; }&gt;&gt;

## Remarks

Create a new pack with its own rewards.

## Example


```javascript
// Data to create the pack
const pack = {
// The address of the contract that holds the rewards you want to include
assetContract: "0x...",
// The metadata of the pack
metadata: {
name: "Cool Pack",
description: "This is a cool pack",
// This can be an image url or image file
image: readFileSync("path/to/image.png"),
},
// The NFTs you want to include in the pack
assets: [
{
tokenId: 0, // The token ID of the asset you want to add
amount: 1, // The amount of the asset you want to add
}, {
tokenId: 1,
amount: 1,
}
],
};

await contract.create(pack);
```
See [Pack.createTo()](./sdk.pack.createto.md)

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

[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [Pack](./sdk.pack.md) &gt; [createTo](./sdk.pack.createto.md)

## Pack.createTo() method

Create Pack To Wallet

<b>Signature:</b>

```typescript
createTo(to: string, metadataWithRewards: PackMetadataInput): Promise<TransactionResultWithId<EditionMetadata>>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| to | string | the address to mint the pack to |
| metadataWithRewards | PackMetadataInput | the metadata and rewards to include in the pack |

<b>Returns:</b>

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

## Remarks

Create a new pack with the given metadata and rewards and mint it to the specified address.

## Example


```javascript
const pack = {
// The metadata for the pack NFT itself
packMetadata: {
name: "My Pack",
description: "This is a new pack",
image: "ipfs://...",
},
// ERC20 rewards to be included in the pack
erc20Rewards: [
{
assetContract: "0x...",
quantity: 100,
}
],
// ERC721 rewards to be included in the pack
erc721Rewards: [
{
assetContract: "0x...",
tokenId: 0,
}
],
// ERC1155 rewards to be included in the pack
erc1155Rewards: [
{
assetContract: "0x...",
tokenId: 0,
quantity: 100,
}
],
openStartTime: new Date(), // the date that packs can start to be opened, defaults to now
rewardsPerPack: 1, // the number of rewards in each pack, defaults to 1
}

const tx = await contract.createTo("0x...", pack);
```

22 changes: 0 additions & 22 deletions docs/sdk.pack.depositlink.md

This file was deleted.

Loading