client

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelTx

func CancelTx(txID *uint32, txSlateID *uuid.UUID) error

CancelTx cancels a transaction.

func FinalizeTx

func FinalizeTx(slateIn libwallet.Slate) (*libwallet.Slate, error)

FinalizeTx finalizes a transaction, after all parties have filled in both rounds of Slate generation.

func InitSendTx

func InitSendTx(initTxArgs libwallet.InitTxArgs) (*libwallet.Slate, error)

InitSendTx initiates a new transaction as the sender, creating a new Slate object containing the sender's inputs, change outputs, and public signature data.

func NodeHeight

func NodeHeight() (*libwallet.NodeHeightResult, error)

NodeHeight retrieves the last known height known by the node.

func PostTx

func PostTx(tx core.Transaction, fluff bool) error

PostTx posts a completed transaction to the listening node for validation and inclusion in a block for mining.

func RetrieveOutputs

func RetrieveOutputs(includeSpent, refreshFromNode bool, txID *uint32) (bool, *[]libwallet.OutputCommitMapping, error)

RetrieveOutputs returns a list of outputs from the active account in the

func RetrieveSummaryInfo

func RetrieveSummaryInfo(refreshFromNode bool, minimumConfirmations uint64) (bool, *libwallet.WalletInfo, error)

RetrieveSummaryInfo returns summary information from the active account in the

func RetrieveTxs

func RetrieveTxs(refreshFromNode bool, txID *uint32, txSlateID *uuid.UUID) (bool, *[]libwallet.TxLogEntry, error)

RetrieveTxs returns a list of Transaction Log Entries from the active account in the

func TxLockOutputs

func TxLockOutputs(slate *libwallet.Slate, participantID uint) error

TxLockOutputs locks the outputs associated with the inputs to the transaction in the given Slate, making them unavailable for use in further transactions.

Types

type EncryptedData

type EncryptedData struct {
	Nonce   string `json:"nonce"`
	BodyEnc string `json:"body_enc"`
}

EncryptedData are the params or result to send/receive for the encrypted owner API

type Envelope

type Envelope struct {
	ID      JSONRPCID        `json:"id"`
	Version JSONRPCV2Version `json:"jsonrpc"`
	Method  string           `json:"method"`
	Params  json.RawMessage  `json:"params,omitempty"`
	Result  json.RawMessage  `json:"result,omitempty"`
	Error   *rpcError        `json:"error,omitempty"`
}

Envelope is the JSON-RPC envelope

type JSONRPCID

type JSONRPCID string

JSONRPCID represents the JSON-RPC V2 id will automatically be serialized

func (JSONRPCID) MarshalJSON

func (e JSONRPCID) MarshalJSON() ([]byte, error)

MarshalJSON implement the Marshaler interface on JSONRPCID

type JSONRPCV2Version

type JSONRPCV2Version string

JSONRPCV2Version represents the JSON-RPC V2 version string will always be serialized to "2.0"

func (JSONRPCV2Version) MarshalJSON

func (e JSONRPCV2Version) MarshalJSON() ([]byte, error)

MarshalJSON implement the Marshaler interface on JSONRPCVersion

type NodeAPI

type NodeAPI struct {
	URL string
}

NodeAPI struct

func (*NodeAPI) GetBlockByHash

func (nodeAPI *NodeAPI) GetBlockByHash(blockHash string) (*api.BlockPrintable, error)

GetBlockByHash returns a block using the hash

func (*NodeAPI) GetBlockByHeight

func (nodeAPI *NodeAPI) GetBlockByHeight(height uint64) (*api.BlockPrintable, error)

GetBlockByHeight returns a block using the height

func (*NodeAPI) GetBlockReward

func (nodeAPI *NodeAPI) GetBlockReward(blockHash string) (uint64, error)

GetBlockReward queries the node to get the block reward with fees

func (*NodeAPI) GetStatus

func (nodeAPI *NodeAPI) GetStatus() (*api.Status, error)

GetStatus returns the node status

type RPCHTTPClient

type RPCHTTPClient struct {
	URL string
}

RPCHTTPClient is a JSON-RPC over HTTP Client

func (*RPCHTTPClient) EncryptedRequest

func (c *RPCHTTPClient) EncryptedRequest(method string, params json.RawMessage, sharedSecret []byte) (*Envelope, error)

EncryptedRequest do an encrypted RPC POST request with the server

func (*RPCHTTPClient) Request

func (c *RPCHTTPClient) Request(method string, params json.RawMessage) (*Envelope, error)

Request do a RPC POST request with the server

type Result

type Result struct {
	Ok  json.RawMessage
	Err json.RawMessage
}

Result is golang equivalent of Rust result

type SecureOwnerAPI

type SecureOwnerAPI struct {
	PublicKey       btcec.PublicKey
	ServerPublicKey *btcec.PublicKey
	// contains filtered or unexported fields
}

SecureOwnerAPI represent the wallet owner API (v3)

func NewSecureOwnerAPI

func NewSecureOwnerAPI(url string) *SecureOwnerAPI

NewSecureOwnerAPI creates a new owner API

func (*SecureOwnerAPI) Accounts

func (owner *SecureOwnerAPI) Accounts() (*[]libwallet.AccountPathMapping, error)

