forked from bolt-observer/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_mock.go
111 lines (87 loc) · 3.97 KB
/
api_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package lightning
import (
"context"
"fmt"
"strconv"
"time"
)
type MockLightningAPI struct {
Trace string
}
func (m *MockLightningAPI) Cleanup() {}
func (m *MockLightningAPI) GetInfo(ctx context.Context) (*InfoAPI, error) {
m.Trace += "getinfo"
return &InfoAPI{IdentityPubkey: "fake"}, nil
}
func (m *MockLightningAPI) GetChannels(ctx context.Context) (*ChannelsAPI, error) {
m.Trace += "getchannels"
return &ChannelsAPI{Channels: []ChannelAPI{{ChanID: 1, Capacity: 1}, {ChanID: 2, Capacity: 2, Private: true}}}, nil
}
func (m *MockLightningAPI) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphAPI, error) {
m.Trace += "describegraph" + strconv.FormatBool(unannounced)
return &DescribeGraphAPI{Nodes: []DescribeGraphNodeAPI{{PubKey: "fake"}},
Channels: []NodeChannelAPI{{ChannelID: 1, Capacity: 1, Node1Pub: "fake"}, {ChannelID: 2, Capacity: 2, Node2Pub: "fake"}}}, nil
}
func (m *MockLightningAPI) GetNodeInfoFull(ctx context.Context, channels, unannounced bool) (*NodeInfoAPIExtended, error) {
// Do not use
m.Trace += "wrong"
return nil, nil
}
func (m *MockLightningAPI) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoAPI, error) {
m.Trace += "getnodeinfo" + pubKey + strconv.FormatBool(channels)
return &NodeInfoAPI{Node: DescribeGraphNodeAPI{PubKey: "fake"},
Channels: []NodeChannelAPI{{ChannelID: 1, Capacity: 1}},
NumChannels: 2, TotalCapacity: 3}, nil
}
func (m *MockLightningAPI) GetChanInfo(ctx context.Context, chanID uint64) (*NodeChannelAPI, error) {
m.Trace += fmt.Sprintf("getchaninfo%d", chanID)
return &NodeChannelAPI{ChannelID: chanID, Capacity: chanID}, nil
}
func (m *MockLightningAPI) GetInvoices(ctx context.Context, pendingOnly bool, pagination Pagination) (*InvoicesResponse, error) {
panic("not implemented")
}
func (m *MockLightningAPI) SubscribeForwards(ctx context.Context, since time.Time, batchSize uint16, maxErrors uint16) (<-chan []ForwardingEvent, <-chan ErrorData) {
panic("not implemented")
}
func (m *MockLightningAPI) GetPayments(ctx context.Context, includeIncomplete bool, pagination Pagination) (*PaymentsResponse, error) {
panic("not implemented")
}
func (m *MockLightningAPI) GetInvoicesRaw(ctx context.Context, pendingOnly bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error) {
panic("not implemented")
}
func (m *MockLightningAPI) GetPaymentsRaw(ctx context.Context, includeIncomplete bool, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error) {
panic("not implemented")
}
func (m *MockLightningAPI) GetForwardsRaw(ctx context.Context, pagination RawPagination) ([]RawMessage, *ResponseRawPagination, error) {
panic("not implemented")
}
func (m *MockLightningAPI) GetAPIType() APIType {
panic("not implemented")
}
func (m *MockLightningAPI) ConnectPeer(ctx context.Context, id string) error {
panic("not implemented")
}
func (m *MockLightningAPI) GetOnChainAddress(ctx context.Context) (string, error) {
panic("not implemented")
}
func (m *MockLightningAPI) GetOnChainFunds(ctx context.Context) (*Funds, error) {
panic("not implemented")
}
func (m *MockLightningAPI) SendToOnChainAddress(ctx context.Context, address string, sats int64, useUnconfirmed bool, urgency Urgency) (string, error) {
panic("not implemented")
}
func (m *MockLightningAPI) PayInvoice(ctx context.Context, paymentRequest string, sats int64, outgoingChanIds []uint64) (*PaymentResp, error) {
panic("not implemented")
}
func (m *MockLightningAPI) GetPaymentStatus(ctx context.Context, paymentRequest string) (*PaymentResp, error) {
panic("not implemented")
}
func (m *MockLightningAPI) CreateInvoice(ctx context.Context, sats int64, preimage string, memo string, expiry time.Duration) (*InvoiceResp, error) {
panic("not implemented")
}
func (m *MockLightningAPI) IsInvoicePaid(ctx context.Context, paymentHash string) (bool, error) {
panic("not implemented")
}
func (m *MockLightningAPI) GetChannelCloseInfo(ctx context.Context, chanIDs []uint64) ([]CloseInfo, error) {
panic("not implemented")
}