package
0.0.0-20191201205449-f379a713d0c2
Repository: https://github.com/rjected/lit.git
Documentation: pkg.go.dev

# README

RPC Commands

Other structs referenced in request/responses have their declarations copied in second secton of this document.

chancmds

ChannelList

Args:

  • ChanIdx (uint32)

Returns:

  • Channels (ChannelInfo list)

If ChanIdx is nonzero, returns info for only that channel.

FundChannel

Args:

  • Peer (uint32)
  • CoinType (uint32)
  • Capacity (int64)
  • Roundup (int64)
  • InitialSend (int64)
  • Data (32 byte array)

Returns:

  • Status (string)

DualFundChannel

Args:

  • Peer (uint32)
  • CoinType (uint32)
  • OurAmount (int64)
  • TheirAmount (int64)

Returns:

  • Status (string)

DualFundRespond

Args:

  • AcceptOrDecline (bool)

Returns:

  • Status (string)

True for accept, false for decline.

PendingDualFund

Args: empty object

Returns:

  • Pending (bool)
  • PeerIdx (uint32)
  • CoinType (uint32)
  • TheirAmount (int64)
  • RequestedAmount (int64)

StateDump

Args: empty object

Returns:

  • Txs (JusticeTx list)

Push

Args:

  • ChanIdx (uint32)
  • Amt (int64)
  • Data (32 byte array)

