utils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AsciiPicure = `` /* 984-byte string literal not displayed */
View Source
var Bold = color.New(color.Bold).SprintFunc()
View Source
var BoldGreen = color.New(color.FgGreen, color.Bold).SprintFunc()
View Source
var BoldRed = color.New(color.FgRed, color.Bold).SprintFunc()
View Source
var BoldYellow = color.New(color.FgYellow, color.Bold).SprintFunc()
View Source
var FgWhiteBgBlue = color.New(color.FgWhite, color.BgBlue).SprintFunc()
View Source
var FgWhiteBgGreen = color.New(color.FgWhite, color.BgGreen).SprintFunc()
View Source
var FgWhiteBgRed = color.New(color.FgWhite, color.BgRed).SprintFunc()
View Source
var FgWhiteBgYellow = color.New(color.FgWhite, color.BgYellow).SprintFunc()

Functions

func BroadcastTx

func BroadcastTx(url string, signTx interface{}) (string, error)

func DataTimeToTimestamp

func DataTimeToTimestamp(dataTime string) (int64, error)

func GetAddressBalance

func GetAddressBalance(url, address, assetId string) (*big.Int, error)

func GetChainId

func GetChainId(url string) (string, error)

func GetRefBlockInfo

func GetRefBlockInfo(url string) (uint16, uint32, error)

func GetWaitCrosschainInfo added in v0.1.5

func GetWaitCrosschainInfo(url string, trxType int) (rsp *[]WithdrawOp, err error)

func ReverseBytesInPlace

func ReverseBytesInPlace(input []byte)

func Uint64Supply

func Uint64Supply(supply interface{}) (uint64, error)

func X17_Byte_Sum256 added in v0.1.2

func X17_Byte_Sum256(input []byte) []byte

func X17_Sum256 added in v0.1.2

func X17_Sum256(input string) []byte

Types

type AddressBalanceResult

type AddressBalanceResult struct {
	Amount  interface{} `json:"amount"`
	AssetId string      `json:"asset_id"`
}

type AddressBalanceRsp

type AddressBalanceRsp struct {
	Id     int                    `json:"id"`
	Result []AddressBalanceResult `json:"result"`
	Error  interface{}            `json:"error"`
}

type AddressMintInfoResult

type AddressMintInfoResult struct {
	Amount    uint64 `json:"amount"`
	Time      string `json:"time"`
	MintCount uint64 `json:"mint_count"`
}

type AddressMintInfoRsp

type AddressMintInfoRsp struct {
	Id     int                   `json:"id"`
	Result AddressMintInfoResult `json:"result"`
	Error  interface{}           `json:"error"`
}

func GetAddressMintInfo

func GetAddressMintInfo(url string, addr, assetName string) (rsp *AddressMintInfoRsp, err error)

type AssetInfoResult

type AssetInfoResult struct {
	Id         string `json:"id"`
	Symbol     string `json:"symbol"`
	Precision  int64  `json:"precision"`
	Issuer     string `json:"issuer"`
	CreateAddr string `json:"create_addr"`
	Options    struct {
		MaxSupply         interface{} `json:"max_supply"`
		MaxPerMint        interface{} `json:"max_per_mint"`
		CreateTime        string      `json:"create_time"`
		Brc20Token        bool        `json:"brc20_token"`
		MintInterval      int64       `json:"mint_interval"`
		MaxMintCountLimit interface{} `json:"max_mint_count_limit"`
		MarketFeePercent  int64       `json:"market_fee_percent"`
		MaxMarketFee      interface{} `json:"max_market_fee"`
		IssuerPermissions int64       `json:"issuer_permissions"`
		Flags             int64       `json:"flags"`
	} `json:"options"`
	DynamicData struct {
		CurrentSupply interface{} `json:"current_supply"`
		CurrentNBits  uint32      `json:"current_nBits"`
	} `json:"dynamic_data"`
}

type AssetInfoRsp

