@neuraiproject/neurai-rpc 0.4.5 → 0.4.7
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 +131 -0
- package/DEPIN_IMPLEMENTATION_GUIDE_EN.md +956 -0
- package/README.md +15 -1
- package/dist/index.cjs +53 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +53 -14
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/docs.json +10 -8
- package/docs.ts +1171 -1118
- package/neurai_methods.md +57 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,12 +91,19 @@ const depinRPC = await getDePinRPC({
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
// Send a DePIN message
|
|
94
|
-
const result = await depinRPC("depinsendmsg", [
|
|
94
|
+
const result = await depinRPC("depinsendmsg", [
|
|
95
|
+
"FRANCE",
|
|
96
|
+
"192.168.1.100:19002",
|
|
97
|
+
"Hello team!",
|
|
98
|
+
"NYourAddressHere"
|
|
99
|
+
]);
|
|
95
100
|
console.log(result);
|
|
96
101
|
```
|
|
97
102
|
|
|
98
103
|
For complete DePIN examples including browser wallet integration, error handling, and advanced usage, see [DEPIN_EXAMPLES.md](./DEPIN_EXAMPLES.md).
|
|
99
104
|
|
|
105
|
+
The messaging token configured for a DePIN gateway can be any asset. Separately, the dedicated DePIN asset-management RPCs work with the newer `&ASSET` DePIN asset type, which is soulbound, documented here as enabled for mainnet and testnet, and must use `units=0`.
|
|
106
|
+
|
|
100
107
|
## DePIN Authentication
|
|
101
108
|
|
|
102
109
|
Port 19002 uses a challenge-response authentication protocol:
|
|
@@ -173,15 +180,21 @@ getcacheinfo
|
|
|
173
180
|
getsnapshot "asset_name" block_height
|
|
174
181
|
issue "asset_name" qty "( to_address )" "( change_address )" ( units ) ( reissuable ) ( has_ipfs ) "( ipfs_hash )"
|
|
175
182
|
issueunique "root_name" [asset_tags] ( [ipfs_hashes] ) "( to_address )" "( change_address )"
|
|
183
|
+
checkdepinvalidity "asset_name" "address"
|
|
184
|
+
freezedepin "asset_name" "address" ("change_address")
|
|
176
185
|
listaddressesbyasset "asset_name" (onlytotal) (count) (start)
|
|
177
186
|
listassetbalancesbyaddress "address" (onlytotal) (count) (start)
|
|
178
187
|
listassets "( asset )" ( verbose ) ( count ) ( start )
|
|
188
|
+
listdepinaddresses "asset_name" (count) (start)
|
|
189
|
+
listdepinholders "asset_name"
|
|
179
190
|
listmyassets "( asset )" ( verbose ) ( count ) ( start ) (confs)
|
|
180
191
|
purgesnapshot "asset_name" block_height
|
|
181
192
|
reissue "asset_name" qty "to_address" "change_address" ( reissuable ) ( new_units) "( new_ipfs )"
|
|
193
|
+
selfrevokedepin "asset_name"
|
|
182
194
|
transfer "asset_name" qty "to_address" "message" expire_time "change_address" "asset_change_address"
|
|
183
195
|
transferfromaddress "asset_name" "from_address" qty "to_address" "message" expire_time "xna_change_address" "asset_change_address"
|
|
184
196
|
transferfromaddresses "asset_name" ["from_addresses"] qty "to_address" "message" expire_time "xna_change_address" "asset_change_address"
|
|
197
|
+
unfreezedepin "asset_name" "address" ("change_address")
|
|
185
198
|
|
|
186
199
|
== Blockchain ==
|
|
187
200
|
clearmempool
|
|
@@ -343,6 +356,7 @@ keypoolrefill ( newsize )
|
|
|
343
356
|
listaccounts ( minconf include_watchonly)
|
|
344
357
|
listaddressgroupings
|
|
345
358
|
listlockunspent
|
|
359
|
+
listpqaddresses
|
|
346
360
|
listreceivedbyaccount ( minconf include_empty include_watchonly)
|
|
347
361
|
listreceivedbyaddress ( minconf include_empty include_watchonly)
|
|
348
362
|
listsinceblock ( "blockhash" target_confirmations include_watchonly include_removed )
|
package/dist/index.cjs
CHANGED
|
@@ -173,10 +173,10 @@ Examples:
|
|
|
173
173
|
**/ checkaddresstag: 'checkaddresstag',
|
|
174
174
|
/** checkdepinvalidity "asset_name" "address"
|
|
175
175
|
|
|
176
|
-
Check if a
|
|
176
|
+
Check if a dedicated DePIN asset is valid/active for a specific address. Dedicated DePIN assets currently use the '&' prefix.
|
|
177
177
|
|
|
178
178
|
Arguments:
|
|
179
|
-
1. "asset_name" (string, required) The
|
|
179
|
+
1. "asset_name" (string, required) The DePIN asset name
|
|
180
180
|
2. "address" (string, required) The address to check
|
|
181
181
|
|
|
182
182
|
Result:
|
|
@@ -1042,14 +1042,14 @@ Examples:
|
|
|
1042
1042
|
**/ freezeaddress: 'freezeaddress',
|
|
1043
1043
|
/** freezedepin "asset_name" "address" ("change_address")
|
|
1044
1044
|
|
|
1045
|
-
Freeze a
|
|
1045
|
+
Freeze a dedicated DePIN asset for a specific address (owner only)
|
|
1046
1046
|
|
|
1047
1047
|
The address will still hold the asset but it will be marked as invalid
|
|
1048
1048
|
|
|
1049
|
-
Requires the owner token (&
|
|
1049
|
+
Requires the owner token for the DePIN asset (for example, '&FRANCE!' for '&FRANCE') in the wallet
|
|
1050
1050
|
|
|
1051
1051
|
Arguments:
|
|
1052
|
-
1. "asset_name" (string, required) The
|
|
1052
|
+
1. "asset_name" (string, required) The DePIN asset name
|
|
1053
1053
|
2. "address" (string, required) The address to freeze
|
|
1054
1054
|
3. "change_address" (string, optional) The change address for the owner token
|
|
1055
1055
|
|
|
@@ -2862,6 +2862,7 @@ Asset name must not conflict with any existing asset.
|
|
|
2862
2862
|
Unit as the number of decimals precision for the asset (0 for whole units ("1"), 8 for max precision ("1.00000000")
|
|
2863
2863
|
Reissuable is true/false for whether additional units can be issued by the original issuer.
|
|
2864
2864
|
If issuing a unique asset these values are required (and will be defaulted to): qty=1, units=0, reissuable=false.
|
|
2865
|
+
Dedicated DePIN assets (name starts with '&') are documented here as enabled for mainnet and testnet, with qty > 0 and units=0.
|
|
2865
2866
|
|
|
2866
2867
|
Arguments:
|
|
2867
2868
|
1. "asset_name" (string, required) a unique name
|
|
@@ -3158,20 +3159,43 @@ Examples:
|
|
|
3158
3159
|
> neurai-cli listbanned
|
|
3159
3160
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listbanned", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/
|
|
3160
3161
|
**/ listbanned: 'listbanned',
|
|
3162
|
+
/** listdepinaddresses "asset_name" (count) (start)
|
|
3163
|
+
|
|
3164
|
+
Returns a list of addresses that own the given asset and have a revealed public key on-chain.
|
|
3165
|
+
Useful for DePIN messaging recipient discovery. Requires -assetindex and -pubkeyindex.
|
|
3166
|
+
|
|
3167
|
+
Arguments:
|
|
3168
|
+
1. "asset_name" (string, required) name of asset
|
|
3169
|
+
2. "count" (integer, optional, default=50000, MAX=50000) truncates results to include only the first _count_ addresses found
|
|
3170
|
+
3. "start" (integer, optional, default=0) results skip over the first _start_ addresses found (if negative it skips back from the end)
|
|
3171
|
+
|
|
3172
|
+
Result:
|
|
3173
|
+
[
|
|
3174
|
+
{
|
|
3175
|
+
"address": "address", (string) The address
|
|
3176
|
+
"pubkey": "pubkey_hex" (string) The revealed public key in hex
|
|
3177
|
+
},
|
|
3178
|
+
...
|
|
3179
|
+
]
|
|
3180
|
+
|
|
3181
|
+
Examples:
|
|
3182
|
+
> neurai-cli listdepinaddresses "&FRANCE"
|
|
3183
|
+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listdepinaddresses", "params": ["&FRANCE"] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/
|
|
3184
|
+
**/ listdepinaddresses: 'listdepinaddresses',
|
|
3161
3185
|
/** listdepinholders "asset_name"
|
|
3162
3186
|
|
|
3163
|
-
Returns all addresses holding a
|
|
3187
|
+
Returns all addresses holding a dedicated DePIN asset with validity status
|
|
3164
3188
|
|
|
3165
|
-
|
|
3189
|
+
Dedicated DePIN assets are soulbound and can be frozen/revoked. They currently use the '&' prefix.
|
|
3166
3190
|
|
|
3167
3191
|
Arguments:
|
|
3168
|
-
1. "asset_name" (string, required) The
|
|
3192
|
+
1. "asset_name" (string, required) The DePIN asset name
|
|
3169
3193
|
|
|
3170
3194
|
Result:
|
|
3171
3195
|
[
|
|
3172
3196
|
{
|
|
3173
3197
|
"address": "address", (string) The address
|
|
3174
|
-
"amount": n, (numeric) The amount
|
|
3198
|
+
"amount": n, (numeric) The amount held
|
|
3175
3199
|
"valid": 1|0 (numeric) 1 = active/valid, 0 = blocked/revoked
|
|
3176
3200
|
},
|
|
3177
3201
|
...
|
|
@@ -3266,6 +3290,20 @@ Examples:
|
|
|
3266
3290
|
> neurai-cli listmyassets "ASSET*" true 10 20
|
|
3267
3291
|
> neurai-cli listmyassets "ASSET*" true 10 20 1
|
|
3268
3292
|
**/ listmyassets: 'listmyassets',
|
|
3293
|
+
/** listpqaddresses
|
|
3294
|
+
|
|
3295
|
+
Returns post-quantum (ML-DSA-44) Bech32m addresses in the wallet.
|
|
3296
|
+
|
|
3297
|
+
Result:
|
|
3298
|
+
[
|
|
3299
|
+
"nq1...", (string) A post-quantum wallet address
|
|
3300
|
+
...
|
|
3301
|
+
]
|
|
3302
|
+
|
|
3303
|
+
Examples:
|
|
3304
|
+
> neurai-cli listpqaddresses
|
|
3305
|
+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listpqaddresses", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8766/
|
|
3306
|
+
**/ listpqaddresses: 'listpqaddresses',
|
|
3269
3307
|
/** listreceivedbyaccount ( minconf include_empty include_watchonly)
|
|
3270
3308
|
|
|
3271
3309
|
DEPRECATED. List balances by account.
|
|
@@ -3699,6 +3737,7 @@ Examples:
|
|
|
3699
3737
|
Reissues a quantity of an asset to an owned address if you own the Owner Token
|
|
3700
3738
|
Can change the reissuable flag during reissuance
|
|
3701
3739
|
Can change the ipfs hash during reissuance
|
|
3740
|
+
For dedicated DePIN assets (name starts with '&'), qty must stay positive and units must remain 0.
|
|
3702
3741
|
Arguments:
|
|
3703
3742
|
1. "asset_name" (string, required) name of asset that is being reissued
|
|
3704
3743
|
2. "qty" (numeric, required) number of assets to reissue
|
|
@@ -3818,14 +3857,14 @@ Examples:
|
|
|
3818
3857
|
**/ savemempool: 'savemempool',
|
|
3819
3858
|
/** selfrevokedepin "asset_name"
|
|
3820
3859
|
|
|
3821
|
-
Self-revoke a
|
|
3860
|
+
Self-revoke a dedicated DePIN asset held in this wallet
|
|
3822
3861
|
|
|
3823
3862
|
The asset will be marked as invalid but will remain in the address
|
|
3824
3863
|
|
|
3825
3864
|
This action can only be undone by the asset owner
|
|
3826
3865
|
|
|
3827
3866
|
Arguments:
|
|
3828
|
-
1. "asset_name" (string, required) The
|
|
3867
|
+
1. "asset_name" (string, required) The DePIN asset name
|
|
3829
3868
|
|
|
3830
3869
|
Result:
|
|
3831
3870
|
"txid" (string) The transaction id
|
|
@@ -4361,14 +4400,14 @@ Examples:
|
|
|
4361
4400
|
**/ unfreezeaddress: 'unfreezeaddress',
|
|
4362
4401
|
/** unfreezedepin "asset_name" "address" ("change_address")
|
|
4363
4402
|
|
|
4364
|
-
Unfreeze a
|
|
4403
|
+
Unfreeze a dedicated DePIN asset for a specific address (owner only)
|
|
4365
4404
|
|
|
4366
4405
|
The asset will be marked as valid again
|
|
4367
4406
|
|
|
4368
|
-
Requires the owner token (&
|
|
4407
|
+
Requires the owner token for the DePIN asset (for example, '&FRANCE!' for '&FRANCE') in the wallet
|
|
4369
4408
|
|
|
4370
4409
|
Arguments:
|
|
4371
|
-
1. "asset_name" (string, required) The
|
|
4410
|
+
1. "asset_name" (string, required) The DePIN asset name
|
|
4372
4411
|
2. "address" (string, required) The address to unfreeze
|
|
4373
4412
|
3. "change_address" (string, optional) The change address for the owner token
|
|
4374
4413
|
|