Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

store provider object + scripts #6

Merged
merged 5 commits into from
Oct 26, 2017
Merged

store provider object + scripts #6

merged 5 commits into from
Oct 26, 2017

Conversation

satello
Copy link
Contributor

@satello satello commented Oct 24, 2017

No description provided.

@satello satello requested a review from n1c01a5 October 25, 2017 14:57
@satello satello force-pushed the store_provider_wrapper branch from 3613512 to d7ffa1c Compare October 25, 2017 23:13
@satello
Copy link
Contributor Author

satello commented Oct 25, 2017

I removed the transpiled js from git. Seems like something unnecessary to track

Copy link
Contributor

@n1c01a5 n1c01a5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's ok. I added some comment to improve the code.

@@ -1 +1,2 @@
export const LOCALHOST_PROVIDER = 'http://localhost:8545'
export const LOCALHOST_ETH_PROVIDER = 'http://localhost:8545'
export const LOCALHOST_STORE_PROVIDER = 'http://localhost:3001'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use kleros.in by default

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later we can use process.env

}

getUserProfile = async (userAddress) => {
let httpResponse = await this._makeRequest('GET', this._storeUri + '/' + userAddress)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you use template es6 ${}?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use const

"description": "Kleros API",
"main": "lib/kleros-api.js",
"scripts": {
"build": "webpack --env build",
"dev": "webpack --progress --colors --watch --env dev",
"test": "jest",
"deploy": "yarn build && yarn deploy",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice command


getDocumentsForDispute = async (userAddress, hash) => {
const userProfile = await this.getUserProfile(userAddress)
if (!userProfile) throw new Error("No profile found for address: " + userAddress)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use single quote

return o.hash === hash
})

if (disputeData.length < 1) return null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use lodash _.isEmpty()

if (httpResponse) {
return JSON.parse(httpResponse)
} else {
return null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be more explicit

}

newUserProfile = async (userAddress, contractsData = {}, disputesData = {}) => {
let httpResponse = await this._makeRequest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use const

@@ -41,10 +42,10 @@ class Kleros {
storeProvider=null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add spaces

import {LOCALHOST_ETH_PROVIDER, LOCALHOST_STORE_PROVIDER} from '../constants'
import config from '../config'

const contractDataFake = [{"hash": "0x139963ddb98576ddd5f39c14b6cf2c12670b38a1", "contentDocument": '{"evidenceB": "<some byte string>"}'}]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use single quotes

@n1c01a5 n1c01a5 merged commit e195d6f into master Oct 26, 2017
@satello satello deleted the store_provider_wrapper branch May 18, 2018 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants