PRESS.one 开发者社区

PRESS.one 开发者社区

  • 文档
  • 博客
  • 开发者论坛

›Node.js SDK 文档

指南

  • 简介
  • DApp 开发流程
  • 创建 DApp
  • 数字签名相关知识
  • PRS 协议

REST API 文档

  • 概述
  • API 鉴权
  • 用户授权
  • 获取数字签名
  • 签名文件相关
  • 合约相关
  • 钱包相关

Node.js SDK 文档

  • SDK 安装
  • 用户授权
  • 签名文件相关
  • 合约相关
  • 钱包相关

钱包相关

  • Finance#getWallet
  • Finance#getTransactions
  • Finance#deposit
  • Finance#withdraw

getWallet

获取用户的钱包信息。

getWallet()

Example

const client = new PRS({ env: 'env', debug: true, address: authAddress, token: token });
const walletRes = await client.finance.getWallet();

getTransactions

获取用户的交易记录。

getTransactions(pageOpts)
interface pageOpts{
  limit: number;
  offset: number;
}

Example

const transactionsRes = await client.finance.getTransactions({ offset: 0, limit: 1 });

deposit

通过 mixin 为用户充值。

deposit(amount)
  • amount: 充值金额。

Example

const rechargeRes = await client.finance.recharge(1);

Response

{
    "receipt": {
        "id": 10454,
        "fromAddress": "24bb85b2a2e72af849e8a83e9f2fce1d7f9f6685",
        "toAddress": "24bb85b2a2e72af849e8a83e9f2fce1d7f9f6685",
        "type": "RECHARGE",
        "currency": "CNB",
        "amount": "1.000000000000000000000000000000",
        "memo": "Recharge from MIXIN",
        "forFileHash": null,
        "status": "INITIALIZED",
        "createdAt": "2019-03-12T01:03:37.000Z",
        "updatedAt": "2019-03-12T01:03:37.000Z",
        "uuid": "aa9bc5d0-4462-11e9-bf4a-a31b15186109",
        "provider": "MIXIN",
        "raw": null,
        "snapshotId": null,
        "fromProviderUserId": null,
        "objectType": "",
        "toProviderUserId": "baa759f5-4c21-36c0-884d-d74485525429",
        "toSnapshotId": null,
        "toRaw": null,
        "forOrder": null,
        "comment": null,
        "forFileRId": null,
        "viewToken": null,
        "paymentUrl": "https://mixin.one/pay?recipient=baa759f5-4c21-36c0-884d-d74485525429&asset=965e5c6e-434c-3fa9-b780-c50f43cd955c&amount=1&trace=aa9bc5d0-4462-11e9-bf4a-a31b15186109&memo=Recharge%20from%20MIXIN"
    }
}
  • paymentUrl: 用户的充值页面,目前支持 mixin 充值。打开此页面,用户使用 mixin 扫码即可充值。

withdraw

提现接口,如果用户的在 PRS 网站上绑定了 Mixin,那么即可直接提现至用户的 Mixin 账户。

withdraw(amount);
  • amount: 提现的金额。

Example

const withdrawRes = await client.finance.withdraw(1);
← 合约相关
  • getWallet
  • getTransactions
  • deposit
  • withdraw
文档
介绍基础知识创建 DApp创建合约
社区
TwitterMedium微信公众号开发者论坛
更多
官方博客GitHub
Copyright © 2023 PRESSone