@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.mjs
CHANGED
|
@@ -31,7 +31,7 @@ var methods = {
|
|
|
31
31
|
> neurai-cli importprivkey "mykey"
|
|
32
32
|
|
|
33
33
|
Abort the running wallet rescan
|
|
34
|
-
> neurai-cli abortrescan
|
|
34
|
+
> neurai-cli abortrescan
|
|
35
35
|
|
|
36
36
|
As a JSON-RPC call
|
|
37
37
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "abortrescan", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
@@ -234,7 +234,7 @@ var methods = {
|
|
|
234
234
|
Clear all banned IPs.
|
|
235
235
|
|
|
236
236
|
Examples:
|
|
237
|
-
> neurai-cli clearbanned
|
|
237
|
+
> neurai-cli clearbanned
|
|
238
238
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "clearbanned", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
239
239
|
**/
|
|
240
240
|
clearbanned: "clearbanned",
|
|
@@ -243,11 +243,11 @@ var methods = {
|
|
|
243
243
|
Removes all transaction from the mempool
|
|
244
244
|
|
|
245
245
|
Examples:
|
|
246
|
-
> neurai-cli clearmempool
|
|
246
|
+
> neurai-cli clearmempool
|
|
247
247
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "clearmempool", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
248
248
|
**/
|
|
249
249
|
clearmempool: "clearmempool",
|
|
250
|
-
/** clearmessages
|
|
250
|
+
/** clearmessages
|
|
251
251
|
|
|
252
252
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
253
253
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -259,14 +259,14 @@ var methods = {
|
|
|
259
259
|
]
|
|
260
260
|
|
|
261
261
|
Examples:
|
|
262
|
-
> neurai-cli clearmessages
|
|
262
|
+
> neurai-cli clearmessages
|
|
263
263
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "clearmessages", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
264
264
|
**/
|
|
265
265
|
clearmessages: "clearmessages",
|
|
266
266
|
/** combinerawtransaction ["hexstring",...]
|
|
267
267
|
|
|
268
268
|
Combine multiple partially signed transactions into one transaction.
|
|
269
|
-
The combined transaction may be another partially signed transaction or a
|
|
269
|
+
The combined transaction may be another partially signed transaction or a
|
|
270
270
|
fully signed transaction.
|
|
271
271
|
Arguments:
|
|
272
272
|
1. "txs" (string) A json array of hex strings of partially signed transactions
|
|
@@ -372,7 +372,7 @@ var methods = {
|
|
|
372
372
|
"txid":"id", (string, required) The transaction id
|
|
373
373
|
"vout":n, (number, required) The output number
|
|
374
374
|
"sequence":n (number, optional) The sequence number
|
|
375
|
-
}
|
|
375
|
+
}
|
|
376
376
|
,...
|
|
377
377
|
]
|
|
378
378
|
2. "outputs" (object or array, required) outputs in object or ordered-array form
|
|
@@ -416,10 +416,10 @@ var methods = {
|
|
|
416
416
|
{ (object) A json object describing new unique assets to issue
|
|
417
417
|
"issue_unique":
|
|
418
418
|
{
|
|
419
|
-
"root_name":"root-name", (string, required) name of the asset the unique asset(s)
|
|
419
|
+
"root_name":"root-name", (string, required) name of the asset the unique asset(s)
|
|
420
420
|
are being issued under
|
|
421
421
|
"asset_tags":["asset_tag", ...], (array, required) the unique tag for each asset which is to be issued
|
|
422
|
-
"ipfs_hashes":["hash", ...], (array, optional) ipfs hashes corresponding to each supplied tag
|
|
422
|
+
"ipfs_hashes":["hash", ...], (array, optional) ipfs hashes corresponding to each supplied tag
|
|
423
423
|
(should be same size as "asset_tags")
|
|
424
424
|
}
|
|
425
425
|
}
|
|
@@ -430,9 +430,9 @@ var methods = {
|
|
|
430
430
|
"asset_name":"asset-name", (string, required) name of asset to be reissued
|
|
431
431
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
432
432
|
"reissuable":[0-1], (number, optional) default is 1, 1=reissuable asset
|
|
433
|
-
"ipfs_hash":"hash", (string, optional) An ipfs hash for discovering asset metadata,
|
|
433
|
+
"ipfs_hash":"hash", (string, optional) An ipfs hash for discovering asset metadata,
|
|
434
434
|
Overrides the current ipfs hash if given
|
|
435
|
-
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
435
|
+
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
436
436
|
If not given, it will be sent to the output address
|
|
437
437
|
}
|
|
438
438
|
}
|
|
@@ -442,13 +442,13 @@ var methods = {
|
|
|
442
442
|
{
|
|
443
443
|
"asset_name":"asset-name",(string, required) new asset name
|
|
444
444
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
445
|
-
"verifier_string":"text", (string, required) the verifier string to be used for a restricted
|
|
445
|
+
"verifier_string":"text", (string, required) the verifier string to be used for a restricted
|
|
446
446
|
asset transfer verification
|
|
447
447
|
"units":[0-8], (number, required) display units, between 0 (integral) and 8 (max precision)
|
|
448
448
|
"reissuable":[0-1], (number, required) 1=reissuable asset
|
|
449
449
|
"has_ipfs":[0-1], (number, required) 1=passing ipfs_hash
|
|
450
450
|
"ipfs_hash":"hash", (string, optional) an ipfs hash for discovering asset metadata
|
|
451
|
-
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
451
|
+
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
452
452
|
If not given, it will be sent to the output address
|
|
453
453
|
}
|
|
454
454
|
}
|
|
@@ -459,11 +459,11 @@ var methods = {
|
|
|
459
459
|
"asset_name":"asset-name", (string, required) name of asset to be reissued
|
|
460
460
|
"asset_quantity":n, (number, required) the number of raw units to issue
|
|
461
461
|
"reissuable":[0-1], (number, optional) default is 1, 1=reissuable asset
|
|
462
|
-
"verifier_string":"text", (string, optional) the verifier string to be used for a restricted asset
|
|
462
|
+
"verifier_string":"text", (string, optional) the verifier string to be used for a restricted asset
|
|
463
463
|
transfer verification
|
|
464
|
-
"ipfs_hash":"hash", (string, optional) An ipfs hash for discovering asset metadata,
|
|
464
|
+
"ipfs_hash":"hash", (string, optional) An ipfs hash for discovering asset metadata,
|
|
465
465
|
Overrides the current ipfs hash if given
|
|
466
|
-
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
466
|
+
"owner_change_address" (string, optional) the address where the owner token will be sent to.
|
|
467
467
|
If not given, it will be sent to the output address
|
|
468
468
|
}
|
|
469
469
|
}
|
|
@@ -473,9 +473,9 @@ var methods = {
|
|
|
473
473
|
{
|
|
474
474
|
"asset_name":"asset_name", (string, required) a qualifier name (starts with '#')
|
|
475
475
|
"asset_quantity":n, (numeric, optional, default=1) the number of units to be issued (1 to 10)
|
|
476
|
-
"has_ipfs":[0-1], (boolean, optional, default=false), whether ifps hash is going
|
|
476
|
+
"has_ipfs":[0-1], (boolean, optional, default=false), whether ifps hash is going
|
|
477
477
|
to be added to the asset
|
|
478
|
-
"ipfs_hash":"hash", (string, optional but required if has_ipfs = 1), an ipfs hash or a
|
|
478
|
+
"ipfs_hash":"hash", (string, optional but required if has_ipfs = 1), an ipfs hash or a
|
|
479
479
|
txid hash once RIP5 is activated
|
|
480
480
|
"root_change_address" (string, optional) Only applies when issuing subqualifiers.
|
|
481
481
|
The address where the root qualifier will be sent.
|
|
@@ -699,216 +699,114 @@ var methods = {
|
|
|
699
699
|
> 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/
|
|
700
700
|
**/
|
|
701
701
|
decodescript: "decodescript",
|
|
702
|
-
/**
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
Examples:
|
|
710
|
-
> neurai-cli depinchallenge "&TOKEN/SECTION" "NXholder..." 1730000000000 "<signature>"
|
|
711
|
-
**/
|
|
702
|
+
/**
|
|
703
|
+
* depinchallenge request
|
|
704
|
+
*
|
|
705
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
706
|
+
* 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.
|
|
707
|
+
*/
|
|
712
708
|
depinchallenge: "depinchallenge",
|
|
713
|
-
/**
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
"removed": n,
|
|
720
|
-
"remaining": n
|
|
721
|
-
}
|
|
722
|
-
**/
|
|
709
|
+
/**
|
|
710
|
+
* depinclearmsg request
|
|
711
|
+
*
|
|
712
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
713
|
+
* 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.
|
|
714
|
+
*/
|
|
723
715
|
depinclearmsg: "depinclearmsg",
|
|
724
|
-
/**
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
716
|
+
/**
|
|
717
|
+
* depindecrypt "address" "encrypted"
|
|
718
|
+
*
|
|
719
|
+
* Decrypts an encrypted DePIN reply with a wallet key. Verify the reply's poolsig before using this method; depindecrypt does not verify it.
|
|
720
|
+
*
|
|
721
|
+
* Result:
|
|
722
|
+
* The decrypted JSON value, or a string when the plaintext is not JSON.
|
|
723
|
+
*/
|
|
731
724
|
depindecrypt: "depindecrypt",
|
|
732
|
-
/**
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
Active means: positive balance, public key revealed, and not blocked by an
|
|
739
|
-
owner freeze or by self-revocation. Restriction is per (asset, address), so an
|
|
740
|
-
address that is active in at least one ancestor is returned even if it revoked
|
|
741
|
-
itself in another -- holding the root already grants visibility over the branch.
|
|
742
|
-
|
|
743
|
-
The query is exact: '&TEST' returns holders of '&TEST' only, never of
|
|
744
|
-
'&TEST/APPLE', '&TESTING' or '&TEST.FOO'. Every derived ancestor must exist; a
|
|
745
|
-
missing intermediate level is an error rather than something skipped.
|
|
746
|
-
|
|
747
|
-
This command is informational. It does not know about -depinmsgmaxusers, does
|
|
748
|
-
not decide whether a message fits in a pool, and a truncated result must not be
|
|
749
|
-
treated as a complete recipient set.
|
|
750
|
-
|
|
751
|
-
Requires -assetindex and -pubkeyindex.
|
|
752
|
-
|
|
753
|
-
Arguments:
|
|
754
|
-
1. "token" (string, required) DEPIN token, e.g. "&TEST/APPLE/GOLDEN"
|
|
755
|
-
2. max_results (numeric, optional, default=1000) Maximum recipients to return
|
|
756
|
-
(1..10000)
|
|
757
|
-
3. "stop_at" (string, optional) Stop deriving ancestors at this token,
|
|
758
|
-
inclusive. Must be the token itself or one of its ancestors.
|
|
759
|
-
Omitted: derive up to the absolute root.
|
|
760
|
-
|
|
761
|
-
Result:
|
|
762
|
-
{
|
|
763
|
-
"token": "name", (string) Token queried
|
|
764
|
-
"stop_at": "name", (string) Where derivation stopped ("" = root)
|
|
765
|
-
"ancestors": ["name", ...], (array) Token first, then each ancestor
|
|
766
|
-
"recipients": [ (array) Active holders, ordered by address
|
|
767
|
-
{
|
|
768
|
-
"address": "address", (string) Holder address
|
|
769
|
-
"pubkey": "hex" (string) Public key revealed on chain
|
|
770
|
-
}, ...
|
|
771
|
-
],
|
|
772
|
-
"returned": n, (numeric) Number of recipients returned
|
|
773
|
-
"max_results": n, (numeric) Limit applied
|
|
774
|
-
"truncated": true|false, (boolean) True if more eligible recipients exist
|
|
775
|
-
"skipped_no_pubkey": n, (numeric) Addresses dropped for lacking a usable
|
|
776
|
-
revealed public key
|
|
777
|
-
"skipped_no_pubkey_complete": bool, (boolean) False when truncated: the count then
|
|
778
|
-
covers only the addresses examined
|
|
779
|
-
"skipped_restricted": n, (numeric) Addresses dropped as frozen or
|
|
780
|
-
self-revoked in every ancestor they hold
|
|
781
|
-
"skipped_restricted_complete": bool (boolean) Same rule as above
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
Examples:
|
|
785
|
-
> neurai-cli depingetancestorrecipients "&TEST/APPLE/GOLDEN"
|
|
786
|
-
> neurai-cli depingetancestorrecipients "&TEST/APPLE/GOLDEN" 50 "&TEST/APPLE"
|
|
787
|
-
> 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/
|
|
788
|
-
**/
|
|
725
|
+
/**
|
|
726
|
+
* depingetancestorrecipients request
|
|
727
|
+
*
|
|
728
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
729
|
+
* 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.
|
|
730
|
+
*/
|
|
789
731
|
depingetancestorrecipients: "depingetancestorrecipients",
|
|
790
|
-
/**
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
732
|
+
/**
|
|
733
|
+
* depingetmsg "token" ( "fromaddress" )
|
|
734
|
+
*
|
|
735
|
+
* 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.
|
|
736
|
+
*/
|
|
794
737
|
depingetmsg: "depingetmsg",
|
|
795
|
-
/**
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
738
|
+
/**
|
|
739
|
+
* depingetmsginfo 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
|
+
* 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.
|
|
743
|
+
*/
|
|
799
744
|
depingetmsginfo: "depingetmsginfo",
|
|
800
|
-
/**
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
745
|
+
/**
|
|
746
|
+
* depinlistsections 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
|
+
*/
|
|
804
751
|
depinlistsections: "depinlistsections",
|
|
805
|
-
/**
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
"enabled": true|false, (boolean) Whether MCP worker is enabled
|
|
812
|
-
"running": true|false, (boolean) Whether MCP worker is running
|
|
813
|
-
"mcp_url": "url", (string) MCP server URL
|
|
814
|
-
"model_name": "name", (string) Name of the loaded AI model
|
|
815
|
-
"command_key": "key", (string) Command prefix (e.g. /ai)
|
|
816
|
-
"depin_token": "token", (string) DePIN token being monitored
|
|
817
|
-
"poll_interval": n, (numeric) Polling interval in seconds
|
|
818
|
-
"commands_processed": n, (numeric) Total commands processed
|
|
819
|
-
"total_errors": n, (numeric) Total errors encountered
|
|
820
|
-
"rate_limited": n, (numeric) Commands rejected by rate limiting
|
|
821
|
-
"concurrency": n, (numeric) Number of parallel task threads
|
|
822
|
-
"tasks_in_flight": n, (numeric) AI requests currently being processed
|
|
823
|
-
"processed_cache": n, (numeric) Size of the processed-message dedup cache
|
|
824
|
-
"context_sessions": n, (numeric) Active conversation contexts
|
|
825
|
-
"last_poll_time": n (numeric) Unix timestamp of last poll
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
Examples:
|
|
829
|
-
> neurai-cli depinmcpstatus
|
|
830
|
-
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "depinmcpstatus", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
831
|
-
**/
|
|
752
|
+
/**
|
|
753
|
+
* depinmcpstatus request
|
|
754
|
+
*
|
|
755
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
756
|
+
* 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.
|
|
757
|
+
*/
|
|
832
758
|
depinmcpstatus: "depinmcpstatus",
|
|
833
|
-
/**
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
759
|
+
/**
|
|
760
|
+
* depinpoolpkey
|
|
761
|
+
*
|
|
762
|
+
* Wallet-only operator helper that derives the dedicated DePIN pool public key from the loaded service wallet.
|
|
763
|
+
*
|
|
764
|
+
* Result:
|
|
765
|
+
* {
|
|
766
|
+
* "pubkey": "hex",
|
|
767
|
+
* "address": "address",
|
|
768
|
+
* "path": "derivation_path"
|
|
769
|
+
* }
|
|
770
|
+
*/
|
|
844
771
|
depinpoolpkey: "depinpoolpkey",
|
|
845
|
-
/**
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
"enabled": true|false,
|
|
852
|
-
"token": "string",
|
|
853
|
-
"total_messages": n,
|
|
854
|
-
"total_size_bytes": n,
|
|
855
|
-
"memory_usage_bytes": n,
|
|
856
|
-
"oldest_message": "YYYY-MM-DD HH:MM:SS",
|
|
857
|
-
"newest_message": "YYYY-MM-DD HH:MM:SS",
|
|
858
|
-
"messages_by_age": {
|
|
859
|
-
"last_hour": n,
|
|
860
|
-
"last_day": n,
|
|
861
|
-
"last_week": n
|
|
862
|
-
},
|
|
863
|
-
"unique_senders": n,
|
|
864
|
-
"unique_recipients": n,
|
|
865
|
-
"avg_recipients_per_message": n.nn,
|
|
866
|
-
"avg_message_size": n,
|
|
867
|
-
"expiring_in_24h": n
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
Examples:
|
|
871
|
-
> neurai-cli depinpoolstats
|
|
872
|
-
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "depinpoolstats", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
873
|
-
**/
|
|
772
|
+
/**
|
|
773
|
+
* depinpoolstats request
|
|
774
|
+
*
|
|
775
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
776
|
+
* 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.
|
|
777
|
+
*/
|
|
874
778
|
depinpoolstats: "depinpoolstats",
|
|
875
|
-
/**
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
779
|
+
/**
|
|
780
|
+
* depinreceivemsg request
|
|
781
|
+
*
|
|
782
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
783
|
+
* 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.
|
|
784
|
+
*/
|
|
879
785
|
depinreceivemsg: "depinreceivemsg",
|
|
880
|
-
/**
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
786
|
+
/**
|
|
787
|
+
* depinreceiveseq request
|
|
788
|
+
*
|
|
789
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
790
|
+
* 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.
|
|
791
|
+
*/
|
|
792
|
+
depinreceiveseq: "depinreceiveseq",
|
|
793
|
+
/**
|
|
794
|
+
* depinsendmsg "token" "message" "fromaddress"
|
|
795
|
+
*
|
|
796
|
+
* 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.
|
|
797
|
+
*/
|
|
884
798
|
depinsendmsg: "depinsendmsg",
|
|
885
|
-
/**
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
/** depinsignrequest "address" "token" ( "type" )
|
|
897
|
-
|
|
898
|
-
Wallet helper that signs a depinchallenge request over the current Unix time in milliseconds.
|
|
899
|
-
|
|
900
|
-
Result:
|
|
901
|
-
{
|
|
902
|
-
"timestamp": n,
|
|
903
|
-
"signature": "base64",
|
|
904
|
-
"preimage": "DEPIN-REQ|..."
|
|
905
|
-
}
|
|
906
|
-
**/
|
|
907
|
-
depinsignrequest: "depinsignrequest",
|
|
908
|
-
/** depinsubmitmsg {"sender":"...","encrypted":"..."}
|
|
909
|
-
|
|
910
|
-
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.
|
|
911
|
-
**/
|
|
799
|
+
/**
|
|
800
|
+
* depinsignrpc "method" request
|
|
801
|
+
* 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.
|
|
802
|
+
*/
|
|
803
|
+
depinsignrpc: "depinsignrpc",
|
|
804
|
+
/**
|
|
805
|
+
* depinsubmitmsg request
|
|
806
|
+
*
|
|
807
|
+
* DePIN RPC protocol 5. Exactly one request object, passed as [request] or {"request": request}. Legacy positional arguments and protocols 2/3/4 are rejected.
|
|
808
|
+
* 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.
|
|
809
|
+
*/
|
|
912
810
|
depinsubmitmsg: "depinsubmitmsg",
|
|
913
811
|
/** disconnectnode "[address]" [nodeid]
|
|
914
812
|
|
|
@@ -975,7 +873,7 @@ var methods = {
|
|
|
975
873
|
"xpqpriv..." (string) Base58Check-encoded master CExtKeyPQ
|
|
976
874
|
|
|
977
875
|
Examples:
|
|
978
|
-
> neurai-cli dumpextkeypq
|
|
876
|
+
> neurai-cli dumpextkeypq
|
|
979
877
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "dumpextkeypq", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
980
878
|
**/
|
|
981
879
|
dumpextkeypq: "dumpextkeypq",
|
|
@@ -1016,7 +914,7 @@ var methods = {
|
|
|
1016
914
|
/** encryptwallet "passphrase"
|
|
1017
915
|
|
|
1018
916
|
Encrypts the wallet with 'passphrase'. This is for first time encryption.
|
|
1019
|
-
After this, any calls that interact with private keys such as sending or signing
|
|
917
|
+
After this, any calls that interact with private keys such as sending or signing
|
|
1020
918
|
will require the passphrase to be set prior the making these calls.
|
|
1021
919
|
Use the walletpassphrase call for this, and then walletlock call.
|
|
1022
920
|
If the wallet is already encrypted, use the walletpassphrasechange call.
|
|
@@ -1037,7 +935,7 @@ var methods = {
|
|
|
1037
935
|
> neurai-cli signmessage "address" "test message"
|
|
1038
936
|
|
|
1039
937
|
Now lock the wallet again by removing the passphrase
|
|
1040
|
-
> neurai-cli walletlock
|
|
938
|
+
> neurai-cli walletlock
|
|
1041
939
|
|
|
1042
940
|
As a json rpc call
|
|
1043
941
|
> 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/
|
|
@@ -1306,7 +1204,7 @@ var methods = {
|
|
|
1306
1204
|
"address" (string) The account neurai address
|
|
1307
1205
|
|
|
1308
1206
|
Examples:
|
|
1309
|
-
> neurai-cli getaccountaddress
|
|
1207
|
+
> neurai-cli getaccountaddress
|
|
1310
1208
|
> neurai-cli getaccountaddress ""
|
|
1311
1209
|
> neurai-cli getaccountaddress "myaccount"
|
|
1312
1210
|
> 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/
|
|
@@ -1585,7 +1483,7 @@ var methods = {
|
|
|
1585
1483
|
Examples:
|
|
1586
1484
|
|
|
1587
1485
|
The total amount in the wallet with 1 or more confirmations
|
|
1588
|
-
> neurai-cli getbalance
|
|
1486
|
+
> neurai-cli getbalance
|
|
1589
1487
|
|
|
1590
1488
|
The total amount in the wallet at least 6 blocks confirmed
|
|
1591
1489
|
> neurai-cli getbalance "*" 6
|
|
@@ -1602,15 +1500,15 @@ var methods = {
|
|
|
1602
1500
|
"hex" (string) the block hash hex encoded
|
|
1603
1501
|
|
|
1604
1502
|
Examples:
|
|
1605
|
-
> neurai-cli getbestblockhash
|
|
1503
|
+
> neurai-cli getbestblockhash
|
|
1606
1504
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestblockhash", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1607
1505
|
**/
|
|
1608
1506
|
getbestblockhash: "getbestblockhash",
|
|
1609
|
-
/** getblock "blockhash" ( verbosity )
|
|
1507
|
+
/** getblock "blockhash" ( verbosity )
|
|
1610
1508
|
|
|
1611
1509
|
If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.
|
|
1612
1510
|
If verbosity is 1, returns an Object with information about block <hash>.
|
|
1613
|
-
If verbosity is 2, returns an Object with information about block <hash> and information about each transaction.
|
|
1511
|
+
If verbosity is 2, returns an Object with information about block <hash> and information about each transaction.
|
|
1614
1512
|
|
|
1615
1513
|
Arguments:
|
|
1616
1514
|
1. "blockhash" (string, required) The block hash
|
|
@@ -1693,11 +1591,11 @@ var methods = {
|
|
|
1693
1591
|
"timeout": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in
|
|
1694
1592
|
"since": xx, (numeric) height of the first block to which the status applies
|
|
1695
1593
|
"statistics": { (object) numeric statistics about BIP9 signalling for a softfork (only for "started" status)
|
|
1696
|
-
"period": xx, (numeric) the length in blocks of the BIP9 signalling period
|
|
1697
|
-
"threshold": xx, (numeric) the number of blocks with the version bit set required to activate the feature
|
|
1698
|
-
"elapsed": xx, (numeric) the number of blocks elapsed since the beginning of the current period
|
|
1699
|
-
"count": xx, (numeric) the number of blocks with the version bit set in the current period
|
|
1700
|
-
"possible": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold
|
|
1594
|
+
"period": xx, (numeric) the length in blocks of the BIP9 signalling period
|
|
1595
|
+
"threshold": xx, (numeric) the number of blocks with the version bit set required to activate the feature
|
|
1596
|
+
"elapsed": xx, (numeric) the number of blocks elapsed since the beginning of the current period
|
|
1597
|
+
"count": xx, (numeric) the number of blocks with the version bit set in the current period
|
|
1598
|
+
"possible": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold
|
|
1701
1599
|
}
|
|
1702
1600
|
}
|
|
1703
1601
|
}
|
|
@@ -1705,7 +1603,7 @@ var methods = {
|
|
|
1705
1603
|
}
|
|
1706
1604
|
|
|
1707
1605
|
Examples:
|
|
1708
|
-
> neurai-cli getblockchaininfo
|
|
1606
|
+
> neurai-cli getblockchaininfo
|
|
1709
1607
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1710
1608
|
**/
|
|
1711
1609
|
getblockchaininfo: "getblockchaininfo",
|
|
@@ -1717,7 +1615,7 @@ var methods = {
|
|
|
1717
1615
|
n (numeric) The current block count
|
|
1718
1616
|
|
|
1719
1617
|
Examples:
|
|
1720
|
-
> neurai-cli getblockcount
|
|
1618
|
+
> neurai-cli getblockcount
|
|
1721
1619
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1722
1620
|
**/
|
|
1723
1621
|
getblockcount: "getblockcount",
|
|
@@ -1841,7 +1739,7 @@ var methods = {
|
|
|
1841
1739
|
"data" : "xxxx", (string) transaction data encoded in hexadecimal (byte-for-byte)
|
|
1842
1740
|
"txid" : "xxxx", (string) transaction id encoded in little-endian hexadecimal
|
|
1843
1741
|
"hash" : "xxxx", (string) hash encoded in little-endian hexadecimal (including witness data)
|
|
1844
|
-
"depends" : [ (array) array of numbers
|
|
1742
|
+
"depends" : [ (array) array of numbers
|
|
1845
1743
|
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
|
|
1846
1744
|
,...
|
|
1847
1745
|
],
|
|
@@ -1859,7 +1757,7 @@ var methods = {
|
|
|
1859
1757
|
"coinbasetxn" : { ... }, (json object) information for coinbase transaction
|
|
1860
1758
|
"target" : "xxxx", (string) The hash target
|
|
1861
1759
|
"mintime" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)
|
|
1862
|
-
"mutable" : [ (array of string) list of ways the block template may be changed
|
|
1760
|
+
"mutable" : [ (array of string) list of ways the block template may be changed
|
|
1863
1761
|
"value" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'
|
|
1864
1762
|
,...
|
|
1865
1763
|
],
|
|
@@ -1873,11 +1771,11 @@ var methods = {
|
|
|
1873
1771
|
}
|
|
1874
1772
|
|
|
1875
1773
|
Examples:
|
|
1876
|
-
> neurai-cli getblocktemplate
|
|
1774
|
+
> neurai-cli getblocktemplate
|
|
1877
1775
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblocktemplate", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1878
1776
|
**/
|
|
1879
1777
|
getblocktemplate: "getblocktemplate",
|
|
1880
|
-
/** getcacheinfo
|
|
1778
|
+
/** getcacheinfo
|
|
1881
1779
|
|
|
1882
1780
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
1883
1781
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -1897,7 +1795,7 @@ var methods = {
|
|
|
1897
1795
|
|
|
1898
1796
|
Examples:
|
|
1899
1797
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getcacheinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1900
|
-
> neurai-cli getcacheinfo
|
|
1798
|
+
> neurai-cli getcacheinfo
|
|
1901
1799
|
**/
|
|
1902
1800
|
getcacheinfo: "getcacheinfo",
|
|
1903
1801
|
/** getchaintips
|
|
@@ -1926,7 +1824,7 @@ var methods = {
|
|
|
1926
1824
|
5. "active" This is the tip of the active main chain, which is certainly valid
|
|
1927
1825
|
|
|
1928
1826
|
Examples:
|
|
1929
|
-
> neurai-cli getchaintips
|
|
1827
|
+
> neurai-cli getchaintips
|
|
1930
1828
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintips", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1931
1829
|
**/
|
|
1932
1830
|
getchaintips: "getchaintips",
|
|
@@ -1949,7 +1847,7 @@ var methods = {
|
|
|
1949
1847
|
}
|
|
1950
1848
|
|
|
1951
1849
|
Examples:
|
|
1952
|
-
> neurai-cli getchaintxstats
|
|
1850
|
+
> neurai-cli getchaintxstats
|
|
1953
1851
|
> 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/
|
|
1954
1852
|
**/
|
|
1955
1853
|
getchaintxstats: "getchaintxstats",
|
|
@@ -1961,7 +1859,7 @@ var methods = {
|
|
|
1961
1859
|
n (numeric) The connection count
|
|
1962
1860
|
|
|
1963
1861
|
Examples:
|
|
1964
|
-
> neurai-cli getconnectioncount
|
|
1862
|
+
> neurai-cli getconnectioncount
|
|
1965
1863
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getconnectioncount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1966
1864
|
**/
|
|
1967
1865
|
getconnectioncount: "getconnectioncount",
|
|
@@ -1973,7 +1871,7 @@ var methods = {
|
|
|
1973
1871
|
n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.
|
|
1974
1872
|
|
|
1975
1873
|
Examples:
|
|
1976
|
-
> neurai-cli getdifficulty
|
|
1874
|
+
> neurai-cli getdifficulty
|
|
1977
1875
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getdifficulty", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
1978
1876
|
**/
|
|
1979
1877
|
getdifficulty: "getdifficulty",
|
|
@@ -2005,7 +1903,7 @@ var methods = {
|
|
|
2005
1903
|
true|false (boolean) If the server is set to generate coins or not
|
|
2006
1904
|
|
|
2007
1905
|
Examples:
|
|
2008
|
-
> neurai-cli getgenerate
|
|
1906
|
+
> neurai-cli getgenerate
|
|
2009
1907
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getgenerate", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2010
1908
|
**/
|
|
2011
1909
|
getgenerate: "getgenerate",
|
|
@@ -2056,7 +1954,7 @@ var methods = {
|
|
|
2056
1954
|
}
|
|
2057
1955
|
|
|
2058
1956
|
Examples:
|
|
2059
|
-
> neurai-cli getinfo
|
|
1957
|
+
> neurai-cli getinfo
|
|
2060
1958
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2061
1959
|
**/
|
|
2062
1960
|
getinfo: "getinfo",
|
|
@@ -2094,7 +1992,7 @@ var methods = {
|
|
|
2094
1992
|
}
|
|
2095
1993
|
|
|
2096
1994
|
Examples:
|
|
2097
|
-
> neurai-cli getmasterkeyinfo
|
|
1995
|
+
> neurai-cli getmasterkeyinfo
|
|
2098
1996
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmasterkeyinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2099
1997
|
**/
|
|
2100
1998
|
getmasterkeyinfo: "getmasterkeyinfo",
|
|
@@ -2121,7 +2019,7 @@ var methods = {
|
|
|
2121
2019
|
"<malloc version="1">..."
|
|
2122
2020
|
|
|
2123
2021
|
Examples:
|
|
2124
|
-
> neurai-cli getmemoryinfo
|
|
2022
|
+
> neurai-cli getmemoryinfo
|
|
2125
2023
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmemoryinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2126
2024
|
**/
|
|
2127
2025
|
getmemoryinfo: "getmemoryinfo",
|
|
@@ -2250,7 +2148,7 @@ var methods = {
|
|
|
2250
2148
|
}
|
|
2251
2149
|
|
|
2252
2150
|
Examples:
|
|
2253
|
-
> neurai-cli getmempoolinfo
|
|
2151
|
+
> neurai-cli getmempoolinfo
|
|
2254
2152
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmempoolinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2255
2153
|
**/
|
|
2256
2154
|
getmempoolinfo: "getmempoolinfo",
|
|
@@ -2272,7 +2170,7 @@ var methods = {
|
|
|
2272
2170
|
}
|
|
2273
2171
|
|
|
2274
2172
|
Examples:
|
|
2275
|
-
> neurai-cli getmininginfo
|
|
2173
|
+
> neurai-cli getmininginfo
|
|
2276
2174
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2277
2175
|
**/
|
|
2278
2176
|
getmininginfo: "getmininginfo",
|
|
@@ -2286,7 +2184,7 @@ var methods = {
|
|
|
2286
2184
|
"passphrase:" (optional) Only show if passphrase was used when creating the wallet
|
|
2287
2185
|
|
|
2288
2186
|
Examples:
|
|
2289
|
-
> neurai-cli getmywords
|
|
2187
|
+
> neurai-cli getmywords
|
|
2290
2188
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmywords", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2291
2189
|
**/
|
|
2292
2190
|
getmywords: "getmywords",
|
|
@@ -2312,7 +2210,7 @@ var methods = {
|
|
|
2312
2210
|
}
|
|
2313
2211
|
|
|
2314
2212
|
Examples:
|
|
2315
|
-
> neurai-cli getnettotals
|
|
2213
|
+
> neurai-cli getnettotals
|
|
2316
2214
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnettotals", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2317
2215
|
**/
|
|
2318
2216
|
getnettotals: "getnettotals",
|
|
@@ -2330,7 +2228,7 @@ var methods = {
|
|
|
2330
2228
|
x (numeric) Hashes per second estimated
|
|
2331
2229
|
|
|
2332
2230
|
Examples:
|
|
2333
|
-
> neurai-cli getnetworkhashps
|
|
2231
|
+
> neurai-cli getnetworkhashps
|
|
2334
2232
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnetworkhashps", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2335
2233
|
**/
|
|
2336
2234
|
getnetworkhashps: "getnetworkhashps",
|
|
@@ -2371,14 +2269,14 @@ var methods = {
|
|
|
2371
2269
|
}
|
|
2372
2270
|
|
|
2373
2271
|
Examples:
|
|
2374
|
-
> neurai-cli getnetworkinfo
|
|
2272
|
+
> neurai-cli getnetworkinfo
|
|
2375
2273
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnetworkinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2376
2274
|
**/
|
|
2377
2275
|
getnetworkinfo: "getnetworkinfo",
|
|
2378
2276
|
/** getnewaddress ( "account" "address_type" )
|
|
2379
2277
|
|
|
2380
2278
|
Returns a new Neurai address for receiving payments.
|
|
2381
|
-
If 'account' is specified (DEPRECATED), it is added to the address book
|
|
2279
|
+
If 'account' is specified (DEPRECATED), it is added to the address book
|
|
2382
2280
|
so payments received with the address will be credited to 'account'.
|
|
2383
2281
|
|
|
2384
2282
|
Arguments:
|
|
@@ -2389,7 +2287,7 @@ var methods = {
|
|
|
2389
2287
|
"address" (string) The new neurai address
|
|
2390
2288
|
|
|
2391
2289
|
Examples:
|
|
2392
|
-
> neurai-cli getnewaddress
|
|
2290
|
+
> neurai-cli getnewaddress
|
|
2393
2291
|
> neurai-cli getnewaddress "" "ecdsa"
|
|
2394
2292
|
> 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/
|
|
2395
2293
|
**/
|
|
@@ -2442,7 +2340,7 @@ var methods = {
|
|
|
2442
2340
|
]
|
|
2443
2341
|
|
|
2444
2342
|
Examples:
|
|
2445
|
-
> neurai-cli getpeerinfo
|
|
2343
|
+
> neurai-cli getpeerinfo
|
|
2446
2344
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getpeerinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2447
2345
|
**/
|
|
2448
2346
|
getpeerinfo: "getpeerinfo",
|
|
@@ -2479,7 +2377,7 @@ var methods = {
|
|
|
2479
2377
|
"address" (string) The address
|
|
2480
2378
|
|
|
2481
2379
|
Examples:
|
|
2482
|
-
> neurai-cli getrawchangeaddress
|
|
2380
|
+
> neurai-cli getrawchangeaddress
|
|
2483
2381
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawchangeaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2484
2382
|
**/
|
|
2485
2383
|
getrawchangeaddress: "getrawchangeaddress",
|
|
@@ -2554,7 +2452,7 @@ var methods = {
|
|
|
2554
2452
|
"vin" : [ (array of json objects)
|
|
2555
2453
|
{
|
|
2556
2454
|
"txid": "id", (string) The transaction id
|
|
2557
|
-
"vout": n, (numeric)
|
|
2455
|
+
"vout": n, (numeric)
|
|
2558
2456
|
"scriptSig": { (json object) The script
|
|
2559
2457
|
"asm": "asm", (string) asm
|
|
2560
2458
|
"hex": "hex" (string) hex
|
|
@@ -2653,12 +2551,12 @@ var methods = {
|
|
|
2653
2551
|
"active_commands" (array) All active commands
|
|
2654
2552
|
[
|
|
2655
2553
|
{ (object) Information about an active command
|
|
2656
|
-
"method" (string) The name of the RPC command
|
|
2554
|
+
"method" (string) The name of the RPC command
|
|
2657
2555
|
"duration" (numeric) The running time in microseconds
|
|
2658
2556
|
},...
|
|
2659
2557
|
],
|
|
2660
2558
|
}
|
|
2661
|
-
> neurai-cli getrpcinfo
|
|
2559
|
+
> neurai-cli getrpcinfo
|
|
2662
2560
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrpcinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2663
2561
|
**/
|
|
2664
2562
|
getrpcinfo: "getrpcinfo",
|
|
@@ -2740,7 +2638,7 @@ var methods = {
|
|
|
2740
2638
|
Result:
|
|
2741
2639
|
{
|
|
2742
2640
|
"amount" : x.xxx, (numeric) The transaction amount in XNA
|
|
2743
|
-
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
2641
|
+
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
2744
2642
|
'send' category of transactions.
|
|
2745
2643
|
"confirmations" : n, (numeric) The number of confirmations
|
|
2746
2644
|
"blockhash" : "hash", (string) The block hash
|
|
@@ -2759,9 +2657,9 @@ var methods = {
|
|
|
2759
2657
|
"amount" : x.xxx, (numeric) The amount in XNA
|
|
2760
2658
|
"label" : "label", (string) A comment for the address/transaction, if any
|
|
2761
2659
|
"vout" : n, (numeric) the vout value
|
|
2762
|
-
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
2660
|
+
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
2763
2661
|
'send' category of transactions.
|
|
2764
|
-
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
|
|
2662
|
+
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
|
|
2765
2663
|
'send' category of transactions.
|
|
2766
2664
|
}
|
|
2767
2665
|
,...
|
|
@@ -2801,8 +2699,8 @@ var methods = {
|
|
|
2801
2699
|
"confirmations" : n, (numeric) The number of confirmations
|
|
2802
2700
|
"value" : x.xxx, (numeric) The transaction value in XNA
|
|
2803
2701
|
"scriptPubKey" : { (json object)
|
|
2804
|
-
"asm" : "code", (string)
|
|
2805
|
-
"hex" : "hex", (string)
|
|
2702
|
+
"asm" : "code", (string)
|
|
2703
|
+
"hex" : "hex", (string)
|
|
2806
2704
|
"reqSigs" : n, (numeric) Number of required signatures
|
|
2807
2705
|
"type" : "pubkeyhash", (string) The type, eg pubkeyhash
|
|
2808
2706
|
"addresses" : [ (array of string) array of neurai addresses
|
|
@@ -2816,7 +2714,7 @@ var methods = {
|
|
|
2816
2714
|
Examples:
|
|
2817
2715
|
|
|
2818
2716
|
Get unspent transactions
|
|
2819
|
-
> neurai-cli listunspent
|
|
2717
|
+
> neurai-cli listunspent
|
|
2820
2718
|
|
|
2821
2719
|
View the details
|
|
2822
2720
|
> neurai-cli gettxout "txid" 1
|
|
@@ -2864,7 +2762,7 @@ var methods = {
|
|
|
2864
2762
|
}
|
|
2865
2763
|
|
|
2866
2764
|
Examples:
|
|
2867
|
-
> neurai-cli gettxoutsetinfo
|
|
2765
|
+
> neurai-cli gettxoutsetinfo
|
|
2868
2766
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettxoutsetinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2869
2767
|
**/
|
|
2870
2768
|
gettxoutsetinfo: "gettxoutsetinfo",
|
|
@@ -2911,7 +2809,7 @@ var methods = {
|
|
|
2911
2809
|
}
|
|
2912
2810
|
|
|
2913
2811
|
Examples:
|
|
2914
|
-
> neurai-cli getwalletinfo
|
|
2812
|
+
> neurai-cli getwalletinfo
|
|
2915
2813
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getwalletinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
2916
2814
|
**/
|
|
2917
2815
|
getwalletinfo: "getwalletinfo",
|
|
@@ -3222,7 +3120,7 @@ var methods = {
|
|
|
3222
3120
|
1. newsize (numeric, optional, default=100) The new keypool size
|
|
3223
3121
|
|
|
3224
3122
|
Examples:
|
|
3225
|
-
> neurai-cli keypoolrefill
|
|
3123
|
+
> neurai-cli keypoolrefill
|
|
3226
3124
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "keypoolrefill", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3227
3125
|
**/
|
|
3228
3126
|
keypoolrefill: "keypoolrefill",
|
|
@@ -3243,7 +3141,7 @@ var methods = {
|
|
|
3243
3141
|
Examples:
|
|
3244
3142
|
|
|
3245
3143
|
List account balances where there at least 1 confirmation
|
|
3246
|
-
> neurai-cli listaccounts
|
|
3144
|
+
> neurai-cli listaccounts
|
|
3247
3145
|
|
|
3248
3146
|
List account balances including zero confirmation transactions
|
|
3249
3147
|
> neurai-cli listaccounts 0
|
|
@@ -3319,7 +3217,7 @@ var methods = {
|
|
|
3319
3217
|
]
|
|
3320
3218
|
|
|
3321
3219
|
Examples:
|
|
3322
|
-
> neurai-cli listaddressgroupings
|
|
3220
|
+
> neurai-cli listaddressgroupings
|
|
3323
3221
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listaddressgroupings", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3324
3222
|
**/
|
|
3325
3223
|
listaddressgroupings: "listaddressgroupings",
|
|
@@ -3414,7 +3312,7 @@ var methods = {
|
|
|
3414
3312
|
List all banned IPs/Subnets.
|
|
3415
3313
|
|
|
3416
3314
|
Examples:
|
|
3417
|
-
> neurai-cli listbanned
|
|
3315
|
+
> neurai-cli listbanned
|
|
3418
3316
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listbanned", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3419
3317
|
**/
|
|
3420
3318
|
listbanned: "listbanned",
|
|
@@ -3486,7 +3384,7 @@ var methods = {
|
|
|
3486
3384
|
]
|
|
3487
3385
|
|
|
3488
3386
|
Examples:
|
|
3489
|
-
> neurai-cli listglobalrestrictions
|
|
3387
|
+
> neurai-cli listglobalrestrictions
|
|
3490
3388
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listglobalrestrictions", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3491
3389
|
**/
|
|
3492
3390
|
listglobalrestrictions: "listglobalrestrictions",
|
|
@@ -3507,13 +3405,13 @@ var methods = {
|
|
|
3507
3405
|
Examples:
|
|
3508
3406
|
|
|
3509
3407
|
List the unspent transactions
|
|
3510
|
-
> neurai-cli listunspent
|
|
3408
|
+
> neurai-cli listunspent
|
|
3511
3409
|
|
|
3512
3410
|
Lock an unspent transaction
|
|
3513
3411
|
> neurai-cli lockunspent false "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
3514
3412
|
|
|
3515
3413
|
List the locked transactions
|
|
3516
|
-
> neurai-cli listlockunspent
|
|
3414
|
+
> neurai-cli listlockunspent
|
|
3517
3415
|
|
|
3518
3416
|
Unlock the transaction again
|
|
3519
3417
|
> neurai-cli lockunspent true "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
@@ -3522,7 +3420,7 @@ var methods = {
|
|
|
3522
3420
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listlockunspent", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3523
3421
|
**/
|
|
3524
3422
|
listlockunspent: "listlockunspent",
|
|
3525
|
-
/** listmyassets "( asset )" ( verbose ) ( count ) ( start ) (confs)
|
|
3423
|
+
/** listmyassets "( asset )" ( verbose ) ( count ) ( start ) (confs)
|
|
3526
3424
|
|
|
3527
3425
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
3528
3426
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -3578,7 +3476,7 @@ var methods = {
|
|
|
3578
3476
|
]
|
|
3579
3477
|
|
|
3580
3478
|
Examples:
|
|
3581
|
-
> neurai-cli listpqaddresses
|
|
3479
|
+
> neurai-cli listpqaddresses
|
|
3582
3480
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listpqaddresses", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3583
3481
|
**/
|
|
3584
3482
|
listpqaddresses: "listpqaddresses",
|
|
@@ -3604,7 +3502,7 @@ var methods = {
|
|
|
3604
3502
|
]
|
|
3605
3503
|
|
|
3606
3504
|
Examples:
|
|
3607
|
-
> neurai-cli listreceivedbyaccount
|
|
3505
|
+
> neurai-cli listreceivedbyaccount
|
|
3608
3506
|
> neurai-cli listreceivedbyaccount 6 true
|
|
3609
3507
|
> 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/
|
|
3610
3508
|
**/
|
|
@@ -3628,7 +3526,7 @@ var methods = {
|
|
|
3628
3526
|
"confirmations" : n, (numeric) The number of confirmations of the most recent transaction included
|
|
3629
3527
|
"label" : "label", (string) A comment for the address/transaction, if any
|
|
3630
3528
|
"txids": [
|
|
3631
|
-
n, (numeric) The ids of transactions received with the address
|
|
3529
|
+
n, (numeric) The ids of transactions received with the address
|
|
3632
3530
|
...
|
|
3633
3531
|
]
|
|
3634
3532
|
}
|
|
@@ -3636,7 +3534,7 @@ var methods = {
|
|
|
3636
3534
|
]
|
|
3637
3535
|
|
|
3638
3536
|
Examples:
|
|
3639
|
-
> neurai-cli listreceivedbyaddress
|
|
3537
|
+
> neurai-cli listreceivedbyaddress
|
|
3640
3538
|
> neurai-cli listreceivedbyaddress 6 true
|
|
3641
3539
|
> 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/
|
|
3642
3540
|
**/
|
|
@@ -3660,7 +3558,7 @@ var methods = {
|
|
|
3660
3558
|
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction. Will be "" for the default account.
|
|
3661
3559
|
"address":"address", (string) The neurai address of the transaction. Not present for move transactions (category = move).
|
|
3662
3560
|
"category":"send|receive", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.
|
|
3663
|
-
"amount": x.xxx, (numeric) The amount in XNA. This is negative for the 'send' category, and for the 'move' category for moves
|
|
3561
|
+
"amount": x.xxx, (numeric) The amount in XNA. This is negative for the 'send' category, and for the 'move' category for moves
|
|
3664
3562
|
outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.
|
|
3665
3563
|
"vout" : n, (numeric) the vout value
|
|
3666
3564
|
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the 'send' category of transactions.
|
|
@@ -3687,7 +3585,7 @@ var methods = {
|
|
|
3687
3585
|
}
|
|
3688
3586
|
|
|
3689
3587
|
Examples:
|
|
3690
|
-
> neurai-cli listsinceblock
|
|
3588
|
+
> neurai-cli listsinceblock
|
|
3691
3589
|
> neurai-cli listsinceblock "000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad" 6
|
|
3692
3590
|
> 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/
|
|
3693
3591
|
**/
|
|
@@ -3709,7 +3607,7 @@ var methods = {
|
|
|
3709
3607
|
]
|
|
3710
3608
|
|
|
3711
3609
|
Examples:
|
|
3712
|
-
> neurai-cli listsnapshotrequests
|
|
3610
|
+
> neurai-cli listsnapshotrequests
|
|
3713
3611
|
> 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/
|
|
3714
3612
|
**/
|
|
3715
3613
|
listsnapshotrequests: "listsnapshotrequests",
|
|
@@ -3746,22 +3644,22 @@ var methods = {
|
|
|
3746
3644
|
Result:
|
|
3747
3645
|
[
|
|
3748
3646
|
{
|
|
3749
|
-
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction.
|
|
3647
|
+
"account":"accountname", (string) DEPRECATED. The account name associated with the transaction.
|
|
3750
3648
|
It will be "" for the default account.
|
|
3751
|
-
"address":"address", (string) The neurai address of the transaction. Not present for
|
|
3649
|
+
"address":"address", (string) The neurai address of the transaction. Not present for
|
|
3752
3650
|
move transactions (category = move).
|
|
3753
3651
|
"category":"send|receive|move", (string) The transaction category. 'move' is a local (off blockchain)
|
|
3754
3652
|
transaction between accounts, and not associated with an address,
|
|
3755
|
-
transaction id or block. 'send' and 'receive' transactions are
|
|
3653
|
+
transaction id or block. 'send' and 'receive' transactions are
|
|
3756
3654
|
associated with an address, transaction id and block details
|
|
3757
3655
|
"amount": x.xxx, (numeric) The amount in XNA. This is negative for the 'send' category, and for the
|
|
3758
3656
|
'move' category for moves outbound. It is positive for the 'receive' category,
|
|
3759
3657
|
and for the 'move' category for inbound funds.
|
|
3760
3658
|
"label": "label", (string) A comment for the address/transaction, if any
|
|
3761
3659
|
"vout": n, (numeric) the vout value
|
|
3762
|
-
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
3660
|
+
"fee": x.xxx, (numeric) The amount of the fee in XNA. This is negative and only available for the
|
|
3763
3661
|
'send' category of transactions.
|
|
3764
|
-
"confirmations": n, (numeric) The number of confirmations for the transaction. Available for 'send' and
|
|
3662
|
+
"confirmations": n, (numeric) The number of confirmations for the transaction. Available for 'send' and
|
|
3765
3663
|
'receive' category of transactions. Negative confirmations indicate the
|
|
3766
3664
|
transaction conflicts with the block chain
|
|
3767
3665
|
"trusted": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.
|
|
@@ -3772,15 +3670,15 @@ var methods = {
|
|
|
3772
3670
|
"blocktime": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).
|
|
3773
3671
|
"txid": "transactionid", (string) The transaction id. Available for 'send' and 'receive' category of transactions.
|
|
3774
3672
|
"time": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).
|
|
3775
|
-
"timereceived": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available
|
|
3673
|
+
"timereceived": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available
|
|
3776
3674
|
for 'send' and 'receive' category of transactions.
|
|
3777
3675
|
"comment": "...", (string) If a comment is associated with the transaction.
|
|
3778
|
-
"otheraccount": "accountname", (string) DEPRECATED. For the 'move' category of transactions, the account the funds came
|
|
3676
|
+
"otheraccount": "accountname", (string) DEPRECATED. For the 'move' category of transactions, the account the funds came
|
|
3779
3677
|
from (for receiving funds, positive amounts), or went to (for sending funds,
|
|
3780
3678
|
negative amounts).
|
|
3781
3679
|
"bip125-replaceable": "yes|no|unknown", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);
|
|
3782
3680
|
may be unknown for unconfirmed transactions not in the mempool
|
|
3783
|
-
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
|
|
3681
|
+
"abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the
|
|
3784
3682
|
'send' category of transactions.
|
|
3785
3683
|
}
|
|
3786
3684
|
]
|
|
@@ -3788,7 +3686,7 @@ var methods = {
|
|
|
3788
3686
|
Examples:
|
|
3789
3687
|
|
|
3790
3688
|
List the most recent 10 transactions in the systems
|
|
3791
|
-
> neurai-cli listtransactions
|
|
3689
|
+
> neurai-cli listtransactions
|
|
3792
3690
|
|
|
3793
3691
|
List transactions 100 to 120
|
|
3794
3692
|
> neurai-cli listtransactions "*" 20 100
|
|
@@ -3824,7 +3722,7 @@ var methods = {
|
|
|
3824
3722
|
Result
|
|
3825
3723
|
[ (array of json object)
|
|
3826
3724
|
{
|
|
3827
|
-
"txid" : "txid", (string) the transaction id
|
|
3725
|
+
"txid" : "txid", (string) the transaction id
|
|
3828
3726
|
"vout" : n, (numeric) the vout value
|
|
3829
3727
|
"address" : "address", (string) the neurai address
|
|
3830
3728
|
"account" : "account", (string) DEPRECATED. The associated account, or "" for the default account
|
|
@@ -3842,7 +3740,7 @@ var methods = {
|
|
|
3842
3740
|
]
|
|
3843
3741
|
|
|
3844
3742
|
Examples
|
|
3845
|
-
> neurai-cli listunspent
|
|
3743
|
+
> neurai-cli listunspent
|
|
3846
3744
|
> neurai-cli listunspent 6 9999999 "[\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\",\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\"]"
|
|
3847
3745
|
> 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/
|
|
3848
3746
|
> neurai-cli listunspent 6 9999999 '[]' true '{ "minimumAmount": 0.005 }'
|
|
@@ -3860,7 +3758,7 @@ var methods = {
|
|
|
3860
3758
|
]
|
|
3861
3759
|
|
|
3862
3760
|
Examples:
|
|
3863
|
-
> neurai-cli listwallets
|
|
3761
|
+
> neurai-cli listwallets
|
|
3864
3762
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listwallets", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3865
3763
|
**/
|
|
3866
3764
|
listwallets: "listwallets",
|
|
@@ -3891,13 +3789,13 @@ var methods = {
|
|
|
3891
3789
|
Examples:
|
|
3892
3790
|
|
|
3893
3791
|
List the unspent transactions
|
|
3894
|
-
> neurai-cli listunspent
|
|
3792
|
+
> neurai-cli listunspent
|
|
3895
3793
|
|
|
3896
3794
|
Lock an unspent transaction
|
|
3897
3795
|
> neurai-cli lockunspent false "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
3898
3796
|
|
|
3899
3797
|
List the locked transactions
|
|
3900
|
-
> neurai-cli listlockunspent
|
|
3798
|
+
> neurai-cli listlockunspent
|
|
3901
3799
|
|
|
3902
3800
|
Unlock the transaction again
|
|
3903
3801
|
> neurai-cli lockunspent true "[{\"txid\":\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\",\"vout\":1}]"
|
|
@@ -3939,7 +3837,7 @@ var methods = {
|
|
|
3939
3837
|
Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.
|
|
3940
3838
|
|
|
3941
3839
|
Examples:
|
|
3942
|
-
> neurai-cli ping
|
|
3840
|
+
> neurai-cli ping
|
|
3943
3841
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "ping", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
3944
3842
|
**/
|
|
3945
3843
|
ping: "ping",
|
|
@@ -4032,7 +3930,7 @@ var methods = {
|
|
|
4032
3930
|
> 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/
|
|
4033
3931
|
**/
|
|
4034
3932
|
purgesnapshot: "purgesnapshot",
|
|
4035
|
-
/** reissue "asset_name" qty "to_address" "change_address" ( reissuable ) ( new_units) "( new_ipfs )"
|
|
3933
|
+
/** reissue "asset_name" qty "to_address" "change_address" ( reissuable ) ( new_units) "( new_ipfs )"
|
|
4036
3934
|
|
|
4037
3935
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4038
3936
|
https://github.com/NeuraiProject/rips/blob/master/rip-0002.mediawiki
|
|
@@ -4081,7 +3979,7 @@ var methods = {
|
|
|
4081
3979
|
|
|
4082
3980
|
Examples:
|
|
4083
3981
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
4084
|
-
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
3982
|
+
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML"
|
|
4085
3983
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML" "changeaddress"
|
|
4086
3984
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" true "KYC & !AML" "changeaddress" -1 true
|
|
4087
3985
|
> neurai-cli reissuerestrictedasset "$ASSET_NAME" 1000 "myaddress" false "" "changeaddress" -1 false QmTqu3Lk3gmTsQVtjU7rYYM37EAW4xNmbuEAp2Mjr4AV7E
|
|
@@ -4166,7 +4064,7 @@ var methods = {
|
|
|
4166
4064
|
Dumps the mempool to disk.
|
|
4167
4065
|
|
|
4168
4066
|
Examples:
|
|
4169
|
-
> neurai-cli savemempool
|
|
4067
|
+
> neurai-cli savemempool
|
|
4170
4068
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "savemempool", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4171
4069
|
**/
|
|
4172
4070
|
savemempool: "savemempool",
|
|
@@ -4216,10 +4114,10 @@ var methods = {
|
|
|
4216
4114
|
2. "toaddress" (string, required) The neurai address to send funds to.
|
|
4217
4115
|
3. amount (numeric or string, required) The amount in XNA (transaction fee is added on top).
|
|
4218
4116
|
4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.
|
|
4219
|
-
5. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4117
|
+
5. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4220
4118
|
This is not part of the transaction, just kept in your wallet.
|
|
4221
|
-
6. "comment_to" (string, optional) An optional comment to store the name of the person or organization
|
|
4222
|
-
to which you're sending the transaction. This is not part of the transaction,
|
|
4119
|
+
6. "comment_to" (string, optional) An optional comment to store the name of the person or organization
|
|
4120
|
+
to which you're sending the transaction. This is not part of the transaction,
|
|
4223
4121
|
it is just kept in your wallet.
|
|
4224
4122
|
|
|
4225
4123
|
Result:
|
|
@@ -4245,10 +4143,10 @@ var methods = {
|
|
|
4245
4143
|
1. "from_address" (string, required) The neurai address to send from.
|
|
4246
4144
|
2. "to_address" (string, required) The neurai address to send to.
|
|
4247
4145
|
3. "amount" (numeric or string, required) The amount in XNA to send. eg 0.1
|
|
4248
|
-
4. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4146
|
+
4. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4249
4147
|
This is not part of the transaction, just kept in your wallet.
|
|
4250
|
-
5. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4251
|
-
to which you're sending the transaction. This is not part of the
|
|
4148
|
+
5. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4149
|
+
to which you're sending the transaction. This is not part of the
|
|
4252
4150
|
transaction, just kept in your wallet.
|
|
4253
4151
|
6. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.
|
|
4254
4152
|
The recipient will receive less neurais than you enter in the amount field.
|
|
@@ -4296,7 +4194,7 @@ var methods = {
|
|
|
4296
4194
|
"CONSERVATIVE"
|
|
4297
4195
|
|
|
4298
4196
|
Result:
|
|
4299
|
-
"txid" (string) The transaction id for the send. Only 1 transaction is created regardless of
|
|
4197
|
+
"txid" (string) The transaction id for the send. Only 1 transaction is created regardless of
|
|
4300
4198
|
the number of addresses.
|
|
4301
4199
|
|
|
4302
4200
|
Examples:
|
|
@@ -4368,10 +4266,10 @@ var methods = {
|
|
|
4368
4266
|
Arguments:
|
|
4369
4267
|
1. "address" (string, required) The neurai address to send to.
|
|
4370
4268
|
2. "amount" (numeric or string, required) The amount in XNA to send. eg 0.1
|
|
4371
|
-
3. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4269
|
+
3. "comment" (string, optional) A comment used to store what the transaction is for.
|
|
4372
4270
|
This is not part of the transaction, just kept in your wallet.
|
|
4373
|
-
4. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4374
|
-
to which you're sending the transaction. This is not part of the
|
|
4271
|
+
4. "comment_to" (string, optional) A comment to store the name of the person or organization
|
|
4272
|
+
to which you're sending the transaction. This is not part of the
|
|
4375
4273
|
transaction, just kept in your wallet.
|
|
4376
4274
|
5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.
|
|
4377
4275
|
The recipient will receive less neurais than you enter in the amount field.
|
|
@@ -4436,7 +4334,7 @@ var methods = {
|
|
|
4436
4334
|
> neurai-cli setgenerate true 1
|
|
4437
4335
|
|
|
4438
4336
|
Check the setting
|
|
4439
|
-
> neurai-cli getgenerate
|
|
4337
|
+
> neurai-cli getgenerate
|
|
4440
4338
|
|
|
4441
4339
|
Turn off generation
|
|
4442
4340
|
> neurai-cli setgenerate false
|
|
@@ -4594,7 +4492,7 @@ var methods = {
|
|
|
4594
4492
|
> 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/
|
|
4595
4493
|
**/
|
|
4596
4494
|
submitblock: "submitblock",
|
|
4597
|
-
/** subscribetochannel
|
|
4495
|
+
/** subscribetochannel
|
|
4598
4496
|
|
|
4599
4497
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4600
4498
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4666,7 +4564,7 @@ var methods = {
|
|
|
4666
4564
|
7. "asset_change_address" (string, optional, default = "") the transactions Asset change will be sent to this address
|
|
4667
4565
|
|
|
4668
4566
|
Result:
|
|
4669
|
-
txid[
|
|
4567
|
+
txid[
|
|
4670
4568
|
txid
|
|
4671
4569
|
]
|
|
4672
4570
|
|
|
@@ -4692,7 +4590,7 @@ var methods = {
|
|
|
4692
4590
|
8. "asset_change_address" (string, optional, default = "") the transaction Asset change will be sent to this address
|
|
4693
4591
|
|
|
4694
4592
|
Result:
|
|
4695
|
-
txid[
|
|
4593
|
+
txid[
|
|
4696
4594
|
txid
|
|
4697
4595
|
]
|
|
4698
4596
|
|
|
@@ -4718,7 +4616,7 @@ var methods = {
|
|
|
4718
4616
|
8. "asset_change_address" (string, optional, default = "") the transactions Asset change will be sent to this address
|
|
4719
4617
|
|
|
4720
4618
|
Result:
|
|
4721
|
-
txid[
|
|
4619
|
+
txid[
|
|
4722
4620
|
txid
|
|
4723
4621
|
]
|
|
4724
4622
|
|
|
@@ -4727,7 +4625,7 @@ var methods = {
|
|
|
4727
4625
|
> 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/
|
|
4728
4626
|
**/
|
|
4729
4627
|
transferfromaddresses: "transferfromaddresses",
|
|
4730
|
-
/** transferqualifier "qualifier_name" qty "to_address" ("change_address") ("message") (expire_time)
|
|
4628
|
+
/** transferqualifier "qualifier_name" qty "to_address" ("change_address") ("message") (expire_time)
|
|
4731
4629
|
|
|
4732
4630
|
THIS COMMAND IS NOT YET ACTIVE! Restricted assets must be active
|
|
4733
4631
|
|
|
@@ -4742,7 +4640,7 @@ var methods = {
|
|
|
4742
4640
|
6. "expire_time" (numeric, optional) UTC timestamp of when the message expires
|
|
4743
4641
|
|
|
4744
4642
|
Result:
|
|
4745
|
-
txid[
|
|
4643
|
+
txid[
|
|
4746
4644
|
txid
|
|
4747
4645
|
]
|
|
4748
4646
|
|
|
@@ -4820,7 +4718,7 @@ var methods = {
|
|
|
4820
4718
|
> 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/
|
|
4821
4719
|
**/
|
|
4822
4720
|
unfreezerestrictedasset: "unfreezerestrictedasset",
|
|
4823
|
-
/** unsubscribefromchannel
|
|
4721
|
+
/** unsubscribefromchannel
|
|
4824
4722
|
|
|
4825
4723
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4826
4724
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4847,7 +4745,7 @@ var methods = {
|
|
|
4847
4745
|
ttt (numeric) The number of seconds that the server has been running
|
|
4848
4746
|
|
|
4849
4747
|
Examples:
|
|
4850
|
-
> neurai-cli uptime
|
|
4748
|
+
> neurai-cli uptime
|
|
4851
4749
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "uptime", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4852
4750
|
**/
|
|
4853
4751
|
uptime: "uptime",
|
|
@@ -4903,7 +4801,7 @@ var methods = {
|
|
|
4903
4801
|
true|false (boolean) Verified or not
|
|
4904
4802
|
|
|
4905
4803
|
Examples:
|
|
4906
|
-
> neurai-cli verifychain
|
|
4804
|
+
> neurai-cli verifychain
|
|
4907
4805
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "verifychain", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4908
4806
|
**/
|
|
4909
4807
|
verifychain: "verifychain",
|
|
@@ -4946,7 +4844,7 @@ var methods = {
|
|
|
4946
4844
|
["txid"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof is invalid
|
|
4947
4845
|
**/
|
|
4948
4846
|
verifytxoutproof: "verifytxoutproof",
|
|
4949
|
-
/** viewallmessagechannels
|
|
4847
|
+
/** viewallmessagechannels
|
|
4950
4848
|
|
|
4951
4849
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4952
4850
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4959,11 +4857,11 @@ var methods = {
|
|
|
4959
4857
|
]
|
|
4960
4858
|
|
|
4961
4859
|
Examples:
|
|
4962
|
-
> neurai-cli viewallmessagechannels
|
|
4860
|
+
> neurai-cli viewallmessagechannels
|
|
4963
4861
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "viewallmessagechannels", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4964
4862
|
**/
|
|
4965
4863
|
viewallmessagechannels: "viewallmessagechannels",
|
|
4966
|
-
/** viewallmessages
|
|
4864
|
+
/** viewallmessages
|
|
4967
4865
|
|
|
4968
4866
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4969
4867
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -4980,11 +4878,11 @@ var methods = {
|
|
|
4980
4878
|
"Expire UTC Time:" (Date, optional) If the message contains an expire date that is too large, the UTC number will be displayed
|
|
4981
4879
|
|
|
4982
4880
|
Examples:
|
|
4983
|
-
> neurai-cli viewallmessages
|
|
4881
|
+
> neurai-cli viewallmessages
|
|
4984
4882
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "viewallmessages", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
4985
4883
|
**/
|
|
4986
4884
|
viewallmessages: "viewallmessages",
|
|
4987
|
-
/** viewmyrestrictedaddresses
|
|
4885
|
+
/** viewmyrestrictedaddresses
|
|
4988
4886
|
|
|
4989
4887
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
4990
4888
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -5000,11 +4898,11 @@ var methods = {
|
|
|
5000
4898
|
}...
|
|
5001
4899
|
|
|
5002
4900
|
Examples:
|
|
5003
|
-
> neurai-cli viewmyrestrictedaddresses
|
|
4901
|
+
> neurai-cli viewmyrestrictedaddresses
|
|
5004
4902
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "viewmyrestrictedaddresses", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
5005
4903
|
**/
|
|
5006
4904
|
viewmyrestrictedaddresses: "viewmyrestrictedaddresses",
|
|
5007
|
-
/** viewmytaggedaddresses
|
|
4905
|
+
/** viewmytaggedaddresses
|
|
5008
4906
|
|
|
5009
4907
|
THIS COMMAND IS NOT YET ACTIVE!
|
|
5010
4908
|
https://github.com/NeuraiProject/rips/blob/master/rip-0005.mediawiki
|
|
@@ -5020,12 +4918,110 @@ var methods = {
|
|
|
5020
4918
|
}...
|
|
5021
4919
|
|
|
5022
4920
|
Examples:
|
|
5023
|
-
> neurai-cli viewmytaggedaddresses
|
|
4921
|
+
> neurai-cli viewmytaggedaddresses
|
|
5024
4922
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "viewmytaggedaddresses", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:19001/
|
|
5025
4923
|
**/
|
|
5026
4924
|
viewmytaggedaddresses: "viewmytaggedaddresses"
|
|
5027
4925
|
};
|
|
5028
4926
|
|
|
4927
|
+
// depin.ts
|
|
4928
|
+
var DEPIN_RPC_PROTOCOL = 5;
|
|
4929
|
+
var DEPIN_REMOTE_METHODS = Object.freeze([
|
|
4930
|
+
"depingetmsginfo",
|
|
4931
|
+
"depinpoolstats",
|
|
4932
|
+
"depinmcpstatus",
|
|
4933
|
+
"depinchallenge",
|
|
4934
|
+
"depinreceivemsg",
|
|
4935
|
+
"depinreceiveseq",
|
|
4936
|
+
"depinlistsections",
|
|
4937
|
+
"depinclearmsg",
|
|
4938
|
+
"depinsubmitmsg",
|
|
4939
|
+
"depingetancestorrecipients"
|
|
4940
|
+
]);
|
|
4941
|
+
function isDepinRemoteMethod(method) {
|
|
4942
|
+
return DEPIN_REMOTE_METHODS.includes(method);
|
|
4943
|
+
}
|
|
4944
|
+
function getDepinRequest(params) {
|
|
4945
|
+
const request = Array.isArray(params) && params.length === 1 ? params[0] : params && typeof params === "object" && Object.keys(params).length === 1 ? params.request : null;
|
|
4946
|
+
const protocol = request?.protocol;
|
|
4947
|
+
if (!request || typeof request !== "object" || Array.isArray(request) || !(protocol === 5 || protocol?.isLosslessNumber === true && protocol.value === "5" && typeof protocol.toString === "function" && protocol.toString() === "5")) {
|
|
4948
|
+
throw Object.assign(new Error("DePIN protocol 5 requires one request object"), {
|
|
4949
|
+
code: -8,
|
|
4950
|
+
data: { depin_error: "unsupported_protocol", expected_protocol: 5 }
|
|
4951
|
+
});
|
|
4952
|
+
}
|
|
4953
|
+
return request;
|
|
4954
|
+
}
|
|
4955
|
+
function createDepinNodeRouter(healthyNodes, randomId) {
|
|
4956
|
+
const identities = /* @__PURE__ */ new WeakMap();
|
|
4957
|
+
const pending = /* @__PURE__ */ new WeakMap();
|
|
4958
|
+
const discoveredAt = /* @__PURE__ */ new WeakMap();
|
|
4959
|
+
async function discover(node) {
|
|
4960
|
+
let promise = pending.get(node);
|
|
4961
|
+
if (!promise && Date.now() - (discoveredAt.get(node) ?? 0) < 1e3) return;
|
|
4962
|
+
if (!promise) {
|
|
4963
|
+
discoveredAt.set(node, Date.now());
|
|
4964
|
+
promise = (async () => {
|
|
4965
|
+
const reply = await node.rpc("depingetmsginfo", [{ protocol: 5, request_id: randomId(), timestamp_ms: Date.now() }]);
|
|
4966
|
+
if (reply?.protocol !== 5 || typeof reply.network !== "string" || typeof reply.pool_pubkey !== "string" || typeof reply.pool_root !== "string" || typeof reply.instance_id !== "string")
|
|
4967
|
+
throw new Error("Node has no RPC 5 pool identity");
|
|
4968
|
+
identities.set(node, reply);
|
|
4969
|
+
})().finally(() => pending.delete(node));
|
|
4970
|
+
pending.set(node, promise);
|
|
4971
|
+
}
|
|
4972
|
+
await promise;
|
|
4973
|
+
}
|
|
4974
|
+
return async function route(method, params) {
|
|
4975
|
+
const request = getDepinRequest(params);
|
|
4976
|
+
const nodes = healthyNodes();
|
|
4977
|
+
if (!nodes.length) throw new Error("No healthy RPC node");
|
|
4978
|
+
if (method === "depingetmsginfo") return nodes[0];
|
|
4979
|
+
const target = request;
|
|
4980
|
+
const matches = (node) => {
|
|
4981
|
+
const identity = identities.get(node);
|
|
4982
|
+
return identity && ["network", "pool_pubkey", "pool_root", "instance_id"].every((key) => identity[key] === target[key]);
|
|
4983
|
+
};
|
|
4984
|
+
let found = nodes.find(matches);
|
|
4985
|
+
if (found) return found;
|
|
4986
|
+
await Promise.all(nodes.map((node) => discover(node).catch(() => identities.delete(node))));
|
|
4987
|
+
found = nodes.find(matches);
|
|
4988
|
+
if (!found)
|
|
4989
|
+
throw Object.assign(new Error("DePIN service_mismatch: target pool or instance is unavailable; refresh bootstrap"), {
|
|
4990
|
+
code: -32600,
|
|
4991
|
+
data: { depin_error: "service_mismatch", expected_protocol: 5 }
|
|
4992
|
+
});
|
|
4993
|
+
return found;
|
|
4994
|
+
};
|
|
4995
|
+
}
|
|
4996
|
+
|
|
4997
|
+
// json.ts
|
|
4998
|
+
function assertNoDuplicateJsonKeys(text) {
|
|
4999
|
+
const stack = [];
|
|
5000
|
+
for (let i = 0; i < text.length; i++) {
|
|
5001
|
+
const ch = text[i];
|
|
5002
|
+
if (ch === '"') {
|
|
5003
|
+
const start = i++;
|
|
5004
|
+
while (i < text.length && text[i] !== '"') {
|
|
5005
|
+
if (text[i] === "\\") i++;
|
|
5006
|
+
i++;
|
|
5007
|
+
}
|
|
5008
|
+
if (i >= text.length) throw new SyntaxError("Unterminated JSON string");
|
|
5009
|
+
const top = stack[stack.length - 1];
|
|
5010
|
+
if (top?.keys && top.expectKey) {
|
|
5011
|
+
const key = JSON.parse(text.slice(start, i + 1));
|
|
5012
|
+
if (top.keys.has(key)) throw new SyntaxError("Duplicate JSON key");
|
|
5013
|
+
top.keys.add(key);
|
|
5014
|
+
top.expectKey = false;
|
|
5015
|
+
}
|
|
5016
|
+
} else if (ch === "{" || ch === "[") {
|
|
5017
|
+
if (stack.length >= 128) throw new SyntaxError("JSON nesting limit exceeded");
|
|
5018
|
+
stack.push(ch === "{" ? { keys: /* @__PURE__ */ new Set(), expectKey: true, close: "}" } : { close: "]" });
|
|
5019
|
+
} else if (ch === "}" || ch === "]") {
|
|
5020
|
+
if (stack.pop()?.close !== ch) throw new SyntaxError("Invalid JSON nesting");
|
|
5021
|
+
} else if (ch === "," && stack[stack.length - 1]?.keys) stack[stack.length - 1].expectKey = true;
|
|
5022
|
+
}
|
|
5023
|
+
}
|
|
5024
|
+
|
|
5029
5025
|
// index.ts
|
|
5030
5026
|
var MAINNET_GENESIS_HASH = "00000044d33c0c0ba019be5c0249730424a69cb4c222153322f68c6104484806";
|
|
5031
5027
|
var TESTNET_GENESIS_HASH = "0000008b384aeffecdab182575dc4e86c9f07f90318c65088532660ed9a8a021";
|
|
@@ -5079,7 +5075,9 @@ function getRPC(username, password, URL) {
|
|
|
5079
5075
|
const rpcResponse = postData(URL, data, username, password);
|
|
5080
5076
|
rpcResponse.then(async (response) => {
|
|
5081
5077
|
if (response.ok) {
|
|
5082
|
-
const
|
|
5078
|
+
const responseText = await response.text();
|
|
5079
|
+
if (isDepinRemoteMethod(method)) assertNoDuplicateJsonKeys(responseText);
|
|
5080
|
+
const obj = parseRpcJson(responseText);
|
|
5083
5081
|
if (obj && obj.error) {
|
|
5084
5082
|
rejectionFunc({
|
|
5085
5083
|
error: obj.error,
|
|
@@ -5094,7 +5092,9 @@ function getRPC(username, password, URL) {
|
|
|
5094
5092
|
description: null
|
|
5095
5093
|
};
|
|
5096
5094
|
try {
|
|
5097
|
-
|
|
5095
|
+
const responseText = await response.text();
|
|
5096
|
+
if (isDepinRemoteMethod(method)) assertNoDuplicateJsonKeys(responseText);
|
|
5097
|
+
obj = parseRpcJson(responseText);
|
|
5098
5098
|
} catch (e) {
|
|
5099
5099
|
}
|
|
5100
5100
|
const myError = {
|
|
@@ -5125,9 +5125,7 @@ async function postData(url = "", data = {}, username, password) {
|
|
|
5125
5125
|
if (typeof btoa === "function") {
|
|
5126
5126
|
base64Credentials = btoa(`${username}:${password}`);
|
|
5127
5127
|
} else if (Buffer) {
|
|
5128
|
-
base64Credentials = Buffer.from(`${username}:${password}`).toString(
|
|
5129
|
-
"base64"
|
|
5130
|
-
);
|
|
5128
|
+
base64Credentials = Buffer.from(`${username}:${password}`).toString("base64");
|
|
5131
5129
|
}
|
|
5132
5130
|
const response = await fetch(url, {
|
|
5133
5131
|
method: "POST",
|
|
@@ -5149,10 +5147,16 @@ async function postData(url = "", data = {}, username, password) {
|
|
|
5149
5147
|
return response;
|
|
5150
5148
|
}
|
|
5151
5149
|
export {
|
|
5150
|
+
DEPIN_REMOTE_METHODS,
|
|
5151
|
+
DEPIN_RPC_PROTOCOL,
|
|
5152
5152
|
MAINNET_GENESIS_HASH,
|
|
5153
5153
|
TESTNET_GENESIS_HASH,
|
|
5154
|
+
assertNoDuplicateJsonKeys,
|
|
5154
5155
|
assertRpcGenesis,
|
|
5156
|
+
createDepinNodeRouter,
|
|
5157
|
+
getDepinRequest,
|
|
5155
5158
|
getRPC,
|
|
5159
|
+
isDepinRemoteMethod,
|
|
5156
5160
|
methods,
|
|
5157
5161
|
parseRpcJson,
|
|
5158
5162
|
rpcNumber,
|