@neuraiproject/neurai-rpc 0.4.3 → 0.4.5

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/types.d.ts CHANGED
@@ -10,6 +10,7 @@ interface IMethods {
10
10
  cancelsnapshotrequest: string;
11
11
  checkaddressrestriction: string;
12
12
  checkaddresstag: string;
13
+ checkdepinvalidity: string;
13
14
  checkglobalrestriction: string;
14
15
  clearbanned: string;
15
16
  clearmempool: string;
@@ -20,6 +21,14 @@ interface IMethods {
20
21
  decodeblock: string;
21
22
  decoderawtransaction: string;
22
23
  decodescript: string;
24
+ depinclearmsg: string;
25
+ depingetmsg: string;
26
+ depingetmsginfo: string;
27
+ depingetpoolcontent: string;
28
+ depinmcpstatus: string;
29
+ depinpoolstats: string;
30
+ depinsendmsg: string;
31
+ depinsubmitmsg: string;
23
32
  disconnectnode: string;
24
33
  distributereward: string;
25
34
  dumpprivkey: string;
@@ -28,6 +37,7 @@ interface IMethods {
28
37
  estimatefee: string;
29
38
  estimatesmartfee: string;
30
39
  freezeaddress: string;
40
+ freezedepin: string;
31
41
  freezerestrictedasset: string;
32
42
  fundrawtransaction: string;
33
43
  generate: string;
@@ -111,6 +121,7 @@ interface IMethods {
111
121
  listassetbalancesbyaddress: string;
112
122
  listassets: string;
113
123
  listbanned: string;
124
+ listdepinholders: string;
114
125
  listglobalrestrictions: string;
115
126
  listlockunspent: string;
116
127
  listmyassets: string;
@@ -137,6 +148,7 @@ interface IMethods {
137
148
  requestsnapshot: string;
138
149
  rescanblockchain: string;
139
150
  savemempool: string;
151
+ selfrevokedepin: string;
140
152
  sendfrom: string;
141
153
  sendfromaddress: string;
142
154
  sendmany: string;
@@ -160,6 +172,7 @@ interface IMethods {
160
172
  transferfromaddresses: string;
161
173
  transferqualifier: string;
162
174
  unfreezeaddress: string;
175
+ unfreezedepin: string;
163
176
  unfreezerestrictedasset: string;
164
177
  unsubscribefromchannel: string;
165
178
  uptime: string;
@@ -173,6 +186,66 @@ interface IMethods {
173
186
  viewmytaggedaddresses: string;
174
187
  }
175
188
  export const methods: IMethods;
176
- export function getRPC(username: string, password: string, URL: string): (method: string, params: any[]) => Promise<any>;
189
+ /**
190
+ * DePIN RPC Client for Neurai
191
+ *
192
+ * This module provides support for communicating with Neurai DePIN messaging
193
+ * on port 19002 using the challenge/response authentication protocol.
194
+ */
195
+ export interface DePinAuthOptions {
196
+ /** DePIN token name (e.g., "MYTOKEN") */
197
+ token: string;
198
+ /** Neurai address that will sign challenges */
199
+ address: string;
200
+ /** Function to sign messages (must return base64 signature) */
201
+ signMessage: (message: string) => Promise<string>;
202
+ /** Operation mode: SEND or RECEIVE (default: RECEIVE) */
203
+ mode?: 'SEND' | 'RECEIVE';
204
+ }
205
+ export interface DePinChallenge {
206
+ /** Challenge string from server */
207
+ challenge: string;
208
+ /** Timeout in seconds */
209
+ timeout: number;
210
+ /** Complete message that needs to be signed */
211
+ messageToSign: string;
212
+ }
213
+ /**
214
+ * Create a DePIN RPC client with challenge/response authentication
215
+ *
216
+ * @param url DePIN server URL (e.g., "http://localhost:19002")
217
+ * @param authOptions Authentication options including token, address, and signing function
218
+ * @returns Async RPC function
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * import { getDePinRPC } from "@neuraiproject/neurai-rpc";
223
+ *
224
+ * const depinRpc = getDePinRPC("http://localhost:19002", {
225
+ * token: "MYTOKEN",
226
+ * address: "NXmyaddress...",
227
+ * signMessage: async (msg) => {
228
+ * // Use your wallet to sign the message
229
+ * return await wallet.signMessage(msg);
230
+ * },
231
+ * mode: "SEND"
232
+ * });
233
+ *
234
+ * // Send a DePIN message
235
+ * const result = await depinRpc("depinsendmsg", [
236
+ * "MYTOKEN",
237
+ * "localhost",
238
+ * "Hello from DePIN!",
239
+ * "NXmyaddress..."
240
+ * ]);
241
+ * ```
242
+ */
243
+ export function getDePinRPC(url: string, authOptions: DePinAuthOptions): (method: string, params: any[]) => Promise<unknown>;
244
+ /**
245
+ * Helper function to request a challenge without making an RPC call
246
+ * Useful for testing or manual challenge handling
247
+ */
248
+ export function requestDePinChallenge(url: string, authOptions: DePinAuthOptions): Promise<DePinChallenge>;
249
+ export function getRPC(username: string, password: string, URL: string): (method: string, params: any[]) => Promise<unknown>;
177
250
 
178
251
  //# sourceMappingURL=types.d.ts.map