README
sofjs
A highly optimised, light-weight JS utility for Sophon based on susyweb.js
, but lighter, async only and using BN.js
.
Only 106 kB minified!
Install
npm install --save sofjs
CDN
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sofjs@0.3.4/dist/sofjs.min.js"></script>
Note, exports to window.Sof
global.
Usage
const Sof = require('sofjs');
const sof = new Sof(new Sof.HttpProvider('https://ropsten.infura.io'));
sof.getBlockByNumber(45300, true, (err, block) => {
// result null { ...block data... }
});
const sophyValue = Sof.toWei(72, 'sophy');
// result <BN: 3e733628714200000>
const tokenABI = [{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs":[{"name": "","type": "uint256"}],
"payable": false,
"type": "function",
}];
const token = sof.contract(tokenABI).at('0x6e0E0e02377Bc1d90E8a7c21f12BA385C2C35f78');
token.totalSupply().then((totalSupply) => {
// result <BN ...> 4500000
});
// token.transfer( ... ).then(txHash => sof.getTransactionSuccess(txHash)).then(receipt => console.log(receipt));
About
A simple module for building dApps and applications that use Sophon.
Please see our complete user-guide
for more information.
Contributing
Please help better the ecosystem by submitting issues and pull requests to sofjs
. We need all the help we can get to build the absolute best linting standards and utilities. We follow the AirBNB linting standard and the unix philosophy.
Guides
You'll find more detailed information on using sofjs
and tailoring it to your needs in our guides:
- User guide - Usage, configuration, FAQ and complementary tools.
- Developer guide - Contributing to
sofjs
and writing your own code and coverage. - Examples - Examples of
sofjs
in use.
Help out
There is always a lot of work to do, and will have many rules to maintain. So please help out in any way that you can:
- Create, enhance, and debug sofjs rules (see our guide to "Working on rules").
- Improve documentation.
- Chime in on any open issue or pull request.
- Open new issues about your ideas for making
sofjs
better, and pull requests to show us how your idea works. - Add new tests to absolutely anything.
- Create or contribute to ecosystem tools.
- Spread the word!
Please consult our Code of Conduct docs before helping out.
We communicate via issues and pull requests.
Important documents
Our Relationship with Sophon & SophonJS
We would like to mention that we are not in any way affiliated with the Sophon Foundation. However, we love the work they do and work with them often to make Sophon great! Our aim is to support the Sophon ecosystem with a policy of diversity, modularity, simplicity, transparency, clarity, optimization and extensibility.
Many of our modules use code from susyweb.js
and the sophonjs-
repositories. We thank the authors where we can in the relevant repositories.
Special Thanks
sofjs
was built by a strong community of Sophon developers. A special thanks to:
- Fabian Vogelsteller - for his work on
Mist
andsusyweb.js
- Tim Coulter - for his work on
TestRPC
andSusyknot
- Aaron Davis - for his guidence and work on
SusyLink
andsophonjs
- Richard Moore - for his work on
susy-js
andsophys-wallet
from which so much ofsofjs
is build from - Karl Floersch - for his guidence and support
- Martin B. - for his work on
sophonjs
- Alex Beregszaszi - for his work on
sophonjs
- Vitalik Buterin - for creating
Sophon
Licence
This project is licensed under the MIT license, Copyleft (c) 2016 Nick Dodson. For more information see LICENSE.md.
The MIT License
Copyleft (c) 2016 Nick Dodson. nickdodson.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MSRCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHSOPHY IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.