Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
add account creation
Browse files Browse the repository at this point in the history
change hashing
  • Loading branch information
Rovak committed Apr 8, 2018
1 parent 69b2fcb commit 35829c1
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 344 deletions.
12 changes: 11 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"license": "GPL-3.0",
"dependencies": {
"axios": "^0.18.0",
"crypto-js": "^3.1.9-1",
"elliptic": "^6.4.0",
"google-protobuf": "^3.5.0",
"grpc": "^1.10.0",
Expand Down
12 changes: 5 additions & 7 deletions src/client/http.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
const xhr = require("axios");
const byteArray2hexStr = require("../utils/bytes").byteArray2hexStr;
const deserializeTransaction = require("../protocol/serializer").deserializeTransaction;
const bytesToString = require("../utils/bytes").bytesToString;
const {base64DecodeFromString} = require("../utils/bytes");
const {base64DecodeFromString, byteArray2hexStr, bytesToString} = require("../utils/bytes");
const {Block, Transaction, Account} = require("../protocol/core/Tron_pb");
const {AccountList, NumberMessage, WitnessList, AssetIssueList} = require("../protocol/api/api_pb");
const {TransferContract} = require("../protocol/core/Contract_pb");
const qs = require("qs");
const stringToBytes = require("../lib/code").stringToBytes;
const passwordToAddress = require("../utils/crypto").passwordToAddress;
const { signTransaction } = require("../utils/crypto");
const { signTransaction, passwordToAddress } = require("../utils/crypto");

class HttpClient {

Expand Down Expand Up @@ -138,6 +135,7 @@ class HttpClient {

return {
address: byteArray2hexStr(witness.getAddress()),
url: witness.getUrl(),
latestBlockNumber: witness.getLatestblocknum(),
producedTotal: witness.getTotalproduced(),
missedTotal: witness.getTotalmissed(),
Expand Down Expand Up @@ -177,9 +175,9 @@ class HttpClient {
* @returns {Promise<*>}
*/
async getAccountBalances(address) {
let {data} = await xhr.post(`${this.url}/queryAccount`, {
let {data} = await xhr.post(`${this.url}/queryAccount`, qs.stringify({
address,
});
}));

let bytesAccountInfo = base64DecodeFromString(data);
let accountInfo = Account.deserializeBinary(bytesAccountInfo);
Expand Down
309 changes: 0 additions & 309 deletions src/lib/sha3.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/protocol/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ function deserializeTransaction(tx) {
for (let contract of contractList) {
let any = contract.getParameter();

console.log(contract.getType());

switch (contract.getType()) {

case contractType.ACCOUNTCREATECONTRACT: {
Expand Down
Loading

0 comments on commit 35829c1

Please sign in to comment.