client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AXIE_INFINITY_GRAPHQL_GATEWAY = "https://graphql-gateway.axieinfinity.com/graphql"
	HOUR_PER_DAY                  = 24
	DAYS_BETWEEN_CLAIM            = 14
	DURATION_BETWEEN_CLAIMS       = time.Hour * HOUR_PER_DAY * DAYS_BETWEEN_CLAIM
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AxieClient

type AxieClient struct {
	// contains filtered or unexported fields
}

func (*AxieClient) BreedAxie

func (c *AxieClient) BreedAxie(ctx context.Context, privateKey string, dadAxieId, momAxieId int) (string, error)

TODO: Test

func (*AxieClient) ClaimSlp

func (c *AxieClient) ClaimSlp(
	ctx context.Context, address, privateKeyStr string) (string, error)

func (*AxieClient) GetClaimableAmount

func (c *AxieClient) GetClaimableAmount(ctx context.Context, address string) (*ClaimableResponse, error)

func (*AxieClient) GetRoninWalletBalance

func (c *AxieClient) GetRoninWalletBalance(ctx context.Context, tokenTypeAddress, address string) (float64, error)

func (*AxieClient) GetTransactionReceipt

func (c *AxieClient) GetTransactionReceipt(ctx context.Context, txHash string) (*types.Receipt, error)

func (*AxieClient) GetWalletTransactionHistory

func (c *AxieClient) GetWalletTransactionHistory(address string) (*pkgTypes.WalletTransactionHistory, error)

func (*AxieClient) TransferAxie

func (c *AxieClient) TransferAxie(ctx context.Context, privateKey, to string, axieId int) (string, error)

func (*AxieClient) TransferSlp

func (c *AxieClient) TransferSlp(ctx context.Context, privateKey, to string, amount int) (string, error)

type ClaimableResponse

type ClaimableResponse struct {
	BlockchainRelated struct {
		Signature struct {
			Signature string `json:"signature"`
			// Total amount earned
			Amount    int `json:"amount"`
			Timestamp int `json:"timestamp"`
		} `json:"signature"`
		// Current SLP in wallet
		Balance int `json:"balance"`
		// Last total amount claimed
		Checkpoint  int `json:"checkpoint"`
		BlockNumber int `json:"block_number"`
	} `json:"blockchain_related"`
	ClaimableTotal int `json:"claimable_total"`
	// Last time this account was claimed
	// NOTE: When a REQUEST to claim occurs, this will set last claim date, even if a claim event did not happen successfully
	// Cannot use this as a last claim date
	LastClaimedItemAt int `json:"last_claimed_item_at"`
	RawTotal          int `json:"raw_total"`
	RawClaimableTotal int `json:"raw_claimable_total"`
	Item              struct {
		Id          int    `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
		ImageUrl    string `json:"image_url"`
		UpdatedAt   int    `json:"updated_at"`
		CreatedAt   int    `json:"created_at"`
	} `json:"item"`
}

func (ClaimableResponse) CanClaim

func (c ClaimableResponse) CanClaim() bool

func (ClaimableResponse) GetClaimableAmount

func (c ClaimableResponse) GetClaimableAmount() int

The following functions are so funny, it makes me think im not sure whats going on OR the devs suck amount that can be claimed as of today if CanClaim is true

func (ClaimableResponse) HoursToNextClaim

func (c ClaimableResponse) HoursToNextClaim() float64

type Client

type Client interface {
	TransferSlp(ctx context.Context, privateKey, to string, amount int) (string, error)
	TransferAxie(ctx context.Context, privateKey, to string, axieId int) (string, error)
	GetTransactionReceipt(ctx context.Context, txHash string) (*types.Receipt, error)
	GetRoninWalletBalance(ctx context.Context, tokenTypeAddress, address string) (float64, error)
	GetClaimableAmount(ctx context.Context, address string) (*ClaimableResponse, error)
	ClaimSlp(ctx context.Context, address, privateKeyStr string) (string, error)
	GetWalletTransactionHistory(address string) (*pkgTypes.WalletTransactionHistory, error)
}

func New

func New() (Client, error)

type GraphqlRequest

type GraphqlRequest struct {
	OperationName string                 `json:"operationName"`
	Variables     map[string]interface{} `json:"variables"`
	Query         string                 `json:"query"`
}

type T

type T struct {
}

Jump to

Keyboard shortcuts

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