atm

package module
v0.0.0-...-99f2218 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 8 Imported by: 0

README

atm-sdk/go

Install

go get -u github.com/fox-one/atm-sdk/go

Documentation

Index

Constants

View Source
const (
	// 市价极速兑换
	StrategyMarket = "MARKET"
	// 跟随买一卖一下单
	StrategyFollow = "FOLLOW"
	// 限价单
	StrategyLimit = "LIMIT"
)
View Source
const (
	// 兑换失败,退款
	TransferActionSourceRefund = "REFUND"
	// 兑换成功
	TransferActionSourceFilled = "FILLED"
)
View Source
const (
	// api host
	Endpoint = "https://efox.fox.one"

	BrokerID = "fb151d94-cc0e-358b-9cdb-57215a557a31"
)

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(userID string, key *rsa.PrivateKey, exp time.Duration) string

func IsErrorCode

func IsErrorCode(err error, code twirp.ErrorCode) bool

func IsErrorNotFound

func IsErrorNotFound(err error) bool

func IsErrorUnauthenticated

func IsErrorUnauthenticated(err error) bool

func WithToken

func WithToken(ctx context.Context, token string) context.Context

WithToken store an authorization token in a context.Context 如果是调用需要鉴权的 rpc 方法,需要通过这种方式将 token 附带上去

Types

type OrderAction

type OrderAction struct {
	// Asset 为要换取的币的 symbol 或者 mixin asset id
	Asset string `json:"a,omitempty"`
	// MARKET or FOLLOW
	Strategy string `json:"s,omitempty"`
	// Price 限价价格,仅用在 LIMIT 策略
	Price string `json:"price,omitempty"`
	// 注册或者更新 public key, rsa public key base64 格式
	PublicKey string `json:"u,omitempty"`
}

func (OrderAction) Encode

func (action OrderAction) Encode() string

type TransferAction

type TransferAction struct {
	// Service = ATM
	Service string `json:"s,omitempty"`
	// REFUND or FILLED
	Source string `json:"c,omitempty"`
	// 订单 id
	OrderID string `json:"t,omitempty"`
}

TransferAction 是 atm 兑换完成或者失败后回款的 memo 格式

Directories

Path Synopsis
Package proto is a generated twirp stub package.
Package proto is a generated twirp stub package.

Jump to

Keyboard shortcuts

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