lnlink-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +461 -0
- package/dist/app.js +11165 -0
- package/dist/binaries.json +20 -0
- package/dist/build-info.json +41 -0
- package/dist/config.default.js +19 -0
- package/dist/index.js +19002 -0
- package/dist/index.js.map +7 -0
- package/dist/package.json +61 -0
- package/dist/prisma/migrations/20250918020814_/migration.sql +188 -0
- package/dist/prisma/migrations/20251114105314_auto_update/migration.sql +2 -0
- package/dist/prisma/migrations/migration_lock.toml +3 -0
- package/dist/prisma/schema.prisma +181 -0
- package/dist/proto/chainkit.proto +74 -0
- package/dist/proto/lightning.proto +5411 -0
- package/dist/proto/lit-status.proto +36 -0
- package/dist/proto/looprpc/client.proto +1435 -0
- package/dist/proto/price_oracle.proto +243 -0
- package/dist/proto/rfqrpc/rfq.proto +436 -0
- package/dist/proto/routerrpc/router.proto +1136 -0
- package/dist/proto/signrpc/signer.proto +709 -0
- package/dist/proto/stateservice.proto +73 -0
- package/dist/proto/swapserverrpc/common.proto +37 -0
- package/dist/proto/tapchannel.proto +306 -0
- package/dist/proto/tapcommon.proto +36 -0
- package/dist/proto/taprootassets.proto +1959 -0
- package/dist/proto/universe.proto +1063 -0
- package/dist/proto/walletkit.proto +1594 -0
- package/dist/proto/walletunlocker.proto +338 -0
- package/dist/public/css/initOwner.css +553 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/init.html +70 -0
- package/dist/public/js/init.js +454 -0
- package/dist/setting.mainnet.json +22 -0
- package/dist/setting.regtest.json +22 -0
- package/dist/setting.testnet.json +22 -0
- package/package.json +91 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ln-link",
|
|
3
|
+
"version": "1.0.9-alpha",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"electron": "lnlink.js",
|
|
7
|
+
"description": "Lightning Network Link - A comprehensive Lightning Network node management solution",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"lightning",
|
|
10
|
+
"bitcoin",
|
|
11
|
+
"lnd",
|
|
12
|
+
"rgb",
|
|
13
|
+
"taproot",
|
|
14
|
+
"nostr",
|
|
15
|
+
"electron"
|
|
16
|
+
],
|
|
17
|
+
"author": "LNFI Network",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/lnfi-network/ln-link.git"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=19.0.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@grpc/grpc-js": "^1.10.8",
|
|
29
|
+
"@grpc/proto-loader": "^0.7.9",
|
|
30
|
+
"@lightsparkdev/lightspark-sdk": "^1.8.9",
|
|
31
|
+
"@lnfi-network/rgb-api-js-sdk": "^1.0.7",
|
|
32
|
+
"@prisma/client": "6.14.0",
|
|
33
|
+
"axios": "^1.7.2",
|
|
34
|
+
"bitcoin-core": "^4.2.0",
|
|
35
|
+
"body-parser": "^1.20.2",
|
|
36
|
+
"cookie-parser": "~1.4.4",
|
|
37
|
+
"crypto-js": "^4.2.0",
|
|
38
|
+
"dayjs": "^1.11.10",
|
|
39
|
+
"debug": "~2.6.9",
|
|
40
|
+
"decimal.js": "^10.4.3",
|
|
41
|
+
"ethers": "^6.15.0",
|
|
42
|
+
"express": "^4.18.2",
|
|
43
|
+
"express-rate-limit": "^8.0.1",
|
|
44
|
+
"find-process": "^2.0.0",
|
|
45
|
+
"form-data": "^4.0.2",
|
|
46
|
+
"http-errors": "~1.6.3",
|
|
47
|
+
"jest": "^29.6.2",
|
|
48
|
+
"long": "^5.2.3",
|
|
49
|
+
"module-alias": "^2.2.3",
|
|
50
|
+
"morgan": "~1.9.1",
|
|
51
|
+
"node-cache": "^5.1.2",
|
|
52
|
+
"node-cron": "^3.0.3",
|
|
53
|
+
"nostr-tools": "1.17.0",
|
|
54
|
+
"pino": "^9.9.0",
|
|
55
|
+
"pino-pretty": "^13.1.1",
|
|
56
|
+
"pino-roll": "^3.1.0",
|
|
57
|
+
"prisma": "^6.14.0",
|
|
58
|
+
"typescript": "^5.7.3",
|
|
59
|
+
"ws": "^8.18.0"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "lnlink_config" (
|
|
3
|
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
4
|
+
"owner_npub" TEXT,
|
|
5
|
+
"node_encrypted_sk" TEXT,
|
|
6
|
+
"node_npub" TEXT,
|
|
7
|
+
"settings" TEXT,
|
|
8
|
+
"create_at" INTEGER,
|
|
9
|
+
"update_at" INTEGER
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
-- CreateTable
|
|
13
|
+
CREATE TABLE "lnlink_nostr_events" (
|
|
14
|
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
15
|
+
"event_id" TEXT,
|
|
16
|
+
"content" TEXT,
|
|
17
|
+
"from_npub" TEXT,
|
|
18
|
+
"to_npub" TEXT,
|
|
19
|
+
"kind" INTEGER,
|
|
20
|
+
"tags" TEXT,
|
|
21
|
+
"reply_event_id" TEXT,
|
|
22
|
+
"reply_err" TEXT,
|
|
23
|
+
"status" INTEGER NOT NULL DEFAULT 0,
|
|
24
|
+
"create_at" INTEGER,
|
|
25
|
+
"reply_at" INTEGER
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
-- CreateTable
|
|
29
|
+
CREATE TABLE "lnlink_users" (
|
|
30
|
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
31
|
+
"name" TEXT,
|
|
32
|
+
"pubkey" TEXT,
|
|
33
|
+
"npub" TEXT,
|
|
34
|
+
"sk" TEXT,
|
|
35
|
+
"node_pubkey" TEXT,
|
|
36
|
+
"node_npub" TEXT,
|
|
37
|
+
"relay" TEXT,
|
|
38
|
+
"account_type" INTEGER,
|
|
39
|
+
"social_id" TEXT,
|
|
40
|
+
"social_type" INTEGER,
|
|
41
|
+
"auth_limit" TEXT,
|
|
42
|
+
"status" INTEGER DEFAULT 1,
|
|
43
|
+
"permissions" TEXT,
|
|
44
|
+
"asset_id" TEXT,
|
|
45
|
+
"parent_pubkey" TEXT,
|
|
46
|
+
"create_at" INTEGER,
|
|
47
|
+
"expire_time" INTEGER
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
-- CreateTable
|
|
51
|
+
CREATE TABLE "lnlink_transactions" (
|
|
52
|
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
53
|
+
"event_id" TEXT,
|
|
54
|
+
"user_npub" TEXT,
|
|
55
|
+
"asset_type" TEXT,
|
|
56
|
+
"asset_id" TEXT,
|
|
57
|
+
"asset_amount" TEXT,
|
|
58
|
+
"invoice" TEXT,
|
|
59
|
+
"status" INTEGER DEFAULT 0,
|
|
60
|
+
"create_at" INTEGER,
|
|
61
|
+
"update_at" INTEGER,
|
|
62
|
+
"node_type" TEXT NOT NULL,
|
|
63
|
+
"transaction_kind" TEXT NOT NULL,
|
|
64
|
+
"direction" TEXT,
|
|
65
|
+
"fees_paid" TEXT,
|
|
66
|
+
"add_index" INTEGER,
|
|
67
|
+
"payment_hash" TEXT,
|
|
68
|
+
"preimage" TEXT,
|
|
69
|
+
"expire_at" INTEGER,
|
|
70
|
+
"settled_at" INTEGER,
|
|
71
|
+
"description" TEXT,
|
|
72
|
+
"description_hash" TEXT,
|
|
73
|
+
"tx_hash" TEXT,
|
|
74
|
+
"tx_type" TEXT,
|
|
75
|
+
"target_address" TEXT,
|
|
76
|
+
"block_height" INTEGER,
|
|
77
|
+
"confirmations" INTEGER DEFAULT 0
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
-- CreateTable
|
|
81
|
+
CREATE TABLE "lnlink_orders" (
|
|
82
|
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
83
|
+
"transaction_id" INTEGER NOT NULL,
|
|
84
|
+
"user_id" INTEGER NOT NULL,
|
|
85
|
+
"create_at" INTEGER
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
-- CreateIndex
|
|
89
|
+
CREATE INDEX "nostr_events_event_id_IDX" ON "lnlink_nostr_events"("event_id");
|
|
90
|
+
|
|
91
|
+
-- CreateIndex
|
|
92
|
+
CREATE INDEX "nostr_events_from_npub_IDX" ON "lnlink_nostr_events"("from_npub");
|
|
93
|
+
|
|
94
|
+
-- CreateIndex
|
|
95
|
+
CREATE INDEX "nostr_events_to_npub_IDX" ON "lnlink_nostr_events"("to_npub");
|
|
96
|
+
|
|
97
|
+
-- CreateIndex
|
|
98
|
+
CREATE INDEX "nostr_events_kind_IDX" ON "lnlink_nostr_events"("kind");
|
|
99
|
+
|
|
100
|
+
-- CreateIndex
|
|
101
|
+
CREATE INDEX "nostr_events_status_IDX" ON "lnlink_nostr_events"("status");
|
|
102
|
+
|
|
103
|
+
-- CreateIndex
|
|
104
|
+
CREATE INDEX "nostr_events_create_at_IDX" ON "lnlink_nostr_events"("create_at");
|
|
105
|
+
|
|
106
|
+
-- CreateIndex
|
|
107
|
+
CREATE UNIQUE INDEX "lnlink_users_pubkey_key" ON "lnlink_users"("pubkey");
|
|
108
|
+
|
|
109
|
+
-- CreateIndex
|
|
110
|
+
CREATE UNIQUE INDEX "lnlink_users_npub_key" ON "lnlink_users"("npub");
|
|
111
|
+
|
|
112
|
+
-- CreateIndex
|
|
113
|
+
CREATE INDEX "idx_account_type" ON "lnlink_users"("account_type");
|
|
114
|
+
|
|
115
|
+
-- CreateIndex
|
|
116
|
+
CREATE INDEX "idx_asset_id" ON "lnlink_users"("asset_id");
|
|
117
|
+
|
|
118
|
+
-- CreateIndex
|
|
119
|
+
CREATE INDEX "idx_parent_pubkey" ON "lnlink_users"("parent_pubkey");
|
|
120
|
+
|
|
121
|
+
-- CreateIndex
|
|
122
|
+
CREATE INDEX "idx_expire_time" ON "lnlink_users"("expire_time");
|
|
123
|
+
|
|
124
|
+
-- CreateIndex
|
|
125
|
+
CREATE INDEX "idx_pubkey" ON "lnlink_users"("pubkey");
|
|
126
|
+
|
|
127
|
+
-- CreateIndex
|
|
128
|
+
CREATE UNIQUE INDEX "lnlink_transactions_event_id_key" ON "lnlink_transactions"("event_id");
|
|
129
|
+
|
|
130
|
+
-- CreateIndex
|
|
131
|
+
CREATE INDEX "idx_user_npub" ON "lnlink_transactions"("user_npub");
|
|
132
|
+
|
|
133
|
+
-- CreateIndex
|
|
134
|
+
CREATE INDEX "idx_asset_type" ON "lnlink_transactions"("asset_type");
|
|
135
|
+
|
|
136
|
+
-- CreateIndex
|
|
137
|
+
CREATE INDEX "idx_tx_asset_id" ON "lnlink_transactions"("asset_id");
|
|
138
|
+
|
|
139
|
+
-- CreateIndex
|
|
140
|
+
CREATE INDEX "idx_payment_hash" ON "lnlink_transactions"("payment_hash");
|
|
141
|
+
|
|
142
|
+
-- CreateIndex
|
|
143
|
+
CREATE INDEX "idx_invoice" ON "lnlink_transactions"("invoice");
|
|
144
|
+
|
|
145
|
+
-- CreateIndex
|
|
146
|
+
CREATE INDEX "idx_tx_hash" ON "lnlink_transactions"("tx_hash");
|
|
147
|
+
|
|
148
|
+
-- CreateIndex
|
|
149
|
+
CREATE INDEX "idx_direction" ON "lnlink_transactions"("direction");
|
|
150
|
+
|
|
151
|
+
-- CreateIndex
|
|
152
|
+
CREATE INDEX "idx_tx_type" ON "lnlink_transactions"("tx_type");
|
|
153
|
+
|
|
154
|
+
-- CreateIndex
|
|
155
|
+
CREATE INDEX "idx_status" ON "lnlink_transactions"("status");
|
|
156
|
+
|
|
157
|
+
-- CreateIndex
|
|
158
|
+
CREATE INDEX "idx_transaction_create_at" ON "lnlink_transactions"("create_at");
|
|
159
|
+
|
|
160
|
+
-- CreateIndex
|
|
161
|
+
CREATE INDEX "idx_node_type" ON "lnlink_transactions"("node_type");
|
|
162
|
+
|
|
163
|
+
-- CreateIndex
|
|
164
|
+
CREATE INDEX "idx_transaction_kind" ON "lnlink_transactions"("transaction_kind");
|
|
165
|
+
|
|
166
|
+
-- CreateIndex
|
|
167
|
+
CREATE INDEX "idx_block_height" ON "lnlink_transactions"("block_height");
|
|
168
|
+
|
|
169
|
+
-- CreateIndex
|
|
170
|
+
CREATE INDEX "idx_target_address" ON "lnlink_transactions"("target_address");
|
|
171
|
+
|
|
172
|
+
-- CreateIndex
|
|
173
|
+
CREATE INDEX "idx_user_npub_status" ON "lnlink_transactions"("user_npub", "status");
|
|
174
|
+
|
|
175
|
+
-- CreateIndex
|
|
176
|
+
CREATE INDEX "idx_asset_id_direction" ON "lnlink_transactions"("asset_id", "direction");
|
|
177
|
+
|
|
178
|
+
-- CreateIndex
|
|
179
|
+
CREATE INDEX "idx_user_npub_transaction_kind" ON "lnlink_transactions"("user_npub", "transaction_kind");
|
|
180
|
+
|
|
181
|
+
-- CreateIndex
|
|
182
|
+
CREATE INDEX "idx_status_create_at" ON "lnlink_transactions"("status", "create_at");
|
|
183
|
+
|
|
184
|
+
-- CreateIndex
|
|
185
|
+
CREATE INDEX "idx_transaction_id" ON "lnlink_orders"("transaction_id");
|
|
186
|
+
|
|
187
|
+
-- CreateIndex
|
|
188
|
+
CREATE INDEX "idx_user_id" ON "lnlink_orders"("user_id");
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// This is your Prisma schema file,
|
|
2
|
+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
3
|
+
|
|
4
|
+
generator client {
|
|
5
|
+
provider = "prisma-client-js"
|
|
6
|
+
binaryTargets = ["native", "darwin", "darwin-arm64", "windows", "debian-openssl-3.0.x"]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
datasource db {
|
|
10
|
+
provider = "sqlite"
|
|
11
|
+
url = env("LINK_DATABASE_URL")
|
|
12
|
+
}
|
|
13
|
+
model LnlinkConfig {
|
|
14
|
+
id Int @id @default(autoincrement())
|
|
15
|
+
owner_npub String? @map("owner_npub")
|
|
16
|
+
node_encrypted_sk String? @map("node_encrypted_sk")
|
|
17
|
+
node_npub String? @map("node_npub")
|
|
18
|
+
node_name String? @map("node_name")
|
|
19
|
+
settings String? @map("settings")
|
|
20
|
+
create_at Int? @map("create_at")
|
|
21
|
+
update_at Int? @map("update_at")
|
|
22
|
+
|
|
23
|
+
@@map("lnlink_config")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Nostr Events Table
|
|
27
|
+
model LnlinkNostrEvent {
|
|
28
|
+
id Int @id @default(autoincrement())
|
|
29
|
+
event_id String? @map("event_id")
|
|
30
|
+
content String?
|
|
31
|
+
from_npub String? @map("from_npub")
|
|
32
|
+
to_npub String? @map("to_npub")
|
|
33
|
+
kind Int?
|
|
34
|
+
tags String? // JSON string
|
|
35
|
+
reply_event_id String? @map("reply_event_id")
|
|
36
|
+
reply_err String? @map("reply_err")
|
|
37
|
+
status Int @default(0)
|
|
38
|
+
create_at Int? @map("create_at")
|
|
39
|
+
reply_at Int? @map("reply_at")
|
|
40
|
+
|
|
41
|
+
@@index([event_id], map: "nostr_events_event_id_IDX")
|
|
42
|
+
@@index([from_npub], map: "nostr_events_from_npub_IDX")
|
|
43
|
+
@@index([to_npub], map: "nostr_events_to_npub_IDX")
|
|
44
|
+
@@index([kind], map: "nostr_events_kind_IDX")
|
|
45
|
+
@@index([status], map: "nostr_events_status_IDX")
|
|
46
|
+
@@index([create_at], map: "nostr_events_create_at_IDX")
|
|
47
|
+
@@map("lnlink_nostr_events")
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// LnLink Users Table
|
|
51
|
+
model LnlinkUser {
|
|
52
|
+
id Int @id @default(autoincrement())
|
|
53
|
+
name String?
|
|
54
|
+
pubkey String? @unique
|
|
55
|
+
npub String? @unique
|
|
56
|
+
sk String?
|
|
57
|
+
node_pubkey String?
|
|
58
|
+
node_npub String?
|
|
59
|
+
relay String?
|
|
60
|
+
account_type Int?
|
|
61
|
+
social_id String?
|
|
62
|
+
social_type Int? @map("social_type")
|
|
63
|
+
auth_limit String?
|
|
64
|
+
status Int? @default(1)
|
|
65
|
+
permissions String?
|
|
66
|
+
asset_id String?
|
|
67
|
+
parent_pubkey String?
|
|
68
|
+
create_at Int?
|
|
69
|
+
expire_time Int?
|
|
70
|
+
|
|
71
|
+
@@index([account_type], map: "idx_account_type")
|
|
72
|
+
@@index([asset_id], map: "idx_asset_id")
|
|
73
|
+
@@index([parent_pubkey], map: "idx_parent_pubkey")
|
|
74
|
+
@@index([expire_time], map: "idx_expire_time")
|
|
75
|
+
@@index([pubkey], map: "idx_pubkey")
|
|
76
|
+
@@map("lnlink_users")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// LnLink Transactions Table
|
|
80
|
+
model LnlinkTransaction {
|
|
81
|
+
id Int @id @default(autoincrement())
|
|
82
|
+
event_id String? @unique @map("event_id")
|
|
83
|
+
user_npub String? @map("user_npub")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
asset_type String? @map("asset_type")
|
|
87
|
+
asset_id String? @map("asset_id")
|
|
88
|
+
asset_amount String? @map("asset_amount")
|
|
89
|
+
invoice String? @map("invoice")
|
|
90
|
+
status Int? @default(0)
|
|
91
|
+
create_at Int? @map("create_at")
|
|
92
|
+
update_at Int? @map("update_at")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
node_type String // "litd" or "rgb"
|
|
96
|
+
transaction_kind String // "onchain" or "lightning"
|
|
97
|
+
direction String? // "in" or "out"
|
|
98
|
+
fees_paid String? @map("fees_paid")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
add_index Int? @map("add_index")
|
|
102
|
+
payment_hash String? @map("payment_hash")
|
|
103
|
+
preimage String?
|
|
104
|
+
expire_at Int? @map("expire_at")
|
|
105
|
+
settled_at Int? @map("settled_at")
|
|
106
|
+
description String?
|
|
107
|
+
description_hash String? @map("description_hash")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
tx_hash String? @map("tx_hash")
|
|
111
|
+
tx_type String? @map("tx_type")
|
|
112
|
+
target_address String? @map("target_address")
|
|
113
|
+
block_height Int? @map("block_height")
|
|
114
|
+
confirmations Int? @default(0)
|
|
115
|
+
|
|
116
|
+
@@index([user_npub], map: "idx_user_npub")
|
|
117
|
+
@@index([asset_type], map: "idx_asset_type")
|
|
118
|
+
@@index([asset_id], map: "idx_tx_asset_id")
|
|
119
|
+
@@index([payment_hash], map: "idx_payment_hash")
|
|
120
|
+
@@index([invoice], map: "idx_invoice")
|
|
121
|
+
@@index([tx_hash], map: "idx_tx_hash")
|
|
122
|
+
@@index([direction], map: "idx_direction")
|
|
123
|
+
@@index([tx_type], map: "idx_tx_type")
|
|
124
|
+
@@index([status], map: "idx_status")
|
|
125
|
+
@@index([create_at], map: "idx_transaction_create_at")
|
|
126
|
+
@@index([node_type], map: "idx_node_type")
|
|
127
|
+
@@index([transaction_kind], map: "idx_transaction_kind")
|
|
128
|
+
@@index([block_height], map: "idx_block_height")
|
|
129
|
+
@@index([target_address], map: "idx_target_address")
|
|
130
|
+
@@index([user_npub, status], map: "idx_user_npub_status")
|
|
131
|
+
@@index([asset_id, direction], map: "idx_asset_id_direction")
|
|
132
|
+
@@index([user_npub, transaction_kind], map: "idx_user_npub_transaction_kind")
|
|
133
|
+
@@index([status, create_at], map: "idx_status_create_at")
|
|
134
|
+
@@map("lnlink_transactions")
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// LnLink Orders Table
|
|
138
|
+
model LnlinkOrder {
|
|
139
|
+
id Int @id @default(autoincrement())
|
|
140
|
+
transaction_id Int
|
|
141
|
+
user_id Int
|
|
142
|
+
create_at Int?
|
|
143
|
+
|
|
144
|
+
@@index([transaction_id], map: "idx_transaction_id")
|
|
145
|
+
@@index([user_id], map: "idx_user_id")
|
|
146
|
+
@@map("lnlink_orders")
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
// Enums for better type safety
|
|
151
|
+
enum EventHandleStatus {
|
|
152
|
+
NO_HANDLE @map("0")
|
|
153
|
+
REPLYING @map("1")
|
|
154
|
+
SUCCESS @map("2")
|
|
155
|
+
ERROR @map("255")
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
enum AccountType {
|
|
159
|
+
NWC @map("1")
|
|
160
|
+
FLASH @map("2")
|
|
161
|
+
FLASH_REGISTER @map("3")
|
|
162
|
+
OWNER @map("4")
|
|
163
|
+
READ_ONLY @map("5")
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
enum InvoiceStatus {
|
|
167
|
+
OPEN @map("0")
|
|
168
|
+
SETTLED @map("1")
|
|
169
|
+
CANCELED @map("2")
|
|
170
|
+
ACCEPTED @map("3")
|
|
171
|
+
EXPIRED @map("4")
|
|
172
|
+
FAILED @map("5")
|
|
173
|
+
ERROR @map("99")
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
enum PaymentStatus {
|
|
177
|
+
IN_FLIGHT @map("1")
|
|
178
|
+
SUCCEEDED @map("2")
|
|
179
|
+
FAILED @map("3")
|
|
180
|
+
INITIATED @map("4")
|
|
181
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package chainrpc;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/lightningnetwork/lnd/lnrpc/chainrpc";
|
|
6
|
+
|
|
7
|
+
// ChainKit is a service that can be used to get information from the
|
|
8
|
+
// chain backend.
|
|
9
|
+
service ChainKit {
|
|
10
|
+
/* lncli: `chain getblock`
|
|
11
|
+
GetBlock returns a block given the corresponding block hash.
|
|
12
|
+
*/
|
|
13
|
+
rpc GetBlock (GetBlockRequest) returns (GetBlockResponse);
|
|
14
|
+
|
|
15
|
+
/* lncli: `chain getblockheader`
|
|
16
|
+
GetBlockHeader returns a block header with a particular block hash.
|
|
17
|
+
*/
|
|
18
|
+
rpc GetBlockHeader (GetBlockHeaderRequest) returns (GetBlockHeaderResponse);
|
|
19
|
+
|
|
20
|
+
/* lncli: `chain getbestblock`
|
|
21
|
+
GetBestBlock returns the block hash and current height from the valid
|
|
22
|
+
most-work chain.
|
|
23
|
+
*/
|
|
24
|
+
rpc GetBestBlock (GetBestBlockRequest) returns (GetBestBlockResponse);
|
|
25
|
+
|
|
26
|
+
/* lncli: `chain getblockhash`
|
|
27
|
+
GetBlockHash returns the hash of the block in the best blockchain
|
|
28
|
+
at the given height.
|
|
29
|
+
*/
|
|
30
|
+
rpc GetBlockHash (GetBlockHashRequest) returns (GetBlockHashResponse);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message GetBlockRequest {
|
|
34
|
+
// The hash of the requested block.
|
|
35
|
+
bytes block_hash = 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// TODO(ffranr): The neutrino GetBlock response includes many
|
|
39
|
+
// additional helpful fields. Consider adding them here also.
|
|
40
|
+
message GetBlockResponse {
|
|
41
|
+
// The raw bytes of the requested block.
|
|
42
|
+
bytes raw_block = 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message GetBlockHeaderRequest {
|
|
46
|
+
// The hash of the block with the requested header.
|
|
47
|
+
bytes block_hash = 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message GetBlockHeaderResponse {
|
|
51
|
+
// The header of the block with the requested hash.
|
|
52
|
+
bytes raw_block_header = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message GetBestBlockRequest {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
message GetBestBlockResponse {
|
|
59
|
+
// The hash of the best block.
|
|
60
|
+
bytes block_hash = 1;
|
|
61
|
+
|
|
62
|
+
// The height of the best block.
|
|
63
|
+
int32 block_height = 2;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
message GetBlockHashRequest {
|
|
67
|
+
// Block height of the target best chain block.
|
|
68
|
+
int64 block_height = 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
message GetBlockHashResponse {
|
|
72
|
+
// The hash of the best block at the specified height.
|
|
73
|
+
bytes block_hash = 1;
|
|
74
|
+
}
|