@neuraiproject/neurai-rpc 0.7.0 → 0.8.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/CHANGELOG.md +6 -0
- package/DEPIN_EXAMPLES.md +45 -127
- package/DEPIN_IMPLEMENTATION_GUIDE_EN.md +19 -93
- package/README.md +29 -113
- package/depin.ts +144 -0
- package/dist/index.cjs +341 -331
- package/dist/index.d.cts +68 -4
- package/dist/index.d.ts +68 -4
- package/dist/index.mjs +335 -331
- package/docs.json +198 -198
- package/docs.ts +1342 -1504
- package/index.ts +44 -38
- package/json.ts +29 -0
- package/neurai_methods.md +743 -872
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -19,10 +19,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// index.ts
|
|
20
20
|
var index_exports = {};
|
|
21
21
|
__export(index_exports, {
|
|
22
|
+
DEPIN_REMOTE_METHODS: () => DEPIN_REMOTE_METHODS,
|
|
23
|
+
DEPIN_RPC_PROTOCOL: () => DEPIN_RPC_PROTOCOL,
|
|
22
24
|
MAINNET_GENESIS_HASH: () => MAINNET_GENESIS_HASH,
|
|
23
25
|
TESTNET_GENESIS_HASH: () => TESTNET_GENESIS_HASH,
|
|
26
|
+
assertNoDuplicateJsonKeys: () => assertNoDuplicateJsonKeys,
|
|
24
27
|
assertRpcGenesis: () => assertRpcGenesis,
|
|
28
|
+
createDepinNodeRouter: () => createDepinNodeRouter,
|
|
29
|
+
getDepinRequest: () => getDepinRequest,
|
|
25
30
|
getRPC: () => getRPC,
|
|
31
|
+
isDepinRemoteMethod: () => isDepinRemoteMethod,
|
|
26
32
|
methods: () => methods,
|
|
27
33
|
parseRpcJson: () => parseRpcJson,
|
|
28
34
|
rpcNumber: () => rpcNumber,
|
|
@@ -61,7 +67,7 @@ var methods = {
|
|
|
61
67
|
> neurai-cli importprivkey "mykey"
|
|
62
68
|
|
|
63
69
|
Abort the running wallet rescan
|
|
64
|
-
> neurai-cli abortrescan
|
|
70
|
+
> neurai-cli abortrescan
|
|
65
71
|
|
|
66
72
|
As a JSON-RPC call
|
|
67
73
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "abortrescan", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
@@ -264,7 +270,7 @@ var methods = {
|
|
|
264
270
|
Clear all banned IPs.
|
|
265
271
|
|
|
266
272
|
Examples:
|
|
267
|
-
> neurai-cli clearbanned
|
|
273
|
+
> neurai-cli clearbanned
|
|
268
274
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "clearbanned", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
269
275
|
**/
|
|
270
276
|
clearbanned: "clearbanned",
|
|
@@ -273,11 +279,11 @@ var methods = {
|
|
|
273
279
|
Removes all transaction from the mempool
|
|
274
280
|
|
|
275
281
|
Examples:
|
|
276
|
-
> neurai-cli clearmempool
|
|
282
|
+
> neurai-cli clearmempool
|
|
277
283
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "clearmempool", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
278
284
|
**/
|
|
279
285
|
clearmempool: "clearmempool",
|
|
280
|
-
/** clearmessages
|
|
286
|
+
/** clearmessages
|
|
281
287
|
|
|
282
288
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
283
289
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -289,14 +295,14 @@ var methods = {
|
|
|
289
295
|
]
|
|
290
296
|
|
|
291
297
|
Examples:
|
|
292
|
-
> neurai-cli clearmessages
|
|
298
|
+
> neurai-cli clearmessages
|
|
293
299
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "clearmessages", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
294
300
|
**/
|
|
295
301
|
clearmessages: "clearmessages",
|
|
296
302
|
/** combinerawtransaction ["hexstring",...]
|
|
297
303
|
|
|
298
304
|
Combine multiple partially signed transactions into one transaction.
|
|
299
|
-
The combined transaction may be another partially signed transaction or a
|
|
305
|
+
The combined transaction may be another partially signed transaction or a
|
|
300
306
|
fully signed transaction.
|
|
301
307
|
Arguments:
|
|
302
308
|
1. "txs" (string) A json array of hex strings of partially signed transactions
|
|
@@ -402,7 +408,7 @@ var methods = {
|
|
|
402
408
|
"txid":"id", (string, required) The transaction id
|
|
403
409
|
"vout":n, (number, required) The output number
|
|
404
410
|
"sequence":n (number, optional) The sequence number
|
|
405
|
-
}
|
|
411
|
+
}
|
|
406
412
|
,...
|
|
407
413
|
]
|
|
408
414
|
2. "outputs" (object or array, required) outputs in object or ordered-array form
|
|
@@ -446,10 +452,10 @@ var methods = {
|
|
|
446
452
|
{ (object) A json object describing new unique assets to issue
|
|
447
453
|
"issue_unique":
|
|
448
454
|
{
|
|
449
|
-
"root_name":"root-name", (string, required) name of the asset the unique asset(s)
|
|
455
|
+
"root_name":"root-name", (string, required) name of the asset the unique asset(s)
|
|
450
456
|
are being issued under
|
|
451
457
|
"asset_tags":["asset_tag", ...], (array, required) the unique tag for each asset which is to be issued
|
|
452
|
-
"ipfs_hashes":["hash", ...], (array, optional) ipfs hashes corresponding to each supplied tag
|
|
458
|
+
"ipfs_hashes":["hash", ...], (array, optional) ipfs hashes corresponding to each supplied tag
|
|
453
459
|
(should be same size as "asset_tags")
|
|
454
460
|
}
|
|
455
461
|
}
|
|
@@ -460,9 +466,9 @@ var methods = {
|
|
|
460
466
|
"asset_name":"asset-name", (string, required) name of asset to be reissued
|
|
461
467
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
462
468
|
"reissuable":[0-1], (number, optional) default is 1, 1=reissuable asset
|
|
463
|
-
"ipfs_hash":"hash", (string, optional) An ipfs hash for discovering asset metadata,
|
|
469
|
+
"ipfs_hash":"hash", (string, optional) An ipfs hash for discovering asset metadata,
|
|
464
470
|
Overrides the current ipfs hash if given
|
|
465
|
-
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
471
|
+
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
466
472
|
If not given, it will be sent to the output address
|
|
467
473
|
}
|
|
468
474
|
}
|
|
@@ -472,13 +478,13 @@ var methods = {
|
|
|
472
478
|
{
|
|
473
479
|
"asset_name":"asset-name",(string, required) new asset name
|
|
474
480
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
475
|
-
"verifier_string":"text", (string, required) the verifier string to be used for a restricted
|
|
481
|
+
"verifier_string":"text", (string, required) the verifier string to be used for a restricted
|
|
476
482
|
asset transfer verification
|
|
477
483
|
"units":[0-8], (number, required) display units, between 0 (integral) and 8 (max precision)
|
|
478
484
|
"reissuable":[0-1], (number, required) 1=reissuable asset
|
|
479
485
|
"has_ipfs":[0-1], (number, required) 1=passing ipfs_hash
|
|
480
486
|
"ipfs_hash":"hash", (string, optional) an ipfs hash for discovering asset metadata
|
|
481
|
-
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
487
|
+
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
482
488
|
If not given, it will be sent to the output address
|
|
483
489
|
}
|
|
484
490
|
}
|
|
@@ -489,11 +495,11 @@ var methods = {
|
|
|
489
495
|
"asset_name":"asset-name", (string, required) name of asset to be reissued
|
|
490
496
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
491
497
|
"reissuable":[0-1], (number, optional) default is 1, 1=reissuable asset
|
|
492
|
-
"verifier_string":"text", (string, optional) the verifier string to be used for a restricted asset
|
|
498
|
+
"verifier_string":"text", (string, optional) the verifier string to be used for a restricted asset
|
|
493
499
|
transfer verification
|
|
494
|
-
"ipfs_hash":"hash", (string, optional) An ipfs hash for discovering asset metadata,
|
|
500
|
+
"ipfs_hash":"hash", (string, optional) An ipfs hash for discovering asset metadata,
|
|
495
501
|
Overrides the current ipfs hash if given
|
|
496
|
-
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
502
|
+
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
497
503
|
If not given, it will be sent to the output address
|
|
498
504
|
}
|
|
499
505
|
}
|
|
@@ -503,9 +509,9 @@ var methods = {
|
|
|
503
509
|
{
|
|
504
510
|
"asset_name":"asset_name", (string, required) a qualifier name (starts with '#')
|
|
505
511
|
"asset_quantity":n, (numeric, optional, default=1) the number of units to be issued (1 to 10)
|
|
506
|
-
"has_ipfs":[0-1], (boolean, optional, default=false), whether ifps hash is going
|
|
512
|
+
"has_ipfs":[0-1], (boolean, optional, default=false), whether ifps hash is going
|
|
507
513
|
to be added to the asset
|
|
508
|
-
"ipfs_hash":"hash", (string, optional but required if has_ipfs = 1), an ipfs hash or a
|
|
514
|
+
"ipfs_hash":"hash", (string, optional but required if has_ipfs = 1), an ipfs hash or a
|
|
509
515
|
txid hash once RIP5 is activated
|
|
510
516
|
"root_change_address" (string, optional) Only applies when issuing subqualifiers.
|
|
511
517
|
The address where the root qualifier will be sent.
|
|
@@ -729,216 +735,114 @@ var methods = {
|
|
|
729
735
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "decodescript", "params": ["hexstring"] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
730
736
|
**/
|
|
731
737
|
decodescript: "decodescript",
|
|
732
|
-
/**
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
Examples:
|
|
740
|
-
> neurai-cli depinchallenge "&TOKEN/SECTION" "NXholder..." 1730000000000 "<signature>"
|
|
741
|
-
**/
|
|
738
|
+
/**
|
|
739
|
+
* depinchallenge request
|
|
740
|
+
*
|
|
741
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
742
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
743
|
+
*/
|
|
742
744
|
depinchallenge: "depinchallenge",
|
|
743
|
-
/**
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
"removed": n,
|
|
750
|
-
"remaining": n
|
|
751
|
-
}
|
|
752
|
-
**/
|
|
745
|
+
/**
|
|
746
|
+
* depinclearmsg request
|
|
747
|
+
*
|
|
748
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
749
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
750
|
+
*/
|
|
753
751
|
depinclearmsg: "depinclearmsg",
|
|
754
|
-
/**
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
752
|
+
/**
|
|
753
|
+
* depindecrypt "address" "encrypted"
|
|
754
|
+
*
|
|
755
|
+
* Decrypts an encrypted DePIN reply with a wallet key. Verify the reply's poolsig before using this method; depindecrypt does not verify it.
|
|
756
|
+
*
|
|
757
|
+
* Result:
|
|
758
|
+
* The decrypted JSON value, or a string when the plaintext is not JSON.
|
|
759
|
+
*/
|
|
761
760
|
depindecrypt: "depindecrypt",
|
|
762
|
-
/**
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
Active means: positive balance, public key revealed, and not blocked by an
|
|
769
|
-
owner freeze or by self-revocation. Restriction is per (asset, address), so an
|
|
770
|
-
address that is active in at least one ancestor is returned even if it revoked
|
|
771
|
-
itself in another -- holding the root already grants visibility over the branch.
|
|
772
|
-
|
|
773
|
-
The query is exact: '&TEST' returns holders of '&TEST' only, never of
|
|
774
|
-
'&TEST/APPLE', '&TESTING' or '&TEST.FOO'. Every derived ancestor must exist; a
|
|
775
|
-
missing intermediate level is an error rather than something skipped.
|
|
776
|
-
|
|
777
|
-
This command is informational. It does not know about -depinmsgmaxusers, does
|
|
778
|
-
not decide whether a message fits in a pool, and a truncated result must not be
|
|
779
|
-
treated as a complete recipient set.
|
|
780
|
-
|
|
781
|
-
Requires -assetindex and -pubkeyindex.
|
|
782
|
-
|
|
783
|
-
Arguments:
|
|
784
|
-
1. "token" (string, required) DEPIN token, e.g. "&TEST/APPLE/GOLDEN"
|
|
785
|
-
2. max_results (numeric, optional, default=1000) Maximum recipients to return
|
|
786
|
-
(1..10000)
|
|
787
|
-
3. "stop_at" (string, optional) Stop deriving ancestors at this token,
|
|
788
|
-
inclusive. Must be the token itself or one of its ancestors.
|
|
789
|
-
Omitted: derive up to the absolute root.
|
|
790
|
-
|
|
791
|
-
Result:
|
|
792
|
-
{
|
|
793
|
-
"token": "name", (string) Token queried
|
|
794
|
-
"stop_at": "name", (string) Where derivation stopped ("" = root)
|
|
795
|
-
"ancestors": ["name", ...], (array) Token first, then each ancestor
|
|
796
|
-
"recipients": [ (array) Active holders, ordered by address
|
|
797
|
-
{
|
|
798
|
-
"address": "address", (string) Holder address
|
|
799
|
-
"pubkey": "hex" (string) Public key revealed on chain
|
|
800
|
-
}, ...
|
|
801
|
-
],
|
|
802
|
-
"returned": n, (numeric) Number of recipients returned
|
|
803
|
-
"max_results": n, (numeric) Limit applied
|
|
804
|
-
"truncated": true|false, (boolean) True if more eligible recipients exist
|
|
805
|
-
"skipped_no_pubkey": n, (numeric) Addresses dropped for lacking a usable
|
|
806
|
-
revealed public key
|
|
807
|
-
"skipped_no_pubkey_complete": bool, (boolean) False when truncated: the count then
|
|
808
|
-
covers only the addresses examined
|
|
809
|
-
"skipped_restricted": n, (numeric) Addresses dropped as frozen or
|
|
810
|
-
self-revoked in every ancestor they hold
|
|
811
|
-
"skipped_restricted_complete": bool (boolean) Same rule as above
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
Examples:
|
|
815
|
-
> neurai-cli depingetancestorrecipients "&TEST/APPLE/GOLDEN"
|
|
816
|
-
> neurai-cli depingetancestorrecipients "&TEST/APPLE/GOLDEN" 50 "&TEST/APPLE"
|
|
817
|
-
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "depingetancestorrecipients", "params": ["&TEST/APPLE/GOLDEN", 50, "&TEST/APPLE"] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
818
|
-
**/
|
|
761
|
+
/**
|
|
762
|
+
* depingetancestorrecipients request
|
|
763
|
+
*
|
|
764
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
765
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
766
|
+
*/
|
|
819
767
|
depingetancestorrecipients: "depingetancestorrecipients",
|
|
820
|
-
/**
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
768
|
+
/**
|
|
769
|
+
* depingetmsg "token" ( "fromaddress" )
|
|
770
|
+
*
|
|
771
|
+
* Uses the local node wallet to decrypt messages from the local DePIN pool. The optional address must belong to the wallet and hold the requested token or a related branch token.
|
|
772
|
+
*/
|
|
824
773
|
depingetmsg: "depingetmsg",
|
|
825
|
-
/**
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
774
|
+
/**
|
|
775
|
+
* depingetmsginfo request
|
|
776
|
+
*
|
|
777
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
778
|
+
* Bootstrap fields: protocol=5, request_id (32 random bytes in lowercase hex), timestamp_ms (integer milliseconds). Verify the response with the local request hash, expected genesis and pinned pool key before using its context.
|
|
779
|
+
*/
|
|
829
780
|
depingetmsginfo: "depingetmsginfo",
|
|
830
|
-
/**
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
781
|
+
/**
|
|
782
|
+
* depinlistsections request
|
|
783
|
+
*
|
|
784
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
785
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
786
|
+
*/
|
|
834
787
|
depinlistsections: "depinlistsections",
|
|
835
|
-
/**
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
"enabled": true|false, (boolean) Whether MCP worker is enabled
|
|
842
|
-
"running": true|false, (boolean) Whether MCP worker is running
|
|
843
|
-
"mcp_url": "url", (string) MCP server URL
|
|
844
|
-
"model_name": "name", (string) Name of the loaded AI model
|
|
845
|
-
"command_key": "key", (string) Command prefix (e.g. /ai)
|
|
846
|
-
"depin_token": "token", (string) DePIN token being monitored
|
|
847
|
-
"poll_interval": n, (numeric) Polling interval in seconds
|
|
848
|
-
"commands_processed": n, (numeric) Total commands processed
|
|
849
|
-
"total_errors": n, (numeric) Total errors encountered
|
|
850
|
-
"rate_limited": n, (numeric) Commands rejected by rate limiting
|
|
851
|
-
"concurrency": n, (numeric) Number of parallel task threads
|
|
852
|
-
"tasks_in_flight": n, (numeric) AI requests currently being processed
|
|
853
|
-
"processed_cache": n, (numeric) Size of the processed-message dedup cache
|
|
854
|
-
"context_sessions": n, (numeric) Active conversation contexts
|
|
855
|
-
"last_poll_time": n (numeric) Unix timestamp of last poll
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
Examples:
|
|
859
|
-
> neurai-cli depinmcpstatus
|
|
860
|
-
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "depinmcpstatus", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
861
|
-
**/
|
|
788
|
+
/**
|
|
789
|
+
* depinmcpstatus request
|
|
790
|
+
*
|
|
791
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
792
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
793
|
+
*/
|
|
862
794
|
depinmcpstatus: "depinmcpstatus",
|
|
863
|
-
/**
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
795
|
+
/**
|
|
796
|
+
* depinpoolpkey
|
|
797
|
+
*
|
|
798
|
+
* Wallet-only operator helper that derives the dedicated DePIN pool public key from the loaded service wallet.
|
|
799
|
+
*
|
|
800
|
+
* Result:
|
|
801
|
+
* {
|
|
802
|
+
* "pubkey": "hex",
|
|
803
|
+
* "address": "address",
|
|
804
|
+
* "path": "derivation_path"
|
|
805
|
+
* }
|
|
806
|
+
*/
|
|
874
807
|
depinpoolpkey: "depinpoolpkey",
|
|
875
|
-
/**
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
"enabled": true|false,
|
|
882
|
-
"token": "string",
|
|
883
|
-
"total_messages": n,
|
|
884
|
-
"total_size_bytes": n,
|
|
885
|
-
"memory_usage_bytes": n,
|
|
886
|
-
"oldest_message": "YYYY-MM-DD HH:MM:SS",
|
|
887
|
-
"newest_message": "YYYY-MM-DD HH:MM:SS",
|
|
888
|
-
"messages_by_age": {
|
|
889
|
-
"last_hour": n,
|
|
890
|
-
"last_day": n,
|
|
891
|
-
"last_week": n
|
|
892
|
-
},
|
|
893
|
-
"unique_senders": n,
|
|
894
|
-
"unique_recipients": n,
|
|
895
|
-
"avg_recipients_per_message": n.nn,
|
|
896
|
-
"avg_message_size": n,
|
|
897
|
-
"expiring_in_24h": n
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
Examples:
|
|
901
|
-
> neurai-cli depinpoolstats
|
|
902
|
-
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "depinpoolstats", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
903
|
-
**/
|
|
808
|
+
/**
|
|
809
|
+
* depinpoolstats request
|
|
810
|
+
*
|
|
811
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
812
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
813
|
+
*/
|
|
904
814
|
depinpoolstats: "depinpoolstats",
|
|
905
|
-
/**
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
815
|
+
/**
|
|
816
|
+
* depinreceivemsg request
|
|
817
|
+
*
|
|
818
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
819
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
820
|
+
*/
|
|
909
821
|
depinreceivemsg: "depinreceivemsg",
|
|
910
|
-
/**
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
822
|
+
/**
|
|
823
|
+
* depinreceiveseq request
|
|
824
|
+
*
|
|
825
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
826
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
827
|
+
*/
|
|
828
|
+
depinreceiveseq: "depinreceiveseq",
|
|
829
|
+
/**
|
|
830
|
+
* depinsendmsg "token" "message" "fromaddress"
|
|
831
|
+
*
|
|
832
|
+
* Uses the local node wallet to sign and encrypt a message for eligible recipients, then adds it to the local DePIN pool. Remote host and port parameters were removed in protocol 2.
|
|
833
|
+
*/
|
|
914
834
|
depinsendmsg: "depinsendmsg",
|
|
915
|
-
/**
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
/** depinsignrequest "address" "token" ( "type" )
|
|
927
|
-
|
|
928
|
-
Wallet helper that signs a depinchallenge request over the current Unix time in milliseconds.
|
|
929
|
-
|
|
930
|
-
Result:
|
|
931
|
-
{
|
|
932
|
-
"timestamp": n,
|
|
933
|
-
"signature": "base64",
|
|
934
|
-
"preimage": "DEPIN-REQ|..."
|
|
935
|
-
}
|
|
936
|
-
**/
|
|
937
|
-
depinsignrequest: "depinsignrequest",
|
|
938
|
-
/** depinsubmitmsg {"sender":"...","encrypted":"..."}
|
|
939
|
-
|
|
940
|
-
Submits a client-prepared, signed DePIN message wrapped in an ECIES envelope for the pool key published by depingetmsginfo. Bare serialized hex is no longer accepted.
|
|
941
|
-
**/
|
|
835
|
+
/**
|
|
836
|
+
* depinsignrpc "method" request
|
|
837
|
+
* Local unlocked-wallet helper: sign a complete RPC 5 request. Returns request, preimage and request_hash. Never expose this wallet helper through a public HTTP/WSS proxy.
|
|
838
|
+
*/
|
|
839
|
+
depinsignrpc: "depinsignrpc",
|
|
840
|
+
/**
|
|
841
|
+
* depinsubmitmsg request
|
|
842
|
+
*
|
|
843
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
844
|
+
* Request fields: protocol, network (genesis), pool_pubkey, pool_root, instance_id, membership_revision, request_id, timestamp_ms, token, address, challenge, args, signature. Every private operation signs its method, target identity, revision and arguments. Public authentication fields are empty. Replies sign the exact request hash and served membership metadata. Verify before decoding/decrypting. See DEPIN_EXAMPLES.md for method-specific args and neurai-depin-msg integration.
|
|
845
|
+
*/
|
|
942
846
|
depinsubmitmsg: "depinsubmitmsg",
|
|
943
847
|
/** disconnectnode "[address]" [nodeid]
|
|
944
848
|
|
|
@@ -1005,7 +909,7 @@ var methods = {
|
|
|
1005
909
|
"xpqpriv..." (string) Base58Check-encoded master CExtKeyPQ
|
|
1006
910
|
|
|
1007
911
|
Examples:
|
|
1008
|
-
> neurai-cli dumpextkeypq
|
|
912
|
+
> neurai-cli dumpextkeypq
|
|
1009
913
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "dumpextkeypq", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1010
914
|
**/
|
|
1011
915
|
dumpextkeypq: "dumpextkeypq",
|
|
@@ -1046,7 +950,7 @@ var methods = {
|
|
|
1046
950
|
/** encryptwallet "passphrase"
|
|
1047
951
|
|
|
1048
952
|
Encrypts the wallet with 'passphrase'. This is for first time encryption.
|
|
1049
|
-
After this, any calls that interact with private keys such as sending or signing
|
|
953
|
+
After this, any calls that interact with private keys such as sending or signing
|
|
1050
954
|
will require the passphrase to be set prior the making these calls.
|
|
1051
955
|
Use the walletpassphrase call for this, and then walletlock call.
|
|
1052
956
|
If the wallet is already encrypted, use the walletpassphrasechange call.
|
|
@@ -1067,7 +971,7 @@ var methods = {
|
|
|
1067
971
|
> neurai-cli signmessage "address" "test message"
|
|
1068
972
|
|
|
1069
973
|
Now lock the wallet again by removing the passphrase
|
|
1070
|
-
> neurai-cli walletlock
|
|
974
|
+
> neurai-cli walletlock
|
|
1071
975
|
|
|
1072
976
|
As a json rpc call
|
|
1073
977
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "encryptwallet", "params": ["my pass phrase"] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
@@ -1336,7 +1240,7 @@ var methods = {
|
|
|
1336
1240
|
"address" (string) The account neurai address
|
|
1337
1241
|
|
|
1338
1242
|
Examples:
|
|
1339
|
-
> neurai-cli getaccountaddress
|
|
1243
|
+
> neurai-cli getaccountaddress
|
|
1340
1244
|
> neurai-cli getaccountaddress ""
|
|
1341
1245
|
> neurai-cli getaccountaddress "myaccount"
|
|
1342
1246
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaccountaddress", "params": ["myaccount"] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
@@ -1615,7 +1519,7 @@ var methods = {
|
|
|
1615
1519
|
Examples:
|
|
1616
1520
|
|
|
1617
1521
|
The total amount in the wallet with 1 or more confirmations
|
|
1618
|
-
> neurai-cli getbalance
|
|
1522
|
+
> neurai-cli getbalance
|
|
1619
1523
|
|
|
1620
1524
|
The total amount in the wallet at least 6 blocks confirmed
|
|
1621
1525
|
> neurai-cli getbalance "*" 6
|
|
@@ -1632,15 +1536,15 @@ var methods = {
|
|
|
1632
1536
|
"hex" (string) the block hash hex encoded
|
|
1633
1537
|
|
|
1634
1538
|
Examples:
|
|
1635
|
-
> neurai-cli getbestblockhash
|
|
1539
|
+
> neurai-cli getbestblockhash
|
|
1636
1540
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestblockhash", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1637
1541
|
**/
|
|
1638
1542
|
getbestblockhash: "getbestblockhash",
|
|
1639
|
-
/** getblock "blockhash" ( verbosity )
|
|
1543
|
+
/** getblock "blockhash" ( verbosity )
|
|
1640
1544
|
|
|
1641
1545
|
If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.
|
|
1642
1546
|
If verbosity is 1, returns an Object with information about block <hash>.
|
|
1643
|
-
If verbosity is 2, returns an Object with information about block <hash> and information about each transaction.
|
|
1547
|
+
If verbosity is 2, returns an Object with information about block <hash> and information about each transaction.
|
|
1644
1548
|
|
|
1645
1549
|
Arguments:
|
|
1646
1550
|
1. "blockhash" (string, required) The block hash
|
|
@@ -1723,11 +1627,11 @@ var methods = {
|
|
|
1723
1627
|
"timeout": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in
|
|
1724
1628
|
"since": xx, (numeric) height of the first block to which the status applies
|
|
1725
1629
|
"statistics": { (object) numeric statistics about BIP9 signalling for a softfork (only for "started" status)
|
|
1726
|
-
"period": xx, (numeric) the length in blocks of the BIP9 signalling period
|
|
1727
|
-
"threshold": xx, (numeric) the number of blocks with the version bit set required to activate the feature
|
|
1728
|
-
"elapsed": xx, (numeric) the number of blocks elapsed since the beginning of the current period
|
|
1729
|
-
"count": xx, (numeric) the number of blocks with the version bit set in the current period
|
|
1730
|
-
"possible": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold
|
|
1630
|
+
"period": xx, (numeric) the length in blocks of the BIP9 signalling period
|
|
1631
|
+
"threshold": xx, (numeric) the number of blocks with the version bit set required to activate the feature
|
|
1632
|
+
"elapsed": xx, (numeric) the number of blocks elapsed since the beginning of the current period
|
|
1633
|
+
"count": xx, (numeric) the number of blocks with the version bit set in the current period
|
|
1634
|
+
"possible": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold
|
|
1731
1635
|
}
|
|
1732
1636
|
}
|
|
1733
1637
|
}
|
|
@@ -1735,7 +1639,7 @@ var methods = {
|
|
|
1735
1639
|
}
|
|
1736
1640
|
|
|
1737
1641
|
Examples:
|
|
1738
|
-
> neurai-cli getblockchaininfo
|
|
1642
|
+
> neurai-cli getblockchaininfo
|
|
1739
1643
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1740
1644
|
**/
|
|
1741
1645
|
getblockchaininfo: "getblockchaininfo",
|
|
@@ -1747,7 +1651,7 @@ var methods = {
|
|
|
1747
1651
|
n (numeric) The current block count
|
|
1748
1652
|
|
|
1749
1653
|
Examples:
|
|
1750
|
-
> neurai-cli getblockcount
|
|
1654
|
+
> neurai-cli getblockcount
|
|
1751
1655
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1752
1656
|
**/
|
|
1753
1657
|
getblockcount: "getblockcount",
|
|
@@ -1871,7 +1775,7 @@ var methods = {
|
|
|
1871
1775
|
"data" : "xxxx", (string) transaction data encoded in hexadecimal (byte-for-byte)
|
|
1872
1776
|
"txid" : "xxxx", (string) transaction id encoded in little-endian hexadecimal
|
|
1873
1777
|
"hash" : "xxxx", (string) hash encoded in little-endian hexadecimal (including witness data)
|
|
1874
|
-
"depends" : [ (array) array of numbers
|
|
1778
|
+
"depends" : [ (array) array of numbers
|
|
1875
1779
|
n (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is
|
|
1876
1780
|
,...
|
|
1877
1781
|
],
|
|
@@ -1889,7 +1793,7 @@ var methods = {
|
|
|
1889
1793
|
"coinbasetxn" : { ... }, (json object) information for coinbase transaction
|
|
1890
1794
|
"target" : "xxxx", (string) The hash target
|
|
1891
1795
|
"mintime" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)
|
|
1892
|
-
"mutable" : [ (array of string) list of ways the block template may be changed
|
|
1796
|
+
"mutable" : [ (array of string) list of ways the block template may be changed
|
|
1893
1797
|
"value" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'
|
|
1894
1798
|
,...
|
|
1895
1799
|
],
|
|
@@ -1903,11 +1807,11 @@ var methods = {
|
|
|
1903
1807
|
}
|
|
1904
1808
|
|
|
1905
1809
|
Examples:
|
|
1906
|
-
> neurai-cli getblocktemplate
|
|
1810
|
+
> neurai-cli getblocktemplate
|
|
1907
1811
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblocktemplate", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1908
1812
|
**/
|
|
1909
1813
|
getblocktemplate: "getblocktemplate",
|
|
1910
|
-
/** getcacheinfo
|
|
1814
|
+
/** getcacheinfo
|
|
1911
1815
|
|
|
1912
1816
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
1913
1817
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -1927,7 +1831,7 @@ var methods = {
|
|
|
1927
1831
|
|
|
1928
1832
|
Examples:
|
|
1929
1833
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getcacheinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1930
|
-
> neurai-cli getcacheinfo
|
|
1834
|
+
> neurai-cli getcacheinfo
|
|
1931
1835
|
**/
|
|
1932
1836
|
getcacheinfo: "getcacheinfo",
|
|
1933
1837
|
/** getchaintips
|
|
@@ -1956,7 +1860,7 @@ var methods = {
|
|
|
1956
1860
|
5. "active" This is the tip of the active main chain, which is certainly valid
|
|
1957
1861
|
|
|
1958
1862
|
Examples:
|
|
1959
|
-
> neurai-cli getchaintips
|
|
1863
|
+
> neurai-cli getchaintips
|
|
1960
1864
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintips", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1961
1865
|
**/
|
|
1962
1866
|
getchaintips: "getchaintips",
|
|
@@ -1979,7 +1883,7 @@ var methods = {
|
|
|
1979
1883
|
}
|
|
1980
1884
|
|
|
1981
1885
|
Examples:
|
|
1982
|
-
> neurai-cli getchaintxstats
|
|
1886
|
+
> neurai-cli getchaintxstats
|
|
1983
1887
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintxstats", "params": [2016] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1984
1888
|
**/
|
|
1985
1889
|
getchaintxstats: "getchaintxstats",
|
|
@@ -1991,7 +1895,7 @@ var methods = {
|
|
|
1991
1895
|
n (numeric) The connection count
|
|
1992
1896
|
|
|
1993
1897
|
Examples:
|
|
1994
|
-
> neurai-cli getconnectioncount
|
|
1898
|
+
> neurai-cli getconnectioncount
|
|
1995
1899
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getconnectioncount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1996
1900
|
**/
|
|
1997
1901
|
getconnectioncount: "getconnectioncount",
|
|
@@ -2003,7 +1907,7 @@ var methods = {
|
|
|
2003
1907
|
n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.
|
|
2004
1908
|
|
|
2005
1909
|
Examples:
|
|
2006
|
-
> neurai-cli getdifficulty
|
|
1910
|
+
> neurai-cli getdifficulty
|
|
2007
1911
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getdifficulty", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2008
1912
|
**/
|
|
2009
1913
|
getdifficulty: "getdifficulty",
|
|
@@ -2035,7 +1939,7 @@ var methods = {
|
|
|
2035
1939
|
true|false (boolean) If the server is set to generate coins or not
|
|
2036
1940
|
|
|
2037
1941
|
Examples:
|
|
2038
|
-
> neurai-cli getgenerate
|
|
1942
|
+
> neurai-cli getgenerate
|
|
2039
1943
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getgenerate", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2040
1944
|
**/
|
|
2041
1945
|
getgenerate: "getgenerate",
|
|
@@ -2086,7 +1990,7 @@ var methods = {
|
|
|
2086
1990
|
}
|
|
2087
1991
|
|
|
2088
1992
|
Examples:
|
|
2089
|
-
> neurai-cli getinfo
|
|
1993
|
+
> neurai-cli getinfo
|
|
2090
1994
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2091
1995
|
**/
|
|
2092
1996
|
getinfo: "getinfo",
|
|
@@ -2124,7 +2028,7 @@ var methods = {
|
|
|
2124
2028
|
}
|
|
2125
2029
|
|
|
2126
2030
|
Examples:
|
|
2127
|
-
> neurai-cli getmasterkeyinfo
|
|
2031
|
+
> neurai-cli getmasterkeyinfo
|
|
2128
2032
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmasterkeyinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2129
2033
|
**/
|
|
2130
2034
|
getmasterkeyinfo: "getmasterkeyinfo",
|
|
@@ -2151,7 +2055,7 @@ var methods = {
|
|
|
2151
2055
|
"<malloc version="1">..."
|
|
2152
2056
|
|
|
2153
2057
|
Examples:
|
|
2154
|
-
> neurai-cli getmemoryinfo
|
|
2058
|
+
> neurai-cli getmemoryinfo
|
|
2155
2059
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmemoryinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2156
2060
|
**/
|
|
2157
2061
|
getmemoryinfo: "getmemoryinfo",
|
|
@@ -2280,7 +2184,7 @@ var methods = {
|
|
|
2280
2184
|
}
|
|
2281
2185
|
|
|
2282
2186
|
Examples:
|
|
2283
|
-
> neurai-cli getmempoolinfo
|
|
2187
|
+
> neurai-cli getmempoolinfo
|
|
2284
2188
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmempoolinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2285
2189
|
**/
|
|
2286
2190
|
getmempoolinfo: "getmempoolinfo",
|
|
@@ -2302,7 +2206,7 @@ var methods = {
|
|
|
2302
2206
|
}
|
|
2303
2207
|
|
|
2304
2208
|
Examples:
|
|
2305
|
-
> neurai-cli getmininginfo
|
|
2209
|
+
> neurai-cli getmininginfo
|
|
2306
2210
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2307
2211
|
**/
|
|
2308
2212
|
getmininginfo: "getmininginfo",
|
|
@@ -2316,7 +2220,7 @@ var methods = {
|
|
|
2316
2220
|
"passphrase:" (optional) Only show if passphrase was used when creating the wallet
|
|
2317
2221
|
|
|
2318
2222
|
Examples:
|
|
2319
|
-
> neurai-cli getmywords
|
|
2223
|
+
> neurai-cli getmywords
|
|
2320
2224
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmywords", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2321
2225
|
**/
|
|
2322
2226
|
getmywords: "getmywords",
|
|
@@ -2342,7 +2246,7 @@ var methods = {
|
|
|
2342
2246
|
}
|
|
2343
2247
|
|
|
2344
2248
|
Examples:
|
|
2345
|
-
> neurai-cli getnettotals
|
|
2249
|
+
> neurai-cli getnettotals
|
|
2346
2250
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnettotals", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2347
2251
|
**/
|
|
2348
2252
|
getnettotals: "getnettotals",
|
|
@@ -2360,7 +2264,7 @@ var methods = {
|
|
|
2360
2264
|
x (numeric) Hashes per second estimated
|
|
2361
2265
|
|
|
2362
2266
|
Examples:
|
|
2363
|
-
> neurai-cli getnetworkhashps
|
|
2267
|
+
> neurai-cli getnetworkhashps
|
|
2364
2268
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnetworkhashps", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2365
2269
|
**/
|
|
2366
2270
|
getnetworkhashps: "getnetworkhashps",
|
|
@@ -2401,14 +2305,14 @@ var methods = {
|
|
|
2401
2305
|
}
|
|
2402
2306
|
|
|
2403
2307
|
Examples:
|
|
2404
|
-
> neurai-cli getnetworkinfo
|
|
2308
|
+
> neurai-cli getnetworkinfo
|
|
2405
2309
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnetworkinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2406
2310
|
**/
|
|
2407
2311
|
getnetworkinfo: "getnetworkinfo",
|
|
2408
2312
|
/** getnewaddress ( "account" "address_type" )
|
|
2409
2313
|
|
|
2410
2314
|
Returns a new Neurai address for receiving payments.
|
|
2411
|
-
If 'account' is specified (DEPRECATED), it is added to the address book
|
|
2315
|
+
If 'account' is specified (DEPRECATED), it is added to the address book
|
|
2412
2316
|
so payments received with the address will be credited to 'account'.
|
|
2413
2317
|
|
|
2414
2318
|
Arguments:
|
|
@@ -2419,7 +2323,7 @@ var methods = {
|
|
|
2419
2323
|
"address" (string) The new neurai address
|
|
2420
2324
|
|
|
2421
2325
|
Examples:
|
|
2422
|
-
> neurai-cli getnewaddress
|
|
2326
|
+
> neurai-cli getnewaddress
|
|
2423
2327
|
> neurai-cli getnewaddress "" "ecdsa"
|
|
2424
2328
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": ["", "pq"] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2425
2329
|
**/
|
|
@@ -2472,7 +2376,7 @@ var methods = {
|
|
|
2472
2376
|
]
|
|
2473
2377
|
|
|
2474
2378
|
Examples:
|
|
2475
|
-
> neurai-cli getpeerinfo
|
|
2379
|
+
> neurai-cli getpeerinfo
|
|
2476
2380
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getpeerinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2477
2381
|
**/
|
|
2478
2382
|
getpeerinfo: "getpeerinfo",
|
|
@@ -2509,7 +2413,7 @@ var methods = {
|
|
|
2509
2413
|
"address" (string) The address
|
|
2510
2414
|
|
|
2511
2415
|
Examples:
|
|
2512
|
-
> neurai-cli getrawchangeaddress
|
|
2416
|
+
> neurai-cli getrawchangeaddress
|
|
2513
2417
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawchangeaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2514
2418
|
**/
|
|
2515
2419
|
getrawchangeaddress: "getrawchangeaddress",
|
|
@@ -2584,7 +2488,7 @@ var methods = {
|
|
|
2584
2488
|
"vin" : [ (array of json objects)
|
|
2585
2489
|
{
|
|
2586
2490
|
"txid": "id", (string) The transaction id
|
|
2587
|
-
"vout": n, (numeric)
|
|
2491
|
+
"vout": n, (numeric)
|
|
2588
2492
|
"scriptSig": { (json object) The script
|
|
2589
2493
|
"asm": "asm", (string) asm
|
|
2590
2494
|
"hex": "hex" (string) hex
|
|
@@ -2683,12 +2587,12 @@ var methods = {
|
|
|
2683
2587
|
"active_commands" (array) All active commands
|
|
2684
2588
|
[
|
|
2685
2589
|
{ (object) Information about an active command
|
|
2686
|
-
"method" (string) The name of the RPC command
|
|
2590
|
+
"method" (string) The name of the RPC command
|
|
2687
2591
|
"duration" (numeric) The running time in microseconds
|
|
2688
2592
|
},...
|
|
2689
2593
|
],
|
|
2690
2594
|
}
|
|
2691
|
-
> neurai-cli getrpcinfo
|
|
2595
|
+
> neurai-cli getrpcinfo
|
|
2692
2596
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrpcinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2693
2597
|
**/
|
|
2694
2598
|
getrpcinfo: "getrpcinfo",
|
|
@@ -2770,7 +2674,7 @@ var methods = {
|
|
|
2770
2674
|
Result:
|
|
2771
2675
|
{
|
|
2772
2676
|
"amount" : x.xxx, (numeric) The transaction amount in XNA
|
|
2773
|
-
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
2677
|
+
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
2774
2678
|
'send' category of transactions.
|
|
2775
2679
|
"confirmations" : n, (numeric) The number of confirmations
|
|
2776
2680
|
"blockhash" : "hash", (string) The block hash
|
|
@@ -2789,9 +2693,9 @@ var methods = {
|
|
|
2789
2693
|
"amount" : x.xxx, (numeric) The amount in XNA
|
|
2790
2694
|
"label" : "label", (string) A comment for the address/transaction, if any
|
|
2791
2695
|
"vout" : n, (numeric) the vout value
|
|
2792
|
-
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
2696
|
+
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
2793
2697
|
'send' category of transactions.
|
|
2794
|
-
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
|
|
2698
|
+
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
|
|
2795
2699
|
'send' category of transactions.
|
|
2796
2700
|
}
|
|
2797
2701
|
,...
|
|
@@ -2831,8 +2735,8 @@ var methods = {
|
|
|
2831
2735
|
"confirmations" : n, (numeric) The number of confirmations
|
|
2832
2736
|
"value" : x.xxx, (numeric) The transaction value in XNA
|
|
2833
2737
|
"scriptPubKey" : { (json object)
|
|
2834
|
-
"asm" : "code", (string)
|
|
2835
|
-
"hex" : "hex", (string)
|
|
2738
|
+
"asm" : "code", (string)
|
|
2739
|
+
"hex" : "hex", (string)
|
|
2836
2740
|
"reqSigs" : n, (numeric) Number of required signatures
|
|
2837
2741
|
"type" : "pubkeyhash", (string) The type, eg pubkeyhash
|
|
2838
2742
|
"addresses" : [ (array of string) array of neurai addresses
|
|
@@ -2846,7 +2750,7 @@ var methods = {
|
|
|
2846
2750
|
Examples:
|
|
2847
2751
|
|
|
2848
2752
|
Get unspent transactions
|
|
2849
|
-
> neurai-cli listunspent
|
|
2753
|
+
> neurai-cli listunspent
|
|
2850
2754
|
|
|
2851
2755
|
View the details
|
|
2852
2756
|
> neurai-cli gettxout "txid" 1
|
|
@@ -2894,7 +2798,7 @@ var methods = {
|
|
|
2894
2798
|
}
|
|
2895
2799
|
|
|
2896
2800
|
Examples:
|
|
2897
|
-
> neurai-cli gettxoutsetinfo
|
|
2801
|
+
> neurai-cli gettxoutsetinfo
|
|
2898
2802
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettxoutsetinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2899
2803
|
**/
|
|
2900
2804
|
gettxoutsetinfo: "gettxoutsetinfo",
|
|
@@ -2941,7 +2845,7 @@ var methods = {
|
|
|
2941
2845
|
}
|
|
2942
2846
|
|
|
2943
2847
|
Examples:
|
|
2944
|
-
> neurai-cli getwalletinfo
|
|
2848
|
+
> neurai-cli getwalletinfo
|
|
2945
2849
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getwalletinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2946
2850
|
**/
|
|
2947
2851
|
getwalletinfo: "getwalletinfo",
|
|
@@ -3252,7 +3156,7 @@ var methods = {
|
|
|
3252
3156
|
1. newsize (numeric, optional, default=100) The new keypool size
|
|
3253
3157
|
|
|
3254
3158
|
Examples:
|
|
3255
|
-
> neurai-cli keypoolrefill
|
|
3159
|
+
> neurai-cli keypoolrefill
|
|
3256
3160
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "keypoolrefill", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3257
3161
|
**/
|
|
3258
3162
|
keypoolrefill: "keypoolrefill",
|
|
@@ -3273,7 +3177,7 @@ var methods = {
|
|
|
3273
3177
|
Examples:
|
|
3274
3178
|
|
|
3275
3179
|
List account balances where there at least 1 confirmation
|
|
3276
|
-
> neurai-cli listaccounts
|
|
3180
|
+
> neurai-cli listaccounts
|
|
3277
3181
|
|
|
3278
3182
|
List account balances including zero confirmation transactions
|
|
3279
3183
|
> neurai-cli listaccounts 0
|
|
@@ -3349,7 +3253,7 @@ var methods = {
|
|
|
3349
3253
|
]
|
|
3350
3254
|
|
|
3351
3255
|
Examples:
|
|
3352
|
-
> neurai-cli listaddressgroupings
|
|
3256
|
+
> neurai-cli listaddressgroupings
|
|
3353
3257
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listaddressgroupings", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3354
3258
|
**/
|
|
3355
3259
|
listaddressgroupings: "listaddressgroupings",
|
|
@@ -3444,7 +3348,7 @@ var methods = {
|
|
|
3444
3348
|
List all banned IPs/Subnets.
|
|
3445
3349
|
|
|
3446
3350
|
Examples:
|
|
3447
|
-
> neurai-cli listbanned
|
|
3351
|
+
> neurai-cli listbanned
|
|
3448
3352
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listbanned", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3449
3353
|
**/
|
|
3450
3354
|
listbanned: "listbanned",
|
|
@@ -3516,7 +3420,7 @@ var methods = {
|
|
|
3516
3420
|
]
|
|
3517
3421
|
|
|
3518
3422
|
Examples:
|
|
3519
|
-
> neurai-cli listglobalrestrictions
|
|
3423
|
+
> neurai-cli listglobalrestrictions
|
|
3520
3424
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listglobalrestrictions", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3521
3425
|
**/
|
|
3522
3426
|
listglobalrestrictions: "listglobalrestrictions",
|
|
@@ -3537,13 +3441,13 @@ var methods = {
|
|
|
3537
3441
|
Examples:
|
|
3538
3442
|
|
|
3539
3443
|
List the unspent transactions
|
|
3540
|
-
> neurai-cli listunspent
|
|
3444
|
+
> neurai-cli listunspent
|
|
3541
3445
|
|
|
3542
3446
|
Lock an unspent transaction
|
|
3543
3447
|
> neurai-cli lockunspent false "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
3544
3448
|
|
|
3545
3449
|
List the locked transactions
|
|
3546
|
-
> neurai-cli listlockunspent
|
|
3450
|
+
> neurai-cli listlockunspent
|
|
3547
3451
|
|
|
3548
3452
|
Unlock the transaction again
|
|
3549
3453
|
> neurai-cli lockunspent true "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
@@ -3552,7 +3456,7 @@ var methods = {
|
|
|
3552
3456
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listlockunspent", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3553
3457
|
**/
|
|
3554
3458
|
listlockunspent: "listlockunspent",
|
|
3555
|
-
/** listmyassets "( asset )" ( verbose ) ( count ) ( start ) (confs)
|
|
3459
|
+
/** listmyassets "( asset )" ( verbose ) ( count ) ( start ) (confs)
|
|
3556
3460
|
|
|
3557
3461
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
3558
3462
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -3608,7 +3512,7 @@ var methods = {
|
|
|
3608
3512
|
]
|
|
3609
3513
|
|
|
3610
3514
|
Examples:
|
|
3611
|
-
> neurai-cli listpqaddresses
|
|
3515
|
+
> neurai-cli listpqaddresses
|
|
3612
3516
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listpqaddresses", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3613
3517
|
**/
|
|
3614
3518
|
listpqaddresses: "listpqaddresses",
|
|
@@ -3634,7 +3538,7 @@ var methods = {
|
|
|
3634
3538
|
]
|
|
3635
3539
|
|
|
3636
3540
|
Examples:
|
|
3637
|
-
> neurai-cli listreceivedbyaccount
|
|
3541
|
+
> neurai-cli listreceivedbyaccount
|
|
3638
3542
|
> neurai-cli listreceivedbyaccount 6 true
|
|
3639
3543
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listreceivedbyaccount", "params": [6, true, true] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3640
3544
|
**/
|
|
@@ -3658,7 +3562,7 @@ var methods = {
|
|
|
3658
3562
|
"confirmations" : n, (numeric) The number of confirmations of the most recent transaction included
|
|
3659
3563
|
"label" : "label", (string) A comment for the address/transaction, if any
|
|
3660
3564
|
"txids": [
|
|
3661
|
-
n, (numeric) The ids of transactions received with the address
|
|
3565
|
+
n, (numeric) The ids of transactions received with the address
|
|
3662
3566
|
...
|
|
3663
3567
|
]
|
|
3664
3568
|
}
|
|
@@ -3666,7 +3570,7 @@ var methods = {
|
|
|
3666
3570
|
]
|
|
3667
3571
|
|
|
3668
3572
|
Examples:
|
|
3669
|
-
> neurai-cli listreceivedbyaddress
|
|
3573
|
+
> neurai-cli listreceivedbyaddress
|
|
3670
3574
|
> neurai-cli listreceivedbyaddress 6 true
|
|
3671
3575
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listreceivedbyaddress", "params": [6, true, true] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3672
3576
|
**/
|
|
@@ -3690,7 +3594,7 @@ var methods = {
|
|
|
3690
3594
|
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction. Will be "" for the default account.
|
|
3691
3595
|
"address":"address", (string) The neurai address of the transaction. Not present for move transactions (category = move).
|
|
3692
3596
|
"category":"send|receive", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.
|
|
3693
|
-
"amount": x.xxx, (numeric) The amount in XNA. This is negative for the 'send' category, and for the 'move' category for moves
|
|
3597
|
+
"amount": x.xxx, (numeric) The amount in XNA. This is negative for the 'send' category, and for the 'move' category for moves
|
|
3694
3598
|
outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.
|
|
3695
3599
|
"vout" : n, (numeric) the vout value
|
|
3696
3600
|
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the 'send' category of transactions.
|
|
@@ -3717,7 +3621,7 @@ var methods = {
|
|
|
3717
3621
|
}
|
|
3718
3622
|
|
|
3719
3623
|
Examples:
|
|
3720
|
-
> neurai-cli listsinceblock
|
|
3624
|
+
> neurai-cli listsinceblock
|
|
3721
3625
|
> neurai-cli listsinceblock "000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad" 6
|
|
3722
3626
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listsinceblock", "params": ["000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3723
3627
|
**/
|
|
@@ -3739,7 +3643,7 @@ var methods = {
|
|
|
3739
3643
|
]
|
|
3740
3644
|
|
|
3741
3645
|
Examples:
|
|
3742
|
-
> neurai-cli listsnapshotrequests
|
|
3646
|
+
> neurai-cli listsnapshotrequests
|
|
3743
3647
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listsnapshotrequests", "params": ["TRONCO" 345333] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3744
3648
|
**/
|
|
3745
3649
|
listsnapshotrequests: "listsnapshotrequests",
|
|
@@ -3776,22 +3680,22 @@ var methods = {
|
|
|
3776
3680
|
Result:
|
|
3777
3681
|
[
|
|
3778
3682
|
{
|
|
3779
|
-
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction.
|
|
3683
|
+
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction.
|
|
3780
3684
|
It will be "" for the default account.
|
|
3781
|
-
"address":"address", (string) The neurai address of the transaction. Not present for
|
|
3685
|
+
"address":"address", (string) The neurai address of the transaction. Not present for
|
|
3782
3686
|
move transactions (category = move).
|
|
3783
3687
|
"category":"send|receive|move", (string) The transaction category. 'move' is a local (off blockchain)
|
|
3784
3688
|
transaction between accounts, and not associated with an address,
|
|
3785
|
-
transaction id or block. 'send' and 'receive' transactions are
|
|
3689
|
+
transaction id or block. 'send' and 'receive' transactions are
|
|
3786
3690
|
associated with an address, transaction id and block details
|
|
3787
3691
|
"amount": x.xxx, (numeric) The amount in XNA. This is negative for the 'send' category, and for the
|
|
3788
3692
|
'move' category for moves outbound. It is positive for the 'receive' category,
|
|
3789
3693
|
and for the 'move' category for inbound funds.
|
|
3790
3694
|
"label": "label", (string) A comment for the address/transaction, if any
|
|
3791
3695
|
"vout": n, (numeric) the vout value
|
|
3792
|
-
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
3696
|
+
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
3793
3697
|
'send' category of transactions.
|
|
3794
|
-
"confirmations": n, (numeric) The number of confirmations for the transaction. Available for 'send' and
|
|
3698
|
+
"confirmations": n, (numeric) The number of confirmations for the transaction. Available for 'send' and
|
|
3795
3699
|
'receive' category of transactions. Negative confirmations indicate the
|
|
3796
3700
|
transaction conflicts with the block chain
|
|
3797
3701
|
"trusted": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.
|
|
@@ -3802,15 +3706,15 @@ var methods = {
|
|
|
3802
3706
|
"blocktime": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).
|
|
3803
3707
|
"txid": "transactionid", (string) The transaction id. Available for 'send' and 'receive' category of transactions.
|
|
3804
3708
|
"time": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).
|
|
3805
|
-
"timereceived": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available
|
|
3709
|
+
"timereceived": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available
|
|
3806
3710
|
for 'send' and 'receive' category of transactions.
|
|
3807
3711
|
"comment": "...", (string) If a comment is associated with the transaction.
|
|
3808
|
-
"otheraccount": "accountname", (string) DEPRECATED. For the 'move' category of transactions, the account the funds came
|
|
3712
|
+
"otheraccount": "accountname", (string) DEPRECATED. For the 'move' category of transactions, the account the funds came
|
|
3809
3713
|
from (for receiving funds, positive amounts), or went to (for sending funds,
|
|
3810
3714
|
negative amounts).
|
|
3811
3715
|
"bip125-replaceable": "yes|no|unknown", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);
|
|
3812
3716
|
may be unknown for unconfirmed transactions not in the mempool
|
|
3813
|
-
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
|
|
3717
|
+
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
|
|
3814
3718
|
'send' category of transactions.
|
|
3815
3719
|
}
|
|
3816
3720
|
]
|
|
@@ -3818,7 +3722,7 @@ var methods = {
|
|
|
3818
3722
|
Examples:
|
|
3819
3723
|
|
|
3820
3724
|
List the most recent 10 transactions in the systems
|
|
3821
|
-
> neurai-cli listtransactions
|
|
3725
|
+
> neurai-cli listtransactions
|
|
3822
3726
|
|
|
3823
3727
|
List transactions 100 to 120
|
|
3824
3728
|
> neurai-cli listtransactions "*" 20 100
|
|
@@ -3854,7 +3758,7 @@ var methods = {
|
|
|
3854
3758
|
Result
|
|
3855
3759
|
[ (array of json object)
|
|
3856
3760
|
{
|
|
3857
|
-
"txid" : "txid", (string) the transaction id
|
|
3761
|
+
"txid" : "txid", (string) the transaction id
|
|
3858
3762
|
"vout" : n, (numeric) the vout value
|
|
3859
3763
|
"address" : "address", (string) the neurai address
|
|
3860
3764
|
"account" : "account", (string) DEPRECATED. The associated account, or "" for the default account
|
|
@@ -3872,7 +3776,7 @@ var methods = {
|
|
|
3872
3776
|
]
|
|
3873
3777
|
|
|
3874
3778
|
Examples
|
|
3875
|
-
> neurai-cli listunspent
|
|
3779
|
+
> neurai-cli listunspent
|
|
3876
3780
|
> neurai-cli listunspent 6 9999999 "[\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\",\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\"]"
|
|
3877
3781
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listunspent", "params": [6, 9999999 "[\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\",\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\"]"] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3878
3782
|
> neurai-cli listunspent 6 9999999 '[]' true '{ "minimumAmount": 0.005 }'
|
|
@@ -3890,7 +3794,7 @@ var methods = {
|
|
|
3890
3794
|
]
|
|
3891
3795
|
|
|
3892
3796
|
Examples:
|
|
3893
|
-
> neurai-cli listwallets
|
|
3797
|
+
> neurai-cli listwallets
|
|
3894
3798
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listwallets", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3895
3799
|
**/
|
|
3896
3800
|
listwallets: "listwallets",
|
|
@@ -3921,13 +3825,13 @@ var methods = {
|
|
|
3921
3825
|
Examples:
|
|
3922
3826
|
|
|
3923
3827
|
List the unspent transactions
|
|
3924
|
-
> neurai-cli listunspent
|
|
3828
|
+
> neurai-cli listunspent
|
|
3925
3829
|
|
|
3926
3830
|
Lock an unspent transaction
|
|
3927
3831
|
> neurai-cli lockunspent false "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
3928
3832
|
|
|
3929
3833
|
List the locked transactions
|
|
3930
|
-
> neurai-cli listlockunspent
|
|
3834
|
+
> neurai-cli listlockunspent
|
|
3931
3835
|
|
|
3932
3836
|
Unlock the transaction again
|
|
3933
3837
|
> neurai-cli lockunspent true "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
@@ -3969,7 +3873,7 @@ var methods = {
|
|
|
3969
3873
|
Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.
|
|
3970
3874
|
|
|
3971
3875
|
Examples:
|
|
3972
|
-
> neurai-cli ping
|
|
3876
|
+
> neurai-cli ping
|
|
3973
3877
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "ping", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3974
3878
|
**/
|
|
3975
3879
|
ping: "ping",
|
|
@@ -4062,7 +3966,7 @@ var methods = {
|
|
|
4062
3966
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "purgesnapshot", "params": ["ASSET_NAME" 28546] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4063
3967
|
**/
|
|
4064
3968
|
purgesnapshot: "purgesnapshot",
|
|
4065
|
-
/** reissue "asset_name" qty "to_address" "change_address" ( reissuable ) ( new_units) "( new_ipfs )"
|
|
3969
|
+
/** reissue "asset_name" qty "to_address" "change_address" ( reissuable ) ( new_units) "( new_ipfs )"
|
|
4066
3970
|
|
|
4067
3971
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4068
3972
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -4111,7 +4015,7 @@ var methods = {
|
|
|
4111
4015
|
|
|
4112
4016
|
Examples:
|
|
4113
4017
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
4114
|
-
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
4018
|
+
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
4115
4019
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML" "changeaddress"
|
|
4116
4020
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML" "changeaddress" -1 true
|
|
4117
4021
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" false "" "changeaddress" -1 false QmTqu3Lk3gmTsQVtjU7rYYM37EAW4xNmbuEAp2Mjr4AV7E
|
|
@@ -4196,7 +4100,7 @@ var methods = {
|
|
|
4196
4100
|
Dumps the mempool to disk.
|
|
4197
4101
|
|
|
4198
4102
|
Examples:
|
|
4199
|
-
> neurai-cli savemempool
|
|
4103
|
+
> neurai-cli savemempool
|
|
4200
4104
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "savemempool", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4201
4105
|
**/
|
|
4202
4106
|
savemempool: "savemempool",
|
|
@@ -4246,10 +4150,10 @@ var methods = {
|
|
|
4246
4150
|
2. "toaddress" (string, required) The neurai address to send funds to.
|
|
4247
4151
|
3. amount (numeric or string, required) The amount in XNA (transaction fee is added on top).
|
|
4248
4152
|
4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.
|
|
4249
|
-
5. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4153
|
+
5. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4250
4154
|
This is not part of the transaction, just kept in your wallet.
|
|
4251
|
-
6. "comment_to" (string, optional) An optional comment to store the name of the person or organization
|
|
4252
|
-
to which you're sending the transaction. This is not part of the transaction,
|
|
4155
|
+
6. "comment_to" (string, optional) An optional comment to store the name of the person or organization
|
|
4156
|
+
to which you're sending the transaction. This is not part of the transaction,
|
|
4253
4157
|
it is just kept in your wallet.
|
|
4254
4158
|
|
|
4255
4159
|
Result:
|
|
@@ -4275,10 +4179,10 @@ var methods = {
|
|
|
4275
4179
|
1. "from_address" (string, required) The neurai address to send from.
|
|
4276
4180
|
2. "to_address" (string, required) The neurai address to send to.
|
|
4277
4181
|
3. "amount" (numeric or string, required) The amount in XNA to send. eg 0.1
|
|
4278
|
-
4. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4182
|
+
4. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4279
4183
|
This is not part of the transaction, just kept in your wallet.
|
|
4280
|
-
5. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4281
|
-
to which you're sending the transaction. This is not part of the
|
|
4184
|
+
5. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4185
|
+
to which you're sending the transaction. This is not part of the
|
|
4282
4186
|
transaction, just kept in your wallet.
|
|
4283
4187
|
6. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.
|
|
4284
4188
|
The recipient will receive less neurais than you enter in the amount field.
|
|
@@ -4326,7 +4230,7 @@ var methods = {
|
|
|
4326
4230
|
"CONSERVATIVE"
|
|
4327
4231
|
|
|
4328
4232
|
Result:
|
|
4329
|
-
"txid" (string) The transaction id for the send. Only 1 transaction is created regardless of
|
|
4233
|
+
"txid" (string) The transaction id for the send. Only 1 transaction is created regardless of
|
|
4330
4234
|
the number of addresses.
|
|
4331
4235
|
|
|
4332
4236
|
Examples:
|
|
@@ -4398,10 +4302,10 @@ var methods = {
|
|
|
4398
4302
|
Arguments:
|
|
4399
4303
|
1. "address" (string, required) The neurai address to send to.
|
|
4400
4304
|
2. "amount" (numeric or string, required) The amount in XNA to send. eg 0.1
|
|
4401
|
-
3. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4305
|
+
3. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4402
4306
|
This is not part of the transaction, just kept in your wallet.
|
|
4403
|
-
4. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4404
|
-
to which you're sending the transaction. This is not part of the
|
|
4307
|
+
4. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4308
|
+
to which you're sending the transaction. This is not part of the
|
|
4405
4309
|
transaction, just kept in your wallet.
|
|
4406
4310
|
5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.
|
|
4407
4311
|
The recipient will receive less neurais than you enter in the amount field.
|
|
@@ -4466,7 +4370,7 @@ var methods = {
|
|
|
4466
4370
|
> neurai-cli setgenerate true 1
|
|
4467
4371
|
|
|
4468
4372
|
Check the setting
|
|
4469
|
-
> neurai-cli getgenerate
|
|
4373
|
+
> neurai-cli getgenerate
|
|
4470
4374
|
|
|
4471
4375
|
Turn off generation
|
|
4472
4376
|
> neurai-cli setgenerate false
|
|
@@ -4624,7 +4528,7 @@ var methods = {
|
|
|
4624
4528
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "submitblock", "params": ["mydata"] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4625
4529
|
**/
|
|
4626
4530
|
submitblock: "submitblock",
|
|
4627
|
-
/** subscribetochannel
|
|
4531
|
+
/** subscribetochannel
|
|
4628
4532
|
|
|
4629
4533
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4630
4534
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4696,7 +4600,7 @@ var methods = {
|
|
|
4696
4600
|
7. "asset_change_address" (string, optional, default = "") the transactions Asset change will be sent to this address
|
|
4697
4601
|
|
|
4698
4602
|
Result:
|
|
4699
|
-
txid[
|
|
4603
|
+
txid[
|
|
4700
4604
|
txid
|
|
4701
4605
|
]
|
|
4702
4606
|
|
|
@@ -4722,7 +4626,7 @@ var methods = {
|
|
|
4722
4626
|
8. "asset_change_address" (string, optional, default = "") the transaction Asset change will be sent to this address
|
|
4723
4627
|
|
|
4724
4628
|
Result:
|
|
4725
|
-
txid[
|
|
4629
|
+
txid[
|
|
4726
4630
|
txid
|
|
4727
4631
|
]
|
|
4728
4632
|
|
|
@@ -4748,7 +4652,7 @@ var methods = {
|
|
|
4748
4652
|
8. "asset_change_address" (string, optional, default = "") the transactions Asset change will be sent to this address
|
|
4749
4653
|
|
|
4750
4654
|
Result:
|
|
4751
|
-
txid[
|
|
4655
|
+
txid[
|
|
4752
4656
|
txid
|
|
4753
4657
|
]
|
|
4754
4658
|
|
|
@@ -4757,7 +4661,7 @@ var methods = {
|
|
|
4757
4661
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "transferfromaddresses", "params": ["ASSET_NAME" '["fromaddress1", "fromaddress2"]' 20 "to_address" "QmTqu3Lk3gmTsQVtjU7rYYM37EAW4xNmbuEAp2Mjr4AV7E" 154652365] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4758
4662
|
**/
|
|
4759
4663
|
transferfromaddresses: "transferfromaddresses",
|
|
4760
|
-
/** transferqualifier "qualifier_name" qty "to_address" ("change_address") ("message") (expire_time)
|
|
4664
|
+
/** transferqualifier "qualifier_name" qty "to_address" ("change_address") ("message") (expire_time)
|
|
4761
4665
|
|
|
4762
4666
|
THIS COMMAND IS NOT YET ACTIVE! Restricted assets must be active
|
|
4763
4667
|
|
|
@@ -4772,7 +4676,7 @@ var methods = {
|
|
|
4772
4676
|
6. "expire_time" (numeric, optional) UTC timestamp of when the message expires
|
|
4773
4677
|
|
|
4774
4678
|
Result:
|
|
4775
|
-
txid[
|
|
4679
|
+
txid[
|
|
4776
4680
|
txid
|
|
4777
4681
|
]
|
|
4778
4682
|
|
|
@@ -4850,7 +4754,7 @@ var methods = {
|
|
|
4850
4754
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "unfreezerestrictedasset", "params": ["$RESTRICTED_ASSET" "change_address"] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4851
4755
|
**/
|
|
4852
4756
|
unfreezerestrictedasset: "unfreezerestrictedasset",
|
|
4853
|
-
/** unsubscribefromchannel
|
|
4757
|
+
/** unsubscribefromchannel
|
|
4854
4758
|
|
|
4855
4759
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4856
4760
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4877,7 +4781,7 @@ var methods = {
|
|
|
4877
4781
|
ttt (numeric) The number of seconds that the server has been running
|
|
4878
4782
|
|
|
4879
4783
|
Examples:
|
|
4880
|
-
> neurai-cli uptime
|
|
4784
|
+
> neurai-cli uptime
|
|
4881
4785
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "uptime", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4882
4786
|
**/
|
|
4883
4787
|
uptime: "uptime",
|
|
@@ -4933,7 +4837,7 @@ var methods = {
|
|
|
4933
4837
|
true|false (boolean) Verified or not
|
|
4934
4838
|
|
|
4935
4839
|
Examples:
|
|
4936
|
-
> neurai-cli verifychain
|
|
4840
|
+
> neurai-cli verifychain
|
|
4937
4841
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "verifychain", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4938
4842
|
**/
|
|
4939
4843
|
verifychain: "verifychain",
|
|
@@ -4976,7 +4880,7 @@ var methods = {
|
|
|
4976
4880
|
["txid"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof is invalid
|
|
4977
4881
|
**/
|
|
4978
4882
|
verifytxoutproof: "verifytxoutproof",
|
|
4979
|
-
/** viewallmessagechannels
|
|
4883
|
+
/** viewallmessagechannels
|
|
4980
4884
|
|
|
4981
4885
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4982
4886
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4989,11 +4893,11 @@ var methods = {
|
|
|
4989
4893
|
]
|
|
4990
4894
|
|
|
4991
4895
|
Examples:
|
|
4992
|
-
> neurai-cli viewallmessagechannels
|
|
4896
|
+
> neurai-cli viewallmessagechannels
|
|
4993
4897
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "viewallmessagechannels", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4994
4898
|
**/
|
|
4995
4899
|
viewallmessagechannels: "viewallmessagechannels",
|
|
4996
|
-
/** viewallmessages
|
|
4900
|
+
/** viewallmessages
|
|
4997
4901
|
|
|
4998
4902
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4999
4903
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -5010,11 +4914,11 @@ var methods = {
|
|
|
5010
4914
|
"Expire UTC Time:" (Date, optional) If the message contains an expire date that is too large, the UTC number will be displayed
|
|
5011
4915
|
|
|
5012
4916
|
Examples:
|
|
5013
|
-
> neurai-cli viewallmessages
|
|
4917
|
+
> neurai-cli viewallmessages
|
|
5014
4918
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "viewallmessages", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
5015
4919
|
**/
|
|
5016
4920
|
viewallmessages: "viewallmessages",
|
|
5017
|
-
/** viewmyrestrictedaddresses
|
|
4921
|
+
/** viewmyrestrictedaddresses
|
|
5018
4922
|
|
|
5019
4923
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
5020
4924
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -5030,11 +4934,11 @@ var methods = {
|
|
|
5030
4934
|
}...
|
|
5031
4935
|
|
|
5032
4936
|
Examples:
|
|
5033
|
-
> neurai-cli viewmyrestrictedaddresses
|
|
4937
|
+
> neurai-cli viewmyrestrictedaddresses
|
|
5034
4938
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "viewmyrestrictedaddresses", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
5035
4939
|
**/
|
|
5036
4940
|
viewmyrestrictedaddresses: "viewmyrestrictedaddresses",
|
|
5037
|
-
/** viewmytaggedaddresses
|
|
4941
|
+
/** viewmytaggedaddresses
|
|
5038
4942
|
|
|
5039
4943
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
5040
4944
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -5050,12 +4954,110 @@ var methods = {
|
|
|
5050
4954
|
}...
|
|
5051
4955
|
|
|
5052
4956
|
Examples:
|
|
5053
|
-
> neurai-cli viewmytaggedaddresses
|
|
4957
|
+
> neurai-cli viewmytaggedaddresses
|
|
5054
4958
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "viewmytaggedaddresses", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
5055
4959
|
**/
|
|
5056
4960
|
viewmytaggedaddresses: "viewmytaggedaddresses"
|
|
5057
4961
|
};
|
|
5058
4962
|
|
|
4963
|
+
// depin.ts
|
|
4964
|
+
var DEPIN_RPC_PROTOCOL = 5;
|
|
4965
|
+
var DEPIN_REMOTE_METHODS = Object.freeze([
|
|
4966
|
+
"depingetmsginfo",
|
|
4967
|
+
"depinpoolstats",
|
|
4968
|
+
"depinmcpstatus",
|
|
4969
|
+
"depinchallenge",
|
|
4970
|
+
"depinreceivemsg",
|
|
4971
|
+
"depinreceiveseq",
|
|
4972
|
+
"depinlistsections",
|
|
4973
|
+
"depinclearmsg",
|
|
4974
|
+
"depinsubmitmsg",
|
|
4975
|
+
"depingetancestorrecipients"
|
|
4976
|
+
]);
|
|
4977
|
+
function isDepinRemoteMethod(method) {
|
|
4978
|
+
return DEPIN_REMOTE_METHODS.includes(method);
|
|
4979
|
+
}
|
|
4980
|
+
function getDepinRequest(params) {
|
|
4981
|
+
const request = Array.isArray(params) && params.length === 1 ? params[0] : params && typeof params === "object" && Object.keys(params).length === 1 ? params.request : null;
|
|
4982
|
+
const protocol = request?.protocol;
|
|
4983
|
+
if (!request || typeof request !== "object" || Array.isArray(request) || !(protocol === 5 || protocol?.isLosslessNumber === true && protocol.value === "5" && typeof protocol.toString === "function" && protocol.toString() === "5")) {
|
|
4984
|
+
throw Object.assign(new Error("DePIN protocol 5 requires one request object"), {
|
|
4985
|
+
code: -8,
|
|
4986
|
+
data: { depin_error: "unsupported_protocol", expected_protocol: 5 }
|
|
4987
|
+
});
|
|
4988
|
+
}
|
|
4989
|
+
return request;
|
|
4990
|
+
}
|
|
4991
|
+
function createDepinNodeRouter(healthyNodes, randomId) {
|
|
4992
|
+
const identities = /* @__PURE__ */ new WeakMap();
|
|
4993
|
+
const pending = /* @__PURE__ */ new WeakMap();
|
|
4994
|
+
const discoveredAt = /* @__PURE__ */ new WeakMap();
|
|
4995
|
+
async function discover(node) {
|
|
4996
|
+
let promise = pending.get(node);
|
|
4997
|
+
if (!promise && Date.now() - (discoveredAt.get(node) ?? 0) < 1e3) return;
|
|
4998
|
+
if (!promise) {
|
|
4999
|
+
discoveredAt.set(node, Date.now());
|
|
5000
|
+
promise = (async () => {
|
|
5001
|
+
const reply = await node.rpc("depingetmsginfo", [{ protocol: 5, request_id: randomId(), timestamp_ms: Date.now() }]);
|
|
5002
|
+
if (reply?.protocol !== 5 || typeof reply.network !== "string" || typeof reply.pool_pubkey !== "string" || typeof reply.pool_root !== "string" || typeof reply.instance_id !== "string")
|
|
5003
|
+
throw new Error("Node has no RPC 5 pool identity");
|
|
5004
|
+
identities.set(node, reply);
|
|
5005
|
+
})().finally(() => pending.delete(node));
|
|
5006
|
+
pending.set(node, promise);
|
|
5007
|
+
}
|
|
5008
|
+
await promise;
|
|
5009
|
+
}
|
|
5010
|
+
return async function route(method, params) {
|
|
5011
|
+
const request = getDepinRequest(params);
|
|
5012
|
+
const nodes = healthyNodes();
|
|
5013
|
+
if (!nodes.length) throw new Error("No healthy RPC node");
|
|
5014
|
+
if (method === "depingetmsginfo") return nodes[0];
|
|
5015
|
+
const target = request;
|
|
5016
|
+
const matches = (node) => {
|
|
5017
|
+
const identity = identities.get(node);
|
|
5018
|
+
return identity && ["network", "pool_pubkey", "pool_root", "instance_id"].every((key) => identity[key] === target[key]);
|
|
5019
|
+
};
|
|
5020
|
+
let found = nodes.find(matches);
|
|
5021
|
+
if (found) return found;
|
|
5022
|
+
await Promise.all(nodes.map((node) => discover(node).catch(() => identities.delete(node))));
|
|
5023
|
+
found = nodes.find(matches);
|
|
5024
|
+
if (!found)
|
|
5025
|
+
throw Object.assign(new Error("DePIN service_mismatch: target pool or instance is unavailable; refresh bootstrap"), {
|
|
5026
|
+
code: -32600,
|
|
5027
|
+
data: { depin_error: "service_mismatch", expected_protocol: 5 }
|
|
5028
|
+
});
|
|
5029
|
+
return found;
|
|
5030
|
+
};
|
|
5031
|
+
}
|
|
5032
|
+
|
|
5033
|
+
// json.ts
|
|
5034
|
+
function assertNoDuplicateJsonKeys(text) {
|
|
5035
|
+
const stack = [];
|
|
5036
|
+
for (let i = 0; i < text.length; i++) {
|
|
5037
|
+
const ch = text[i];
|
|
5038
|
+
if (ch === '"') {
|
|
5039
|
+
const start = i++;
|
|
5040
|
+
while (i < text.length && text[i] !== '"') {
|
|
5041
|
+
if (text[i] === "\\") i++;
|
|
5042
|
+
i++;
|
|
5043
|
+
}
|
|
5044
|
+
if (i >= text.length) throw new SyntaxError("Unterminated JSON string");
|
|
5045
|
+
const top = stack[stack.length - 1];
|
|
5046
|
+
if (top?.keys && top.expectKey) {
|
|
5047
|
+
const key = JSON.parse(text.slice(start, i + 1));
|
|
5048
|
+
if (top.keys.has(key)) throw new SyntaxError("Duplicate JSON key");
|
|
5049
|
+
top.keys.add(key);
|
|
5050
|
+
top.expectKey = false;
|
|
5051
|
+
}
|
|
5052
|
+
} else if (ch === "{" || ch === "[") {
|
|
5053
|
+
if (stack.length >= 128) throw new SyntaxError("JSON nesting limit exceeded");
|
|
5054
|
+
stack.push(ch === "{" ? { keys: /* @__PURE__ */ new Set(), expectKey: true, close: "}" } : { close: "]" });
|
|
5055
|
+
} else if (ch === "}" || ch === "]") {
|
|
5056
|
+
if (stack.pop()?.close !== ch) throw new SyntaxError("Invalid JSON nesting");
|
|
5057
|
+
} else if (ch === "," && stack[stack.length - 1]?.keys) stack[stack.length - 1].expectKey = true;
|
|
5058
|
+
}
|
|
5059
|
+
}
|
|
5060
|
+
|
|
5059
5061
|
// index.ts
|
|
5060
5062
|
var MAINNET_GENESIS_HASH = "00000044d33c0c0ba019be5c0249730424a69cb4c222153322f68c6104484806";
|
|
5061
5063
|
var TESTNET_GENESIS_HASH = "0000008b384aeffecdab182575dc4e86c9f07f90318c65088532660ed9a8a021";
|
|
@@ -5109,7 +5111,9 @@ function getRPC(username, password, URL) {
|
|
|
5109
5111
|
const rpcResponse = postData(URL, data, username, password);
|
|
5110
5112
|
rpcResponse.then(async (response) => {
|
|
5111
5113
|
if (response.ok) {
|
|
5112
|
-
const
|
|
5114
|
+
const responseText = await response.text();
|
|
5115
|
+
if (isDepinRemoteMethod(method)) assertNoDuplicateJsonKeys(responseText);
|
|
5116
|
+
const obj = parseRpcJson(responseText);
|
|
5113
5117
|
if (obj && obj.error) {
|
|
5114
5118
|
rejectionFunc({
|
|
5115
5119
|
error: obj.error,
|
|
@@ -5124,7 +5128,9 @@ function getRPC(username, password, URL) {
|
|
|
5124
5128
|
description: null
|
|
5125
5129
|
};
|
|
5126
5130
|
try {
|
|
5127
|
-
|
|
5131
|
+
const responseText = await response.text();
|
|
5132
|
+
if (isDepinRemoteMethod(method)) assertNoDuplicateJsonKeys(responseText);
|
|
5133
|
+
obj = parseRpcJson(responseText);
|
|
5128
5134
|
} catch (e) {
|
|
5129
5135
|
}
|
|
5130
5136
|
const myError = {
|
|
@@ -5155,9 +5161,7 @@ async function postData(url = "", data = {}, username, password) {
|
|
|
5155
5161
|
if (typeof btoa === "function") {
|
|
5156
5162
|
base64Credentials = btoa(`${username}:${password}`);
|
|
5157
5163
|
} else if (Buffer) {
|
|
5158
|
-
base64Credentials = Buffer.from(`${username}:${password}`).toString(
|
|
5159
|
-
"base64"
|
|
5160
|
-
);
|
|
5164
|
+
base64Credentials = Buffer.from(`${username}:${password}`).toString("base64");
|
|
5161
5165
|
}
|
|
5162
5166
|
const response = await fetch(url, {
|
|
5163
5167
|
method: "POST",
|
|
@@ -5180,10 +5184,16 @@ async function postData(url = "", data = {}, username, password) {
|
|
|
5180
5184
|
}
|
|
5181
5185
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5182
5186
|
0 && (module.exports = {
|
|
5187
|
+
DEPIN_REMOTE_METHODS,
|
|
5188
|
+
DEPIN_RPC_PROTOCOL,
|
|
5183
5189
|
MAINNET_GENESIS_HASH,
|
|
5184
5190
|
TESTNET_GENESIS_HASH,
|
|
5191
|
+
assertNoDuplicateJsonKeys,
|
|
5185
5192
|
assertRpcGenesis,
|
|
5193
|
+
createDepinNodeRouter,
|
|
5194
|
+
getDepinRequest,
|
|
5186
5195
|
getRPC,
|
|
5196
|
+
isDepinRemoteMethod,
|
|
5187
5197
|
methods,
|
|
5188
5198
|
parseRpcJson,
|
|
5189
5199
|
rpcNumber,
|