Sample Usage
Last updated
Last updated
Since Adena is installed on the user's device, window.adena
will return available functions.
Once the application confirms that Adena is installed on the current device, it must first request to establish a connection via window.adena.AddEstablish("name")
.
This will open a connection request page asking the user to approve adding the current domain to a local whitelist.
Provided that the user approves the connection request, running window.adena.GetAccount();
will return information about the current account.
Let's first send some $GNOTs to an address. We'll be using /bank.MsgSend
for this operation.
Running the function will open a pop-up page asking the user to approve the transaction. Clicking on Approve will submit the transaction. The console will return TRANSACTION_SENT
if the transaction has been successfully sent. Once confirmed, the transaction will appear in your History and its details can be found on Gnoscan, the explorer for Gnoland.
Let's try creating a board named integrate_adena. We'll use the same sample code from the Establish a Connection section, /vm.m_call
, with different parameters.
Running the function will open a pop-up page asking the user to approve the transaction. Clicking on Approve will complete the transaction. The console will return TRANSACTION_SENT
if the transaction has been successfully submitted to the blockchain. Once the transaction is confirmed, the board will be created on Test2 Gnoland Boards.
As you can see, a board named integrate_adena has been created.
Let's upload a test package with a simple function. We'll be using /vm.m_addpkg
for this operation. Note that the actual code of the package is entered under Files
as an array.
Running the function will open a pop-up page asking the user to approve the transaction. Clicking on Approve will complete the transaction. The console will return TRANSACTION_SENT
if the transaction has been successfully submitted to the blockchain. Just like other transactions above, it will appear in your History once confirmed. Track it on Gnoscan, and you'll see that your code will be fully auditable and transparent for anyone to see.