kcckit

package module
v0.0.0-...-b285c8e Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 10 Imported by: 0

README

KCC Kit

Install

go get github.com/mhxw/kcc-kit

Usage

s, err := kcckit.NewAppService(
    //services.AppChainIdOption(testChainId),
    //services.AppRpcUriOption(testRpc),
    services.AppChainIdOption(mainChainId),
    services.AppRpcUriOption(mainRpc),
    services.AppKeyOption(key),
    services.AppGasPriceOption(gasPrice),
    services.AppGasPriceMultiOption(gasPriceMultipoint),
)
if err != nil {
    return
}

Faucet

  • Mainnet

https://faucet.kcc.io

  • Testnet

https://faucet-testnet.kcc.network

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ChainId            *big.Int
	GasPriceMultiPoint float64
	GasPrice           int64
)

Functions

This section is empty.

Types

type AppService

type AppService struct {
	ChainId string

	Info *Config
	// contains filtered or unexported fields
}

An AppService provides an HTTP client and a signer to make a HTTP request with the signature to KuCoin API.

func NewAppService

func NewAppService(opts ...AppServiceOption) (*AppService, error)

func (*AppService) GetNativeBalance

func (as *AppService) GetNativeBalance(userAddr string) (*big.Int, error)

func (*AppService) SpiltTx

func (as *AppService) SpiltTx(txHash string) string

func (*AppService) TransferNativeBalance

func (as *AppService) TransferNativeBalance(toAddr string, amount *big.Int) (string, error)

type AppServiceOption

type AppServiceOption func(service *AppService)

An AppServiceOption is an option parameter to create the instance of AppService.

func AppChainIdOption

func AppChainIdOption(chainId string) AppServiceOption

AppChainIdOption creates an instance of ApiServiceOption about chainId.

func AppGasPriceMultiOption

func AppGasPriceMultiOption(gasPriceMulti float64) AppServiceOption

AppGasPriceMultiOption creates an instance of ApiServiceOption about gas price multipoint.

func AppGasPriceOption

func AppGasPriceOption(gasPrice int64) AppServiceOption

AppGasPriceOption creates an instance of ApiServiceOption about gas price.

func AppKeyOption

func AppKeyOption(key string) AppServiceOption

AppKeyOption creates an instance of ApiServiceOption about key.

func AppRpcUriOption

func AppRpcUriOption(rpcUri string) AppServiceOption

AppRpcUriOption creates an instance of ApiServiceOption about rpc uri.

type Chain

type Chain struct {
	Network    string
	ChainId    int64
	TXUrl      string
	RPCUrl     string
	WSUrl      string
	Multicall  string
	Multicall2 string
}

type Config

type Config struct {
	Token         Token
	Mojito        Mojito
	Torches       Torches
	Chain         Chain
	Witnet        Witnet
	TorchesOralce TorchesOralce
	MojitoOracle  MojitoOracle
}

func GetConfigForKCC

func GetConfigForKCC() *Config

func GetConfigForKCCTestnet

func GetConfigForKCCTestnet() *Config

type EACAndOCR

type EACAndOCR struct {
	EAC string
	OCR string
}

type Lp

type Lp struct {
	LpMJTUSDT  string
	LpMJTUSDC  string
	LpUSDTUSDC string
	LpWKCSMJT  string
	LpWKCSUSDC string
	LpWKCSUSDT string
}

type LpPid

type LpPid struct {
	LpMJTUSDTPid  int64
	LpMJTUSDCPid  int64
	LpUSDTUSDCPid int64
}

type Mojito

type Mojito struct {
	MojitoFactory    string
	Masterchef       string
	MasterchefV2     string
	MojitoRouter     string
	SwapMiningAddr   string
	MojitoOracle     string
	LP               Lp
	LpPid            LpPid
	Path             Path
	EIP712DomainHash string
	PermitTypeHash   string
}

type MojitoOracle

type MojitoOracle struct {
	MojitoOracleAddr string
	MOProxyAddr      string
	BtcUsdtPairId    string
	EthUsdtPairId    string
	KcsUsdtPairId    string
	MjtUsdtPairId    string
	UsdcUsdtPairId   string
}

type NetworkParams

type NetworkParams struct {
	ChainName       string
	ChainID         int
	RpcUri          string
	WebSocketRpcUri string
	ExplorerUri     string
}

type Path

type Path struct {
	PathUsdcUsdt []common.Address
	PathUsdtUsdc []common.Address
	PathUsdtMjt  []common.Address
	PathMjtUsdt  []common.Address
	PathUsdtChe  []common.Address
	PathCheUsdt  []common.Address
}

type TToken

type TToken struct {
	TKCS  string
	TUSDT string
	TUSDC string
	TBTC  string
	TETH  string
	TSKCS string
}

type Token

type Token struct {
	BTCAddress   string
	ETHAddress   string
	SKCSAddress  string
	WKCSAddress  string
	WOKTAddress  string
	OKBAddress   string
	USDTAddress  string
	USDCAddress  string
	MJTAddress   string
	CHEAddress   string
	APEAddress   string
	MULTIAddress string
	SAXAddress   string
	SANDAddress  string
	MANAAddress  string
	MLSAddress   string
	AAVEAddress  string
	CRVAddress   string
	UNIAddress   string
	CFXAddress   string
	LINKAddress  string
}

type Torches

type Torches struct {
	TorchesTroller string
	CompoundLens   string
	TToken         TToken
}

type TorchesOralce

type TorchesOralce struct {
	BtcUsd  EACAndOCR
	EthUsd  EACAndOCR
	KcsUsd  EACAndOCR
	MjtUsd  EACAndOCR
	UsdtUsd EACAndOCR
	UsdcUsd EACAndOCR
}

type Witnet

type Witnet struct {
	WitnetPriceRouter string
	BtcUsdPairId      string
	EthUsdPairId      string
	KcsUsdtPairId     string
	MjtKcsPairId      string
	UsdtUsdPairId     string
	UsdcUsdPairId     string
}

Jump to

Keyboard shortcuts

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