Skip to content

Commit

Permalink
Merge pull request #111 from dialectlabs/v0.1.12-rc
Browse files Browse the repository at this point in the history
v0.1.12-rc
  • Loading branch information
cbosborn authored Apr 4, 2022
2 parents 5df3ee3 + d490d8c commit 8f5352e
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 97 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/formatters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actionsx/prettier@v2
with:
# prettier CLI arguments.
args: --check index.ts examples/ src/ tests/
args: --check examples/ src/ tests/

fmt:
name: Rustfmt
Expand All @@ -32,18 +32,18 @@ jobs:
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.57.0
override: true
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D warnings
# TODO: Address failing issue
# clippy:
# name: Clippy
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: 1.57.0
# override: true
# components: clippy
# - uses: actions-rs/clippy-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# args: -- -D warnings
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## [0.1.12] - 2022-04-02

* Upgrade anchor to 0.23.0.
* Move index.ts to src/index.ts.
* Enforce that dialect owner must be a member with admin privileges.

## [0.1.6] - 2022-02-28

* Update program ids for mainnet.
Expand Down
53 changes: 46 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Protocol & web3

## Summary

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_.
Expand All @@ -10,6 +12,15 @@ This repository contains both the Dialect rust programs (protocol), in Anchor, a

Currently, the dialect account rent cost is `~0.059 SOL`.

## Table of Contents
1. Installation
2. Usage
3. Local Development
4. Docker
5. Anchor Tests
6. Examples
7. Message Encryption

## Installation

**npm:**
Expand Down Expand Up @@ -76,14 +87,14 @@ Run the example above
ts-node examples/hello-world.ts
```

## Local development
## Local Development

Note: If you just need a local running instance of the Dialect program, it is easiest to simply run Dialect in a docker container. See the [Docker](###docker) section below.

Dialect is built with Solana and Anchor. Install both dependencies first following their respective documentation

- [Solana](https://docs.solana.com/cli/install-solana-cli-tools)
- [Anchor](https://book.anchor-lang.com)
- [Anchor](https://book.anchor-lang.com) v0.18.0

We recommend installing anchor with [avm](https://book.anchor-lang.com/chapter_2/installation.html#installing-using-anchor-version-manager-avm-recommended) and using the `"@project-serum/anchor"` version that's specified in our [package.json](https://github.com/dialectlabs/protocol/blob/master/package.json) file.

Expand Down Expand Up @@ -119,7 +130,21 @@ Build the Dialect Solana program:
anchor build
```

If you haven't deployed before, the output of `anchor build` will give you a program keypair, stored in `target/deploy/dialect-keypair.json`. Add this keypair in the following additional places:
If you haven't deployed this program to localnet before, `anchor build` produces a program-id stored in `target/idl/dialect.json`. The program-id is the address field of the "metadata" element (usually at bottom of file, note your address may differ locally):

```json
"metadata": {
"address": "2YFyZAg8rBtuvzFFiGvXwPHFAQJ2FXZoS7bYCKticpjk"
}
```

Alternatively, you can get this program id from the command

```bash
solana address -k target/deploy/dialect-keypair.json
```

Add this program id in the following additional places before proceeding:

1. In the `dialect = "<program-id>"` in `Anchor.toml`
2. In the `declare_id!("<program-id>")` in `programs/dialect/lib.rs`
Expand Down Expand Up @@ -161,17 +186,31 @@ docker build -f docker/Dockerfile . -t dialect/protocol:latest
docker run -i --rm -p 8899:8899 -p 8900:8900 -p 9900:9900 --name protocol dialect/protocol:latest
```

## examples
## Tests

First ensure you have ts-mocha install globally:

```shell
npm install -g ts-mocha
```

Run the tests with:

```shell
anchor test
```

## Examples

Run the example with:

```bash
DIALECT_PUBLIC_KEY=<dialect-public-key> ts-node examples/index.ts
DIALECT_PUBLIC_KEY=<dialect-public-key> ts-node examples/hello-world.ts
```

It is fine to omit the `DIALECT_PUBLIC_KEY` environment variable, the example will generate one on the fly. However, if you're using this example as an integration test with other services, such as the monitoring, you'll need to set it to the public key corresponding to the private key in the notification service.
It is fine to omit the `DIALECT_PUBLIC_KEY` environment variable, the example will generate one on the fly. However, if you're using this example as an integration test with other services, such as the monitoring service, you'll need to set it to the public key corresponding to the private key in the monitoring service.

## Message encryption
## Message Encryption

A note about the encryption nonce.

Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
programs,
sendMessage,
Wallet_,
} from '..';
} from '../src';

const NETWORK_NAME = 'localnet';
const local = new web3.Connection(
Expand Down
2 changes: 0 additions & 2 deletions index.ts

This file was deleted.

Loading

0 comments on commit 8f5352e

Please sign in to comment.