This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ethAirBalloons = require('ethairballoons'); | |
| const path = require('path'); | |
| const savePath = path.resolve(__dirname + '/contracts'); | |
| const express = require('express') | |
| const bodyParser = require('body-parser') | |
| const app = express() | |
| const port = 3000 | |
| app.use(bodyParser.json()) | |
| const ethAirBalloonsProvider = ethAirBalloons('http://localhost:8545', savePath); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var updatedCarObject = { engine: 'V9', wheels: 4 }; | |
| Car.updateById('Audi A4', updatedCarObject, function (err, updatedObject) { | |
| if (!err) { | |
| console.log('object updated successfully'); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Car.deleteById('Audi A4', function (err, success) { | |
| if (!err) { | |
| console.log('object deleted successfully'); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Car.findById('Audi A4', function (err, record) { | |
| if (!err) { | |
| console.log(record); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Car.find(function (err, allRecords) { | |
| if (!err) { | |
| console.log(allRecords); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var newCarObject = {model:'Audi A4', engine: 'V8', wheels: 4}; | |
| Car.save(newCarObject, function (err, objectSaved) { | |
| if (!err) { | |
| console.log('object saved'); | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Car.deploy(function (err, success) { | |
| if (!err) { | |
| console.log('Deployed successfully'); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ethAirBalloons = require('ethairballoons'); | |
| var path = require('path'); | |
| var savePath = path.resolve(__dirname + '/contracts'); | |
| var ethAirBalloonsProvider = ethAirBalloons('http://localhost:8545', savePath); | |
| //ethereum blockchain provider URL, path to save auto generated smart contracts | |
| var Car = ethAirBalloonsProvider.createSchema({ | |
| name: "Car", | |
| contractName: "carsContract", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return ( | |
| <div className="App"> | |
| <div style={{width: '270px', overflowY: 'scroll', margin: 'auto'}}> | |
| {checkboxItems()} | |
| <p>{state.selections.toString()}</p> | |
| </div> | |
| </div> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function handleCheckboxChange(key: string) { | |
| let sel = state.selections | |
| let find = sel.indexOf(key) | |
| if (find > -1) { | |
| sel.splice(find, 1) | |
| } else { | |
| sel.push(key) | |
| } | |
| setState({ |