From ff898fe45e516504597721d161abb200968b2726 Mon Sep 17 00:00:00 2001 From: Chris Lexmond Date: Tue, 18 Jun 2024 13:13:26 +0200 Subject: [PATCH] Updated readme for ReadComponent example --- README.md | 7 ++++++- src/lib/entity.js | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 032f030..df7368d 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/src/lib/entity.js b/src/lib/entity.js index 5fdce3d..5ace2cd 100644 --- a/src/lib/entity.js +++ b/src/lib/entity.js @@ -6,7 +6,6 @@ const IDS = { BUILDING: 5, SHIP: 6, DEPOSIT: 7, - // ORDER: 8, DELIVERY: 9, SPACE: 10 }; @@ -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' } };