1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

web3message fixes, formatting fixes

This commit is contained in:
Matthias Kretschmann 2019-04-08 10:44:03 +02:00
parent 00e69646ad
commit a04b2553e5
Signed by: m
GPG Key ID: 606EEEF3C479A91F
10 changed files with 102 additions and 97 deletions

View File

@ -1026,14 +1026,14 @@
"integrity": "sha512-p2n505t2K0zD1ZvGPhI6EsSviEVLCB7BYowhf/ONmVaWED138PaG4Z9nY6YuHU383uOoIWT+Lq3dLkFzDzstXw=="
},
"@oceanprotocol/keeper-contracts": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.9.0.tgz",
"integrity": "sha512-QrTCQNiQa9KszH6/dTAS0a8AoW/SIEkZazXTwA2aoePBS0X8fNpsKvT3N2OuR1YPAjCU3rGWzYdV4TNnMNbsSw=="
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.9.1.tgz",
"integrity": "sha512-c1LvaH+e1tzow0gZLwSWe19ap+DrZuNmZfxBdwEVEPQXarI0jTXa5qVDoiBow8kBWaqSIUgFAzQOJW8rKdlS1A=="
},
"@oceanprotocol/squid": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-0.5.0.tgz",
"integrity": "sha512-yGu121WJ9XEX1U4ql/p7ISV36fqNydxGBYgXHbOjeXS/kvNFx3hP2emBf4QA12PjPZcmuLz0wE+7GBL4H/v+eA==",
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-0.5.1.tgz",
"integrity": "sha512-YJewmMIpHG5cjsOsgOynky7z+5YT7l5+niW9AqCMOoMGy76VEe1+6nmAhZ/PB9BtIpYCGWOl1Y68I32qhX9IWQ==",
"requires": {
"@oceanprotocol/keeper-contracts": "^0.9.0",
"bignumber.js": "^8.0.1",

View File

@ -150,7 +150,7 @@ class App extends Component<{}, AppState> {
balance,
network,
account: accounts[0].getId(),
isLoading: false,
isLoading: false
})
} else {
this.setState({

View File

@ -48,9 +48,7 @@ export default class AssetsUser extends PureComponent<
}
public render() {
return (
this.context.isNile &&
this.context.account ? (
return this.context.isNile && this.context.account ? (
<div className={styles.assetsUser}>
{this.props.recent && (
<h2 className={styles.subTitle}>
@ -93,7 +91,6 @@ export default class AssetsUser extends PureComponent<
) : (
<Web3message />
)
)
}
}

View File

@ -26,9 +26,12 @@ export default class Web3message extends PureComponent {
public noWeb3() {
return (
<div className={styles.message}>
<AccountStatus className={styles.status} /> Not a Web3 Browser. For
publishing or consuming an asset you need to{' '}
<a href="https://docs.oceanprotocol.com/tutorials/metamask-setup/" target="_blank">
<AccountStatus className={styles.status} /> Not a Web3 Browser.
For publishing or consuming an asset you need to{' '}
<a
href="https://docs.oceanprotocol.com/tutorials/metamask-setup/"
target="_blank"
>
setup MetaMask
</a>{' '}
or use any other Web3-capable plugin or browser.
@ -40,7 +43,7 @@ export default class Web3message extends PureComponent {
return (
<div className={styles.message}>
<AccountStatus className={styles.status} /> Account locked. For
publishing an asset you need to unlock your Web3 account.
publishing an asset you need to unlock your Web3 account.{' '}
<Button link onClick={states.startLogin}>
Unlock account
</Button>

View File

@ -13,24 +13,32 @@ export const nodeHost = process.env.REACT_APP_NODE_HOST || 'nile.dev-ocean.com'
export const nodePort = process.env.REACT_APP_NODE_PORT || 443
export const aquariusScheme = process.env.REACT_APP_AQUARIUS_SCHEME || 'https'
export const aquariusHost = process.env.REACT_APP_AQUARIUS_HOST || 'nginx-aquarius.dev-ocean.com'
export const aquariusHost =
process.env.REACT_APP_AQUARIUS_HOST || 'nginx-aquarius.dev-ocean.com'
export const aquariusPort = process.env.REACT_APP_AQUARIUS_PORT || 443
export const brizoScheme = process.env.REACT_APP_BRIZO_SCHEME || 'https'
export const brizoHost = process.env.REACT_APP_BRIZO_HOST || 'nginx-brizo.dev-ocean.com'
export const brizoHost =
process.env.REACT_APP_BRIZO_HOST || 'nginx-brizo.dev-ocean.com'
export const brizoPort = process.env.REACT_APP_BRIZO_PORT || 443
export const brizoAddress = process.env.REACT_APP_BRIZO_ADDRESS || '0x376817c638d2a04f475a73af37f7b51a2862d567'
export const brizoAddress =
process.env.REACT_APP_BRIZO_ADDRESS ||
'0x376817c638d2a04f475a73af37f7b51a2862d567'
export const parityScheme = process.env.REACT_APP_PARITY_SCHEME || 'https'
export const parityHost = process.env.REACT_APP_PARITY_HOST || 'nile.dev-ocean.com'
export const parityHost =
process.env.REACT_APP_PARITY_HOST || 'nile.dev-ocean.com'
export const parityPort = process.env.REACT_APP_PARITY_PORT || 443
export const secretStoreScheme = process.env.REACT_APP_SECRET_STORE_SCHEME || 'https'
export const secretStoreHost = process.env.REACT_APP_SECRET_STORE_HOST || 'secret-store.dev-ocean.com'
export const secretStoreScheme =
process.env.REACT_APP_SECRET_STORE_SCHEME || 'https'
export const secretStoreHost =
process.env.REACT_APP_SECRET_STORE_HOST || 'secret-store.dev-ocean.com'
export const secretStorePort = process.env.REACT_APP_SECRET_STORE_PORT || 443
export const faucetScheme = process.env.REACT_APP_FAUCET_SCHEME || 'https'
export const faucetHost = process.env.REACT_APP_FAUCET_HOST || 'faucet.nile.dev-ocean.com'
export const faucetHost =
process.env.REACT_APP_FAUCET_HOST || 'faucet.nile.dev-ocean.com'
export const faucetPort = process.env.REACT_APP_FAUCET_PORT || 443
//
@ -65,4 +73,3 @@ export const faucetPort = process.env.REACT_APP_FAUCET_PORT || 443
// export const faucetPort = 3001
export const verbose = true

View File

@ -85,19 +85,23 @@ export default class AssetFile extends PureComponent<
<Button
primary
className={styles.buttonMain}
onClick={() => this.purchaseAsset(ddo, file.index)}
onClick={() =>
this.purchaseAsset(ddo, file.index)
}
>
Get file
</Button>
) :
) : (
states.isWeb3 && (
<Button
primary
className={styles.buttonMain}
onClick={states.startLogin}>
onClick={states.startLogin}
>
Get file
</Button>
)
)
}
</User.Consumer>
)}

View File

@ -20,9 +20,7 @@ export default class AssetFilesDetails extends PureComponent<{
</div>
<User.Consumer>
{states =>
(!states.isNile || !states.isLogged) && (
<Web3message />
)
(!states.isNile || !states.isLogged) && <Web3message />
}
</User.Consumer>
</>

View File

@ -10,15 +10,13 @@ interface FaucetState {
isLoading: boolean
success?: string
error?: string
eth?: string
}
export default class Faucet extends PureComponent<{}, FaucetState> {
public state = {
isLoading: false,
success: undefined,
error: undefined,
eth: 'xx'
error: undefined
}
private getTokens = async (requestFromFaucet: () => any) => {
@ -55,15 +53,10 @@ export default class Faucet extends PureComponent<{}, FaucetState> {
>
Request Ether
</Button>
) :
states.isWeb3 ? (
<Button onClick={states.startLogin}>
Request Ether (unlock Metamask)
</Button>
) : states.isWeb3 ? (
<Web3message />
) : (
<Button onClick={(e: Event) => window.open("https://docs.oceanprotocol.com/tutorials/metamask-setup/", "_blank")}>
Request Ether (install Metamask)
</Button>
<Web3message />
)
}
</User.Consumer>
@ -105,11 +98,7 @@ export default class Faucet extends PureComponent<{}, FaucetState> {
description="Shower yourself with some Ether for the Ocean POA network."
>
<User.Consumer>
{states =>
!states.isNile && (
<Web3message />
)
}
{states => !states.isNile && <Web3message />}
</User.Consumer>
<this.ActionMarkup />

View File

@ -158,16 +158,20 @@ export default class Step extends PureComponent<StepProps, {}> {
{states =>
states.isLogged ? (
<Button primary>Register asset</Button>
) :
states.isWeb3 ? (
) : states.isWeb3 ? (
<Button onClick={states.startLogin}>
Register asset (unlock Metamask)
</Button>
) : (
<Button onClick={(e: Event) => {
<Button
onClick={(e: Event) => {
e.preventDefault()
window.open("https://docs.oceanprotocol.com/tutorials/metamask-setup/", "_blank")
}}>
window.open(
'https://docs.oceanprotocol.com/tutorials/metamask-setup/',
'_blank'
)
}}
>
Register asset (install Metamask)
</Button>
)

View File

@ -22,7 +22,10 @@ export class UrlCheckRouter {
headers: { Range: 'bytes=0-' }
},
(error, response) => {
if (response && response.statusCode.toString().startsWith('2')) {
if (
response &&
response.statusCode.toString().startsWith('2')
) {
const result: any = {}
result.found = true