You are viewing a single comment's thread from:

RE: Making a Decentralized Game on Hive - Tic Tac Toe - Part 1

in HiveDevs2 years ago

Hi,
Trying to figure out this part of the code, what is the meaning of "[[username]]"? Won't username suffice?

const accounts = await hiveTx.call('condenser_api.get_accounts', [[username]])

Sorry not a JS dev :)

Sort:  
 2 years ago  

That's not related to JS. The Hive API node wants a call in that format. Check APIs on devportal
Parameters are sent in an array. Here, we have to put another array inside that array because API accepts a list of accounts not a single account.

The above code is equivalent to this curl:

curl -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_accounts", "params":[["username"]], "id":1}' https://api.hive.blog

Thanks!