钱包相关
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);