Skip to content

Commit

Permalink
GITBOOK-30: Add QS tvm sdk js
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticLove1 authored and gitbook-bot committed Jan 27, 2025
1 parent 5c92403 commit c9958cd
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 45 deletions.
Binary file added docs/.gitbook/assets/uninit (1) (1).jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.gitbook/assets/uninit (1).jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.gitbook/assets/uninit.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 43 additions & 41 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
* [About Acki Nacki SDK](README.md)
* [How to deploy a Multisig Wallet](how-to-deploy-a-multisig-wallet.md)
* [Dapp ID Full Guide: creation, fees, centralized replenishment](dapp-id-full-guide-creation-fees-centralized-replenishment.md)
* [GraphQL Quick Start](graphql-quick-start.md)
* [Add Acki Nacki to your backend](add\_to\_backend.md)
* [Quick Starts](quick-starts/README.md)
* [Quick Start TVM SDK JavaScript](quick-starts/quick-start-tvm-sdk-javascript.md)
* [GraphQL Quick Start](quick-starts/graphql-quick-start.md)
* [Add Acki Nacki to your backend](add_to_backend.md)

## Reference

* [Core Library Reference](reference/types-and-methods/README.md)
* [Modules](reference/types-and-methods/modules.md)
* [Module abi](reference/types-and-methods/mod\_abi.md)
* [Module boc](reference/types-and-methods/mod\_boc.md)
* [Module client](reference/types-and-methods/mod\_client.md)
* [Module crypto](reference/types-and-methods/mod\_crypto.md)
* [Module debot](reference/types-and-methods/mod\_debot.md)
* [Module net](reference/types-and-methods/mod\_net.md)
* [Module processing](reference/types-and-methods/mod\_processing.md)
* [Module proofs](reference/types-and-methods/mod\_proofs.md)
* [Module tvm](reference/types-and-methods/mod\_tvm.md)
* [Module utils](reference/types-and-methods/mod\_utils.md)
* [Core Library Error API](reference/error\_api.md)
* [Error Codes](reference/error\_codes.md)
* [TVM-CLI Reference](https://github.com/tvmlabs/tvm-sdk/blob/main/tvm\_cli/README.md)
* [Module abi](reference/types-and-methods/mod_abi.md)
* [Module boc](reference/types-and-methods/mod_boc.md)
* [Module client](reference/types-and-methods/mod_client.md)
* [Module crypto](reference/types-and-methods/mod_crypto.md)
* [Module debot](reference/types-and-methods/mod_debot.md)
* [Module net](reference/types-and-methods/mod_net.md)
* [Module processing](reference/types-and-methods/mod_processing.md)
* [Module proofs](reference/types-and-methods/mod_proofs.md)
* [Module tvm](reference/types-and-methods/mod_tvm.md)
* [Module utils](reference/types-and-methods/mod_utils.md)
* [Core Library Error API](reference/error_api.md)
* [Error Codes](reference/error_codes.md)
* [TVM-CLI Reference](https://github.com/tvmlabs/tvm-sdk/blob/main/tvm_cli/README.md)
* [VM Instructions specifications](reference/vm-instructions-specifications.md)

## GraphQL
Expand Down Expand Up @@ -59,38 +61,38 @@
## JS(TS) guides

* [Installation](guides/installation/README.md)
* [Add SDK to your App](guides/installation/add\_sdk\_to\_your\_app.md)
* [Add SDK to your App](guides/installation/add_sdk_to_your_app.md)
* [Configuration](guides/configuration/README.md)
* [Endpoint Configuration](guides/configuration/endpoint-configuration.md)
* [Message Expiration](guides/configuration/message\_expiration.md)
* [Message Retry](guides/configuration/retry\_message.md)
* [Config Reference](guides/configuration/configure\_sdk.md)
* [Work with contracts](guides/work\_with\_contracts/README.md)
* [Add Contract to your App](guides/work\_with\_contracts/add\_contract\_to\_your\_app.md)
* [Use your own Sponsor Wallet](guides/work\_with\_contracts/custom\_giver.md)
* [Deploy](guides/work\_with\_contracts/deploy.md)
* [Run on-chain](guides/work\_with\_contracts/run\_onchain.md)
* [Run ABI Get Method](guides/work\_with\_contracts/run\_abi\_get\_method.md)
* [Run Fift Get Method](guides/work\_with\_contracts/run\_fift\_get\_method.md)
* [Query messages(events)](guides/work\_with\_contracts/work\_with\_events.md)
* [Decode Messages(Event)](guides/work\_with\_contracts/decode\_message.md)
* [External Signing](guides/work\_with\_contracts/external\_signing.md)
* [Emulate Transaction](guides/work\_with\_contracts/emulate\_transaction.md)
* [Estimate Fees](guides/work\_with\_contracts/estimate\_fees.md)
* [Validate address, convert address](guides/work\_with\_contracts/validate\_address\_convert\_address.md)
* [Message Expiration](guides/configuration/message_expiration.md)
* [Message Retry](guides/configuration/retry_message.md)
* [Config Reference](guides/configuration/configure_sdk.md)
* [Work with contracts](guides/work_with_contracts/README.md)
* [Add Contract to your App](guides/work_with_contracts/add_contract_to_your_app.md)
* [Use your own Sponsor Wallet](guides/work_with_contracts/custom_giver.md)
* [Deploy](guides/work_with_contracts/deploy.md)
* [Run on-chain](guides/work_with_contracts/run_onchain.md)
* [Run ABI Get Method](guides/work_with_contracts/run_abi_get_method.md)
* [Run Fift Get Method](guides/work_with_contracts/run_fift_get_method.md)
* [Query messages(events)](guides/work_with_contracts/work_with_events.md)
* [Decode Messages(Event)](guides/work_with_contracts/decode_message.md)
* [External Signing](guides/work_with_contracts/external_signing.md)
* [Emulate Transaction](guides/work_with_contracts/emulate_transaction.md)
* [Estimate Fees](guides/work_with_contracts/estimate_fees.md)
* [Validate address, convert address](guides/work_with_contracts/validate_address_convert_address.md)
* [Crypto](guides/crypto/README.md)
* [Mnemonics and Keys](guides/crypto/mnemonics\_and\_keys.md)
* [Queries](guides/queries\_and\_subscriptions/README.md)
* [Use-cases](guides/queries\_and\_subscriptions/use-cases.md)
* [How to work with net module](guides/queries\_and\_subscriptions/how-to-work-with-net-module.md)
* [net.query syntax](guides/queries\_and\_subscriptions/raw\_query.md)
* [Data pagination](guides/queries\_and\_subscriptions/data-pagination.md)
* [Query Collection](guides/queries\_and\_subscriptions/query\_collection.md)
* [Mnemonics and Keys](guides/crypto/mnemonics_and_keys.md)
* [Queries](guides/queries_and_subscriptions/README.md)
* [Use-cases](guides/queries_and_subscriptions/use-cases.md)
* [How to work with net module](guides/queries_and_subscriptions/how-to-work-with-net-module.md)
* [net.query syntax](guides/queries_and_subscriptions/raw_query.md)
* [Data pagination](guides/queries_and_subscriptions/data-pagination.md)
* [Query Collection](guides/queries_and_subscriptions/query_collection.md)

## For Binding Developers

* [How to work with Application Objects in binding generators](for-binding-developers/app\_objects.md)
* [JSON Interface to TVM Client](for-binding-developers/json\_interface.md)
* [How to work with Application Objects in binding generators](for-binding-developers/app_objects.md)
* [JSON Interface to TVM Client](for-binding-developers/json_interface.md)

## Links

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
hidden: true
---

# Dapp ID Full Guide: creation, fees, centralized replenishment

## **What will you learn from this guide?** <a href="#prerequisites" id="prerequisites"></a>
Expand Down
2 changes: 2 additions & 0 deletions docs/quick-starts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Quick Starts

File renamed without changes.
125 changes: 125 additions & 0 deletions docs/quick-starts/quick-start-tvm-sdk-javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Quick Start TVM SDK JavaScript

### **Prerequisites**

* Rust v1.76+
* Node.js v18.19.1
* Python 3
* Python 3 setuptools
* [TVM-CLI and Multisig Wallet](../how-to-deploy-a-multisig-wallet.md)

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

{% hint style="info" %}
For testing your developed applications, you can the test network at [`shellnet.ackinacki.org`](https://shellnet.ackinacki.org)

To replenish the balance of the Multisig wallet contract, please contact us in the [Telegram channel](https://t.me/tvmlabs).
{% endhint %}

We will perform all the tasks in this quick start within a separate `~/test-sdk` folder. Let's create it:

```
cd ~
mkdir test-sdk
```

### **Build core TVM library for Node.js**

1. Clone the repository into a separate directory:

```
cd ~/test-sdk
git clone https://github.com/tvmlabs/tvm-sdk-js.git
```

2. Run build:

```
cd tvm-sdk-js/packages/lib-node/build
cargo run
```

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:

```
cd ~/test-sdk
git clone https://github.com/tvmlabs/sdk-examples.git
cd sdk-examples/js/nodejs/helloWorld
```

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

```
WALLET_ADDRESS=YOUR_MULTISIG_WALLET_ADDRESS
WALLET_KEYS=FULL_PATH_TO_YOUR_MULTISIG_WALLET_KEYS_FILE # the absolute path must be specified
```

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

```
npm install
```

4. Replace the binary file in `@tvmsdk/lib-node` with the Acki Nacki - compatible one that was built earlier:

```
cp ~/test-sdk/tvm-sdk-js/packages/lib-node/tvmsdk.node ~/test-sdk/sdk-examples/js/nodejs/helloWorld/node_modules/@tvmsdk/lib-node/
```

### **Run it**

Go to the folder containing the demo application and run it:

```
cd ~/test-sdk/sdk-examples/js/nodejs/helloWorld
node index.js
```

You will see a result similar to the following:

{% hint style="info" %}
All amounts are specified in nanotokens.
{% endhint %}

```
wallet keys fname: /home/username/wallet/wallet.keys.json
Future address of helloWorld contract is: 0:ef6e287ce266c9ab6bc1190b3bed061bef935796e4a0d659eb28ddcc6f9ecd03
Transferring 2000000000 nanoSHELL tokens from Multisig wallet to 0:ef6e287ce266c9ab6bc1190b3bed061bef935796e4a0d659eb28ddcc6f9ecd03
Success. Tokens were transferred
Deploying helloWorld contract
Success. Contract was deployed
helloWorld balance is 983952999 nanoVMSHELL
Run `timestamp` get method
`timestamp` value is { timestamp: '1736843146' }
Calling `touch` function
Success. TransactionId is: d9c26ef8a0adae234c500d020b298fa600f3e1b8b27758240eff654cd9b85c39
Run `timestamp` get method
Updated `timestamp` value is { timestamp: '1736843151' }
Sending 100000000 nanoSHELL tokens to 0:a088cb42523b9cacf79ca598b9070c160a13674edc8de9c662636caa7969e506
Normal exit
```

### **Source code**

The source code of all the components used can be found [here](https://github.com/tvmlabs/sdk-examples)

0 comments on commit c9958cd

Please sign in to comment.