OSDN Git Service

big boom
[bytom/Bytom-JS-SDK.git] / src / api / accounts.js
1 function accountsApi(http) {
2     this.http = http;
3 }
4
5 /**
6  * Create a new account.
7  * 
8  * @see https://github.com/Bytom/bytom/wiki/API-Reference#create-account
9  * 
10  * @param {Array of String} xpubs - root_xpubs, pubkey array.
11  * @param {Integer} quorum - The number of keys required to sign transactions for the account.
12  * @param {String} alias  - Account alias.
13  */
14 accountsApi.prototype.create = function(xpubs, quorum, alias) {
15     return this.http.request('/create-account', {root_xpubs: xpubs, quorum, alias});
16 };
17
18 /**
19  * List all accounts in the target Bytom node.
20  */
21 accountsApi.prototype.listAll = function() {
22     return this.http.request('/list-accounts', {});
23 };
24
25 /**
26  * List all addresses for one account.
27  * 
28  * @param {String} accountId - id of account.
29  */
30 accountsApi.prototype.listAddressesById = function(accountId) {
31     return this.http.request("/list-addresses", {account_id: accountId});
32 };
33
34 /**
35  * List all addresses for one account.
36  * 
37  * @param {String} accountAlias - alias of account.
38  */
39 accountsApi.prototype.listAddressesByAlias = function(accountAlias) {
40     return this.http.request("/list-addresses", {account_alias: accountAlias});
41 };
42
43 export default accountsApi;