type AssetInfoRsp struct {
	Id     int             `json:"id"`
	Result AssetInfoResult `json:"result"`
	Error  interface{}     `json:"error"`
}

func GetAssetInfo

func GetAssetInfo(url string, assetName string) (rsp *AssetInfoRsp, err error)

type BindingAccountResult

type BindingAccountResult struct {
	Id          string `json:"id"`
	Owner       string `json:"owner"`
	ChainType   string `json:"chain_type"`
	BindAccount string `json:"bind_account"`
}

func GetBindingAccount

func GetBindingAccount(url string, addr string, asset string) ([]BindingAccountResult, error)

type BindingAccountRsp

type BindingAccountRsp struct {
	Id     int                    `json:"id"`
	Result []BindingAccountResult `json:"result"`
	Error  interface{}            `json:"error"`
}

type BroadcastTxRsp

type BroadcastTxRsp struct {
	Id     int         `json:"id"`
	Result string      `json:"result"`
	Error  interface{} `json:"error"`
}

type DepositAddressResult

type DepositAddressResult struct {
	Id                string `json:"id"`
	ChainType         string `json:"chain_type"`
	BindAccountHot    string `json:"bind_account_hot"`
	RedeemScriptHot   string `json:"redeemScript_hot"`
	BindAccountCold   string `json:"bind_account_cold"`
	RedeemScriptCold  string `json:"redeemScript_cold"`
	EffectiveBlockNum int    `json:"effective_block_num"`
	EndBlock          int64  `json:"end_block"`
}

func GetDepositAddress

func GetDepositAddress(url string, asset string) (*DepositAddressResult, error)

type DepositAddressRsp

type DepositAddressRsp struct {
	Id     int                  `json:"id"`
	Result DepositAddressResult `json:"result"`
	Error  interface{}          `json:"error"`
}

type HttpClient

type HttpClient struct {
	Timeout int64
}

func (HttpClient) HttpPost

func (h HttpClient) HttpPost(url string, rpcReq RpcReq) ([]byte, error)

type InfoResult

type InfoResult struct {
	ChainId string `json:"chain_id"`
}

type InfoRsp

type InfoRsp struct {
	Id     int         `json:"id"`
	Result InfoResult  `json:"result"`
	Error  interface{} `json:"error"`
}

type RefBlockInfoRsp

type RefBlockInfoRsp struct {
	Id     int         `json:"id"`
	Result string      `json:"result"`
	Error  interface{} `json:"error"`
}

type RpcReq

type RpcReq struct {
	Id     int           `json:"id"`
	Method string        `json:"method"`
	Params []interface{} `json:"params"`
}

type RpcResp

type RpcResp struct {
	Id      int    `json:"id"`
	JsonRpc string `json:"jsonrpc"`
	Result  string `json:"result"`
}

type WithdrawAllData added in v0.1.5

type WithdrawAllData struct {
	Result [][]interface{} `json:"result"`
}

type WithdrawOp added in v0.1.5

type WithdrawOp struct {
	Fee struct {
		Amount  int    `json:"amount"`
		AssetId string `json:"asset_id"`
	} `json:"fee"`
	WithdrawAccount   string `json:"withdraw_account"`
	Amount            string `json:"amount"`
	AssetSymbol       string `json:"asset_symbol"`
	AssetId           string `json:"asset_id"`
	CrosschainAccount string `json:"crosschain_account"`
	Memo              string `json:"memo"`
}

type WithdrawTransaction added in v0.1.5

type WithdrawTransaction struct {
	RefBlockNum    interface{}     `json:"ref_block_num"`
	RefBlockPrefix interface{}     `json:"ref_block_prefix"`
	Expiration     string          `json:"expiration"`
	Operations     [][]interface{} `json:"operations"`
	Extensions     []interface{}   `json:"extensions"`
	Nonce          int             `json:"nonce"`
	Signatures     []string        `json:"signatures"`
}

Jump to

Keyboard shortcuts

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