particlrpc

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

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 6 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

particlrpc

GO package implementing the RPC interface to the particl node daemon.

API documentation: https://godoc.org/github.com/mua69/particlrpc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressDelta

type AddressDelta struct {
	Satoshis Sat    `json:"satoshis"`
	Txid     string `json:"txid"`
}

type Block

type Block struct {
	Hash   string `json:"hash"`
	Time   int64  `json:"time"`
	Height int    `json:"height"`
}

type BlockReward

type BlockReward struct {
	Blockhash    string                  `json:"blockhash"`
	Coinstake    string                  `json:"coinstake"`
	Stakereward  float64                 `json:"stakereward"`
	Blockreward  float64                 `json:"blockreward"`
	Kernelscript BlockRewardKernelScript `json:"kernelscript"`
	Outputs      []BlockRewardOutput     `json:"outputs"`
}

type BlockRewardKernelScript

type BlockRewardKernelScript struct {
	Spendaddr string `json:"spendaddr"`
}

type BlockRewardOutput

type BlockRewardOutput struct {
	Script BlockRewardOutputScript `json:"script"`
	Value  float64                 `json:"value"`
}

type BlockRewardOutputScript

type BlockRewardOutputScript struct {
	Hex       string `json:"hex"`
	Spendaddr string `json:"spendaddr"`
}

type BlockchainInfo

type BlockchainInfo struct {
	Blocks int `json:"blocks"`
}

type ColdStakeUnspent

type ColdStakeUnspent struct {
	Height    int    `json:"height"`
	Value     Sat    `json:"value"`
	Addrspend string `json:"addrspend"`
}

type NetworkInfo

type NetworkInfo struct {
	Version     int    `json:"version"`
	Subversion  string `json:"subversion"`
	Connections int    `json:"connections"`
}

type ParticlRpc

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

func NewParticlRpc

func NewParticlRpc() *ParticlRpc

NewParticlRpc creates a new ParticlRpc instance with default settings: dataDir: ".", rpcHost: "localhost", rpcPort: 51735

func (*ParticlRpc) CallRpc

func (rpc *ParticlRpc) CallRpc(cmd string, wallet string, args []interface{}, res interface{}) error

CallRpc executes rpc command <cmd> with arguments <args> at the particl daemon. Returned data is written to <res>, which must be a pointer to a data structure matching the command. If rpc command is wallet specific, the wallet name can be passed in <wallet>, otherwise an empty string must be passed.

func (*ParticlRpc) GetBlockchainInfo

func (rpc *ParticlRpc) GetBlockchainInfo() (*BlockchainInfo, error)

GetBlockchainInfo executes the "getnetworkinfo" command and returns results.

func (*ParticlRpc) GetNetworkInfo

func (rpc *ParticlRpc) GetNetworkInfo() (*NetworkInfo, error)

GetNetworkInfo executes the "getnetworkinfo" command and returns results.

func (*ParticlRpc) GetStakingInfo

func (rpc *ParticlRpc) GetStakingInfo(wallet string) (*StakingInfo, error)

GetStakingInfo executes the "getnetworkinfo" command and returns results.

func (*ParticlRpc) GetStakingOptions

func (rpc *ParticlRpc) GetStakingOptions(wallet string) (*Stakingoptions, error)

GetStakingOptions retuns currently set staking options

func (*ParticlRpc) GetUptime

func (rpc *ParticlRpc) GetUptime() (int64, error)

GetStakingInfo executes the "getnetworkinfo" command and returns results.

func (*ParticlRpc) ReadConfig

func (rpc *ParticlRpc) ReadConfig(filename string) error

ReadConfig reads a JSON config file defining data dir (data_dir), rpc host ("rpc_host") and rpc port ("rpc_port").

func (*ParticlRpc) ReadPartRpcCookie

func (rpc *ParticlRpc) ReadPartRpcCookie() error

ReadPartRpcCookie reads an rpc authorization .cookie file from the data directory.

func (*ParticlRpc) SetDataDirectoy

func (rpc *ParticlRpc) SetDataDirectoy(dir string)

SetDataDirectoy sets the particld data directory. An emptry string is interepreted as "."

func (*ParticlRpc) SetRpcHost

func (rpc *ParticlRpc) SetRpcHost(host string)

SetRpcHost sets the host to which the RPC call will connect. An empty string is interpreted as "localhost"

func (*ParticlRpc) SetRpcPort

func (rpc *ParticlRpc) SetRpcPort(port int)

SetRpcPort sets the port to which the RPC call will connect. Value <= 0 will be interpreted as 51735.

func (*ParticlRpc) SetStakingOptions

func (rpc *ParticlRpc) SetStakingOptions(enabled bool, rewardaddress string, smsgfeeratetarget float64,
	wallet string) (*Stakingoptions, error)

SetStakingOptions sets staking options (staking enabled, reward address) for specified wallet and returns current settings.

type Sat

type Sat int64

type ScriptPubKey

type ScriptPubKey struct {
	Type      string   `json:"type"`
	Addresses []string `json:"addresses"`
}

type SetStakingoptions

type SetStakingoptions struct {
	Rewardaddress     string  `json:"rewardaddress"`
	Enabled           bool    `json:"enabled"`
	Smsgfeeratetarget float64 `json:"smsgfeeratetarget"`
}

type StakingInfo

type StakingInfo struct {
	Staking                 bool    `json:"staking"`
	Errors                  string  `json:"errors"`
	Weight                  int64   `json:"weight"`
	Percentyearreward       float64 `json:"percentyearreward"`
	Moneysupply             float64 `json:"moneysupply"`
	Treasurydonationpercent float64 `json:"treasurydonationpercent"`
	Netstakeweight          int64   `json:"netstakeweight"`
	Expectedtime            int64   `json:"expectedtime"`
}

type Stakingoptions

type Stakingoptions struct {
	Rewardaddress     string  `json:"rewardaddress"`
	Enabled           bool    `json:"enabled"`
	Time              int64   `json:"time"`
	Smsgfeeratetarget float64 `json:"smsgfeeratetarget"`
}

type Tx

type Tx struct {
	Vin       []TxVin  `json:"vin"`
	Vout      []TxVout `json:"vout"`
	Time      int64    `json:"time"`
	Blockhash string   `json:"blockhash"`
}

type TxVin

type TxVin struct {
	Txid string `json:"txid"`
	Vout int    `json:"vout"`
}

type TxVout

type TxVout struct {
	Type         string       `json:"type"`
	ValueSat     Sat          `json:"valueSat"`
	ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
}

Jump to

Keyboard shortcuts

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