Skip to content

Commit 8642bce

Browse files
author
Alexey Tsymbal
committed
Working on fixing tests
1 parent 52de37b commit 8642bce

3 files changed

Lines changed: 300 additions & 313 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Dialect is a smart messaging protocol for dapp notifications and wallet-to-wallet messaging on the Solana Blockchain.
66

77
Dialect works by decorating on-chain resources, or sets of resources, with publish-subscribe (pub-sub) messaging capabilities. This is accomplished by creating a PDA whose seeds are the (lexically sorted) resources' public keys. Each pub-sub messaging PDA is called a _dialect_.
8-
8+
99
Dialect `v0` currently supports one-to-one messaging between wallets, which powers both dapp notifications as well as user-to-user chat. Future versions of Dialect will also support one-to-many and many-to-many messaging.
1010

1111
This repository contains both the Dialect rust programs (protocol), in Anchor, as well as a typescript client, published to npm as `@dialectlabs/web3`.

src/api/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ export async function createMetadata(
181181
return await getMetadata(program, publicKey);
182182
}
183183

184-
export async function deleteMetadata(
185-
program: anchor.Program,
186-
): Promise<void> {
184+
export async function deleteMetadata(program: anchor.Program): Promise<void> {
187185
const wallet = program.provider.wallet;
188186
const publicKey = wallet.publicKey;
189187
const [metadataAddress, metadataNonce] = await getMetadataProgramAddress(
@@ -320,10 +318,10 @@ export async function getDialect(
320318

321319
export async function getDialects(
322320
program: anchor.Program,
323-
user: Wallet,
321+
user: PublicKey | Wallet, // TODO: why we need wallet here?
324322
encryptionProps?: EncryptionProps,
325323
): Promise<DialectAccount[]> {
326-
const metadata = await getMetadata(program, user.publicKey);
324+
const metadata = await getMetadata(program, user);
327325
const enabledSubscriptions = metadata.subscriptions.filter(
328326
(it) => it.enabled,
329327
);
@@ -467,7 +465,6 @@ export async function sendMessage(
467465
text: string,
468466
encryptionProps?: EncryptionProps,
469467
): Promise<Message> {
470-
const wallet = program.provider.wallet;
471468
const [dialectPublicKey, nonce] = await getDialectProgramAddress(
472469
program,
473470
dialect.members,
@@ -480,6 +477,7 @@ export async function sendMessage(
480477
encryptionProps,
481478
);
482479
const serializedText = textSerde.serialize(text);
480+
const wallet = program.provider.wallet;
483481
await program.rpc.sendMessage(
484482
new anchor.BN(nonce),
485483
Buffer.from(serializedText),

0 commit comments

Comments
 (0)