Go (golang) Wrapper for the OpenSea API https://docs.opensea.io/reference/api-overview
If using Go modules (Go version >= 11.1) simply import as needed.
go mod init github.com/yourusername/yourprojectname
go get github.com/rbbrown1/go-opensea
package main
import (
"context"
"fmt"
"log"
"time"
goopensea "github.com/rbbrown1/go-opensea"
)
// get NFTs for a wallet address
func main() {
ctx, cancel := context.WithTimeout(
context.Background(),
time.Duration(time.Second*10))
defer cancel()
// create opensea client object
client := goopensea.NewClient(ctx)
// create parameter object
params := goopensea.GetAssetsParams{
Owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
Limit: 1}
// execute the api call
assets, err := client.GetAssets(params)
if err != nil {
log.Fatalf("Error getting multiple assets: %v", err)
}
fmt.Printf("%+v", assets)
}
go test
Documentation coming soon :)