This is a Golang library for OpenSea API v1.
Execute the command below to download the library.
go get github.com/AxLabs/go-opensea
Instantiate an Opensea instance and then call one of its provided methods to interact with the Opensea API.
// Create the OpenSea Client
opensea, err := NewOpensea(os.Getenv("API_KEY"))
if err != nil {
panic("could not instantiate Opensea instance")
}
// Get the NFT contract of, e.g., "CryptoKitties"
cryptoKittiesContract, err := opensea.GetSingleContract("0x06012c8cf97bead5deae237070f9587f8e7a266d")
if err != nil {
panic("could not get contract")
}
fmt.Println("Contract name: " + cryptoKittiesContract.Name)
fmt.Println("Schema Name: " + cryptoKittiesContract.SchemaName)
fmt.Println("External URL: " + cryptoKittiesContract.Collection.ExternalUrl)
fmt.Println("Discord URL: " + cryptoKittiesContract.Collection.DiscordUrl)
This SDK supports the following endpoints:
- 🛠 Retrieve Assets (/api/v1/assets)
- ✅ Retrieve an Asset (/api/v1/asset_contract/{asset_contract_address})
- 🛠 Validate an Asset (/api/v1/asset/{asset_contract_address}/{token_id}/validate)
- 🛠 Retrieve Events (/api/v1/events)
- 🛠 Retrieve Collections (/api/v1/collections)
- 🛠 Retrieve Bundles (/api/v1/bundles)
- ✅ Retrieve a Contract (/api/v1/asset/{asset_contract_address}/{token_id})
- 🛠 Retrieve a Collection (/api/v1/collection/{collection_slug})
- 🛠 Retrieve Collection Stats (/api/v1/collection/{collection_slug}/stats)
- 🛠 Retrieve Owners (/api/v1/asset/{asset_contract_address}/{token_id}/{owners})
Do not hesitate to fork and open Pull Requests that would resolve any of the opened issues, fix potential bugs or support additional features. Take a look at the existing issues in this repository that specify some of the desired features for this library.
- Add support for
/assets
- Add support for
/asset_contract/{asset_contract_address}
- Add support for
/asset/{asset_contract_address}/{token_id}/validate
- Add support for
/events
- Add support for
/collections
- Add support for
/bundles
- Add support for
/asset/{asset_contract_address}/{token_id}
- Add support for
/collection/{collection_slug}
- Add support for
/collection/{collection_slug}/stats
- Add support for
/asset/{asset_contract_address}/{token_id}/{owners}
- Write UTs for all above endpoints
- Include integration tests for all endpoints
This library was reworked from https://github.com/rmanzoku/go-opensea at this commit. Thanks for it! 🎉
Financial support is highly appreciated!
If you like what we've built please consider sponsoring us via GitHub.
Reach out to us in our Discord server in the #go-opensea
channel. If you have feature requests or have
identified bugs, please don't hesitate to directly open an issue about it.