2019-01-07 10:43:51 -08:00
|
|
|
import { constants } from '../utils/constants'
|
2018-02-01 14:48:48 -08:00
|
|
|
|
|
|
|
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
|
2018-02-01 14:48:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2018-02-01 14:48:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
|
|
|
})
|
2018-02-01 14:48:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
const helpers = {
|
2018-07-11 08:50:14 -07:00
|
|
|
addressesURL,
|
|
|
|
ABIURL,
|
2018-10-10 08:55:10 -07:00
|
|
|
getABI
|
2018-02-01 14:48:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default helpers
|