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

Commit

Permalink
Update storage to use api key (#134)
Browse files Browse the repository at this point in the history
* Update storage to use api key

* Add back X-App-Name header

* Update with secretKey setup

* Update to production domains

* Remove

* Update docs with api key
  • Loading branch information
adam-maj authored Jul 18, 2023
1 parent ec836c0 commit 221143c
Show file tree
Hide file tree
Showing 38 changed files with 275 additions and 194 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ go get github.com/thirdweb-dev/go-sdk/v2/thirdweb

## Getting Started

To start using this SDK, you just need to pass in a provider configuration.
To start using this SDK, you just need to pass in a provider configuration. It's also strongly recommended that you use your thirdweb API keys with the SDK in order to get the best infrastructure performance (across RPCs, IPFS, etc.) - you can learn more about creating and using API keys [here](https://portal.thirdweb.com/api-keys).

### Instantiating the SDK

Expand All @@ -34,10 +34,15 @@ import (
)

func main() {
// Your secret key from the thirdweb api keys dashboard
secretKey := "..."

// Creates a new SDK instance to get read-only data for your contracts, you can pass:
// - a chain name (mainnet, rinkeby, goerli, polygon, mumbai, avalanche, fantom)
// - a custom RPC URL
sdk, err := thirdweb.NewThirdwebSDK("mumbai", nil)
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
SecretKey: secretKey,
})
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -66,7 +71,12 @@ import (
)

func main() {
sdk, err := thirdweb.NewThirdwebSDK("mumbai", nil)
// Get your secret key that you created from the thirdweb dashboard
secretKey := "..."

sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
SecretKey: secretKey,
})
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -107,11 +117,15 @@ import (
)

