🛠️ Tools for building on top of the Boson Protocol.
JS lib which extends @xmtp/xmtp-js, adding support for chat threads and further message types.
npm i @bosonprotocol/chat-sdk
- Initialise SDK
-
import { BosonXmtpClient } from "@bosonprotocol/chat-sdk"; const client = await BosonXmtpClient.initialise(signer, "test");
- Get Chat Threads
-
const counterparties = ["0xabc123", "0xdef456", ...]; const threads = await client.getThreads(counterparties);
- Send Message
-
const messageObj = { threadId: { exchangeId: "1", buyerId: "2", sellerId: "3" }, contentType: MessageType.String, version: "0.0.1", content: { value: "Example message" } }; const recipient = "0xabc123..."; await client.encodeAndSendMessage(messageObj, recipient);
- Monitor Chat Thread (i.e. for incoming messages)
-
for await (const message of await client.monitorThread(threadId, counterparty)) { console.log(message); }
- Build
-
npm run build
- Test
-
npm run test:all npm run test:unit npm run test:integration
- Lint
-
npm run lint npm run lint:fix
- Format
-
npm run prettier