@@ -7,19 +7,23 @@ import {connect} from "react-redux";
77import { Table } from "../components-ui/Table" ;
88import { WalletGenerate } from "./GatewayApplicationWalletGenerate" ;
99import {
10- generateGatewayApplicationWallet ,
10+ exportApplicationWalletPrivateKey ,
11+ generateGatewayApplicationWallet , importGatewayApplicationWallet ,
1112 removeGatewayApplicationWallet
1213} from "../actions/gateway-wallet" ;
1314
1415import { getGatewayWalletSelector } from "../selectors/getGatewayWalletsSelector" ;
1516
1617import { GatewayApplicationWalletRemove } from "./GatewayApplicationWalletRemove" ;
18+ import { GatewayApplicationWalletPrivateKey } from "./GatewayApplicationWalletPrivateKey" ;
19+ import { WalletImport } from "./GatewayApplicationWalletImport" ;
20+ import { OpenScanLink } from "../components-ui/OpenScanLink" ;
1721
18- const getColumns = ( wallets , onRemove ) => [
22+ const getColumns = ( wallets , onRemove , onExport ) => [
1923 {
2024 Header : 'Wallet Address' ,
2125 accessor : 'address' ,
22- Cell : ( { value } ) => < EtherscanLink > { value } </ EtherscanLink > ,
26+ Cell : ( { value } ) => < OpenScanLink > { value } </ OpenScanLink > ,
2327 sortable : false
2428 } ,
2529 {
@@ -39,6 +43,17 @@ const getColumns = (wallets, onRemove) => [
3943 </ span >
4044 ) ,
4145 sortable : false
46+ } ,
47+ {
48+ Header : '' ,
49+ accessor : 'address' ,
50+ width : 150 ,
51+ Cell : ( props ) => (
52+ < span >
53+ < GatewayApplicationWalletPrivateKey onSubmit = { ( ) => onExport ( props . row . _original . address , props . row . _original . blockchain ) } />
54+ </ span >
55+ ) ,
56+ sortable : false
4257 }
4358] ;
4459
@@ -49,19 +64,28 @@ class GatewayApplicationWalletComponent extends React.Component {
4964 return this . props . removeGatewayApplicationWallet ( gateway . id , address ) ;
5065 } ;
5166
67+ onExportPrivateKey = ( address , blockchain ) => {
68+ return this . props . exportApplicationWalletPrivateKey ( address , blockchain ) ;
69+ }
70+
5271 onGenerateWallet = blockchain => {
5372 const { gateway } = this . props ;
5473 this . props . generateGatewayApplicationWallet ( { applicationId : gateway . id , webHook : gateway . webHook } , blockchain ) ;
5574 }
5675
76+ onImportWallet = walletImport => {
77+ this . props . importGatewayApplicationWallet ( walletImport . walletRequest , { address : walletImport . address , blockchain : walletImport . blockchain } ) ;
78+ }
79+
5780 render ( ) {
5881 const { wallets, gateway } = this . props ;
5982
60- const columns = getColumns ( wallets . list , this . onRemoveWallet ) ;
83+ const columns = getColumns ( wallets . list , this . onRemoveWallet , this . onExportPrivateKey ) ;
6184 const noDataText = 'No Wallet exist'
6285 return (
6386 < div className = "table-with-add" >
6487 < WalletGenerate gateway = { gateway } onSubmit = { this . onGenerateWallet } />
88+ < WalletImport gateway = { gateway } onSubmit = { this . onImportWallet } />
6589 < Segment attached styles = { { padding : 0 } } >
6690 < Table data = { wallets . list } columns = { columns } noDataText = { noDataText } />
6791 </ Segment >
@@ -70,7 +94,7 @@ class GatewayApplicationWalletComponent extends React.Component {
7094 }
7195}
7296
73- const mapStateToProps = ( state , { gateway } ) => {
97+ const mapStateToProps = ( state , { gateway} ) => {
7498 const wallets = getGatewayWalletSelector ( state , gateway . id ) ;
7599 return { gateway, wallets } ;
76100} ;
@@ -79,6 +103,8 @@ export const GatewayApplicationWallet = connect(
79103 mapStateToProps ,
80104 {
81105 generateGatewayApplicationWallet,
82- removeGatewayApplicationWallet
106+ importGatewayApplicationWallet,
107+ removeGatewayApplicationWallet,
108+ exportApplicationWalletPrivateKey
83109 }
84110) ( GatewayApplicationWalletComponent ) ;
0 commit comments