commons

package
v0.10.0-alpha6 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Active = Status(iota)
	Inactive
	Pending
	Deleted
)
View Source
const (
	LND = Implementation(iota)
	CLN
)
View Source
const (
	Bitcoin = Chain(iota)
	Litecoin
)
View Source
const (
	MainNet = Network(iota)
	SigNet
	SimNet
	RegTest
	TestNet
)
View Source
const (
	Opening = ChannelStatus(iota)
	Open
	Closing
	CooperativeClosed      = 100
	LocalForceClosed       = 101
	RemoteForceClosed      = 102
	BreachClosed           = 103
	FundingCancelledClosed = 104
	AbandonedClosed        = 105
)

Variables

View Source
var ManagedChannelChannel = make(chan ManagedChannel) //nolint:gochecknoglobals
View Source
var ManagedNodeChannel = make(chan ManagedNode) //nolint:gochecknoglobals
View Source
var ManagedSettingsChannel = make(chan ManagedSettings) //nolint:gochecknoglobals

Functions

func GetActiveChannelIdFromFundingTransaction

func GetActiveChannelIdFromFundingTransaction(fundingTransactionHash string, fundingOutputIndex int) int

func GetActiveChannelIdFromShortChannelId

func GetActiveChannelIdFromShortChannelId(shortChannelId string) int

func GetActiveNodeIdFromPublicKey

func GetActiveNodeIdFromPublicKey(publicKey string, chain Chain, network Network) int

func GetActiveTorqNodeIdFromPublicKey

func GetActiveTorqNodeIdFromPublicKey(publicKey string, chain Chain, network Network) int

func GetAllChannelPublicKeys

func GetAllChannelPublicKeys(chain Chain, network Network) []string

func GetAllTorqNodeIds

func GetAllTorqNodeIds(chain Chain, network Network) []int

func GetAllTorqPublicKeys

func GetAllTorqPublicKeys(chain Chain, network Network) []string

func GetChannelIdFromFundingTransaction

func GetChannelIdFromFundingTransaction(fundingTransactionHash string, fundingOutputIndex int) int

func GetChannelIdFromShortChannelId

func GetChannelIdFromShortChannelId(shortChannelId string) int

func GetChannelNodeIds

func GetChannelNodeIds(chain Chain, network Network) []int

func GetChannelPublicKeys

func GetChannelPublicKeys(chain Chain, network Network) []string

func GetNodeIdFromPublicKey

func GetNodeIdFromPublicKey(publicKey string, chain Chain, network Network) int

func InactivateChannelNode

func InactivateChannelNode(publicKey string, chain Chain, network Network)

func ManagedChannelCache

func ManagedChannelCache(ch chan ManagedChannel, ctx context.Context)

ManagedChannelCache parameter Context is for test cases...

func ManagedNodeCache

func ManagedNodeCache(ch chan ManagedNode, ctx context.Context)

ManagedNodeCache parameter Context is for test cases...

func ManagedSettingsCache

func ManagedSettingsCache(ch chan ManagedSettings, ctx context.Context)

ManagedSettingsCache parameter Context is for test cases...

func SendToManagedChannelChannel

func SendToManagedChannelChannel(ch chan ManagedChannel, managedChannel ManagedChannel)

func SendToManagedChannelSettingsChannel

func SendToManagedChannelSettingsChannel(ch chan ManagedChannelSettings, channelSettings ManagedChannelSettings)

func SendToManagedNodeChannel

func SendToManagedNodeChannel(ch chan ManagedNode, managedNode ManagedNode)

func SendToManagedNodeIdsChannel

func SendToManagedNodeIdsChannel(ch chan []int, channelIds []int)

func SendToManagedNodeSettingsChannel

func SendToManagedNodeSettingsChannel(ch chan ManagedNodeSettings, nodeSettings ManagedNodeSettings)

func SendToManagedPublicKeysChannel

func SendToManagedPublicKeysChannel(ch chan []string, publicKeys []string)

func SendToManagedSettingsChannel

func SendToManagedSettingsChannel(ch chan ManagedSettings, managedSettings ManagedSettings)

func SetChannel

func SetChannel(channelId int, shortChannelId *string, status ChannelStatus, fundingTransactionHash string, fundingOutputIndex int)

func SetChannelNode

func SetChannelNode(nodeId int, publicKey string, chain Chain, network Network, status ChannelStatus)

func SetChannelStatus

func SetChannelStatus(channelId int, status ChannelStatus)

func SetInactiveChannelNode

func SetInactiveChannelNode(nodeId int, publicKey string, chain Chain, network Network)

func SetSettings

func SetSettings(defaultDateRange, defaultLanguage, weekStartsOn, preferredTimeZone string)

func SetTorqNode

func SetTorqNode(nodeId int, status Status, publicKey string, chain Chain, network Network)

SetTorqNode When active then also adds to channelNodes

Types

type Chain

type Chain int

func GetChain

func GetChain(chain string) Chain

