Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

Overview

Reference

The @ocap/client library is a JavaScript client for connecting applications to a Forge-powered blockchain. It simplifies interaction by sending requests over HTTP/HTTPS and can be used in both Node.js and browser environments, making it a versatile tool for building applications that read and write data to the blockchain. You can find the library on npm.

How It Works#

The client acts as an intermediary between your application and a blockchain node. It abstracts the complexities of the GraphQL API, allowing you to interact with the blockchain through a straightforward set of JavaScript methods. For real-time updates, it establishes a WebSocket connection to subscribe to on-chain events.

Queries & Mutations (over HTTP/S)

Subscriptions (over WebSocket)

Your Application (Node.js/Browser)

@ocap/client

Forge Blockchain Node

Blockchain Ledger


Core Capabilities#

A GraphQLClient instance provides five main groups of methods to streamline your development process when interacting with the blockchain.

Method Group

Description

Queries

Retrieve data from the blockchain, such as information on blocks, transactions, accounts, assets, or the overall chain state.

Mutations

Send transactions to the blockchain. The main method is sendTx, which requires a signed transaction.

Subscriptions

Listen for real-time changes to any data on the blockchain, allowing your application to react to events as they happen.

Senders

A set of helper methods that simplify the process of signing and sending a transaction by taking a wallet and a tx object.

Encoders

A set of helper methods that encode a transaction for later signing. These are used internally by the senders but are also available.

Next Steps#

To begin building your application, proceed to the Getting Started guide for installation instructions and a basic usage example. If you are new to the underlying blockchain principles, you may find it helpful to review the Core Blockchain Concepts first.