Name: cosmos-sdk-js
Owner: COSMOS
Description: JavaScript client for the Cosmos SDK API
Created: 2017-07-27 18:24:53.0
Updated: 2018-03-15 14:37:59.0
Pushed: 2017-12-30 03:08:11.0
Size: 21
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
JavaScript client for the Cosmos SDK API
install --save cosmos-sdk
s
client = require('cosmos-sdk')('http://localhost:45512')
reate a key
key = await client.generateKey({ name: 'matt', passphrase: 'top secret' })
uild a transaction
tx = await client.build('send', {
: key.address,
ount: { amount: 12345, denom: 'mycoin' },
e: { amount: 23, denom: 'atom' }
ow sign the tx
signedTx = await client.sign({ tx, name: 'judd', password: 'other top secret' })
end the signed transaction to the node to send out to other nodes
result = await client.send(tx)
uery account
queryResult = await query({
pe: 'account',
ta: 'sigs:BDADF167E6CF2CDF2D621E590FF1FED2787A40E0'
ole.log(result)
"height": 1170,
"data": {
"coins": [
{
"denom": "mycoin",
"amount": 12345
}
]
}