OSDN Git Service

fix accountsApi
authorYongfeng LI <wliyongfeng@gmail.com>
Mon, 14 May 2018 02:44:08 +0000 (10:44 +0800)
committerYongfeng LI <wliyongfeng@gmail.com>
Mon, 14 May 2018 02:44:08 +0000 (10:44 +0800)
src/api/accounts.js

index 196f6fb..0a266e6 100644 (file)
@@ -54,13 +54,11 @@ const Accounts = (connection) => {
      * @param {module:AccountsApi~alias} alias - Account alias.
      * @returns {Promise<Response>} Newly created account response.
      */
-    create(xpubs, quorum, alias) {
-      this.connection.request('/create-account', {
-        root_xpubs: xpubs,
-        quorum,
-        alias
-      })
-    },
+    create: (xpubs, quorum, alias) => connection.request('/create-account', {
+      root_xpubs: xpubs,
+      quorum,
+      alias
+    }),
 
     /**
      * List accounts whose id starts with the given id.
@@ -68,9 +66,7 @@ const Accounts = (connection) => {
      * @param {module:AccountsApi~id} id - Account id prefix.
      * @return {Promise<Response>} target accounts response.
      */
-    listAccounts(id) {
-      this.connection.request('/list-accounts', {id})
-    },
+    listAccounts: (id) => connection.request('/list-accounts', {id}),
 
     /**
      * Create account receiver.
@@ -78,32 +74,20 @@ const Accounts = (connection) => {
      * @param {module:AccountsApi~id} accountId - Id for the target account.
      * @return {Promise<Response>} target receiver response.
      */
-    createReceiverById(accountId) {
-      this.connection.request('/create-account-receiver', {
-        account_id: accountId
-      })
-    },
+    createReceiverById: (accountId) => connection.request('/create-account-receiver', {account_id: accountId}),
 
     /**
      * List all addresses for one account.
      * @param {module:AccountsApi~id} accountId - Id for the target account.
      * @return {Promise<Response>} target addresses response.
      */
-    listAddressesById(accountId) {
-      this.connection.request('/list-addresses', {
-        account_id: accountId
-      })
-    },
+    listAddressesById: (accountId) => connection.request('/list-addresses', {account_id: accountId}),
 
     /**
      * Delete account.
      * @param {module:AccountsApi~id} id - Target account id.
      */
-    deleteById(id) {
-      this.connection.request('/delete-account', {
-        account_info: id
-      })
-    }
+    deleteById: (id) => connection.request('/delete-account', {account_info: id})
   }
 }