0.2.22 • Published 5 years ago

sdag.js v0.2.22

Weekly downloads
4
License
GPL-3
Repository
github
Last release
5 years ago

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();
MethodDescriptionReturn
connectConnect to a hubboolean
getJointGet a joint from hubPropertyJoint
getNetworkInfoGet the latest net infoNetworkInfo
getBalanceQuery the balance of specified addressBalance
getTxsByAddressQuery history txs of specified addressTransaction[]
getJointsByMciQuery joints by mciJoint[]
getJointsByLevelQuery joints between levelsJointLevel
getFreeJointsQuery free jointsJoint[]
transferTransfer assetsstring

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);
MethodDescriptionReturn
constructorThe mnemonic code is required
genAddressGenerate a address by indexstring
signSign unit hash when you transfer assetsstring
verifyVerify a signed stringboolean
ecdsaPubkeyGen a ecdsa pub key by indexstring
signMessageSign a text messagestring
verifyMessageVerify a text messageboolean

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