Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Add docs and feature snippets for extensions #119

Merged
merged 2 commits into from
Mar 24, 2023
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
16 changes: 8 additions & 8 deletions docs/contract_deployer.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

## Contract Deployments

The contract deployer lets you deploy new contracts to the blockchain using just the thirdweb SDK\. You can access the contract deployer interface as follows:
The contract deployer lets you deploy new contracts to the blockchain using just the thirdweb SDK. You can access the contract deployer interface as follows:

```
import (
Expand Down Expand Up @@ -34,7 +34,7 @@ type ContractDeployer struct {
func (deployer *ContractDeployer) DeployEdition(ctx context.Context, metadata *DeployEditionMetadata) (string, error)
```

Deploy a new Edition contract\.
Deploy a new Edition contract.

metadata: the contract metadata

Expand All @@ -57,7 +57,7 @@ address, err := sdk.Deployer.DeployEdition(
func (deployer *ContractDeployer) DeployEditionDrop(ctx context.Context, metadata *DeployEditionDropMetadata) (string, error)
```

Deploy a new Edition Drop contract\.
Deploy a new Edition Drop contract.

metadata: the contract metadata

Expand All @@ -80,7 +80,7 @@ address, err := sdk.Deployer.DeployEditionDrop(
func (deployer *ContractDeployer) DeployMarketplace(ctx context.Context, metadata *DeployMarketplaceMetadata) (string, error)
```

Deploy a new Marketplace contract\.
Deploy a new Marketplace contract.

metadata: the contract metadata

Expand All @@ -103,7 +103,7 @@ address, err := sdk.Deployer.DeployMarketplace(
func (deployer *ContractDeployer) DeployMultiwrap(ctx context.Context, metadata *DeployMultiwrapMetadata) (string, error)
```

Deploy a new Multiwrap contract\.
Deploy a new Multiwrap contract.

metadata: the contract metadata

Expand All @@ -126,7 +126,7 @@ address, err := sdk.Deployer.DeployMultiwrap(
func (deployer *ContractDeployer) DeployNFTCollection(ctx context.Context, metadata *DeployNFTCollectionMetadata) (string, error)
```

Deploy a new NFT Collection contract\.
Deploy a new NFT Collection contract.

metadata: the contract metadata

Expand All @@ -149,7 +149,7 @@ address, err := sdk.Deployer.DeployNFTCollection(
func (deployer *ContractDeployer) DeployNFTDrop(ctx context.Context, metadata *DeployNFTDropMetadata) (string, error)
```

Deploy a new NFT Drop contract\.
Deploy a new NFT Drop contract.

metadata: the contract metadata

Expand All @@ -172,7 +172,7 @@ address, err := sdk.Deployer.DeployNFTDrop(
func (deployer *ContractDeployer) DeployToken(ctx context.Context, metadata *DeployTokenMetadata) (string, error)
```

Deploy a new Token contract\.
Deploy a new Token contract.

metadata: the contract metadata

Expand Down
10 changes: 5 additions & 5 deletions docs/contract_encoder.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

## Contract Encoder

This interface is currently supported by all contract encoder classes and provides a generic method to encode write function calls\.
This interface is currently supported by all contract encoder classes and provides a generic method to encode write function calls.

```go
type ContractEncoder struct {}
Expand All @@ -13,15 +13,15 @@ type ContractEncoder struct {}
func (encoder *ContractEncoder) Encode(ctx context.Context, signerAddress string, method string, args ...interface{}) (*types.Transaction, error)
```

Get the unsigned transaction data for any contract call on a contract\.
Get the unsigned transaction data for any contract call on a contract.

signerAddress: the address expected to sign this transaction

method: the name of the contract function to encode transaction data for

args: the arguments to pass to the contract function\.
args: the arguments to pass to the contract function.

returns: the encoded transaction data for the transaction\.
returns: the encoded transaction data for the transaction.

#### Example

Expand All @@ -36,7 +36,7 @@ fmt.Println(tx.Nonce())
fmt.Println(tx.Value())
```

## type [ContractEvent](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_events.go#L49-L53>)
## type [ContractEvent](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_events.go#L48-L52>)

```go
type ContractEvent struct {
Expand Down
10 changes: 5 additions & 5 deletions docs/contract_events.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

## Contract Events

This interface provides a way to query past events or listen for future events on any contract\. It's currently support on all pre\-built and custom contracts\!
This interface provides a way to query past events or listen for future events on any contract. It's currently support on all pre\-built and custom contracts\!

### Example

Expand All @@ -25,13 +25,13 @@ contract.Events.AddEventListener("Transfer", func (event thirdweb.ContractEvent)
type ContractEvents struct {}
```

### func \(\*ContractEvents\) [AddEventListener](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_events.go#L95>)
### func \(\*ContractEvents\) [AddEventListener](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_events.go#L94>)

```go
func (events *ContractEvents) AddEventListener(ctx context.Context, eventName string, listener func(event ContractEvent)) EventSubscription
```

Add a listener to listen in the background for any future events of a specific type\.
Add a listener to listen in the background for any future events of a specific type.

eventName: The name of the event to listen for

Expand All @@ -54,13 +54,13 @@ subscription := contract.Events.AddEventListener(context.Background(), "Transfer
subscription.Unsubscribe()
```

### func \(\*ContractEvents\) [GetEvents](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_events.go#L175>)
### func \(\*ContractEvents\) [GetEvents](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_events.go#L174>)

```go
func (events *ContractEvents) GetEvents(ctx context.Context, eventName string, options EventQueryOptions) ([]ContractEvent, error)
```

Query past events of a specific type on the contract\.
Query past events of a specific type on the contract.

eventName: The name of the event to query for

Expand Down
22 changes: 13 additions & 9 deletions docs/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

### Custom Contracts

With the thirdweb SDK, you can get a contract instance for any contract\. Additionally, if you deployed your contract using thirdweb deploy, you can get a more explicit and intuitive interface to interact with your contracts\.
With the thirdweb SDK, you can get a contract instance for any contract. Additionally, if you deployed your contract using thirdweb deploy, you can get a more explicit and intuitive interface to interact with your contracts.

\# Getting a Custom Contract Instance

Expand Down Expand Up @@ -65,18 +65,22 @@ tx, err := contract.Call("mintTo", "{{wallet_address}}", "ipfs://...")

```go
type SmartContract struct {
Helper *contractHelper
Encoder *ContractEncoder
Events *ContractEvents
ERC20 *ERC20
ERC721 *ERC721
ERC1155 *ERC1155
}
```

### func \(\*SmartContract\) [Call](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/smart_contract.go#L134>)
### func \(\*SmartContract\) [Call](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/smart_contract.go#L153>)

```go
func (c *SmartContract) Call(ctx context.Context, method string, args ...interface{}) (interface{}, error)
```

Call any function on your contract\.
Call any function on your contract.

method: the name of the method on your contract you want to call

Expand All @@ -93,7 +97,7 @@ balance, err := contract.Call("balanceOf", "{{wallet_address}}")
tx, err := contract.Call(context.Background(), "mintTo", "{{wallet_address}}", "ipfs://...")
```

## type [SnapshotClaim](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/snapshots.go#L17-L21>)
## type [SnapshotClaim](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/snapshots.go#L18-L22>)

```go
type SnapshotClaim struct {
Expand All @@ -103,7 +107,7 @@ type SnapshotClaim struct {
}
```

## type [SnapshotEntry](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/types.go#L573-L578>)
## type [SnapshotEntry](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/types.go#L594-L599>)

```go
type SnapshotEntry struct {
Expand All @@ -114,7 +118,7 @@ type SnapshotEntry struct {
}
```

## type [SnapshotEntryWithProof](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/types.go#L551-L557>)
## type [SnapshotEntryWithProof](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/types.go#L572-L578>)

```go
type SnapshotEntryWithProof struct {
Expand All @@ -126,7 +130,7 @@ type SnapshotEntryWithProof struct {
}
```

## type [SnapshotInfo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/snapshots.go#L23-L26>)
## type [SnapshotInfo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/snapshots.go#L24-L27>)

```go
type SnapshotInfo struct {
Expand All @@ -135,7 +139,7 @@ type SnapshotInfo struct {
}
```

## type [SnapshotInfos](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/snapshots.go#L28-L32>)
## type [SnapshotInfos](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/snapshots.go#L29-L33>)

```go
type SnapshotInfos struct {
Expand All @@ -145,7 +149,7 @@ type SnapshotInfos struct {
}
```

## type [SnapshotInput](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/snapshots.go#L12-L15>)
## type [SnapshotInput](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/snapshots.go#L13-L16>)

```go
type SnapshotInput struct {
Expand Down
26 changes: 14 additions & 12 deletions docs/edition.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ contract, err := sdk.GetEdition("{{contract_address}}")

```go
type Edition struct {
*ERC1155
*ERC1155Standard

Helper *contractHelper
Signature *ERC1155SignatureMinting
Encoder *ContractEncoder
Events *ContractEvents
Expand All @@ -32,33 +34,33 @@ type Edition struct {
func (edition *Edition) Mint(ctx context.Context, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
```

Mint an NFT to the connected wallet\.
Mint an NFT to the connected wallet.

metadataWithSupply: nft metadata with supply of the NFT to mint

returns: the transaction receipt of the mint

### func \(\*Edition\) [MintAdditionalSupply](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L141>)
### func \(\*Edition\) [MintAdditionalSupply](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L119>)

```go
func (edition *Edition) MintAdditionalSupply(ctx context.Context, tokenId int, additionalSupply int) (*types.Transaction, error)
```

Mint additionaly supply of a token to the connected wallet\.
Mint additionaly supply of a token to the connected wallet.

tokenId: token ID to mint additional supply of

additionalSupply: additional supply to mint

returns: the transaction receipt of the mint

### func \(\*Edition\) [MintAdditionalSupplyTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L155>)
### func \(\*Edition\) [MintAdditionalSupplyTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L132>)

```go
func (edition *Edition) MintAdditionalSupplyTo(ctx context.Context, to string, tokenId int, additionalSupply int) (*types.Transaction, error)
```

Mint additional supply of a token to the specified wallet\.
Mint additional supply of a token to the specified wallet.

to: address of the wallet to mint NFTs to

Expand All @@ -68,25 +70,25 @@ additionalySupply: additional supply to mint

returns: the transaction receipt of the mint

### func \(\*Edition\) [MintBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L184>)
### func \(\*Edition\) [MintBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L141>)

```go
func (edition *Edition) MintBatch(ctx context.Context, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
```

Mint a batch of NFTs to the connected wallet\.
Mint a batch of NFTs to the connected wallet.

metadatasWithSupply: list of NFT metadatas with supplies to mint

returns: the transaction receipt of the mint

### func \(\*Edition\) [MintBatchTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L216>)
### func \(\*Edition\) [MintBatchTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L173>)

```go
func (edition *Edition) MintBatchTo(ctx context.Context, to string, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
```

Mint a batch of NFTs to a specific wallet\.
Mint a batch of NFTs to a specific wallet.

to: address of the wallet to mint NFTs to

Expand Down Expand Up @@ -117,13 +119,13 @@ metadatasWithSupply := []*thirdweb.EditionMetadataInput{
tx, err := contract.MintBatchTo(context.Background(), "{{wallet_address}}", metadatasWithSupply)
```

### func \(\*Edition\) [MintTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L109>)
### func \(\*Edition\) [MintTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L108>)

```go
func (edition *Edition) MintTo(ctx context.Context, address string, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
```

Mint a new NFT to the specified wallet\.
Mint a new NFT to the specified wallet.

address: the wallet address to mint the NFT to

Expand Down
16 changes: 9 additions & 7 deletions docs/edition_drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,36 @@ contract, err := sdk.GetEditionDrop("{{contract_address}}")

```go
type EditionDrop struct {
*ERC1155
*ERC1155Standard

Helper *contractHelper
ClaimConditions *EditionDropClaimConditions
Encoder *ContractEncoder
Events *ContractEvents
}
```

### func \(\*EditionDrop\) [Claim](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition_drop.go#L158>)
### func \(\*EditionDrop\) [Claim](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition_drop.go#L119>)

```go
func (drop *EditionDrop) Claim(ctx context.Context, tokenId int, quantity int) (*types.Transaction, error)
```

Claim NFTs from this contract to the connect wallet\.
Claim NFTs from this contract to the connect wallet.

tokenId: the token ID of the NFT to claim

quantity: the number of NFTs to claim

returns: the transaction receipt of the claim

### func \(\*EditionDrop\) [ClaimTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition_drop.go#L180>)
### func \(\*EditionDrop\) [ClaimTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition_drop.go#L140>)

```go
func (drop *EditionDrop) ClaimTo(ctx context.Context, destinationAddress string, tokenId int, quantity int) (*types.Transaction, error)
```

Claim NFTs from this contract to the connect wallet\.
Claim NFTs from this contract to the connect wallet.

tokenId: the token ID of the NFT to claim

Expand All @@ -66,13 +68,13 @@ quantity = 1
tx, err := contract.ClaimTo(context.Background(), address, tokenId, quantity)
```

### func \(\*EditionDrop\) [CreateBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition_drop.go#L110>)
### func \(\*EditionDrop\) [CreateBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition_drop.go#L108>)

```go
func (drop *EditionDrop) CreateBatch(ctx context.Context, metadatas []*NFTMetadataInput) (*types.Transaction, error)
```

Create a batch of NFTs on this contract\.
Create a batch of NFTs on this contract.

metadatas: a list of the metadatas of the NFTs to create

Expand Down
Loading