foxapi

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Endpoint    = "https://api.fox.one/api/v2"
	EndpointDev = "https://dev.fox.one/api/v2"
)
View Source
const (
	ErrCodeAuthFailed = 1537
)

Variables

This section is empty.

Functions

func UseEndpoint

func UseEndpoint(endpoint string)

func ValidateToken

func ValidateToken(token string) error

Types

type Asset

type Asset struct {
	AssetID       string          `json:"asset_id,omitempty"`
	ChainID       string          `json:"chain_id,omitempty"`
	Name          string          `json:"name,omitempty"`
	Symbol        string          `json:"symbol,omitempty"`
	Icon          string          `json:"icon,omitempty"`
	Price         decimal.Decimal `json:"price,omitempty"`
	Change        decimal.Decimal `json:"change,omitempty"`
	PriceUSD      decimal.Decimal `json:"price_usd,omitempty"`
	ChangeUSD     decimal.Decimal `json:"change_usd,omitempty"`
	PriceBTC      decimal.Decimal `json:"price_btc,omitempty"`
	ChangeBTC     decimal.Decimal `json:"change_btc,omitempty"`
	Confirmations int             `json:"confirmations,omitempty"`

	// user asset
	Balance     decimal.Decimal `json:"balance,omitempty"`
	Destination string          `json:"destination,omitempty"`
	Tag         string          `json:"tag,omitempty"`

	Chain *Asset `json:"chain,omitempty"`
}

func ReadAsset

func ReadAsset(ctx context.Context, accessToken string, assetID string) (*Asset, error)

func ReadAssets

func ReadAssets(ctx context.Context, accessToken string) ([]*Asset, error)

func SearchAssets

func SearchAssets(ctx context.Context, symbol string, fuzzy bool) ([]*Asset, error)

type Opponent

type Opponent struct {
	Avatar   string `json:"avatar,omitempty"`
	FullName string `json:"fullname,omitempty"`
	ID       string `json:"id,omitempty"`
}

type PageSnapshots

type PageSnapshots struct {
	Pagination *pagination.Pagination `json:"pagination"`
	Snapshots  []*Snapshot            `json:"snapshots"`
}

func ReadSnapshots

func ReadSnapshots(context context.Context, accessToken, assetID, cursor string, limit int) (*PageSnapshots, error)

type Snapshot

type Snapshot struct {
	Asset           *Asset                 `json:"asset"`
	Amount          decimal.Decimal        `json:"amount"`
	AssetID         string                 `json:"asset_id"`
	InsideMixin     bool                   `json:"inside_mixin,omitempty"`
	CreatedAt       int64                  `json:"created_at"`
	Memo            string                 `json:"memo,omitempty"`
	ExtraData       map[string]interface{} `json:"extra_data"`
	Opponent        *Opponent              `json:"opponent,omitempty"`
	OpponentID      string                 `json:"opponent_id,omitempty"`
	Receiver        string                 `json:"receiver,omitempty"`
	Sender          string                 `json:"sender,omitempty"`
	SnapshotID      string                 `json:"snapshot_id,omitempty"`
	Source          string                 `json:"source,omitempty"`
	TraceID         string                 `json:"trace_id,omitempty"`
	TransactionHash string                 `json:"transaction_hash,omitempty"`
	UserID          string                 `json:"user_id,omitempty"`
}

func ReadSnapshot

func ReadSnapshot(context context.Context, accessToken, snapshotID string) (*Snapshot, error)

type Token

type Token struct {
	AccessToken  string `json:"access_token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
	ExpiresIn    int64  `json:"expires_in,omitempty"`
	Scope        string `json:"scope,omitempty"`
	TokenType    string `json:"token_type,omitempty"` // bearer
}

func AuthorizeToken

func AuthorizeToken(ctx context.Context, clientID, clientSecret, code, verifier string) (*Token, error)

func RefreshToken

func RefreshToken(ctx context.Context, refreshToken string, transation int) (*Token, error)

RefreshToken return new access token by refresh token old access token will still be alive in transation minutes

type User

type User struct {
	ID          string `json:"id,omitempty"`
	Avatar      string `json:"avatar,omitempty"`
	Name        string `json:"fullname,omitempty"`
	Language    string `json:"language,omitempty"`
	PhoneCode   string `json:"phone_code,omitempty"`
	PhoneNumber string `json:"phone_number,omitempty"`
}

func SearchWalletUser

func SearchWalletUser(ctx context.Context, walletID string) (*User, error)

func UserMe

func UserMe(ctx context.Context, accessToken string) (*User, error)

Jump to

Keyboard shortcuts

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