forked from maticnetwork/ethindia-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.js
45 lines (31 loc) · 980 Bytes
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import AirbnbABI from './airbnbABI'
const Web3 = require('web3')
let metamaskWeb3 = new Web3('http://localhost:8545')
let account = null
let airbnbContract
let airbnbContractAddress = '' // Paste Contract address here
export function web3() {
return metamaskWeb3
}
export const accountAddress = () => {
return account
}
export async function setProvider() {
// TODO: get injected Metamask Object and create Web3 instance
}
function getAirbnbContract() {
// TODO: create and return contract Object
}
export async function postProperty(name, description, price) {
// TODO: call Airbnb.rentOutproperty
alert('Property Posted Successfully')
}
export async function bookProperty(spaceId, checkInDate, checkOutDate, totalPrice) {
// TODO: call Airbnb.rentSpace
alert('Property Booked Successfully')
}
export async function fetchAllProperties() {
// TODO: call Airbnb.propertyId
// iterate till property Id
// push each object to properties array
}