Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arcblock/forge-js
:fire: JavaScript libraries to work with forge framework
https://github.com/arcblock/forge-js
arcblock blockchain nodejs sdk
Last synced: about 1 month ago
JSON representation
:fire: JavaScript libraries to work with forge framework
- Host: GitHub
- URL: https://github.com/arcblock/forge-js
- Owner: ArcBlock
- License: other
- Created: 2019-01-08T03:20:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-08T06:21:48.000Z (over 1 year ago)
- Last Synced: 2024-10-09T11:35:09.151Z (about 1 month ago)
- Topics: arcblock, blockchain, nodejs, sdk
- Language: JavaScript
- Homepage: https://forge-js.netlify.com/
- Size: 14.8 MB
- Stars: 26
- Watchers: 25
- Forks: 2
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![forge-javascript-sdk](https://www.arcblock.io/.netlify/functions/badge/?text=Forge%20Javascript%20SDK)
## Table of Contents
- [Table of Contents](#Table-of-Contents)
- [Introduction](#Introduction)
- [Packages](#Packages)
- [Install](#Install)
- [Usage](#Usage)
- [ES5(commonjs)](#ES5commonjs)
- [ES6](#ES6)
- [Util](#Util)
- [Wallet](#Wallet)
- [Message](#Message)
- [Documentation](#Documentation)
- [Contribution](#Contribution)
- [Compatibility](#Compatibility)
- [Report a Bug?](#Report-a-Bug)
- [License](#License)## Introduction
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lernajs.io/)
[![docs](https://img.shields.io/badge/powered%20by-arcblock-green.svg)](https://docs.arcblock.io)
[![Gitter](https://badges.gitter.im/ArcBlock/community.svg)](https://gitter.im/ArcBlock/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)> Last updated at 9/7/2022, 2:26:20 PM
Javascript SDK for [forge](https://docs.arcblock.io/forge/latest/), which is an awesome framework to write distributed blockchain applications.
## Packages
- [client-extension ](https://www.npmjs.com/package/@arcblock/client-extension)
- [forge-config ](https://www.npmjs.com/package/@arcblock/forge-config)
- [forge-message ](https://www.npmjs.com/package/@arcblock/forge-message)
- [forge-proto ](https://www.npmjs.com/package/@arcblock/forge-proto)
- [forge-sdk ](https://www.npmjs.com/package/@arcblock/forge-sdk)
- [forge-util ](https://www.npmjs.com/package/@arcblock/forge-util)
- [forge-wallet ](https://www.npmjs.com/package/@arcblock/forge-wallet)
- [graphql-client ](https://www.npmjs.com/package/@arcblock/graphql-client)
- [grpc-client ](https://www.npmjs.com/package/@arcblock/grpc-client)
- [mcrypto ](https://www.npmjs.com/package/@arcblock/mcrypto)
- [tx-util ](https://www.npmjs.com/package/@arcblock/tx-util)
- [did-agent-storage ](https://www.npmjs.com/package/@arcblock/did-agent-storage)
- [did-agent-storage-memory ](https://www.npmjs.com/package/@arcblock/did-agent-storage-memory)
- [did-agent-storage-mongo ](https://www.npmjs.com/package/@arcblock/did-agent-storage-mongo)
- [did-agent-storage-nedb ](https://www.npmjs.com/package/@arcblock/did-agent-storage-nedb)
- [did-auth-storage ](https://www.npmjs.com/package/@arcblock/did-auth-storage)
- [did-auth-storage-firebase ](https://www.npmjs.com/package/@arcblock/did-auth-storage-firebase)
- [did-auth-storage-keystone ](https://www.npmjs.com/package/@arcblock/did-auth-storage-keystone)
- [did-auth-storage-memory ](https://www.npmjs.com/package/@arcblock/did-auth-storage-memory)
- [did-auth-storage-mongo ](https://www.npmjs.com/package/@arcblock/did-auth-storage-mongo)
- [did-auth-storage-nedb ](https://www.npmjs.com/package/@arcblock/did-auth-storage-nedb)
- [event-client ](https://www.npmjs.com/package/@arcblock/event-client)
- [event-server ](https://www.npmjs.com/package/@arcblock/event-server)
- [swap-retriever ](https://www.npmjs.com/package/@arcblock/swap-retriever)
- [swap-storage ](https://www.npmjs.com/package/@arcblock/swap-storage)
- [swap-storage-memory ](https://www.npmjs.com/package/@arcblock/swap-storage-memory)
- [swap-storage-mongo ](https://www.npmjs.com/package/@arcblock/swap-storage-mongo)
- [swap-storage-nedb ](https://www.npmjs.com/package/@arcblock/swap-storage-nedb)## Install
```sh
npm i @arcblock/forge-sdk
// OR
yarn add @arcblock/forge-sdk
```## Usage
### ES5(commonjs)
> Support Node.js
```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);
```### ES6
> If you want to support both node.js and browser, please use lite version
> And the lite version only supports http connections```js
import ForgeSDK from '@arcblock/forge-sdk/lite';ForgeSDK.connect('https://test.abtnetwork.io/api', { name: 'test' });
ForgeSDK.getChainInfo().then(console.log);
```### Util
```javascript
const ForgeSDK = require('@arcblock/forge-sdk');const bn = ForgeSDK.Util.fromTokenToUnit(10, 16);
console.log(bn);
```### Wallet
```javascript
const ForgeSDK = require('@arcblock/forge-sdk');const wallet = ForgeSDK.Wallet.fromRandom();
console.log(wallet.toJSON());
```### Message
```javascript
const ForgeSDK = require('@arcblock/forge-sdk');const message = ForgeSDK.Message.createMessage('Transaction', { from: 'abcd' });
console.log(message);
```## Documentation
[https://docs.arcblock.io/forge/sdks/javascript/latest/](https://docs.arcblock.io/forge/sdks/javascript/latest/)
## Contribution
Checkout [CONTRIBUTION.md](https://github.com/ArcBlock/forge-js/blob/master/CONTRIBUTION.md)
## Compatibility
Forge javascript sdk works with node.js v8.x or above, checkout [Travis](https://travis-ci.com/ArcBlock/forge-js/builds) for status.
## Report a Bug?
Bugs and feature requests please create new issues [here](https://github.com/ArcBlock/forge-js/issues)
## License
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 athttp://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.