dapplib
. Therefore, it is important to reference dapplib
in your client from where youβd be interacting with the blockchain. (In the starter projects for Hyperhack, we've already imported DappLib for you.)js
or jsx
file, reference dapplib
by adding the following import line. This import line will change depending upon the file structure you create within the /packages/client/src
folder.dapplib
. Dapplib
is a library of all the functions the Smart Module has implemented. So instead of interacting directly with the smart modules, we use dapplib
.Tribes
Smart Module and within that we want to read the current Tribe of a user. The corresponding dapplib
function to that is TribesGetCurrentTribe
. We can call this dapplib function like and get the result like so: returnVal
will contain the data that is returned by the smart module function. If the function is writing to the blockchain, the returnVal
will contain the transaction hash. If the function is reading from the blockchain, the returnVal.result
will contain the value that is returned. In the case above, we are reading from the blockchain, so we console.log
the result./packages/dapplib/src/dapp-lib.js
. From there, if you find the name of the Javascript function you would like to call (in this case TribesGetCurrentTribe
), there are comments above each function specifying what parameters you must pass in.Tribes
Smart Module once again. Within that module, we want to call the TribesJoinTribe
method in order to join a Tribe. So within your client, you'd write code like this.tribe
from the Birbal account under the Admin's Tenant. result
will contain the transaction hash, verifying that you are truly awesome!