rpc

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 25 Imported by: 13

Documentation

Index

Constants

View Source
const (
	NameSCID   = "0000000000000000000000000000000000000000000000000000000000000001"
	RatingSCID = "c66a11ddb22912e92b0a7ab777ed0d343632d9e3c6e8a81452396ca84d2decb6"
	DreamsSCID = "ad2e7b37c380cc1aed3a6b27224ddfc92a2d15962ca1f4d35e530dba0f9575a9"
	HgcSCID    = "e2e45ce26f70cb551951c855e81a12fee0bb6ebe80ef115c3f50f51e119c02f3"
	// TourneySCID = "c2e1ec16aed6f653aef99a06826b2b6f633349807d01fbb74cc0afb5ff99c3c7"
	// HolderoSCID  = "e3f37573de94560e126a9020c0a5b3dfc7a4f3a4fbbe369fba93fbd219dc5fe9"
	// pHolderoSCID = "896834d57628d3a65076d3f4d84ddc7c5daf3e86b66a47f018abda6068afe2e6"
	// HHolderoSCID = "efe646c48977fd776fee73cdd3df147a2668d3b7d965cdb7a187dda4d23005d8"
	BaccSCID = "8289c6109f41cbe1f6d5f27a419db537bf3bf30a25eff285241a36e1ae3e48a4"
	// PredictSCID  = "eaa62b220fa1c411785f43c0c08ec59c761261cb58a0ccedc5b358e5ed2d2c95"
	// PPredictSCID = "e5e49c9a6dc1c0dc8a94429a01bf758e705de49487cbd0b3e3550648d2460cdf"
	// SportsSCID   = "ad11377c29a863523c1cc50a33ca13e861cc146a7c0496da58deaa1973e0a39f"
	// PSportsSCID  = "fffdc4ea6d157880841feab335ab4755edcde4e60fec2fff661009b16f44fa94"
	TarotSCID  = "a6fc0033327073dd54e448192af929466596fce4d689302e558bc85ea8734a82"
	DerBnbSCID = "cfbd566d3678dec6e6dfa3a919feae5306ab12af1485e8bcf9320bd5a122b1d3"
	TrvlSCID   = "efacf71e7b5f849653bfa49bfb9dcf7ad3d372944aef33f1e6f54dc95890e3ba"
	GnomonSCID = "a05395bb0cf77adc850928b0db00eb5ca7a9ccbafd9a38d021c8d299ad5ce1a4"
	DevAddress = "dero1qyr8yjnu6cl2c5yqkls0hmxe6rry77kn24nmc5fje6hm9jltyvdd5qq4hn5pn"
	ArtAddress = "dero1qy0khp9s9yw2h0eu20xmy9lth3zp5cacmx3rwt6k45l568d2mmcf6qgcsevzx"

	DAEMON_RPC_DEFAULT = "127.0.0.1:10102"
	DAEMON_RPC_REMOTE1 = "89.38.99.117:10102"
	DAEMON_RPC_REMOTE2 = "publicrpc1.dero.io:10102"
	DAEMON_RPC_REMOTE3 = "dero-node.mysrv.cloud:10102"
	DAEMON_RPC_REMOTE4 = "derostats.io:10102"
	DAEMON_RPC_REMOTE5 = "85.17.52.28:11012"
	DAEMON_RPC_REMOTE6 = "node.derofoundation.org:11012"
)

Variables

View Source
var Daemon daemon
View Source
var HighLimitFee = uint64(10000)
View Source
var IlumaFee = uint64(9000)
View Source
var ListingFee = uint64(10000)
View Source
var LowLimitFee = uint64(1320)
View Source
var MintingFee = uint64(500)
View Source
var SCIDs map[string]string
View Source
var Startup bool
View Source
var UnlockFee = uint64(300000)
View Source
var Wallet wallet

Functions

func AddOne

func AddOne(v interface{}) string

