@polkadot-apps/statement-store 0.2.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/dist/channels.d.ts +117 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/channels.js +422 -0
- package/dist/channels.js.map +1 -0
- package/dist/client.d.ts +133 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +688 -0
- package/dist/client.js.map +1 -0
- package/dist/codec.d.ts +74 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +564 -0
- package/dist/codec.js.map +1 -0
- package/dist/errors.d.ts +60 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +152 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/topics.d.ts +60 -0
- package/dist/topics.d.ts.map +1 -0
- package/dist/topics.js +187 -0
- package/dist/topics.js.map +1 -0
- package/dist/transport.d.ts +94 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +590 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +276 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +33 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/** Maximum size of a single statement's data payload in bytes. */
|
|
2
|
+
export declare const MAX_STATEMENT_SIZE = 512;
|
|
3
|
+
/** Maximum total storage per user in bytes. */
|
|
4
|
+
export declare const MAX_USER_TOTAL = 1024;
|
|
5
|
+
/** Default time-to-live for published statements in seconds. */
|
|
6
|
+
export declare const DEFAULT_TTL_SECONDS = 30;
|
|
7
|
+
/** Default polling interval in milliseconds for the fallback poller. */
|
|
8
|
+
export declare const DEFAULT_POLL_INTERVAL_MS = 10000;
|
|
9
|
+
/**
|
|
10
|
+
* A 32-byte blake2b-256 hash used as a statement topic.
|
|
11
|
+
*
|
|
12
|
+
* Topics allow subscribers to filter statements efficiently on the network.
|
|
13
|
+
* Create one with {@link createTopic}.
|
|
14
|
+
*/
|
|
15
|
+
export type TopicHash = Uint8Array & {
|
|
16
|
+
readonly __brand: "TopicHash";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A 32-byte blake2b-256 hash used as a statement channel identifier.
|
|
20
|
+
*
|
|
21
|
+
* Channels enable last-write-wins semantics: for a given channel,
|
|
22
|
+
* only the most recent statement (by timestamp) is kept.
|
|
23
|
+
* Create one with {@link createChannel}.
|
|
24
|
+
*/
|
|
25
|
+
export type ChannelHash = Uint8Array & {
|
|
26
|
+
readonly __brand: "ChannelHash";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Raw statement fields before signing.
|
|
30
|
+
*
|
|
31
|
+
* These map directly to the SCALE-encoded fields in the on-chain statement format.
|
|
32
|
+
* Field tags: 0=proof, 2=expiry, 3=decryptionKey, 4=topic1, 5=topic2, 6=channel, 8=data.
|
|
33
|
+
*/
|
|
34
|
+
export interface StatementFields {
|
|
35
|
+
/** Unix timestamp (seconds) at which the statement expires. */
|
|
36
|
+
expirationTimestamp: number;
|
|
37
|
+
/** Sequence number for ordering within the same expiry window. */
|
|
38
|
+
sequenceNumber: number;
|
|
39
|
+
/** Optional 32-byte decryption key hint for filtering polled statements. */
|
|
40
|
+
decryptionKey?: Uint8Array;
|
|
41
|
+
/** Optional 32-byte channel hash for last-write-wins deduplication. */
|
|
42
|
+
channel?: Uint8Array;
|
|
43
|
+
/** Primary topic hash (32 bytes). Typically the application namespace. */
|
|
44
|
+
topic1?: Uint8Array;
|
|
45
|
+
/** Secondary topic hash (32 bytes). Typically the room or document ID. */
|
|
46
|
+
topic2?: Uint8Array;
|
|
47
|
+
/** Arbitrary data payload (max {@link MAX_STATEMENT_SIZE} bytes). */
|
|
48
|
+
data?: Uint8Array;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A statement decoded from the network.
|
|
52
|
+
*
|
|
53
|
+
* Contains all parsed fields from the SCALE-encoded on-chain representation.
|
|
54
|
+
* The `signer` field is extracted from the Sr25519 authenticity proof.
|
|
55
|
+
*/
|
|
56
|
+
export interface DecodedStatement {
|
|
57
|
+
/** 32-byte Sr25519 public key of the statement signer. */
|
|
58
|
+
signer?: Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* Combined expiry value: upper 32 bits are the Unix timestamp,
|
|
61
|
+
* lower 32 bits are the sequence number.
|
|
62
|
+
*/
|
|
63
|
+
expiry?: bigint;
|
|
64
|
+
/** 32-byte decryption key hint. */
|
|
65
|
+
decryptionKey?: Uint8Array;
|
|
66
|
+
/** Primary topic (32 bytes). */
|
|
67
|
+
topic1?: Uint8Array;
|
|
68
|
+
/** Secondary topic (32 bytes). */
|
|
69
|
+
topic2?: Uint8Array;
|
|
70
|
+
/** Channel hash (32 bytes). */
|
|
71
|
+
channel?: Uint8Array;
|
|
72
|
+
/** Raw data payload. */
|
|
73
|
+
data?: Uint8Array;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Filter for statement subscriptions and queries.
|
|
77
|
+
*
|
|
78
|
+
* - `"any"` — matches all statements (no filtering).
|
|
79
|
+
* - `{ matchAll: [...] }` — matches statements that have **all** listed topics.
|
|
80
|
+
* - `{ matchAny: [...] }` — matches statements that have **any** listed topic.
|
|
81
|
+
*/
|
|
82
|
+
export type TopicFilter = "any" | {
|
|
83
|
+
matchAll: TopicHash[];
|
|
84
|
+
} | {
|
|
85
|
+
matchAny: TopicHash[];
|
|
86
|
+
};
|
|
87
|
+
/** Serialized topic filter with hex-encoded topics, ready for JSON-RPC. */
|
|
88
|
+
export type SerializedTopicFilter = "any" | {
|
|
89
|
+
matchAll: string[];
|
|
90
|
+
} | {
|
|
91
|
+
matchAny: string[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Configuration for {@link StatementStoreClient}.
|
|
95
|
+
*
|
|
96
|
+
* Provide either `endpoint` for a direct WebSocket connection to a statement store node,
|
|
97
|
+
* or rely on the chain-client's bulletin chain connection (the default).
|
|
98
|
+
*/
|
|
99
|
+
export interface StatementStoreConfig {
|
|
100
|
+
/**
|
|
101
|
+
* Application namespace used as the primary topic (topic1).
|
|
102
|
+
*
|
|
103
|
+
* All statements published by this client are tagged with `blake2b(appName)`.
|
|
104
|
+
* Subscribers filter on this topic to receive only relevant statements.
|
|
105
|
+
*
|
|
106
|
+
* @example "ss-webrtc", "mark3t-presence", "my-app"
|
|
107
|
+
*/
|
|
108
|
+
appName: string;
|
|
109
|
+
/**
|
|
110
|
+
* Fallback WebSocket endpoint for the statement store node.
|
|
111
|
+
*
|
|
112
|
+
* The client always tries the chain-client's bulletin chain first
|
|
113
|
+
* (which uses Host API routing when inside a container). This endpoint
|
|
114
|
+
* is only used if chain-client is unavailable (not initialized or not installed).
|
|
115
|
+
*
|
|
116
|
+
* @example "wss://paseo-bulletin-rpc.polkadot.io"
|
|
117
|
+
*/
|
|
118
|
+
endpoint?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Polling interval in milliseconds for the fallback poller.
|
|
121
|
+
*
|
|
122
|
+
* The client uses both subscriptions (real-time) and polling (fallback)
|
|
123
|
+
* to ensure no statements are missed. Set to 0 to disable polling.
|
|
124
|
+
*
|
|
125
|
+
* @default 10_000
|
|
126
|
+
*/
|
|
127
|
+
pollIntervalMs?: number;
|
|
128
|
+
/**
|
|
129
|
+
* Default time-to-live for published statements in seconds.
|
|
130
|
+
*
|
|
131
|
+
* Statements automatically expire after this duration.
|
|
132
|
+
* Can be overridden per-publish via {@link PublishOptions.ttlSeconds}.
|
|
133
|
+
*
|
|
134
|
+
* @default 30
|
|
135
|
+
*/
|
|
136
|
+
defaultTtlSeconds?: number;
|
|
137
|
+
/**
|
|
138
|
+
* Whether to enable the polling fallback.
|
|
139
|
+
*
|
|
140
|
+
* When true (default), the client polls for statements periodically
|
|
141
|
+
* in addition to the real-time subscription. This handles gossip delays
|
|
142
|
+
* and nodes that don't support subscriptions.
|
|
143
|
+
*
|
|
144
|
+
* @default true
|
|
145
|
+
*/
|
|
146
|
+
enablePolling?: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Options for publishing a single statement.
|
|
150
|
+
*/
|
|
151
|
+
export interface PublishOptions {
|
|
152
|
+
/**
|
|
153
|
+
* Channel name for last-write-wins semantics.
|
|
154
|
+
*
|
|
155
|
+
* When provided, the statement is tagged with `blake2b(channel)`.
|
|
156
|
+
* For a given channel, only the most recent statement is kept.
|
|
157
|
+
*
|
|
158
|
+
* @example "presence/peer-abc123", "handshake/alice-bob"
|
|
159
|
+
*/
|
|
160
|
+
channel?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Secondary topic for additional filtering.
|
|
163
|
+
*
|
|
164
|
+
* Hashed with blake2b and set as topic2. Useful for scoping
|
|
165
|
+
* statements to a specific room, document, or context.
|
|
166
|
+
*
|
|
167
|
+
* @example "doc-abc123", "room-456"
|
|
168
|
+
*/
|
|
169
|
+
topic2?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Time-to-live in seconds. Overrides {@link StatementStoreConfig.defaultTtlSeconds}.
|
|
172
|
+
*/
|
|
173
|
+
ttlSeconds?: number;
|
|
174
|
+
/**
|
|
175
|
+
* Decryption key hint (32 bytes).
|
|
176
|
+
*
|
|
177
|
+
* Used by the `statement_posted` RPC method to filter statements.
|
|
178
|
+
* Typically set to the blake2b hash of the room or document ID.
|
|
179
|
+
*/
|
|
180
|
+
decryptionKey?: Uint8Array;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A received statement with typed data and metadata.
|
|
184
|
+
*
|
|
185
|
+
* @typeParam T - The parsed data type (decoded from JSON).
|
|
186
|
+
*/
|
|
187
|
+
export interface ReceivedStatement<T = unknown> {
|
|
188
|
+
/** Parsed data payload. */
|
|
189
|
+
data: T;
|
|
190
|
+
/** 32-byte Sr25519 public key of the signer, if present. */
|
|
191
|
+
signer?: Uint8Array;
|
|
192
|
+
/** Channel hash, if present. */
|
|
193
|
+
channel?: Uint8Array;
|
|
194
|
+
/** Primary topic hash, if present. */
|
|
195
|
+
topic1?: Uint8Array;
|
|
196
|
+
/** Secondary topic hash, if present. */
|
|
197
|
+
topic2?: Uint8Array;
|
|
198
|
+
/** Combined expiry value (upper 32 bits = timestamp, lower 32 bits = sequence). */
|
|
199
|
+
expiry?: bigint;
|
|
200
|
+
/** The full decoded statement for advanced inspection. */
|
|
201
|
+
raw: DecodedStatement;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* A function that signs a message with an Sr25519 key.
|
|
205
|
+
*
|
|
206
|
+
* Takes the signature material bytes and returns a 64-byte Sr25519 signature.
|
|
207
|
+
* May be synchronous or asynchronous (e.g., when signing via a hardware wallet).
|
|
208
|
+
*/
|
|
209
|
+
export type StatementSigner = (message: Uint8Array) => Uint8Array | Promise<Uint8Array>;
|
|
210
|
+
/**
|
|
211
|
+
* An Sr25519 signer with its associated public key.
|
|
212
|
+
*
|
|
213
|
+
* Used by {@link StatementStoreClient.connect} to sign published statements.
|
|
214
|
+
*/
|
|
215
|
+
export interface StatementSignerWithKey {
|
|
216
|
+
/** 32-byte Sr25519 public key. */
|
|
217
|
+
publicKey: Uint8Array;
|
|
218
|
+
/** Signing function. */
|
|
219
|
+
sign: StatementSigner;
|
|
220
|
+
}
|
|
221
|
+
/** Result status from submitting a statement via RPC. */
|
|
222
|
+
export type SubmitStatus = "new" | "known" | "rejected";
|
|
223
|
+
/** Handle returned by subscription methods. Call `unsubscribe()` to stop receiving events. */
|
|
224
|
+
export interface Unsubscribable {
|
|
225
|
+
unsubscribe: () => void;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Low-level transport interface for statement store communication.
|
|
229
|
+
*
|
|
230
|
+
* Implementations handle the actual RPC or Host API calls.
|
|
231
|
+
* Most consumers should use {@link StatementStoreClient} instead.
|
|
232
|
+
*/
|
|
233
|
+
export interface StatementTransport {
|
|
234
|
+
/**
|
|
235
|
+
* Subscribe to statements matching a topic filter.
|
|
236
|
+
*
|
|
237
|
+
* @param filter - Topic filter for the subscription.
|
|
238
|
+
* @param onStatement - Called with each statement's hex-encoded bytes.
|
|
239
|
+
* @param onError - Called when the subscription encounters an error.
|
|
240
|
+
* @returns A handle to unsubscribe.
|
|
241
|
+
*/
|
|
242
|
+
subscribe(filter: TopicFilter, onStatement: (statementHex: string) => void, onError: (error: Error) => void): Unsubscribable;
|
|
243
|
+
/**
|
|
244
|
+
* Submit a signed statement to the network.
|
|
245
|
+
*
|
|
246
|
+
* @param statementHex - Hex-encoded SCALE-encoded signed statement.
|
|
247
|
+
* @returns The submission status: "new" (accepted), "known" (duplicate), or "rejected".
|
|
248
|
+
*/
|
|
249
|
+
submit(statementHex: string): Promise<SubmitStatus>;
|
|
250
|
+
/**
|
|
251
|
+
* Query existing statements from the store.
|
|
252
|
+
*
|
|
253
|
+
* Tries multiple RPC methods with graceful fallback:
|
|
254
|
+
* `statement_posted` -> `statement_broadcasts` -> `statement_dump`.
|
|
255
|
+
*
|
|
256
|
+
* @param topics - Topic hashes to filter by.
|
|
257
|
+
* @param decryptionKey - Optional hex-encoded decryption key for `statement_posted`.
|
|
258
|
+
* @returns Array of hex-encoded statement strings.
|
|
259
|
+
*/
|
|
260
|
+
query(topics: TopicHash[], decryptionKey?: string): Promise<string[]>;
|
|
261
|
+
/** Destroy the transport and release all resources. */
|
|
262
|
+
destroy(): void;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Batched event format from the statement subscription API.
|
|
266
|
+
*
|
|
267
|
+
* The subscription returns batched events with metadata
|
|
268
|
+
* instead of individual hex strings.
|
|
269
|
+
*/
|
|
270
|
+
export interface StatementEvent {
|
|
271
|
+
/** Array of SCALE-encoded hex statements. */
|
|
272
|
+
statements: string[];
|
|
273
|
+
/** Count of remaining statements in initial sync. */
|
|
274
|
+
remaining?: number;
|
|
275
|
+
}
|
|
276
|
+
//#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AqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Constants
|
|
3
|
+
// ============================================================================
|
|
4
|
+
/** Maximum size of a single statement's data payload in bytes. */
|
|
5
|
+
export const MAX_STATEMENT_SIZE = 512;
|
|
6
|
+
/** Maximum total storage per user in bytes. */
|
|
7
|
+
export const MAX_USER_TOTAL = 1024;
|
|
8
|
+
/** Default time-to-live for published statements in seconds. */
|
|
9
|
+
export const DEFAULT_TTL_SECONDS = 30;
|
|
10
|
+
/** Default polling interval in milliseconds for the fallback poller. */
|
|
11
|
+
export const DEFAULT_POLL_INTERVAL_MS = 10_000;
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,kEAAkE;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC,wEAAwE;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@polkadot-apps/statement-store",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@noble/hashes": "^2.0.1",
|
|
21
|
+
"polkadot-api": "^1.23.3",
|
|
22
|
+
"@polkadot-apps/chain-client": "0.3.1",
|
|
23
|
+
"@polkadot-apps/descriptors": "0.1.2",
|
|
24
|
+
"@polkadot-apps/logger": "0.1.3"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.9.3"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.json",
|
|
31
|
+
"clean": "rm -rf dist"
|
|
32
|
+
}
|
|
33
|
+
}
|