@neuraiproject/neurai-rpc 0.6.2 → 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 +17 -0
- package/DEPIN_EXAMPLES.md +45 -127
- package/DEPIN_IMPLEMENTATION_GUIDE_EN.md +19 -93
- package/README.md +29 -105
- package/depin.ts +144 -0
- package/dist/index.cjs +355 -331
- package/dist/index.d.cts +72 -4
- package/dist/index.d.ts +72 -4
- package/dist/index.mjs +346 -331
- package/docs.json +198 -198
- package/docs.ts +1342 -1504
- package/index.ts +54 -34
- package/json.ts +29 -0
- package/neurai_methods.md +743 -872
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -19,7 +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,
|
|
24
|
+
MAINNET_GENESIS_HASH: () => MAINNET_GENESIS_HASH,
|
|
25
|
+
TESTNET_GENESIS_HASH: () => TESTNET_GENESIS_HASH,
|
|
26
|
+
assertNoDuplicateJsonKeys: () => assertNoDuplicateJsonKeys,
|
|
27
|
+
assertRpcGenesis: () => assertRpcGenesis,
|
|
28
|
+
createDepinNodeRouter: () => createDepinNodeRouter,
|
|
29
|
+
getDepinRequest: () => getDepinRequest,
|
|
22
30
|
getRPC: () => getRPC,
|
|
31
|
+
isDepinRemoteMethod: () => isDepinRemoteMethod,
|
|
23
32
|
methods: () => methods,
|
|
24
33
|
parseRpcJson: () => parseRpcJson,
|
|
25
34
|
rpcNumber: () => rpcNumber,
|
|
@@ -58,7 +67,7 @@ var methods = {
|
|
|
58
67
|
> neurai-cli importprivkey "mykey"
|
|
59
68
|
|
|
60
69
|
Abort the running wallet rescan
|
|
61
|
-
> neurai-cli abortrescan
|
|
70
|
+
> neurai-cli abortrescan
|
|
62
71
|
|
|
63
72
|
As a JSON-RPC call
|
|
64
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/
|
|
@@ -261,7 +270,7 @@ var methods = {
|
|
|
261
270
|
Clear all banned IPs.
|
|
262
271
|
|
|
263
272
|
Examples:
|
|
264
|
-
> neurai-cli clearbanned
|
|
273
|
+
> neurai-cli clearbanned
|
|
265
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/
|
|
266
275
|
**/
|
|
267
276
|
clearbanned: "clearbanned",
|
|
@@ -270,11 +279,11 @@ var methods = {
|
|
|
270
279
|
Removes all transaction from the mempool
|
|
271
280
|
|
|
272
281
|
Examples:
|
|
273
|
-
> neurai-cli clearmempool
|
|
282
|
+
> neurai-cli clearmempool
|
|
274
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/
|
|
275
284
|
**/
|
|
276
285
|
clearmempool: "clearmempool",
|
|
277
|
-
/** clearmessages
|
|
286
|
+
/** clearmessages
|
|
278
287
|
|
|
279
288
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
280
289
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -286,14 +295,14 @@ var methods = {
|
|
|
286
295
|
]
|
|
287
296
|
|
|
288
297
|
Examples:
|
|
289
|
-
> neurai-cli clearmessages
|
|
298
|
+
> neurai-cli clearmessages
|
|
290
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/
|
|
291
300
|
**/
|
|
292
301
|
clearmessages: "clearmessages",
|
|
293
302
|
/** combinerawtransaction ["hexstring",...]
|
|
294
303
|
|
|
295
304
|
Combine multiple partially signed transactions into one transaction.
|
|
296
|
-
The combined transaction may be another partially signed transaction or a
|
|
305
|
+
The combined transaction may be another partially signed transaction or a
|
|
297
306
|
fully signed transaction.
|
|
298
307
|
Arguments:
|
|
299
308
|
1. "txs" (string) A json array of hex strings of partially signed transactions
|
|
@@ -399,7 +408,7 @@ var methods = {
|
|
|
399
408
|
"txid":"id", (string, required) The transaction id
|
|
400
409
|
"vout":n, (number, required) The output number
|
|
401
410
|
"sequence":n (number, optional) The sequence number
|
|
402
|
-
}
|
|
411
|
+
}
|
|
403
412
|
,...
|
|
404
413
|
]
|
|
405
414
|
2. "outputs" (object or array, required) outputs in object or ordered-array form
|
|
@@ -443,10 +452,10 @@ var methods = {
|
|
|
443
452
|
{ (object) A json object describing new unique assets to issue
|
|
444
453
|
"issue_unique":
|
|
445
454
|
{
|
|
446
|
-
"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)
|
|
447
456
|
are being issued under
|
|
448
457
|
"asset_tags":["asset_tag", ...], (array, required) the unique tag for each asset which is to be issued
|
|
449
|
-
"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
|
|
450
459
|
(should be same size as "asset_tags")
|
|
451
460
|
}
|
|
452
461
|
}
|
|
@@ -457,9 +466,9 @@ var methods = {
|
|
|
457
466
|
"asset_name":"asset-name", (string, required) name of asset to be reissued
|
|
458
467
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
459
468
|
"reissuable":[0-1], (number, optional) default is 1, 1=reissuable asset
|
|
460
|
-
"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,
|
|
461
470
|
Overrides the current ipfs hash if given
|
|
462
|
-
"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.
|
|
463
472
|
If not given, it will be sent to the output address
|
|
464
473
|
}
|
|
465
474
|
}
|
|
@@ -469,13 +478,13 @@ var methods = {
|
|
|
469
478
|
{
|
|
470
479
|
"asset_name":"asset-name",(string, required) new asset name
|
|
471
480
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
472
|
-
"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
|
|
473
482
|
asset transfer verification
|
|
474
483
|
"units":[0-8], (number, required) display units, between 0 (integral) and 8 (max precision)
|
|
475
484
|
"reissuable":[0-1], (number, required) 1=reissuable asset
|
|
476
485
|
"has_ipfs":[0-1], (number, required) 1=passing ipfs_hash
|
|
477
486
|
"ipfs_hash":"hash", (string, optional) an ipfs hash for discovering asset metadata
|
|
478
|
-
"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.
|
|
479
488
|
If not given, it will be sent to the output address
|
|
480
489
|
}
|
|
481
490
|
}
|
|
@@ -486,11 +495,11 @@ var methods = {
|
|
|
486
495
|
"asset_name":"asset-name", (string, required) name of asset to be reissued
|
|
487
496
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
488
497
|
"reissuable":[0-1], (number, optional) default is 1, 1=reissuable asset
|
|
489
|
-
"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
|
|
490
499
|
transfer verification
|
|
491
|
-
"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,
|
|
492
501
|
Overrides the current ipfs hash if given
|
|
493
|
-
"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.
|
|
494
503
|
If not given, it will be sent to the output address
|
|
495
504
|
}
|
|
496
505
|
}
|
|
@@ -500,9 +509,9 @@ var methods = {
|
|
|
500
509
|
{
|
|
501
510
|
"asset_name":"asset_name", (string, required) a qualifier name (starts with '#')
|
|
502
511
|
"asset_quantity":n, (numeric, optional, default=1) the number of units to be issued (1 to 10)
|
|
503
|
-
"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
|
|
504
513
|
to be added to the asset
|
|
505
|
-
"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
|
|
506
515
|
txid hash once RIP5 is activated
|
|
507
516
|
"root_change_address" (string, optional) Only applies when issuing subqualifiers.
|
|
508
517
|
The address where the root qualifier will be sent.
|
|
@@ -726,216 +735,114 @@ var methods = {
|
|
|
726
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/
|
|
727
736
|
**/
|
|
728
737
|
decodescript: "decodescript",
|
|
729
|
-
/**
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
Examples:
|
|
737
|
-
> neurai-cli depinchallenge "&TOKEN/SECTION" "NXholder..." 1730000000000 "<signature>"
|
|
738
|
-
**/
|
|
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
|
+
*/
|
|
739
744
|
depinchallenge: "depinchallenge",
|
|
740
|
-
/**
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
"removed": n,
|
|
747
|
-
"remaining": n
|
|
748
|
-
}
|
|
749
|
-
**/
|
|
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
|
+
*/
|
|
750
751
|
depinclearmsg: "depinclearmsg",
|
|
751
|
-
/**
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
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
|
+
*/
|
|
758
760
|
depindecrypt: "depindecrypt",
|
|
759
|
-
/**
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
Active means: positive balance, public key revealed, and not blocked by an
|
|
766
|
-
owner freeze or by self-revocation. Restriction is per (asset, address), so an
|
|
767
|
-
address that is active in at least one ancestor is returned even if it revoked
|
|
768
|
-
itself in another -- holding the root already grants visibility over the branch.
|
|
769
|
-
|
|
770
|
-
The query is exact: '&TEST' returns holders of '&TEST' only, never of
|
|
771
|
-
'&TEST/APPLE', '&TESTING' or '&TEST.FOO'. Every derived ancestor must exist; a
|
|
772
|
-
missing intermediate level is an error rather than something skipped.
|
|
773
|
-
|
|
774
|
-
This command is informational. It does not know about -depinmsgmaxusers, does
|
|
775
|
-
not decide whether a message fits in a pool, and a truncated result must not be
|
|
776
|
-
treated as a complete recipient set.
|
|
777
|
-
|
|
778
|
-
Requires -assetindex and -pubkeyindex.
|
|
779
|
-
|
|
780
|
-
Arguments:
|
|
781
|
-
1. "token" (string, required) DEPIN token, e.g. "&TEST/APPLE/GOLDEN"
|
|
782
|
-
2. max_results (numeric, optional, default=1000) Maximum recipients to return
|
|
783
|
-
(1..10000)
|
|
784
|
-
3. "stop_at" (string, optional) Stop deriving ancestors at this token,
|
|
785
|
-
inclusive. Must be the token itself or one of its ancestors.
|
|
786
|
-
Omitted: derive up to the absolute root.
|
|
787
|
-
|
|
788
|
-
Result:
|
|
789
|
-
{
|
|
790
|
-
"token": "name", (string) Token queried
|
|
791
|
-
"stop_at": "name", (string) Where derivation stopped ("" = root)
|
|
792
|
-
"ancestors": ["name", ...], (array) Token first, then each ancestor
|
|
793
|
-
"recipients": [ (array) Active holders, ordered by address
|
|
794
|
-
{
|
|
795
|
-
"address": "address", (string) Holder address
|
|
796
|
-
"pubkey": "hex" (string) Public key revealed on chain
|
|
797
|
-
}, ...
|
|
798
|
-
],
|
|
799
|
-
"returned": n, (numeric) Number of recipients returned
|
|
800
|
-
"max_results": n, (numeric) Limit applied
|
|
801
|
-
"truncated": true|false, (boolean) True if more eligible recipients exist
|
|
802
|
-
"skipped_no_pubkey": n, (numeric) Addresses dropped for lacking a usable
|
|
803
|
-
revealed public key
|
|
804
|
-
"skipped_no_pubkey_complete": bool, (boolean) False when truncated: the count then
|
|
805
|
-
covers only the addresses examined
|
|
806
|
-
"skipped_restricted": n, (numeric) Addresses dropped as frozen or
|
|
807
|
-
self-revoked in every ancestor they hold
|
|
808
|
-
"skipped_restricted_complete": bool (boolean) Same rule as above
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
Examples:
|
|
812
|
-
> neurai-cli depingetancestorrecipients "&TEST/APPLE/GOLDEN"
|
|
813
|
-
> neurai-cli depingetancestorrecipients "&TEST/APPLE/GOLDEN" 50 "&TEST/APPLE"
|
|
814
|
-
> 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/
|
|
815
|
-
**/
|
|
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
|
+
*/
|
|
816
767
|
depingetancestorrecipients: "depingetancestorrecipients",
|
|
817
|
-
/**
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
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
|
+
*/
|
|
821
773
|
depingetmsg: "depingetmsg",
|
|
822
|
-
/**
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
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
|
+
*/
|
|
826
780
|
depingetmsginfo: "depingetmsginfo",
|
|
827
|
-
/**
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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
|
+
*/
|
|
831
787
|
depinlistsections: "depinlistsections",
|
|
832
|
-
/**
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
"enabled": true|false, (boolean) Whether MCP worker is enabled
|
|
839
|
-
"running": true|false, (boolean) Whether MCP worker is running
|
|
840
|
-
"mcp_url": "url", (string) MCP server URL
|
|
841
|
-
"model_name": "name", (string) Name of the loaded AI model
|
|
842
|
-
"command_key": "key", (string) Command prefix (e.g. /ai)
|
|
843
|
-
"depin_token": "token", (string) DePIN token being monitored
|
|
844
|
-
"poll_interval": n, (numeric) Polling interval in seconds
|
|
845
|
-
"commands_processed": n, (numeric) Total commands processed
|
|
846
|
-
"total_errors": n, (numeric) Total errors encountered
|
|
847
|
-
"rate_limited": n, (numeric) Commands rejected by rate limiting
|
|
848
|
-
"concurrency": n, (numeric) Number of parallel task threads
|
|
849
|
-
"tasks_in_flight": n, (numeric) AI requests currently being processed
|
|
850
|
-
"processed_cache": n, (numeric) Size of the processed-message dedup cache
|
|
851
|
-
"context_sessions": n, (numeric) Active conversation contexts
|
|
852
|
-
"last_poll_time": n (numeric) Unix timestamp of last poll
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
Examples:
|
|
856
|
-
> neurai-cli depinmcpstatus
|
|
857
|
-
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "depinmcpstatus", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
858
|
-
**/
|
|
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
|
+
*/
|
|
859
794
|
depinmcpstatus: "depinmcpstatus",
|
|
860
|
-
/**
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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
|
+
*/
|
|
871
807
|
depinpoolpkey: "depinpoolpkey",
|
|
872
|
-
/**
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
"enabled": true|false,
|
|
879
|
-
"token": "string",
|
|
880
|
-
"total_messages": n,
|
|
881
|
-
"total_size_bytes": n,
|
|
882
|
-
"memory_usage_bytes": n,
|
|
883
|
-
"oldest_message": "YYYY-MM-DD HH:MM:SS",
|
|
884
|
-
"newest_message": "YYYY-MM-DD HH:MM:SS",
|
|
885
|
-
"messages_by_age": {
|
|
886
|
-
"last_hour": n,
|
|
887
|
-
"last_day": n,
|
|
888
|
-
"last_week": n
|
|
889
|
-
},
|
|
890
|
-
"unique_senders": n,
|
|
891
|
-
"unique_recipients": n,
|
|
892
|
-
"avg_recipients_per_message": n.nn,
|
|
893
|
-
"avg_message_size": n,
|
|
894
|
-
"expiring_in_24h": n
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
Examples:
|
|
898
|
-
> neurai-cli depinpoolstats
|
|
899
|
-
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "depinpoolstats", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
900
|
-
**/
|
|
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
|
+
*/
|
|
901
814
|
depinpoolstats: "depinpoolstats",
|
|
902
|
-
/**
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
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
|
+
*/
|
|
906
821
|
depinreceivemsg: "depinreceivemsg",
|
|
907
|
-
/**
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
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
|
+
*/
|
|
911
834
|
depinsendmsg: "depinsendmsg",
|
|
912
|
-
/**
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
/** depinsignrequest "address" "token" ( "type" )
|
|
924
|
-
|
|
925
|
-
Wallet helper that signs a depinchallenge request over the current Unix time in milliseconds.
|
|
926
|
-
|
|
927
|
-
Result:
|
|
928
|
-
{
|
|
929
|
-
"timestamp": n,
|
|
930
|
-
"signature": "base64",
|
|
931
|
-
"preimage": "DEPIN-REQ|..."
|
|
932
|
-
}
|
|
933
|
-
**/
|
|
934
|
-
depinsignrequest: "depinsignrequest",
|
|
935
|
-
/** depinsubmitmsg {"sender":"...","encrypted":"..."}
|
|
936
|
-
|
|
937
|
-
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.
|
|
938
|
-
**/
|
|
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
|
+
*/
|
|
939
846
|
depinsubmitmsg: "depinsubmitmsg",
|
|
940
847
|
/** disconnectnode "[address]" [nodeid]
|
|
941
848
|
|
|
@@ -1002,7 +909,7 @@ var methods = {
|
|
|
1002
909
|
"xpqpriv..." (string) Base58Check-encoded master CExtKeyPQ
|
|
1003
910
|
|
|
1004
911
|
Examples:
|
|
1005
|
-
> neurai-cli dumpextkeypq
|
|
912
|
+
> neurai-cli dumpextkeypq
|
|
1006
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/
|
|
1007
914
|
**/
|
|
1008
915
|
dumpextkeypq: "dumpextkeypq",
|
|
@@ -1043,7 +950,7 @@ var methods = {
|
|
|
1043
950
|
/** encryptwallet "passphrase"
|
|
1044
951
|
|
|
1045
952
|
Encrypts the wallet with 'passphrase'. This is for first time encryption.
|
|
1046
|
-
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
|
|
1047
954
|
will require the passphrase to be set prior the making these calls.
|
|
1048
955
|
Use the walletpassphrase call for this, and then walletlock call.
|
|
1049
956
|
If the wallet is already encrypted, use the walletpassphrasechange call.
|
|
@@ -1064,7 +971,7 @@ var methods = {
|
|
|
1064
971
|
> neurai-cli signmessage "address" "test message"
|
|
1065
972
|
|
|
1066
973
|
Now lock the wallet again by removing the passphrase
|
|
1067
|
-
> neurai-cli walletlock
|
|
974
|
+
> neurai-cli walletlock
|
|
1068
975
|
|
|
1069
976
|
As a json rpc call
|
|
1070
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/
|
|
@@ -1333,7 +1240,7 @@ var methods = {
|
|
|
1333
1240
|
"address" (string) The account neurai address
|
|
1334
1241
|
|
|
1335
1242
|
Examples:
|
|
1336
|
-
> neurai-cli getaccountaddress
|
|
1243
|
+
> neurai-cli getaccountaddress
|
|
1337
1244
|
> neurai-cli getaccountaddress ""
|
|
1338
1245
|
> neurai-cli getaccountaddress "myaccount"
|
|
1339
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/
|
|
@@ -1612,7 +1519,7 @@ var methods = {
|
|
|
1612
1519
|
Examples:
|
|
1613
1520
|
|
|
1614
1521
|
The total amount in the wallet with 1 or more confirmations
|
|
1615
|
-
> neurai-cli getbalance
|
|
1522
|
+
> neurai-cli getbalance
|
|
1616
1523
|
|
|
1617
1524
|
The total amount in the wallet at least 6 blocks confirmed
|
|
1618
1525
|
> neurai-cli getbalance "*" 6
|
|
@@ -1629,15 +1536,15 @@ var methods = {
|
|
|
1629
1536
|
"hex" (string) the block hash hex encoded
|
|
1630
1537
|
|
|
1631
1538
|
Examples:
|
|
1632
|
-
> neurai-cli getbestblockhash
|
|
1539
|
+
> neurai-cli getbestblockhash
|
|
1633
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/
|
|
1634
1541
|
**/
|
|
1635
1542
|
getbestblockhash: "getbestblockhash",
|
|
1636
|
-
/** getblock "blockhash" ( verbosity )
|
|
1543
|
+
/** getblock "blockhash" ( verbosity )
|
|
1637
1544
|
|
|
1638
1545
|
If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.
|
|
1639
1546
|
If verbosity is 1, returns an Object with information about block <hash>.
|
|
1640
|
-
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.
|
|
1641
1548
|
|
|
1642
1549
|
Arguments:
|
|
1643
1550
|
1. "blockhash" (string, required) The block hash
|
|
@@ -1720,11 +1627,11 @@ var methods = {
|
|
|
1720
1627
|
"timeout": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in
|
|
1721
1628
|
"since": xx, (numeric) height of the first block to which the status applies
|
|
1722
1629
|
"statistics": { (object) numeric statistics about BIP9 signalling for a softfork (only for "started" status)
|
|
1723
|
-
"period": xx, (numeric) the length in blocks of the BIP9 signalling period
|
|
1724
|
-
"threshold": xx, (numeric) the number of blocks with the version bit set required to activate the feature
|
|
1725
|
-
"elapsed": xx, (numeric) the number of blocks elapsed since the beginning of the current period
|
|
1726
|
-
"count": xx, (numeric) the number of blocks with the version bit set in the current period
|
|
1727
|
-
"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
|
|
1728
1635
|
}
|
|
1729
1636
|
}
|
|
1730
1637
|
}
|
|
@@ -1732,7 +1639,7 @@ var methods = {
|
|
|
1732
1639
|
}
|
|
1733
1640
|
|
|
1734
1641
|
Examples:
|
|
1735
|
-
> neurai-cli getblockchaininfo
|
|
1642
|
+
> neurai-cli getblockchaininfo
|
|
1736
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/
|
|
1737
1644
|
**/
|
|
1738
1645
|
getblockchaininfo: "getblockchaininfo",
|
|
@@ -1744,7 +1651,7 @@ var methods = {
|
|
|
1744
1651
|
n (numeric) The current block count
|
|
1745
1652
|
|
|
1746
1653
|
Examples:
|
|
1747
|
-
> neurai-cli getblockcount
|
|
1654
|
+
> neurai-cli getblockcount
|
|
1748
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/
|
|
1749
1656
|
**/
|
|
1750
1657
|
getblockcount: "getblockcount",
|
|
@@ -1868,7 +1775,7 @@ var methods = {
|
|
|
1868
1775
|
"data" : "xxxx", (string) transaction data encoded in hexadecimal (byte-for-byte)
|
|
1869
1776
|
"txid" : "xxxx", (string) transaction id encoded in little-endian hexadecimal
|
|
1870
1777
|
"hash" : "xxxx", (string) hash encoded in little-endian hexadecimal (including witness data)
|
|
1871
|
-
"depends" : [ (array) array of numbers
|
|
1778
|
+
"depends" : [ (array) array of numbers
|
|
1872
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
|
|
1873
1780
|
,...
|
|
1874
1781
|
],
|
|
@@ -1886,7 +1793,7 @@ var methods = {
|
|
|
1886
1793
|
"coinbasetxn" : { ... }, (json object) information for coinbase transaction
|
|
1887
1794
|
"target" : "xxxx", (string) The hash target
|
|
1888
1795
|
"mintime" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)
|
|
1889
|
-
"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
|
|
1890
1797
|
"value" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'
|
|
1891
1798
|
,...
|
|
1892
1799
|
],
|
|
@@ -1900,11 +1807,11 @@ var methods = {
|
|
|
1900
1807
|
}
|
|
1901
1808
|
|
|
1902
1809
|
Examples:
|
|
1903
|
-
> neurai-cli getblocktemplate
|
|
1810
|
+
> neurai-cli getblocktemplate
|
|
1904
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/
|
|
1905
1812
|
**/
|
|
1906
1813
|
getblocktemplate: "getblocktemplate",
|
|
1907
|
-
/** getcacheinfo
|
|
1814
|
+
/** getcacheinfo
|
|
1908
1815
|
|
|
1909
1816
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
1910
1817
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -1924,7 +1831,7 @@ var methods = {
|
|
|
1924
1831
|
|
|
1925
1832
|
Examples:
|
|
1926
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/
|
|
1927
|
-
> neurai-cli getcacheinfo
|
|
1834
|
+
> neurai-cli getcacheinfo
|
|
1928
1835
|
**/
|
|
1929
1836
|
getcacheinfo: "getcacheinfo",
|
|
1930
1837
|
/** getchaintips
|
|
@@ -1953,7 +1860,7 @@ var methods = {
|
|
|
1953
1860
|
5. "active" This is the tip of the active main chain, which is certainly valid
|
|
1954
1861
|
|
|
1955
1862
|
Examples:
|
|
1956
|
-
> neurai-cli getchaintips
|
|
1863
|
+
> neurai-cli getchaintips
|
|
1957
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/
|
|
1958
1865
|
**/
|
|
1959
1866
|
getchaintips: "getchaintips",
|
|
@@ -1976,7 +1883,7 @@ var methods = {
|
|
|
1976
1883
|
}
|
|
1977
1884
|
|
|
1978
1885
|
Examples:
|
|
1979
|
-
> neurai-cli getchaintxstats
|
|
1886
|
+
> neurai-cli getchaintxstats
|
|
1980
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/
|
|
1981
1888
|
**/
|
|
1982
1889
|
getchaintxstats: "getchaintxstats",
|
|
@@ -1988,7 +1895,7 @@ var methods = {
|
|
|
1988
1895
|
n (numeric) The connection count
|
|
1989
1896
|
|
|
1990
1897
|
Examples:
|
|
1991
|
-
> neurai-cli getconnectioncount
|
|
1898
|
+
> neurai-cli getconnectioncount
|
|
1992
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/
|
|
1993
1900
|
**/
|
|
1994
1901
|
getconnectioncount: "getconnectioncount",
|
|
@@ -2000,7 +1907,7 @@ var methods = {
|
|
|
2000
1907
|
n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.
|
|
2001
1908
|
|
|
2002
1909
|
Examples:
|
|
2003
|
-
> neurai-cli getdifficulty
|
|
1910
|
+
> neurai-cli getdifficulty
|
|
2004
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/
|
|
2005
1912
|
**/
|
|
2006
1913
|
getdifficulty: "getdifficulty",
|
|
@@ -2032,7 +1939,7 @@ var methods = {
|
|
|
2032
1939
|
true|false (boolean) If the server is set to generate coins or not
|
|
2033
1940
|
|
|
2034
1941
|
Examples:
|
|
2035
|
-
> neurai-cli getgenerate
|
|
1942
|
+
> neurai-cli getgenerate
|
|
2036
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/
|
|
2037
1944
|
**/
|
|
2038
1945
|
getgenerate: "getgenerate",
|
|
@@ -2083,7 +1990,7 @@ var methods = {
|
|
|
2083
1990
|
}
|
|
2084
1991
|
|
|
2085
1992
|
Examples:
|
|
2086
|
-
> neurai-cli getinfo
|
|
1993
|
+
> neurai-cli getinfo
|
|
2087
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/
|
|
2088
1995
|
**/
|
|
2089
1996
|
getinfo: "getinfo",
|
|
@@ -2121,7 +2028,7 @@ var methods = {
|
|
|
2121
2028
|
}
|
|
2122
2029
|
|
|
2123
2030
|
Examples:
|
|
2124
|
-
> neurai-cli getmasterkeyinfo
|
|
2031
|
+
> neurai-cli getmasterkeyinfo
|
|
2125
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/
|
|
2126
2033
|
**/
|
|
2127
2034
|
getmasterkeyinfo: "getmasterkeyinfo",
|
|
@@ -2148,7 +2055,7 @@ var methods = {
|
|
|
2148
2055
|
"<malloc version="1">..."
|
|
2149
2056
|
|
|
2150
2057
|
Examples:
|
|
2151
|
-
> neurai-cli getmemoryinfo
|
|
2058
|
+
> neurai-cli getmemoryinfo
|
|
2152
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/
|
|
2153
2060
|
**/
|
|
2154
2061
|
getmemoryinfo: "getmemoryinfo",
|
|
@@ -2277,7 +2184,7 @@ var methods = {
|
|
|
2277
2184
|
}
|
|
2278
2185
|
|
|
2279
2186
|
Examples:
|
|
2280
|
-
> neurai-cli getmempoolinfo
|
|
2187
|
+
> neurai-cli getmempoolinfo
|
|
2281
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/
|
|
2282
2189
|
**/
|
|
2283
2190
|
getmempoolinfo: "getmempoolinfo",
|
|
@@ -2299,7 +2206,7 @@ var methods = {
|
|
|
2299
2206
|
}
|
|
2300
2207
|
|
|
2301
2208
|
Examples:
|
|
2302
|
-
> neurai-cli getmininginfo
|
|
2209
|
+
> neurai-cli getmininginfo
|
|
2303
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/
|
|
2304
2211
|
**/
|
|
2305
2212
|
getmininginfo: "getmininginfo",
|
|
@@ -2313,7 +2220,7 @@ var methods = {
|
|
|
2313
2220
|
"passphrase:" (optional) Only show if passphrase was used when creating the wallet
|
|
2314
2221
|
|
|
2315
2222
|
Examples:
|
|
2316
|
-
> neurai-cli getmywords
|
|
2223
|
+
> neurai-cli getmywords
|
|
2317
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/
|
|
2318
2225
|
**/
|
|
2319
2226
|
getmywords: "getmywords",
|
|
@@ -2339,7 +2246,7 @@ var methods = {
|
|
|
2339
2246
|
}
|
|
2340
2247
|
|
|
2341
2248
|
Examples:
|
|
2342
|
-
> neurai-cli getnettotals
|
|
2249
|
+
> neurai-cli getnettotals
|
|
2343
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/
|
|
2344
2251
|
**/
|
|
2345
2252
|
getnettotals: "getnettotals",
|
|
@@ -2357,7 +2264,7 @@ var methods = {
|
|
|
2357
2264
|
x (numeric) Hashes per second estimated
|
|
2358
2265
|
|
|
2359
2266
|
Examples:
|
|
2360
|
-
> neurai-cli getnetworkhashps
|
|
2267
|
+
> neurai-cli getnetworkhashps
|
|
2361
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/
|
|
2362
2269
|
**/
|
|
2363
2270
|
getnetworkhashps: "getnetworkhashps",
|
|
@@ -2398,14 +2305,14 @@ var methods = {
|
|
|
2398
2305
|
}
|
|
2399
2306
|
|
|
2400
2307
|
Examples:
|
|
2401
|
-
> neurai-cli getnetworkinfo
|
|
2308
|
+
> neurai-cli getnetworkinfo
|
|
2402
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/
|
|
2403
2310
|
**/
|
|
2404
2311
|
getnetworkinfo: "getnetworkinfo",
|
|
2405
2312
|
/** getnewaddress ( "account" "address_type" )
|
|
2406
2313
|
|
|
2407
2314
|
Returns a new Neurai address for receiving payments.
|
|
2408
|
-
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
|
|
2409
2316
|
so payments received with the address will be credited to 'account'.
|
|
2410
2317
|
|
|
2411
2318
|
Arguments:
|
|
@@ -2416,7 +2323,7 @@ var methods = {
|
|
|
2416
2323
|
"address" (string) The new neurai address
|
|
2417
2324
|
|
|
2418
2325
|
Examples:
|
|
2419
|
-
> neurai-cli getnewaddress
|
|
2326
|
+
> neurai-cli getnewaddress
|
|
2420
2327
|
> neurai-cli getnewaddress "" "ecdsa"
|
|
2421
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/
|
|
2422
2329
|
**/
|
|
@@ -2469,7 +2376,7 @@ var methods = {
|
|
|
2469
2376
|
]
|
|
2470
2377
|
|
|
2471
2378
|
Examples:
|
|
2472
|
-
> neurai-cli getpeerinfo
|
|
2379
|
+
> neurai-cli getpeerinfo
|
|
2473
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/
|
|
2474
2381
|
**/
|
|
2475
2382
|
getpeerinfo: "getpeerinfo",
|
|
@@ -2506,7 +2413,7 @@ var methods = {
|
|
|
2506
2413
|
"address" (string) The address
|
|
2507
2414
|
|
|
2508
2415
|
Examples:
|
|
2509
|
-
> neurai-cli getrawchangeaddress
|
|
2416
|
+
> neurai-cli getrawchangeaddress
|
|
2510
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/
|
|
2511
2418
|
**/
|
|
2512
2419
|
getrawchangeaddress: "getrawchangeaddress",
|
|
@@ -2581,7 +2488,7 @@ var methods = {
|
|
|
2581
2488
|
"vin" : [ (array of json objects)
|
|
2582
2489
|
{
|
|
2583
2490
|
"txid": "id", (string) The transaction id
|
|
2584
|
-
"vout": n, (numeric)
|
|
2491
|
+
"vout": n, (numeric)
|
|
2585
2492
|
"scriptSig": { (json object) The script
|
|
2586
2493
|
"asm": "asm", (string) asm
|
|
2587
2494
|
"hex": "hex" (string) hex
|
|
@@ -2680,12 +2587,12 @@ var methods = {
|
|
|
2680
2587
|
"active_commands" (array) All active commands
|
|
2681
2588
|
[
|
|
2682
2589
|
{ (object) Information about an active command
|
|
2683
|
-
"method" (string) The name of the RPC command
|
|
2590
|
+
"method" (string) The name of the RPC command
|
|
2684
2591
|
"duration" (numeric) The running time in microseconds
|
|
2685
2592
|
},...
|
|
2686
2593
|
],
|
|
2687
2594
|
}
|
|
2688
|
-
> neurai-cli getrpcinfo
|
|
2595
|
+
> neurai-cli getrpcinfo
|
|
2689
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/
|
|
2690
2597
|
**/
|
|
2691
2598
|
getrpcinfo: "getrpcinfo",
|
|
@@ -2767,7 +2674,7 @@ var methods = {
|
|
|
2767
2674
|
Result:
|
|
2768
2675
|
{
|
|
2769
2676
|
"amount" : x.xxx, (numeric) The transaction amount in XNA
|
|
2770
|
-
"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
|
|
2771
2678
|
'send' category of transactions.
|
|
2772
2679
|
"confirmations" : n, (numeric) The number of confirmations
|
|
2773
2680
|
"blockhash" : "hash", (string) The block hash
|
|
@@ -2786,9 +2693,9 @@ var methods = {
|
|
|
2786
2693
|
"amount" : x.xxx, (numeric) The amount in XNA
|
|
2787
2694
|
"label" : "label", (string) A comment for the address/transaction, if any
|
|
2788
2695
|
"vout" : n, (numeric) the vout value
|
|
2789
|
-
"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
|
|
2790
2697
|
'send' category of transactions.
|
|
2791
|
-
"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
|
|
2792
2699
|
'send' category of transactions.
|
|
2793
2700
|
}
|
|
2794
2701
|
,...
|
|
@@ -2828,8 +2735,8 @@ var methods = {
|
|
|
2828
2735
|
"confirmations" : n, (numeric) The number of confirmations
|
|
2829
2736
|
"value" : x.xxx, (numeric) The transaction value in XNA
|
|
2830
2737
|
"scriptPubKey" : { (json object)
|
|
2831
|
-
"asm" : "code", (string)
|
|
2832
|
-
"hex" : "hex", (string)
|
|
2738
|
+
"asm" : "code", (string)
|
|
2739
|
+
"hex" : "hex", (string)
|
|
2833
2740
|
"reqSigs" : n, (numeric) Number of required signatures
|
|
2834
2741
|
"type" : "pubkeyhash", (string) The type, eg pubkeyhash
|
|
2835
2742
|
"addresses" : [ (array of string) array of neurai addresses
|
|
@@ -2843,7 +2750,7 @@ var methods = {
|
|
|
2843
2750
|
Examples:
|
|
2844
2751
|
|
|
2845
2752
|
Get unspent transactions
|
|
2846
|
-
> neurai-cli listunspent
|
|
2753
|
+
> neurai-cli listunspent
|
|
2847
2754
|
|
|
2848
2755
|
View the details
|
|
2849
2756
|
> neurai-cli gettxout "txid" 1
|
|
@@ -2891,7 +2798,7 @@ var methods = {
|
|
|
2891
2798
|
}
|
|
2892
2799
|
|
|
2893
2800
|
Examples:
|
|
2894
|
-
> neurai-cli gettxoutsetinfo
|
|
2801
|
+
> neurai-cli gettxoutsetinfo
|
|
2895
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/
|
|
2896
2803
|
**/
|
|
2897
2804
|
gettxoutsetinfo: "gettxoutsetinfo",
|
|
@@ -2938,7 +2845,7 @@ var methods = {
|
|
|
2938
2845
|
}
|
|
2939
2846
|
|
|
2940
2847
|
Examples:
|
|
2941
|
-
> neurai-cli getwalletinfo
|
|
2848
|
+
> neurai-cli getwalletinfo
|
|
2942
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/
|
|
2943
2850
|
**/
|
|
2944
2851
|
getwalletinfo: "getwalletinfo",
|
|
@@ -3249,7 +3156,7 @@ var methods = {
|
|
|
3249
3156
|
1. newsize (numeric, optional, default=100) The new keypool size
|
|
3250
3157
|
|
|
3251
3158
|
Examples:
|
|
3252
|
-
> neurai-cli keypoolrefill
|
|
3159
|
+
> neurai-cli keypoolrefill
|
|
3253
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/
|
|
3254
3161
|
**/
|
|
3255
3162
|
keypoolrefill: "keypoolrefill",
|
|
@@ -3270,7 +3177,7 @@ var methods = {
|
|
|
3270
3177
|
Examples:
|
|
3271
3178
|
|
|
3272
3179
|
List account balances where there at least 1 confirmation
|
|
3273
|
-
> neurai-cli listaccounts
|
|
3180
|
+
> neurai-cli listaccounts
|
|
3274
3181
|
|
|
3275
3182
|
List account balances including zero confirmation transactions
|
|
3276
3183
|
> neurai-cli listaccounts 0
|
|
@@ -3346,7 +3253,7 @@ var methods = {
|
|
|
3346
3253
|
]
|
|
3347
3254
|
|
|
3348
3255
|
Examples:
|
|
3349
|
-
> neurai-cli listaddressgroupings
|
|
3256
|
+
> neurai-cli listaddressgroupings
|
|
3350
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/
|
|
3351
3258
|
**/
|
|
3352
3259
|
listaddressgroupings: "listaddressgroupings",
|
|
@@ -3441,7 +3348,7 @@ var methods = {
|
|
|
3441
3348
|
List all banned IPs/Subnets.
|
|
3442
3349
|
|
|
3443
3350
|
Examples:
|
|
3444
|
-
> neurai-cli listbanned
|
|
3351
|
+
> neurai-cli listbanned
|
|
3445
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/
|
|
3446
3353
|
**/
|
|
3447
3354
|
listbanned: "listbanned",
|
|
@@ -3513,7 +3420,7 @@ var methods = {
|
|
|
3513
3420
|
]
|
|
3514
3421
|
|
|
3515
3422
|
Examples:
|
|
3516
|
-
> neurai-cli listglobalrestrictions
|
|
3423
|
+
> neurai-cli listglobalrestrictions
|
|
3517
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/
|
|
3518
3425
|
**/
|
|
3519
3426
|
listglobalrestrictions: "listglobalrestrictions",
|
|
@@ -3534,13 +3441,13 @@ var methods = {
|
|
|
3534
3441
|
Examples:
|
|
3535
3442
|
|
|
3536
3443
|
List the unspent transactions
|
|
3537
|
-
> neurai-cli listunspent
|
|
3444
|
+
> neurai-cli listunspent
|
|
3538
3445
|
|
|
3539
3446
|
Lock an unspent transaction
|
|
3540
3447
|
> neurai-cli lockunspent false "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
3541
3448
|
|
|
3542
3449
|
List the locked transactions
|
|
3543
|
-
> neurai-cli listlockunspent
|
|
3450
|
+
> neurai-cli listlockunspent
|
|
3544
3451
|
|
|
3545
3452
|
Unlock the transaction again
|
|
3546
3453
|
> neurai-cli lockunspent true "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
@@ -3549,7 +3456,7 @@ var methods = {
|
|
|
3549
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/
|
|
3550
3457
|
**/
|
|
3551
3458
|
listlockunspent: "listlockunspent",
|
|
3552
|
-
/** listmyassets "( asset )" ( verbose ) ( count ) ( start ) (confs)
|
|
3459
|
+
/** listmyassets "( asset )" ( verbose ) ( count ) ( start ) (confs)
|
|
3553
3460
|
|
|
3554
3461
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
3555
3462
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -3605,7 +3512,7 @@ var methods = {
|
|
|
3605
3512
|
]
|
|
3606
3513
|
|
|
3607
3514
|
Examples:
|
|
3608
|
-
> neurai-cli listpqaddresses
|
|
3515
|
+
> neurai-cli listpqaddresses
|
|
3609
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/
|
|
3610
3517
|
**/
|
|
3611
3518
|
listpqaddresses: "listpqaddresses",
|
|
@@ -3631,7 +3538,7 @@ var methods = {
|
|
|
3631
3538
|
]
|
|
3632
3539
|
|
|
3633
3540
|
Examples:
|
|
3634
|
-
> neurai-cli listreceivedbyaccount
|
|
3541
|
+
> neurai-cli listreceivedbyaccount
|
|
3635
3542
|
> neurai-cli listreceivedbyaccount 6 true
|
|
3636
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/
|
|
3637
3544
|
**/
|
|
@@ -3655,7 +3562,7 @@ var methods = {
|
|
|
3655
3562
|
"confirmations" : n, (numeric) The number of confirmations of the most recent transaction included
|
|
3656
3563
|
"label" : "label", (string) A comment for the address/transaction, if any
|
|
3657
3564
|
"txids": [
|
|
3658
|
-
n, (numeric) The ids of transactions received with the address
|
|
3565
|
+
n, (numeric) The ids of transactions received with the address
|
|
3659
3566
|
...
|
|
3660
3567
|
]
|
|
3661
3568
|
}
|
|
@@ -3663,7 +3570,7 @@ var methods = {
|
|
|
3663
3570
|
]
|
|
3664
3571
|
|
|
3665
3572
|
Examples:
|
|
3666
|
-
> neurai-cli listreceivedbyaddress
|
|
3573
|
+
> neurai-cli listreceivedbyaddress
|
|
3667
3574
|
> neurai-cli listreceivedbyaddress 6 true
|
|
3668
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/
|
|
3669
3576
|
**/
|
|
@@ -3687,7 +3594,7 @@ var methods = {
|
|
|
3687
3594
|
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction. Will be "" for the default account.
|
|
3688
3595
|
"address":"address", (string) The neurai address of the transaction. Not present for move transactions (category = move).
|
|
3689
3596
|
"category":"send|receive", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.
|
|
3690
|
-
"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
|
|
3691
3598
|
outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.
|
|
3692
3599
|
"vout" : n, (numeric) the vout value
|
|
3693
3600
|
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the 'send' category of transactions.
|
|
@@ -3714,7 +3621,7 @@ var methods = {
|
|
|
3714
3621
|
}
|
|
3715
3622
|
|
|
3716
3623
|
Examples:
|
|
3717
|
-
> neurai-cli listsinceblock
|
|
3624
|
+
> neurai-cli listsinceblock
|
|
3718
3625
|
> neurai-cli listsinceblock "000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad" 6
|
|
3719
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/
|
|
3720
3627
|
**/
|
|
@@ -3736,7 +3643,7 @@ var methods = {
|
|
|
3736
3643
|
]
|
|
3737
3644
|
|
|
3738
3645
|
Examples:
|
|
3739
|
-
> neurai-cli listsnapshotrequests
|
|
3646
|
+
> neurai-cli listsnapshotrequests
|
|
3740
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/
|
|
3741
3648
|
**/
|
|
3742
3649
|
listsnapshotrequests: "listsnapshotrequests",
|
|
@@ -3773,22 +3680,22 @@ var methods = {
|
|
|
3773
3680
|
Result:
|
|
3774
3681
|
[
|
|
3775
3682
|
{
|
|
3776
|
-
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction.
|
|
3683
|
+
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction.
|
|
3777
3684
|
It will be "" for the default account.
|
|
3778
|
-
"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
|
|
3779
3686
|
move transactions (category = move).
|
|
3780
3687
|
"category":"send|receive|move", (string) The transaction category. 'move' is a local (off blockchain)
|
|
3781
3688
|
transaction between accounts, and not associated with an address,
|
|
3782
|
-
transaction id or block. 'send' and 'receive' transactions are
|
|
3689
|
+
transaction id or block. 'send' and 'receive' transactions are
|
|
3783
3690
|
associated with an address, transaction id and block details
|
|
3784
3691
|
"amount": x.xxx, (numeric) The amount in XNA. This is negative for the 'send' category, and for the
|
|
3785
3692
|
'move' category for moves outbound. It is positive for the 'receive' category,
|
|
3786
3693
|
and for the 'move' category for inbound funds.
|
|
3787
3694
|
"label": "label", (string) A comment for the address/transaction, if any
|
|
3788
3695
|
"vout": n, (numeric) the vout value
|
|
3789
|
-
"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
|
|
3790
3697
|
'send' category of transactions.
|
|
3791
|
-
"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
|
|
3792
3699
|
'receive' category of transactions. Negative confirmations indicate the
|
|
3793
3700
|
transaction conflicts with the block chain
|
|
3794
3701
|
"trusted": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.
|
|
@@ -3799,15 +3706,15 @@ var methods = {
|
|
|
3799
3706
|
"blocktime": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).
|
|
3800
3707
|
"txid": "transactionid", (string) The transaction id. Available for 'send' and 'receive' category of transactions.
|
|
3801
3708
|
"time": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).
|
|
3802
|
-
"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
|
|
3803
3710
|
for 'send' and 'receive' category of transactions.
|
|
3804
3711
|
"comment": "...", (string) If a comment is associated with the transaction.
|
|
3805
|
-
"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
|
|
3806
3713
|
from (for receiving funds, positive amounts), or went to (for sending funds,
|
|
3807
3714
|
negative amounts).
|
|
3808
3715
|
"bip125-replaceable": "yes|no|unknown", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);
|
|
3809
3716
|
may be unknown for unconfirmed transactions not in the mempool
|
|
3810
|
-
"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
|
|
3811
3718
|
'send' category of transactions.
|
|
3812
3719
|
}
|
|
3813
3720
|
]
|
|
@@ -3815,7 +3722,7 @@ var methods = {
|
|
|
3815
3722
|
Examples:
|
|
3816
3723
|
|
|
3817
3724
|
List the most recent 10 transactions in the systems
|
|
3818
|
-
> neurai-cli listtransactions
|
|
3725
|
+
> neurai-cli listtransactions
|
|
3819
3726
|
|
|
3820
3727
|
List transactions 100 to 120
|
|
3821
3728
|
> neurai-cli listtransactions "*" 20 100
|
|
@@ -3851,7 +3758,7 @@ var methods = {
|
|
|
3851
3758
|
Result
|
|
3852
3759
|
[ (array of json object)
|
|
3853
3760
|
{
|
|
3854
|
-
"txid" : "txid", (string) the transaction id
|
|
3761
|
+
"txid" : "txid", (string) the transaction id
|
|
3855
3762
|
"vout" : n, (numeric) the vout value
|
|
3856
3763
|
"address" : "address", (string) the neurai address
|
|
3857
3764
|
"account" : "account", (string) DEPRECATED. The associated account, or "" for the default account
|
|
@@ -3869,7 +3776,7 @@ var methods = {
|
|
|
3869
3776
|
]
|
|
3870
3777
|
|
|
3871
3778
|
Examples
|
|
3872
|
-
> neurai-cli listunspent
|
|
3779
|
+
> neurai-cli listunspent
|
|
3873
3780
|
> neurai-cli listunspent 6 9999999 "[\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\",\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\"]"
|
|
3874
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/
|
|
3875
3782
|
> neurai-cli listunspent 6 9999999 '[]' true '{ "minimumAmount": 0.005 }'
|
|
@@ -3887,7 +3794,7 @@ var methods = {
|
|
|
3887
3794
|
]
|
|
3888
3795
|
|
|
3889
3796
|
Examples:
|
|
3890
|
-
> neurai-cli listwallets
|
|
3797
|
+
> neurai-cli listwallets
|
|
3891
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/
|
|
3892
3799
|
**/
|
|
3893
3800
|
listwallets: "listwallets",
|
|
@@ -3918,13 +3825,13 @@ var methods = {
|
|
|
3918
3825
|
Examples:
|
|
3919
3826
|
|
|
3920
3827
|
List the unspent transactions
|
|
3921
|
-
> neurai-cli listunspent
|
|
3828
|
+
> neurai-cli listunspent
|
|
3922
3829
|
|
|
3923
3830
|
Lock an unspent transaction
|
|
3924
3831
|
> neurai-cli lockunspent false "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
3925
3832
|
|
|
3926
3833
|
List the locked transactions
|
|
3927
|
-
> neurai-cli listlockunspent
|
|
3834
|
+
> neurai-cli listlockunspent
|
|
3928
3835
|
|
|
3929
3836
|
Unlock the transaction again
|
|
3930
3837
|
> neurai-cli lockunspent true "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
@@ -3966,7 +3873,7 @@ var methods = {
|
|
|
3966
3873
|
Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.
|
|
3967
3874
|
|
|
3968
3875
|
Examples:
|
|
3969
|
-
> neurai-cli ping
|
|
3876
|
+
> neurai-cli ping
|
|
3970
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/
|
|
3971
3878
|
**/
|
|
3972
3879
|
ping: "ping",
|
|
@@ -4059,7 +3966,7 @@ var methods = {
|
|
|
4059
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/
|
|
4060
3967
|
**/
|
|
4061
3968
|
purgesnapshot: "purgesnapshot",
|
|
4062
|
-
/** 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 )"
|
|
4063
3970
|
|
|
4064
3971
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4065
3972
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -4108,7 +4015,7 @@ var methods = {
|
|
|
4108
4015
|
|
|
4109
4016
|
Examples:
|
|
4110
4017
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
4111
|
-
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
4018
|
+
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
4112
4019
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML" "changeaddress"
|
|
4113
4020
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML" "changeaddress" -1 true
|
|
4114
4021
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" false "" "changeaddress" -1 false QmTqu3Lk3gmTsQVtjU7rYYM37EAW4xNmbuEAp2Mjr4AV7E
|
|
@@ -4193,7 +4100,7 @@ var methods = {
|
|
|
4193
4100
|
Dumps the mempool to disk.
|
|
4194
4101
|
|
|
4195
4102
|
Examples:
|
|
4196
|
-
> neurai-cli savemempool
|
|
4103
|
+
> neurai-cli savemempool
|
|
4197
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/
|
|
4198
4105
|
**/
|
|
4199
4106
|
savemempool: "savemempool",
|
|
@@ -4243,10 +4150,10 @@ var methods = {
|
|
|
4243
4150
|
2. "toaddress" (string, required) The neurai address to send funds to.
|
|
4244
4151
|
3. amount (numeric or string, required) The amount in XNA (transaction fee is added on top).
|
|
4245
4152
|
4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.
|
|
4246
|
-
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.
|
|
4247
4154
|
This is not part of the transaction, just kept in your wallet.
|
|
4248
|
-
6. "comment_to" (string, optional) An optional comment to store the name of the person or organization
|
|
4249
|
-
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,
|
|
4250
4157
|
it is just kept in your wallet.
|
|
4251
4158
|
|
|
4252
4159
|
Result:
|
|
@@ -4272,10 +4179,10 @@ var methods = {
|
|
|
4272
4179
|
1. "from_address" (string, required) The neurai address to send from.
|
|
4273
4180
|
2. "to_address" (string, required) The neurai address to send to.
|
|
4274
4181
|
3. "amount" (numeric or string, required) The amount in XNA to send. eg 0.1
|
|
4275
|
-
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.
|
|
4276
4183
|
This is not part of the transaction, just kept in your wallet.
|
|
4277
|
-
5. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4278
|
-
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
|
|
4279
4186
|
transaction, just kept in your wallet.
|
|
4280
4187
|
6. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.
|
|
4281
4188
|
The recipient will receive less neurais than you enter in the amount field.
|
|
@@ -4323,7 +4230,7 @@ var methods = {
|
|
|
4323
4230
|
"CONSERVATIVE"
|
|
4324
4231
|
|
|
4325
4232
|
Result:
|
|
4326
|
-
"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
|
|
4327
4234
|
the number of addresses.
|
|
4328
4235
|
|
|
4329
4236
|
Examples:
|
|
@@ -4395,10 +4302,10 @@ var methods = {
|
|
|
4395
4302
|
Arguments:
|
|
4396
4303
|
1. "address" (string, required) The neurai address to send to.
|
|
4397
4304
|
2. "amount" (numeric or string, required) The amount in XNA to send. eg 0.1
|
|
4398
|
-
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.
|
|
4399
4306
|
This is not part of the transaction, just kept in your wallet.
|
|
4400
|
-
4. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4401
|
-
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
|
|
4402
4309
|
transaction, just kept in your wallet.
|
|
4403
4310
|
5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.
|
|
4404
4311
|
The recipient will receive less neurais than you enter in the amount field.
|
|
@@ -4463,7 +4370,7 @@ var methods = {
|
|
|
4463
4370
|
> neurai-cli setgenerate true 1
|
|
4464
4371
|
|
|
4465
4372
|
Check the setting
|
|
4466
|
-
> neurai-cli getgenerate
|
|
4373
|
+
> neurai-cli getgenerate
|
|
4467
4374
|
|
|
4468
4375
|
Turn off generation
|
|
4469
4376
|
> neurai-cli setgenerate false
|
|
@@ -4621,7 +4528,7 @@ var methods = {
|
|
|
4621
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/
|
|
4622
4529
|
**/
|
|
4623
4530
|
submitblock: "submitblock",
|
|
4624
|
-
/** subscribetochannel
|
|
4531
|
+
/** subscribetochannel
|
|
4625
4532
|
|
|
4626
4533
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4627
4534
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4693,7 +4600,7 @@ var methods = {
|
|
|
4693
4600
|
7. "asset_change_address" (string, optional, default = "") the transactions Asset change will be sent to this address
|
|
4694
4601
|
|
|
4695
4602
|
Result:
|
|
4696
|
-
txid[
|
|
4603
|
+
txid[
|
|
4697
4604
|
txid
|
|
4698
4605
|
]
|
|
4699
4606
|
|
|
@@ -4719,7 +4626,7 @@ var methods = {
|
|
|
4719
4626
|
8. "asset_change_address" (string, optional, default = "") the transaction Asset change will be sent to this address
|
|
4720
4627
|
|
|
4721
4628
|
Result:
|
|
4722
|
-
txid[
|
|
4629
|
+
txid[
|
|
4723
4630
|
txid
|
|
4724
4631
|
]
|
|
4725
4632
|
|
|
@@ -4745,7 +4652,7 @@ var methods = {
|
|
|
4745
4652
|
8. "asset_change_address" (string, optional, default = "") the transactions Asset change will be sent to this address
|
|
4746
4653
|
|
|
4747
4654
|
Result:
|
|
4748
|
-
txid[
|
|
4655
|
+
txid[
|
|
4749
4656
|
txid
|
|
4750
4657
|
]
|
|
4751
4658
|
|
|
@@ -4754,7 +4661,7 @@ var methods = {
|
|
|
4754
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/
|
|
4755
4662
|
**/
|
|
4756
4663
|
transferfromaddresses: "transferfromaddresses",
|
|
4757
|
-
/** transferqualifier "qualifier_name" qty "to_address" ("change_address") ("message") (expire_time)
|
|
4664
|
+
/** transferqualifier "qualifier_name" qty "to_address" ("change_address") ("message") (expire_time)
|
|
4758
4665
|
|
|
4759
4666
|
THIS COMMAND IS NOT YET ACTIVE! Restricted assets must be active
|
|
4760
4667
|
|
|
@@ -4769,7 +4676,7 @@ var methods = {
|
|
|
4769
4676
|
6. "expire_time" (numeric, optional) UTC timestamp of when the message expires
|
|
4770
4677
|
|
|
4771
4678
|
Result:
|
|
4772
|
-
txid[
|
|
4679
|
+
txid[
|
|
4773
4680
|
txid
|
|
4774
4681
|
]
|
|
4775
4682
|
|
|
@@ -4847,7 +4754,7 @@ var methods = {
|
|
|
4847
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/
|
|
4848
4755
|
**/
|
|
4849
4756
|
unfreezerestrictedasset: "unfreezerestrictedasset",
|
|
4850
|
-
/** unsubscribefromchannel
|
|
4757
|
+
/** unsubscribefromchannel
|
|
4851
4758
|
|
|
4852
4759
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4853
4760
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4874,7 +4781,7 @@ var methods = {
|
|
|
4874
4781
|
ttt (numeric) The number of seconds that the server has been running
|
|
4875
4782
|
|
|
4876
4783
|
Examples:
|
|
4877
|
-
> neurai-cli uptime
|
|
4784
|
+
> neurai-cli uptime
|
|
4878
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/
|
|
4879
4786
|
**/
|
|
4880
4787
|
uptime: "uptime",
|
|
@@ -4930,7 +4837,7 @@ var methods = {
|
|
|
4930
4837
|
true|false (boolean) Verified or not
|
|
4931
4838
|
|
|
4932
4839
|
Examples:
|
|
4933
|
-
> neurai-cli verifychain
|
|
4840
|
+
> neurai-cli verifychain
|
|
4934
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/
|
|
4935
4842
|
**/
|
|
4936
4843
|
verifychain: "verifychain",
|
|
@@ -4973,7 +4880,7 @@ var methods = {
|
|
|
4973
4880
|
["txid"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof is invalid
|
|
4974
4881
|
**/
|
|
4975
4882
|
verifytxoutproof: "verifytxoutproof",
|
|
4976
|
-
/** viewallmessagechannels
|
|
4883
|
+
/** viewallmessagechannels
|
|
4977
4884
|
|
|
4978
4885
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4979
4886
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4986,11 +4893,11 @@ var methods = {
|
|
|
4986
4893
|
]
|
|
4987
4894
|
|
|
4988
4895
|
Examples:
|
|
4989
|
-
> neurai-cli viewallmessagechannels
|
|
4896
|
+
> neurai-cli viewallmessagechannels
|
|
4990
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/
|
|
4991
4898
|
**/
|
|
4992
4899
|
viewallmessagechannels: "viewallmessagechannels",
|
|
4993
|
-
/** viewallmessages
|
|
4900
|
+
/** viewallmessages
|
|
4994
4901
|
|
|
4995
4902
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4996
4903
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -5007,11 +4914,11 @@ var methods = {
|
|
|
5007
4914
|
"Expire UTC Time:" (Date, optional) If the message contains an expire date that is too large, the UTC number will be displayed
|
|
5008
4915
|
|
|
5009
4916
|
Examples:
|
|
5010
|
-
> neurai-cli viewallmessages
|
|
4917
|
+
> neurai-cli viewallmessages
|
|
5011
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/
|
|
5012
4919
|
**/
|
|
5013
4920
|
viewallmessages: "viewallmessages",
|
|
5014
|
-
/** viewmyrestrictedaddresses
|
|
4921
|
+
/** viewmyrestrictedaddresses
|
|
5015
4922
|
|
|
5016
4923
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
5017
4924
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -5027,11 +4934,11 @@ var methods = {
|
|
|
5027
4934
|
}...
|
|
5028
4935
|
|
|
5029
4936
|
Examples:
|
|
5030
|
-
> neurai-cli viewmyrestrictedaddresses
|
|
4937
|
+
> neurai-cli viewmyrestrictedaddresses
|
|
5031
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/
|
|
5032
4939
|
**/
|
|
5033
4940
|
viewmyrestrictedaddresses: "viewmyrestrictedaddresses",
|
|
5034
|
-
/** viewmytaggedaddresses
|
|
4941
|
+
/** viewmytaggedaddresses
|
|
5035
4942
|
|
|
5036
4943
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
5037
4944
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -5047,13 +4954,119 @@ var methods = {
|
|
|
5047
4954
|
}...
|
|
5048
4955
|
|
|
5049
4956
|
Examples:
|
|
5050
|
-
> neurai-cli viewmytaggedaddresses
|
|
4957
|
+
> neurai-cli viewmytaggedaddresses
|
|
5051
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/
|
|
5052
4959
|
**/
|
|
5053
4960
|
viewmytaggedaddresses: "viewmytaggedaddresses"
|
|
5054
4961
|
};
|
|
5055
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
|
+
|
|
5056
5061
|
// index.ts
|
|
5062
|
+
var MAINNET_GENESIS_HASH = "00000044d33c0c0ba019be5c0249730424a69cb4c222153322f68c6104484806";
|
|
5063
|
+
var TESTNET_GENESIS_HASH = "0000008b384aeffecdab182575dc4e86c9f07f90318c65088532660ed9a8a021";
|
|
5064
|
+
async function assertRpcGenesis(rpc, expectedGenesisHash) {
|
|
5065
|
+
const actual = await rpc("getblockhash", [0]);
|
|
5066
|
+
if (typeof actual !== "string" || actual.toLowerCase() !== expectedGenesisHash.toLowerCase()) {
|
|
5067
|
+
throw new Error(`Unexpected genesis block: expected ${expectedGenesisHash}, received ${String(actual)}`);
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5057
5070
|
function rpcNumber(value) {
|
|
5058
5071
|
return new import_lossless_json.LosslessNumber(value);
|
|
5059
5072
|
}
|
|
@@ -5098,7 +5111,9 @@ function getRPC(username, password, URL) {
|
|
|
5098
5111
|
const rpcResponse = postData(URL, data, username, password);
|
|
5099
5112
|
rpcResponse.then(async (response) => {
|
|
5100
5113
|
if (response.ok) {
|
|
5101
|
-
const
|
|
5114
|
+
const responseText = await response.text();
|
|
5115
|
+
if (isDepinRemoteMethod(method)) assertNoDuplicateJsonKeys(responseText);
|
|
5116
|
+
const obj = parseRpcJson(responseText);
|
|
5102
5117
|
if (obj && obj.error) {
|
|
5103
5118
|
rejectionFunc({
|
|
5104
5119
|
error: obj.error,
|
|
@@ -5113,7 +5128,9 @@ function getRPC(username, password, URL) {
|
|
|
5113
5128
|
description: null
|
|
5114
5129
|
};
|
|
5115
5130
|
try {
|
|
5116
|
-
|
|
5131
|
+
const responseText = await response.text();
|
|
5132
|
+
if (isDepinRemoteMethod(method)) assertNoDuplicateJsonKeys(responseText);
|
|
5133
|
+
obj = parseRpcJson(responseText);
|
|
5117
5134
|
} catch (e) {
|
|
5118
5135
|
}
|
|
5119
5136
|
const myError = {
|
|
@@ -5144,9 +5161,7 @@ async function postData(url = "", data = {}, username, password) {
|
|
|
5144
5161
|
if (typeof btoa === "function") {
|
|
5145
5162
|
base64Credentials = btoa(`${username}:${password}`);
|
|
5146
5163
|
} else if (Buffer) {
|
|
5147
|
-
base64Credentials = Buffer.from(`${username}:${password}`).toString(
|
|
5148
|
-
"base64"
|
|
5149
|
-
);
|
|
5164
|
+
base64Credentials = Buffer.from(`${username}:${password}`).toString("base64");
|
|
5150
5165
|
}
|
|
5151
5166
|
const response = await fetch(url, {
|
|
5152
5167
|
method: "POST",
|
|
@@ -5169,7 +5184,16 @@ async function postData(url = "", data = {}, username, password) {
|
|
|
5169
5184
|
}
|
|
5170
5185
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5171
5186
|
0 && (module.exports = {
|
|
5187
|
+
DEPIN_REMOTE_METHODS,
|
|
5188
|
+
DEPIN_RPC_PROTOCOL,
|
|
5189
|
+
MAINNET_GENESIS_HASH,
|
|
5190
|
+
TESTNET_GENESIS_HASH,
|
|
5191
|
+
assertNoDuplicateJsonKeys,
|
|
5192
|
+
assertRpcGenesis,
|
|
5193
|
+
createDepinNodeRouter,
|
|
5194
|
+
getDepinRequest,
|
|
5172
5195
|
getRPC,
|
|
5196
|
+
isDepinRemoteMethod,
|
|
5173
5197
|
methods,
|
|
5174
5198
|
parseRpcJson,
|
|
5175
5199
|
rpcNumber,
|