sagoutil

package
v0.0.0-...-d2e3322 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: MIT Imports: 23 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Log ...
	Log *log.Logger
	// ShrliLogFile stores the stdout/stderr output log
	ShrliLogFile = "./shurli.log"
)
View Source
var DexP2pChain string = "SHURLI0"

DexP2pChain which shurli queries for DEXP2P API

Functions

func BackupConfigJSON

func BackupConfigJSON(confPath string)

BackupConfigJSON take backup of existing config.json file and store it with filename + timestamp

func BackupWallet

func BackupWallet()

BackupWallet allows taking a dump or backup of the wallet.dat file

func BackupWalletJSON

func BackupWalletJSON(confPath string)

BackupWalletJSON take backup of existing wallet.json file and store it with filename + timestamp

func DLSubJSONData

func DLSubJSONData() error

DLSubJSONData downloads the latest updated subatomic.json file data and saves it to "assets/subatomic.json" file in subatomicgo app

func DlBootstrap

func DlBootstrap()

DlBootstrap download, extract and replace/update bootstrap blockchain files for a specified wallet

func GenerateDEXP2PAccount

func GenerateDEXP2PAccount() error

GenerateDEXP2PAccount generate the transaparent address and shielded address

func GenerateDEXP2PWallet

func GenerateDEXP2PWallet() (kmdutil.IguanaWallet, error)

GenerateDEXP2PWallet ...

func GetFreePort

func GetFreePort() (int, error)

GetFreePort asks the kernel for a free open port that is ready to use.

func GetFreePorts

func GetFreePorts(count int) ([]int, error)

GetFreePorts asks the kernel for free open ports that are ready to use.

func GetHandle

func GetHandle(pubkey string) (string, string, bool)

GetHandle returns Handle, Public Key and Authorized status of that pubkey

func ImportTAddrPrivKey

func ImportTAddrPrivKey(toChain string) error

ImportTAddrPrivKey import private key of DEXP2P transparent address to specified wallet

func ImportZAddrPrivKey

func ImportZAddrPrivKey(toChain string) error

ImportZAddrPrivKey import private key of DEXP2P shielded address to specified wallet

func IntToString

func IntToString(n int32) string

IntToString Converts Int value to string

func IsLower

func IsLower(s string) bool

IsLower returns true if supplied string is lower case, false if upper case

func MatchedAuthorized

func MatchedAuthorized(pubkey string) (bool, error)

MatchedAuthorized checks the pubkey against the subatomic.json file's authorized pubkey list. If the searched pubkey is present in that list, it returns true, otherwise false.

func ShurliRootDir

func ShurliRootDir() string

ShurliRootDir returns Shurli root directory path

func ShurliStartMsg

func ShurliStartMsg()

ShurliStartMsg printing message at start

func StartWallet

func StartWallet(chain string, cmdParams []string) error

StartWallet launches Komodo-Ocean-QT with the specified Wallet

func StrToAppType

func StrToAppType(chain []ConfigCoins) []kmdgo.AppType

StrToAppType converts and returns slice of string as slice of kmdgo.AppType

func SwapLogFilter

func SwapLogFilter(logString, answer string) (string, error)

SwapLogFilter returns JSON processed data for submitted log string

func TxIDFromOpID

func TxIDFromOpID(coin, opid string) (string, error)

TxIDFromOpID returns TxID for provided opid and coin

func UpdateDEXP2PAccount

func UpdateDEXP2PAccount(data SubAtomicConfig) error

UpdateDEXP2PAccount allow users to update config.json file with user specified DEXP2P params details

Types

type ConfigChains

type ConfigChains struct {
	Chains    []ConfigCoins     `json:"chains"`
	Explorers map[string]string `json:"explorers"`
}

ConfigChains holds the list of chains and it's other details like explorers links etc.

type ConfigCoins

type ConfigCoins struct {
	Coin     string `json:"coin"`
	Ticker   string `json:"ticker"`
	Name     string `json:"name"`
	Shielded bool   `json:"shielded"`
}

ConfigCoins type holds the values of coin information

func GetCoinConfInfo

func GetCoinConfInfo(coin string) ConfigCoins

GetCoinConfInfo returns single coin info from config.json cofiguration list

type DEXHandle

type DEXHandle struct {
	Pubkey     string
	Handle     string
	DEXPubkey  string
	Authorised bool
}

DEXHandle stores data to get authorised/unauthorised hanldes from all broadcasting traders

func DEXHandles

func DEXHandles() []DEXHandle

DEXHandles returns public address's public Key, DEX CC specific public key, and handle data set picked from: - DEX_list handles API - subatomic.json file taken from the source code of komodo code The purpose of this function is to return the data about authorised and unauthorised handles and show that in orderbook or orderlist in the GUI application.

type OrderData

