rubixchain / rubixgoplatform

GNU General Public License v3.0
8 stars 17 forks source link

parameters validation #187

Closed ashi31 closed 1 month ago

ashi31 commented 2 months ago

This is to verify the validity of input parameters for the commands before it reaches the API. The basic validation will be done in the beginning to prevent unnecessary API calls.

ping : valididty of peerId, i.e. length & prefix

addbootstrap : len of peers provided if peers start with "/"

removebootstrap : len of peers provided if peers start with "/"

createdid : didType (between 0 and 4) if required files are present

addquorum : if the file is available if the file is empty

setupquorum : valididty of did by checking length and prefix if did is empty, asking the user for did

generatetestrbt : if did is empty, asking the user for did valididty of did by checking length and prefix checking for numTokens value >0

transferrbt : checking sender address, if empty asking user to enter checking receiver address, if empty asking user to enter checking if the adress has just did checking for the validity of both sender and receiver DID if transtype is 1 or 2 if rbt amount is not less than 5 decimal places

getaccountinfo : if did is empty, asking the user for did valididty of did by checking length and prefix

dumptokenchain : if token is empty, asking the user for token valididty of token by checking length and prefix

registerdid / setupdid : if did is empty, asking the user for did valididty of did by checking length and prefix

migratenode : didType (between 0 and 4)

createdatatoken : if did is empty, asking the user for did valididty of did by checking length and prefix

commitdatatoken : if did is empty, asking the user for did valididty of did by checking length and prefix

gettxndetails : checking if any of the values (did, txnId, transComment) are provided if did is provided, valididty check of did by checking length and prefix

publishcontract : if sc token is empty, asking the user for token valididty of sc token by checking length and prefix checking validity of DID checking if publishtype is 0 or 1

subscribecontract : if sc token is empty, asking the user for token valididty of sc token by checking length and prefix

deploysmartcontract : if sc token is empty, asking the user for token valididty of sc token by checking length and prefix checking deployerdid by checking length and prefix validating rbt amount to be committed checking if trans type is 1 or 2

generatesmartcontract : if did is empty, asking the user for did valididty of did by checking length and prefix checking if binary code file, raw code file and schema file are provided

fetchsmartcontract : if sc token is empty, asking the user for token valididty of sc token by checking length and prefix

dumpsmartcontracttokenchain : if sc token is empty, asking the user for token valididty of sc token by checking length and prefix

executesmartcontract : if sc token is empty, asking the user for token valididty of sc token by checking length and prefix checking executerdid by checking length and prefix checking if trans type is 1 or 2 checking if data to be executed is provided

checkquorumstatus : if quorum address is empty, asking the user for quorum address checking if address has 2 parts check peerID and did validity

addexplorer : length of links provided

remove explorer : length of links provided

addpeerdetails : if peerID is empty, asking the user for peerID valididty of peerID by checking length and prefix if did is empty, asking the user for did valididty of did by checking length and prefix didType (between 0 and 4)