JS Quick Start
This is a reference quick start guide in JS, other languages have the same api and should implement the integration the same way
Prerequisites
You should have a Sponsor Wallet deployed.
Node.js v18
The next 3 dependencies are needed only to build TVM-SDK binary for Node.js engine for your platform. Soon we will start publishing them for your convenience in tvm-sdk-js github releases. And you will not require to have these preinstalled.
Rust v1.76+
Python 3
Python 3 setuptools
What we will learn
In this quick start we will lean how to
Generate the keys
Calculate contract address
Top up contract address with funds from a sponsor wallet
run the contract's get method
run the contract's method on-chain (send transaction)
Create test project
We will do all the work in this quick start in a separate ~/test-sdk
folder. Let's create it:
Now you need to specify your Sponsor Wallet credentials in order for the App to use it for test contract work. To do this, in the App folder, edit .env
file with following content:
Install the packages @tvmsdk/core
and @tvmsdk/lib-node
for the demo application:
Before running the test project we need to add TVM-SDK binary built for your platform.
Let's do it.
Build TVM SDK binary
Clone the TVM-SDK repository to a separate directory:
Run build:
As a result, the tvm-sdk binary for Node enginetvmsdk.node
will be placed into the folder ~/test-sdk/tvm-sdk-js/packages/lib-node
.
Place the binary file to /node_modules/@tvmsdk/lib-node:
Run our App!
Go to the folder with the HelloWorld application and run it:
You will see a result similar to the following:
Last updated