0.2.22 • Published 5 years ago
sdag.js v0.2.22
SDAG.js
A Javascript SDAG library for Web broswers and Node.js.
Installing
npm install sdag.js
API Documentation
Almost all network APIs are promise-style, await/async is recommended.
HubClient
The core class of SDAG.js.
import { HubClient } from 'sdag.js';
let client = new HubClient();
Keyman
SDAG keys manager. You should use this class to manage users' addresses and private keys.
import { Keyman , HubClient } from 'sdag.js';
let client = new HubClient();
let man = new Keyman(mnemnoic, passphrase);
// Sign a transaction when transferring assets
await client.transfer({ to: 'To', from: 'From', amount: 2, ecdsaPubkey: man.mainEcdsaPubKey }, (hash) => man.sign(hash));
// Sign and verify text messages
let signed = man.signMessage('hello sdag');
let ok = man.verifyMessage('hello sdag', signed);
let ok2 = man.verifyMessage('other message' ,otherSignedMessage, otherPubkey);
Method | Description | Return |
---|---|---|
constructor | The mnemonic code is required | |
genAddress | Generate a address by index | string |
sign | Sign unit hash when you transfer assets | string |
verify | Verify a signed string | boolean |
ecdsaPubkey | Gen a ecdsa pub key by index | string |
signMessage | Sign a text message | string |
verifyMessage | Verify a text message | boolean |
License
GPL-3.0
0.2.22
5 years ago
0.2.21
5 years ago
0.2.20
5 years ago
0.2.19
5 years ago
0.2.18
5 years ago
0.2.17
5 years ago
0.2.16
5 years ago
0.2.15
5 years ago
0.2.14
5 years ago
0.2.13
5 years ago
0.2.12
5 years ago
0.2.11
5 years ago
0.2.10
5 years ago
0.2.9
5 years ago
0.2.8
5 years ago
0.2.7
5 years ago
0.2.6
5 years ago
0.2.5
5 years ago
0.2.4
5 years ago
0.2.3
5 years ago
0.2.2
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.11
5 years ago
0.1.10
5 years ago
0.1.9
5 years ago
0.1.8
5 years ago
0.1.7
5 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.4
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago