Skip to content

Commit

Permalink
Updated readme for ReadComponent example
Browse files Browse the repository at this point in the history
  • Loading branch information
clexmond committed Jun 18, 2024
1 parent eb64e6e commit ff898fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ Smart contract ABIs can be included with `import { starknetContracts, ethereumCo
### Components
All state in Influence is stored as components on the Dispatcher contract and can be accessed via a special system action `ReadComponent`.
Components are addressed by a key, typically the entity, and component name. For some components, the key is complex and includes multiple fields.
Call the `ReadComponent` system like: `Dispatcher.run_system('ReadComponent', { name: 'ComponentName', path: [ entity, key2, ... ]}`
For example, the `Crew` component is addressed by the crew's packed entity UUID:
```js
Dispatcher.call('run_system', Dispatcher.callData.compile('run_system', {
name: 'ReadComponent', calldata: [ 'Crew', 1, Entity.packEntity({ label: Entity.IDS.CREW, id: 4938 }) ]
}));
```

ABI types / schemas for all components can be found in `./contracts/starknet_components.json`.

Expand Down
2 changes: 0 additions & 2 deletions src/lib/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const IDS = {
BUILDING: 5,
SHIP: 6,
DEPOSIT: 7,
// ORDER: 8,
DELIVERY: 9,
SPACE: 10
};
Expand All @@ -19,7 +18,6 @@ const TYPES = {
[IDS.BUILDING]: { label: 'BUILDING' },
[IDS.SHIP]: { label: 'SHIP' },
[IDS.DEPOSIT]: { label: 'DEPOSIT' },
// [IDS.ORDER]: { label: 'ORDER' },
[IDS.DELIVERY]: { label: 'DELIVERY' },
[IDS.SPACE]: { label: 'SPACE' }
};
Expand Down

0 comments on commit ff898fe

Please sign in to comment.