Documentation
¶
Index ¶
- Constants
- Variables
- func CreateApp(svc *TestService) (app *db.App, cipher *cipher.Nip47Cipher, err error)
- func CreateAppWithPrivateKey(svc *TestService, senderPrivkey, nip47Encryption string) (app *db.App, nip47Cipher *cipher.Nip47Cipher, err error)
- func CreateAppWithSharedWalletPubkey(svc *TestService, senderPrivkey, nip47Encryption string) (app *db.App, nip47Cipher *cipher.Nip47Cipher, err error)
- func NewMockEventConsumer() *mockEventConsumer
- func NewMockSimplePool() *mockSimplePool
- type CreateAppFn
- type MockLn
- func (mln *MockLn) CancelHoldInvoice(ctx context.Context, paymentHash string) (err error)
- func (mln *MockLn) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error)
- func (mln *MockLn) ConnectPeer(ctx context.Context, connectPeerRequest *lnclient.ConnectPeerRequest) error
- func (mln *MockLn) DisconnectPeer(ctx context.Context, peerId string) error
- func (mln *MockLn) ExecuteCustomNodeCommand(ctx context.Context, command *lnclient.CustomNodeCommandRequest) (*lnclient.CustomNodeCommandResponse, error)
- func (mln *MockLn) GetBalances(ctx context.Context, includeInactiveChannels bool) (*lnclient.BalancesResponse, error)
- func (mln *MockLn) GetCustomNodeCommandDefinitions() []lnclient.CustomNodeCommandDef
- func (mln *MockLn) GetInfo(ctx context.Context) (info *lnclient.NodeInfo, err error)
- func (mln *MockLn) GetLogOutput(ctx context.Context, maxLen int) ([]byte, error)
- func (mln *MockLn) GetNetworkGraph(ctx context.Context, nodeIds []string) (lnclient.NetworkGraphResponse, error)
- func (mln *MockLn) GetNewOnchainAddress(ctx context.Context) (string, error)
- func (mln *MockLn) GetNodeConnectionInfo(ctx context.Context) (nodeConnectionInfo *lnclient.NodeConnectionInfo, err error)
- func (mln *MockLn) GetNodeStatus(ctx context.Context) (nodeStatus *lnclient.NodeStatus, err error)
- func (mln *MockLn) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainBalanceResponse, error)
- func (mln *MockLn) GetPubkey() string
- func (mln *MockLn) GetStorageDir() (string, error)
- func (mln *MockLn) GetSupportedNIP47Methods() []string
- func (mln *MockLn) GetSupportedNIP47NotificationTypes() []string
- func (mln *MockLn) ListChannels(ctx context.Context) (channels []lnclient.Channel, err error)
- func (mln *MockLn) ListOnchainTransactions(ctx context.Context) ([]lnclient.OnchainTransaction, error)
- func (mln *MockLn) ListPeers(ctx context.Context) ([]lnclient.PeerDetails, error)
- func (mln *MockLn) ListTransactions(ctx context.Context, from, until, limit, offset uint64, unpaid bool, ...) (invoices []lnclient.Transaction, err error)
- func (mln *MockLn) LookupInvoice(ctx context.Context, paymentHash string) (transaction *lnclient.Transaction, err error)
- func (mln *MockLn) MakeHoldInvoice(ctx context.Context, amount int64, description string, descriptionHash string, ...) (transaction *lnclient.Transaction, err error)
- func (mln *MockLn) MakeInvoice(ctx context.Context, amount int64, description string, descriptionHash string, ...) (transaction *lnclient.Transaction, err error)
- func (mln *MockLn) MakeOffer(ctx context.Context, description string) (string, error)
- func (mln *MockLn) OpenChannel(ctx context.Context, openChannelRequest *lnclient.OpenChannelRequest) (*lnclient.OpenChannelResponse, error)
- func (mln *MockLn) RedeemOnchainFunds(ctx context.Context, toAddress string, amount uint64, feeRate *uint64, ...) (txId string, err error)
- func (mln *MockLn) ResetRouter(key string) error
- func (mln *MockLn) SendKeysend(amount uint64, destination string, custom_records []lnclient.TLVRecord, ...) (*lnclient.PayKeysendResponse, error)
- func (mln *MockLn) SendPaymentProbes(ctx context.Context, invoice string) error
- func (mln *MockLn) SendPaymentSync(payReq string, amount *uint64) (*lnclient.PayInvoiceResponse, error)
- func (mln *MockLn) SendSpontaneousPaymentProbes(ctx context.Context, amountMsat uint64, nodeId string) error
- func (mln *MockLn) SettleHoldInvoice(ctx context.Context, preimage string) (err error)
- func (mln *MockLn) Shutdown() error
- func (mln *MockLn) SignMessage(ctx context.Context, message string) (string, error)
- func (mln *MockLn) UpdateChannel(ctx context.Context, updateChannelRequest *lnclient.UpdateChannelRequest) error
- func (mln *MockLn) UpdateLastWalletSyncRequest()
- type TestService
Constants ¶
View Source
const MockInvoice = "" /* 322-byte string literal not displayed */
View Source
const MockPaymentHash = "23277d5e13fce5534f9752c62fcf9337a2a6b0ebea9d21fa816a4c9d054cf93b" // for the above invoice
View Source
const MockPaymentHash500 = "be8ad5d0b82071d538dcd160e3a3af444bd890de68388a4d771ba23c01096f2a"
for the invoice: lnbcrt5u1pjuywzppp5h69dt59cypca2wxu69sw8ga0g39a3yx7dqug5nthrw3rcqgfdu4qdqqcqzzsxqyz5vqsp5gzlpzszyj2k30qmpme7jsfzr24wqlvt9xdmr7ay34lfelz050krs9qyyssq038x07nh8yuv8hdpjh5y8kqp7zcd62ql9na9xh7pla44htjyy02sz23q7qm2tza6ct4ypljk54w9k9qsrsu95usk8ce726ytep6vhhsq9mhf9a
View Source
const MockZeroAmountInvoice = "" /* 330-byte string literal not displayed */
View Source
const MockZeroAmountPaymentHash = "8c4859ba70ed96328bec21b6c2f97d5453dc8c88bc56533209711701a8ff4211"
Variables ¶
View Source
var MockLNClientBalances = lnclient.BalancesResponse{ Lightning: lnclient.LightningBalanceResponse{ TotalSpendable: 21000, }, }
View Source
var MockLNClientHoldTransaction = &lnclient.Transaction{
Type: "incoming",
Invoice: "lntb10n1p5zg5p7dqud4hkx6eqdphkcepqd9h8vmmfvdjsnp4qw988hn4lhpu0my4rf0qkraft3wdx5aa0jnjmusgd23z3s0e9qv62pp5yaulxt6x83u4u0x2pck5pyg7fdxhjsd65c9lmu2a9r05qh0cgl6ssp5x57tsnnuc9hr99a9xzg5ylqma5fwvckxa50jqqay5zykqp83h9kq9qyysgqcqpcxqxf92hqqxh0avuskdnuzkk7mxslsdwem3qq3sf79a4ypmx0hax3rupp043yhv97h25vaarj0xrlcg2fdfdhpztsthettskyaylrz6vweztn0twqqv7kxmr",
Description: "mock hold invoice",
DescriptionHash: "",
Preimage: "4aa083cad11038359b4f614f3a3d6a8298ae17d5275412bc3eca4f5f4d27f2d4",
PaymentHash: "2779f32f463c795e3cca0e2d40911e4b4d7941baa60bfdf15d28df405df847f5",
Amount: 2000,
}
View Source
var MockLNClientTransaction = &MockLNClientTransactions[0]
View Source
var MockLNClientTransactions = []lnclient.Transaction{ { Type: "incoming", Invoice: MockInvoice, Description: "mock invoice 1", DescriptionHash: "hash1", Preimage: "preimage1", PaymentHash: MockPaymentHash, Amount: 1000, FeesPaid: 50, SettledAt: &MockTimeUnix, Metadata: map[string]interface{}{ "key1": "value1", "key2": 42, }, }, { Type: "incoming", Invoice: MockInvoice, Description: "mock invoice 2", DescriptionHash: "hash2", Preimage: "preimage2", PaymentHash: MockPaymentHash, Amount: 2000, FeesPaid: 75, SettledAt: &MockTimeUnix, }, }
View Source
var MockNodeInfo = lnclient.NodeInfo{
Alias: "bob",
Color: "#3399FF",
Pubkey: "123pubkey",
Network: "testnet",
BlockHeight: 12,
BlockHash: "123blockhash",
}
View Source
var MockTime = time.Unix(1693876963, 0)
View Source
var MockTimeUnix = MockTime.Unix()
Functions ¶
func CreateApp ¶
func CreateApp(svc *TestService) (app *db.App, cipher *cipher.Nip47Cipher, err error)
func CreateAppWithPrivateKey ¶ added in v1.2.0
func CreateAppWithPrivateKey(svc *TestService, senderPrivkey, nip47Encryption string) (app *db.App, nip47Cipher *cipher.Nip47Cipher, err error)
func CreateAppWithSharedWalletPubkey ¶ added in v1.14.0
func CreateAppWithSharedWalletPubkey(svc *TestService, senderPrivkey, nip47Encryption string) (app *db.App, nip47Cipher *cipher.Nip47Cipher, err error)
func NewMockEventConsumer ¶ added in v1.6.0
func NewMockEventConsumer() *mockEventConsumer
func NewMockSimplePool ¶ added in v1.21.0
func NewMockSimplePool() *mockSimplePool
Types ¶
type CreateAppFn ¶ added in v1.14.0
type CreateAppFn func(svc *TestService, senderPrivkey string, nip47Encryption string) (app *db.App, nip47Cipher *cipher.Nip47Cipher, err error)
type MockLn ¶
type MockLn struct {
PayInvoiceResponses []*lnclient.PayInvoiceResponse
PayInvoiceErrors []error
PaymentDelay *time.Duration
Pubkey string
MockTransaction *lnclient.Transaction
SupportedNotificationTypes *[]string
}
func (*MockLn) CancelHoldInvoice ¶ added in v1.18.0
func (*MockLn) CloseChannel ¶
func (mln *MockLn) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error)
func (*MockLn) ConnectPeer ¶
func (*MockLn) DisconnectPeer ¶
func (*MockLn) ExecuteCustomNodeCommand ¶ added in v1.14.0
func (mln *MockLn) ExecuteCustomNodeCommand(ctx context.Context, command *lnclient.CustomNodeCommandRequest) (*lnclient.CustomNodeCommandResponse, error)
func (*MockLn) GetBalances ¶
func (*MockLn) GetCustomNodeCommandDefinitions ¶ added in v1.14.0
func (mln *MockLn) GetCustomNodeCommandDefinitions() []lnclient.CustomNodeCommandDef
func (*MockLn) GetLogOutput ¶
func (*MockLn) GetNetworkGraph ¶
func (*MockLn) GetNewOnchainAddress ¶
func (*MockLn) GetNodeConnectionInfo ¶
func (*MockLn) GetNodeStatus ¶
func (*MockLn) GetOnchainBalance ¶
func (*MockLn) GetStorageDir ¶
func (*MockLn) GetSupportedNIP47Methods ¶
func (*MockLn) GetSupportedNIP47NotificationTypes ¶
func (*MockLn) ListChannels ¶
func (*MockLn) ListOnchainTransactions ¶ added in v1.17.0
func (*MockLn) ListTransactions ¶
func (*MockLn) LookupInvoice ¶
func (*MockLn) MakeHoldInvoice ¶ added in v1.18.0
func (*MockLn) MakeInvoice ¶
func (*MockLn) OpenChannel ¶
func (mln *MockLn) OpenChannel(ctx context.Context, openChannelRequest *lnclient.OpenChannelRequest) (*lnclient.OpenChannelResponse, error)
func (*MockLn) RedeemOnchainFunds ¶
func (*MockLn) ResetRouter ¶
func (*MockLn) SendKeysend ¶
func (*MockLn) SendPaymentProbes ¶
func (*MockLn) SendPaymentSync ¶
func (*MockLn) SendSpontaneousPaymentProbes ¶
func (*MockLn) SettleHoldInvoice ¶ added in v1.18.0
func (*MockLn) SignMessage ¶
func (*MockLn) UpdateChannel ¶
func (*MockLn) UpdateLastWalletSyncRequest ¶
func (mln *MockLn) UpdateLastWalletSyncRequest()
type TestService ¶
type TestService struct {
Keys keys.Keys
Cfg config.Config
LNClient lnclient.LNClient
EventPublisher events.EventPublisher
AppsService apps.AppsService
DB *gorm.DB
}
func CreateTestService ¶
func CreateTestService(t *testing.T) (svc *TestService, err error)
func CreateTestServiceWithMnemonic ¶ added in v1.11.0
func (*TestService) Remove ¶ added in v1.14.0
func (s *TestService) Remove()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.