litrpc

package
v0.0.0-...-aeb2f35 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdrStringToOutscript

func AdrStringToOutscript(adr string) ([]byte, error)

AdrStringToOutscript converts an address string into an output script byte slice note that this ignores the prefix! Be careful not to mix networks. currently only works for testnet legacy addresses

func CoinTypeFromAdr

func CoinTypeFromAdr(adr string) uint32

Default to testnet for unknown / bad addrs.

func CoinTypeFromBechAdr

func CoinTypeFromBechAdr(adr string) (uint32, error)

Gives the cointype from an address string (if known)

func RPCListen

func RPCListen(rpcl *LitRPC, host string, port uint16)

Types

type AcceptContractArgs

type AcceptContractArgs struct {
	CIdx uint64
}

type AcceptContractReply

type AcceptContractReply struct {
	Success bool
}

type AddOracleArgs

type AddOracleArgs struct {
	Key  string
	Name string
}

type AddOracleReply

type AddOracleReply struct {
	Oracle *dlc.DlcOracle
}

type AddressArgs

type AddressArgs struct {
	NumToMake uint32
	CoinType  uint32
}

------------------------- address

type AddressReply

type AddressReply struct {
	WitAddresses    []string
	LegacyAddresses []string
}

type AssignNicknameArgs

type AssignNicknameArgs struct {
	Peer     uint32
	Nickname string
}

------------------------- name a connection

type BalanceReply

type BalanceReply struct {
	Balances []CoinBalReply
}

type ChanArgs

type ChanArgs struct {
	ChanIdx uint32
}

------------------------- cclose

type ChannelGraphReply

type ChannelGraphReply struct {
	Graph string
}

------------ Dump channel map

type 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
}

type ChannelListReply

type ChannelListReply struct {
	Channels []ChannelInfo
}

type CoinArgs

type CoinArgs struct {
	CoinType uint32
}

type 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
}

------------------------- balance BalReply is the reply when the user asks about their balance.

type ConInfo

type ConInfo struct {
	PeerNumber uint32
	RemoteHost string
}

type ConnectArgs

type ConnectArgs struct {
	LNAddr string
}

------------------------- connect

type DeclineContractArgs

type DeclineContractArgs struct {
	CIdx uint64
}

type DeclineContractReply

type DeclineContractReply struct {
	Success bool
}

type DualFundAcceptArgs

type DualFundAcceptArgs struct {
}

type DualFundArgs

type DualFundArgs struct {
	Peer        uint32 // who to make the channel with
	CoinType    uint32 // what coin to use
	OurAmount   int64  // what amount we will fund
	TheirAmount int64  // what amount we request them to fund
}

------------------------- dual fund

type DualFundDeclineArgs

type DualFundDeclineArgs struct {
}

type DumpReply

type DumpReply struct {
	Privs []PrivInfo
}

type FanArgs

type FanArgs struct {
	DestAdr      string
	NumOutputs   uint32
	AmtPerOutput int64
}

------------------------- fanout

type FeeArgs

type FeeArgs struct {
	CoinType uint32
}

get fee

type FeeReply

type FeeReply struct {
	CurrentFee int64
}

type FundArgs

type FundArgs struct {
	Peer        uint32 // who to make the channel with
	CoinType    uint32 // what coin to use
	Capacity    int64  // later can be minimum capacity
	Roundup     int64  // ignore for now; can be used to round-up capacity
	InitialSend int64  // Initial send of -1 means "ALL"
	Data        [32]byte
}

------------------------- fund

type GetContractArgs

type GetContractArgs struct {
	Idx uint64
}

type GetContractReply

type GetContractReply struct {
	Contract *lnutil.DlcContract
}

type ImportOracleArgs

type ImportOracleArgs struct {
	Url  string
	Name string
}

type ImportOracleReply

type ImportOracleReply struct {
	Oracle *dlc.DlcOracle
}

type ListConnectionsReply

type ListConnectionsReply struct {
	Connections []qln.PeerInfo
	MyPKH       string
}

type ListContractsArgs

type ListContractsArgs struct {
}

type ListContractsReply

type ListContractsReply struct {
	Contracts []*lnutil.DlcContract
}

