From 358e63fb4cb958f2f4c3e8d3ae84cb07d36da9df Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Tue, 28 May 2024 12:16:56 -0600 Subject: [PATCH] fix: Fix keybundle generic Fix keybundle method with generic content types --- example/src/types/typeTests.ts | 21 +++++++++++++++++++++ src/lib/Client.ts | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/example/src/types/typeTests.ts b/example/src/types/typeTests.ts index 2f3df8f75..e8ae52ed5 100644 --- a/example/src/types/typeTests.ts +++ b/example/src/types/typeTests.ts @@ -110,6 +110,27 @@ export const typeTests = async () => { await reactionConvo.send({ text: 'text', }) + const keyBundle = await reactionClient.exportKeyBundle() + const keyBundleReactionClient = await Client.createFromKeyBundle< + typeof supportedCodecs + >(keyBundle, { + codecs: supportedCodecs, + }) + const reactionKeyBundleConvo = ( + await keyBundleReactionClient.conversations.list() + )[0] + await reactionKeyBundleConvo.send({ + // @ts-expect-error + sdfsdf: 'sdfsdf', + }) + await reactionConvo.send({ + reaction: { + action: 'added', + content: '💖', + reference: '123', + schema: 'unicode', + }, + }) const messages = await reactionConvo.messages() const content = messages[0].content() diff --git a/src/lib/Client.ts b/src/lib/Client.ts index 93a609bb3..d938e2b93 100644 --- a/src/lib/Client.ts +++ b/src/lib/Client.ts @@ -172,7 +172,7 @@ export class Client< >( keyBundle: string, opts?: Partial & { codecs?: ContentCodecs } - ): Promise> { + ): Promise> { const options = defaultOptions(opts) const address = await XMTPModule.createFromKeyBundle( keyBundle,