solana-messenger-sdk 0.8.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -148
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -13
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +127 -93
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +465 -135
- package/dist/instructions.js.map +1 -1
- package/dist/messenger.d.ts +31 -31
- package/dist/messenger.d.ts.map +1 -1
- package/dist/messenger.js +301 -237
- package/dist/messenger.js.map +1 -1
- package/dist/pda.d.ts +4 -1
- package/dist/pda.d.ts.map +1 -1
- package/dist/pda.js +39 -6
- package/dist/pda.js.map +1 -1
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/solana-messenger-sdk)
|
|
4
4
|
[](https://github.com/sabersally/solana-messenger/blob/main/LICENSE)
|
|
5
5
|
|
|
6
|
-
TypeScript SDK for **solana-messenger** — encrypted
|
|
6
|
+
TypeScript SDK for **solana-messenger** — encrypted on-chain messaging with servers, channels, and DMs.
|
|
7
7
|
|
|
8
|
-
**Program:** `msg1jhfewu1hGDnQKGhXDmqas6JZTq7Lg7PbSX5jY9y`
|
|
8
|
+
**Program (mainnet):** `msg1jhfewu1hGDnQKGhXDmqas6JZTq7Lg7PbSX5jY9y`
|
|
9
|
+
**Program (devnet):** `E6p87FCXNZFii8GJs5NY5xUmH8wKRPvGXn3Z2VhNqSv`
|
|
9
10
|
|
|
10
11
|
## Install
|
|
11
12
|
|
|
@@ -15,195 +16,108 @@ npm install solana-messenger-sdk
|
|
|
15
16
|
|
|
16
17
|
## Quick Start
|
|
17
18
|
|
|
18
|
-
### Self-Custody (you have a keypair)
|
|
19
|
-
|
|
20
19
|
```typescript
|
|
21
20
|
import { SolanaMessenger } from "solana-messenger-sdk";
|
|
22
|
-
import { readFileSync } from "fs";
|
|
23
|
-
|
|
24
|
-
const keypair = new Uint8Array(JSON.parse(readFileSync("~/.config/solana/id.json", "utf-8")));
|
|
25
21
|
|
|
26
22
|
const messenger = new SolanaMessenger({
|
|
27
23
|
apiKey: "YOUR_HELIUS_API_KEY",
|
|
28
|
-
|
|
29
|
-
keypair,
|
|
24
|
+
keypair: keypairBytes, // 64-byte ed25519
|
|
30
25
|
});
|
|
31
26
|
|
|
32
|
-
// Initialize: generates local encryption key, registers on-chain
|
|
33
27
|
await messenger.init();
|
|
34
28
|
|
|
35
|
-
//
|
|
36
|
-
await messenger.send(
|
|
29
|
+
// DM
|
|
30
|
+
await messenger.send(recipient, "hey!");
|
|
37
31
|
|
|
38
|
-
//
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
console.log(`${msg.sender}: ${msg.text}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Listen for new messages in real-time (~400ms)
|
|
45
|
-
const unsub = await messenger.listen((msg) => {
|
|
46
|
-
console.log(`New message from ${msg.sender}: ${msg.text}`);
|
|
47
|
-
});
|
|
32
|
+
// Server + channel
|
|
33
|
+
const { serverId } = await messenger.createServer("My Server");
|
|
34
|
+
await messenger.inviteToServer(serverId, member, [serverKey]);
|
|
48
35
|
```
|
|
49
36
|
|
|
50
|
-
### External Signer (Privy, Turnkey
|
|
51
|
-
|
|
52
|
-
For agents using custodial wallets where you don't have the raw keypair:
|
|
37
|
+
### External Signer (Privy, Turnkey)
|
|
53
38
|
|
|
54
39
|
```typescript
|
|
55
40
|
const messenger = new SolanaMessenger({
|
|
56
41
|
apiKey: "YOUR_HELIUS_API_KEY",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
signer: async (unsignedTx, recentBlockhash, feePayer) => {
|
|
60
|
-
return await privySignTransaction(unsignedTx);
|
|
61
|
-
},
|
|
42
|
+
walletAddress: "YourCustodialWallet",
|
|
43
|
+
signer: async (unsignedTx) => await privySign(unsignedTx),
|
|
62
44
|
});
|
|
63
|
-
|
|
64
|
-
await messenger.init();
|
|
65
|
-
await messenger.send(recipient, "hello from a custodial wallet");
|
|
66
45
|
```
|
|
67
46
|
|
|
68
|
-
**Why two modes?** Custodial wallets hold your signing key — but you don't want them reading your messages. `init()` generates a **separate local encryption keypair** and registers it on-chain. Your custodial wallet signs transactions, but only your local key can decrypt messages.
|
|
69
|
-
|
|
70
47
|
## API
|
|
71
48
|
|
|
72
|
-
###
|
|
73
|
-
|
|
74
|
-
**Self-custody:**
|
|
75
|
-
| Field | Type | Required | Description |
|
|
76
|
-
|-------|------|----------|-------------|
|
|
77
|
-
| `apiKey` | string | ✅ | Helius API key |
|
|
78
|
-
| `network` | "mainnet" \| "devnet" | | Network (default: "mainnet") |
|
|
79
|
-
| `keypair` | Uint8Array | ✅ | 64-byte ed25519 keypair |
|
|
80
|
-
| `programId` | string | | Custom program ID (default: mainnet) |
|
|
81
|
-
| `keysDir` | string | | Encryption key storage path |
|
|
82
|
-
|
|
83
|
-
**External signer:**
|
|
84
|
-
| Field | Type | Required | Description |
|
|
85
|
-
|-------|------|----------|-------------|
|
|
86
|
-
| `apiKey` | string | ✅ | Helius API key |
|
|
87
|
-
| `network` | "mainnet" \| "devnet" | | Network (default: "mainnet") |
|
|
88
|
-
| `walletAddress` | string | ✅ | Your wallet's public key |
|
|
89
|
-
| `signer` | ExternalSignerFn | ✅ | Signs serialized transactions |
|
|
90
|
-
| `programId` | string | | Custom program ID |
|
|
91
|
-
| `keysDir` | string | | Encryption key storage path |
|
|
92
|
-
|
|
93
|
-
### Methods
|
|
94
|
-
|
|
95
|
-
#### Messaging
|
|
96
|
-
| Method | Description |
|
|
97
|
-
|--------|-------------|
|
|
98
|
-
| `init()` | Generate encryption key, register on-chain. Call once. Returns `{ encryptionAddress, status }` where status is `"registered"`, `"already_registered"`, or `"updated"`. |
|
|
99
|
-
| `send(recipient, message, encryptionPubkey?)` | Send encrypted DM. Recipient must be registered. Auto-chunks if needed. Fees auto-deducted. |
|
|
100
|
-
| `read({ since?, limit? })` | Read DMs sent to you. `since` is a unix timestamp (seconds). Decrypts automatically. |
|
|
101
|
-
| `listen(callback)` | Real-time WebSocket listener for DMs. Returns unsubscribe function. |
|
|
49
|
+
### Direct Messages
|
|
102
50
|
|
|
103
|
-
#### Groups
|
|
104
51
|
| Method | Description |
|
|
105
52
|
|--------|-------------|
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
|
|
53
|
+
| `send(recipient, message)` | Send encrypted DM. Auto-chunks if needed. |
|
|
54
|
+
| `read({ since?, limit? })` | Read DMs sent to you. |
|
|
55
|
+
| `listen(callback)` | Real-time WebSocket listener. Returns unsubscribe fn. |
|
|
56
|
+
|
|
57
|
+
### Servers
|
|
110
58
|
|
|
111
|
-
#### Registry
|
|
112
59
|
| Method | Description |
|
|
113
60
|
|--------|-------------|
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `deregister()` | Remove registry entry, reclaim rent. |
|
|
118
|
-
| `lookupEncryptionKey(address)` | Look up anyone's encryption key. |
|
|
119
|
-
| `getAddress()` | Get your wallet address. |
|
|
120
|
-
| `getEncryptionPublicKey()` | Get your encryption public key (after init). |
|
|
61
|
+
| `createServer(name)` | Create server. You become owner. |
|
|
62
|
+
| `inviteToServer(serverId, member, serverKeys)` | Invite member (admin/owner). Wraps all key versions. |
|
|
63
|
+
| `leaveServer(serverId, remainingMembers)` | Leave + rotate key for remaining members. |
|
|
121
64
|
|
|
122
|
-
###
|
|
65
|
+
### Channels
|
|
123
66
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
await messenger.sendGroup(groupPda, "Hello team!");
|
|
132
|
-
|
|
133
|
-
// Update members (creator only)
|
|
134
|
-
await messenger.updateGroup(groupPda, [myAddress, "Member1Address...", "NewMember..."]);
|
|
67
|
+
| Method | Description |
|
|
68
|
+
|--------|-------------|
|
|
69
|
+
| `createChannel({ serverId?, channelType?, members })` | Create channel (standalone or server). |
|
|
70
|
+
| `sendChannelMessage({ channelPda, message, channelKey, keyVersion, senderServerMemberPda? })` | Send to channel. `senderServerMemberPda` required for public channels. |
|
|
71
|
+
| `addChannelMembers(channelPda, channelId, members, allKeyVersions)` | Add members with all historical keys. |
|
|
72
|
+
| `removeChannelMembers(channelId, version, removeList, remaining)` | Remove + rotate key. Returns new channel PDA. |
|
|
73
|
+
| `closeChannel(channelPda, channelId, members)` | Close channel, reclaim rent. |
|
|
135
74
|
|
|
136
|
-
|
|
137
|
-
await messenger.closeGroup(groupPda);
|
|
138
|
-
```
|
|
75
|
+
### Identity
|
|
139
76
|
|
|
140
|
-
|
|
77
|
+
| Method | Description |
|
|
78
|
+
|--------|-------------|
|
|
79
|
+
| `init()` | Register encryption key on-chain. |
|
|
80
|
+
| `setMinFee(lamports)` | Set spam fee for DMs. |
|
|
81
|
+
| `lookupEncryptionKey(address)` | Look up anyone's encryption key. |
|
|
82
|
+
| `getAddress()` | Get wallet address. |
|
|
141
83
|
|
|
142
|
-
### Low-Level
|
|
84
|
+
### Low-Level Builders
|
|
143
85
|
|
|
144
|
-
|
|
86
|
+
All instruction builders exported for custom tx composition:
|
|
145
87
|
|
|
146
88
|
```typescript
|
|
147
89
|
import {
|
|
148
90
|
buildSendMessageInstruction,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
91
|
+
buildCreateServerInstruction,
|
|
92
|
+
buildInviteToServerInstruction,
|
|
93
|
+
buildLeaveServerInstruction,
|
|
94
|
+
buildRemoveServerMemberInstruction,
|
|
95
|
+
buildCreateChannelInstruction,
|
|
96
|
+
buildSendChannelMessageInstruction,
|
|
97
|
+
buildAddChannelMembersInstruction,
|
|
98
|
+
buildRemoveChannelMembersInstruction,
|
|
99
|
+
// PDA derivation
|
|
100
|
+
deriveServerPda,
|
|
101
|
+
deriveServerMemberPda,
|
|
102
|
+
deriveChannelPda,
|
|
103
|
+
deriveChannelMemberPda,
|
|
157
104
|
deriveRegistryPda,
|
|
158
|
-
|
|
159
|
-
lookupEncryptionKey,
|
|
160
|
-
encrypt,
|
|
161
|
-
decrypt,
|
|
162
|
-
encodeMessage,
|
|
163
|
-
decodeMessage,
|
|
164
|
-
parseMessageSentEvents,
|
|
105
|
+
deriveConfigPda,
|
|
165
106
|
} from "solana-messenger-sdk";
|
|
166
107
|
```
|
|
167
108
|
|
|
168
|
-
##
|
|
169
|
-
|
|
170
|
-
- **Encryption (DMs):** NaCl box (XSalsa20-Poly1305) via Diffie-Hellman shared secret
|
|
171
|
-
- **Encryption (Groups):** NaCl secretbox (symmetric) + per-recipient key wraps via NaCl box
|
|
172
|
-
- **Key conversion:** ed25519 → x25519 via ed2curve
|
|
173
|
-
- **Messages:** Emitted as program events — no on-chain storage
|
|
174
|
-
- **Chunking:** Messages > 661 bytes are automatically split and reassembled
|
|
175
|
-
- **Registry:** On-chain PDA at `["messenger", wallet]` maps identity → encryption pubkey
|
|
176
|
-
- **Groups:** On-chain PDA at `["group", group_id]` stores membership (max 10)
|
|
177
|
-
|
|
178
|
-
## Cost
|
|
179
|
-
|
|
180
|
-
| Action | Cost |
|
|
181
|
-
|--------|------|
|
|
182
|
-
| Send message | ~5000 lamports tx fee + protocol fee (default 0) + recipient min_fee (default 0) |
|
|
183
|
-
| Register encryption key | ~0.001 SOL (rent, reclaimable) |
|
|
184
|
-
| Set min_fee | tx fee only |
|
|
185
|
-
| Lookup encryption key | Free (read-only) |
|
|
186
|
-
| Deregister | Reclaims rent |
|
|
187
|
-
|
|
188
|
-
## Funding Your Agent
|
|
189
|
-
|
|
190
|
-
Your agent needs SOL to send messages. Get your agent's address and transfer SOL from any wallet:
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
const address = await messenger.getAddress();
|
|
194
|
-
console.log(`Send SOL to: ${address}`);
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
## Dependencies
|
|
198
|
-
|
|
199
|
-
- `@solana/kit` — Solana web3 v2
|
|
200
|
-
- `tweetnacl` — NaCl box encryption
|
|
201
|
-
- `ed2curve` — ed25519 → x25519 conversion
|
|
109
|
+
## Protocol
|
|
202
110
|
|
|
203
|
-
|
|
111
|
+
Full spec: [SPEC.md](https://github.com/sabersally/solana-messenger/blob/main/SPEC.md)
|
|
204
112
|
|
|
205
|
-
|
|
206
|
-
|
|
113
|
+
| Feature | Details |
|
|
114
|
+
|---------|---------|
|
|
115
|
+
| Encryption | NaCl box (DMs), NaCl secretbox (channels) |
|
|
116
|
+
| Member cap | 256 per channel/server |
|
|
117
|
+
| Key rotation | On removal + voluntary leave |
|
|
118
|
+
| History | New members get all historical keys |
|
|
119
|
+
| Discovery | Zero backend — GPA + getSignaturesForAddress |
|
|
120
|
+
| Payer separation | Relay/gasless support |
|
|
207
121
|
|
|
208
122
|
## License
|
|
209
123
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { deriveRegistryPda,
|
|
1
|
+
export { buildInitializeConfigInstruction, buildUpdateConfigInstruction, buildRegisterInstruction, buildUpdateEncryptionKeyInstruction, buildDeregisterInstruction, buildSetMinFeeInstruction, buildSendMessageInstruction, buildCreateServerInstruction, buildInviteToServerInstruction, buildRemoveServerMemberInstruction, buildLeaveServerInstruction, buildUpdateServerInstruction, buildCloseServerInstruction, buildCreateChannelInstruction, buildSendChannelMessageInstruction, buildAddChannelMembersInstruction, buildRemoveChannelMembersInstruction, buildCloseChannelInstruction, } from "./instructions";
|
|
2
|
+
export { deriveConfigPda, deriveRegistryPda, deriveServerPda, deriveServerMemberPda, deriveChannelPda, deriveChannelMemberPda, } from "./pda";
|
|
3
3
|
export { lookupEncryptionKey } from "./registry";
|
|
4
4
|
export { loadOrGenerateEncryptionKeypair } from "./keys";
|
|
5
5
|
export { convertEd25519ToX25519, encrypt, decrypt, decryptRaw, encodeMessage, decodeMessage, } from "./crypto";
|
|
6
6
|
export { parseMessageSentEvents } from "./events";
|
|
7
|
-
export type { EncryptedPayload, DecodedMessage, MessageSentEvent, Message, } from "./types";
|
|
7
|
+
export type { EncryptedPayload, DecodedMessage, MessageSentEvent, ChannelMessageSentEvent, Message, ChannelMessage, KeyWrap, ServerInfo, ChannelInfo, } from "./types";
|
|
8
|
+
export { ChannelType, Role } from "./types";
|
|
8
9
|
export { SolanaMessenger } from "./messenger";
|
|
9
10
|
export type { SolanaMessengerConfig, SelfCustodyConfig, ExternalSignerConfig, ExternalSignerFn, } from "./messenger";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,gCAAgC,EAChC,4BAA4B,EAE5B,wBAAwB,EACxB,mCAAmC,EACnC,0BAA0B,EAC1B,yBAAyB,EAEzB,2BAA2B,EAE3B,4BAA4B,EAC5B,8BAA8B,EAC9B,kCAAkC,EAClC,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAE3B,6BAA6B,EAC7B,kCAAkC,EAClC,iCAAiC,EACjC,oCAAoC,EACpC,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAGzD,OAAO,EACL,sBAAsB,EACtB,OAAO,EACP,OAAO,EACP,UAAU,EACV,aAAa,EACb,aAAa,GACd,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,OAAO,EACP,cAAc,EACd,OAAO,EACP,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaMessenger = exports.parseMessageSentEvents = exports.decodeMessage = exports.encodeMessage = exports.decryptRaw = exports.decrypt = exports.encrypt = exports.convertEd25519ToX25519 = exports.loadOrGenerateEncryptionKeypair = exports.lookupEncryptionKey = exports.
|
|
4
|
-
// Instruction builders
|
|
3
|
+
exports.SolanaMessenger = exports.Role = exports.ChannelType = exports.parseMessageSentEvents = exports.decodeMessage = exports.encodeMessage = exports.decryptRaw = exports.decrypt = exports.encrypt = exports.convertEd25519ToX25519 = exports.loadOrGenerateEncryptionKeypair = exports.lookupEncryptionKey = exports.deriveChannelMemberPda = exports.deriveChannelPda = exports.deriveServerMemberPda = exports.deriveServerPda = exports.deriveRegistryPda = exports.deriveConfigPda = exports.buildCloseChannelInstruction = exports.buildRemoveChannelMembersInstruction = exports.buildAddChannelMembersInstruction = exports.buildSendChannelMessageInstruction = exports.buildCreateChannelInstruction = exports.buildCloseServerInstruction = exports.buildUpdateServerInstruction = exports.buildLeaveServerInstruction = exports.buildRemoveServerMemberInstruction = exports.buildInviteToServerInstruction = exports.buildCreateServerInstruction = exports.buildSendMessageInstruction = exports.buildSetMinFeeInstruction = exports.buildDeregisterInstruction = exports.buildUpdateEncryptionKeyInstruction = exports.buildRegisterInstruction = exports.buildUpdateConfigInstruction = exports.buildInitializeConfigInstruction = void 0;
|
|
4
|
+
// Instruction builders
|
|
5
5
|
var instructions_1 = require("./instructions");
|
|
6
|
-
|
|
6
|
+
// Platform
|
|
7
|
+
Object.defineProperty(exports, "buildInitializeConfigInstruction", { enumerable: true, get: function () { return instructions_1.buildInitializeConfigInstruction; } });
|
|
8
|
+
Object.defineProperty(exports, "buildUpdateConfigInstruction", { enumerable: true, get: function () { return instructions_1.buildUpdateConfigInstruction; } });
|
|
9
|
+
// Identity
|
|
7
10
|
Object.defineProperty(exports, "buildRegisterInstruction", { enumerable: true, get: function () { return instructions_1.buildRegisterInstruction; } });
|
|
8
11
|
Object.defineProperty(exports, "buildUpdateEncryptionKeyInstruction", { enumerable: true, get: function () { return instructions_1.buildUpdateEncryptionKeyInstruction; } });
|
|
9
12
|
Object.defineProperty(exports, "buildDeregisterInstruction", { enumerable: true, get: function () { return instructions_1.buildDeregisterInstruction; } });
|
|
10
13
|
Object.defineProperty(exports, "buildSetMinFeeInstruction", { enumerable: true, get: function () { return instructions_1.buildSetMinFeeInstruction; } });
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(exports, "
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
-
Object.defineProperty(exports, "
|
|
18
|
-
|
|
14
|
+
// DMs
|
|
15
|
+
Object.defineProperty(exports, "buildSendMessageInstruction", { enumerable: true, get: function () { return instructions_1.buildSendMessageInstruction; } });
|
|
16
|
+
// Servers
|
|
17
|
+
Object.defineProperty(exports, "buildCreateServerInstruction", { enumerable: true, get: function () { return instructions_1.buildCreateServerInstruction; } });
|
|
18
|
+
Object.defineProperty(exports, "buildInviteToServerInstruction", { enumerable: true, get: function () { return instructions_1.buildInviteToServerInstruction; } });
|
|
19
|
+
Object.defineProperty(exports, "buildRemoveServerMemberInstruction", { enumerable: true, get: function () { return instructions_1.buildRemoveServerMemberInstruction; } });
|
|
20
|
+
Object.defineProperty(exports, "buildLeaveServerInstruction", { enumerable: true, get: function () { return instructions_1.buildLeaveServerInstruction; } });
|
|
21
|
+
Object.defineProperty(exports, "buildUpdateServerInstruction", { enumerable: true, get: function () { return instructions_1.buildUpdateServerInstruction; } });
|
|
22
|
+
Object.defineProperty(exports, "buildCloseServerInstruction", { enumerable: true, get: function () { return instructions_1.buildCloseServerInstruction; } });
|
|
23
|
+
// Channels
|
|
24
|
+
Object.defineProperty(exports, "buildCreateChannelInstruction", { enumerable: true, get: function () { return instructions_1.buildCreateChannelInstruction; } });
|
|
25
|
+
Object.defineProperty(exports, "buildSendChannelMessageInstruction", { enumerable: true, get: function () { return instructions_1.buildSendChannelMessageInstruction; } });
|
|
26
|
+
Object.defineProperty(exports, "buildAddChannelMembersInstruction", { enumerable: true, get: function () { return instructions_1.buildAddChannelMembersInstruction; } });
|
|
27
|
+
Object.defineProperty(exports, "buildRemoveChannelMembersInstruction", { enumerable: true, get: function () { return instructions_1.buildRemoveChannelMembersInstruction; } });
|
|
28
|
+
Object.defineProperty(exports, "buildCloseChannelInstruction", { enumerable: true, get: function () { return instructions_1.buildCloseChannelInstruction; } });
|
|
29
|
+
// PDA derivation
|
|
19
30
|
var pda_1 = require("./pda");
|
|
20
|
-
Object.defineProperty(exports, "deriveRegistryPda", { enumerable: true, get: function () { return pda_1.deriveRegistryPda; } });
|
|
21
31
|
Object.defineProperty(exports, "deriveConfigPda", { enumerable: true, get: function () { return pda_1.deriveConfigPda; } });
|
|
22
|
-
Object.defineProperty(exports, "
|
|
32
|
+
Object.defineProperty(exports, "deriveRegistryPda", { enumerable: true, get: function () { return pda_1.deriveRegistryPda; } });
|
|
33
|
+
Object.defineProperty(exports, "deriveServerPda", { enumerable: true, get: function () { return pda_1.deriveServerPda; } });
|
|
34
|
+
Object.defineProperty(exports, "deriveServerMemberPda", { enumerable: true, get: function () { return pda_1.deriveServerMemberPda; } });
|
|
35
|
+
Object.defineProperty(exports, "deriveChannelPda", { enumerable: true, get: function () { return pda_1.deriveChannelPda; } });
|
|
36
|
+
Object.defineProperty(exports, "deriveChannelMemberPda", { enumerable: true, get: function () { return pda_1.deriveChannelMemberPda; } });
|
|
23
37
|
// Registry lookup
|
|
24
38
|
var registry_1 = require("./registry");
|
|
25
39
|
Object.defineProperty(exports, "lookupEncryptionKey", { enumerable: true, get: function () { return registry_1.lookupEncryptionKey; } });
|
|
@@ -37,6 +51,9 @@ Object.defineProperty(exports, "decodeMessage", { enumerable: true, get: functio
|
|
|
37
51
|
// Events
|
|
38
52
|
var events_1 = require("./events");
|
|
39
53
|
Object.defineProperty(exports, "parseMessageSentEvents", { enumerable: true, get: function () { return events_1.parseMessageSentEvents; } });
|
|
54
|
+
var types_1 = require("./types");
|
|
55
|
+
Object.defineProperty(exports, "ChannelType", { enumerable: true, get: function () { return types_1.ChannelType; } });
|
|
56
|
+
Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return types_1.Role; } });
|
|
40
57
|
// Convenience class
|
|
41
58
|
var messenger_1 = require("./messenger");
|
|
42
59
|
Object.defineProperty(exports, "SolanaMessenger", { enumerable: true, get: function () { return messenger_1.SolanaMessenger; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uBAAuB;AACvB,+CAwBwB;AAvBtB,WAAW;AACX,gIAAA,gCAAgC,OAAA;AAChC,4HAAA,4BAA4B,OAAA;AAC5B,WAAW;AACX,wHAAA,wBAAwB,OAAA;AACxB,mIAAA,mCAAmC,OAAA;AACnC,0HAAA,0BAA0B,OAAA;AAC1B,yHAAA,yBAAyB,OAAA;AACzB,MAAM;AACN,2HAAA,2BAA2B,OAAA;AAC3B,UAAU;AACV,4HAAA,4BAA4B,OAAA;AAC5B,8HAAA,8BAA8B,OAAA;AAC9B,kIAAA,kCAAkC,OAAA;AAClC,2HAAA,2BAA2B,OAAA;AAC3B,4HAAA,4BAA4B,OAAA;AAC5B,2HAAA,2BAA2B,OAAA;AAC3B,WAAW;AACX,6HAAA,6BAA6B,OAAA;AAC7B,kIAAA,kCAAkC,OAAA;AAClC,iIAAA,iCAAiC,OAAA;AACjC,oIAAA,oCAAoC,OAAA;AACpC,4HAAA,4BAA4B,OAAA;AAG9B,iBAAiB;AACjB,6BAOe;AANb,sGAAA,eAAe,OAAA;AACf,wGAAA,iBAAiB,OAAA;AACjB,sGAAA,eAAe,OAAA;AACf,4GAAA,qBAAqB,OAAA;AACrB,uGAAA,gBAAgB,OAAA;AAChB,6GAAA,sBAAsB,OAAA;AAGxB,kBAAkB;AAClB,uCAAiD;AAAxC,+GAAA,mBAAmB,OAAA;AAE5B,iBAAiB;AACjB,+BAAyD;AAAhD,uHAAA,+BAA+B,OAAA;AAExC,SAAS;AACT,mCAOkB;AANhB,gHAAA,sBAAsB,OAAA;AACtB,iGAAA,OAAO,OAAA;AACP,iGAAA,OAAO,OAAA;AACP,oGAAA,UAAU,OAAA;AACV,uGAAA,aAAa,OAAA;AACb,uGAAA,aAAa,OAAA;AAGf,SAAS;AACT,mCAAkD;AAAzC,gHAAA,sBAAsB,OAAA;AAc/B,iCAA4C;AAAnC,oGAAA,WAAW,OAAA;AAAE,6FAAA,IAAI,OAAA;AAE1B,oBAAoB;AACpB,yCAA8C;AAArC,4GAAA,eAAe,OAAA"}
|
package/dist/instructions.d.ts
CHANGED
|
@@ -1,137 +1,171 @@
|
|
|
1
1
|
import { address } from "@solana/kit";
|
|
2
|
-
|
|
3
|
-
sender: string;
|
|
4
|
-
recipient: string;
|
|
5
|
-
ciphertext: Uint8Array;
|
|
6
|
-
nonce: Uint8Array;
|
|
7
|
-
configPda: string;
|
|
8
|
-
feeVault: string;
|
|
9
|
-
recipientRegistryPda: string;
|
|
10
|
-
payer?: string;
|
|
11
|
-
programId?: string;
|
|
12
|
-
}): {
|
|
2
|
+
type Instruction = {
|
|
13
3
|
programAddress: ReturnType<typeof address>;
|
|
14
4
|
accounts: any[];
|
|
15
5
|
data: Uint8Array;
|
|
16
6
|
};
|
|
7
|
+
export declare function buildInitializeConfigInstruction(params: {
|
|
8
|
+
authority: string;
|
|
9
|
+
configPda: string;
|
|
10
|
+
feeVault: string;
|
|
11
|
+
protocolFee: bigint;
|
|
12
|
+
payer?: string;
|
|
13
|
+
programId?: string;
|
|
14
|
+
}): Instruction;
|
|
15
|
+
export declare function buildUpdateConfigInstruction(params: {
|
|
16
|
+
authority: string;
|
|
17
|
+
configPda: string;
|
|
18
|
+
feeVault?: string;
|
|
19
|
+
protocolFee?: bigint;
|
|
20
|
+
programId?: string;
|
|
21
|
+
}): Instruction;
|
|
17
22
|
export declare function buildRegisterInstruction(params: {
|
|
18
23
|
owner: string;
|
|
19
24
|
encryptionPubkey: Uint8Array;
|
|
20
25
|
registryPda: string;
|
|
21
26
|
payer?: string;
|
|
22
27
|
programId?: string;
|
|
23
|
-
}):
|
|
24
|
-
programAddress: ReturnType<typeof address>;
|
|
25
|
-
accounts: any[];
|
|
26
|
-
data: Uint8Array;
|
|
27
|
-
};
|
|
28
|
+
}): Instruction;
|
|
28
29
|
export declare function buildUpdateEncryptionKeyInstruction(params: {
|
|
29
30
|
owner: string;
|
|
30
31
|
newEncryptionPubkey: Uint8Array;
|
|
31
32
|
registryPda: string;
|
|
32
33
|
programId?: string;
|
|
33
|
-
}):
|
|
34
|
-
programAddress: ReturnType<typeof address>;
|
|
35
|
-
accounts: any[];
|
|
36
|
-
data: Uint8Array;
|
|
37
|
-
};
|
|
34
|
+
}): Instruction;
|
|
38
35
|
export declare function buildSetMinFeeInstruction(params: {
|
|
39
36
|
owner: string;
|
|
40
37
|
registryPda: string;
|
|
41
38
|
minFee: bigint;
|
|
42
39
|
programId?: string;
|
|
43
|
-
}):
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
}): Instruction;
|
|
41
|
+
export declare function buildDeregisterInstruction(params: {
|
|
42
|
+
owner: string;
|
|
43
|
+
registryPda: string;
|
|
44
|
+
programId?: string;
|
|
45
|
+
}): Instruction;
|
|
46
|
+
export declare function buildSendMessageInstruction(params: {
|
|
47
|
+
sender: string;
|
|
48
|
+
recipient: string;
|
|
49
|
+
ciphertext: Uint8Array;
|
|
50
|
+
nonce: Uint8Array;
|
|
50
51
|
configPda: string;
|
|
51
52
|
feeVault: string;
|
|
52
|
-
|
|
53
|
+
recipientRegistryPda: string;
|
|
53
54
|
payer?: string;
|
|
54
55
|
programId?: string;
|
|
55
|
-
}):
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
}): Instruction;
|
|
57
|
+
export declare function buildCreateServerInstruction(params: {
|
|
58
|
+
creator: string;
|
|
59
|
+
serverPda: string;
|
|
60
|
+
serverId: string;
|
|
61
|
+
name: Uint8Array;
|
|
62
|
+
ownerKeyWrap: Uint8Array;
|
|
63
|
+
ownerKeyNonce: Uint8Array;
|
|
64
|
+
ownerServerMemberPda: string;
|
|
65
|
+
payer?: string;
|
|
65
66
|
programId?: string;
|
|
66
|
-
}):
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
}): Instruction;
|
|
68
|
+
export declare function buildInviteToServerInstruction(params: {
|
|
69
|
+
serverId: string;
|
|
70
|
+
serverPda: string;
|
|
71
|
+
inviter: string;
|
|
72
|
+
inviterMemberPda: string;
|
|
73
|
+
newMember: string;
|
|
74
|
+
newMemberPda: string;
|
|
75
|
+
keyWraps: Uint8Array[];
|
|
76
|
+
keyNonces: Uint8Array[];
|
|
74
77
|
payer?: string;
|
|
75
78
|
programId?: string;
|
|
76
|
-
}):
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
}): Instruction;
|
|
80
|
+
export declare function buildRemoveServerMemberInstruction(params: {
|
|
81
|
+
serverId: string;
|
|
82
|
+
serverPda: string;
|
|
83
|
+
admin: string;
|
|
84
|
+
adminMemberPda: string;
|
|
85
|
+
removedMember: string;
|
|
86
|
+
removedMemberPda: string;
|
|
87
|
+
remainingMemberPdas: string[];
|
|
88
|
+
newKeyWraps: Uint8Array[];
|
|
89
|
+
newKeyNonces: Uint8Array[];
|
|
86
90
|
payer?: string;
|
|
87
91
|
programId?: string;
|
|
88
|
-
}):
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
}): Instruction;
|
|
93
|
+
export declare function buildLeaveServerInstruction(params: {
|
|
94
|
+
serverId: string;
|
|
95
|
+
serverPda: string;
|
|
96
|
+
member: string;
|
|
97
|
+
serverMemberPda: string;
|
|
98
|
+
remainingMemberPdas: string[];
|
|
99
|
+
newKeyWraps: Uint8Array[];
|
|
100
|
+
newKeyNonces: Uint8Array[];
|
|
101
|
+
programId?: string;
|
|
102
|
+
}): Instruction;
|
|
103
|
+
export declare function buildUpdateServerInstruction(params: {
|
|
104
|
+
serverPda: string;
|
|
105
|
+
owner: string;
|
|
106
|
+
name: Uint8Array;
|
|
107
|
+
programId?: string;
|
|
108
|
+
}): Instruction;
|
|
109
|
+
export declare function buildCloseServerInstruction(params: {
|
|
110
|
+
serverPda: string;
|
|
111
|
+
owner: string;
|
|
112
|
+
memberPubkeys: string[];
|
|
113
|
+
memberPdas: string[];
|
|
114
|
+
programId?: string;
|
|
115
|
+
}): Instruction;
|
|
116
|
+
export declare function buildCreateChannelInstruction(params: {
|
|
94
117
|
creator: string;
|
|
95
|
-
|
|
118
|
+
channelPda: string;
|
|
119
|
+
channelId: string;
|
|
120
|
+
serverId?: string;
|
|
121
|
+
channelType: number;
|
|
96
122
|
members: string[];
|
|
123
|
+
keyWraps: Uint8Array[];
|
|
124
|
+
keyNonces: Uint8Array[];
|
|
125
|
+
creatorServerMemberPda?: string;
|
|
126
|
+
channelMemberPdas: string[];
|
|
127
|
+
payer?: string;
|
|
97
128
|
programId?: string;
|
|
98
|
-
}):
|
|
99
|
-
|
|
100
|
-
accounts: any[];
|
|
101
|
-
data: Uint8Array;
|
|
102
|
-
};
|
|
103
|
-
export declare function buildSendGroupMessageInstruction(params: {
|
|
129
|
+
}): Instruction;
|
|
130
|
+
export declare function buildSendChannelMessageInstruction(params: {
|
|
104
131
|
sender: string;
|
|
105
|
-
|
|
132
|
+
channelPda: string;
|
|
106
133
|
configPda: string;
|
|
107
134
|
feeVault: string;
|
|
108
135
|
ciphertext: Uint8Array;
|
|
109
136
|
nonce: Uint8Array;
|
|
110
|
-
|
|
111
|
-
|
|
137
|
+
keyVersion: number;
|
|
138
|
+
senderServerMemberPda?: string;
|
|
112
139
|
payer?: string;
|
|
113
140
|
programId?: string;
|
|
114
|
-
}):
|
|
115
|
-
|
|
116
|
-
accounts: any[];
|
|
117
|
-
data: Uint8Array;
|
|
118
|
-
};
|
|
119
|
-
export declare function buildCloseGroupInstruction(params: {
|
|
141
|
+
}): Instruction;
|
|
142
|
+
export declare function buildAddChannelMembersInstruction(params: {
|
|
120
143
|
creator: string;
|
|
121
|
-
|
|
144
|
+
channelPda: string;
|
|
145
|
+
newMembers: string[];
|
|
146
|
+
keyWraps: Uint8Array[][];
|
|
147
|
+
keyNonces: Uint8Array[][];
|
|
148
|
+
channelMemberPdas: string[];
|
|
149
|
+
payer?: string;
|
|
122
150
|
programId?: string;
|
|
123
|
-
}):
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
151
|
+
}): Instruction;
|
|
152
|
+
export declare function buildRemoveChannelMembersInstruction(params: {
|
|
153
|
+
creator: string;
|
|
154
|
+
oldChannelPda: string;
|
|
155
|
+
newChannelPda: string;
|
|
156
|
+
removeList: string[];
|
|
157
|
+
newKeyWraps: Uint8Array[];
|
|
158
|
+
newKeyNonces: Uint8Array[];
|
|
159
|
+
removedMemberPdas: string[];
|
|
160
|
+
remainingMemberPdas: string[];
|
|
161
|
+
payer?: string;
|
|
131
162
|
programId?: string;
|
|
132
|
-
}):
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
163
|
+
}): Instruction;
|
|
164
|
+
export declare function buildCloseChannelInstruction(params: {
|
|
165
|
+
creator: string;
|
|
166
|
+
channelPda: string;
|
|
167
|
+
channelMemberPdas: string[];
|
|
168
|
+
programId?: string;
|
|
169
|
+
}): Instruction;
|
|
170
|
+
export {};
|
|
137
171
|
//# sourceMappingURL=instructions.d.ts.map
|