Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snap Support #446

Merged
merged 91 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
eeb9f2d
feat: begin adding some group conversation features
nakajima May 22, 2023
25edc2e
Use metadata instead of group context, remove redundant fields
nakajima May 23, 2023
03022c1
Remove shared wallet
nakajima May 23, 2023
a46043f
cleanup
nakajima May 23, 2023
8b39ad8
Add super basic test
nakajima May 23, 2023
e10adaa
unlink proto npm
nakajima May 23, 2023
39d452a
Make sure we're not mutating when we don't wanna
nakajima May 23, 2023
6cc1dc1
Update test to reflect group-ness being part of the conversation ID
nakajima May 24, 2023
ad6d582
Don't consider empty initialMembers as a group
nakajima May 24, 2023
0061e3d
use local we already have
nakajima May 24, 2023
6869df9
Simplify API for creating a new group convo
nakajima May 24, 2023
f632e70
Merge branch 'beta' into multi-invites
nakajima May 24, 2023
748720e
Make sure creator address is in initial members and dedup
nakajima May 24, 2023
c0fb9af
Merge branch 'multi-invites' of https://github.com/xmtp/xmtp-js into …
nakajima May 24, 2023
1746cca
Avoid self dh
nakajima May 24, 2023
8ba9854
Introduce group content types
nakajima May 25, 2023
513c7ec
Add a test for adding members
nakajima May 25, 2023
8855108
Add additional assertion to make sure member adding actually works
nakajima May 25, 2023
6f5d860
Update authority id
nakajima May 25, 2023
0805413
remove unnecessary wrapper around newGroupConversation
nakajima May 25, 2023
2fc86b9
punt on nicknames
nakajima May 25, 2023
1bb882f
fix: no need for this change
nakajima May 25, 2023
9884c6f
fix: no need for this change
nakajima May 25, 2023
2a6229d
fix: crypto import
nakajima May 25, 2023
e2503ff
fix: crypto import
nakajima May 25, 2023
6903495
feat: introduce dedicated group chat invitation topic
nakajima May 30, 2023
94e9c2d
fix: topic prefixes can't have dashes
nakajima May 30, 2023
786f8e6
Update src/conversations/Conversations.ts
nakajima May 30, 2023
52e83e5
Merge branch 'multi-invites' into group-content-types
nakajima May 30, 2023
6a29c2d
fix: add runtime validation
nakajima May 30, 2023
a4cd52b
fix: add upper bound to title
nakajima May 30, 2023
9da20ac
Merge branch 'group-content-types' of https://github.com/xmtp/xmtp-js…
nakajima May 30, 2023
8b2c3f6
fix: flip order
nakajima May 30, 2023
7dba17c
fix: remove unnecessary property
nakajima May 30, 2023
74c4ef1
Merge pull request #384 from xmtp/group-content-types
nakajima May 30, 2023
ff2a15b
fix: lint
nakajima May 30, 2023
828b3dc
fix: handle case where group chat is enabled after initial convo loading
nakajima May 31, 2023
a9409b1
fix: topics must be ascii
nakajima May 31, 2023
8718e99
fix: remove commented code
nakajima May 31, 2023
995d556
Merge pull request #381 from xmtp/multi-invites
nakajima May 31, 2023
bde44e6
feat: add isGroup to Conversation interface
nakajima Jun 1, 2023
781ed49
Merge pull request #387 from xmtp/add-is-group-conversation
nakajima Jun 1, 2023
fa3f753
fix: export group chat content types
nakajima Jun 1, 2023
347a25d
Merge pull request #389 from xmtp/export-missing-content-types
nakajima Jun 1, 2023
1f4bfb9
fix: include group conversations in conversations.stream()
nakajima Jun 1, 2023
23c96b6
fix: stream group chat messages in streamAllMessages
nakajima Jun 1, 2023
6f6379a
Merge pull request #390 from xmtp/stream-group-conversations
nakajima Jun 1, 2023
2063235
fix: use proper contenttypeid definition for group chat types
nakajima Jun 15, 2023
e96a54f
fix: group conversations coming from stream should be marked isGroup
nakajima Jun 15, 2023
127694a
fix: imports
nakajima Jun 16, 2023
7ec8662
Merge branch 'beta' into fix-content-types
nakajima Jun 16, 2023
3991968
Merge pull request #404 from xmtp/fix-content-types
nakajima Jun 16, 2023
87f9636
docs: update README for group chat (#388)
nakajima Jun 26, 2023
b087b04
feat: initial snap provider
neekolas Jun 28, 2023
dbbe579
feat: update keystore provider
neekolas Jun 29, 2023
7200366
feat: add new keystore methods
neekolas Jun 29, 2023
1419a3b
docs: add coments
neekolas Jun 29, 2023
48b9ab0
feat: add snap tests
neekolas Jul 5, 2023
2edc286
fix: add full meta object
neekolas Jul 5, 2023
a41823e
feat: clean up proto imports
neekolas Jul 5, 2023
106194d
build: add snap config
neekolas Jul 5, 2023
222a943
build: release on snap branch
neekolas Jul 5, 2023
1794726
build: fmt
neekolas Jul 5, 2023
8dfc8cc
Merge pull request #409 from xmtp/snap-support
neekolas Jul 5, 2023
2cfe3ff
fix: export SnapProvider
neekolas Jul 5, 2023
01d7ef0
fix: add more logging
neekolas Jul 6, 2023
2c450cc
fix: do not send empty params
neekolas Jul 6, 2023
f94d243
feat: use new GetV2ConversationsResponse
neekolas Jul 6, 2023
858b39d
build: rename RPCs to be generic
neekolas Jul 6, 2023
e101b6f
fix: move around api defs
neekolas Jul 7, 2023
5a8a4cd
Merge branch 'nmolnar/validate-private-key' into snap
neekolas Jul 7, 2023
3d83e94
build: update package-lock
neekolas Jul 7, 2023
13f8610
fix: export defaultKeystoreProviders
neekolas Jul 7, 2023
a8d2d85
fix: allow for empty strings to be sent
neekolas Jul 7, 2023
585ba43
build: eslint disable
neekolas Jul 7, 2023
262e048
feat: support group conversations
neekolas Jul 17, 2023
d6b6335
Merge branch 'beta' into snap
neekolas Aug 24, 2023
9e4160a
feat: remove group chat stuff
neekolas Aug 24, 2023
1777679
Merge branch 'beta' into nmolnar/merge-beta-to-snap
neekolas Aug 29, 2023
b282944
chore: make tests pass post-merge
neekolas Aug 29, 2023
2185e6c
chore: update RPCs available
neekolas Aug 29, 2023
0129b75
build: remove deployment from snap directory
neekolas Aug 29, 2023
112930f
feat: improved feature detection for Snaps
neekolas Aug 29, 2023
4ef2c6a
build: better typing for window.ethereum
neekolas Aug 30, 2023
4296b1f
test: add tests for users without metamask
neekolas Aug 30, 2023
77d0c90
chore: remove unused types
neekolas Aug 30, 2023
9859610
chore: remove unused types
neekolas Aug 30, 2023
c856165
test: add tests for SnapProvider
neekolas Aug 30, 2023
45c18ac
test: add one more assertion to tests
neekolas Aug 30, 2023
5e0bc9c
chore: remove newline
neekolas Aug 30, 2023
7f318b1
chore: add back newline
neekolas Aug 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 184 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"devDependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@metamask/providers": "^11.1.1",
"@types/benchmark": "^2.1.2",
"@types/bl": "^5.0.2",
"@types/callback-to-async-iterator": "^1.1.4",
Expand Down
50 changes: 0 additions & 50 deletions src/codecs/TypingNotification.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

This file was deleted.

1 change: 1 addition & 0 deletions src/conversations/Conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface Conversation {
* Timestamp the conversation was created at
*/
createdAt: Date

/**
* Optional field containing the `conversationId` and `metadata` for V2 conversations.
* Will always be undefined on V1 conversations
Expand Down
12 changes: 8 additions & 4 deletions src/conversations/Conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class Conversations {
}

private async getV2ConversationsFromKeystore(): Promise<ConversationV2[]> {
return (await this.client.keystore.getV2Conversations()).map(
return (await this.client.keystore.getV2Conversations()).conversations.map(
this.conversationReferenceToV2.bind(this)
)
}
Expand Down Expand Up @@ -160,8 +160,7 @@ export default class Conversations {
const out: ConversationV2[] = []
for (const response of responses) {
try {
const convo = this.saveInviteResponseToConversation(response)
out.push(convo)
out.push(this.saveInviteResponseToConversation(response))
} catch (e) {
console.warn('Error saving invite response to conversation: ', e)
if (shouldThrow) {
Expand Down Expand Up @@ -244,12 +243,15 @@ export default class Conversations {
return results[0]
}
}

throw new Error('unrecognized invite topic')
}

const topics = [introTopic, inviteTopic]

return Stream.create<Conversation>(
this.client,
[inviteTopic, introTopic],
topics,
decodeConversation.bind(this),
undefined,
onConnectionLost
Expand All @@ -268,7 +270,9 @@ export default class Conversations {
): Promise<AsyncGenerator<DecodedMessage>> {
const introTopic = buildUserIntroTopic(this.client.address)
const inviteTopic = buildUserInviteTopic(this.client.address)

const topics = new Set<string>([introTopic, inviteTopic])

const convoMap = new Map<string, Conversation>()

for (const conversation of await this.list()) {
Expand Down
Loading
Loading