type OrderData struct {
	Price        string  `json:"price"`
	MaxVolume    string  `json:"max_volume"`
	DexPubkey    string  `json:"dex_pubkey"`
	Base         string  `json:"base"`
	ZBase        bool    `json:"zbase"`
	Rel          string  `json:"rel"`
	ZRel         bool    `json:"zrel"`
	OrderID      int64   `json:"orderid"`
	TimestampStr string  `json:"timestampstr"`
	Timestamp    string  `json:"timestamp"`
	Handle       string  `json:"handle"`
	Pubkey       string  `json:"pubkey"`
	Authorized   bool    `json:"authorized"`
	BaseBal      float64 `json:"basebal"`
	ZBaseBal     float64 `json:"zbasebal"`
	RelBal       float64 `json:"relbal"`
	ZRelBal      float64 `json:"zrelbal"`
	BaseIcon     string  `json:"baseicon"`
	RelIcon      string  `json:"relicon"`
}

OrderData type is used to get formated data to display on Orderbook page

func OrderBookList

func OrderBookList(base, rel, maxentries, sortby string) []OrderData

OrderBookList returns processed data for Orderbook page

func OrderID

func OrderID(id string) OrderData

OrderID returns data to display on orderbook/{orderid} page

type SubAtomicConfig

type SubAtomicConfig struct {
	Chains       []ConfigCoins     `json:"chains,omitempty"`
	SubatomicExe string            `json:"subatomic_exe"`
	SubatomicDir string            `json:"subatomic_dir"`
	DexNSPV      string            `json:"dex_nSPV"`
	DexAddnode   string            `json:"dex_addnode"`
	DexPubkey    string            `json:"dex_pubkey"`
	DexHandle    string            `json:"dex_handle"`
	DexRecvZAddr string            `json:"dex_recvzaddr"`
	DexRecvTAddr string            `json:"dex_recvtaddr"`
	Explorers    map[string]string `json:"explorers,omitempty"`
}

SubAtomicConfig holds the app's confugration settings

func SubAtomicConfInfo

func SubAtomicConfInfo() SubAtomicConfig

SubAtomicConfInfo returns application's config params

type SwapHistory

type SwapHistory struct {
	SwapID           string       `json:"swapid"`
	TimeStamp        string       `json:"timestamp"`
	Base             string       `json:"base"`
	Rel              string       `json:"rel"`
	BaseAmount       float64      `json:"baseamount"`
	RelAmount        float64      `json:"relamount"`
	BaseTxID         string       `json:"basetxid"`
	RelTxID          string       `json:"reltxid"`
	Status           string       `json:"status"`
	BobID            string       `json:"bobid"`
	BobPubkey        string       `json:"bobpubkey"`
	BobAuthorized    bool         `json:"bobauthorized"`
	OrderIDTimeStamp string       `json:"orderidtimestamp"`
	OrderPrice       float64      `json:"orderprice"`
	OrderMaxVolume   float64      `json:"ordermaxvolume"`
	BaseIcon         string       `json:"baseicon"`
	RelIcon          string       `json:"relicon"`
	BaseExplorer     string       `json:"baseexplorer"`
	RelExplorer      string       `json:"relexplorer"`
	ZBase            bool         `json:"zbase"`
	ZRel             bool         `json:"zrel"`
	SwapLog          []SwapStatus `json:"swaplog,omitempty"`
}

SwapHistory type stores the single object from Swaps logs history

type SwapStatus

type SwapStatus struct {
	State        string  `json:"state,omitempty"`
	StateID      string  `json:"state_id,omitempty"`
	Status       string  `json:"status,omitempty"`
	StateHash    string  `json:"state_hash,omitempty"`
	BaseTxID     string  `json:"base_txid,omitempty"`
	RelTxID      string  `json:"rel_txid,omitempty"`
	SwapID       string  `json:"swap_id,omitempty"`
	SendToAddr   string  `json:"sendtoaddr,omitempty"`
	RecvAddr     string  `json:"recvaddr,omitempty"`
	Base         string  `json:"base,omitempty"`
	Rel          string  `json:"rel,omitempty"`
	BaseAmount   float64 `json:"base_amount,omitempty"`
	RelAmount    float64 `json:"rel_amount,omitempty"`
	SwapFullData string  `json:"swap_full_data,omitempty"`
}

SwapStatus defines the data type to store filtered data and push to application in JSON format for UI side rendering.

type SwapsHistory

type SwapsHistory []SwapHistory

SwapsHistory type is used as collection of SwapHistory objects

func (SwapsHistory) SwapsHistory

func (history SwapsHistory) SwapsHistory() (SwapsHistory, error)

SwapsHistory returns processed slice of swaplogs in JSON format

type WInfo

type WInfo struct {
	Name       string
	Ticker     string
	Icon       string
	Status     string
	Balance    float64
	ZBalance   float64
	Blocks     int
	Synced     bool
	Shielded   bool
	TValidAddr bool
	ZValidAddr bool
}

WInfo type stores data to display on Wallet info screen

func WalletInfo

func WalletInfo(chains []kmdgo.AppType) []WInfo

WalletInfo method returns processed data to display on Dashboard

type ZFrom

type ZFrom []struct {
	Address string  `json:"address,omitempty"`
	Amount  float64 `json:"amount,omitempty"`
	Memo    string  `json:"memo,omitempty"`
}

ZFrom to render the JSON data from "from." log entery coming from subatomic stdout

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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