Skip to content

Commit

Permalink
refactor: update readme file with more details
Browse files Browse the repository at this point in the history
  • Loading branch information
ezesundayeze committed Nov 28, 2021
1 parent d6c7d08 commit e7622a3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ npm install -g near-cli

--- check scripts in `./scripts` ---

## How it works

- This smart contract can be used by a delivery company to track deliveries from the warehouse to the item's destination
- at every point the item moves, the delivery agent will need to update the current location, basically by creating a shipment with the same information and only changing the `status` and `currentLoction`
- in the end the status will be changed to delivered and the current location will be set to the destination.




2 changes: 1 addition & 1 deletion scripts/2.use-contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ echo ---------------------------------------------------------
echo
echo

near view $CONTRACT entry
near view $CONTRACT entries

echo
echo
Expand Down
6 changes: 3 additions & 3 deletions src/assembly/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { MapEntry } from "near-sdk-as"

export function create(shipment: string, currentLocation: string, status: string): Shipment {

return Shipment.insert(shipment, currentLocation, status);
return Shipment.create(shipment, currentLocation, status);
}

export function entry(): MapEntry<u32, Shipment>[] {
return Shipment.entry();
export function entries(): MapEntry<u32, Shipment>[] {
return Shipment.entries();
}

export function get(id: u32): Shipment {
Expand Down
4 changes: 2 additions & 2 deletions src/assembly/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Shipment {
this.status = status;
}

static insert(shipment: string, currentLocation: string, status: string): Shipment {
static create(shipment: string, currentLocation: string, status: string): Shipment {
const cargo = new Shipment(shipment, currentLocation, status);
shipments.set(cargo.id, cargo);
return cargo;
Expand All @@ -27,7 +27,7 @@ export class Shipment {
return cargo;
}

static entry(): MapEntry<u32, Shipment>[] {
static entries(): MapEntry<u32, Shipment>[] {
const cargos = shipments.entries()!;
return cargos;
}
Expand Down

0 comments on commit e7622a3

Please sign in to comment.