tokengate

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 5 Imported by: 0

README

Axie Infinity Tokengate Client

This package provides a simple client that wraps the tokengate API.

Installation

go get github.com/wehmoen-dev/tokengate

Usage

package main

import (
	"github.com/ethereum/go-ethereum/common"
	"github.com/wehmoen-dev/tokengate"
	"log"
)

var testAddress = common.HexToAddress("0x2d62c27ce2e9e66bb8a667ce1b60f7cb02fa9810")

func main() {
	client := tokengate.New()
	hasMystic, err := client.HasAxieFromCollection(testAddress, tokengate.MysticAxie)
	if err != nil {
		log.Fatal(err)
	}

	if hasMystic {
		log.Printf("Address %s has a mystic axie", testAddress.Hex())
	} else {
		log.Printf("Address %s does not have a mystic axie", testAddress.Hex())
	}
}

Notes

Land functions are currently not implemented. I first have to update the upstream API proxy.

Documentation

Index

Constants

View Source
const VERSION = "v1.0.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type AxieCollection

type AxieCollection string
const (
	MysticAxie   AxieCollection = "mystic"
	XmasAxie     AxieCollection = "xmas"
	JapaneseAxie AxieCollection = "japanese"
	ShinyAxie    AxieCollection = "shiny"
	SummerAxie   AxieCollection = "summer"
	OriginAxie   AxieCollection = "origin"
)

type AxieSummary

type AxieSummary map[AxieCollection]int

type LandCollection

type LandCollection string
const (
	SavannahLand LandCollection = "savannah"
	ForestLand   LandCollection = "forest"
	ArcticLand   LandCollection = "arctic"
	MysticLand   LandCollection = "mystic"
	GenesisLand  LandCollection = "genesis"
)

type LandSummary

type LandSummary map[LandCollection]int

type StakingType

type StakingType string
const (
	RONStaking  StakingType = "ron"
	AXSStaking  StakingType = "axs"
	LANDStaking StakingType = "land"
)

type TokenGateClient

type TokenGateClient interface {
	HasAxieFromCollection(wallet common.Address, collection AxieCollection) (bool, error)
	HasLandFromCollection(wallet common.Address, collection LandCollection) (bool, error)

	GetAxieSummary(wallet common.Address) (AxieSummary, error)
	GetLandSummary(wallet common.Address) (LandSummary, error)
}

func New

func New() TokenGateClient

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL