Skip to content
Permalink
Browse files

[M2]0.1.7

  • Loading branch information...
jiangfuyao committed Jun 22, 2019
1 parent 07893d9 commit 8701f4ec1d494512cc1d0828db407da0503f1960
Showing 794 changed files with 32,654 additions and 12,842 deletions.
28 .babelrc 100644 → 100755
@@ -1,11 +1,27 @@
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/transform-runtime", {
"helpers": true,
"regenerator": false
}]
[
"@babel/plugin-transform-flow-strip-types"
],
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
{
"loose":true
}
],
[
"@babel/transform-runtime",
{
"helpers": true,
"regenerator": false
}
]
]

}
0 .buckconfig 100644 → 100755
No changes.

Large diffs are not rendered by default.

0 .flowconfig 100644 → 100755
No changes.
@@ -0,0 +1,11 @@
module.exports = {
printWidth: 120, // 换行字符串阈值 | Newline string threshold
semi: false, // 句末加分号 | Add a semicolon at the end of the sentence
singleQuote: true, // 用单引号 | Use single quote
trailingComma: 'none', // 最后一个对象元素加逗号 | Last object element with comma
bracketSpacing: true, // 对象,数组加空格 | Object, array plus space
jsxBracketSameLine: false, // jsx > 是否另起一行 | Jsx > whether to start another line
arrowParens: 'avoid', // (x) => {} 是否要有小括号 | (x) => {} Need parentheses
requirePragma: false, // 是否要注释来决定是否格式化代码 | Comment to decide whether to format the code?
proseWrap: 'preserve' // 是否要换行 | Whether or not to break a line
}
4 .update 100644 → 100755
@@ -1,3 +1,3 @@
{
"token": "Deleted...Need add it by yourself:)"
}
"token": "Need add yourself token"
}
2 .watchmanconfig 100644 → 100755
@@ -1 +1 @@
{}
{}
165 App.js 100644 → 100755
@@ -1,83 +1,104 @@
import React, { Component } from 'react';
import {
View,
StyleSheet
} from 'react-native';
import {StackNavigator} from 'react-navigation'
import Tabbed_Navigation from './src/code/Tabbed_Navigation.js'
import Create_Account from './src/code/Assets/secondary/Create_Account'
import Backup_Account from './src/code/Assets/secondary/Backup_Account'
import QR_Code from './src/code/Assets/secondary/QR_Code'
import Coin_details from './src/code/Assets/secondary/coin_details'
import Manage_Account from './src/code/Profile/secondary/Manage_Account'
import Transfer from './src/code/Assets/secondary/Transfer/transfer'
import Make_transfer from './src/code/Assets/secondary/Transfer/make_transfer'
import Transfer_details from './src/code/Assets/secondary/Transfer/Transfer_details'
import Addresses from './src/code/Profile/secondary/Addresses'
import Add_address from './src/code/Profile/secondary/add_address'
import Address_information from './src/code/Profile/secondary/address_information'
import Camera from './src/code/Assets/secondary/camera'
import Validator_Info from './src/code/Staking/secondary/Validator_Info'
import Stake from './src/code/Staking/secondary/stake'
import Nominate from './src/code/Staking/secondary/nominate'
import Unstake from './src/code/Staking/secondary/unstake'
import Unnominate from './src/code/Staking/secondary/unnominate'
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'
import About from './src/code/Profile/secondary/About'
import Gesture from './src/code/Profile/secondary/Settings/Gesture'




