Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gnosis/pm-trading-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
mmv08 committed Dec 11, 2018
2 parents ae9c1e0 + f549544 commit b3c8e67
Show file tree
Hide file tree
Showing 71 changed files with 16,749 additions and 16,408 deletions.
31,222 changes: 15,585 additions & 15,637 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"precommit"
],
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@gnosis.pm/pm-apollo-contracts": "^1.4.1",
"@gnosis.pm/pm-contracts": "1.0.4",
"@gnosis.pm/pm-js": "^2.1.0",
Expand Down
74 changes: 36 additions & 38 deletions src/api/gnosis.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ import { isFeatureEnabled } from 'utils/features'

const tournamentEnabled = isFeatureEnabled('tournament')

let gnosisInstance
let gnosisROInstance
const gnosisInstances = {
main: undefined,
readOnly: undefined,
}

if (window && process.env.NODE_ENV === 'development') {
window.gnosisInstances = {}
}

export const {
calcLMSRCost, calcLMSROutcomeTokenCount, calcLMSRMarginalPrice, calcLMSRProfit,
Expand All @@ -20,14 +26,17 @@ const addApolloContracts = async (gnosisJsInstance) => {
})
}

const waitForGnosisConnection = instance => new Promise((resolve, reject) => {
const waitForGnosisConnection = type => new Promise((resolve, reject) => {
let stillRunning = true
const instanceCheck = setInterval(() => {
const instance = gnosisInstances[type]
if (instance) {
stillRunning = false
clearInterval(instanceCheck)
return resolve(instance)
}

return undefined
}, 50)

setTimeout(() => {
Expand All @@ -42,8 +51,8 @@ const waitForGnosisConnection = instance => new Promise((resolve, reject) => {
* Initializes connection to GnosisJS
* @param {*dictionary} GNOSIS_OPTIONS
*/
export const initGnosisConnection = async (GNOSIS_OPTIONS) => {
if (gnosisInstance) return
export const initGnosisConnection = type => async (GNOSIS_OPTIONS) => {
if (gnosisInstances[type]) return

try {
const gnosis = await Gnosis.create(GNOSIS_OPTIONS)
Expand All @@ -52,38 +61,15 @@ export const initGnosisConnection = async (GNOSIS_OPTIONS) => {
await addApolloContracts(gnosis)
}

gnosisInstance = gnosis
gnosisInstances[type] = gnosis

if (process.env.NODE_ENV === 'development') {
window.gnosis = gnosisInstance
window.gnosisInstances[type] = gnosis
}

console.info('Gnosis Integration: connection established') // eslint-disable-line no-console
console.info(`Gnosis ${type} Integration: connection established`) // eslint-disable-line no-console
} catch (err) {
console.error('Gnosis Integration: connection failed') // eslint-disable-line no-console
console.error(err) // eslint-disable-line no-console
}
}

export const initReadOnlyGnosisConnection = async (GNOSIS_OPTIONS) => {
if (gnosisROInstance) return

try {
const gnosis = await Gnosis.create(GNOSIS_OPTIONS)

if (tournamentEnabled) {
await addApolloContracts(gnosis)
}

gnosisROInstance = gnosis

if (process.env.NODE_ENV === 'development') {
window.gnosisRO = gnosisROInstance
}

console.info('Gnosis RO Integration: connection established') // eslint-disable-line no-console
} catch (err) {
console.error('Gnosis RO Integration: connection failed') // eslint-disable-line no-console
console.error(`Gnosis ${type} Integration: connection failed`) // eslint-disable-line no-console
console.error(err) // eslint-disable-line no-console
}
}
Expand All @@ -92,19 +78,31 @@ export const initReadOnlyGnosisConnection = async (GNOSIS_OPTIONS) => {
* Returns an instance of the connection to GnosisJS
*/
export const getGnosisConnection = async () => {
if (gnosisInstance) {
return gnosisInstance
if (gnosisInstances.main) {
return gnosisInstances.main
}

return waitForGnosisConnection(gnosisInstance)
return waitForGnosisConnection('main')
}

export const getROGnosisConnection = async () => {
if (gnosisROInstance) {
return gnosisROInstance
if (gnosisInstances.readOnly) {
return gnosisInstances.readOnly
}

return waitForGnosisConnection(gnosisROInstance)
return waitForGnosisConnection('readOnly')
}

export const getROGnosisNetworkId = () => new Promise(async (resolve, reject) => {
const gnosisRO = await getROGnosisConnection()

gnosisRO.web3.version.getNetwork((err, network) => {
if (err) {
reject(err)
}

resolve(network)
})
})

export default Gnosis
45 changes: 45 additions & 0 deletions src/assets/img/icons/icon-attention.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions src/assets/img/icons/icon_attention.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/img/icons/icon_next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 72 additions & 2 deletions src/assets/locales/de/translation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"loading": "Wird geladen...",
"application": "Die Anwendung",
"and": "und",
"header": {
"markets": "Märkte",
"dashboard": "Dashboard",
Expand Down Expand Up @@ -106,5 +108,73 @@
"no_outcome_selected": "Bitte wählen Sie einen Ausgang",
"loss_detected": "Diese Transaktion wird nicht zugelassen, da Sie garantiert einen Verlust machen."
}
}
}
},
"legal": {
"heading": "AGB und Datenschutzerklärung",
"to_use_app": "Um {{appName}} zu nutzen, müssen Sie folgenden Punkten zustimmen",
"read_and_understood": "Ich stimme den <1>{{document}}</1> zu",
"documents": {
"terms_of_service": "Allgemeinen Geschäftsbedingungen",
"privacy_policy": "Datenschutzerklärung",
"risk_disclaimer": "Risikoerklärung",
"address_public_description": "Ich verstehe und stimme zu, dass meine Ethereum Adresse öffentlich dargestellt wird auf der Bestenliste"
}
},
"reward_claim": {
"info": "Um Ihre <1>{{value}} {{symbol}}</1> tokens zu beanspruchen, müssen Sie erst zum <2>{{targetNetwork}</span> Netzwerk wechseln mit Ihrem Wallet. Bitte stellen Sie sicher, dass Sie genügend ETH besitzen für die Gas-Kosten. Mehr dazu in unseren <3>FAQ</3>.",
"already_claimed": "Bereits beansprucht",
"claim": "Benaspruchen",
"current_network": "Derzeitiges Netzwerk: ",
"gas_estimation": "Geschätzte Gas-Kosten: ",
"errors": {
"wrong_network": "Bitte verbinden Sie sich zum oben genannten Netzwerk um Ihre Gewinne zu beanspruchen.",
"not_enough_balance": "Sie besitzen nicht genügend ETH um die Gas-Kosten für diese Transaktion zu decken.",
"failed_tx_ask_support": "Leider ist die Transaktion fehlgeschlagen. Bitte probieren Sie es erneut oder wenden Sie sich an unseren Support."
}
},
"initialisation_error": {
"heading": "Entschluldigung, es ist ein Fehler aufgetreten beim starten von {{provider}}.",
"instructions": "Bitte versichern Sie sich, dass Sie die neuste Version von {{provider}} nutzen oder kontaktieren Sie den Support."
},
"install_provider": {
"heading": "{{provider}} Installation",
"instructions": "{{provider}} ist derzeit nicht installiert oder wird nicht erkannt. <1>Bitte installieren Sie {{provider}}</1> um {{application}} zu verwenden."
},
"select_provider": {
"heading": "Wie möchten Sie Ihr Wallet verwenden?",
"switch_network": "Um die Anwendung zu verwenden, müssen Sie mit dem {{targetNetwork}} netzwerk verbunden sein."
},
"register_wallet": {
"heading": "Ihr Wallet registrieren",
"instructions": "Bitte registrieren Sie Ihr Wallet, an welches wir Ihre {{symbol} tokens gewinne, sowie anschließende {{rewardSymbol}} gewinne schicken können. Bitte lesen Sie unsere Geschäftsbedingungen für mehr Informationen.",
"eth_required": "Um Ihr Wallet zu registrieren brauchen Sie Rinkeby ETH.",
"rinkeby_eth_balance": "Rinkeby ETH Kontostand:",
"rinkeby_eth_request": "Rinkeby ETH beantragen",
"not_enough_balance": "Warnung: Nicht genügend Rinkeby ETH um die Transaktion durchzuführen.",
"register_wallet": "Wallet registrieren"
},
"register_uport": {
"heading": "Wallet für Ihre Gewinne angeben",
"disclaimer": "Bitte Geben Sie Ihre Wallet adresse an, an die wir Ihre GNO Gewinne schicken können, falls Sie es in die Top 50 schaffen. <br /> Bitte beachten Sie, dass Sie Ihr Wallet nur <em>einmal</em> registrieren können.",
"save_address": "Adresse Speichern",
"failed_tx_ask_support": "Entschuldigung, die Transaktion ist leider fehlgeschlagen. Bitte probieren Sie es erneut und wenden Sie sich dann an den Support!",
"ethereum_wallet_address": "Ethereum-Wallet Adresse",
"enter_valid_address": "Bitte geben Sie eine gültige Adresse ein"
},
"transaction_explanations": {
"heading": "Wir werden Sie bitten folgende Transaktionen zu akzeptieren:"
},
"unlock": {
"heading": "Entsperren Sie Ihren Metamask Account",
"instructions": "Bitte entsperren Sie Ihren Metamask Zugang, damit {{applicationName}} nutzen zu können."
},
"verification": {
"errors": {
"not_loaded": "Unser Benutzerverifizierungsservice konnte nicht geladen werden.",
"not_found": "Entschuldigen Sie die unanehmlichkeiten und probieren Sie es später noch einmal!"
}
},
"warning": {
"price_changed": "Ihre Transaktion wurde nicht verarbeitet weil sich die potentielle Marge verändert hat, durch den handel anderer Nutzer. <br />Bitte überprüfen Sie die Preise und versuchen sie es erneut."
},
}
14 changes: 7 additions & 7 deletions src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@
"failed_tx_ask_support": "Unfortunately, the transaction failed. Please try again or contact our support for further assistance."
}
},
"metamask": {
"install_metamask": "Install Metamask",
"missing": "Metamask is currently not installed or detected. <1>Please download and install Metamask</1> to start using {{name}}"
"install_provider": {
"heading": "Install {{provider}}",
"instructions": "{{provider}} is currently not installed or detected. <1>Please download and install {{provider}}</1> to start using {{application}}"
},
"register_wallet": {
"heading": "Register wallet address",
Expand All @@ -161,10 +161,6 @@
"ethereum_wallet_address": "Ethereum Address",
"enter_valid_address": "Please enter a valid address"
},
"switch_network": {
"heading": "Switch to the {{targetNetwork}} Network",
"instructions": "Your provider is not currently set to the {{targetNetwork}} network. Please switch to {{targetNetwork}} and make sure your wallet is unlocked to start using {{applicationName}}."
},
"transaction_explanations": {
"heading": "We will ask you to approve the following transactions:"
},
Expand Down Expand Up @@ -226,6 +222,10 @@
"reward": "Reward"
}
},
"select_provider": {
"heading": "How would you like to access your wallet?",
"switch_network": "To use the interface, your wallet has to be connected to the {{targetNetwork}} network."
},
"form": {
"field_required": "This field is required"
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/Identicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import createIcon from 'blockies'

import { hexWithoutPrefix } from 'utils/helpers'

const Identicon = ({ account, className }) => {
const Identicon = ({ account, className, ...props }) => {
const canvas = createIcon({
// All options are optional
seed: hexWithoutPrefix(account).toLowerCase(), // seed used to generate icon data, default: random
Expand All @@ -17,7 +17,7 @@ const Identicon = ({ account, className }) => {
// that look like eyes, mouths and noses.
})

return <img className={className} src={canvas.toDataURL()} alt={account} />
return <img className={className} src={canvas.toDataURL()} alt={account} {...props} />
}

Identicon.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.wrongNetwork {
background-size: cover;
margin-right: 10px;
}
Loading

0 comments on commit b3c8e67

Please sign in to comment.