Commit 6c63f4d0 authored by Viktor Velev's avatar Viktor Velev

Fixed tofixed issue

parent 6e3acead
......@@ -14,7 +14,7 @@ function init(){
var inst;
var address = "0x18159f1a276711d3e8114d4949c1731dbf816518";
var address = "0x8c67fefbf1f71737bc2ed4c38367d842899529a1";
var acc;
//temp fix:
......@@ -56,8 +56,6 @@ function isCallerAdmin() {
}
function getEventIDs() {
console.log(web3)
console.log(inst)
return new Promise((accept, reject) => {
inst.getEventIDs.call({"from": acc}, function(err, res){
if(!err) {
......@@ -70,7 +68,9 @@ function getEventIDs() {
}
function getEventByID(eventID) {
console.log(eventID)
return new Promise((accept, reject) => {
console.log("???")
inst.getEventByID.call(eventID, {"from": acc}, function(err, res){
if(!err) {
accept(res);
......@@ -132,11 +132,13 @@ function getEventPlacedBetsAmount(eventID) {
async function getEvents(){
let ids = await getEventIDs();
console.log(ids)
objects = []
for(let i=0; i<ids.length; i++) {
console.log("ssss")
let res = await getEventByID(ids[i]);
console.log(res)
objects.push(res);
}
......
......@@ -29,15 +29,18 @@ export default class BetPage extends Component {
}
}
parseBetTypes(rawBetTypes) {
rawBetTypes = [ rawBetTypes[0].toFixed(), rawBetTypes[1].toFixed() ]
let betTypes = []
rawBetTypes.forEach((betType) => {
betTypes.push(this.betTypes[betType])
})
return betTypes
parseBetTypes(raw) {
if (raw.length > 0 ){
let raw0 = raw[0].toFixed()
let raw1 = raw[1].toFixed()
let rawBetTypes = [ raw0, raw1 ]
let betTypes = []
rawBetTypes.forEach((betType) => {
betTypes.push(this.betTypes[betType])
})
return betTypes
}
}
parseEvent(propArray) {
......@@ -53,7 +56,6 @@ export default class BetPage extends Component {
//bigInt
let betTypes = this.parseBetTypes(propArray[5])
let closedBetTypes = this.parseBetTypes(propArray[6])
//bool
let active = propArray[7]
......@@ -96,6 +98,7 @@ export default class BetPage extends Component {
async getAllEvents() {
let rawEvents = await getEvents() //eslint-disable-line
console.log(rawEvents)
rawEvents.forEach((event) => {
this.state.events.push(this.parseEvent(event))
})
......
......@@ -5,6 +5,7 @@ import App from './App';
import registerServiceWorker from './registerServiceWorker';
import 'semantic-ui-css/semantic.min.css';
//dont ask
setTimeout(() => ReactDOM.render(<App />, document.getElementById('root')), 1);
registerServiceWorker();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment