in3
Version:
IN3 Ethereum client WASM with bindings for Javascript and Typescript types
126 lines (93 loc) • 3.84 kB
Markdown
This client uses the in3-core sources compiled to wasm. The wasm is included into the js-file wich makes it easier to include the data.
This module has **no** dependencies! All it needs is included inta a wasm of about 300kB.
Installing IN3 is as easy as installing any other module:
```
npm install --save in3
```
The complete documentation can be found https://in3.readthedocs.io/en/develop/ .
In case you want to run IN3 within a react native app, you might face issues because wasm is not supported there yet. In this case you can use [in3-asmjs](https://www.npmjs.com/package/in3-asmjs), which has the same API, but runs on pure javascript (a bit slower and bigger, but full support everywhere).
```js
// import in3-Module
import IN3 from 'in3'
import * as web3 from 'web3'
const IN3Client c = new IN3({
proof : 'standard',
signatureCount : 1,
chainId : 'mainnet',
replaceLatestBlock : 10
})
// use the In3Client as Http-Provider
const web3 = new Web3(c)
(async () => {
// use the web3
const block = await web.eth.getBlockByNumber('latest')
})().catch(console.error);
```
IN3 includes a light API, allowinng not only to use all RPC-Methods in a typesafe way, but also to sign transactions and call funnctions of a contract without the web3-library.
For more details see the [API-Doc](https://github.com/blockchainsllc/in3/blob/master/docs/api.md#type-api)
```js
// import in3-Module
import IN3 from "in3";
// use the In3Client
const in3 = new IN3({
proof: "standard",
signatureCount: 1,
chainId: "mainnet",
replaceLatestBlock: 10
})(async () => {
// use the IN3 directly
const block = await in3.eth.getBlockByNumber("latest");
})().catch(console.error);
```
```html
<html>
<head>
<script src="in3.js"></script>
</head>
<body>
IN3-Demo
<div>
result:
<pre id="result">
...waiting...
</pre
>
</div>
<script>
var c = new IN3({
chainId: 0x5
});
c.send({ method: "eth_getBlockByNumber", params: ["latest", false] })
.then((r) => (document.getElementById("result").innerHTML = JSON.stringify(r, null, 2)))
.catch(alert);
</script>
</body>
</html>
```
Licensees holding a valid commercial license may use this software in accordance
with the commercial license agreement provided with the Software or, alternatively,
in accordance with the terms contained in a written agreement between you and
slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further
information please contact slock.it at in3@slock.it.
Alternatively, this software may be used under the AGPL license as follows:
This program is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
[]
You should have received a copy of the GNU Affero General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>.