rpc

package
v0.0.0-...-2797e35 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMinerFee

func GetMinerFee() float64

ins*150 + outs*34 + 10 + 80 = transaction size https://shimo.im/docs/5w9Fi1c9vm8yp1ly

func GetOmniDustBtc

func GetOmniDustBtc() float64

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) AddMultiSigAddress

func (client *Client) AddMultiSigAddress(minSignNum int, keys []string) (result string, err error)

func (*Client) BtcCreateAndSignAndSendRawTransaction

func (client *Client) BtcCreateAndSignAndSendRawTransaction(fromBitCoinAddress string, privkeys []string, outputItems []TransactionOutputItem, minerFee float64, sequence int) (txId string, err error)

create a transaction and signature and send to the network

func (*Client) BtcCreateAndSignRawTransaction

func (client *Client) BtcCreateAndSignRawTransaction(fromBitCoinAddress string, privkeys []string, outputItems []TransactionOutputItem, minerFee float64, sequence int, redeemScript *string) (txid string, hex string, err error)

create a transaction and just signnature , not send to the network,get the hash of signature

func (*Client) BtcCreateAndSignRawTransactionForUnsendInputTx

func (client *Client) BtcCreateAndSignRawTransactionForUnsendInputTx(fromBitCoinAddress string, privkeys []string, inputItems []TransactionInputItem, outputItems []TransactionOutputItem, minerFee float64, sequence int, redeemScript *string) (txid string, hex string, err error)

创建btc的raw交易:输入为未广播的预交易,输出为交易hex,支持单签和多签,如果是单签,就需要后续步骤再签名

func (*Client) BtcSignAndSendRawTransaction

func (client *Client) BtcSignAndSendRawTransaction(hex string, privKey string) (string, string, error)

func (*Client) BtcSignRawTransaction

func (client *Client) BtcSignRawTransaction(hex string, privKey string) (string, string, error)

func (*Client) BtcSignRawTransactionForUnsend

func (client *Client) BtcSignRawTransactionForUnsend(hex string, inputItems []TransactionInputItem, privKey string) (string, string, error)

func (*Client) CheckVersion

func (client *Client) CheckVersion() error

func (*Client) CreateMultiSig

func (client *Client) CreateMultiSig(minSignNum int, keys []string) (result string, err error)

https://bitcoin.org/en/developer-reference#bitcoin-core-apis

func (*Client) CreateRawTransaction

func (client *Client) CreateRawTransaction(inputs []map[string]interface{}, outputs map[string]interface{}) (result string, err error)

func (*Client) DecodeRawTransaction

func (client *Client) DecodeRawTransaction(hex string) (result string, err error)

func (*Client) DecodeScript

func (client *Client) DecodeScript(hexString string) (result string, err error)

func (*Client) DumpPrivKey

func (client *Client) DumpPrivKey(address string) (result string, err error)

func (*Client) GetAddressInfo

func (client *Client) GetAddressInfo(address string) (json string, err error)

func (*Client) GetBalanceByAddress

func (client *Client) GetBalanceByAddress(address string) (balance decimal.Decimal, err error)

func (*Client) GetBlockCount

func (client *Client) GetBlockCount() (result int, err error)

func (*Client) GetDifficulty

func (client *Client) GetDifficulty() (result string, err error)

func (*Client) GetMiningInfo

func (client *Client) GetMiningInfo() (result string, err error)

func (*Client) GetNetworkInfo

func (client *Client) GetNetworkInfo() (result string, err error)

func (*Client) GetNewAddress

func (client *Client) GetNewAddress(label string) (address string, err error)

func (*Client) GetTransactionById

func (client *Client) GetTransactionById(txid string) (result string, err error)

func (*Client) GetTxOut

func (client *Client) GetTxOut(txid string, num int) (result string, err error)

func (*Client) ImportPrivKey

func (client *Client) ImportPrivKey(privkey string) (result string, err error)

func (*Client) ListUnspent

func (client *Client) ListUnspent(address string) (result string, err error)

func (*Client) NextID

func (client *Client) NextID() uint64

func (*Client) OmniCreateAndSignRawTransaction

func (client *Client) OmniCreateAndSignRawTransaction(fromBitCoinAddress string, privkeys []string, toBitCoinAddress string, propertyId int64, amount float64, minerFee float64, sequence int) (txid, hex string, err error)

func (*Client) OmniCreateAndSignRawTransactionUseRestInput

func (client *Client) OmniCreateAndSignRawTransactionUseRestInput(txType int, fromBitCoinAddress string, usedTxid string, privkeys []string, toBitCoinAddress, changeToAddress string, propertyId int64, amount float64, minerFee float64, sequence int, redeemScript *string) (txid, hex string, err error)

func (*Client) OmniCreateAndSignRawTransactionUseSingleInput

func (client *Client) OmniCreateAndSignRawTransactionUseSingleInput(txType int, fromBitCoinAddress string, privkeys []string, toBitCoinAddress string, propertyId int64, amount float64, minerFee float64, sequence int, redeemScript *string, usedTxid string) (txid, hex string, currUseTxid string, err error)

From channelAddress to temp multi address, to Create CommitmentTx

