nftlabs-sdk-ts

Home > @3rdweb/sdk

sdk package

The thirdweb typescript sdk.

Remarks

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 🍪 )

Example

To get you started here’s how you would instantiate the SDK and fetch some NFTs

  1. Install the sdk
npm install @3rdweb/sdk
  1. Get your NFT contract address from the Admin Dashboard.

  2. 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: "..."
         },
      },
      ...
   ]

Classes

Class Description
AppModule Access this module by calling ThirdwebSDK.getAppModule()
BundleModule (BETA) Access this module by calling ThirdwebSDK.getBundleModule()
BundleModuleMetadata  
CurrencyModule Access this module by calling ThirdwebSDK.getCurrencyModule()
CurrencyModuleMetadata  
DatastoreModuleMetadata  
DropModule (BETA) Access this module by calling ThirdwebSDK.getDropModule()
DropModuleMetadata  
InvariantError Error that may get thrown when an invariant assummption fails.
MarketModule Access this module by calling ThirdwebSDK.getMarketModule()
MarketModuleMetadata  
Module The root Module class. All other Modules extend this.
ModuleWithRoles Extends the Module class to add Role functionality.
NFTModule Access this module by calling ThirdwebSDK.getNFTModule()
NftModuleMetadata  
NotFoundError Error that may get thrown if IPFS returns nothing for a given uri.
PackModule (BETA) Access this module by calling ThirdwebSDK.getPackModule()
PackModuleMetadata  
SplitsModuleMetadata  
ThirdwebSDK The entrypoint to the SDK.
UploadError  

Enumerations

Enumeration Description
ModuleType The type of Modules that are available.

Functions

Function Description
convertModuleTypeToName(moduleType)  
convertNameToModuleType(moduleName)  
uploadToIPFS(data, contractAddress, signerAddress) A helper function to upload arbitrary data to IPFS and return the resulting IPFS uri.

Interfaces

Interface Description
BundleMetadata (BETA)
CollectionMetadata  
ContractMetadata The typical contract metadata found on the modules.
CreatePublicMintCondition (BETA)
Currency Currency metadata.
CurrencyValue Currency metadata & value.
IAppModule  
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.
ITokenMintArgs  
ITokenMintFromArgs  
ListingFilter Filter options for the Market module.
ListingMetadata Metadata for items listed on a Market module.
ModuleMetadata The module metadata, includes the address and the ModuleType.
NFTMetadata The shared NFT metadata.
NFTMetadataOwner The shared NFT metadata, including the current owner address.
PackMetadata (BETA)
PackNFTMetadata  
PublicMintCondition (BETA)
SplitRecipient The SplitRecipient type represents a recipient of some royalty, indicated by their split percentage.

Variables

Variable Description
NFTLabsSDK Deprecated, please use ThirdwebSDK instead.

Type Aliases

Type Alias Description
CollectionModule  
ForwardRequestMessage Forward Request Message that’s used for gasless transaction
JSONValue A JSON value
MetadataURIOrObject A valid URI string or metadata object
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.
ValidProviderInput A valid “ethers” Provider, Signer or a Network object or url address to create a Provider with.