diff --git a/publickey.json b/publickey.json
index 8c9ac42..aba8204 100644
--- a/publickey.json
+++ b/publickey.json
@@ -1,14 +1,41 @@
{
- "AccountPublicKey": "2EdJJzcrKrB9DXypghbR1npqyZMPYEnT43oix6Abgw7S",
- "AccountSecreKey": "107,143,235,119,147,182,152,17,156,227,125,249,233,187,154,227,103,199,194,228,106,30,131,224,186,254,206,128,134,22,226,90,18,89,71,189,125,161,45,49,164,0,229,88,172,190,118,118,43,92,6,164,3,212,226,196,162,140,148,167,62,70,23,165",
- "TokenPublicKeys": [
+ "AccountPublicKey": "14jeK98twjZyT8meztwMjSYksUBVyDRviLpXuYq5pYcg",
+ "AccountSecreKey": "219,203,94,212,53,215,133,116,178,105,38,209,213,95,235,33,180,241,47,179,111,38,216,39,80,187,189,230,182,64,201,145,0,244,245,154,96,31,90,100,168,153,92,147,192,58,153,92,169,178,213,163,229,114,17,108,170,168,4,2,118,155,186,201",
+ "TokenInfos": [
{
- "tokenpubkey": "4m4GriqBUKxx41JkNwfma1SABCjP7qaevqYMzW3zwzJQ",
- "tokenaccountpubkey": "JAjpqyGW23drjFz8avUPzuvnsW9ScvGyFzq2J9ydVG2k"
+ "tokenpubkey": "HgcdmBE1jLZDpKNt9p75vm8UCy5oyuNZYZBpReA7Q66R",
+ "tokenaccpubkey": "ALDYPuzk9W53tnEaU416PcdkGaXm2QcBHSAVyfAeTw5b",
+ "tokenlogo": "bit_up.png",
+ "tokenname": "DDUP"
},
{
- "tokenpubkey": "Br5EfPGUT9yP5QkDVkVAkzC6r75JpQSCuMKfPBE4D95X",
- "tokenaccountpubkey": "DoxzTmaUixUzSPbNYQ353ZPExkaYitW26oQ96QoZGsng"
+ "tokenpubkey": "4PbYRiMmzNiDaNNQ8aU9cJj8JGtTHmRVB4DtH7tJBbFD",
+ "tokenaccpubkey": "6367umXQG2j17i5TtCKWwGxP3UhQeaFZPrKXMnxsfmqr",
+ "tokenlogo": "bit_mz.png",
+ "tokenname": "ASC"
+ },
+ {
+ "tokenpubkey": "7PYPxAXpXPTCM7irxPGyTFq1tL1tmn9AwG44bG5wYV94",
+ "tokenaccpubkey": "78RJmchAmsFbjbhkDTfwL4vLJR3AAUifGHTczvWjMbeM",
+ "tokenlogo": "bit_pet.png",
+ "tokenname": "PET"
+
+ },
+
+ {
+ "tokenpubkey": "5weo8mfVbeuZtLqVfDdiiiCPM1AbyYntGLFjCJsxMwx3",
+ "tokenaccpubkey": "Gxxqku8s84BxiajLcEuy9C4iy3ArzcG83HDSiMM8szFF",
+ "tokenlogo": "bit_ttc.png",
+ "tokenname": "TTC"
+
+ },
+ {
+ "tokenpubkey": "24yq6uEXs4KbFPTVLHXtdgJeYrNjZU1Vsj7RTPvnMNnr",
+ "tokenaccpubkey": "7UpAWpEK3wN35bhx2dhYVT8a6dgXKQX4rULHrkAhgq5J",
+ "tokenlogo": "bit_pyh.png",
+ "tokenname": "PYH"
+
}
+
]
}
diff --git a/src/appwallet.js b/src/appwallet.js
index 0ebbd17..1eb30d3 100755
--- a/src/appwallet.js
+++ b/src/appwallet.js
@@ -11,21 +11,21 @@ import {
// OverlayTrigger,
ProgressBar,
// Tooltip,
- DropdownButton,
- MenuItem,
} from 'react-bootstrap';
import PropTypes from 'prop-types';
import copy from 'copy-to-clipboard';
import * as web3 from '@bitconch/bitconch-web3j';
import {Settings} from './settings';
-import data from '../publickey.json';
+import {PropertyDetail} from './detail';
+import info from '../publickey.json';
import Background from './images/account_backgroud.png';
import CopyIcon from './images/address_copy.png';
-import TransferIcon from './images/account_change.png';
-
+import TransferIcon from './images/main_right.png';
+import AddIcon from './images/main_jia.png';
+import SelectOn from './images/selecte_on.png';
+import SelectOff from './images/selecte_off.png';
const AIRDORP_QUOTA = 3000;
-
var sectionStyle = {
height: '250px',
width: '100%',
@@ -36,21 +36,48 @@ var sectionStyle = {
var lineStyle = {
height: '0.5px',
backgroundColor: '#b8b6b6',
- marginLeft:'10px'
+ marginLeft:'10px',
+ width:'100%'
};
+//定义一个Section子组件
+class PropertyAdd extends React.Component{
+ //接收父组件传递过来的item
+ render(){
+ return(
+
+
+ );
+ }
+}
+
+//
+PropertyAdd.propTypes = {
+ icondisabled: PropTypes.object,
+ addproperty:PropTypes.function,
+ requestairdrop:PropTypes.function,
+};
//定义一个Section子组件
class PropertySection extends React.Component{
//接收父组件传递过来的item
render(){
return(
-
+
-
@@ -60,165 +87,176 @@ class PropertySection extends React.Component{
);
}
}
-
-//
PropertySection.propTypes = {
tokenLogo: PropTypes.object,
tokenName: PropTypes.object,
tokenAmount: PropTypes.object,
transferAccounts:PropTypes.function,
};
+
+class PropertySelect extends React.Component{
+ state = {
+ imageurl: this.props.tokenselected == false? SelectOff:SelectOn
+ }
+ render(){
+ return(
+
+
})
+
+
+
+
+
+ );
+ }
+}
+
+//
+PropertySelect.propTypes = {
+ tokenLogo: PropTypes.object,
+ tokenName: PropTypes.object,
+ selected: PropTypes.function,
+ switchOn: PropTypes.object,
+ buttonId: PropTypes.object,
+ tokenselected: PropTypes.object
+};
+class PropertyList extends React.Component {
+ componentDidMount() {
+ console.log('sssssss:',this.props.tokenNameArray);
+ }
+ render() {
+ return (
+
+ {
+ this.props.tokenNameArray.map((obj,index) => {
+ console.log('obj======',obj);
+ return(
+
+ );
+ })
+ }
+
+ );
+ }
+}
+PropertyList.propTypes = {
+ tokenNameArray: PropTypes.object,
+};
class TokenAsset extends React.Component {
state = {
- value: '',
- validationState: null,
- tokenInfo: null,
- tokenNameArray: [],
+ tokenNameArray: []
};
constructor(props) {
super(props);
this.readPublicKeyFromFile();
}
+ AddTokenNameArray(){
+ this.props.onTokenAsset(this.state.tokenNameArray);
+ console.log('第一步:::::::',this.state.tokenNameArray);
+ }
+ //
async readPublicKeyFromFile() {
- try {
- String.format = function(src){
- if (arguments.length == 0) return null;
- var args = Array.prototype.slice.call(arguments, 1);
- return src.replace(/\{(\d+)\}/g, function(m, i){
- return args[i];
- });
- };
-
- var i;
- // var tem = '';
- // var msg = '';
- var arrToken = [];
- for(i = 0; i < data.TokenPublicKeys.length; i++) {
- var tokenpubkey = new web3.PublicKey(data.TokenPublicKeys[i].tokenpubkey);
- var token = new web3.Token(this.props.conn, tokenpubkey);
- var acc = await token.tokenInfo();
- var tokenname = acc.name;
- var tokensymbol = acc.symbol;
- var tokensupply = acc.supply;
- var tokendecimal = acc.decimals;
-
- // tem += ' 代币名称: {' + i + '} ';
-
- var tokenaccpubkey = data.TokenPublicKeys[i].tokenaccountpubkey;
- var accTokenInfo = await token.accountInfo(new web3.PublicKey(tokenaccpubkey));
-
- // tem += '余额: ' + accTokenInfo.amount;
-
- arrToken.push({
- tokenpubkey,
- tokenname,
- tokensymbol,
- tokensupply,
- tokendecimal,
- tokenaccpubkey,
- accTokenInfo
- });
+ var TokensArray = this.props.publickey;
+ var weekArray = await JSON.parse(localStorage.getItem(TokensArray));
+ if (weekArray&&weekArray.length>0) {
+ console.log('weekArray:',weekArray);
+ this.setState({tokenNameArray: weekArray});
+ }else{
+ try {
+ String.format = function(src){
+ if (arguments.length == 0) return null;
+ var args = Array.prototype.slice.call(arguments, 1);
+ return src.replace(/\{(\d+)\}/g, function(m, i){
+ return args[i];
+ });
+ };
+ var i;
+ var arrToken = [];
+ for(i = 0; i < info.TokenInfos.length; i++) {
+ console.log('tokenpubkey==',info.TokenInfos[i].tokenpubkey);
+ var tokenpubkey = new web3.PublicKey(info.TokenInfos[i].tokenpubkey);
+ //根据tokenpublickey获取token信息
+ var token = new web3.Token(this.props.conn, tokenpubkey);
+ var acc = await token.tokenInfo();
+ var tokenname = acc.name;
+ var tokensymbol = acc.symbol;
+ var tokensupply = acc.supply;
+ var tokendecimal = acc.decimals;
+ var tokenlogo = info.TokenInfos[i].tokenlogo;
+ var tokenselected = false;
+ var tokenaccpubkey = '';
+ var tokenamount = '10';
+ var tokenpublickey = info.TokenInfos[i].tokenpubkey;
+
+ // tem += ' 代币名称: {' + i + '} ';
+ //根据tokenaccoutpublickey获取余额
+ // var tokenaccpubkey = data.TokenPublicKeys[i].tokenaccountpubkey;
+ // var accTokenInfo = await token.accountInfo(new web3.PublicKey(tokenaccpubkey));
+
+ // tem += '余额: ' + accTokenInfo.amount;
+
+ arrToken.push({
+ tokenpublickey,
+ tokenaccpubkey,
+ tokenname,
+ tokensymbol,
+ tokensupply,
+ tokendecimal,
+ tokenlogo,
+ tokenselected,
+ tokenamount,
+ });
+
+ // msg += String.format(
+ // tem,
+ // acc.name
+ // );
+ }
+ console.log('arrToken:',arrToken);
+ this.setState({tokenNameArray: arrToken});
- // msg += String.format(
- // tem,
- // acc.name
- // );
+ } catch (err)
+ {
+ this.addError(err.message);
}
- this.setState({
- // tokenInfo: msg,
- tokenNameArray: arrToken,
- });
- } catch (err)
- {
- this.addError(err.message);
}
}
+ addSelectedToken(index){
+ console.log('index:::::::',index);
- async setTokenInfo(token) {
- var tem = '';
- var msg = '';
- var to = new web3.Token(this.props.conn, token.tokenpubkey);
- var tokenacc = await to.accountInfo(new web3.PublicKey(token.tokenaccpubkey));
- String.format = function(src){
- if (arguments.length == 0) return null;
- var args = Array.prototype.slice.call(arguments, 1);
- return src.replace(/\{(\d+)\}/g, function(m, i){
- return args[i];
- });
- };
-
- tem += '代币名称: {0} ' +
- '余额: {1}';
-
- msg += String.format(
- tem,
- token.tokenname,
- tokenacc.amount
- );
- this.setState({
- tokenInfo: msg,
- });
- this.props.onTokenAsset(token);
- }
+ var tokeninfo = this.state.tokenNameArray[index];
+ console.log('tokeninfo:::::::',tokeninfo);
- getValidationState(value) {
- const length = value.length;
- if (length === 44) {
- if (value.match(/^[A-Za-z0-9]+$/)) {
- return 'success';
- }
- return 'error';
- } else if (length > 44) {
- return 'error';
- } else if (length > 0) {
- return 'warning';
+ if (tokeninfo.tokenselected == false) {
+ tokeninfo.tokenselected = true;
+ document.getElementById('button'+index).style.background=`url(${SelectOn})`;
+ document.getElementById('button'+index).style.backgroundSize='25px 25px';
+ }else{
+ tokeninfo.tokenselected = false;
+ document.getElementById('button'+index).style.background=`url(${SelectOff})`;
+ document.getElementById('button'+index).style.backgroundSize='25px 25px';
}
- return null;
- }
-
- handleChange(e) {
- const {value} = e.target;
- const validationState = this.getValidationState(value);
- this.setState({
- value: value,
- validationState: validationState,
- });
-
- this.props.onTokenAsset(validationState === 'success' ? value : null);
+ this.AddTokenNameArray();
}
-
render() {
return (
-
+
+ {
+ this.state.tokenNameArray.map((obj,index) => {
+ return(
+
this.addSelectedToken(index)}/>
+ );
+ })
+ }
+
);
}
}
TokenAsset.propTypes = {
+ publickey: PropTypes.object,
onTokenAsset: PropTypes.function,
conn: PropTypes.object,
};
@@ -723,7 +761,7 @@ class TokenInput extends React.Component {
return (