utils

package
v0.0.0-...-9414cfa Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const BUY = "buy"
View Source
const LIMIT = "limit"
View Source
const MARKET = "market"
View Source
const ORDER_CLOSE = "close"
View Source
const ORDER_OPEN = "open"
View Source
const SELL = "sell"

Variables

View Source
var EmptyKeyPairList = []KeyPair{}
View Source
var HttpClient *http.Client

Functions

func Delete

func Delete(url string, requestBody string, params []KeyPair, headers []KeyPair) (string, error)

func ExtendAddressTo256bit

func ExtendAddressTo256bit(address string) string

func Get

func Get(url string, requestBody string, params []KeyPair, headers []KeyPair) (string, error)

func JoinUrlPath

func JoinUrlPath(baseUrl string, subPath string) string

func ParseHexToBigint

func ParseHexToBigint(hex string) *big.Int

func ParseHexToDecimal

func ParseHexToDecimal(hex string, exp int32) *decimal.Decimal

func Post

func Post(url string, requestBody string, params []KeyPair, headers []KeyPair) (string, error)

func PrivateKeyToAddress

func PrivateKeyToAddress(privateKey string) string

func SetDecimal

func SetDecimal(d decimal.Decimal, decimalNum int) decimal.Decimal

func SetPrecision

func SetPrecision(d decimal.Decimal, precision int) decimal.Decimal

func SignOrderId

func SignOrderId(privateKey string, orderId string) string

func SignString

func SignString(privateKey string, msg string) string

func Stripe0xPrefix

func Stripe0xPrefix(str string) string

func ToggleSide

func ToggleSide(side string) string

func Web3Call

func Web3Call(url string, contractAddress string, data string) (string, error)

Types

type ERC20

type ERC20 struct {
	Symbol      string
	Address     string
	Decimal     int
	Initialized bool
}

func (*ERC20) GetBalance

func (erc *ERC20) GetBalance(web3url string, address string) (balance *decimal.Decimal, rawBalance *decimal.Decimal, err error)

type EthereumLog

type EthereumLog struct {
	Address          string   `json:"address"`
	BlockHash        string   `json:"blockHash"`
	BlockNumber      string   `json:"blockNumber"`
	Data             string   `json:"data"`
	LogIndex         string   `json:"logIndex"`
	Removed          bool     `json:"removed"`
	Topics           []string `json:"topics"`
	TransactionHash  string   `json:"transactionHash"`
	TransactionIndex string   `json:"transactionIndex"`
}

type EthereumReceipt

type EthereumReceipt struct {
	BlockHash         string        `json:"blockHash"`
	BlockNumber       string        `json:"blockNumber"`
	ContractAddress   interface{}   `json:"contractAddress"`
	CumulativeGasUsed string        `json:"cumulativeGasUsed"`
	From              string        `json:"from"`
	GasUsed           string        `json:"gasUsed"`
	Logs              []EthereumLog `json:"logs"`
	LogsBloom         string        `json:"logsBloom"`
	Status            string        `json:"status"`
	To                string        `json:"to"`
	TransactionHash   string        `json:"transactionHash"`
	TransactionIndex  string        `json:"transactionIndex"`
}

type IJsonRpcBlockInfo

type IJsonRpcBlockInfo struct {
	ID     int `json:"id"`
	Result struct {
		Difficulty       string   `json:"difficulty"`
		ExtraData        string   `json:"extraData"`
		GasLimit         string   `json:"gasLimit"`
		GasUsed          string   `json:"gasUsed"`
		Hash             string   `json:"hash"`
		LogsBloom        string   `json:"logsBloom"`
		Miner            string   `json:"miner"`
		MixHash          string   `json:"mixHash"`
		Nonce            string   `json:"nonce"`
		Number           string   `json:"number"`
		ParentHash       string   `json:"parentHash"`
		ReceiptsRoot     string   `json:"receiptsRoot"`
		Sha3Uncles       string   `json:"sha3Uncles"`
		Size             string   `json:"size"`
		StateRoot        string   `json:"stateRoot"`
		Timestamp        string   `json:"timestamp"`
		TotalDifficulty  string   `json:"totalDifficulty"`
		Transactions     []string `json:"transactions"`
		TransactionsRoot string   `json:"transactionsRoot"`
		Uncles           []string `json:"uncles"`
	} `json:"result"`
}

type IJsonRpcResLogs

type IJsonRpcResLogs struct {
	Result []EthereumLog `json:"result"`
}

type IJsonRpcResReceipt

type IJsonRpcResReceipt struct {
	Result EthereumReceipt `json:"result"`
}

type IJsonRpcResString

type IJsonRpcResString struct {
	Result string `json:"result"`
}

type KeyPair

type KeyPair struct {
	Key   string
	Value string
}

type NodeBlockNum

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

Jump to

Keyboard shortcuts

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