Created
July 8, 2022 12:48
-
-
Save petrosDemetrakopoulos/4aae442b98c8e01b6eb1330d98047574 to your computer and use it in GitHub Desktop.
EthairBalloons Python Example
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
| from ethairballoons.ethairballoons import ethairBalloons | |
| prov = ethairBalloons('127.0.0.1', '..') | |
| carSchema = prov.createSchema(modelDefinition={ | |
| 'name': "Car", | |
| 'contractName': "carsContract", | |
| 'properties': [{ | |
| 'name': "model", | |
| 'type': "bytes32", | |
| 'primaryKey': True | |
| }, | |
| { | |
| 'name': "engine", | |
| 'type': "bytes32", | |
| }, | |
| { | |
| 'name': "cylinders", | |
| 'type': "uint" | |
| } | |
| ] | |
| }) | |
| carSchema.deploy() | |
| receipt = carSchema.save({ | |
| 'model': 'A4', | |
| 'engine': 'V8', | |
| 'cylinders': '8' | |
| }) | |
| print(receipt) | |
| print(carSchema.find()) | |
| print(carSchema.findById('A567')) | |
| print(carSchema.updateById('A4', {'model': 'A4', | |
| 'engine': 'V18', | |
| 'cylinders': '18'})) | |
| print(carSchema.find()) | |
| print(carSchema.deleteById('A4')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment