Skip to content

Commit

Permalink
Update simple-agent example to define location for EventLog
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Hinek <[email protected]>
  • Loading branch information
frankhinek committed Apr 21, 2023
1 parent 1b4d64e commit 6d63a0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/simple-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DATASTORE-*
EVENTLOG-*
INDEX-*
MESSAGESTORE-*
7 changes: 4 additions & 3 deletions examples/simple-agent/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import getRawBody from 'raw-body';
import { DataStoreLevel, Dwn, MessageStoreLevel } from '@tbd54566975/dwn-sdk-js';
import { DataStoreLevel, Dwn, EventLogLevel, MessageStoreLevel } from '@tbd54566975/dwn-sdk-js';
import { Web5 } from '@tbd54566975/web5';
import fs from 'node:fs';
import mkdirp from 'mkdirp';
Expand All @@ -9,12 +9,13 @@ import { createRequire } from 'node:module';
// in the same directory. If you don't do this, you will get LevelDB lock errors.
const port = await getPort(process.argv);
const dataStore = new DataStoreLevel({ blockstoreLocation: `DATASTORE-${port}` });
const eventLog = new EventLogLevel({ location: `EVENTLOG-${port}` });
const messageStore = new MessageStoreLevel({
blockstoreLocation : `MESSAGESTORE-${port}`,
indexLocation : `INDEX-${port}`,
});

const dwnNode = await Dwn.create({ messageStore, dataStore });
const dwnNode = await Dwn.create({ dataStore, eventLog, messageStore });

export const web5 = new Web5({ dwn: { node: dwnNode }});

Expand Down Expand Up @@ -57,7 +58,7 @@ export async function loadConfig() {
web5.did.manager.set(didState.id, {
connected: true,
endpoint: 'app://dwn',
keys: didState.keys['#dwn'].keyPair,
keys: { ['#dwn']: { keyPair: didState.keys[0].keyPair} },
});
}

Expand Down

0 comments on commit 6d63a0b

Please sign in to comment.