OSDN Git Service

create address when account create
authorZhiting Lin <zlin035@uottawa.ca>
Thu, 18 Jul 2019 07:26:35 +0000 (15:26 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Thu, 18 Jul 2019 07:26:35 +0000 (15:26 +0800)
src/features/accounts/actions.js
src/features/accounts/components/List.jsx
src/features/accounts/components/List.scss [new file with mode: 0644]
src/features/accounts/components/ListItem.jsx
src/features/initialization/actions.js
src/locales/en/translation.json
src/locales/zh/translation.json

index 54eb85c..fc07ed3 100644 (file)
@@ -84,7 +84,12 @@ const createAccount = (data) => {
 
             if(resp.status === 'success') {
               dispatch({type: 'SET_CURRENT_ACCOUNT', account: resp.data.alias})
-              dispatch(createSuccess() )
+              return chainClient().accounts.createAddress({'account_alias':resp.data.alias})
+                .then(() =>{
+                  dispatch(createSuccess() )
+                }).catch((err) => {
+                  throw ( err)
+                })
             }
           })
           .catch((err) => {
index f695a0b..6dcaa41 100644 (file)
@@ -3,6 +3,7 @@ import ListItem from './ListItem'
 import {withNamespaces} from 'react-i18next'
 import React from 'react'
 import { actions } from 'features/accounts'
+import styles from './List.scss'
 
 const type = 'account'
 
@@ -27,7 +28,8 @@ const mapStateToProps = (state, ownProps) => {
     ...BaseList.mapStateToProps(type, ListItem, {
       wrapperComponent: TableList,
       wrapperProps: {
-        titles: ownProps.t('account.formTitle',  { returnObjects: true })
+        titles: ownProps.t('account.formTitle',  { returnObjects: true }),
+        styles: styles.main
       }
     })(state)
   }
diff --git a/src/features/accounts/components/List.scss b/src/features/accounts/components/List.scss
new file mode 100644 (file)
index 0000000..8fbd6d9
--- /dev/null
@@ -0,0 +1,10 @@
+.main {
+  th, td {
+    &:nth-child(2) {
+      width: 40%;
+    }
+    &:nth-child(3) {
+      width: 15%;
+    }
+  }
+}
index e95c4cc..692572b 100644 (file)
@@ -7,6 +7,7 @@ class ListItem extends React.Component {
   render() {
     const item = this.props.item
     const t = this.props.t
+    const signStuct = `${item.quorum} of ${item.xpubs.length}`
 
     return(
       <tr className={styles.tr}>
@@ -16,6 +17,7 @@ class ListItem extends React.Component {
           </Link>
         </td>
         <td><code>{item.id}</code></td>
+        <td><code>{signStuct}</code></td>
         <td>
           {item.isUsed?
             <button className={`btn btn-default btn-sm ${styles.selectButton} ${styles.buttonDisable}`} disabled>
index dc053cd..20e346c 100644 (file)
@@ -32,7 +32,12 @@ const registerKey = (data) => {
 
             if(resp.status === 'success') {
               dispatch({type: 'SET_CURRENT_ACCOUNT', account: resp.data.alias})
-              dispatch(initSucceeded())
+              return chainClient().accounts.createAddress({'account_alias':resp.data.alias})
+                .then(() =>{
+                  dispatch(initSucceeded() )
+                }).catch((err) => {
+                  throw ( err)
+                })
             }
           })
           .catch((err) => {
index 4ddbfd0..e5e8360 100644 (file)
@@ -70,7 +70,7 @@
     "settings":"settings",
     "coreStatus":"Core status",
     "logout":"Log Out",
-    "backupRestore":"Backup and Restore",
+    "backupRestore":"Backup or Restore",
     "newTx":"Create a new transaction",
     "newAccount":"Create an account",
     "newKey":"Create a key",
   },
   "account":{
     "account":"Account",
-    "formTitle":["Account Alias", "Account ID"],
+    "formTitle":["Account Alias", "Account ID", "Signature Structure"],
     "accountXpub":"Account Xpub",
     "keyIndex":"Key Index",
     "address":"Addresses",
index 9bdc227..45c630d 100644 (file)
   },
   "account":{
     "account":"账户",
-    "formTitle":["账户别名","账户ID"],
+    "formTitle":["账户别名","账户ID","签名构成"],
     "accountXpub":"账户公钥",
     "keyIndex":"密钥索引",
     "address":"地址",