poa-dapps-validators/src/contracts/helpers.js

33 lines
734 B
JavaScript
Raw Permalink Normal View History

import { constants } from '../utils/constants'
function addressesURL(branch) {
2018-07-11 08:50:14 -07:00
const URL = `https://raw.githubusercontent.com/${constants.organization}/${constants.repoName}/${branch}/${
constants.addressesSourceFile
}`
console.log(URL)
return URL
}
function ABIURL(branch, contract) {
2018-07-11 08:50:14 -07:00
const URL = `https://raw.githubusercontent.com/${constants.organization}/${constants.repoName}/${branch}/abis/${
constants.ABIsSources[contract]
}`
console.log(URL)
return URL
}
function getABI(branch, contract) {
2018-07-11 08:50:14 -07:00
let addr = helpers.ABIURL(branch, contract)
return fetch(addr).then(function(response) {
return response.json()
})
}
const helpers = {
2018-07-11 08:50:14 -07:00
addressesURL,
ABIURL,
getABI
}
export default helpers