Returns value plus one as string

func BidBuyNFA

func BidBuyNFA(scid, bidor string, amt uint64) (tx string)

Send bid or buy to NFA SC

  • bidor defines bid or buy call

func CancelCloseNFA

func CancelCloseNFA(scid string, close bool) (tx string)

Cancel or close a listed NFA. Can only be canceled within opening buffer period. Can only close listing after expiry

  • close true to close a listing and false to cancel

func CheckForIndex

func CheckForIndex(scid string) interface{}

Check Gnomon SC for stored contract owner

func ClaimNFA

func ClaimNFA(scid string) (tx string)

Claim transferred NFA token

func ConfirmTx

func ConfirmTx(txid, tag string, timeout int) bool

Watch a sent tx and return true if tx is confirmed

  • tag for log print
  • timeout is duration of loop in 2sec increment, will break if reached

func ConfirmTxRetry

func ConfirmTxRetry(txid, tag string, timeout int) (retry int)

Watch a sent tx with int return for retry count, failed tx returns 1, timeout returns 2

  • tag for log print
  • timeout is duration of loop in 2sec increment, will break if reached

func DaemonHeight

func DaemonHeight(tag, ep string) uint64

Get a daemons height

func DaemonVersion

func DaemonVersion() (version string)

Get a daemons version

func DeroAddressFromKey

func DeroAddressFromKey(v interface{}) (address string)

Get Dero address from keys

func DisplayBalance

func DisplayBalance(name string) string

Return Display.Balance string of name

func EchoWallet

func EchoWallet(tag string)

Echo Dero wallet for connection

  • tag for log print

func Float64Type

func Float64Type(v interface{}) (value float64)

Switch to convert interface to float64

func FromAtomic

func FromAtomic(v interface{}, precision int) string

Returns atomic string value of v rounded to precision, walletapi.FormatMoneyPrecision()

func GasEstimate

func GasEstimate(scid, tag string, args rpc.Arguments, t []rpc.Transfer, max uint64) uint64

SC call gas estimate

  • tag for log print
  • Pass args and transfers for call
  • If result is > max + 120, then returns max + 120

func GetAddress

func GetAddress(tag string)

Get a wallets Dero address

  • tag for log print

func GetAssetSCIDName

func GetAssetSCIDName(scid string) string

Get display name of asset by SCID

func GetAssetSCIDforTransfer

func GetAssetSCIDforTransfer(amt uint64, scid string) (transfer rpc.Transfer)

Return asset transfer for SCID

func GetBalance

func GetBalance() uint64

Returns Dero wallet balance

func GetBlockTime

func GetBlockTime(ep string) float64

Get average block time from a daemon

func GetDaemonTx

func GetDaemonTx(txid string) *rpc.Tx_Related_Info

Get single TX data with GetTransaction

func GetDaemonTxPool added in v0.11.1

func GetDaemonTxPool() (result *rpc.GetTxPool_Result)

Get daemon TX pool

func GetDapps added in v0.11.0

func GetDapps() (dApps []string)

Get list of dReams dApps from contract store

  • Uses remote daemon if not connected

func GetDifficulty

func GetDifficulty(ep string) float64

Get difficulty from a daemon

func GetDreamsBalances

func GetDreamsBalances(assets map[string]string)

Get Dero balance and all tokens used on dReams platform

func GetFees added in v0.11.0

func GetFees()

Get platform fees from on chain store

  • Overwrites default fee values with current stored values

func GetG45Collection

func GetG45Collection(scid string) (scids []string)

Get all asset SCIDs from collection

func GetSCCode

func GetSCCode(scid string) string

Get code of a SC

func GetStringKey added in v0.11.0

func GetStringKey(scid, key, daemon string) interface{}

Get single string key result from SCID with daemon input

func GetUintKey added in v0.11.1

func GetUintKey(scid, key, daemon string) interface{}

