-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update the README #2
base: main
Are you sure you want to change the base?
Conversation
|
||
In the `broadcast-example-api` directory, create a `generateAndPrintKeys.ts` file with the following contents. | ||
|
||
Replace `<YOUR_PRIVATE_KEY>` with the private key for the wallet address you want to use as the broadcast address. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea if there is a better way to get the key bundle - but this is the route ChatGPT took me down. =P Please advise!
|
||
To use this example broadcast API to try out the flow to subscribe to a broadcast with built-in consent, use it with the [subscribe-broadcast repo](https://github.com/xmtp/subscribe-broadcast). | ||
|
||
To learn how, see [Try the subscribe with built-in consent and broadcast flow](https://docs.xmtp.org/consent/subscribe-broadcast). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do https://www.npmjs.com/package/@xmtp/broadcast-sdk and https://github.com/alexrisch/broadcaster-app come into the picture? Is there an opportunity to surface them in this README?
|
||
export const generateAndPrintKeys = async (signer: Signer) => { | ||
const clientOptions = { | ||
env: "production", // this works even if in .env, XMTP_ENV=dev. if set this to dev, key bundle doesn't work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get what is going on with this. =)
In my .env file, XMTP_ENV=dev - and the key bundle this script generates when this value is set to production works.
However, if I set this value to dev in this script, to match the env in my .env file, the generated key bundle doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm that doesn't seem right, they should have to match
At the top of the `src/index.ts` file, add the following line. This will load all variables from your `.env` file into `process.env`. | ||
|
||
```tsx | ||
import "dotenv/config"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this to the file to make things work...but there is an existing line: import dotenv from "dotenv";
The commands weren't working for me without import "dotenv/config";
.
Not sure if both are necessary? Could also be user error on my part!
First pass written with help from ChatGPT. 😅