GetChain defaults to Bitcoin when no match is found

type ChannelStatus

type ChannelStatus int

func GetChannelStatusFromChannelId

func GetChannelStatusFromChannelId(channelId int) ChannelStatus

type Implementation

type Implementation int

type ManagedChannel

type ManagedChannel struct {
	Type                   ManagedChannelCacheOperationType
	ChannelId              int
	ShortChannelId         string
	FundingTransactionHash string
	FundingOutputIndex     int
	Status                 ChannelStatus
	Out                    chan ManagedChannel
	ChannelIdSettingsOut   chan ManagedChannelSettings
}

type ManagedChannelCacheOperationType

type ManagedChannelCacheOperationType uint
const (
	// READ_ACTIVE_CHANNELID_BY_SHORTCHANNELID please provide ShortChannelId and Out
	READ_ACTIVE_CHANNELID_BY_SHORTCHANNELID ManagedChannelCacheOperationType = iota
	// READ_CHANNELID_BY_SHORTCHANNELID please provide ShortChannelId and Out
	READ_CHANNELID_BY_SHORTCHANNELID
	// READ_ACTIVE_CHANNELID_BY_FUNDING_TRANSACTION please provide FundingTransactionHash, FundingOutputIndex and Out
	READ_ACTIVE_CHANNELID_BY_FUNDING_TRANSACTION
	// READ_CHANNELID_BY_FUNDING_TRANSACTION please provide FundingTransactionHash, FundingOutputIndex and Out
	READ_CHANNELID_BY_FUNDING_TRANSACTION
	// READ_STATUSID_BY_CHANNELID please provide ChannelId and Out
	READ_STATUSID_BY_CHANNELID
	// READ_CHANNEL_SETTINGS please provide ChannelId and ChannelIdSettingsOut
	READ_CHANNEL_SETTINGS
	// WRITE_CHANNEL Please provide ChannelId, FundingTransactionHash, FundingOutputIndex and Status (other values are optional in case of pending open channel)
	WRITE_CHANNEL
	// WRITE_CHANNELSTATUSID Please provide ChannelId and Status
	WRITE_CHANNELSTATUSID
)

type ManagedChannelSettings

type ManagedChannelSettings struct {
	ChannelId              int
	ShortChannelId         string
	FundingTransactionHash string
	FundingOutputIndex     int
	Status                 ChannelStatus
}

func GetChannelSettingsFromChannelId

func GetChannelSettingsFromChannelId(channelId int) ManagedChannelSettings

type ManagedNode

type ManagedNode struct {
	Type              ManagedNodeCacheOperationType
	NodeId            int
	Chain             *Chain
	Network           *Network
	PublicKey         string
	Out               chan ManagedNode
	NodeIdsOut        chan []int
	NodeIdSettingsOut chan ManagedNodeSettings
	PublicKeysOut     chan []string
}

type ManagedNodeCacheOperationType

type ManagedNodeCacheOperationType uint
const (
	READ_ALL_TORQ_NODE ManagedNodeCacheOperationType = iota
	WRITE_INACTIVE_TORQ_NODE
	READ_ALL_TORQ_NODEIDS
	READ_ALL_TORQ_PUBLICKEYS
	READ_ACTIVE_TORQ_NODE
	WRITE_ACTIVE_TORQ_NODE
	READ_ACTIVE_TORQ_NODEIDS
	READ_ACTIVE_TORQ_PUBLICKEYS
	READ_ACTIVE_CHANNEL_NODE
	READ_CHANNEL_NODE
	WRITE_ACTIVE_CHANNEL_NODE
	WRITE_INACTIVE_CHANNEL_NODE
	INACTIVATE_CHANNEL_NODE
	READ_ALL_CHANNEL_NODEIDS
	READ_ALL_CHANNEL_PUBLICKEYS
	READ_NODE_SETTINGS
)

type ManagedNodeSettings

type ManagedNodeSettings struct {
	NodeId    int
	Chain     Chain
	Network   Network
	PublicKey string
	Status    Status
}

func GetNodeSettingsByNodeId

func GetNodeSettingsByNodeId(nodeId int) ManagedNodeSettings

type ManagedSettings

type ManagedSettings struct {
	Type              ManagedSettingsCacheOperationType
	DefaultLanguage   string
	PreferredTimeZone string
	DefaultDateRange  string
	WeekStartsOn      string
	Out               chan ManagedSettings
}

func GetSettings

func GetSettings() ManagedSettings

type ManagedSettingsCacheOperationType

type ManagedSettingsCacheOperationType uint
const (
	// READ please provide Out
	READ ManagedSettingsCacheOperationType = iota
	// WRITE please provide defaultLanguage, preferredTimeZone, defaultDateRange and weekStartsOn
	WRITE
)

type Network

type Network int

func GetNetwork

func GetNetwork(network string) Network

GetNetwork defaults to MainNet when no match is found

type Status

type Status int

Jump to

Keyboard shortcuts

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