@neuraiproject/neurai-rpc 0.4.5 → 0.4.6
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 +128 -0
- package/DEPIN_IMPLEMENTATION_GUIDE_EN.md +927 -0
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/docs.json +5 -5
- package/docs.ts +1118 -1118
- package/neurai_methods.md +7 -7
- package/package.json +1 -1
package/docs.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"transferfromaddress": "transferfromaddress \"asset_name\" \"from_address\" qty \"to_address\" \"message\" expire_time \"xna_change_address\" \"asset_change_address\"\n\nTransfer a quantity of an owned asset in a specific address to a given address\nArguments:\n1. \"asset_name\" (string, required) name of asset\n2. \"from_address\" (string, required) address that the asset will be transferred from\n3. \"qty\" (numeric, required) number of assets you want to send to the address\n4. \"to_address\" (string, required) address to send the asset to\n5. \"message\" (string, optional) Once RIP5 is voted in ipfs hash or txid hash to send along with the transfer\n6. \"expire_time\" (numeric, optional) UTC timestamp of when the message expires\n7. \"xna_change_address\" (string, optional, default = \"\") the transaction XNA change will be sent to this address\n8. \"asset_change_address\" (string, optional, default = \"\") the transaction Asset change will be sent to this address\n\nResult:\ntxid[ \ntxid\n]\n\nExamples:\n> neurai-cli transferfromaddress \"ASSET_NAME\" \"fromaddress\" 20 \"address\" \"QmTqu3Lk3gmTsQVtjU7rYYM37EAW4xNmbuEAp2Mjr4AV7E\", 156545652\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"transferfromaddress\", \"params\": [\"ASSET_NAME\" \"fromaddress\" 20 \"address\" \"QmTqu3Lk3gmTsQVtjU7rYYM37EAW4xNmbuEAp2Mjr4AV7E\", 156545652] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
21
21
|
"transferfromaddresses": "transferfromaddresses \"asset_name\" [\"from_addresses\"] qty \"to_address\" \"message\" expire_time \"xna_change_address\" \"asset_change_address\"\n\nTransfer a quantity of an owned asset in specific address(es) to a given address\nArguments:\n1. \"asset_name\" (string, required) name of asset\n2. \"from_addresses\" (array, required) list of from addresses to send from\n3. \"qty\" (numeric, required) number of assets you want to send to the address\n4. \"to_address\" (string, required) address to send the asset to\n5. \"message\" (string, optional) Once RIP5 is voted in ipfs hash or txid hash to send along with the transfer\n6. \"expire_time\" (numeric, optional) UTC timestamp of when the message expires\n7. \"xna_change_address\" (string, optional, default = \"\") the transactions XNA change will be sent to this address\n8. \"asset_change_address\" (string, optional, default = \"\") the transactions Asset change will be sent to this address\n\nResult:\ntxid[ \ntxid\n]\n\nExamples:\n> neurai-cli transferfromaddresses \"ASSET_NAME\" '[\"fromaddress1\", \"fromaddress2\"]' 20 \"to_address\" \"QmTqu3Lk3gmTsQVtjU7rYYM37EAW4xNmbuEAp2Mjr4AV7E\" 154652365\n> 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:8766/\n",
|
|
22
22
|
"clearmempool": "clearmempool\n\nRemoves all transaction from the mempool\n\nExamples:\n> neurai-cli clearmempool \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"clearmempool\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
23
|
-
"checkdepinvalidity": "checkdepinvalidity \"asset_name\" \"address\"\n\nCheck if a DEPIN asset is valid/active for a specific address\n\nArguments:\n1. \"asset_name\" (string, required) The DEPIN asset name
|
|
23
|
+
"checkdepinvalidity": "checkdepinvalidity \"asset_name\" \"address\"\n\nCheck if a DEPIN asset is valid/active for a specific address\n\nArguments:\n1. \"asset_name\" (string, required) The DEPIN asset name\n2. \"address\" (string, required) The address to check\n\nResult:\n{\n \"has_asset\": true|false, (boolean) Whether the address holds the asset\n \"amount\": n, (numeric) The amount (if has_asset is true)\n \"valid\": 1|0, (numeric) 1 = active/valid, 0 = blocked/revoked (if has_asset is true)\n \"blocked\": true|false (boolean) Whether the asset is blocked (if has_asset is true)\n}\n\nExamples:\n> neurai-cli checkdepinvalidity \"&FRANCE\" \"address\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"checkdepinvalidity\", \"params\": [\"&FRANCE\", \"address\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
24
24
|
"depinclearmsg": "depinclearmsg ( \"all\" | hours )\n\nRemove messages from DePIN messaging pool\n\nArguments:\n1. mode (string or numeric, optional) Cleanup mode:\n - omitted: Remove only expired messages (default)\n - \"all\": Remove ALL messages from pool\n - <hours>: Remove messages older than specified hours (numeric)\n\nResult:\n{\n \"removed\": n, (numeric) Number of messages removed\n \"remaining\": n (numeric) Number of messages remaining\n}\n\nExamples:\n> neurai-cli depinclearmsg\n> neurai-cli depinclearmsg \"all\"\n> neurai-cli depinclearmsg 7\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"depinclearmsg\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
25
25
|
"depingetmsg": "depingetmsg \"token\" (\"ip[:port]\"|\"fromaddress\") (\"fromaddress\")\n\nRetrieve and decrypt DePIN messages for your addresses\n\nArguments:\n1. \"token\" (string, required) Token name\n2. \"ip[:port]\" OR \"fromaddress\" (string, optional)\n - IP address with optional port (e.g., \"192.168.1.31\" or \"192.168.1.31:19002\")\n - OR Neurai address for local query with specific address\n - Omit for local query with all addresses\n3. \"fromaddress\" (string, optional) Specific address to decrypt with (only if arg 2 is an IP)\n\nResult:\n[\n {\n \"recipient\": \"address\", (string) Recipient address (your address)\n \"sender\": \"address\", (string) Sender address\n \"message\": \"text\", (string) Decrypted message\n \"timestamp\": n, (numeric) Unix timestamp\n \"date\": \"YYYY-MM-DD HH:MM:SS\", (string) Formatted date\n \"expires\": \"YYYY-MM-DD HH:MM:SS\" (string) Expiration date\n },\n ...\n]\n\nExamples:\n> neurai-cli depingetmsg \"MYTOKEN\"\n> neurai-cli depingetmsg \"MYTOKEN\" \"NXyouraddress...\"\n> neurai-cli depingetmsg \"MYTOKEN\" \"192.168.1.78\"\n> neurai-cli depingetmsg \"MYTOKEN\" \"192.168.1.78:19002\" \"NXyouraddress...\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"depingetmsg\", \"params\": [\"MYTOKEN\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
26
26
|
"depingetmsginfo": "depingetmsginfo\n\nReturns information about the DePIN messaging system\n\nResult:\n{\n \"enabled\": true|false, (boolean) Whether DePIN messaging is enabled\n \"token\": \"name\", (string) Active token name\n \"port\": n, (numeric) Listening port\n \"maxrecipients\": n, (numeric) Maximum recipients per message\n \"maxmessagesize\": n, (numeric) Maximum message size in bytes\n \"messageexpiryhours\": n, (numeric) Message expiry time in hours\n \"maxpoolsizemb\": n, (numeric) Maximum pool size in MB\n \"messages\": n, (numeric) Number of messages in mempool\n \"memoryusage\": n, (numeric) Memory usage in bytes\n \"memoryusagemb\": n, (numeric) Memory usage in MB\n \"oldestmessage\": \"time\", (string) Timestamp of oldest message\n \"newestmessage\": \"time\" (string) Timestamp of newest message\n}\n\nExamples:\n> neurai-cli depingetmsginfo\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"depingetmsginfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"depinpoolstats": "depinpoolstats\n\nGet statistical analysis of the DePIN message pool.\n\nResult:\n{\n \"enabled\": true|false,\n \"token\": \"string\",\n \"total_messages\": n,\n \"total_size_bytes\": n,\n \"memory_usage_bytes\": n,\n \"oldest_message\": \"YYYY-MM-DD HH:MM:SS\",\n \"newest_message\": \"YYYY-MM-DD HH:MM:SS\",\n \"messages_by_age\": {\n \"last_hour\": n,\n \"last_day\": n,\n \"last_week\": n\n },\n \"unique_senders\": n,\n \"avg_message_size\": n,\n \"expiring_in_24h\": n\n}\n\nExamples:\n> neurai-cli depinpoolstats\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"depinpoolstats\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
30
30
|
"depinsendmsg": "depinsendmsg \"token\" \"ip[:port]\" \"message\" \"fromaddress\" (port)\n\nSend an encrypted message through a remote DePIN gateway (challenge/response)\n\nArguments:\n1. \"token\" (string, required) Token name\n2. \"ip[:port]\" (string, required) Target node address (optional :port to contact remote gateway)\n3. \"message\" (string, required) Message to send (max 1KB)\n4. \"fromaddress\" (string, required) Wallet address used for signing/encryption\n5. port (numeric, optional) Destination message port (defaults to 19002). Only used when specified after fromaddress\n\nResult:\n{\n \"result\": \"success\", (string) Status\n \"hash\": \"hash\", (string) Message hash\n \"recipients\": n, (numeric) Number of recipients\n \"timestamp\": n (numeric) Message timestamp\n}\n\nExamples:\n> neurai-cli depinsendmsg \"MYTOKEN\" \"192.168.1.100\" \"Hello team!\" \"NXsender...\"\n> neurai-cli depinsendmsg \"MYTOKEN\" \"192.168.1.100:19005\" \"Hello team!\" \"NXsender...\" 19005\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"depinsendmsg\", \"params\": [\"MYTOKEN\", \"192.168.1.100\", \"Hello team!\", \"NXsender...\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
31
31
|
"depinsubmitmsg": "depinsubmitmsg \"hexmessage\"\n\nSubmit a pre-encrypted and signed DePIN message to the pool\n\nThis is the secure protocol where the client prepares the complete message\n(encryption + signature) and the server only validates and stores it.\n\nArguments:\n1. \"hexmessage\" (string, required) Hex-encoded serialized CDepinMessage\n\nResult:\n{\n \"result\": \"success\", (string) Status\n \"hash\": \"hash\", (string) Message hash\n \"timestamp\": n (numeric) Unix timestamp\n}\n\nNote: This endpoint is typically called by remote nodes after challenge/response authentication.\n\nExamples:\n> neurai-cli depinsubmitmsg \"0a3f2e...\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"depinsubmitmsg\", \"params\": [\"0a3f2e...\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
32
|
-
"freezedepin": "freezedepin \"asset_name\" \"address\" (\"change_address\")\n\nFreeze a DEPIN asset for a specific address (owner only)\n\nThe address will still hold the asset but it will be marked as invalid\n\nRequires the owner token (
|
|
33
|
-
"listdepinholders": "listdepinholders \"asset_name\"\n\nReturns all addresses holding a DEPIN asset with validity status\n\nDEPIN assets are soulbound (non-transferable except by owner) and can be frozen/revoked\n\nArguments:\n1. \"asset_name\" (string, required) The DEPIN asset name
|
|
34
|
-
"selfrevokedepin": "selfrevokedepin \"asset_name\"\n\nSelf-revoke a DEPIN asset held in this wallet\n\nThe asset will be marked as invalid but will remain in the address\n\nThis action can only be undone by the asset owner\n\nArguments:\n1. \"asset_name\" (string, required) The DEPIN asset name
|
|
35
|
-
"unfreezedepin": "unfreezedepin \"asset_name\" \"address\" (\"change_address\")\n\nUnfreeze a DEPIN asset for a specific address (owner only)\n\nThe asset will be marked as valid again\n\nRequires the owner token (
|
|
32
|
+
"freezedepin": "freezedepin \"asset_name\" \"address\" (\"change_address\")\n\nFreeze a DEPIN asset for a specific address (owner only)\n\nThe address will still hold the asset but it will be marked as invalid\n\nRequires the owner token (ASSET!) in the wallet\n\nArguments:\n1. \"asset_name\" (string, required) The DEPIN asset name\n2. \"address\" (string, required) The address to freeze\n3. \"change_address\" (string, optional) The change address for the owner token\n\nResult:\n\"txid\" (string) The transaction id\n\nExamples:\n> neurai-cli freezedepin \"&FRANCE\" \"address\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"freezedepin\", \"params\": [\"&FRANCE\", \"address\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
33
|
+
"listdepinholders": "listdepinholders \"asset_name\"\n\nReturns all addresses holding a DEPIN asset with validity status\n\nDEPIN assets are soulbound (non-transferable except by owner) and can be frozen/revoked\n\nArguments:\n1. \"asset_name\" (string, required) The DEPIN asset name\n\nResult:\n[\n {\n \"address\": \"address\", (string) The address\n \"amount\": n, (numeric) The amount (always 1 for DEPIN)\n \"valid\": 1|0 (numeric) 1 = active/valid, 0 = blocked/revoked\n },\n ...\n]\n\nExamples:\n> neurai-cli listdepinholders \"&FRANCE\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listdepinholders\", \"params\": [\"&FRANCE\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
34
|
+
"selfrevokedepin": "selfrevokedepin \"asset_name\"\n\nSelf-revoke a DEPIN asset held in this wallet\n\nThe asset will be marked as invalid but will remain in the address\n\nThis action can only be undone by the asset owner\n\nArguments:\n1. \"asset_name\" (string, required) The DEPIN asset name\n\nResult:\n\"txid\" (string) The transaction id\n\nExamples:\n> neurai-cli selfrevokedepin \"&FRANCE\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"selfrevokedepin\", \"params\": [\"&FRANCE\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
35
|
+
"unfreezedepin": "unfreezedepin \"asset_name\" \"address\" (\"change_address\")\n\nUnfreeze a DEPIN asset for a specific address (owner only)\n\nThe asset will be marked as valid again\n\nRequires the owner token (ASSET!) in the wallet\n\nArguments:\n1. \"asset_name\" (string, required) The DEPIN asset name\n2. \"address\" (string, required) The address to unfreeze\n3. \"change_address\" (string, optional) The change address for the owner token\n\nResult:\n\"txid\" (string) The transaction id\n\nExamples:\n> neurai-cli unfreezedepin \"&FRANCE\" \"address\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"unfreezedepin\", \"params\": [\"&FRANCE\", \"address\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
36
36
|
"decodeblock": "decodeblock \"blockhex\"\n\nArguments:\n1. \"blockhex\" (string, required) The block hex\n\nResult:\n{\n \"hash\" : \"hash\", (string) the block hash (same as provided)\n \"size\" : n, (numeric) The block size\n \"strippedsize\" : n, (numeric) The block size excluding witness data\n \"weight\" : n (numeric) The block weight as defined in BIP 141\n \"height\" : n, (numeric) The block height or index\n \"version\" : n, (numeric) The block version\n \"versionHex\" : \"00000000\", (string) The block version formatted in hexadecimal\n \"merkleroot\" : \"xxxx\", (string) The merkle root\n \"tx\" : [ (array of string) The transaction ids\n \"transactionid\" (string) The transaction id\n ,...\n ],\n \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n \"nonce\" : n, (numeric) The nonce\n \"bits\" : \"1d00ffff\", (string) The bits\n}\n\nExamples:\n> neurai-cli decodeblock \"xxxx\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"decodeblock\", \"params\": [\"xxxx\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
37
37
|
"getbestblockhash": "getbestblockhash\n\nReturns the hash of the best (tip) block in the longest blockchain.\n\nResult:\n\"hex\" (string) the block hash hex encoded\n\nExamples:\n> neurai-cli getbestblockhash \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getbestblockhash\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|
|
38
38
|
"getblock": "getblock \"blockhash\" ( verbosity ) \n\nIf verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\nIf verbosity is 1, returns an Object with information about block <hash>.\nIf verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n\nArguments:\n1. \"blockhash\" (string, required) The block hash\n2. verbosity (numeric, optional, default=1) 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data\n\nResult (for verbosity = 0):\n\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n\nResult (for verbosity = 1):\n{\n \"hash\" : \"hash\", (string) the block hash (same as provided)\n \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n \"size\" : n, (numeric) The block size\n \"strippedsize\" : n, (numeric) The block size excluding witness data\n \"weight\" : n (numeric) The block weight as defined in BIP 141\n \"height\" : n, (numeric) The block height or index\n \"version\" : n, (numeric) The block version\n \"versionHex\" : \"00000000\", (string) The block version formatted in hexadecimal\n \"merkleroot\" : \"xxxx\", (string) The merkle root\n \"tx\" : [ (array of string) The transaction ids\n \"transactionid\" (string) The transaction id\n ,...\n ],\n \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n \"nonce\" : n, (numeric) The nonce\n \"bits\" : \"1d00ffff\", (string) The bits\n \"difficulty\" : x.xxx, (numeric) The difficulty\n \"chainwork\" : \"xxxx\", (string) Expected number of hashes required to produce the chain up to this block (in hex)\n \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n \"nextblockhash\" : \"hash\" (string) The hash of the next block\n}\n\nResult (for verbosity = 2):\n{\n ..., Same output as verbosity = 1.\n \"tx\" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 \"tx\" result.\n ,...\n ],\n ,... Same output as verbosity = 1.\n}\n\nExamples:\n> neurai-cli getblock \"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblock\", \"params\": [\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/\n",
|