type ListOraclesArgs

type ListOraclesArgs struct {
}

type ListOraclesReply

type ListOraclesReply struct {
	Oracles []*dlc.DlcOracle
}

type ListenArgs

type ListenArgs struct {
	Port string
}

type ListeningPortsReply

type ListeningPortsReply struct {
	LisIpPorts []string
	Adr        string
}

type LitRPC

type LitRPC struct {
	Node      *qln.LitNode
	OffButton chan bool
}

func (*LitRPC) AcceptContract

func (r *LitRPC) AcceptContract(args AcceptContractArgs,
	reply *AcceptContractReply) error

AcceptContract accepts an offered contract and will initiate a signature-exchange for settlement and then for funding

func (*LitRPC) AddOracle

func (r *LitRPC) AddOracle(args AddOracleArgs, reply *AddOracleReply) error

AddOracle manually adds an oracle from its PubKey A

func (*LitRPC) Address

func (r *LitRPC) Address(args *AddressArgs, reply *AddressReply) error

func (*LitRPC) AssignNickname

func (r *LitRPC) AssignNickname(args AssignNicknameArgs, reply *StatusReply) error

func (*LitRPC) Balance

func (r *LitRPC) Balance(args *NoArgs, reply *BalanceReply) error

func (*LitRPC) BreakChannel

func (r *LitRPC) BreakChannel(args ChanArgs, reply *StatusReply) error

------------------------- break

func (*LitRPC) ChannelList

func (r *LitRPC) ChannelList(args ChanArgs, reply *ChannelListReply) error

ChannelList sends back a list of every (open?) channel with some info for each.

func (*LitRPC) CloseChannel

func (r *LitRPC) CloseChannel(args ChanArgs, reply *StatusReply) error

reply with status string CloseChannel is a cooperative closing of a channel to a specified address.

func (*LitRPC) Connect

func (r *LitRPC) Connect(args ConnectArgs, reply *StatusReply) error

func (*LitRPC) DeclineContract

func (r *LitRPC) DeclineContract(args DeclineContractArgs,
	reply *DeclineContractReply) error

DeclineContract declines an offered contract

func (*LitRPC) DualFundAccept

func (r *LitRPC) DualFundAccept(args DualFundAcceptArgs, reply *StatusReply) error

func (*LitRPC) DualFundChannel

func (r *LitRPC) DualFundChannel(args DualFundArgs, reply *StatusReply) error

func (*LitRPC) DualFundDecline

func (r *LitRPC) DualFundDecline(args DualFundDeclineArgs, reply *StatusReply) error

func (*LitRPC) DumpPrivs

func (r *LitRPC) DumpPrivs(args NoArgs, reply *DumpReply) error

DumpPrivs returns WIF private keys for every utxo and channel

func (*LitRPC) Fanout

func (r *LitRPC) Fanout(args FanArgs, reply *TxidsReply) error

func (*LitRPC) FundChannel

func (r *LitRPC) FundChannel(args FundArgs, reply *StatusReply) error

func (*LitRPC) GetChannelMap

func (r *LitRPC) GetChannelMap(args NoArgs, reply *ChannelGraphReply) error

func (*LitRPC) GetContract

func (r *LitRPC) GetContract(args GetContractArgs,
	reply *GetContractReply) error

GetContract returns a single contract based on its index

func (*LitRPC) GetFee

func (r *LitRPC) GetFee(args *FeeArgs, reply *FeeReply) error

Fee gets the fee rate for a wallet.

func (*LitRPC) GetListeningPorts

func (r *LitRPC) GetListeningPorts(args NoArgs, reply *ListeningPortsReply) error

func (*LitRPC) GetMessages

func (r *LitRPC) GetMessages(args NoArgs, reply *StatusReply) error

------- receive chat

func (*LitRPC) ImportOracle

func (r *LitRPC) ImportOracle(args ImportOracleArgs,
	reply *ImportOracleReply) error

ImportOracle imports an oracle from a REST API

func (*LitRPC) ListConnections

func (r *LitRPC) ListConnections(args NoArgs, reply *ListConnectionsReply) error

func (*LitRPC) ListContracts

func (r *LitRPC) ListContracts(args ListContractsArgs,
	reply *ListContractsReply) error