Accounts Returns a list of accounts stored in the wallet (i.e. mappings between user-specified labels and BIP32 derivation paths

func (*SecureOwnerAPI) CancelTx

func (owner *SecureOwnerAPI) CancelTx(txID *uint32, txSlateID *uuid.UUID) error

CancelTx cancels a transaction.

func (*SecureOwnerAPI) Close

func (owner *SecureOwnerAPI) Close(name *string) error

Close is an helper function to close the wallet and free the token from memory

func (*SecureOwnerAPI) CloseWallet

func (owner *SecureOwnerAPI) CloseWallet(name *string) error

CloseWallet close a wallet, removing the master seed from memory.

func (*SecureOwnerAPI) CreateSlatepackMessage

func (owner *SecureOwnerAPI) CreateSlatepackMessage(derivationIndex uint32, slate slateversions.SlateV4, senderIndex *uint32, recipients []string) (*string, error)

CreateSlatepackMessage create a slatepack message from the given slate

func (*SecureOwnerAPI) DecodeSlatepackMessage

func (owner *SecureOwnerAPI) DecodeSlatepackMessage(message string, secretIndices []uint32) (*slatepack.Slatepack, error)

DecodeSlatepackMessage decodes a slatepack message

func (*SecureOwnerAPI) FinalizeTx

func (owner *SecureOwnerAPI) FinalizeTx(slateIn slateversions.SlateV4) (*slateversions.SlateV4, error)

FinalizeTx finalizes a transaction, after all parties have filled in both rounds of Slate generation.

func (*SecureOwnerAPI) GetSlatepackAddress

func (owner *SecureOwnerAPI) GetSlatepackAddress(derivationIndex uint32) (*string, error)

GetSlatepackAddress retrieve the slatepack address for the current parent key at the given index

func (*SecureOwnerAPI) GetSlatepackSecretKey

func (owner *SecureOwnerAPI) GetSlatepackSecretKey(derivationIndex uint32) (*string, error)

GetSlatepackSecretKey retrieve the decryption key for the current parent key the given index

func (*SecureOwnerAPI) GetStoredTx

func (owner *SecureOwnerAPI) GetStoredTx(id *uint32, slateID *uuid.UUID) (*slateversions.SlateV4, error)

GetStoredTx retrieves the stored transaction associated with a TxLogEntry. Can be used even after the transaction has completed. Either the Transaction Log ID or the Slate UUID must be supplied. If both are supplied, the Transaction Log ID is preferred.

func (*SecureOwnerAPI) Init

func (owner *SecureOwnerAPI) Init() error

Init initalize the secure owner API

func (*SecureOwnerAPI) InitSecureAPI

func (owner *SecureOwnerAPI) InitSecureAPI(pubKey []byte) (string, error)

InitSecureAPI Initializes the secure JSON-RPC API. This function must be called and a shared key established before any other OwnerAPI JSON-RPC function can be called.

func (*SecureOwnerAPI) InitSendTx

func (owner *SecureOwnerAPI) InitSendTx(initTxArgs libwallet.InitTxArgs) (*slateversions.SlateV4, error)

InitSendTx initiates a new transaction as the sender, creating a new Slate object containing the sender's inputs, change outputs, and public signature data.

func (*SecureOwnerAPI) NodeHeight

func (owner *SecureOwnerAPI) NodeHeight() (*libwallet.NodeHeightResult, error)

NodeHeight retrieves the last known height known by the node.

func (*SecureOwnerAPI) Open

func (owner *SecureOwnerAPI) Open(name *string, password string) error

Open is an helper function to open the wallet and set the token

func (*SecureOwnerAPI) OpenWallet

func (owner *SecureOwnerAPI) OpenWallet(name *string, password string) (string, error)

OpenWallet `opens` a wallet, populating the internal keychain with the encrypted seed, and optionally returning a `keychain_mask` token to the caller to provide in all future calls. If using a mask, the seed will be stored in-memory XORed against the `keychain_mask`, and will not be useable if the mask is not provided.

func (*SecureOwnerAPI) PostTx

func (owner *SecureOwnerAPI) PostTx(slate slateversions.SlateV4, fluff bool) error

PostTx posts a completed transaction to the listening node for validation and inclusion in a block for mining.

func (*SecureOwnerAPI) RetrieveOutputs

func (owner *SecureOwnerAPI) RetrieveOutputs(includeSpent, refreshFromNode bool, txID *uint32) (bool, *[]libwallet.OutputCommitMapping, error)

RetrieveOutputs returns a list of outputs from the active account in the

func (*SecureOwnerAPI) RetrieveSummaryInfo

func (owner *SecureOwnerAPI) RetrieveSummaryInfo(refreshFromNode bool, minimumConfirmations uint64) (bool, *libwallet.WalletInfo, error)

RetrieveSummaryInfo returns summary information from the active account in the

func (*SecureOwnerAPI) RetrieveTxs

func (owner *SecureOwnerAPI) RetrieveTxs(refreshFromNode bool, txID *uint32, txSlateID *uuid.UUID) (bool, *[]libwallet.TxLogEntry, error)

RetrieveTxs returns a list of Transaction Log Entries from the active account in the

func (*SecureOwnerAPI) SetTorConfig

func (owner *SecureOwnerAPI) SetTorConfig(torConfig libwallet.TorConfig) error

SetTorConfig set the TOR configuration for this instance of the OwnerAPI, used during InitSendTx when send args are present and a TOR address is specified

func (*SecureOwnerAPI) SlateFromSlatepackMessage

func (owner *SecureOwnerAPI) SlateFromSlatepackMessage(message string, secretIndices []uint32) (*slateversions.SlateV4, error)

SlateFromSlatepackMessage create a slate from a slatepack message

func (*SecureOwnerAPI) TxLockOutputs

func (owner *SecureOwnerAPI) TxLockOutputs(slate slateversions.SlateV4) error

TxLockOutputs locks the outputs associated with the inputs to the transaction in the given Slate, making them unavailable for use in further transactions.

Jump to

Keyboard shortcuts

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