import {Provider} from 'mobx-react'
//获取store实例
import React, { Component } from 'react'
import { StackNavigator } from 'react-navigation'
import { Provider } from 'mobx-react'
import Api from '@polkadot/api/promise'
import WsProvider from '@polkadot/rpc-provider/ws'
import Tabbed_Navigation from './src/page/TabbedNavigation'
import Create_Account from './src/page/Assets/secondary/CreateAccount'
import Backup_Account from './src/page/Assets/secondary/BackupAccount'
import MnemonicWord_1 from './src/page/Assets/secondary/MnemonicWord_1'
import MnemonicWord_2 from './src/page/Assets/secondary/MnemonicWord_2'
import MnemonicWord_3 from './src/page/Assets/secondary/MnemonicWord_3'
import QR_Code from './src/page/Assets/secondary/QRCode'
import Coin_details from './src/page/Assets/secondary/CoinDetails'
import Manage_Account from './src/page/Profile/secondary/ManageAccount'
import Transfer from './src/page/Assets/secondary/Transfer/Transfer'
import Make_transfer from './src/page/Assets/secondary/Transfer/MakeTransfer'
import Transfer_details from './src/page/Assets/secondary/Transfer/TransferDetails'
import Addresses from './src/page/Profile/secondary/Addresses'
import Add_address from './src/page/Profile/secondary/AddAddress'
import Address_information from './src/page/Profile/secondary/AddressInformation'
import Camera from './src/page/Assets/secondary/Camera'
import Validator_Info from './src/page/Staking/secondary/ValidatorInfo'
import Stake from './src/page/Staking/secondary/Stake'
import BondFunds from './src/page/Staking/secondary/BondFunds'
import Unbond from './src/page/Staking/secondary/Unbond'
import BondAdditional from './src/page/Staking/secondary/BondAdditional'
import SetSessionKey from './src/page/Staking/secondary/SetSessionKey'
import Nominate from './src/page/Staking/secondary/Nominate'
import Unstake from './src/page/Staking/secondary/Unstake'
import Unnominate from './src/page/Staking/secondary/Unnominate'
import Change_Password from './src/page/Profile/secondary/Change/ChangePassword'
import Change_Name from './src/page/Profile/secondary/Change/ChangeName'
import NayorAye from './src/page/Democracy/secondary/NayorAye'
import Settings from './src/page/Profile/secondary/Settings'
import Set_Node from './src/page/Profile/secondary/Settings/SetNode'
import About from './src/page/Profile/secondary/About'
import Gesture from './src/page/Profile/secondary/Settings/Gesture'
import { setJSExceptionHandler } from './src/util/error_guard'
// 获取store实例 | Get store instance
import AppState from './src/mobx/mobx'

const Polkawallet_App = StackNavigator({
Tabbed_Navigation:{screen:Tabbed_Navigation,navigationOptions:{header:null}},
Create_Account:{screen:Create_Account,navigationOptions:{header:null}},
Backup_Account:{screen:Backup_Account,navigationOptions:{header:null}},
QR_Code:{screen:QR_Code,navigationOptions:{header:null}},
Coin_details:{screen:Coin_details,navigationOptions:{header:null}},
Manage_Account:{screen:Manage_Account,navigationOptions:{header:null}},
Transfer:{screen:Transfer,navigationOptions:{header:null}},
Make_transfer:{screen:Make_transfer,navigationOptions:{header:null}},
Transfer_details:{screen:Transfer_details,navigationOptions:{header:null}},
Addresses:{screen:Addresses,navigationOptions:{header:null}},
Add_address:{screen:Add_address,navigationOptions:{header:null}},
Address_information:{screen:Address_information,navigationOptions:{header:null}},
Camera:{screen:Camera,navigationOptions:{header:null}},
Validator_Info:{screen:Validator_Info,navigationOptions:{header:null}},
Stake:{screen:Stake,navigationOptions:{header:null}},
Nominate:{screen:Nominate,navigationOptions:{header:null}},
Unstake:{screen:Unstake,navigationOptions:{header:null}},
Unnominate:{screen:Unnominate,navigationOptions:{header:null}},
Preferences:{screen:Preferences,navigationOptions:{header:null}},
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}},
About:{screen:About,navigationOptions:{header:null}},
Gesture:{screen:Gesture,navigationOptions:{header:null}},
const Polkawallet_App = StackNavigator({
Tabbed_Navigation: {
screen: Tabbed_Navigation,
navigationOptions: { header: null }
},
Create_Account: { screen: Create_Account, navigationOptions: { header: null } },
Backup_Account: { screen: Backup_Account, navigationOptions: { header: null } },
QR_Code: { screen: QR_Code, navigationOptions: { header: null } },
Coin_details: { screen: Coin_details, navigationOptions: { header: null } },
Manage_Account: { screen: Manage_Account, navigationOptions: { header: null } },
Transfer: { screen: Transfer, navigationOptions: { header: null } },
Make_transfer: { screen: Make_transfer, navigationOptions: { header: null } },
Transfer_details: {
screen: Transfer_details,
navigationOptions: { header: null }
},
Addresses: { screen: Addresses, navigationOptions: { header: null } },
Add_address: { screen: Add_address, navigationOptions: { header: null } },
Address_information: {
screen: Address_information,
navigationOptions: { header: null }
},
Camera: { screen: Camera, navigationOptions: { header: null } },
Validator_Info: { screen: Validator_Info, navigationOptions: { header: null } },
Stake: { screen: Stake, navigationOptions: { header: null } },
BondFunds: { screen: BondFunds, navigationOptions: { header: null } },
Unbond: { screen: Unbond, navigationOptions: { header: null } },
BondAdditional: { screen: BondAdditional, navigationOptions: { header: null } },
SetSessionKey: { screen: SetSessionKey, navigationOptions: { header: null } },
Nominate: { screen: Nominate, navigationOptions: { header: null } },
Unstake: { screen: Unstake, navigationOptions: { header: null } },
Unnominate: { screen: Unnominate, navigationOptions: { header: null } },
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 } },
About: { screen: About, navigationOptions: { header: null } },
Gesture: { screen: Gesture, navigationOptions: { header: null } },
MnemonicWord_1: { screen: MnemonicWord_1, navigationOptions: { header: null } },
MnemonicWord_2: { screen: MnemonicWord_2, navigationOptions: { header: null } },
MnemonicWord_3: { screen: MnemonicWord_3, navigationOptions: { header: null } }
})

})


