The thirdweb typescript sdk.
Please keep in mind that the thirdweb typescript sdk and Admin Dashboard are currently in Early Access.
Should you find bugs or in the case you need help please reach out to us in Discord. (We also have 🍪 )
To get you started here’s how you would instantiate the SDK and fetch some NFTs
npm install @3rdweb/sdk
Get your NFT contract address from the Admin Dashboard.
Write the tiniest amount of code!
1 | import { ThirdwebSDK } from "@3rdweb/sdk";
2 | import type { NFTModule, NFTMetadataOwner } from "@3rdweb/sdk";
3 |
5 | const contractAddress = "0x..."; // your contract address from step 2
6 |
7 | const sdk = new ThirdwebSDK();
8 |
9 | const nftModule: NFTModule = sdk.getNFTModule(contractAddress);
10 |
11 | const nftListWithOwnerAddress: NFTMetadataOwner[] = await nftModule.getAllWithOwner();
12 |
13 | console.log(nftListWithOwnerAddress);
Output
=> [
{
owner: "0x...",
metadata: {
name: "...",
description: "...",
image: "..."
},
},
{
owner: "0x...",
metadata: {
name: "...",
description: "...",
image: "..."
},
},
...
]
Class | Description |
---|---|
AdminRoleMissingError | Thrown when attempting to execute an admin-role function. |
AppModule | Access this module by calling ThirdwebSDK.getAppModule() |
AssetNotFoundError | |
AuctionAlreadyStartedError | Thrown when attempting to update/cancel an auction that already started |
AuctionHasNotEndedError | Thrown when attempting to close an auction that has not ended |
BundleDropModule | Setup a collection of NFTs with a customizable number of each NFT that are minted as users claim them. |
BundleDropModuleMetadata | |
BundleModule | Create a collection of NFTs that lets you optionally mint multiple copies of each NFT. |
BundleModuleMetadata | |
ClaimConditionFactory | |
ClaimConditionPhase | |
ClaimProof | The model for a claim proof. Currently we support only an address in the leaf of the merkle tree. |
CommonModuleMetadata | CommonModuleMetadata defines the common properties of a module deployment. |
CurrencyModule | |
CurrencyModuleMetadata | |
DatastoreModuleMetadata | |
DropModule | Setup a collection of one-of-one NFTs that are minted as users claim them. |
DropModuleMetadata | |
DuplicateFileNameError | |
DuplicateLeafsError | Thrown when attempting to create a snapshot with duplicate leafs |
FetchError | Thrown when data fails to fetch from storage. |
FileNameMissingError | |
FunctionDeprecatedError | |
InvalidAddressError | Error that may get thrown if an invalid address was passed |
InvariantError | Error that may get thrown when an invariant assummption fails. |
IpfsStorage | |
ListingNotFoundError | Thrown when trying to retrieve a listing from a marketplace that doesn’t exist |
MarketModule | Access this module by calling ThirdwebSDK.getMarketModule() |
MarketModuleMetadata | |
MarketplaceModule | Create your own whitelabel marketplace that enables users to buy and sell any digital assets. |
MarketplaceModuleMetadata | |
MissingOwnerRoleError | |
MissingRoleError | |
Module | The root Module class. All other Modules extend this. |
ModuleWithRoles | Extends the Module class to add Role functionality. |
NFTModule | Create a collection of one-of-one NFTs. |
NftModuleMetadata | |
NotEnoughTokensError | |
NotFoundError | Error that may get thrown if IPFS returns nothing for a given uri. |
PackModule | Create lootboxes of NFTs with rarity based open mechanics. |
PackModuleMetadata | |
QuantityAboveLimitError | |
RestrictedTransferError | Thrown when attempting to transfer an asset that has restricted transferability |
Snapshot | |
SplitsModule | Create custom royalty splits to distribute funds. |
SplitsModuleMetadata | |
ThirdwebSDK | The entrypoint to the SDK. |
TokenModule | Create a standard crypto token or crypto currency. |
TokenModuleMetadata | |
UploadError | |
VoteModule | Create a decentralized organization for token holders to vote on proposals. |
VoteModuleMetadata | |
WrongListingTypeError | Thrown when trying to retrieve a listing of the wrong type |
Enumeration | Description |
---|---|
ClaimEligibility | |
ListingType | |
ModuleType | The type of Modules that are available. |
ProposalState | |
UnderlyingType | |
VoteType |
Function | Description |
---|---|
convertModuleTypeToName(moduleType) | |
convertNameToModuleType(moduleName) | |
estimateBlockAtTime(timeInEpochSeconds, provider) | Given a time in second, return the block number that the time is in. |
generateRoot(items) | Convenience function to generate a merkle root from a list of strings. |
getNativeTokenByChainId(chainId) | |
getTokenMetadataUsingStorage(contractAddress, provider, tokenId, storage) | |
recursiveResolveGatewayUrl(json, storage) | |
uploadToIPFS(data, contractAddress, signerAddress) | A helper function to upload arbitrary data to IPFS and return the resulting IPFS uri. |
Interface | Description |
---|---|
AuctionListing | Represents a new marketplace auction listing. |
BatchToReveal | |
BundleDropCreateClaimCondition | (BETA) |
BundleDropMetadata | (BETA) |
BundleMetadata | (BETA) |
ClaimCondition | (BETA) |
CollectionMetadata | |
ContractMetadata | The typical contract metadata found on the modules. |
CreatePublicMintCondition | (BETA) |
Currency | Currency metadata. |
CurrencyValue | Currency metadata & value. |
DirectListing | Represents a marketplace direct listing. |
Erc1155SignaturePayload | |
GaslessTransaction | transaction message contains information that’s needed to execute a gasless transaction |
IAppModule | |
IDropModule | |
IMarketplace | |
INFTBundleBatchArgs | |
INFTBundleCreateArgs | (BETA) |
INFTCollectionBatchArgs | (BETA) |
INFTCollectionCreateArgs | |
IPackBatchArgs | (BETA) |
IPackCreateArgs | (BETA) |
IRoles | Roles are used to handle permissions on modules that extend ModuleWithRoles. |
ISDKOptions | The optional options that can be passed to the SDK. |
ISignatureMinter | |
ISplitsModule | |
IStorage | |
IThirdwebSdk | |
ITokenMintArgs | |
ITokenMintFromArgs | |
ITransferable | |
ListingFilter | Filter options for the Market module. |
ListingMetadata | Metadata for items listed on a Market module. |
MarketplaceFilter | |
ModuleMetadata | The module metadata, includes the address and the ModuleType. |
ModuleMetadataNoType | The module metadata, but missing the ModuleType. |
NativeToken | |
NewAuctionListing | Represents a new marketplace auction listing. |
NewDirectListing | Represents a new marketplace direct listing. |
NewErc1155SignaturePayload | |
NewSignaturePayload | Represents a new SignatureMint request. |
NewSplitRecipient | The NewSplitRecipient interface describes the structure of a new split recipient. The shares property is important for the calculation of the the total split.If there are two recipients each with 10 shares, they each will receive 50% of the total royalties.If there are two recipients each with 1 share, they each will receive 50% of the total royalties.I.e. the total number of shares is used to calculate the percentage of the total royalties that is allocated to each recipient. |
NFTMetadata | The shared NFT metadata. |
NFTMetadataOwner | The shared NFT metadata, including the current owner address. |
Offer | |
PackMetadata | (BETA) |
PackMetadataWithBalance | |
PackNFTMetadata | |
Proposal | |
ProposalExecutable | |
ProposalVote | |
PublicClaimCondition | (BETA) |
PublicMintCondition | (BETA) |
SignaturePayload | Represents a prepared SignaturePayload object, which will be signed by a wallet. |
SnapshotInfo | |
SplitRecipient | The SplitRecipient type represents a recipient of some royalty, indicated by their split percentage. |
VoteSettings |
Variable | Description |
---|---|
DEFAULT_BLOCK_TIMES_FALLBACK | Fallback map of default block mining times in seconds. |
NFTLabsSDK | Deprecated, please use ThirdwebSDK instead. |
Type Alias | Description |
---|---|
AllModuleMetadata | |
CollectionModule | |
CollectionModuleMetadata | |
ForwardRequestMessage | Forward Request Message that’s used for gasless transaction |
JSONValue | A JSON value |
MetadataURIOrObject | A valid URI string or metadata object |
ModuleMetadataMap | |
PermitRequestMessage | EIP-2612 token permit message for gasless transaction |
ProviderOrSigner | A valid “ethers” Provider or Signer. |
Role | Roles are used to handle permissions on modules that extend ModuleWithRoles. |
SetAllRoles | |
ValidProviderInput | A valid “ethers” Provider, Signer or a Network object or url address to create a Provider with. |