github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/reference/tm2-js-client/tm2-js-client.md (about)

     1  ---
     2  id: tm2-js-client
     3  ---
     4  
     5  # Tendermint2 JavaScript Client
     6  
     7  [@gnolang/tm2-js-client](https://github.com/gnolang/tm2-js-client) is a JavaScript/TypeScript client implementation 
     8  for Tendermint2-based chains. It is designed to make it
     9  easy for developers to interact with TM2 chains, providing a simplified API for 
    10  account and transaction management. By doing all the heavy lifting behind the
    11  scenes, `@gnolang/tm2-js-client` enables developers to focus on what really 
    12  matters - building their dApps.
    13  
    14  ## Key Features
    15  
    16  - JSON-RPC and WebSocket client support via a `Provider`
    17  - Simple account and transaction management API with a `Wallet`
    18  - Designed for easy extension for custom TM2 chains, such as [Gnoland](https://gno.land)
    19  
    20  ## Installation
    21  
    22  To install `@gnolang/tm2-js-client`, use your preferred package manager:
    23  
    24  ```bash
    25  yarn add @gnolang/tm2-js-client
    26  ```
    27  
    28  ```bash
    29  npm install @gnolang/tm2-js-client
    30  ```
    31  
    32  ## Common Terminology
    33  
    34  ### Provider
    35  
    36  A `Provider` is an interface that abstracts the interaction with the Tendermint2 
    37  chain, making it easier for users to communicate with it. Rather than requiring 
    38  users to understand which endpoints are exposed, what their return types are,
    39  and how they are parsed, the `Provider` abstraction handles all of this behind 
    40  the scenes. It exposes useful API methods that users can use and expects
    41  concrete types in return.
    42  
    43  Currently, the `@gnolang/tm2-js-client` package provides support for two
    44  Provider implementations:
    45  
    46  - `JSON-RPC Provider`: executes each call as a separate HTTP RPC call.
    47  - `WS Provider`: executes each call through an active WebSocket connection,
    48  which requires closing when not needed anymore.
    49  
    50  ### Signer
    51  
    52  A `Signer` is an interface that abstracts the interaction with a single 
    53  Secp256k1 key pair. It exposes methods for signing data, verifying signatures,
    54  and getting metadata associated with the key pair, such as the address.
    55  
    56  Currently, the `@gnolang/tm2-js-client` package provides support for two 
    57  `Signer` implementations:
    58  
    59  - `Key`: a signer that is based on a raw Secp256k1 key pair.
    60  - `Ledger`: a signer that is based on a Ledger device, with all interaction
    61  flowing through the user's device.
    62  
    63  ### Wallet
    64  
    65  A `Wallet` is a user-facing API that is used to interact with an account. 
    66  A `Wallet` instance is tied to a single key pair and essentially wraps the given
    67  `Provider` for that specific account.
    68  
    69  A wallet can be generated from a randomly generated seed, a private key, or
    70  instantiated using a Ledger device.
    71  
    72  Using the `Wallet`, users can easily interact with the Tendermint2 chain using
    73  their account without having to worry about account management.