Skip to content

Commit

Permalink
Working on fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Tsymbal committed Apr 8, 2022
1 parent 52de37b commit 8642bce
Show file tree
Hide file tree
Showing 3 changed files with 300 additions and 313 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Dialect is a smart messaging protocol for dapp notifications and wallet-to-wallet messaging on the Solana Blockchain.

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_.

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.

This repository contains both the Dialect rust programs (protocol), in Anchor, as well as a typescript client, published to npm as `@dialectlabs/web3`.
Expand Down
10 changes: 4 additions & 6 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ export async function createMetadata(
return await getMetadata(program, publicKey);
}

export async function deleteMetadata(
program: anchor.Program,
): Promise<void> {
export async function deleteMetadata(program: anchor.Program): Promise<void> {
const wallet = program.provider.wallet;
const publicKey = wallet.publicKey;
const [metadataAddress, metadataNonce] = await getMetadataProgramAddress(
Expand Down Expand Up @@ -320,10 +318,10 @@ export async function getDialect(

export async function getDialects(
program: anchor.Program,
user: Wallet,
user: PublicKey | Wallet, // TODO: why we need wallet here?
encryptionProps?: EncryptionProps,
): Promise<DialectAccount[]> {
const metadata = await getMetadata(program, user.publicKey);
const metadata = await getMetadata(program, user);
const enabledSubscriptions = metadata.subscriptions.filter(
(it) => it.enabled,
);
Expand Down Expand Up @@ -467,7 +465,6 @@ export async function sendMessage(
text: string,
encryptionProps?: EncryptionProps,
): Promise<Message> {
const wallet = program.provider.wallet;
const [dialectPublicKey, nonce] = await getDialectProgramAddress(
program,
dialect.members,
Expand All @@ -480,6 +477,7 @@ export async function sendMessage(
encryptionProps,
);
const serializedText = textSerde.serialize(text);
const wallet = program.provider.wallet;
await program.rpc.sendMessage(
new anchor.BN(nonce),
Buffer.from(serializedText),
Expand Down
Loading

0 comments on commit 8642bce

Please sign in to comment.