It provides json rpc communication interface and development library with symverse blockchain, rpc api.
npm i symjs
yarn add symjs
A minified, browserified file dist/symjs.js
is included for use in the browser. Including this file simply attaches the symjs
object to window:
<script src='dist/symjs.js'></script>
Use the symjs object directly from the global namespace:
console.log(SymJs) // { utils: ...}
const symjs = new SymJs();
console.log(symjs); // {network: ..., utils: ..., signer: ...}
Network connect(symverse rpc
)
const symjs = new SymJs();
symjs.network.connect("http://localhost:8001").then(connectedMessage => {
console.log(connectedMessage, 'connect success...')
}).catch(e => {
// connected fail...
})
There you go, now you can use it:
// Return Promise Object By Json RPC
symjs.network.call.getBalance(address);
symjs.network.call.clientVersion();
- Send Raw Transaction example:
let privateKey = "1a43aa399cb2efe186317e0b09f4a7ef88b83cff05089b145709881bf4db3a20"
let params = {
from:"0x00021000000000010002",
nonce: 210,
gasPrice: 1000000000000,
gasLimit: 41000,
to: "0x00021000000000020002",
value: 5,
workNodes: ["0x00021000000000010002"],
chainId: 7777 //require
};
// Return Promise Object By Json RPC
symjs.network.call.sendTransaction(params, privateKey);
- Send SCT Raw Transaction example:
//sct input tools
symjs.param.sct20.create("HI","asd", 12323, "0x00021000000000010002")
symjs.param.sct20.transfer(to, amount)
symjs.param.sct20.transferFrom(from, to, amount)
symjs.param.sct20.approve(to, amount)
symjs.param.sct21 ...
symjs.param.sct30 ...
symjs.param.sct40 ...
...
let privateKey = "1a43aa399cb2efe186317e0b09f4a7ef88b83cff05089b145709881bf4db3a20"
let params = {
from: "0x00021000000000010002",
nonce: 214,
gasPrice: '0x09184e72a000000',
gasLimit: '0x271000',
workNodes: ["0x00021000000000010002"],
type: 1,
input: "0x"+symjs.param.sct20.create("HI","asd", 12323, "0x00021000000000010002").raw(),
chainId: 7777
};
// Return Promise Object By Json RPC
symjs.network.call.sendTransaction(params, privateKey);
- Citizen api call example:
// Return Promise Object By Json RPC
let citizenInfo = await symjs.network.call.citizen.getCitizenBySymID("0x00021000000000010002")
let count = await symjs.network.call.citizen.getCitizenCount()
- Warrant api call example:
// Return Promise Object By Json RPC
let blockNumber = await symjs.network.call.warrant.blockNumber()
- Sct api call example:
// Return Promise Object By Json RPC
let constract = await symjs.network.call.sct.getContract("0x4523ad7875a9c41e9629")
let account = await symjs.network.call.sct.getContractAccount("0x4523ad7875a9c41e9629", "0x00021000000000010002")
https://www.symverse.com/
Please contact us on this page.