- Table of Contents
- Introduction
- Packages
- Install
- Usage
- Documentation
- Contribution
- Compatibility
- Report a Bug?
- License
Last updated at 9/7/2022, 2:26:20 PM
Javascript SDK for forge, which is an awesome framework to write distributed blockchain applications.
- client-extension
- forge-config
- forge-message
- forge-proto
- forge-sdk
- forge-util
- forge-wallet
- graphql-client
- grpc-client
- mcrypto
- tx-util
- did-agent-storage
- did-agent-storage-memory
- did-agent-storage-mongo
- did-agent-storage-nedb
- did-auth-storage
- did-auth-storage-firebase
- did-auth-storage-keystone
- did-auth-storage-memory
- did-auth-storage-mongo
- did-auth-storage-nedb
- event-client
- event-server
- swap-retriever
- swap-storage
- swap-storage-memory
- swap-storage-mongo
- swap-storage-nedb
npm i @arcblock/forge-sdk
// OR
yarn add @arcblock/forge-sdk
Support Node.js
const ForgeSDK = require('@arcblock/forge-sdk');
// Connect to multi endpoints
ForgeSDK.connect('https://test.abtnetwork.io/api', { name: 'test' });
ForgeSDK.connect('https://zinc.abtnetwork.io/api', { name: 'zinc' });
ForgeSDK.connect('tcp://127.0.0.1:28210', { name: 'local' });
// Declare on test chain
ForgeSDK.sendDeclareTx({
tx: { itx: { moniker: 'abcd' } },
wallet: ForgeSDK.Wallet.fromRandom(),
}).then(console.log);
// Get zinc chain info
ForgeSDK.getChainInfo({ conn: 'zinc' }).then(console.log);
// Get local chain info
ForgeSDK.getChainInfo({ conn: 'local' }).then(console.log);
If you want to support both node.js and browser, please use lite version And the lite version only supports http connections
import ForgeSDK from '@arcblock/forge-sdk/lite';
ForgeSDK.connect('https://test.abtnetwork.io/api', { name: 'test' });
ForgeSDK.getChainInfo().then(console.log);
const ForgeSDK = require('@arcblock/forge-sdk');
const bn = ForgeSDK.Util.fromTokenToUnit(10, 16);
console.log(bn);
const ForgeSDK = require('@arcblock/forge-sdk');
const wallet = ForgeSDK.Wallet.fromRandom();
console.log(wallet.toJSON());
const ForgeSDK = require('@arcblock/forge-sdk');
const message = ForgeSDK.Message.createMessage('Transaction', { from: 'abcd' });
console.log(message);
https://docs.arcblock.io/forge/sdks/javascript/latest/
Checkout CONTRIBUTION.md
Forge javascript sdk works with node.js v8.x or above, checkout Travis for status.
Bugs and feature requests please create new issues here
Copyright 2018-2019 ArcBlock
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.