Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabo/enable account creation as default on testnet #2409

Merged
merged 4 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ const rpc =
const faucet = process.env.FAUCET !== undefined ? process.env.FAUCET : `https://faucet.voyager.ninja`

export default {
name: `Cosmos Voyager`,
name: `Cosmos Lunie`,
development: dev,
default_network: `${dev ? `local-` : ``}testnet`,
network: process.env.NETWORK || `local-testnet`,
stargate,
rpc,
google_analytics_uid: `UA-51029217-3`,
sentry_dsn: `https://afb30cc1460e4464a98e89600bb0926e@sentry.io/1429416`,
node_halted_timeout: 120000,
block_timeout: 10000,
default_gas_price: 2.5e-8, // recomended from Cosmos Docs
default_gas_price: 2.5e-8, // recommended from Cosmos Docs
default_gas_adjustment: 1.5,
faucet,
version: process.env.RELEASE
Expand Down
2 changes: 1 addition & 1 deletion app/src/helpers/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function getURLParams(window) {
const queries = window.location.search.slice(1).split(`&`)
return queries.reduce((config, current) => {
const [name, value] = current.split(`=`)
if ([`stargate`, `rpc`, `experimental`, `insecure`].includes(name)) {
if ([`stargate`, `rpc`, `experimental`].includes(name)) {
return {
...config,
[name]: value
Expand Down
16 changes: 0 additions & 16 deletions app/src/network.js

This file was deleted.

6 changes: 0 additions & 6 deletions app/src/renderer/components/common/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
</div>
</template>
</div>
<div
v-if="!session.experimentalMode && session.insecureMode"
id="develop-mode-warning"
>
INSECURE MODE
</div>
<app-menu v-if="open || desktop" @close="close" />
</div>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/common/TmSessionLoading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="tm-session-container tm-session-loading">
<div class="tm-session-header">
<div class="tm-session-title">
Connecting to '{{ session.default_network }}'&hellip;
Connecting to '{{ session.network }}'&hellip;
</div>
</div>
<div class="tm-session-main tm-session-main--loading">
Expand Down
63 changes: 41 additions & 22 deletions app/src/renderer/components/common/TmSessionWelcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,37 @@
@click.native="setState('hardware')"
/>
<template v-if="session.insecureMode">
<li-session
v-if="accountExists"
id="sign-in-with-account"
icon="lock"
title="Sign in with password"
subtitle="If you have an account, choose this option."
@click.native="setState('sign-in')"
/>
<li-session
icon="person_add"
title="Create new account"
subtitle="Generate a brand new seed and create a new account."
@click.native="setState('sign-up')"
/>
<li-session
v-if="session.experimentalMode"
id="import-seed"
icon="settings_backup_restore"
title="Import with seed"
subtitle="Use an existing seed phrase to create an account."
@click.native="setState('import')"
/>
<div class="danger-zone">
<div class="header">
<h1>DANGER ZONE</h1>
<p>
Never use accounts created in the browser on a real network. You
could loose all your money.
</p>
</div>
<li-session
v-if="accountExists"
id="sign-in-with-account"
icon="lock"
title="Sign in with password"
subtitle="If you have an account, choose this option."
@click.native="setState('sign-in')"
/>
<li-session
icon="person_add"
title="Create new account"
subtitle="Generate a brand new seed and create a new account."
@click.native="setState('sign-up')"
/>
<li-session
v-if="session.developmentMode"
id="import-seed"
icon="settings_backup_restore"
title="Import with seed"
subtitle="Use an existing seed phrase to create an account."
@click.native="setState('import')"
/>
</div>
</template>
</div>
</div>
Expand Down Expand Up @@ -70,3 +79,13 @@ export default {
}
}
</script>
<style scoped>
.danger-zone {
border: 1px solid var(--danger);
}

.danger-zone .header {
color: var(--danger);
padding: 1rem 1rem 0 1rem;
}
</style>
3 changes: 0 additions & 3 deletions app/src/renderer/scripts/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ export const startApp = async (
if (urlParams.experimental) {
store.commit(`setExperimentalMode`)
}
if (urlParams.insecure) {
store.commit(`setInsecureMode`)
}
if (urlParams.rpc) {
store.commit(`setRpcUrl`, urlParams.rpc)
}
Expand Down
15 changes: 0 additions & 15 deletions app/src/renderer/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,10 @@ input.tm-field {
flex-flow: column no-wrap;
}

#develop-mode-warning {
background: red;
text-align: center;
height: 1.5rem;
font-weight: 500;
z-index: 1000000;
width: 100%;
top: 0;
position: absolute;
}

#appzi-launch-button-cf1d801a-9653-4934-8a18-cea8c9e77495 {
z-index: var(--z-appHeader) !important;
}

.mobile #develop-mode-warning {
position: relative;
}

@media screen and (min-width: 1023px) {
#app {
padding-top: 0;
Expand Down
4 changes: 4 additions & 0 deletions app/src/renderer/vuex/modules/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export default function ({ node }) {
height: status.sync_info.latest_block_height,
chain_id: status.node_info.network
})

if (status.node_info.network === `testnet`) {
commit(`setInsecureMode`)
}
})

node.rpc.subscribe(
Expand Down
5 changes: 3 additions & 2 deletions app/src/renderer/vuex/modules/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export default () => {
const ERROR_COLLECTION_KEY = `voyager_error_collection`

const state = {
experimentalMode: config.development, // development mode
insecureMode: config.development, // show the local signer
developmentMode: config.development, // can't be set in browser
experimentalMode: config.development, // development mode, can be set from browser
insecureMode: false, // show the local signer
gasPrice: config.default_gas_price, // price per unit of gas
gasAdjustment: config.default_gas_adjustment, // default adjustment multiplier
signedIn: false,
Expand Down
1 change: 1 addition & 0 deletions changes/fabo_insecure-by-default
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Changed] [#2409](https://github.com/cosmos/lunie/pull/2409) Enable web accounts per default on a testnet @faboweb
7 changes: 0 additions & 7 deletions test/unit/specs/App.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,6 @@ describe(`App Start`, () => {

expect(store.commit).toHaveBeenCalledWith(`setExperimentalMode`)
})
it(`should set insecure mode`, async () => {
const { store } = await start({
insecure: true
})

expect(store.commit).toHaveBeenCalledWith(`setInsecureMode`)
})

it(`should set rpc url`, async () => {
const { store } = await start({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe(`TmSessionLoading`, () => {
wrapper = shallowMount(TmSessionLoading, {
data: () => ({
session: {
default_network: `mock-net`
network: `mock-net`
}
})
})
Expand Down
4 changes: 2 additions & 2 deletions test/unit/specs/components/common/TmSessionWelcome.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe(`TmSessionWelcome`, () => {

beforeEach(() => {
const getters = {
session: { accounts, insecureMode: true, experimentalMode: true },
session: { accounts, insecureMode: true, developmentMode: true },
lastPage: `/`
}
$store = {
Expand Down Expand Up @@ -113,7 +113,7 @@ describe(`TmSessionWelcome`, () => {

it(`should hide seed import if not in development`, () => {
expect(wrapper.find(`#import-seed`).exists()).toBe(true)
wrapper.vm.session.experimentalMode = false
wrapper.vm.session.developmentMode = false
expect(wrapper.find(`#import-seed`).exists()).toBe(false)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ exports[`AppHeader should display the sidebar on desktop 1`] = `
<!---->
</div>

<div
id="develop-mode-warning"
>

INSECURE MODE

</div>

<app-menu-stub />
</div>
</nav>
Expand Down Expand Up @@ -65,14 +57,6 @@ exports[`AppHeader should show the sidebar as a menu on mobile 1`] = `
<!---->
</div>

<div
id="develop-mode-warning"
>

INSECURE MODE

</div>

<app-menu-stub />
</div>
</nav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,39 @@ exports[`TmSessionWelcome with accounts has the expected html structure 1`] = `
title="Sign in with Ledger Nano S"
/>

<li-session-stub
icon="lock"
id="sign-in-with-account"
subtitle="If you have an account, choose this option."
title="Sign in with password"
/>

<li-session-stub
icon="person_add"
subtitle="Generate a brand new seed and create a new account."
title="Create new account"
/>

<!---->
<div
class="danger-zone"
>
<div
class="header"
>
<h1>
DANGER ZONE
</h1>

<p>

Never use accounts created in the browser on a real network. You
could loose all your money.

</p>
</div>

<li-session-stub
icon="lock"
id="sign-in-with-account"
subtitle="If you have an account, choose this option."
title="Sign in with password"
/>

<li-session-stub
icon="person_add"
subtitle="Generate a brand new seed and create a new account."
title="Create new account"
/>

<!---->
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -93,20 +112,39 @@ exports[`TmSessionWelcome without accounts has the expected html structure 1`] =
title="Sign in with Ledger Nano S"
/>

<!---->

<li-session-stub
icon="person_add"
subtitle="Generate a brand new seed and create a new account."
title="Create new account"
/>

<li-session-stub
icon="settings_backup_restore"
id="import-seed"
subtitle="Use an existing seed phrase to create an account."
title="Import with seed"
/>
<div
class="danger-zone"
>
<div
class="header"
>
<h1>
DANGER ZONE
</h1>

<p>

Never use accounts created in the browser on a real network. You
could loose all your money.

</p>
</div>

<!---->

<li-session-stub
icon="person_add"
subtitle="Generate a brand new seed and create a new account."
title="Create new account"
/>

<li-session-stub
icon="settings_backup_restore"
id="import-seed"
subtitle="Use an existing seed phrase to create an account."
title="Import with seed"
/>
</div>
</div>
</div>
</div>
Expand Down
Loading