- You can buy ticket with your wallet.
- Current version of Node.js <=v16.14.2
- Install dependencies:
yarn install
- [near-cli] is a command line interface (CLI) for interacting with the NEAR blockchain.
npm install -g near-cli
- clone this repo to a local folder
- run
yarn build:release
to build the app - run
yarn deploy
to deploy the app to the NEAR testnet - run
export CONTRACT=YOUR_DEV_ACCOUNT_HERE
- This function creates flight information on the NEAR blockchain.
Usage:
near call $CONTRACT create '{"origin": "İstanbul","destination": "İzmir","price":5,"date":"3 Mart","availableSeats":13 }' --accountId $OWNER
- This function buys ticket with your NEAR wallet. For the buy the ticket, you need to deposit the amount of ticket price.
Since the price is defined as an int during development, you will not get an error unless you type 0.
If you type amount like
--amount $1
the error occurs.
Usage:
near call $CONTRACT buyTicket '{"accountId": "Your_testnet_account","id":1441379057}' --accountId $OWNER --amount 1
- This function updates flight information on the NEAR blockchain. Origin, destination, price and date can be updated.
Usage:
near call $CONTRACT update '{"id":1441379057,"origin":"İstanbul","destination":"İzmir","price":1,"date":"19 Temmuz"}' --accountId $OWNER
- This function returns all flight information on the NEAR blockchain.
Usage:
near view $CONTRACT getAll '{"offset":0}' --accountId $OWNER
- This function returns flight information by id on the NEAR blockchain.
Usage:
near view $CONTRACT getById '{"id":1441379057}' --accountId $OWNER
- This function returns flight count on the NEAR blockchain.
Usage:
near view $CONTRACT getFlightCount '{}' --accountId $OWNER
- This function deletes flight information by id on the NEAR blockchain.
Usage:
near call $CONTRACT deleteById '{"id":1441379057}' --accountId $OWNER
- This function deletes all flight information on the NEAR blockchain.
Usage:
near call $CONTRACT deleteAllFlights '{}' --accountId $OWNER