Get single uint64 key result from SCID with daemon input

func GetWalletHeight

func GetWalletHeight(tag string)

Gets Dero wallet height

  • tag for log print

func GetWalletTransfers added in v0.10.1

func GetWalletTransfers(min, max, dst uint64) *[]rpc.Entry

Get wallet transfers with min/max heights and dst port

func GetWalletTx

func GetWalletTx(txid string) *rpc.Entry

Get wallet tx entry data by txid

func GetdReams

func GetdReams(amt uint64) (tx string)

Swap Dero for dReams

  • amt of Der to swap for dReams

func HexToString

func HexToString(h interface{}) string

Convert hex value to string

func IntType

func IntType(v interface{}) (value int)

Switch to convert interface to int

func IsConfirmingTx added in v0.11.0

func IsConfirmingTx() bool

func IsReady

func IsReady() bool

Check if wallet and daemon rpc are connected

func MsToTime

func MsToTime(ms string) (time.Time, error)

Convert a millisecond string to time.Time

func Ping

func Ping()

Ping Dero blockchain for connection

func PrintError added in v0.11.0

func PrintError(format string, a ...any)

Prints session error entry to Wallet.LogEntry and stdout

func PrintLog added in v0.11.0

func PrintLog(format string, a ...any)

Prints session log entry to Wallet.LogEntry and stdout

func RateSCID

func RateSCID(scid string, amt, pos uint64) (tx string)

Rate a SC with dReams rating system. Ratings are weight based on transactions Dero amount

  • amt of Dero for rating
  • pos defines positive or negative rating

func SendAsset

func SendAsset(scid, dest string) (tx string)

Send Dero asset to destination address and sends asset SCID as message to destination as payload for claiming

func SendMessage

func SendMessage(dest, msg string, rings uint64)

Send a message to destination address through Dero transaction, with ringsize selection

func SessionLog

func SessionLog(tag string, dapp semver.Version) *fyne.Container

Make gui log for txs with save function. print out for dApp version if being imported

func SetDaemonClient

func SetDaemonClient(addr string) (jsonrpc.RPCClient, context.Context, context.CancelFunc)

Set daemon rpc client with context and 8 sec cancel

func SetHeaders

func SetHeaders(name, desc, icon, scid string)

Set any SC headers on Gnomon SC

  • name, desc and icon are header params

func SetNFAListing

func SetNFAListing(scid, list, char string, dur, amt, perc uint64) (tx string)

List NFA for auction or sale by SCID

  • list defines type of listing
  • char sets charity donation address
  • dur sets listing duration
  • amt sets starting price
  • perc sets percentage to go to charity on sale

func SetWalletClient

func SetWalletClient(addr, pass string) (jsonrpc.RPCClient, context.Context, context.CancelFunc)

Set wallet rpc client with auth, context and 8 sec cancel

func SqfootToSqMeter

func SqfootToSqMeter(sqft float64) float64

func StringToInt

func StringToInt(s string) int

Convert string to int, returns 0 if err

func StringToUint64

func StringToUint64(s string) uint64

Convert string to Uint64, returns 0 if err

func ToAtomic

func ToAtomic(v interface{}, precision float64) uint64

Returns uint64 atomic value of v rounding to precision

func TokenBalance

func TokenBalance(scid string) uint64

Returns wallet balance of token by SCID

func TradedReams

func TradedReams(amt uint64) (tx string)

Swap dReams for Dero

  • amt of dReams to swap for Dero

func Uint64Type

func Uint64Type(v interface{}) (value uint64)

Switch to convert interface to uint64

func UploadNFAContract

func UploadNFAContract(code string) (tx string)

Upload a new NFA SC by string

func VerifySigner

func VerifySigner(txid string) bool

Verify TX signer with GetTransaction

func Version added in v0.11.0

func Version() semver.Version

Get current package version

Types

This section is empty.

Jump to

Keyboard shortcuts

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