From 0355da63d88bdced4894baaaa2e63f0cf71906c4 Mon Sep 17 00:00:00 2001 From: zx870076178 <870076178@qq.com> Date: Fri, 22 Feb 2019 18:00:32 +0800 Subject: [PATCH 1/2] Settings&&Set_Node --- App.js | 4 + ios/Polkawallet/Info.plist | 2 +- src/code/Assetes/secondary/Backup_Account.js | 8 ++ src/code/Assetes/secondary/Create_Account.js | 4 +- .../secondary/Transfer/make_transfer.js | 1 - .../Assetes/secondary/Transfer/transfer.js | 42 +++++- src/code/Assetes/secondary/camera.js | 3 - src/code/Assetes/secondary/coin_details.js | 4 +- src/code/Assetes/secondary/right_menu.js | 1 - src/code/Democracy/proposals.js | 2 +- src/code/Democracy/referendums/Active.js | 124 ++++++++-------- src/code/Democracy/secondary/NayorAye.js | 2 +- src/code/Profile/Profile.js | 8 +- src/code/Profile/secondary/Addresses.js | 1 - .../secondary/Change/Change_Password.js | 4 +- src/code/Profile/secondary/Manage_Account.js | 1 - src/code/Profile/secondary/Settings.js | 126 ++++++++++++++++ .../Profile/secondary/Settings/Set_Node.js | 136 ++++++++++++++++++ .../Profile/secondary/address_information.js | 2 +- src/code/Staking/Staking.js | 8 +- src/code/Staking/secondary/Validator_Info.js | 2 +- src/code/Staking/secondary/nominate.js | 2 +- src/code/Staking/secondary/preferences.js | 4 +- src/code/Staking/secondary/stake.js | 2 +- src/code/Staking/secondary/unnominate.js | 3 +- src/code/Staking/secondary/unstake.js | 2 +- 26 files changed, 401 insertions(+), 97 deletions(-) create mode 100644 src/code/Profile/secondary/Settings.js create mode 100644 src/code/Profile/secondary/Settings/Set_Node.js diff --git a/App.js b/App.js index a48ad5e6..50579545 100644 --- a/App.js +++ b/App.js @@ -27,6 +27,8 @@ import Preferences from './src/code/Staking/secondary/preferences' import Change_Password from './src/code/Profile/secondary/Change/Change_Password' import Change_Name from './src/code/Profile/secondary/Change/Change_Name' import NayorAye from './src/code/Democracy/secondary/NayorAye' +import Settings from './src/code/Profile/secondary/Settings' +import Set_Node from './src/code/Profile/secondary/Settings/Set_Node' @@ -58,6 +60,8 @@ const Polkawallet_App = StackNavigator({ Change_Password:{screen:Change_Password,navigationOptions:{header:null}}, Change_Name:{screen:Change_Name,navigationOptions:{header:null}}, NayorAye:{screen:NayorAye,navigationOptions:{header:null}}, + Settings:{screen:Settings,navigationOptions:{header:null}}, + Set_Node:{screen:Set_Node,navigationOptions:{header:null}}, }) diff --git a/ios/Polkawallet/Info.plist b/ios/Polkawallet/Info.plist index 10696409..597a4576 100644 --- a/ios/Polkawallet/Info.plist +++ b/ios/Polkawallet/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.2 + 1.4 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/src/code/Assetes/secondary/Backup_Account.js b/src/code/Assetes/secondary/Backup_Account.js index 78800f59..48006bf5 100644 --- a/src/code/Assetes/secondary/Backup_Account.js +++ b/src/code/Assetes/secondary/Backup_Account.js @@ -13,8 +13,14 @@ import { Picker, Clipboard } from 'react-native'; +import Api from '@polkadot/api/promise'; +import WsProvider from '@polkadot/rpc-provider/ws'; + let ScreenWidth = Dimensions.get("screen").width; let ScreenHeight = Dimensions.get("screen").height; +import { observer, inject } from "mobx-react"; +@inject('rootStore') +@observer export default class Polkawallet extends Component{ constructor(props) { @@ -30,6 +36,8 @@ export default class Polkawallet extends Component{ this.props.navigation.navigate('Create_Account') } Continue(){ + this.props.rootStore.stateStore.isvalidators=0 + this.props.rootStore.stateStore.StakingState=0 this.props.navigation.navigate('Tabbed_Navigation') } async copy(){ diff --git a/src/code/Assetes/secondary/Create_Account.js b/src/code/Assetes/secondary/Create_Account.js index 024d539c..92c56dc7 100644 --- a/src/code/Assetes/secondary/Create_Account.js +++ b/src/code/Assetes/secondary/Create_Account.js @@ -194,7 +194,6 @@ export default class Polkawallet extends Component { this.props.navigation.navigate('Backup_Account',{key:this.state.key}) }else{ - // /* this.pair.setMeta({'name':this.state.name}) this.json = this.pair.toJson(this.state.password) this.json.meta = this.pair.getMeta() @@ -204,7 +203,6 @@ export default class Polkawallet extends Component { this.props.rootStore.stateStore.Accountnum++ this.props.rootStore.stateStore.Account=this.props.rootStore.stateStore.Accountnum this.props.navigation.navigate('Backup_Account',{key:this.state.key}) - // */ } } else{ @@ -275,7 +273,7 @@ export default class Polkawallet extends Component { }} > - {this.state.way} + {this.state.way} { - // alert(this.props.rootStore.stateStore.Accounts[this.props.rootStore.stateStore.Account].address) this.setState({ balance:balance }); }); + this.setState({fees:await api.derive.balances.fees()}) })() } @@ -168,10 +168,10 @@ import { { if(index==0){this.ChangeAddress(changeText)} if(index==1){this.ChangeValue(changeText)} @@ -207,13 +207,31 @@ import { /> : - } ) }) } + + + {'creationFee : '+formatBalance(String(this.state.fees.creationFee))} + + + {'existentialDeposit : '+formatBalance(String(this.state.fees.existentialDeposit))} + + + {'transactionBaseFee : '+formatBalance(String(this.state.fees.transactionBaseFee))} + + + {'transactionByteFee : '+formatBalance(String(this.state.fees.transactionByteFee))} + + + {'transferFee : '+formatBalance(String(this.state.fees.transferFee))} + + + + @@ -349,5 +367,15 @@ import { fontWeight:'500', fontSize:ScreenHeight/50, color:'#4169E1' + }, + feesView:{ + height:ScreenHeight/35, + width:ScreenWidth, + justifyContent:'center', + marginLeft:ScreenWidth/20 + }, + feesText:{ + color:'#696969', + fontSize:ScreenHeight/60 } }) \ No newline at end of file diff --git a/src/code/Assetes/secondary/camera.js b/src/code/Assetes/secondary/camera.js index 4ac1c6c0..eab64964 100644 --- a/src/code/Assetes/secondary/camera.js +++ b/src/code/Assetes/secondary/camera.js @@ -48,7 +48,6 @@ export default class Scanner extends Component { } onRead = (res) => { if(this.props.rootStore.stateStore.tocamera==0){ - alert('0') //Assets界面进来的 this.props.rootStore.stateStore.iscamera=1 this.props.rootStore.stateStore.t_address=res.data @@ -61,14 +60,12 @@ export default class Scanner extends Component { this.props.navigation.dispatch(resetAction) } if(this.props.rootStore.stateStore.tocamera==1){ - alert('1') //transfer界面进来的 this.props.rootStore.stateStore.iscamera=1 this.props.rootStore.stateStore.t_address=res.data this.props.navigation.navigate('Transfer') } if(this.props.rootStore.stateStore.tocamera==2){ - alert('2') //通讯录界面进来的 this.props.rootStore.stateStore.iscamera=1 this.props.rootStore.stateStore.QRaddress=res.data diff --git a/src/code/Assetes/secondary/coin_details.js b/src/code/Assetes/secondary/coin_details.js index 8ceeb925..85e813b4 100644 --- a/src/code/Assetes/secondary/coin_details.js +++ b/src/code/Assetes/secondary/coin_details.js @@ -145,7 +145,7 @@ import { observer, inject } from "mobx-react"; {/* The line chart */} - + @@ -158,7 +158,7 @@ import { observer, inject } from "mobx-react"; titlebottoms.map((item,index)=>{ return( { this.setState({ titlebottom:index+1 diff --git a/src/code/Assetes/secondary/right_menu.js b/src/code/Assetes/secondary/right_menu.js index 9cdc62b7..f27b4459 100644 --- a/src/code/Assetes/secondary/right_menu.js +++ b/src/code/Assetes/secondary/right_menu.js @@ -70,7 +70,6 @@ export default class New extends Component { }) if (String(nominating)!=''&&String(nominating)!='5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUppTZ') { - console.warn(String(nominating)) this.props.rootStore.stateStore.StakingState=3 } if(this.props.rootStore.stateStore.StakingState!=2&&this.props.rootStore.stateStore.StakingState!=3){ diff --git a/src/code/Democracy/proposals.js b/src/code/Democracy/proposals.js index 95cf25da..2f1fe1cb 100644 --- a/src/code/Democracy/proposals.js +++ b/src/code/Democracy/proposals.js @@ -65,7 +65,7 @@ export default class Polkawallet extends Component { }) for(i=0;i{ - // this.state.votingState = [] - // ifNewIndex = false - // test=0 - // l=0 - // const api = await Api.create(new WsProvider(this.props.rootStore.stateStore.ENDPOINT)); - // for(i=0;i{ - // if(result[0]!=null){ - // if(this.state.votingState[0]!=null){ - // this.state.votingState.forEach(value => { - // this.state.votingStateIndex.push(value[0].referendumId) - // }) - // console.warn('votingStateIndex: '+ this.state.votingStateIndex) - // for(k=0;k{ + this.state.votingState = [] + ifNewIndex = false + test=0 + l=0 + const api = await Api.create(new WsProvider(this.props.rootStore.stateStore.ENDPOINT)); + for(i=0;i{ + if(result[0]!=null){ + if(this.state.votingState[0]!=null){ + // this.state.votingState.forEach(value => { + // this.state.votingStateIndex.push(value[0].referendumId) + // }) + // console.warn('votingStateIndex: '+ this.state.votingStateIndex) + for(k=0;k{ const api = await Api.create(new WsProvider(this.props.rootStore.stateStore.ENDPOINT)); @@ -97,7 +97,7 @@ export default class Polkawallet extends Component { this.setState({votingCountdown:bestNumber}) }) await api.derive.democracy.referendums((result)=>{ - this.setState({referendums:[],Actives_Nofixed:[],Actives_Nofixedvalue:[],Actives_Title:[],votingIndex:[],votingState:[]}) + this.setState({referendums:[],Actives_Nofixed:[],Actives_Nofixedvalue:[],Actives_Title:[],votingState:[]}) result.map((item,index)=>{ info = item.unwrapOr(null) if (info) { @@ -109,10 +109,16 @@ export default class Polkawallet extends Component { this.state.votingIndex.push(info.index) } this.setState({}) - // this.votingState() + this.votingState() }) }) + // for(i=0;i{ + // this.state.votingState.push(result); + // this.setState({}) + // }) + // } })() @@ -163,7 +169,7 @@ export default class Polkawallet extends Component { {'Threshold: '+item.threshold} - + {/* {'Nay '+item.Nay} 33.25% {'('+item.nay+')'} - + */} - + /> */} {/* Nay or Aye */} diff --git a/src/code/Democracy/secondary/NayorAye.js b/src/code/Democracy/secondary/NayorAye.js index e852b045..772c62fe 100644 --- a/src/code/Democracy/secondary/NayorAye.js +++ b/src/code/Democracy/secondary/NayorAye.js @@ -88,7 +88,7 @@ import { this.setState({ type:type }) - console.warn(type) + // console.warn(type) if(type === 'Finalised'){ setTimeout(() => { Alert.alert( diff --git a/src/code/Profile/Profile.js b/src/code/Profile/Profile.js index e63e546c..72f1e3e8 100644 --- a/src/code/Profile/Profile.js +++ b/src/code/Profile/Profile.js @@ -15,7 +15,7 @@ const Custom_Components=[ //Need Open // {image:require('../../images/Profile/Notifications.png'),text:'Notifications'}, {image:require('../../images/Profile/Addresses.png'),text:'Addresses'}, - // {image:require('../../images/Profile/Settings.png'),text:'Settings'}, + {image:require('../../images/Profile/Settings.png'),text:'Settings'}, // {image:require('../../images/Profile/Support.png'),text:'Support'}, // {image:require('../../images/Profile/About.png'),text:'About'}, ] @@ -41,6 +41,9 @@ export default class New extends Component { this.props.rootStore.stateStore.transfer_address=0 this.props.navigation.navigate('Addresses') } + Settings(){ + this.props.navigation.navigate('Settings') + } render() { return ( @@ -84,8 +87,9 @@ export default class New extends Component { { if(index==0){this.Addresses()} + if(index==1){this.Settings()} }} - style={{backgroundColor:'white',marginTop:(index==3)?ScreenHeight/35:0,flexDirection:'row',alignItems:'center',height:ScreenHeight/13,borderWidth:0.5,borderColor:'#C0C0C0',borderRadius:ScreenHeight/130,marginHorizontal:1,borderBottomWidth:(index==4||index==2)?1:0.5}} + style={{backgroundColor:'white',marginTop:(index==3)?ScreenHeight/35:0,flexDirection:'row',alignItems:'center',height:ScreenHeight/13,borderWidth:0.5,borderColor:'#C0C0C0',marginHorizontal:1,borderBottomWidth:(index==4||index==2)?1:0.5}} > {/* 标题 */} - Addresses + Change Password {/* 保存 */} + {/* 标题栏 */} + + {/* 返回 */} + + + + {/* 标题 */} + Settings + {/* 空白 */} + + + { + msg.map((item,index)=>{ + return( + { + if(index==0){this.Set_Node()} + }} + > + {item} + + + + ) + }) + } + + ); + } +} +const styles = StyleSheet.create({ + title:{ + padding:ScreenHeight/50, + height:ScreenHeight/9, + flexDirection:'row', + alignItems:'flex-end', + justifyContent:'space-between', + backgroundColor:'#776f71' + }, + text_title:{ + fontSize:ScreenHeight/37, + fontWeight:'bold', + color:'#e6e6e6' + }, + image_title:{ + height:ScreenHeight/33.35, + width:ScreenHeight/33.35, + resizeMode:'contain' + }, + msgView:{ + backgroundColor:'white', + flexDirection:'row', + alignItems:'center', + height:ScreenHeight/13, + borderWidth:0.5, + borderColor:'#C0C0C0', + borderRadius:ScreenHeight/130, + marginHorizontal:1, + paddingLeft:ScreenWidth*0.05 + }, + msgText:{ + fontSize:ScreenWidth/20, + color:'#696969' + }, + msgImage:{ + marginRight:ScreenWidth/28, + height:ScreenHeight/60, + width:ScreenHeight/60/1.83, + resizeMode:'contain' + }, + +}) \ No newline at end of file diff --git a/src/code/Profile/secondary/Settings/Set_Node.js b/src/code/Profile/secondary/Settings/Set_Node.js new file mode 100644 index 00000000..4de83c97 --- /dev/null +++ b/src/code/Profile/secondary/Settings/Set_Node.js @@ -0,0 +1,136 @@ +import React, { Component } from 'react'; +import { + AppRegistry, + StyleSheet, + Text, + View, + Dimensions, + ScrollView, + Image, + TouchableOpacity, + AsyncStorage, + TextInput +} from 'react-native'; + +let ScreenWidth = Dimensions.get("screen").width; +let ScreenHeight = Dimensions.get("screen").height; +const msg = ['Language','Assets Display Unit','Remote Node'] +import { observer, inject } from "mobx-react"; +@inject('rootStore') +@observer +export default class New extends Component { + constructor(props) + { + super(props) + this.state = { + node:'' + } + this.back=this.back.bind(this) + this.onChangeNode = this.onChangeNode.bind(this) + this.Set_Node=this.Set_Node.bind(this) + } + back(){ + this.props.navigation.navigate('Settings') + } + onChangeNode(onChangeNode){ + this.setState({ + node:onChangeNode + }) + } + Set_Node(){ + this.props.rootStore.stateStore.ENDPOINT=this.state.node + this.props.navigation.navigate('Tabbed_Navigation') + } + componentWillMount(){ + + } + render() { + return ( + + {/* 标题栏 */} + + {/* 返回 */} + + + + {/* 标题 */} + Set Node + {/* 空白 */} + + + import remote node,if not is Alexander,not have the chart function + + NOTE: Exit the app,will return to the default (wss://poc3-rpc.polkadot.io/) + + confirm + + + ); + } +} +const styles = StyleSheet.create({ + title:{ + padding:ScreenHeight/50, + height:ScreenHeight/9, + flexDirection:'row', + alignItems:'flex-end', + justifyContent:'space-between', + backgroundColor:'#776f71' + }, + text_title:{ + fontSize:ScreenHeight/37, + fontWeight:'bold', + color:'#e6e6e6' + }, + image_title:{ + height:ScreenHeight/33.35, + width:ScreenHeight/33.35, + resizeMode:'contain' + }, + text:{ + marginLeft:ScreenWidth*0.06, + marginTop:ScreenHeight/70, + width:ScreenWidth*0.8, + fontSize:ScreenWidth/25, + color:'#696969' + }, + textInputStyle:{ + paddingVertical: 0, + marginTop:ScreenHeight/70, + color:'black', + marginLeft:ScreenWidth*0.06, + height:ScreenHeight/24, + width:ScreenWidth*0.8, + borderWidth:1, + borderColor:'#DCDCDC', + fontSize:ScreenHeight/60, + borderRadius:ScreenHeight/150, + paddingLeft:ScreenHeight/100, + paddingVertical: 0 + }, + Touch:{ + marginRight:ScreenWidth*0.14, + marginTop:ScreenHeight/40, + height:ScreenHeight/20, + width:ScreenWidth*0.4, + alignSelf:'flex-end', + borderRadius:ScreenHeight/100, + justifyContent:'center', + alignItems:'center', + backgroundColor:'#FF4081C7' + }, +}) \ No newline at end of file diff --git a/src/code/Profile/secondary/address_information.js b/src/code/Profile/secondary/address_information.js index e9d8216b..e468d236 100644 --- a/src/code/Profile/secondary/address_information.js +++ b/src/code/Profile/secondary/address_information.js @@ -103,7 +103,7 @@ export default class New extends Component { style={styles.save_touch} onPress={this.save} > - Edit + {/* Edit */} } > {/* *********************** 点线图 *********************** */} - + @@ -550,7 +549,8 @@ export default class IntegralMall extends Component { To load more ~ : - + + ~ Bottom } @@ -780,7 +780,7 @@ export default class IntegralMall extends Component { (this.state.next_up[0]==null) ? - - Not have next_up. + Not have Next up. : this.state.next_up.map((item,index)=>{ diff --git a/src/code/Staking/secondary/Validator_Info.js b/src/code/Staking/secondary/Validator_Info.js index 238db898..d1e54024 100644 --- a/src/code/Staking/secondary/Validator_Info.js +++ b/src/code/Staking/secondary/Validator_Info.js @@ -157,7 +157,7 @@ export default class IntegralMall extends Component { {/* *********************** 点线图 *********************** */} - + diff --git a/src/code/Staking/secondary/nominate.js b/src/code/Staking/secondary/nominate.js index de3ace85..350a8d8e 100644 --- a/src/code/Staking/secondary/nominate.js +++ b/src/code/Staking/secondary/nominate.js @@ -107,7 +107,7 @@ import { set } from 'mobx'; this.setState({ type:type }) - console.warn(type) + // console.warn(type) if(type === 'Finalised'){ setTimeout(() => { Alert.alert( diff --git a/src/code/Staking/secondary/preferences.js b/src/code/Staking/secondary/preferences.js index 697f29bc..3ec9f0ad 100644 --- a/src/code/Staking/secondary/preferences.js +++ b/src/code/Staking/secondary/preferences.js @@ -132,7 +132,7 @@ import { set } from 'mobx'; intentions = await api.query.staking.intentions() stakeIndex = intentions.indexOf(this.props.rootStore.stateStore.Accounts[this.props.rootStore.stateStore.Account].address) await api.tx.staking.registerPreferences(stakeIndex,registerPreferences).signAndSend(loadPair,({ status, type }) => { - console.warn(type) + // console.warn(type) this.setState({ type:type }) @@ -433,6 +433,8 @@ import { set } from 'mobx'; backgroundColor:'#97BEC7' }, Choose_unit:{ + marginTop:ScreenHeight/70, + justifyContent:'center', alignItems:'center', marginLeft:ScreenWidth/70, width:ScreenWidth*0.25, diff --git a/src/code/Staking/secondary/stake.js b/src/code/Staking/secondary/stake.js index 996f8454..11c92aec 100644 --- a/src/code/Staking/secondary/stake.js +++ b/src/code/Staking/secondary/stake.js @@ -87,7 +87,7 @@ import { set } from 'mobx'; this.setState({ type:type }) - console.warn(type) + // console.warn(type) if(type === 'Finalised'){ setTimeout(() => { Alert.alert( diff --git a/src/code/Staking/secondary/unnominate.js b/src/code/Staking/secondary/unnominate.js index c183981e..5334a045 100644 --- a/src/code/Staking/secondary/unnominate.js +++ b/src/code/Staking/secondary/unnominate.js @@ -96,9 +96,8 @@ import { set } from 'mobx'; nominating = await api.query.staking.nominating(this.props.rootStore.stateStore.Accounts[this.props.rootStore.stateStore.Account].address) intentions = await api.query.staking.intentions() stakeIndex = intentions.indexOf(String(nominating)) - console.warn(stakeIndex) await api.tx.staking.unnominate(stakeIndex).signAndSend(loadPair,({ status, type }) => { - console.warn(type) + // console.warn(type) this.setState({ type:type }) diff --git a/src/code/Staking/secondary/unstake.js b/src/code/Staking/secondary/unstake.js index f15d899d..5a625a7b 100644 --- a/src/code/Staking/secondary/unstake.js +++ b/src/code/Staking/secondary/unstake.js @@ -97,7 +97,7 @@ import { set } from 'mobx'; this.setState({ type:type }) - console.warn(type) + // console.warn(type) if(type === 'Finalised'){ setTimeout(() => { Alert.alert( From 029741bad285b780512941961ad657e71ac06177 Mon Sep 17 00:00:00 2001 From: zx870076178 <870076178@qq.com> Date: Fri, 22 Feb 2019 18:40:25 +0800 Subject: [PATCH 2/2] update polkadot/api@0.45.12 --- package-lock.json | 175 ++++++++++++++++++++++-------------- package.json | 2 +- src/code/Staking/Staking.js | 6 +- 3 files changed, 113 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index 09b623c9..a4645bec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -792,18 +792,18 @@ "integrity": "sha512-4zAPlpDEh2VwXswwr/t8xGNDGg8RQiPxtxZ3qQEXyQsBV39ptTdESCjuBvGze1nLMVrxmTIKmnO/nAV8Tqjjzg==" }, "@polkadot/api": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-0.45.8.tgz", - "integrity": "sha512-FOEN8Mb/A8bZtAmrS2TsDjtYMAuCA+RooNksNluNKdAlkz602xFegBiRua3eYTtT927dMUYnksFhTdZ8ULPS/Q==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-0.45.12.tgz", + "integrity": "sha512-fV7QOEGwuqA4C9Y+S335Y133C3WE8pQLrV10Jf/eiIPWdwieJi9RefXqF4tldU6475cEsJJY27/0t0eVRmj9Gw==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/api-derive": "^0.45.8", - "@polkadot/extrinsics": "^0.45.8", - "@polkadot/rpc-provider": "^0.45.8", - "@polkadot/rpc-rx": "^0.45.8", - "@polkadot/storage": "^0.45.8", - "@polkadot/types": "^0.45.8", - "@polkadot/util-crypto": "^0.34.21" + "@polkadot/api-derive": "^0.45.12", + "@polkadot/extrinsics": "^0.45.12", + "@polkadot/rpc-provider": "^0.45.12", + "@polkadot/rpc-rx": "^0.45.12", + "@polkadot/storage": "^0.45.12", + "@polkadot/types": "^0.45.12", + "@polkadot/util-crypto": "^0.34.22" }, "dependencies": { "@babel/runtime": { @@ -817,13 +817,13 @@ } }, "@polkadot/api-derive": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-0.45.8.tgz", - "integrity": "sha512-m9SOqDvhelQr87otPhguaPupAxeWUrzERbuKKo+2TTp5yy7gumKyGK9cS7Be6Ua5INmhzzOCMSE0LQM4SUgHdA==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-0.45.12.tgz", + "integrity": "sha512-dRqjk5RrMO4so0gVMlj6Zw/YMUzlSj3CSknmpBiRIz8WNqx9YCWLbB1HZXRVDXgCPWcY9WUj0Uz69mxFBcmp3Q==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/api": "^0.45.8", - "@polkadot/types": "^0.45.8", + "@polkadot/api": "^0.45.12", + "@polkadot/types": "^0.45.12", "@types/memoizee": "^0.4.2", "memoizee": "^0.4.14" }, @@ -839,13 +839,13 @@ } }, "@polkadot/extrinsics": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/extrinsics/-/extrinsics-0.45.8.tgz", - "integrity": "sha512-x8lhwpGuFCLuv+QWZ8j9ed5kN2ksvGeMdd5dLW3IcXUITdiP75k5ndROAAY4o7TkXjrH6OY1a84k0jguluXECQ==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/extrinsics/-/extrinsics-0.45.12.tgz", + "integrity": "sha512-vtZ7rCviV8TtWqwfHfjHAWwJmHTvQKqxuL21Cm0GTe2PRFY7OovQtzw4zM90eoQuymSGfiNahELmhOD+omfe8Q==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/types": "^0.45.8", - "@polkadot/util": "^0.34.21" + "@polkadot/types": "^0.45.12", + "@polkadot/util": "^0.34.22" }, "dependencies": { "@babel/runtime": { @@ -859,9 +859,9 @@ } }, "@polkadot/jsonrpc": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/jsonrpc/-/jsonrpc-0.45.8.tgz", - "integrity": "sha512-dqQIKVMiPadNs3kOgWA0VmgVUVZ2VkmhHqMNDf52C5C0Bwow9DEgAdWOulas8tod0MvPjEB2ascDoxiZjtGBCA==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/jsonrpc/-/jsonrpc-0.45.12.tgz", + "integrity": "sha512-ryHe/CBRAnl6jd54CHCQ1c6l8D2YqNKLXVG2ulwIhYw0NjCTEJT/9usUmjHtpXAvmZB8+L3CiSm+fSWnhesarg==", "requires": { "@babel/runtime": "^7.3.1" }, @@ -877,13 +877,13 @@ } }, "@polkadot/keyring": { - "version": "0.34.21", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-0.34.21.tgz", - "integrity": "sha512-9yIxAn51DY1/ZE6dH920MnQIzRlR+s3QKKk3rICChnzJBJFki0yfmvTZ/3Wi/p+bK7WjFMrzm03ZtAQBzOgUsQ==", + "version": "0.34.22", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-0.34.22.tgz", + "integrity": "sha512-aFxY4s69RfMyqAIwZtwHSZXz5i8Ly4gWZ+wUwYsyvlC/SgDJbvbE5xu9OqjX3xvcxiPkikiM6Askcqq6056jsQ==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/util": "^0.34.21", - "@polkadot/util-crypto": "^0.34.21", + "@polkadot/util": "^0.34.22", + "@polkadot/util-crypto": "^0.34.22", "@types/bs58": "^4.0.0", "bs58": "^4.0.1" }, @@ -899,15 +899,15 @@ } }, "@polkadot/rpc-core": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-0.45.8.tgz", - "integrity": "sha512-jhMRLAT+BPmZIXRgVCQn8CQPxTHSHHGvWoxuyzrXQbshEO0rq+sDnQvXE8F5vmBIxd7W8c4m5ajO4jTf7/ojvg==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-0.45.12.tgz", + "integrity": "sha512-Sa+rWMoOoJu5op/UD9+diBjaRMvvc3aetGZUFS6JQ/DQABV47M3prU0CshHE+m0bJ5tJv/o1IVmSV2pAE3EJKw==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/jsonrpc": "^0.45.8", - "@polkadot/rpc-provider": "^0.45.8", - "@polkadot/types": "^0.45.8", - "@polkadot/util": "^0.34.21" + "@polkadot/jsonrpc": "^0.45.12", + "@polkadot/rpc-provider": "^0.45.12", + "@polkadot/types": "^0.45.12", + "@polkadot/util": "^0.34.22" }, "dependencies": { "@babel/runtime": { @@ -921,15 +921,15 @@ } }, "@polkadot/rpc-provider": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-0.45.8.tgz", - "integrity": "sha512-riZdSm6tcsHCUMe2HR2f8MYMe7kWNS3vu8W/5OtDVsDH0Y0E8mR7kVJjl14yhM/4eIcmiL1a71XoSwA4vnPCnA==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-0.45.12.tgz", + "integrity": "sha512-0FJfNTSKXWC4Tfra4OXYp99/JYRcNK9dgUJaZEE7l2yKgfV0wGt3xJ8Gat/dSMK+rXvRBUT5LceWypmu6vpd7Q==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/keyring": "^0.34.21", - "@polkadot/storage": "^0.45.8", - "@polkadot/util": "^0.34.21", - "@polkadot/util-crypto": "^0.34.21", + "@polkadot/keyring": "^0.34.22", + "@polkadot/storage": "^0.45.12", + "@polkadot/util": "^0.34.22", + "@polkadot/util-crypto": "^0.34.22", "@types/nock": "^9.3.1", "eventemitter3": "^3.1.0", "isomorphic-fetch": "^2.2.1", @@ -947,13 +947,13 @@ } }, "@polkadot/rpc-rx": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-rx/-/rpc-rx-0.45.8.tgz", - "integrity": "sha512-MVMtZBJTCLNl85aSnlGbDY0gZ1eNJfhAvHZGoXBhmfKIfAwD4itDkznb2/6fEuBLV2ElUHvaz58G60wnFu6D5Q==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-rx/-/rpc-rx-0.45.12.tgz", + "integrity": "sha512-FggG87M4b1uFO//Si5dzhqUTu/hxdePfndbhnGfO52RsJj8zrzm7dmhZtgyQ5nKUmM5CqQWcnYgw/rxSxqPltw==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/rpc-core": "^0.45.8", - "@polkadot/rpc-provider": "^0.45.8", + "@polkadot/rpc-core": "^0.45.12", + "@polkadot/rpc-provider": "^0.45.12", "@types/memoizee": "^0.4.2", "@types/rx": "^4.1.1", "memoizee": "^0.4.14", @@ -976,15 +976,15 @@ "integrity": "sha512-Y6cJWOOJyQ6TPzWzfgPrZlWzcR89X2tOgLIrCXOyEE72+CFiBfyAQDqG2jBzxolEqqN/Fz0AUdxqPT45BzionQ==" }, "@polkadot/storage": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/storage/-/storage-0.45.8.tgz", - "integrity": "sha512-hSOULuiCSEsrXCIf9x5BgIGdfko6VviCPTpmuEFhRdgDWmNwMYPFm2NwrFk8twm8CXUjqHQrr2urI8AIsK8pmQ==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/storage/-/storage-0.45.12.tgz", + "integrity": "sha512-Av1I6FesMG15+AD0DaQIgiomfik+E+KoOuCsjnBjkLOV4Rys4XKVNewJA34wwFQYg+RU64LaiBx74tRF5TKzWQ==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/keyring": "^0.34.21", - "@polkadot/types": "^0.45.8", - "@polkadot/util": "^0.34.21", - "@polkadot/util-crypto": "^0.34.21" + "@polkadot/keyring": "^0.34.22", + "@polkadot/types": "^0.45.12", + "@polkadot/util": "^0.34.22", + "@polkadot/util-crypto": "^0.34.22" }, "dependencies": { "@babel/runtime": { @@ -998,13 +998,13 @@ } }, "@polkadot/types": { - "version": "0.45.8", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-0.45.8.tgz", - "integrity": "sha512-xmpK+rsz8Y5kUI1p8nPc8tB1RLj1dU2+vyvu+448nHMtd02Lukjjukl6aqqaMKdL5th2eYSJfexGSzlyTTNBNg==", + "version": "0.45.12", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-0.45.12.tgz", + "integrity": "sha512-bFWxnglrPaVcH5yTdrMRaZ+MGdLct3XW/9s0b+XgBnqoBekOB+1TJSkiAXElIfO4Po7JWTVJAHn2IcLHjVy6Wg==", "requires": { "@babel/runtime": "^7.3.1", - "@polkadot/keyring": "^0.34.21", - "@polkadot/util": "^0.34.21", + "@polkadot/keyring": "^0.34.22", + "@polkadot/util": "^0.34.22", "core-js": "^2.6.5" }, "dependencies": { @@ -1034,9 +1034,9 @@ } }, "@polkadot/util": { - "version": "0.34.21", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-0.34.21.tgz", - "integrity": "sha512-tzSiEIdwht6cXZAw0cYtKJCeItV5THX0q6RfWItmEy/kYuPGrxBeEYY4HQHJqifok4rBay6E912zcelxXvmJ1w==", + "version": "0.34.22", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-0.34.22.tgz", + "integrity": "sha512-TJmQOmcvRmsW5LW3RHgGxht9oQAaytFrcw8fEZ+y8U/ifOWUsCuyoK7jhJK2P9F0sMq6pDboRlTS368Ee0hEOw==", "requires": { "@babel/runtime": "^7.3.1", "@types/bn.js": "^4.11.4", @@ -1068,19 +1068,21 @@ } }, "@polkadot/util-crypto": { - "version": "0.34.21", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-0.34.21.tgz", - "integrity": "sha512-nDNQEbbCr9u6SfF1/Ts+EKUO4Nl70NqeLTirQagmiU58ju7rPX18vw3nCbA8/35LCCj8gliwkkFXrLtINQmRPg==", + "version": "0.34.22", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-0.34.22.tgz", + "integrity": "sha512-GbEHhwV21t6ZGaJHdhi7K9baKjVXKregqs4bXKu4PMX1fkO7nQKrihIUEtWrtkyGxEcz6MQdDMY/ycovChh+1g==", "requires": { "@babel/runtime": "^7.3.1", "@polkadot/schnorrkel-js": "^0.1.2-1", - "@polkadot/util": "^0.34.21", + "@polkadot/util": "^0.34.22", "@types/bip39": "^2.4.2", + "@types/secp256k1": "^3.5.0", "@types/webassembly-js-api": "^0.0.2", "@types/xxhashjs": "^0.2.0", "bip39": "^2.5.0", "blakejs": "^1.1.0", "js-sha3": "^0.8.0", + "secp256k1": "^3.6.2", "tweetnacl": "^1.0.1", "xxhashjs": "^0.2.2" }, @@ -1325,6 +1327,14 @@ "@types/rx-lite": "*" } }, + "@types/secp256k1": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-3.5.0.tgz", + "integrity": "sha512-ZE39QhkIaNK6xbKIp1VLN5O36r97LuslLmRnjAcT0sVDxcfvrk3zqp/VnIfmGza7J6jDxR8dIai3hsCxPYglPA==", + "requires": { + "@types/node": "*" + } + }, "@types/store": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/store/-/store-2.0.1.tgz", @@ -3046,6 +3056,14 @@ "unorm": "^1.3.3" } }, + "bip66": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", + "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "bl": { "version": "0.8.2", "resolved": "http://registry.npm.taobao.org/bl/download/bl-0.8.2.tgz", @@ -4178,6 +4196,16 @@ "webidl-conversions": "^4.0.2" } }, + "drbg.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", + "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", + "requires": { + "browserify-aes": "^1.0.6", + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4" + } + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "http://registry.npm.taobao.org/ecc-jsbn/download/ecc-jsbn-0.1.2.tgz", @@ -9667,6 +9695,21 @@ "object-assign": "^4.1.1" } }, + "secp256k1": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.6.2.tgz", + "integrity": "sha512-90nYt7yb0LmI4A2jJs1grglkTAXrBwxYAjP9bpeKjvJKOjG2fOeH/YI/lchDMIvjrOasd5QXwvV2jwN168xNng==", + "requires": { + "bindings": "^1.2.1", + "bip66": "^1.1.3", + "bn.js": "^4.11.3", + "create-hash": "^1.1.2", + "drbg.js": "^1.0.1", + "elliptic": "^6.2.3", + "nan": "^2.2.1", + "safe-buffer": "^5.1.0" + } + }, "semver": { "version": "5.6.0", "resolved": "http://registry.npm.taobao.org/semver/download/semver-5.6.0.tgz", diff --git a/package.json b/package.json index 967d8bf9..ced8a0ae 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@babel/plugin-proposal-decorators": "^7.2.3", "@babel/plugin-transform-runtime": "^7.2.0", "@babel/runtime": "^7.2.0", - "@polkadot/api": "^0.45.8", + "@polkadot/api": "^0.45.12", "@tradle/react-native-http": "^2.0.1", "browserify-zlib": "^0.1.4", "buffer": "^4.9.1", diff --git a/src/code/Staking/Staking.js b/src/code/Staking/Staking.js index 51ba5472..71f7630e 100644 --- a/src/code/Staking/Staking.js +++ b/src/code/Staking/Staking.js @@ -158,7 +158,7 @@ export default class IntegralMall extends Component { }) //查询nominating //查询Staking状态 nominating = await api.query.staking.nominating(this.props.rootStore.stateStore.Accounts[this.props.rootStore.stateStore.Account].address) - nominatingBalance = await api.query.balances.freeBalance(nominating) + nominatingBalance = await api.query.balances.freeBalance(String(nominating)) if (String(nominating)!=''&&String(nominating)!='5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUppTZ') { this.props.rootStore.stateStore.StakingState=3 @@ -171,7 +171,7 @@ export default class IntegralMall extends Component { this.props.rootStore.stateStore.StakingState=1 } //求出给nominating的提名者们nominatingNominators的额度总和sumnominatingBalance - nominatingNominators = await api.query.staking.nominatorsFor(nominating) + nominatingNominators = await api.query.staking.nominatorsFor(String(nominating)) nominatingBalances = await Promise.all( nominatingNominators.map(authorityId => api.query.balances.freeBalance(authorityId) @@ -581,7 +581,7 @@ export default class IntegralMall extends Component { - {formatBalance(this.state.nominatingBalance)+'('+formatBalance(this.state.sumnominatingBalance)+')'} + {formatBalance(String(this.state.nominatingBalance))+'('+formatBalance(String(this.state.sumnominatingBalance))+')'} :