Official Thirdweb sdk
Project description
NFTLabs Python SDK
PyPi package found here.
Deprecation Notice
The
nftlabs-sdk
pypi package will be deprecated on November 30th, 2021Please make sure you install the new
thirdweb-sdk
package found hereIn your code, update all imports to use the
thirdweb
package and switch to using theThirdwebSdk
package (instead of theNftlabsSdk
package)
Docs
API Reference
https://python-docs.nftlabs.co/
Installing the SDK
$ pip install thirdweb-sdk
Package Structure
nftlabs
├── abi // contains autogenerated ABI contract wrappers
├── errors // commonly thrown errors
├── modules // NFT, Currency, Marketplace, Pack, Collection, etc modules
├── options // Options classes used throughout the SDK
├── sdk.py // NftlabsSdk class, wrapper for the entire package
├── storage // Distributed file storage helper classes
└── types // Types consumed by some of the methods exposed in the modules
Calling the modules
You can call the NFTLabs modules by instantiating an SDK object and fetching the module with your contract address like this:
import os
from nftlabs import NftlabsSdk, SdkOptions
sdk = NftlabsSdk(SdkOptions(), "https://rpc-mumbai.maticvigil.com") # polygon testnet as an example
# Assumes your private key is assigned to the `PKEY` environment variable
sdk.set_private_key(os.getenv("PKEY"))
# Put your NFT contract address here if you want to mint your own NFTs!
nft_module = sdk.get_nft_module("0xbDfF8fb43688fB4D2184DF8029A7238ac1413A24")
print(nft_module.total_supply())
Development
Generating ABI wrappers
The abi
package contains autogenerated code compiled by the
0xchain abi-gen
tool found here.
Our protocols are developer at this repo.
Install the abi-gen
cli tool and use it to compile abi wrappers like this:
$ # assumes you have the nftlabs-protocols repo cloned in the parent directory
$ abi-gen --language Python -o nftlabs/abi --abis ../nftlabs-protocols/abi/NFT.json
Anytime there are ABI contract changes, you should regenerate the abi wrappers.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for thirdweb_sdk-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f49eb550b61bceb56547d85085731642e065b1f9b2219931852601aa2ced815e |
|
MD5 | 47bbdbe187331c6a68c51860feb7a4a1 |
|
BLAKE2b-256 | f2ca4831bc24a580c5b19eeb21acfe6d36bf002942d1d2e3d80a9a6f688a78ef |