Skip to main content

Official Nftlabs sdk

Project description

NFTLabs Python SDK

PyPi package found here.

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
import nftlabs.options
from nftlabs import NftlabsSdk

options = nftlabs.options.SdkOptions()
sdk = NftlabsSdk(options, "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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nftlabs-sdk-0.1.0.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

nftlabs_sdk-0.1.0-py3-none-any.whl (59.2 kB view details)

Uploaded Python 3

File details

Details for the file nftlabs-sdk-0.1.0.tar.gz.

File metadata

  • Download URL: nftlabs-sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.10.0

File hashes

Hashes for nftlabs-sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 987aeaa41624fcf79e09322e7ba945fe9bee6159b8af06f71044bd9eb8ae166e
MD5 478df162ba17a5b6821854e0061c1e64
BLAKE2b-256 ad8aad9292d7dbe85a6ffaa42acdab0ed3341d2f96b9de8ba497f26b03f7fb2f

See more details on using hashes here.

File details

Details for the file nftlabs_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nftlabs_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 59.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.10.0

File hashes

Hashes for nftlabs_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc7b5c3ba2e40c9044a4bab74fe00181b36cfd7765dcc7411042e332bc2b8b84
MD5 61ad250642649dffad7d6e6fd51df884
BLAKE2b-256 e1daa9d3c0ae8a61c5f194d318fd63e6220493d8646deefaa18416626b67dba6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page