Browse Source

add help doc for KV

pull/4/head
Alrighttt 6 years ago
parent
commit
38e9a59c2c
  1. 23
      src/rpcblockchain.cpp
  2. 26
      src/wallet/rpcwallet.cpp

23
src/rpcblockchain.cpp

@ -767,7 +767,28 @@ UniValue kvsearch(const UniValue& params, bool fHelp)
{
UniValue ret(UniValue::VOBJ); uint32_t flags; uint8_t value[IGUANA_MAXSCRIPTSIZE],key[IGUANA_MAXSCRIPTSIZE]; int32_t duration,j,height,valuesize,keylen; uint256 refpubkey; static uint256 zeroes;
if (fHelp || params.size() != 1 )
throw runtime_error("kvsearch key");
throw runtime_error(
"kvsearch key\n"
"\nSearch for a key stored via the kvupdate command. This feature is only available for asset chains.\n"
"\nArguments:\n"
"1. key (string, required) search the chain for this key\n"
"\nResult:\n"
"{\n"
" \"coin\": \"xxxxx\", (string) chain the key is stored on\n"
" \"currentheight\": xxxxx, (numeric) current height of the chain\n"
" \"key\": \"xxxxx\", (string) key\n"
" \"keylen\": xxxxx, (string) length of the key \n"
" \"owner\": \"xxxx\" (string) hex string representing the owner of the key \n"
" \"height\": xxxxx, (numeric) height the key was stored at\n"
" \"expiration\": xxxxx, (numeric) height the key will expire\n"
" \"flags\": x (numeric) 1 if the key was created with a password; 0 otherwise.\n"
" \"value\": \"xxxxx\", (string) stored value\n"
" \"valuesize\": xxxxx (string) amount of characters stored\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("kvsearch", "examplekey")
+ HelpExampleRpc("kvsearch", "examplekey")
);
LOCK(cs_main);
if ( (keylen= (int32_t)strlen(params[0].get_str().c_str())) > 0 )
{

26
src/wallet/rpcwallet.cpp

@ -509,7 +509,31 @@ UniValue kvupdate(const UniValue& params, bool fHelp)
CWalletTx wtx; UniValue ret(UniValue::VOBJ);
uint8_t keyvalue[IGUANA_MAXSCRIPTSIZE],opretbuf[IGUANA_MAXSCRIPTSIZE]; int32_t i,coresize,haveprivkey,duration,opretlen,height; uint16_t keylen=0,valuesize=0,refvaluesize=0; uint8_t *key,*value=0; uint32_t flags,tmpflags,n; struct komodo_kv *ptr; uint64_t fee; uint256 privkey,pubkey,refpubkey,sig;
if (fHelp || params.size() < 3 )
throw runtime_error("kvupdate key value flags/passphrase");
throw runtime_error(
"kvupdate key \"value\" days passphrase\n"
"\nStore a key value. This feature is only available for asset chains.\n"
"\nArguments:\n"
"1. key (string, required) key\n"
"2. \"value\" (string, required) value\n"
"3. days (numeric, required) amount of days(1440 blocks/day) before the key expires. Minimum 1 day\n"
"4. passphrase (string, optional) passphrase required to update this key\n"
"\nResult:\n"
"{\n"
" \"coin\": \"xxxxx\", (string) chain the key is stored on\n"
" \"height\": xxxxx, (numeric) height the key was stored at\n"
" \"expiration\": \"xxxxx\", (numeric) height the key will expire\n"
" \"flags\": xxxxx, (string) amount of days the key will be stored \n"
" \"key\": xxxxx, (numeric) stored key\n"
" \"keylen\": xxxxx, (numeric) length of the key\n"
" \"value\": x (numeric) stored value\n"
" \"valuesize\": \"xxxxx\", (string) length of the stored value\n"
" \"fee\": xxxxx (string) transaction fee paid to store the key\n"
" \"txid\": xxxxx (string) transaction id\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("kvupdate", "examplekey \"examplevalue\" 2 examplepassphrase")
+ HelpExampleRpc("kvupdate", "examplekey \"examplevalue\" 2 examplepassphrase")
);
if (!EnsureWalletIsAvailable(fHelp))
return 0;
if ( ASSETCHAINS_SYMBOL[0] == 0 )

Loading…
Cancel
Save