Skip to content

Commit 4ea5901

Browse files
committed
update readme script
1 parent 27b74b6 commit 4ea5901

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

README.md

+25-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,31 @@ yarn gen:keys
3030
> [!WARNING]
3131
> Running the `gen:keys` script will overwrite the existing `.env` file.
3232
33+
## Working with addresses
34+
35+
Conversations in XMTP can be `DMs` or `Groups`. The underlying technicalities are the same, but DMs are essentially groups locked between two users that can be reused - basically a fixed group of 2. This is how MLS works.
36+
37+
Each member of a conversation has the following properties:
38+
39+
```tsx
40+
inboxId: string; // unique identifier from the XMTP network
41+
accountAddresses: Array<string>; // ethereum network addresses
42+
installationIds: Array<string>; // How many active devices the user has
43+
permissionLevel: PermissionLevel; // In the context of a group, if it's admin or not
44+
consentState: ConsentState; // If it's blocked or allowed via consent
45+
```
46+
47+
To fetch an ethereum address in a DM, you can use a script like the following:
48+
49+
```tsx
50+
const address =
51+
(await group.members?.find(
52+
(member: any) => member.inboxId === dm.dmPeerInboxId,
53+
)?.accountAddresses[0]) || "";
54+
```
55+
56+
> XMTP is working on integrating passkeys as a pillar of identity. Expect a breaking change soon as XMTP prepares for the first v3 stable release.
57+
3358
## Examples
3459

3560
- [gm](/examples/gm/): A simple agent that replies to all text messages with "gm".
@@ -51,6 +76,3 @@ Examples integrating XMTP with external libraries from the ecosystem
5176
Interact with the XMTP network using [xmtp.chat](https://xmtp.chat), the official web inbox for developers.
5277

5378
![](/media/chat.png)
54-
55-
> [!WARNING]
56-
> This React app isn't a complete solution. For example, the list of conversations doesn't update when new messages arrive in existing conversations.

0 commit comments

Comments
 (0)