Quick Start TVM SDK JavaScript

Prerequisites

This demo app implements the following scenario:

  1. Creates and initializes an instance of the SDK client.

  2. 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 the helloWorld contract.

  3. Retrieves account information and prints the balance of the helloWorld contract.

  4. Runs the account's get method timestamp.

  5. Executes the touch method for the newly deployed helloWorld contract.

  6. Calls the get method again to ensure the timestamp has changed.

  7. 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

  1. Clone the repository into a separate directory:

  1. 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

  1. Clone the repository containing the demo application:

  1. 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:

  1. Install the @tvmsdk/core and @tvmsdk/lib-node packages for the demo application:

  1. 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