Returns:

  • `StateIndex (uint64)``

CloseChannel

Args:

  • ChanIdx (uint32)

Returns:

  • Status (string)

BreakChannel

Args:

  • ChanIdx (uint32)

Returns:

  • Status (string)

DumpPrivs

Args: none

Returns:

  • Privs (PrivInfo list)

dlccmds

ListOracles

Args: empty object

Returns:

  • Oracles (DlcOracle list)

ImportOracle

Args:

  • Url (string)
  • Name (string)

Returns:

  • Oracle (DlcOracle)

AddOracle

Args:

  • Key (string)
  • Name (string)

Returns:

  • Oracle (DlcOracle)

NewContract

Args: empty object

Returns:

  • Contract (DlcContract)

ListContracts

Args: empty object

Returns:

  • Contracts (DlcContract list)

GetContract

Args:

  • Idx (uint64)

Returns:

  • Contract (DlcContract)

SetContractOracle

Args:

  • CIdx (uint64)
  • OIdx (uint64)

Returns:

  • Success (bool)

SetContractDatafeed

Args:

  • CIdx (uint64)
  • Feed (uint64)

Returns:

  • Success (bool)

SetContractRPoint

Args:

  • CIdx (uint64)
  • RPoint (33 byte list)

Returns:

  • Success (bool)

SetContractFunding

Args:

  • CIdx (uint64)
  • OutAmount (int64)
  • TheirAmount (int64)

SetContractDivision

Args:

  • CIdx (uint64)
  • ValueFullyOurs (int64)
  • ValueFullyTheirs (int64)

Returns:

  • Success (bool)

SetContractCoinType

Args:

  • CIdx (uint64)
  • CoinType (uint32)

Returns:

  • Success (bool)

OfferContract

Args:

  • CIdx (uint64)
  • PeerIdx (uint32)

Returns:

  • Success (bool)

ContractRespond

Args:

  • AcceptOrDecline (bool)
  • CIdx (uint64)

Returns:

  • Success (bool)

True for accept, false for decline.

SettleContract

Args:

  • CIdx (uint64)
  • OracleValue (int64)
  • OracleSig (32 byte list)

Returns:

  • Success (bool)
  • SettleTxHash (32 byte list)
  • ClaimTxHash (32 byte list)

netcmds

Listen

Args:

  • Port (string) (why is this a string lol)

Returns:

  • LisIpPorts (string list)
  • Adr (string)

Connect

Args:

  • LNAddr (string)

Returns:

  • Status (string)
  • PeerIdx (uint32)

AssignNickname

Args:

  • Peer (uint32)
  • Nickname (string)

Returns:

  • Status (string)

ListConnections

Args: none

Returns:

  • Connections (PeerInfo list)
  • MyPKH (string)

GetListeningPorts

Args: none

Returns:

  • LisIpPorts (string list)
  • Adr (string)

GetMessages

Args: none

Returns:

  • Status (string)

Say

Args:

  • Peer (uint32)
  • Message (string)

Returns:

  • Status (string)

Stop

Args: none

Returns:

  • Status (string)

GetChannelMap

Args: none

Returns:

  • Graph (string)

The string is formatted in the GraphViz .dot format.

towercmds

Watch

Args:

  • ChanIdx (uint32)
  • SendToPeer (uint32)

Returns:

  • Msg (string)

walletcmds

Balance

Args: none

Returns:

  • Balances (CoinBalReply list)

TxoList

Args: none

Returns:

  • Txos (TxoInfo list)

Send

Args:

  • DestArgs (string list)
  • Amts (int64 list)

Returns:

  • Txids (string list)

Sweep

Args:

  • DestAdr (string)
  • NumTx (uint32)
  • Drop (bool)

Returns:

  • Txids (string list)

Fanout

Args:

  • DestAdr (string)
  • NumOutputs (uint32)
  • AmtPerOutput (int64)

Returns:

  • Txids (string list)

SetFee

Args:

  • Fee (int64)
  • CoinType (uint32)

Returns:

  • CurrentFee (int64)

GetFee

Args:

  • CoinType (uint32)

Returns:

  • CurrentFee (int64)

Address

Args:

  • NumToMake (uint32)
  • CoinType (uint32)

Returns:

  • CoinTypes (uint32 list)
  • WitAddresses (string list)
  • LegacyAddresses (string list)

If you set NumToMake to 0, it'll return all the addresses of the type.

GetAddresses

Args: none

Returns:

  • CoinTypes (uint32 list)
  • WitAddresses (string list)
  • LegacyAddresses (string list)

Other Types

ChannelInfo

type ChannelInfo struct {
	OutPoint      string
	CoinType      uint32
	Closed        bool
	Capacity      int64
	MyBalance     int64
	Height        int32  // block height of channel fund confirmation
	StateNum      uint64 // Most recent commit number
	PeerIdx, CIdx uint32
	PeerID        string
	Data          [32]byte
	Pkh           [20]byte
	LastUpdate    uint64
}

Priv Info

type PrivInfo struct {
	OutPoint string
	Amt      int64
	Height   int32
	Delay    int32
	CoinType string
	Witty    bool
	PairKey  string

	WIF string
}

DlcOracle

type DlcOracle struct {
	Idx  uint64   // Index of the oracle for refencing in commands
	A    [33]byte // public key of the oracle
	Name string   // Name of the oracle for display purposes
	Url  string   // Base URL of the oracle, if its REST based (optional)
}

DlcContract

type DlcContract struct {
	// Index of the contract for referencing in commands
	Idx uint64
	// Index of the contract on the other peer (so we can reference it in
	// messages)
	TheirIdx uint64
	// Index of the peer we've offered the contract to or received the contract
	// from
	PeerIdx uint32
	// Coin type
	CoinType uint32
	// Pub keys of the oracle and the R point used in the contract
	OracleA, OracleR [33]byte
	// The time we expect the oracle to publish
	OracleTimestamp uint64
	// The payout specification
	Division []DlcContractDivision
	// The amounts either side are funding
	OurFundingAmount, TheirFundingAmount int64
	// PKH to which the contracts funding change should go
	OurChangePKH, TheirChangePKH [20]byte
	// Pubkey used in the funding multisig output
	OurFundMultisigPub, TheirFundMultisigPub [33]byte
	// Pubkey to be used in the commit script (combined with oracle pubkey
	// or CSV timeout)
	OurPayoutBase, TheirPayoutBase [33]byte
	// Pubkeyhash to which the contract pays out (directly)
	OurPayoutPKH, TheirPayoutPKH [20]byte
	// Status of the contract
	Status DlcContractStatus
	// Outpoints used to fund the contract
	OurFundingInputs, TheirFundingInputs []DlcContractFundingInput
	// Signatures for the settlement transactions
	TheirSettlementSignatures []DlcContractSettlementSignature
	// The outpoint of the funding TX we want to spend in the settlement
	// for easier monitoring
	FundingOutpoint wire.OutPoint
}

PeerInfo

type PeerInfo struct {
	PeerNumber uint32
	RemoteHost string
	LitAdr 	   string
	Nickname   string
}

CoinBalReply

type CoinBalReply struct {
	CoinType    uint32
	SyncHeight  int32 // height this wallet is synced to
	ChanTotal   int64 // total balance in channels
	TxoTotal    int64 // all utxos
	MatureWitty int64 // confirmed, spendable and witness
	FeeRate     int64 // fee per byte
}

TxoInfo

type TxoInfo struct {
	OutPoint string
	Amt      int64
	Height   int32
	Delay    int32
	CoinType string
	Witty    bool

	KeyPath string
}

# Functions

AdrStringToOutscript converts an address string into an output script byte slice note that this ignores the prefix! Be careful not to mix networks.
Default to testnet for unknown / bad addrs.
Gives the cointype from an address string (if known).
LndcRpcCanConnectLocally checks if we can connect to lit using the normal home directory.
LndcRpcCanConnectLocallyWithHomeDir checks if we can connect to lit given the home directory.
NewLndcRpcClient creates a new LNDC client using the given private key, which is arbitrary.
NewLndcRpcWebsocketProxy is an overload to NewLndcRpcWebsocketProxyWithLndc connecting to the given lit node specified by litAdr, identifying with the given key.
NewLndcRpcWebsocketProxyWithLndc creates a new proxy that listens on the websocket port and translates requests into remote control messages over lndc transport.
NewLocalLndcRpcClient is an overload for NewLocalLndcRpcClientWithHomeDirAndPort using the default home dir and port.
NewLocalLndcRpcClientWithHomeDirAndPort loads up privkey.hex, and derives the local lit node's address from it, as well as derives the default remote control private key from it.
NewLocalLndcRpcClientWithPort is an overload for NewLocalLndcRpcClientWithHomeDirAndPort using the default home dir.
NewLocalLndcRpcWebsocketProxy is an overload to NewLndcRpcWebsocketProxyWithLndc connecting to the local lit using a derived key from the locally stored privkey.hex using the default home dir and port.
NewLocalLndcRpcWebsocketProxy is an overload to NewLndcRpcWebsocketProxyWithLndc connecting to the local lit using a derived key from the locally stored privkey.hex using the given homedir and the given port.
NewLocalLndcRpcWebsocketProxy is an overload to NewLndcRpcWebsocketProxyWithLndc connecting to the local lit using a derived key from the locally stored privkey.hex using the default home dir and the given port.
No description provided by the author
No description provided by the author

# Structs

------------------------- HTLCs.
No description provided by the author
No description provided by the author
No description provided by the author
------------------------- address.
TODO Make this contain an array of structures not a structure of arrays.
------------------------- name a connection.
No description provided by the author
------------------------- cclose.
------------ Dump channel map.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
------------------------- balance BalReply is the reply when the user asks about their balance.
No description provided by the author
------------------------- connect.
No description provided by the author
No description provided by the author
No description provided by the author
------------------------- dual fund.
No description provided by the author
No description provided by the author
------------------------- fanout.
get fee.
No description provided by the author
------------------------- fund.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
LndcRpcClient can be used to remotely talk to a lit node over LNDC, making remote control instructions over the remote control interface.
LndcRpcWebsocketProxy is a regular websocket server that translates the received requests into a call on the new LNDC based remote control transport.
------------ Show multihop payments.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
OiOoReadWriter is for One-In-One-Out Reader/Writer and I hope to god that it works.
No description provided by the author
No description provided by the author
No description provided by the author
------------------------- dumpPriv.
------------------------- push.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
------------------------- send.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
set fee.
No description provided by the author
No description provided by the author
------------------------- statedump.
No description provided by the author
No description provided by the author
------------------------- sweep.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author