2.0.0 • Published 3 years ago

tronapi-node v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Tronapi nodejs client.

这是 tronapinode.js 开发包。用于简化商户接入 tronapi 的接口服务。

链接

安装

$ npm install tronapi-node --save

使用

const Tronapi = require('tronapi-node');
const client = new Tronapi({
  public_key: 'your public key',
  private_key: 'your private key',
});

订单

  • 订单创建

接口文档:https://doc.tronapi.com/api/transaction/create.html

  client.transaction.create({
    amount: 100,
    currency: 'CNY', // CNY or USD
    coin_code: 'USDT', // 固定为 USDT
    order_id: 'your order id',
  }).then((res)=> {
    console.info('res:', res); // 订单数据
  });
  • 订单查询

接口文档:https://doc.tronapi.com/api/transaction/query.html

  client.transaction.query({
    token: 'your transaction token'
  }).then((res)=> {
    console.info('res:', res); // 订单状态
  });

收款地址

  • 收款地址查询

接口文档:https://doc.tronapi.com/api/address/query.html

  client.address.list().then((res)=> {
    console.info('res:', res); // 地址信息
  });
  • 收款地址配置

接口文档:https://doc.tronapi.com/api/address/add.html

  client.address.add('your wallet address').then((res)=> {
    console.info('res:', res); // 操作结果
  });
  • 收款地址生成

接口文档:https://doc.tronapi.com/api/address/generate.html

  client.address.generate().then((res)=> {
    console.info('res:', res); // 地址信息
  });
  • 收款地址生成 & 替换

接口文档:https://doc.tronapi.com/api/address/generate_add.html

  client.address.generate_add().then((res)=> {
    console.info('res:', res); // 地址信息
  });

账户

  • 余额查询

接口文档:https://doc.tronapi.com/api/account/balance.html

  client.account.balance().then((res)=> {
    console.info('res:', res); // 账户信息
  });

测试

配置 test/client.js 中的 public_key & private_key,然后执行:

npm run test

or

npm run test-cov

联系

  • 可通过 官网 右下角 反馈功能和我们取得联系。
  • telegram: jackslowfak
2.0.0

3 years ago

1.0.0

3 years ago