cobo_custody

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeyPair

func GenerateKeyPair() (string, string)

func Hash256

func Hash256(s string) string

func Hash256x2

func Hash256x2(s string) string

func SortParams

func SortParams(params map[string]string) string

Types

type AddressInfo

type AddressInfo struct {
	Coin    string `json:"coin"`
	Address string `json:"address"`
}

type AddressesInfo

type AddressesInfo struct {
	Coin      string   `json:"coin"`
	Addresses []string `json:"addresses"`
}

type ApiError

type ApiError struct {
	ErrorId          string `json:"error_id"`
	ErrorCode        int    `json:"error_code"`
	ErrorMessage     string `json:"error_message"`
	ErrorDescription string `json:"error_description"`
}

type ApiSigner

type ApiSigner interface {
	Sign(message string) string
	GetPublicKey() string
}

type Asset

type Asset struct {
	Coin                string          `json:"coin"`
	DisplayCode         string          `json:"display_code"`
	Description         string          `json:"description"`
	Decimal             int             `json:"decimal"`
	CanDeposit          bool            `json:"can_deposit"`
	CanWithdraw         bool            `json:"can_withdraw"`
	Balance             decimal.Decimal `json:"balance"`
	AbsBalance          decimal.Decimal `json:"abs_balance"`
	FeeCoin             string          `json:"fee_coin"`
	AbsEstimateFee      decimal.Decimal `json:"abs_estimate_fee"`
	ConfirmingThreshold int             `json:"confirming_threshold"`
	DustThreshold       int             `json:"dust_threshold"`
	TokenAddress        string          `json:"token_address"`
	RequireMemo         bool            `json:"require_memo"`
}

type CallDetail added in v0.0.3

type CallDetail struct {
	RequestInfo RequestInfo
	RespInfo    RespInfo
}

type Client

type Client struct {
	Signer ApiSigner
	Env    Env
	Debug  bool
}

func (Client) BatchNewDepositAddress

func (c Client) BatchNewDepositAddress(coin string, count int, nativeSegwit bool) (CallDetail, RespNewAddresses, error)

func (Client) BatchVerifyDepositAddress

func (c Client) BatchVerifyDepositAddress(coin string, addresses []string) (CallDetail, RespNewAddresses, error)

func (Client) GetAccountInfo

func (c Client) GetAccountInfo() (CallDetail, RespOrgInfo, error)

func (Client) GetAddressHistory

func (c Client) GetAddressHistory(coin string) (CallDetail, RespAddressHistory, error)

func (Client) GetAddressHistoryWithPage

func (c Client) GetAddressHistoryWithPage(params map[string]string) (CallDetail, RespAddressHistory, error)

func (Client) GetCoinInfo

func (c Client) GetCoinInfo(coin string) (CallDetail, RespCoinInfo, error)

func (Client) GetPendingTransaction

func (c Client) GetPendingTransaction(id string) (CallDetail, RespTransactions, error)

func (Client) GetPendingTransactions

func (c Client) GetPendingTransactions(params map[string]string) (CallDetail, RespTransactions, error)

func (Client) GetTransactionDetails

func (c Client) GetTransactionDetails(txId string) (CallDetail, RespTransaction, error)

func (Client) GetTransactionHistory

func (c Client) GetTransactionHistory(params map[string]string) (CallDetail, RespTransactions, error)

func (Client) GetTransactionsById

func (c Client) GetTransactionsById(params map[string]string) (CallDetail, RespTransactions, error)

func (Client) GetTransactionsByTime

func (c Client) GetTransactionsByTime(params map[string]string) (CallDetail, RespTransactions, error)

func (Client) GetTransactionsByTxid

func (c Client) GetTransactionsByTxid(txid string) (CallDetail, RespTransaction, error)

func (Client) NewDepositAddress

func (c Client) NewDepositAddress(coin string, nativeSegwit bool) (CallDetail, RespNewAddress, error)

func (Client) QueryWithdrawInfo

func (c Client) QueryWithdrawInfo(requestId string) (CallDetail, RespTransaction, error)

func (Client) Request

func (c Client) Request(method string, path string, params map[string]string) (callDetail CallDetail, body []byte, err error)

func (Client) VerifyDepositAddress

func (c Client) VerifyDepositAddress(coin string, address string) (CallDetail, RespNewAddresses, error)

func (Client) VerifyEcc

func (c Client) VerifyEcc(message string, signature string) bool

func (Client) VerifyValidAddress

func (c Client) VerifyValidAddress(coin string, addresses string) (CallDetail, RespIsValidAddress, error)

type Coin

type Coin struct {
	Coin        string `json:"coin"`
	DisplayCode string `json:"display_code"`
	Description string `json:"description"`
	Decimal     int    `json:"decimal"`
	CanDeposit  bool   `json:"can_deposit"`
	CanWithdraw bool   `json:"can_withdraw"`
	RequireMemo bool   `json:"require_memo"`
}

type CoinInfo

