Comparing version 2.2.3 to 2.3.0
{ | ||
"name": "basecoin", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"description": "Client for Tendermint's basecoin cryptocurrency", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,5 +47,5 @@ 'use strict' | ||
if (err) return this.emit('error', err) | ||
let { block } = event[1].data[1] | ||
block.data.txs = block.data.txs.map((txHex) => { | ||
let txBytes = Buffer.from(txHex, 'hex') | ||
let { block } = event.data.data | ||
block.data.txs = block.data.txs.map((txBase64) => { | ||
let txBytes = Buffer.from(txBase64, 'base64') | ||
return Tx.decode(txBytes) | ||
@@ -66,3 +66,2 @@ }) | ||
let res = yield this.rpc.status(next) | ||
// let appHash = Buffer.from(res[1].latest_app_hash, 'hex') | ||
@@ -72,21 +71,8 @@ // TODO: use js-merkleeyes | ||
path: '/key', | ||
data: key.toString('hex'), | ||
data: key.toString('base64'), | ||
prove: true | ||
}, next) | ||
// let proof = Buffer.from(res[1].response.proof, 'hex') | ||
if (!res[1].response.value) return null | ||
let accountBytes = Buffer.from(res[1].response.value, 'hex') | ||
// let proofHeight = res[1].response.height | ||
if (!res.response.value) return null | ||
let accountBytes = Buffer.from(res.response.value, 'base64') | ||
// TODO: verify proofs | ||
// res = yield this.crypto.verifyMerkleProof(proof, next) | ||
// if (!res.isValid) { | ||
// throw Error('Account proof is invalid') | ||
// } | ||
// if (!res.rootHash.equals(appHash)) { | ||
// throw Error(`Proof contains incorrect root: | ||
// current app hash: ${appHash.toString('hex')} | ||
// proof root hash: ${res.rootHash.toString('hex')}`) | ||
// } | ||
let account = Account.decode(accountBytes) | ||
@@ -100,3 +86,3 @@ if (account.key && !account.key.address().equals(address)) { | ||
* sendTx (tx, next) { | ||
let txBytes = Tx.encode(tx).toString('hex') | ||
let txBytes = Tx.encode(tx).toString('base64') | ||
return yield this.rpc.broadcastTxCommit({ tx: txBytes }, next) | ||
@@ -118,3 +104,3 @@ } | ||
maxHeight: 1e10 | ||
}, next))[1].block_metas | ||
}, next)).block_metas | ||
if (headers.length === 0) { | ||
@@ -134,5 +120,5 @@ headers.height = from | ||
txs.height = height | ||
for (let [ , { block } ] of blocks) { | ||
for (let { block } of blocks) { | ||
for (let txBytes of block.data.txs) { | ||
let tx = Tx.decode(Buffer.from(txBytes, 'hex')) | ||
let tx = Tx.decode(Buffer.from(txBytes, 'base64')) | ||
if (isTxRelevant(tx, addrs)) { | ||
@@ -139,0 +125,0 @@ tx.time = new Date(block.header.time).getTime() |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107507
699