https://github.com/tronprotocol/sun.js
https://github.com/tronprotocol/sun.js
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/tronprotocol/sun.js
- Owner: tronprotocol
- Created: 2020-02-18T03:27:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-14T04:01:21.000Z (about 6 years ago)
- Last Synced: 2025-04-16T08:10:44.410Z (about 1 year ago)
- Language: JavaScript
- Size: 1.34 MB
- Stars: 5
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# What is Sun.js
Sun.js inherits from TronWeb and services for Sun-network. We encapsulated two objects (mainchain and sidechain) based on TronWeb. The methods and attributes in mainchain or sidechain are exactly the same as the tronweb instance. For example, users can use sun.mainchain.trx.getBalance() to get balance from the mainchain. Futhermore, we add some new methods which are as follows in Sun class so that users can use them to contact between the main chain and the side chain.
# Installation
Node.js
```javascript
npm install sun
```
or
```javascript
yarn add sun
```
Browser
Then easiest way to use Sun.js in a browser is to install it as above and copy the dist file to your working folder. For example:
```javascript
cp node_modules/sun/dist/Sun.js ./js/Sun.js
```
so that you can call it in your HTML page as
```javascript
<script>
```
# Test cases
```javascript
npm run test
```
But before run test cases, you must add some info in test/config.js, such fullnode, solidity node, eventsever and private key.
# Documentation
[Sun](http://47.252.84.158:8080/sunnetwork/doc/guide/#sunweb-class)