type CoinInfo struct {
	Coin                string `json:"coin"`
	DisplayCode         string `json:"display_code"`
	Description         string `json:"description"`
	Decimal             int    `json:"decimal"`
	CanDeposit          bool   `json:"can_deposit"`
	CanWithdraw         bool   `json:"can_withdraw"`
	RequireMemo         bool   `json:"require_memo"`
	Balance             string `json:"balance"`
	AbsBalance          string `json:"abs_balance"`
	FeeCoin             string `json:"fee_coin"`
	AbsEstimateFee      string `json:"abs_estimate_fee"`
	ConfirmingThreshold int    `json:"confirming_threshold"`
	DustThreshold       int    `json:"dust_threshold"`
	TokenAddress        string `json:"token_address"`
}

type Config

type Config struct {
	CoboId      string
	TxId        string
	WithdrawId  string
	DeAddress   map[string]string
	DeAddresses map[string]string
	LpAddress   map[string]string
	LpAddresses map[string]string
	Withdraw    map[string]string
}

func ProdConfig

func ProdConfig() Config

func SandboxConfig

func SandboxConfig() Config

type Env

type Env struct {
	Host    string
	CoboPub string
}

func Prod

func Prod() Env

func Sandbox

func Sandbox() Env

type LocalSigner

type LocalSigner struct {
	PrivateKey string
}

func (LocalSigner) GetPublicKey

func (signer LocalSigner) GetPublicKey() string

func (LocalSigner) Sign

func (signer LocalSigner) Sign(message string) string

type OrgInfo

type OrgInfo struct {
	Name   string  `json:"name"`
	Assets []Asset `json:"assets"`
}

type RequestInfo added in v0.0.2

type RequestInfo struct {
	Method string
	Url    string
	Body   string
	Header http.Header
}

type RespAddressHistory

type RespAddressHistory struct {
	ApiError
	Success bool          `json:"success"`
	Result  []AddressInfo `json:"result"`
}

type RespAddressInfo

type RespAddressInfo struct {
	ApiError
	Success bool        `json:"success"`
	Result  AddressInfo `json:"result"`
}

type RespAddressesInfo

type RespAddressesInfo struct {
	ApiError
	Success bool          `json:"success"`
	Result  AddressesInfo `json:"result"`
}

type RespCoinInfo

type RespCoinInfo struct {
	ApiError
	Success bool     `json:"success"`
	Result  CoinInfo `json:"result"`
}

type RespInfo added in v0.0.3

type RespInfo struct {
	Header http.Header
	Body   string
}

type RespIsValidAddress

type RespIsValidAddress struct {
	ApiError
	Success bool `json:"success"`
	Result  bool `json:"result"`
}

type RespNewAddress

type RespNewAddress struct {
	ApiError
	Success bool        `json:"success"`
	Result  AddressInfo `json:"result"`
}

type RespNewAddresses

type RespNewAddresses struct {
	ApiError
	Success bool          `json:"success"`
	Result  AddressesInfo `json:"result"`
}

type RespOrgInfo

type RespOrgInfo struct {
	ApiError
	Success bool    `json:"success"`
	Result  OrgInfo `json:"result"`
}

type RespSupportedCoins

type RespSupportedCoins struct {
	ApiError
	Success bool   `json:"success"`
	Result  []Coin `json:"result"`
}

type RespTransaction

type RespTransaction struct {
	ApiError
	Success bool        `json:"success"`
	Result  Transaction `json:"result"`
}

type RespTransactions

type RespTransactions struct {
	ApiError
	Success bool          `json:"success"`
	Result  []Transaction `json:"result"`
}

type Transaction

type Transaction struct {
	ID                  string          `json:"id"`
	Coin                string          `json:"coin"`
	DisplayCode         string          `json:"display_code"`
	Description         string          `json:"description"`
	Decimal             int             `json:"decimal"`
	Address             string          `json:"address"`
	SourceAddress       string          `json:"source_address"`
	Side                string          `json:"side"`
	Amount              decimal.Decimal `json:"amount"`
	AbsAmount           decimal.Decimal `json:"abs_amount"`
	Txid                string          `json:"txid"`
	VoutN               int             `json:"vout_n"`
	RequestID           string          `json:"request_id"`
	Status              string          `json:"status"`
	AbsCoboFee          decimal.Decimal `json:"abs_cobo_fee"`
	CreatedTimestamp    int64           `json:"created_time"`
	CreatedTime         time.Time       `json:"-"`
	LastTimestamp       int64           `json:"last_time"`
	LastTime            time.Time       `json:"-"`
	ConfirmedNum        int             `json:"confirmed_num"`
	TxDetail            TxDetail        `json:"tx_detail"`
	SourceAddressDetail string          `json:"source_address_detail"`
	Memo                string          `json:"memo"`
	ConfirmingThreshold int             `json:"confirming_threshold"`
	FeeCoin             string          `json:"fee_coin"`
	FeeAmount           int             `json:"fee_amount"`
	FeeDecimal          int             `json:"fee_decimal"`
	Fee                 decimal.Decimal `json:"-"`
	Type                string          `json:"type"`
}

type TxDetail

type TxDetail struct {
	Txid      string `json:"txid"`
	Blocknum  int    `json:"blocknum"`
	Blockhash string `json:"blockhash"`
	Fee       int    `json:"fee"`
	Actualgas int    `json:"actualgas"`
	Gasprice  int    `json:"gasprice"`
	Hexstr    string `json:"hexstr"`
}

Jump to

Keyboard shortcuts

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