client

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: GPL-3.0 Imports: 24 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) ClaimOriginSlp added in v0.1.11

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

func (*AxieClient) ClaimSlp

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

func (*AxieClient) CreateAccessToken added in v0.1.7

func (c *AxieClient) CreateAccessToken(address, privateKeyStr string) (string, error)

func (*AxieClient) GetClaimOriginPayload added in v0.1.11

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

func (*AxieClient) GetClaimPayload added in v0.1.4

func (c *AxieClient) GetClaimPayload(ctx context.Context, address, privateKeyStr string) (*ClaimableResponse, 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 {
	ClientID          string `json:"clientID"`
	ItemID            int    `json:"itemID"`
	Name              string `json:"name"`
	Description       string `json:"description"`
	ImageUrl          string `json:"imageUrl"`
	Total             int    `json:"total"`
	BlockchainRelated struct {
		Signature struct {
			Signature string `json:"signature"`
			Amount    int    `json:"amount"`
			Timestamp int    `json:"timestamp"`
		} `json:"signature"`
		Balance     int `json:"balance"`
		Checkpoint  int `json:"checkpoint"`
		BlockNumber int `json:"blockNumber"`
	} `json:"blockchainRelated"`
	ClaimableTotal    int `json:"claimableTotal"`
	LastClaimedItemAt int `json:"lastClaimedItemAt"`
	RawTotal          int `json:"rawTotal"`
	RawClaimableTotal int `json:"rawClaimableTotal"`
}

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)
	ClaimOriginSlp(ctx context.Context, address, privateKeyStr string) (string, error)
	GetWalletTransactionHistory(address string) (*pkgTypes.WalletTransactionHistory, error)
	GetClaimPayload(ctx context.Context, address, privateKeyStr string) (*ClaimableResponse, error)
	GetClaimOriginPayload(ctx context.Context, address, privateKeyStr string) (*OriginClaimableResponse, error)
	CreateAccessToken(address, privateKeyStr string) (string, 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 OriginClaimableResponse added in v0.1.11

type OriginClaimableResponse struct {
	ClientID     string `json:"clientID"`
	ItemID       string `json:"itemID"`
	Withdrawable int    `json:"withdrawable"`
	Quantity     int    `json:"quantity"`
	Item         struct {
		Category      string `json:"category"`
		Name          string `json:"name"`
		Description   string `json:"description"`
		Rarity        string `json:"rarity"`
		TokenStandard string `json:"tokenStandard"`
		TokenId       string `json:"tokenId"`
	} `json:"item"`
}

func (OriginClaimableResponse) CanClaim added in v0.1.11

func (c OriginClaimableResponse) CanClaim() bool

func (OriginClaimableResponse) GetClaimableAmount added in v0.1.11

func (c OriginClaimableResponse) GetClaimableAmount() int

type OriginWithdrawItemsResponse added in v0.1.11

type OriginWithdrawItemsResponse struct {
	UserAddress string `json:"userAddress"`
	Nonce       int64  `json:"nonce"`
	ExpiredAt   int64  `json:"expiredAt"`
	Signature   string `json:"signature"`
	Items       []struct {
		ItemId        string `json:"itemId"`
		TokenStandard string `json:"tokenStandard"`
		TokenAddress  string `json:"tokenAddress"`
		TokenId       string `json:"tokenId"`
		SignedAmount  string `json:"signedAmount"`
	} `json:"items"`
	ExtraData string `json:"extraData"`
}

type T

type T struct {
}

Jump to

Keyboard shortcuts

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