models.go raw
1 package models
2
3 import (
4 "encoding/json"
5 )
6
7 const (
8 INFO_EVENT_KIND = 13194
9 REQUEST_KIND = 23194
10 RESPONSE_KIND = 23195
11 LEGACY_NOTIFICATION_KIND = 23196
12 NOTIFICATION_KIND = 23197
13
14 // request methods
15 PAY_INVOICE_METHOD = "pay_invoice"
16 GET_BALANCE_METHOD = "get_balance"
17 GET_BUDGET_METHOD = "get_budget"
18 GET_INFO_METHOD = "get_info"
19 MAKE_INVOICE_METHOD = "make_invoice"
20 LOOKUP_INVOICE_METHOD = "lookup_invoice"
21 LIST_TRANSACTIONS_METHOD = "list_transactions"
22 PAY_KEYSEND_METHOD = "pay_keysend"
23 MULTI_PAY_INVOICE_METHOD = "multi_pay_invoice"
24 MULTI_PAY_KEYSEND_METHOD = "multi_pay_keysend"
25 SIGN_MESSAGE_METHOD = "sign_message"
26 CREATE_CONNECTION_METHOD = "create_connection"
27 MAKE_HOLD_INVOICE_METHOD = "make_hold_invoice"
28 CANCEL_HOLD_INVOICE_METHOD = "cancel_hold_invoice"
29 SETTLE_HOLD_INVOICE_METHOD = "settle_hold_invoice"
30 )
31
32 type Transaction struct {
33 Type string `json:"type"`
34 State string `json:"state"`
35 Invoice string `json:"invoice"`
36 Description string `json:"description"`
37 DescriptionHash string `json:"description_hash"`
38 Preimage string `json:"preimage"`
39 PaymentHash string `json:"payment_hash"`
40 Amount int64 `json:"amount"`
41 FeesPaid int64 `json:"fees_paid"`
42 CreatedAt int64 `json:"created_at"`
43 ExpiresAt *int64 `json:"expires_at"`
44 SettledAt *int64 `json:"settled_at"`
45 SettleDeadline *uint32 `json:"settle_deadline"` // block number for accepted hold invoices
46 Metadata interface{} `json:"metadata,omitempty"`
47 }
48
49 type PayRequest struct {
50 Invoice string `json:"invoice"`
51 }
52
53 type Request struct {
54 Method string `json:"method"`
55 Params json.RawMessage `json:"params"`
56 }
57
58 type Response struct {
59 Error *Error `json:"error,omitempty"`
60 Result interface{} `json:"result,omitempty"`
61 ResultType string `json:"result_type"`
62 }
63
64 type Error struct {
65 Code string `json:"code,omitempty"`
66 Message string `json:"message,omitempty"`
67 }
68