Quick Start TVM SDK JavaScript
Prerequisites
Rust v1.76+
Node.js v18.19.1
Python 3
Python 3 setuptools
This demo app implements the following scenario:
Creates and initializes an instance of the SDK client.
Deploys the
helloWorld
contract: 2.1. Generates a key pair for the contract. 2.2. Calculates the future address of the contract. 2.3. Sends tokens to the future address of the contract, which are required for deployment. 2.4. Deploys thehelloWorld
contract.Retrieves account information and prints the balance of the
helloWorld
contract.Runs the account's
get
methodtimestamp
.Executes the
touch
method for the newly deployedhelloWorld
contract.Calls the
get
method again to ensure the timestamp has changed.Sends tokens from the
helloWorld
contract to a random account.
For testing your developed applications, you can the test network at shellnet.ackinacki.org
To replenish the balance of the Multisig wallet contract, please contact us in the Telegram channel.
We will perform all the tasks in this quick start within a separate ~/test-sdk
folder. Let's create it:
Build core TVM library for Node.js
Clone the repository into a separate directory:
Run build:
As a result, the built binding tvmsdk.node
will be placed in the folder ~/test-sdk/tvm-sdk-js/packages/lib-node
.
Prepare demo application
Clone the repository containing the demo application:
Configure the Multisig wallet for use in the demo app:
To do this, in the demo folder, edit the .env
file with the following content:
Install the
@tvmsdk/core
and@tvmsdk/lib-node
packages for the demo application:
Replace the binary file in
@tvmsdk/lib-node
with the Acki Nacki - compatible one that was built earlier:
Run it
Go to the folder containing the demo application and run it:
You will see a result similar to the following:
All amounts are specified in nanotokens.
Source code
The source code of all the components used can be found here
Last updated