ListContracts returns all contracts know to LIT

func (*LitRPC) ListOracles

func (r *LitRPC) ListOracles(args ListOraclesArgs,
	reply *ListOraclesReply) error

ListOracles returns all oracles know to LIT

func (*LitRPC) Listen

func (r *LitRPC) Listen(args ListenArgs, reply *ListeningPortsReply) error

func (*LitRPC) NewContract

func (r *LitRPC) NewContract(args NewContractArgs,
	reply *NewContractReply) error

NewContract creates a new draft contract

func (*LitRPC) OfferContract

func (r *LitRPC) OfferContract(args OfferContractArgs,
	reply *OfferContractReply) error

OfferContract offers a contract to a (connected) peer

func (*LitRPC) PendingDualFund

func (r *LitRPC) PendingDualFund(args PendingDualFundRequestsArgs, reply *PendingDualFundReply) error

func (*LitRPC) Push

func (r *LitRPC) Push(args PushArgs, reply *PushReply) error

func (*LitRPC) Say

func (r *LitRPC) Say(args SayArgs, reply *StatusReply) error

func (*LitRPC) Send

func (r *LitRPC) Send(args SendArgs, reply *TxidsReply) error

func (*LitRPC) SetContractCoinType

func (r *LitRPC) SetContractCoinType(args SetContractCoinTypeArgs,
	reply *SetContractCoinTypeReply) error

SetContractCoinType sets the coin type the contract will be in. Note that a peer that doesn't have a wallet of that type will automatically decline the contract.

func (*LitRPC) SetContractDatafeed

func (r *LitRPC) SetContractDatafeed(args SetContractDatafeedArgs,
	reply *SetContractDatafeedReply) error

SetContractDatafeed sets a data feed by index to a contract, which is then used to fetch the R-point from the oracle's REST API

func (*LitRPC) SetContractDivision

func (r *LitRPC) SetContractDivision(args SetContractDivisionArgs,
	reply *SetContractDivisionReply) error

SetContractDivision sets how the contract is settled. The parameters indicate at what value the full contract funds are ours, and at what value they are full funds are for our peer. Between those values, the contract will divide the contract funds linearly

func (*LitRPC) SetContractFunding

func (r *LitRPC) SetContractFunding(args SetContractFundingArgs,
	reply *SetContractFundingReply) error

SetContractFunding sets the division in funding the channel. The arguments decide how much we're funding and how much we expect the peer we offer the contract to to fund

func (*LitRPC) SetContractOracle

func (r *LitRPC) SetContractOracle(args SetContractOracleArgs,
	reply *SetContractOracleReply) error

SetContractOracle assigns a known oracle to a (new) contract

func (*LitRPC) SetContractRPoint

func (r *LitRPC) SetContractRPoint(args SetContractRPointArgs,
	reply *SetContractRPointReply) error

SetContractRPoint manually sets the R-point for the contract using a pubkey

func (*LitRPC) SetContractSettlementTime

func (r *LitRPC) SetContractSettlementTime(args SetContractSettlementTimeArgs,
	reply *SetContractSettlementTimeReply) error

SetContractSettlementTime sets the time this contract will settle (the unix epoch)

func (*LitRPC) SetFee

func (r *LitRPC) SetFee(args *SetFeeArgs, reply *FeeReply) error

SetFee allows you to set a fee rate for a wallet.

func (*LitRPC) SettleContract

func (r *LitRPC) SettleContract(args SettleContractArgs,
	reply *SettleContractReply) error

SettleContract uses the value and signature from the oracle to settle the contract and send the equivalent settlement transaction to the blockchain. It will subsequently claim the contract output back to our wallet

func (*LitRPC) StateDump

func (r *LitRPC) StateDump(args StateDumpArgs, reply *StateDumpReply) error

StateDump dumps all of the meta data for the state commitments of a channel

func (*LitRPC) Stop

func (r *LitRPC) Stop(args NoArgs, reply *StatusReply) error

func (*LitRPC) Sweep

func (r *LitRPC) Sweep(args SweepArgs, reply *TxidsReply) error

func (*LitRPC) TxoList

