OSDN Git Service

add account api
authorYongfeng LI <wliyongfeng@gmail.com>
Fri, 11 May 2018 05:55:45 +0000 (13:55 +0800)
committerYongfeng LI <wliyongfeng@gmail.com>
Fri, 11 May 2018 05:55:45 +0000 (13:55 +0800)
src/api/account.js [new file with mode: 0644]
src/client.js

diff --git a/src/api/account.js b/src/api/account.js
new file mode 100644 (file)
index 0000000..197aba7
--- /dev/null
@@ -0,0 +1,39 @@
+import ApiBase from './base'
+
+class Account {
+  constructor(connection) {
+    this.connection = connection
+  }
+
+  create(xpubs, quorum, alias) {
+    this.connection.request('/create-account', {
+      root_xpubs: xpubs,
+      quorum,
+      alias
+    })
+  }
+
+  listAccounts(id) {
+    this.connection.request('/list-accounts', {id})
+  }
+
+  createReceiverById(accountId) {
+    this.connection.request('/create-account-receiver', {
+      account_id: accountId
+    })
+  }
+
+  listAddressesById(accountId) {
+    this.connection.request('/list-addresses', {
+      account_id: accountId
+    })
+  }
+
+  deleteById(id) {
+    this.connection.request('/delete-account', {
+      account_info: id
+    })
+  }
+}
+
+export default Account
index 3bfb79a..c747356 100644 (file)
@@ -1,8 +1,11 @@
 import Connection from 'connection'
+import Account from 'api/account'
 
 class Client {
   constructor(baseUrl, token) {
     this.connection = new Connection(baseUrl, token)
+
+    this.account = new Account(this.connection)
   }
 }