Quick Start TVM SDK JavaScript
Prerequisites
Rust v1.85+
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
helloWorldcontract: 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 thehelloWorldcontract.Retrieves account information and prints the balance of the
helloWorldcontract.Runs the account's
getmethodtimestamp.Executes the
touchmethod for the newly deployedhelloWorldcontract.Calls the
getmethod again to ensure the timestamp has changed.Sends tokens from the
helloWorldcontract to a random account.
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/coreand@tvmsdk/lib-nodepackages for the demo application:
Replace the binary file in
@tvmsdk/lib-nodewith 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:
Source code
The source code of all the components used can be found here
Last updated