setJSExceptionHandler(() => {}, true)

export default class Polkawallet extends Component {
componentWillMount() {
;(async () => {
const provider = new WsProvider(AppState.stateStore.ENDPOINT)
const api = await Api.create(provider)
AppState.stateStore.API = api
})()
}

render() {
return (
<Provider rootStore={AppState}>
<Polkawallet_App/>
<Polkawallet_App />
</Provider>

);
)
}
}

0 LICENSE 100644 → 100755
No changes.
0 README.md 100644 → 100755
No changes.
@@ -0,0 +1,54 @@
/* eslint-disable new-cap */
/* eslint-disable no-undef */
let _interopRequireDefault = require('@babel/runtime/helpers/interopRequireDefault')

let _types = require('@polkadot/types')

let _index = _interopRequireDefault(require('@polkadot/rpc-provider/mock/index'))

let _ = require('@polkadot/api')

// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.

describe.skip('Metadata queries', () => {
let mock
beforeEach(() => {
jest.setTimeout(3000000)
mock = new _index.default()
})
it('Create API instance with metadata map and makes the runtime, rpc, state & extrinsics available', async () => {
const rpcData = await mock.send('state_getMetadata', [])
const genesisHash = new _types.Hash(await mock.send('chain_getBlockHash', [])).toHex()
const specVersion = 0
const metadata = {}
const key = ''.concat(genesisHash, '-').concat(specVersion)
metadata[key] = rpcData
const api = await _.ApiPromise.create({
provider: mock,
metadata
})
expect(api.genesisHash).toBeDefined()
expect(api.runtimeMetadata.toJSON()).toEqual(new _types.Metadata(rpcData).toJSON())
expect(api.runtimeVersion).toBeDefined()
expect(api.rpc).toBeDefined()
expect(api.query).toBeDefined()
expect(api.tx).toBeDefined()
expect(api.derive).toBeDefined()
})
it('Create API instance without metadata and makes the runtime, rpc, state & extrinsics available', async () => {
const metadata = {}
const api = await _.ApiPromise.create({
provider: mock,
metadata
})
expect(api.genesisHash).toBeDefined()
expect(api.runtimeMetadata).toBeDefined()
expect(api.runtimeVersion).toBeDefined()
expect(api.rpc).toBeDefined()
expect(api.query).toBeDefined()
expect(api.tx).toBeDefined()
expect(api.derive).toBeDefined()
})
})
@@ -0,0 +1,69 @@
/* eslint-disable no-undef */
const { ScreenWidth, ScreenHeight, getUnit, formatData } = require('../src/util/Common')

test('formatData', () => {
expect(formatData({})).toEqual({})
})

test('ScreenWidth', () => {
expect(ScreenWidth).not.toBeNull()
})
test('ScreenHeight', () => {
expect(ScreenHeight).not.toBeNull()
})

test('getUnit femto', () => {
expect(getUnit('femto')).toBe('1')
})

test('getUnit pico', () => {
expect(getUnit('pico')).toBe('1000')
})

test('getUnit nano', () => {
expect(getUnit('nano')).toBe('1000000')
})

test('getUnit micro', () => {
expect(getUnit('micro')).toBe('1000000000')
})

test('getUnit milli', () => {
expect(getUnit('milli')).toBe('1000000000000')
})

test('getUnit DOT', () => {
expect(getUnit('DOT')).toBe('1000000000000000')
})

test('getUnit Kilo', () => {
expect(getUnit('Kilo')).toBe('1000000000000000000')
})

test('getUnit Mega', () => {
expect(getUnit('Mega')).toBe('1000000000000000000000')
})

test('getUnit Giga', () => {
expect(getUnit('Giga')).toBe('1000000000000000000000000')
})

test('getUnit Tera', () => {
expect(getUnit('Tera')).toBe('1000000000000000000000000000')
})

test('getUnit Peta', () => {
expect(getUnit('Peta')).toBe('1000000000000000000000000000000')
})

test('getUnit Exa', () => {
expect(getUnit('Exa')).toBe('1000000000000000000000000000000000')
})

test('getUnit Zeta', () => {
expect(getUnit('Zeta')).toBe('1000000000000000000000000000000000000')
})

test('getUnit Yotta', () => {
expect(getUnit('Yotta')).toBe('1000000000000000000000000000000000000000')
})

0 comments on commit 8701f4e

Please sign in to comment.
You can’t perform that action at this time.