func (*Client) OmniCreateAndSignRawTransactionUseUnsendInput

func (client *Client) OmniCreateAndSignRawTransactionUseUnsendInput(fromBitCoinAddress string, privkeys []string, inputItems []TransactionInputItem, toBitCoinAddress, changeToAddress string, propertyId int64, amount float64, minerFee float64, sequence int, redeemScript *string) (txid string, hex string, err error)

func (*Client) OmniDecodeTransaction

func (client *Client) OmniDecodeTransaction(hex string) (result string, err error)

func (*Client) OmniDecodeTransactionWithPrevTxs

func (client *Client) OmniDecodeTransactionWithPrevTxs(hex string, prevtxs []TransactionInputItem) (result string, err error)

func (*Client) OmniGetAllBalancesForAddress

func (client *Client) OmniGetAllBalancesForAddress(address string) (result string, err error)

func (*Client) OmniGetProperty

func (client *Client) OmniGetProperty(propertyId int64) (result string, err error)

Get detailed information about an Omni transaction.

func (*Client) OmniGetbalance

func (client *Client) OmniGetbalance(address string, propertyId int) (result string, err error)

func (*Client) OmniGetinfo

func (client *Client) OmniGetinfo() (result string, err error)

https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md Returns various state information of the client and protocol.

func (*Client) OmniGettransaction

func (client *Client) OmniGettransaction(txid string) (result string, err error)

Get detailed information about an Omni transaction.

func (*Client) OmniListProperties

func (client *Client) OmniListProperties() (result string, err error)

Get detailed information about an Omni transaction.

func (*Client) OmniListTransactions

func (client *Client) OmniListTransactions(count int, skip int) (result string, err error)

List wallet transactions, optionally filtered by an address and block boundaries.

func (*Client) OmniRawTransaction

func (client *Client) OmniRawTransaction(fromBitCoinAddress string, privkeys []string, toBitCoinAddress string, propertyId int64, amount float64, minerFee float64, sequence int) (txid string, err error)

func (*Client) OmniSend

func (client *Client) OmniSend(fromAddress string, toAddress string, propertyId int, amount float64) (result string, err error)

Create and broadcast a simple send transaction.

func (*Client) OmniSendGrant

func (client *Client) OmniSendGrant(fromAddress string, propertyId int64, amount float64, memo string) (result string, err error)

Issue or grant new units of managed tokens. https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md#omni_sendgrant

func (*Client) OmniSendIssuanceFixed

func (client *Client) OmniSendIssuanceFixed(fromAddress string, ecosystem int, divisibleType int, name string, data string, amount float64) (result string, err error)

Create new tokens with manageable supply. https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md#omni_sendissuancemanaged

func (*Client) OmniSendIssuanceManaged

func (client *Client) OmniSendIssuanceManaged(fromAddress string, ecosystem int, divisibleType int, name string, data string) (result string, err error)

Create new tokens with manageable supply. https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md#omni_sendissuancemanaged

func (*Client) OmniSendRevoke

func (client *Client) OmniSendRevoke(fromAddress string, propertyId int64, amount float64, memo string) (result string, err error)

Revoke units of managed tokens. https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md#omni_sendrevoke

func (*Client) OmniSignRawTransactionForUnsend

func (client *Client) OmniSignRawTransactionForUnsend(hex string, inputItems []TransactionInputItem, privKey string) (string, string, error)

func (*Client) SendRawTransaction

func (client *Client) SendRawTransaction(hex string) (result string, err error)

func (*Client) SignMessageWithPrivKey

func (client *Client) SignMessageWithPrivKey(privkey string, message string) (result string, err error)

func (*Client) SignRawTransactionWithKey

func (client *Client) SignRawTransactionWithKey(hex string, privkeys []string, prevtxs []map[string]interface{}, sighashtype string) (result string, err error)

func (*Client) TestMemPoolAccept

func (client *Client) TestMemPoolAccept(signedhex string) (result string, err error)

https://bitcoin.org/en/developer-reference#testmempoolaccept

func (*Client) ValidateAddress

func (client *Client) ValidateAddress(address string) (isValid bool, err error)

func (*Client) VerifyMessage

func (client *Client) VerifyMessage(address string, signature string, message string) (result string, err error)

type ConnConfig

type ConnConfig struct {
	// Host is the IP address and port of the remote omnicore server you want to connect to.
	Host string
	// User is the username used in authentification by the remote RPC server.
	User string
	// Pass is the passphrase used in authentification.
	Pass string
}

type RPCError

type RPCError struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

func (*RPCError) Error

func (r *RPCError) Error() string

type Request

type Request struct {
	Jsonrpc string            `json:"jsonrpc"`
	ID      interface{}       `json:"id"`
	Method  string            `json:"method"`
	Params  []json.RawMessage `json:"params"`
}

type TransactionInputItem

type TransactionInputItem struct {
	Txid         string  `json:"txid"`
	ScriptPubKey string  `json:"scriptPubKey"`
	Vout         uint32  `json:"vout"`
	Amount       float64 `json:"value"`
}

type TransactionOutputItem

type TransactionOutputItem struct {
	ToBitCoinAddress string
	Amount           float64
}

Jump to

Keyboard shortcuts

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