OSDN Git Service

update create key
[bytom/Bytom-JS-SDK.git] / README.md
1 # Bytom-JS-SDK
2 [![npm version](https://img.shields.io/npm/v/bytom-js-sdk.svg?style=flat-square)](https://www.npmjs.com/package/bytom-js-sdk)
3
4 ## Install
5
6 ``` bash
7 npm install bytom-js-sdk
8 ```
9
10 ## Use
11
12 ```javascript
13 let net = {
14     main: "http://main-net-host/",
15     test: "http://test-net-host/"
16 };
17 let bytom = new Bytom(net, chrome.runtime.getURL("main.wasm"));
18
19 //set Bytom net type (main test), default main net.
20 bytom.setNetType('test');
21 console.log(bytom.getNetType());
22
23 //create key
24 bytom.sdk.keys.create("test_alias", "123456").then((res)=>{
25     console.log(res)
26 }).catch(error => {
27     console.log(error)
28 });
29 ```
30
31 ## WebAssembly build
32
33 Project depends on WebAssembly. \
34 See [Bytom-WebAssembly](https://github.com/oysheng/Bytom-WebAssembly).