func (r *LitRPC) TxoList(args *NoArgs, reply *TxoListReply) error

TxoList sends back a list of all non-channel utxos

func (*LitRPC) Watch

func (r *LitRPC) Watch(args WatchArgs, reply *WatchReply) error

type NewContractArgs

type NewContractArgs struct {
}

type NewContractReply

type NewContractReply struct {
	Contract *lnutil.DlcContract
}

type NoArgs

type NoArgs struct {
}

type OfferContractArgs

type OfferContractArgs struct {
	CIdx    uint64
	PeerIdx uint32
}

type OfferContractReply

type OfferContractReply struct {
	Success bool
}

type PendingDualFundReply

type PendingDualFundReply struct {
	Pending         bool
	PeerIdx         uint32
	CoinType        uint32
	TheirAmount     int64
	RequestedAmount int64
}

type PendingDualFundRequestsArgs

type PendingDualFundRequestsArgs struct {
}

type PrivInfo

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

	WIF string
}

------------------------- dumpPriv

type PushArgs

type PushArgs struct {
	ChanIdx uint32
	Amt     int64
	Data    [32]byte
}

------------------------- push

type PushReply

type PushReply struct {
	StateIndex uint64
}

type SayArgs

type SayArgs struct {
	Peer    uint32
	Message string
}

type SendArgs

type SendArgs struct {
	DestAddrs []string
	Amts      []int64
}

------------------------- send

type SetContractCoinTypeArgs

type SetContractCoinTypeArgs struct {
	CIdx     uint64
	CoinType uint32
}

type SetContractCoinTypeReply

type SetContractCoinTypeReply struct {
	Success bool
}

type SetContractDatafeedArgs

type SetContractDatafeedArgs struct {
	CIdx uint64
	Feed uint64
}

type SetContractDatafeedReply

type SetContractDatafeedReply struct {
	Success bool
}

type SetContractDivisionArgs

type SetContractDivisionArgs struct {
	CIdx             uint64
	ValueFullyOurs   int64
	ValueFullyTheirs int64
}

type SetContractDivisionReply

type SetContractDivisionReply struct {
	Success bool
}

type SetContractFundingArgs

type SetContractFundingArgs struct {
	CIdx        uint64
	OurAmount   int64
	TheirAmount int64
}

type SetContractFundingReply

type SetContractFundingReply struct {
	Success bool
}

type SetContractOracleArgs

type SetContractOracleArgs struct {
	CIdx uint64
	OIdx uint64
}

type SetContractOracleReply

type SetContractOracleReply struct {
	Success bool
}

type SetContractRPointArgs

type SetContractRPointArgs struct {
	CIdx   uint64
	RPoint [33]byte
}

type SetContractRPointReply

type SetContractRPointReply struct {
	Success bool
}

type SetContractSettlementTimeArgs

type SetContractSettlementTimeArgs struct {
	CIdx uint64
	Time uint64
}

type SetContractSettlementTimeReply

type SetContractSettlementTimeReply struct {
	Success bool
}

type SetFeeArgs

type SetFeeArgs struct {
	Fee      int64
	CoinType uint32
}

set fee

type SettleContractArgs

type SettleContractArgs struct {
	CIdx        uint64
	OracleValue int64
	OracleSig   [32]byte
}

type SettleContractReply

type SettleContractReply struct {
	Success      bool
	SettleTxHash [32]byte
	ClaimTxHash  [32]byte
}

type StateDumpArgs

type StateDumpArgs struct {
}

------------------------- statedump

type StateDumpReply

type StateDumpReply struct {
	Txs []qln.JusticeTx
}

type StatusReply

type StatusReply struct {
	Status string
}

type SweepArgs

type SweepArgs struct {
	DestAdr string
	NumTx   uint32
	Drop    bool
}

------------------------- sweep

type TxidsReply

type TxidsReply struct {
	Txids []string
}

type TxoInfo

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

	KeyPath string
}

type TxoListReply

type TxoListReply struct {
	Txos []TxoInfo
}

type WatchArgs

type WatchArgs struct {
	ChanIdx, SendToPeer uint32
}

type WatchReply

type WatchReply struct {
	Msg string
}

Jump to

Keyboard shortcuts

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