@neuraiproject/neurai-rpc 0.7.0 → 0.9.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/dist/index.d.cts CHANGED
@@ -8,7 +8,6 @@ interface IMethods {
8
8
  addtagtoaddress: string;
9
9
  addwitnessaddress: string;
10
10
  backupwallet: string;
11
- bumpfee: string;
12
11
  cancelsnapshotrequest: string;
13
12
  checkaddressrestriction: string;
14
13
  checkaddresstag: string;
@@ -17,12 +16,15 @@ interface IMethods {
17
16
  clearbanned: string;
18
17
  clearmempool: string;
19
18
  clearmessages: string;
19
+ closedepin: string;
20
20
  combinerawtransaction: string;
21
+ createdistributionbatch: string;
21
22
  createmultisig: string;
22
23
  createrawtransaction: string;
23
24
  decodeblock: string;
24
25
  decoderawtransaction: string;
25
26
  decodescript: string;
27
+ decodesilentpaymentcode: string;
26
28
  depinchallenge: string;
27
29
  depinclearmsg: string;
28
30
  depindecrypt: string;
@@ -34,9 +36,9 @@ interface IMethods {
34
36
  depinpoolpkey: string;
35
37
  depinpoolstats: string;
36
38
  depinreceivemsg: string;
39
+ depinreceiveseq: string;
37
40
  depinsendmsg: string;
38
- depinsignchallenge: string;
39
- depinsignrequest: string;
41
+ depinsignrpc: string;
40
42
  depinsubmitmsg: string;
41
43
  disconnectnode: string;
42
44
  distributereward: string;
@@ -46,6 +48,7 @@ interface IMethods {
46
48
  encryptwallet: string;
47
49
  estimatefee: string;
48
50
  estimatesmartfee: string;
51
+ exportsilentpaymentviewkey: string;
49
52
  exportxpqpub: string;
50
53
  freezeaddress: string;
51
54
  freezedepin: string;
@@ -75,9 +78,13 @@ interface IMethods {
75
78
  getcacheinfo: string;
76
79
  getchaintips: string;
77
80
  getchaintxstats: string;
81
+ getchannelmessages: string;
78
82
  getconnectioncount: string;
79
83
  getdifficulty: string;
80
84
  getdistributestatus: string;
85
+ getdistributionbatches: string;
86
+ getdistributionplan: string;
87
+ getdistributionproof: string;
81
88
  getgenerate: string;
82
89
  getibdstatus: string;
83
90
  getinfo: string;
@@ -95,6 +102,8 @@ interface IMethods {
95
102
  getnetworkinfo: string;
96
103
  getnewaddress: string;
97
104
  getpeerinfo: string;
105
+ getprivacypoolinfo: string;
106
+ getprivacypoolupdates: string;
98
107
  getpubkey: string;
99
108
  getrawchangeaddress: string;
100
109
  getrawmempool: string;
@@ -102,7 +111,14 @@ interface IMethods {
102
111
  getreceivedbyaccount: string;
103
112
  getreceivedbyaddress: string;
104
113
  getrpcinfo: string;
114
+ getsilentpaymentcode: string;
115
+ getsilentpaymentindexinfo: string;
116
+ getsilentpaymentinfo: string;
117
+ getsilentpaymenttweaks: string;
118
+ getsilentpaymenttweaksrange: string;
105
119
  getsnapshot: string;
120
+ getsnapshotannouncement: string;
121
+ getsnapshotrecipients: string;
106
122
  getsnapshotrequest: string;
107
123
  getspentinfo: string;
108
124
  gettransaction: string;
@@ -118,6 +134,7 @@ interface IMethods {
118
134
  importprivkey: string;
119
135
  importprunedfunds: string;
120
136
  importpubkey: string;
137
+ importsilentpaymentviewkey: string;
121
138
  importwallet: string;
122
139
  issue: string;
123
140
  issuequalifierasset: string;
@@ -141,6 +158,7 @@ interface IMethods {
141
158
  listpqaddresses: string;
142
159
  listreceivedbyaccount: string;
143
160
  listreceivedbyaddress: string;
161
+ listsilentpayments: string;
144
162
  listsinceblock: string;
145
163
  listsnapshotrequests: string;
146
164
  listtagsforaddress: string;
@@ -149,6 +167,7 @@ interface IMethods {
149
167
  listwallets: string;
150
168
  lockunspent: string;
151
169
  move: string;
170
+ opendepin: string;
152
171
  ping: string;
153
172
  pprpcsb: string;
154
173
  preciousblock: string;
@@ -159,15 +178,20 @@ interface IMethods {
159
178
  reissuerestrictedasset: string;
160
179
  removeprunedfunds: string;
161
180
  removetagfromaddress: string;
181
+ repairsilentpaymentidentity: string;
182
+ replaysnapshot: string;
162
183
  requestsnapshot: string;
163
184
  rescanblockchain: string;
185
+ rescansilentpayments: string;
164
186
  savemempool: string;
187
+ sealdepin: string;
165
188
  selfrevokedepin: string;
166
189
  sendfrom: string;
167
190
  sendfromaddress: string;
168
191
  sendmany: string;
169
192
  sendmessage: string;
170
193
  sendrawtransaction: string;
194
+ sendsilentpayments: string;
171
195
  sendtoaddress: string;
172
196
  setaccount: string;
173
197
  setban: string;
@@ -192,6 +216,7 @@ interface IMethods {
192
216
  uptime: string;
193
217
  validateaddress: string;
194
218
  verifychain: string;
219
+ verifydistribution: string;
195
220
  verifymessage: string;
196
221
  verifytxoutproof: string;
197
222
  viewallmessagechannels: string;
@@ -201,6 +226,70 @@ interface IMethods {
201
226
  }
202
227
  declare const methods: IMethods;
203
228
 
229
+ /** Transport types only. Build and verify signatures with neurai-depin-msg. */
230
+ declare const DEPIN_RPC_PROTOCOL: 5;
231
+ declare const DEPIN_REMOTE_METHODS: readonly ["depingetmsginfo", "depinpoolstats", "depinmcpstatus", "depinchallenge", "depinreceivemsg", "depinreceiveseq", "depinlistsections", "depinclearmsg", "depinsubmitmsg", "depingetancestorrecipients"];
232
+ type DepinRemoteMethod = (typeof DEPIN_REMOTE_METHODS)[number];
233
+ interface DepinBootstrapRequest {
234
+ protocol: 5;
235
+ request_id: string;
236
+ timestamp_ms: number | bigint;
237
+ }
238
+ interface DepinSequenceCursor {
239
+ version: 1;
240
+ stream_id: string;
241
+ after_seq: number | bigint;
242
+ scope: string;
243
+ address: string;
244
+ from_timestamp: number | bigint;
245
+ }
246
+ interface DepinRpcRequest extends DepinBootstrapRequest {
247
+ network: string;
248
+ pool_pubkey: string;
249
+ pool_root: string;
250
+ instance_id: string;
251
+ membership_revision: string;
252
+ token: string;
253
+ address: string;
254
+ challenge: string;
255
+ args: Record<string, unknown>;
256
+ signature: string;
257
+ }
258
+ type DepinRpcParams = [DepinBootstrapRequest | DepinRpcRequest] | {
259
+ request: DepinBootstrapRequest | DepinRpcRequest;
260
+ };
261
+ interface DepinRpcResponse {
262
+ protocol: 5;
263
+ network: string;
264
+ pool_pubkey: string;
265
+ pool_root: string;
266
+ instance_id: string;
267
+ membership_revision: string;
268
+ membership_height: number;
269
+ membership_blockhash: string;
270
+ request_hash: string;
271
+ body_kind: 0 | 1;
272
+ body?: string;
273
+ encrypted?: string;
274
+ poolsig: string;
275
+ }
276
+ declare function isDepinRemoteMethod(method: string): method is DepinRemoteMethod;
277
+ /** Keep every signed byte intact. The node performs canonical validation. */
278
+ declare function getDepinRequest(params: unknown): DepinBootstrapRequest | DepinRpcRequest;
279
+ type RpcNode = {
280
+ rpc: (method: string, params: any) => Promise<any>;
281
+ };
282
+ /** Route signed requests to their exact pool/instance, with no request rewriting.
283
+ * Discovery is advisory routing metadata; the client verifies the final reply.
284
+ * No private request is broadcast and no write is retried by this router.
285
+ */
286
+ declare function createDepinNodeRouter<T extends RpcNode>(healthyNodes: () => T[], randomId: () => string): (method: string, params: unknown) => Promise<T>;
287
+
288
+ /** Detect duplicate JSON property names, including equal values and escaped names.
289
+ * Syntax and numeric decoding are delegated to the JSON parser afterwards.
290
+ */
291
+ declare function assertNoDuplicateJsonKeys(text: string): void;
292
+
204
293
  declare const MAINNET_GENESIS_HASH = "00000044d33c0c0ba019be5c0249730424a69cb4c222153322f68c6104484806";
205
294
  declare const TESTNET_GENESIS_HASH = "0000008b384aeffecdab182575dc4e86c9f07f90318c65088532660ed9a8a021";
206
295
  /** Reject an RPC endpoint that serves a different chain with the same network label. */
@@ -210,6 +299,6 @@ declare function rpcNumber(value: string): LosslessNumber;
210
299
  /** Preserve unsafe JSON numeric tokens as strings; retain safe number compatibility. */
211
300
  declare function parseRpcJson(text: string): any;
212
301
  declare function stringifyRpcJson(value: unknown): string;
213
- declare function getRPC(username: string, password: string, URL: string): (method: string, params: any[]) => Promise<unknown>;
302
+ declare function getRPC(username: string, password: string, URL: string): (method: string, params: any[] | Record<string, unknown>) => Promise<unknown>;
214
303
 
215
- export { MAINNET_GENESIS_HASH, TESTNET_GENESIS_HASH, assertRpcGenesis, getRPC, methods, parseRpcJson, rpcNumber, stringifyRpcJson };
304
+ export { DEPIN_REMOTE_METHODS, DEPIN_RPC_PROTOCOL, type DepinBootstrapRequest, type DepinRemoteMethod, type DepinRpcParams, type DepinRpcRequest, type DepinRpcResponse, type DepinSequenceCursor, MAINNET_GENESIS_HASH, TESTNET_GENESIS_HASH, assertNoDuplicateJsonKeys, assertRpcGenesis, createDepinNodeRouter, getDepinRequest, getRPC, isDepinRemoteMethod, methods, parseRpcJson, rpcNumber, stringifyRpcJson };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,6 @@ interface IMethods {
8
8
  addtagtoaddress: string;
9
9
  addwitnessaddress: string;
10
10
  backupwallet: string;
11
- bumpfee: string;
12
11
  cancelsnapshotrequest: string;
13
12
  checkaddressrestriction: string;
14
13
  checkaddresstag: string;
@@ -17,12 +16,15 @@ interface IMethods {
17
16
  clearbanned: string;
18
17
  clearmempool: string;
19
18
  clearmessages: string;
19
+ closedepin: string;
20
20
  combinerawtransaction: string;
21
+ createdistributionbatch: string;
21
22
  createmultisig: string;
22
23
  createrawtransaction: string;
23
24
  decodeblock: string;
24
25
  decoderawtransaction: string;
25
26
  decodescript: string;
27
+ decodesilentpaymentcode: string;
26
28
  depinchallenge: string;
27
29
  depinclearmsg: string;
28
30
  depindecrypt: string;
@@ -34,9 +36,9 @@ interface IMethods {
34
36
  depinpoolpkey: string;
35
37
  depinpoolstats: string;
36
38
  depinreceivemsg: string;
39
+ depinreceiveseq: string;
37
40
  depinsendmsg: string;
38
- depinsignchallenge: string;
39
- depinsignrequest: string;
41
+ depinsignrpc: string;
40
42
  depinsubmitmsg: string;
41
43
  disconnectnode: string;
42
44
  distributereward: string;
@@ -46,6 +48,7 @@ interface IMethods {
46
48
  encryptwallet: string;
47
49
  estimatefee: string;
48
50
  estimatesmartfee: string;
51
+ exportsilentpaymentviewkey: string;
49
52
  exportxpqpub: string;
50
53
  freezeaddress: string;
51
54
  freezedepin: string;
@@ -75,9 +78,13 @@ interface IMethods {
75
78
  getcacheinfo: string;
76
79
  getchaintips: string;
77
80
  getchaintxstats: string;
81
+ getchannelmessages: string;
78
82
  getconnectioncount: string;
79
83
  getdifficulty: string;
80
84
  getdistributestatus: string;
85
+ getdistributionbatches: string;
86
+ getdistributionplan: string;
87
+ getdistributionproof: string;
81
88
  getgenerate: string;
82
89
  getibdstatus: string;
83
90
  getinfo: string;
@@ -95,6 +102,8 @@ interface IMethods {
95
102
  getnetworkinfo: string;
96
103
  getnewaddress: string;
97
104
  getpeerinfo: string;
105
+ getprivacypoolinfo: string;
106
+ getprivacypoolupdates: string;
98
107
  getpubkey: string;
99
108
  getrawchangeaddress: string;
100
109
  getrawmempool: string;
@@ -102,7 +111,14 @@ interface IMethods {
102
111
  getreceivedbyaccount: string;
103
112
  getreceivedbyaddress: string;
104
113
  getrpcinfo: string;
114
+ getsilentpaymentcode: string;
115
+ getsilentpaymentindexinfo: string;
116
+ getsilentpaymentinfo: string;
117
+ getsilentpaymenttweaks: string;
118
+ getsilentpaymenttweaksrange: string;
105
119
  getsnapshot: string;
120
+ getsnapshotannouncement: string;
121
+ getsnapshotrecipients: string;
106
122
  getsnapshotrequest: string;
107
123
  getspentinfo: string;
108
124
  gettransaction: string;
@@ -118,6 +134,7 @@ interface IMethods {
118
134
  importprivkey: string;
119
135
  importprunedfunds: string;
120
136
  importpubkey: string;
137
+ importsilentpaymentviewkey: string;
121
138
  importwallet: string;
122
139
  issue: string;
123
140
  issuequalifierasset: string;
@@ -141,6 +158,7 @@ interface IMethods {
141
158
  listpqaddresses: string;
142
159
  listreceivedbyaccount: string;
143
160
  listreceivedbyaddress: string;
161
+ listsilentpayments: string;
144
162
  listsinceblock: string;
145
163
  listsnapshotrequests: string;
146
164
  listtagsforaddress: string;
@@ -149,6 +167,7 @@ interface IMethods {
149
167
  listwallets: string;
150
168
  lockunspent: string;
151
169
  move: string;
170
+ opendepin: string;
152
171
  ping: string;
153
172
  pprpcsb: string;
154
173
  preciousblock: string;
@@ -159,15 +178,20 @@ interface IMethods {
159
178
  reissuerestrictedasset: string;
160
179
  removeprunedfunds: string;
161
180
  removetagfromaddress: string;
181
+ repairsilentpaymentidentity: string;
182
+ replaysnapshot: string;
162
183
  requestsnapshot: string;
163
184
  rescanblockchain: string;
185
+ rescansilentpayments: string;
164
186
  savemempool: string;
187
+ sealdepin: string;
165
188
  selfrevokedepin: string;
166
189
  sendfrom: string;
167
190
  sendfromaddress: string;
168
191
  sendmany: string;
169
192
  sendmessage: string;
170
193
  sendrawtransaction: string;
194
+ sendsilentpayments: string;
171
195
  sendtoaddress: string;
172
196
  setaccount: string;
173
197
  setban: string;
@@ -192,6 +216,7 @@ interface IMethods {
192
216
  uptime: string;
193
217
  validateaddress: string;
194
218
  verifychain: string;
219
+ verifydistribution: string;
195
220
  verifymessage: string;
196
221
  verifytxoutproof: string;
197
222
  viewallmessagechannels: string;
@@ -201,6 +226,70 @@ interface IMethods {
201
226
  }
202
227
  declare const methods: IMethods;
203
228
 
229
+ /** Transport types only. Build and verify signatures with neurai-depin-msg. */
230
+ declare const DEPIN_RPC_PROTOCOL: 5;
231
+ declare const DEPIN_REMOTE_METHODS: readonly ["depingetmsginfo", "depinpoolstats", "depinmcpstatus", "depinchallenge", "depinreceivemsg", "depinreceiveseq", "depinlistsections", "depinclearmsg", "depinsubmitmsg", "depingetancestorrecipients"];
232
+ type DepinRemoteMethod = (typeof DEPIN_REMOTE_METHODS)[number];
233
+ interface DepinBootstrapRequest {
234
+ protocol: 5;
235
+ request_id: string;
236
+ timestamp_ms: number | bigint;
237
+ }
238
+ interface DepinSequenceCursor {
239
+ version: 1;
240
+ stream_id: string;
241
+ after_seq: number | bigint;
242
+ scope: string;
243
+ address: string;
244
+ from_timestamp: number | bigint;
245
+ }
246
+ interface DepinRpcRequest extends DepinBootstrapRequest {
247
+ network: string;
248
+ pool_pubkey: string;
249
+ pool_root: string;
250
+ instance_id: string;
251
+ membership_revision: string;
252
+ token: string;
253
+ address: string;
254
+ challenge: string;
255
+ args: Record<string, unknown>;
256
+ signature: string;
257
+ }
258
+ type DepinRpcParams = [DepinBootstrapRequest | DepinRpcRequest] | {
259
+ request: DepinBootstrapRequest | DepinRpcRequest;
260
+ };
261
+ interface DepinRpcResponse {
262
+ protocol: 5;
263
+ network: string;
264
+ pool_pubkey: string;
265
+ pool_root: string;
266
+ instance_id: string;
267
+ membership_revision: string;
268
+ membership_height: number;
269
+ membership_blockhash: string;
270
+ request_hash: string;
271
+ body_kind: 0 | 1;
272
+ body?: string;
273
+ encrypted?: string;
274
+ poolsig: string;
275
+ }
276
+ declare function isDepinRemoteMethod(method: string): method is DepinRemoteMethod;
277
+ /** Keep every signed byte intact. The node performs canonical validation. */
278
+ declare function getDepinRequest(params: unknown): DepinBootstrapRequest | DepinRpcRequest;
279
+ type RpcNode = {
280
+ rpc: (method: string, params: any) => Promise<any>;
281
+ };
282
+ /** Route signed requests to their exact pool/instance, with no request rewriting.
283
+ * Discovery is advisory routing metadata; the client verifies the final reply.
284
+ * No private request is broadcast and no write is retried by this router.
285
+ */
286
+ declare function createDepinNodeRouter<T extends RpcNode>(healthyNodes: () => T[], randomId: () => string): (method: string, params: unknown) => Promise<T>;
287
+
288
+ /** Detect duplicate JSON property names, including equal values and escaped names.
289
+ * Syntax and numeric decoding are delegated to the JSON parser afterwards.
290
+ */
291
+ declare function assertNoDuplicateJsonKeys(text: string): void;
292
+
204
293
  declare const MAINNET_GENESIS_HASH = "00000044d33c0c0ba019be5c0249730424a69cb4c222153322f68c6104484806";
205
294
  declare const TESTNET_GENESIS_HASH = "0000008b384aeffecdab182575dc4e86c9f07f90318c65088532660ed9a8a021";
206
295
  /** Reject an RPC endpoint that serves a different chain with the same network label. */
@@ -210,6 +299,6 @@ declare function rpcNumber(value: string): LosslessNumber;
210
299
  /** Preserve unsafe JSON numeric tokens as strings; retain safe number compatibility. */
211
300
  declare function parseRpcJson(text: string): any;
212
301
  declare function stringifyRpcJson(value: unknown): string;
213
- declare function getRPC(username: string, password: string, URL: string): (method: string, params: any[]) => Promise<unknown>;
302
+ declare function getRPC(username: string, password: string, URL: string): (method: string, params: any[] | Record<string, unknown>) => Promise<unknown>;
214
303
 
215
- export { MAINNET_GENESIS_HASH, TESTNET_GENESIS_HASH, assertRpcGenesis, getRPC, methods, parseRpcJson, rpcNumber, stringifyRpcJson };
304
+ export { DEPIN_REMOTE_METHODS, DEPIN_RPC_PROTOCOL, type DepinBootstrapRequest, type DepinRemoteMethod, type DepinRpcParams, type DepinRpcRequest, type DepinRpcResponse, type DepinSequenceCursor, MAINNET_GENESIS_HASH, TESTNET_GENESIS_HASH, assertNoDuplicateJsonKeys, assertRpcGenesis, createDepinNodeRouter, getDepinRequest, getRPC, isDepinRemoteMethod, methods, parseRpcJson, rpcNumber, stringifyRpcJson };