Giter Club home page Giter Club logo

node-wallet-api's Introduction

node-wallet-api

Node.js Wallet API for the Tron Protocol

How to UseLinksWikiCommunity

How to use

Requirements

  • Node v9.8.0

Running tests

Running the tests requires an active wallet-cli application. Check out to the readme to get it up and running.

When there is a running wallet-cli application use npm to run the tests

> npm test

Usage

Install the package

> npm install @tronprotocol/wallet-api

Use the HTTP Client

import {HttpClient} from "@tronprotocol/wallet-api";

const Client = new HttpClient();

let latestBlock = await Client.getLatestBlock();

Community

Links

Projects

node-wallet-api's People

Contributors

rovak avatar zergweak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-wallet-api's Issues

How to compute transaction id?

Hi, I wanna know how to compute the transaction hash from a Transaction instance.

I have tried

const hash = byteArray2hexStr(SHA256(tx.getRawData().serializeBinary()));

Because of this implementation in java-tron

System.out.println(
  "txid = " + ByteArray.toHexString(Hash.sha256(transaction.getRawData().toByteArray())));

But my output is different what is in the blockchain.

For example

Transaction hex from byteArray2hexStr(tx.serializeBinary())
0A8A010A024FAB22089DFE403B668BE88E4088AAA3A8BB2C5A69080112650A2D747970652E676F6F676C65617069732E636F6D2F70726F746F636F6C2E5472616E73666572436F6E747261637412340A15A099357684BC659F5166046B56C95A0E99F1265CBD1215A0F8B3D67B96E807B2525E81A6C443C1C6BE00BF1F1880C8AFA0257080F6D6EB879BEA991512410BA65ABC419ED352FD5377A2D02FCE64556ABC6BF10F713A7652C9B2E42DE4F0BC560CA4BFF285BCBCF23A3DA7EAC95CA3B26CBB7BE642060717D7BCAEAA26DC00
My output is
22F1D5CA7C3A6CBC119C294454238340810DCF8651747CB0D53C381E6A6B3E79
The correct one is
5ab4e286e2f8eda49beef85dd662ca76eb68fd4ec26b85d13b4cfb422e5a55eb

API error in http.js

TypeError: Cannot read property 'getRawData' of undefined at HttpClient.getBlockByNum(http.js:70)

image
image

Publish package to NPM

Publish the Wallet API so it can be installed using NPM

Installation

npm install @tronprotocol/wallet-api

Usage

import {Client} from "@tronprotocol/wallet-api";

let nodes = await Client.getNodes();

Implement full Wallet GRPC API

  • rpc GetAccount (Account) returns (Account)
  • rpc CreateTransaction (TransferContract) returns (Transaction)
  • rpc BroadcastTransaction (Transaction) returns (Return)
  • rpc ListAccounts (EmptyMessage) returns (AccountList)
  • rpc CreateAccount (AccountCreateContract) returns (Transaction)
  • rpc VoteWitnessAccount (VoteWitnessContract) returns (Transaction)
  • rpc CreateAssetIssue (AssetIssueContract) returns (Transaction)
  • rpc ListWitnesses (EmptyMessage) returns (WitnessList)
  • rpc UpdateWitness (WitnessUpdateContract) returns (Transaction)
  • rpc CreateWitness (WitnessCreateContract) returns (Transaction)
  • rpc TransferAsset (TransferAssetContract) returns (Transaction)
  • rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction)
  • rpc ListNodes (EmptyMessage) returns (NodeList)
  • rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList)
  • rpc GetAssetIssueByAccount (Account) returns (AssetIssueList)
  • rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract)
  • rpc GetNowBlock (EmptyMessage) returns (Block)
  • rpc GetBlockByNum (NumberMessage) returns (Block)

Implement HTTP Api

Add a client which communicates with the REST API of the wallet-cli project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.