func main() {
// Get your secret key that you created from the thirdweb dashboard
secretKey := "..."

// Get your private key securely (preferably from an environment variable)
privateKey := "..."

// Instantiate the SDK with your privateKey
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
SecretKey: secretKey,
PrivateKey: privateKey,
})
if err != nil {
Expand Down
18 changes: 10 additions & 8 deletions docs/contract_deployer.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"github.com/thirdweb-dev/go-sdk/v2/thirdweb"
)
privateKey = "..."
privateKey := "..."
secretKey := "..."
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
PrivateKey: privateKey,
SecretKey: secretKey
})
// Now you can deploy a contract
Expand All @@ -28,7 +30,7 @@ type ContractDeployer struct {
}
```

### func \(\*ContractDeployer\) [DeployEdition](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L114>)
### func \(\*ContractDeployer\) [DeployEdition](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L117>)

```go
func (deployer *ContractDeployer) DeployEdition(ctx context.Context, metadata *DeployEditionMetadata) (string, error)
Expand All @@ -51,7 +53,7 @@ address, err := sdk.Deployer.DeployEdition(
})
```

### func \(\*ContractDeployer\) [DeployEditionDrop](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L171>)
### func \(\*ContractDeployer\) [DeployEditionDrop](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L174>)

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

### func \(\*ContractDeployer\) [DeployMarketplace](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L209>)
### func \(\*ContractDeployer\) [DeployMarketplace](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L212>)

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

### func \(\*ContractDeployer\) [DeployMultiwrap](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L190>)
### func \(\*ContractDeployer\) [DeployMultiwrap](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L193>)

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

### func \(\*ContractDeployer\) [DeployNFTCollection](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L95>)
### func \(\*ContractDeployer\) [DeployNFTCollection](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L98>)

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

### func \(\*ContractDeployer\) [DeployNFTDrop](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L152>)
### func \(\*ContractDeployer\) [DeployNFTDrop](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L155>)

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

### func \(\*ContractDeployer\) [DeployToken](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L133>)
### func \(\*ContractDeployer\) [DeployToken](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/contract_deployer.go#L136>)

```go
func (deployer *ContractDeployer) DeployToken(ctx context.Context, metadata *DeployTokenMetadata) (string, error)
Expand Down
10 changes: 6 additions & 4 deletions docs/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import (
"github.com/thirdweb-dev/go-sdk/v2/thirdweb"
)
privateKey = "..."
privateKey := "..."
secretKey := "..."
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
PrivateKey: privateKey,
SecretKey: secretKey
})
// You can replace your own contract address here
Expand Down Expand Up @@ -74,7 +76,7 @@ type SmartContract struct {
}
```

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

```go
func (c *SmartContract) Call(ctx context.Context, method string, args ...interface{}) (interface{}, error)
Expand Down Expand Up @@ -107,7 +109,7 @@ type SnapshotClaim struct {
}
```

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

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

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

```go
type SnapshotEntryWithProof struct {
Expand Down
16 changes: 9 additions & 7 deletions docs/edition.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"github.com/thirdweb-dev/go-sdk/v2/thirdweb"
)
privateKey = "..."
privateKey := "..."
secretKey := "..."
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
PrivateKey: privateKey,
SecretKey: secretKey
})
contract, err := sdk.GetEdition("{{contract_address}}")
Expand All @@ -28,7 +30,7 @@ type Edition struct {
}
```

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

```go
func (edition *Edition) Mint(ctx context.Context, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
Expand All @@ -40,7 +42,7 @@ 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#L119>)
### func \(\*Edition\) [MintAdditionalSupply](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L121>)

```go
func (edition *Edition) MintAdditionalSupply(ctx context.Context, tokenId int, additionalSupply int) (*types.Transaction, error)
Expand All @@ -54,7 +56,7 @@ 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#L132>)
### func \(\*Edition\) [MintAdditionalSupplyTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L134>)

```go
func (edition *Edition) MintAdditionalSupplyTo(ctx context.Context, to string, tokenId int, additionalSupply int) (*types.Transaction, error)
Expand All @@ -70,7 +72,7 @@ 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#L141>)
### func \(\*Edition\) [MintBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L143>)

```go
func (edition *Edition) MintBatch(ctx context.Context, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
Expand All @@ -82,7 +84,7 @@ 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#L173>)
### func \(\*Edition\) [MintBatchTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L175>)

```go
func (edition *Edition) MintBatchTo(ctx context.Context, to string, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
Expand Down Expand Up @@ -119,7 +121,7 @@ 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#L108>)
### func \(\*Edition\) [MintTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition.go#L110>)

```go
func (edition *Edition) MintTo(ctx context.Context, address string, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
Expand Down
10 changes: 6 additions & 4 deletions docs/edition_drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"github.com/thirdweb-dev/go-sdk/v2/thirdweb"
)
privateKey = "..."
privateKey := "..."
secretKey := "..."
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
PrivateKey: privateKey,
SecretKey: secretKey
})
contract, err := sdk.GetEditionDrop("{{contract_address}}")
Expand All @@ -28,7 +30,7 @@ type EditionDrop struct {
}
```

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

```go
func (drop *EditionDrop) Claim(ctx context.Context, tokenId int, quantity int) (*types.Transaction, error)
Expand All @@ -42,7 +44,7 @@ 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#L140>)
### func \(\*EditionDrop\) [ClaimTo](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition_drop.go#L142>)

```go
func (drop *EditionDrop) ClaimTo(ctx context.Context, destinationAddress string, tokenId int, quantity int) (*types.Transaction, error)
Expand All @@ -68,7 +70,7 @@ 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#L108>)
### func \(\*EditionDrop\) [CreateBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/edition_drop.go#L110>)
```go
func (drop *EditionDrop) CreateBatch(ctx context.Context, metadatas []*NFTMetadataInput) (*types.Transaction, error)
Expand Down
16 changes: 8 additions & 8 deletions docs/erc721_signature_minting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type ERC721SignatureMinting struct {
}
```

### func \(\*ERC721SignatureMinting\) [Generate](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L315>)
### func \(\*ERC721SignatureMinting\) [Generate](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L314>)

```go
func (signature *ERC721SignatureMinting) Generate(ctx context.Context, payloadToSign *Signature721PayloadInput) (*SignedPayload721, error)
Expand Down Expand Up @@ -41,7 +41,7 @@ payload := &thirdweb.Signature721PayloadInput{
signedPayload, err := contract.Signature.Generate(payload)
```

### func \(\*ERC721SignatureMinting\) [GenerateBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L364>)
### func \(\*ERC721SignatureMinting\) [GenerateBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L363>)

```go
func (signature *ERC721SignatureMinting) GenerateBatch(ctx context.Context, payloadsToSign []*Signature721PayloadInput) ([]*SignedPayload721, error)
Expand Down Expand Up @@ -90,27 +90,27 @@ payload := []*thirdweb.Signature721PayloadInput{
signedPayload, err := contract.Signature.GenerateBatch(context.Background(), payload)
```

### func \(\*ERC721SignatureMinting\) [GenerateBatchWithUris](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L446>)
### func \(\*ERC721SignatureMinting\) [GenerateBatchWithUris](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L444>)

```go
func (signature *ERC721SignatureMinting) GenerateBatchWithUris(ctx context.Context, payloadsToSign []*Signature721PayloadInputWithUri) ([]*SignedPayload721, error)
```

### func \(\*ERC721SignatureMinting\) [Mint](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L69>)
### func \(\*ERC721SignatureMinting\) [Mint](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L68>)

```go
func (signature *ERC721SignatureMinting) Mint(ctx context.Context, signedPayload *SignedPayload721) (*types.Transaction, error)
```

Deprecated: use MintAndAwait

### func \(\*ERC721SignatureMinting\) [MintAndAwait](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L73>)
### func \(\*ERC721SignatureMinting\) [MintAndAwait](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L72>)

```go
func (signature *ERC721SignatureMinting) MintAndAwait(ctx context.Context, signedPayload *SignedPayload721) (*types.Transaction, error)
```

### func \(\*ERC721SignatureMinting\) [MintBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L147>)
### func \(\*ERC721SignatureMinting\) [MintBatch](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L146>)

```go
func (signature *ERC721SignatureMinting) MintBatch(ctx context.Context, signedPayloads []*SignedPayload721) (*types.Transaction, error)
Expand All @@ -130,13 +130,13 @@ signedPayloads, err := contract.Signature.GenerateBatch(payloads)
tx, err := contract.Signature.MintBatch(context.Background(), signedPayloads)
```

### func \(\*ERC721SignatureMinting\) [MintWithOpts](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L88>)
### func \(\*ERC721SignatureMinting\) [MintWithOpts](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L87>)

```go
func (signature *ERC721SignatureMinting) MintWithOpts(ctx context.Context, signedPayload *SignedPayload721, txOpts *bind.TransactOpts) (*types.Transaction, error)
```

### func \(\*ERC721SignatureMinting\) [Verify](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L264>)
### func \(\*ERC721SignatureMinting\) [Verify](<https://github.com/thirdweb-dev/go-sdk/blob/main/thirdweb/erc721_signature_minting.go#L263>)

```go
func (signature *ERC721SignatureMinting) Verify(ctx context.Context, signedPayload *SignedPayload721) (bool, error)
Expand Down
Loading

0 comments on commit 221143c

Please sign in to comment.