@domino-sdk/relay 1.0.0-next.2 → 1.0.0-next.34

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.
Files changed (61) hide show
  1. package/README.md +13 -1
  2. package/build.mjs +18 -1
  3. package/dist/activity-B8k9Sa_a.d.ts +9112 -0
  4. package/dist/authoring.d.ts +1355 -182
  5. package/dist/authoring.js +658 -225
  6. package/dist/automatic-outcomes-B1xrETxm.d.ts +758 -0
  7. package/dist/avatar.d.ts +29 -0
  8. package/dist/avatar.js +21 -0
  9. package/dist/browser-J7tUpXxy.d.ts +4154 -0
  10. package/dist/browser.d.ts +11 -4580
  11. package/dist/browser.js +8 -6
  12. package/dist/capability-error-DNMwKmlL.d.ts +458 -0
  13. package/dist/chunk-36HTX2BM.js +1223 -0
  14. package/dist/chunk-6QJ3LADK.js +112 -0
  15. package/dist/chunk-BGGKNIRP.js +171 -0
  16. package/dist/chunk-EYH5RDIE.js +496 -0
  17. package/dist/chunk-GQKYAQM6.js +84 -0
  18. package/dist/chunk-GUP7YRR4.js +42 -0
  19. package/dist/chunk-GZ6FJAXN.js +1659 -0
  20. package/dist/chunk-JON5SESL.js +2986 -0
  21. package/dist/chunk-MC6V6VMG.js +49 -0
  22. package/dist/chunk-NPGENI7K.js +37 -0
  23. package/dist/chunk-V7UKZLHA.js +35 -0
  24. package/dist/chunk-VFHHLN6A.js +284 -0
  25. package/dist/chunk-WJSSJ7AF.js +151 -0
  26. package/dist/{chunk-VH4OQ5VX.js → chunk-XFMSUPNS.js} +26 -5
  27. package/dist/{chunk-FDWRBMB3.js → chunk-ZVIRG24J.js} +150 -33
  28. package/dist/client-XiuFnug_.d.ts +4262 -0
  29. package/dist/groups-Ck-OxzjD.d.ts +2449 -0
  30. package/dist/identity-integration-GxAHdKR2.d.ts +58 -0
  31. package/dist/images-Dv-P5VBw.d.ts +234 -0
  32. package/dist/index.d.ts +15 -13115
  33. package/dist/index.js +30 -689
  34. package/dist/internal.d.ts +159 -0
  35. package/dist/internal.js +79 -0
  36. package/dist/offers-Cy-e4o5x.d.ts +431 -0
  37. package/dist/outcomes-kVB-Juzs.d.ts +4902 -0
  38. package/dist/pages-BBYD21IE.d.ts +359 -0
  39. package/dist/participant-rewards-3duLb8YJ.d.ts +668 -0
  40. package/dist/portal-proxy.js +26 -9
  41. package/dist/profiles-D2aFcOxu.d.ts +297 -0
  42. package/dist/react/index.d.ts +3378 -3318
  43. package/dist/react/index.js +1635 -783
  44. package/dist/request-error-DWduJCGV.d.ts +62 -0
  45. package/dist/schema-DfJzH2ci.d.ts +5644 -0
  46. package/dist/schema.d.ts +15 -3388
  47. package/dist/schema.js +790 -3
  48. package/dist/server/index.d.ts +81498 -0
  49. package/dist/server/index.js +2520 -0
  50. package/dist/streaks-CWyq8Px5.d.ts +71 -0
  51. package/dist/submission-input-BZkm6ohU.d.ts +290 -0
  52. package/dist/units-CwgsPB_r.d.ts +9 -0
  53. package/dist/vite.d.ts +1 -1
  54. package/dist/vite.js +1 -0
  55. package/dist/wallet-YssWxGg8.d.ts +228 -0
  56. package/package.json +24 -5
  57. package/dist/chunk-4KNTMNXA.js +0 -1847
  58. package/dist/chunk-B76BAJ25.js +0 -624
  59. package/dist/chunk-NKGJEYZM.js +0 -1833
  60. package/dist/chunk-ONDBQSMU.js +0 -373
  61. package/dist/submission-input-JDwq3EVK.d.ts +0 -4986
@@ -0,0 +1,71 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const quizChoiceSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ label: z.ZodString;
6
+ }, z.core.$strict>;
7
+ declare const quizQuestionSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ prompt: z.ZodString;
10
+ choices: z.ZodArray<z.ZodObject<{
11
+ id: z.ZodString;
12
+ label: z.ZodString;
13
+ }, z.core.$strict>>;
14
+ }, z.core.$strict>;
15
+ declare const quizQuestionsSchema: z.ZodArray<z.ZodObject<{
16
+ id: z.ZodString;
17
+ prompt: z.ZodString;
18
+ choices: z.ZodArray<z.ZodObject<{
19
+ id: z.ZodString;
20
+ label: z.ZodString;
21
+ }, z.core.$strict>>;
22
+ }, z.core.$strict>>;
23
+ declare const quizContentSchema: z.ZodArray<z.ZodObject<{
24
+ id: z.ZodString;
25
+ prompt: z.ZodString;
26
+ choices: z.ZodArray<z.ZodObject<{
27
+ id: z.ZodString;
28
+ label: z.ZodString;
29
+ }, z.core.$strict>>;
30
+ correct: z.ZodString;
31
+ }, z.core.$strict>>;
32
+ type QuizContent = z.infer<typeof quizContentSchema>;
33
+
34
+ declare const streakPolicySchema: z.ZodObject<{
35
+ kind: z.ZodLiteral<"streak">;
36
+ days: z.ZodNumber;
37
+ }, z.core.$strip>;
38
+ type StreakPolicy = z.infer<typeof streakPolicySchema>;
39
+ declare const streakProgressSchema: z.ZodObject<{
40
+ goal: z.ZodNumber;
41
+ current: z.ZodNumber;
42
+ best: z.ZodNumber;
43
+ today: z.ZodString;
44
+ todayQualified: z.ZodBoolean;
45
+ timeZone: z.ZodString;
46
+ nextBoundary: z.ZodNumber;
47
+ pendingTimeZone: z.ZodNullable<z.ZodObject<{
48
+ timeZone: z.ZodString;
49
+ effectiveAt: z.ZodNumber;
50
+ }, z.core.$strip>>;
51
+ days: z.ZodArray<z.ZodObject<{
52
+ day: z.ZodNumber;
53
+ date: z.ZodString;
54
+ timeZone: z.ZodString;
55
+ occurredAt: z.ZodNumber;
56
+ }, z.core.$strip>>;
57
+ milestone: z.ZodDiscriminatedUnion<[z.ZodObject<{
58
+ status: z.ZodLiteral<"pending">;
59
+ }, z.core.$strip>, z.ZodObject<{
60
+ status: z.ZodLiteral<"awarded">;
61
+ completion: z.ZodString;
62
+ achievedAt: z.ZodNumber;
63
+ }, z.core.$strip>, z.ZodObject<{
64
+ status: z.ZodLiteral<"budget-exhausted">;
65
+ budget: z.ZodString;
66
+ achievedAt: z.ZodNumber;
67
+ }, z.core.$strip>], "status">;
68
+ }, z.core.$strip>;
69
+ type StreakProgress = z.infer<typeof streakProgressSchema>;
70
+
71
+ export { type QuizContent as Q, type StreakProgress as S, type StreakPolicy as a, quizContentSchema as b, quizQuestionSchema as c, quizQuestionsSchema as d, streakProgressSchema as e, quizChoiceSchema as q, streakPolicySchema as s };
@@ -0,0 +1,290 @@
1
+ import { z } from 'zod';
2
+ import { cH as LedgerReference, cG as QuestHandle } from './schema-DfJzH2ci.js';
3
+ import { p as ProjectGroupReference } from './groups-Ck-OxzjD.js';
4
+
5
+ /** A Discord message as `ctx.discord.message()` reads it, from the project's Discord server. */
6
+ declare const discordMessageSchema: z.ZodObject<{
7
+ guildId: z.ZodString;
8
+ channelId: z.ZodString;
9
+ messageId: z.ZodString;
10
+ userId: z.ZodString;
11
+ content: z.ZodNullable<z.ZodString>;
12
+ replyTo: z.ZodNullable<z.ZodString>;
13
+ publishedAt: z.ZodNumber;
14
+ }, z.core.$strict>;
15
+ type DiscordMessage = z.infer<typeof discordMessageSchema>;
16
+ /**
17
+ * Messages posted in the project's Discord server, written by the Discord gateway. The record's
18
+ * `author` is the message author's Discord account. Message text is stored only with `text: true`.
19
+ * Edits update stored text. Deleting a message, or turning text off, removes retained text.
20
+ */
21
+ declare const discordMessagesSourceSchema: z.ZodObject<{
22
+ kind: z.ZodLiteral<"discord-messages">;
23
+ /** Store each message's text in `data.text`. Off unless set. */
24
+ text: z.ZodOptional<z.ZodBoolean>;
25
+ }, z.core.$strict>;
26
+ /**
27
+ * Reactions added in the project's Discord server, written by the Discord gateway. The record's
28
+ * `author` is the reactor's Discord account and its `messageAuthor` account is the message's
29
+ * author, when Discord could name it.
30
+ */
31
+ declare const discordReactionsSourceSchema: z.ZodObject<{
32
+ kind: z.ZodLiteral<"discord-reactions">;
33
+ }, z.core.$strict>;
34
+ /** The `data` of a `discord.messages()` record. IDs are Discord snowflakes. */
35
+ declare const discordMessageDataSchema: z.ZodObject<{
36
+ guildId: z.ZodString;
37
+ channelId: z.ZodString;
38
+ messageId: z.ZodString;
39
+ replyTo: z.ZodNullable<z.ZodString>;
40
+ publishedAt: z.ZodNumber;
41
+ }, z.core.$strip>;
42
+ type DiscordMessageData = z.infer<typeof discordMessageDataSchema>;
43
+ /**
44
+ * The `data` of a `discord.messages({ text: true })` record. `text` is null when the platform's
45
+ * bot does not receive message content.
46
+ */
47
+ declare const discordMessageTextDataSchema: z.ZodObject<{
48
+ guildId: z.ZodString;
49
+ channelId: z.ZodString;
50
+ messageId: z.ZodString;
51
+ replyTo: z.ZodNullable<z.ZodString>;
52
+ publishedAt: z.ZodNumber;
53
+ text: z.ZodNullable<z.ZodString>;
54
+ }, z.core.$strip>;
55
+ type DiscordMessageTextData = z.infer<typeof discordMessageTextDataSchema>;
56
+ /** The `data` of a `discord.reactions()` record. IDs are Discord snowflakes. */
57
+ declare const discordReactionDataSchema: z.ZodObject<{
58
+ guildId: z.ZodString;
59
+ channelId: z.ZodString;
60
+ messageId: z.ZodString;
61
+ emoji: z.ZodObject<{
62
+ id: z.ZodNullable<z.ZodString>;
63
+ name: z.ZodString;
64
+ }, z.core.$strip>;
65
+ reactorRoles: z.ZodArray<z.ZodString>;
66
+ messagePublishedAt: z.ZodNumber;
67
+ }, z.core.$strip>;
68
+ type DiscordReactionData = z.infer<typeof discordReactionDataSchema>;
69
+ /** Rewards and resource selectors supported by the Discord integration. */
70
+ declare const discordRewardSchema: z.ZodObject<{
71
+ kind: z.ZodLiteral<"integration">;
72
+ provider: z.ZodLiteral<"discord">;
73
+ action: z.ZodLiteral<"grant-role">;
74
+ roleId: z.ZodString;
75
+ }, z.core.$strict>;
76
+ declare const discordResourceSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
77
+ provider: z.ZodLiteral<"discord">;
78
+ resource: z.ZodLiteral<"channel">;
79
+ types: z.ZodArray<z.ZodEnum<{
80
+ text: "text";
81
+ announcement: "announcement";
82
+ }>>;
83
+ }, z.core.$strict>, z.ZodObject<{
84
+ provider: z.ZodLiteral<"discord">;
85
+ resource: z.ZodLiteral<"role">;
86
+ assignable: z.ZodDefault<z.ZodBoolean>;
87
+ }, z.core.$strict>]>;
88
+
89
+ declare const completionPrerequisiteSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
90
+ kind: z.ZodLiteral<"completion">;
91
+ quest: z.ZodString;
92
+ scope: z.ZodLiteral<"ever">;
93
+ }, z.core.$strict>, z.ZodObject<{
94
+ kind: z.ZodLiteral<"completion">;
95
+ quest: z.ZodString;
96
+ scope: z.ZodLiteral<"period">;
97
+ period: z.ZodEnum<{
98
+ day: "day";
99
+ week: "week";
100
+ month: "month";
101
+ }>;
102
+ }, z.core.$strict>], "scope">;
103
+ declare const balancePrerequisiteSchema: z.ZodObject<{
104
+ kind: z.ZodLiteral<"balance">;
105
+ balance: z.ZodString;
106
+ minimum: z.ZodNumber;
107
+ }, z.core.$strict>;
108
+ declare const groupPrerequisiteSchema: z.ZodObject<{
109
+ kind: z.ZodLiteral<"group">;
110
+ group: z.ZodString;
111
+ title: z.ZodString;
112
+ }, z.core.$strict>;
113
+ declare const prerequisiteSchema: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
114
+ kind: z.ZodLiteral<"completion">;
115
+ quest: z.ZodString;
116
+ scope: z.ZodLiteral<"ever">;
117
+ }, z.core.$strict>, z.ZodObject<{
118
+ kind: z.ZodLiteral<"completion">;
119
+ quest: z.ZodString;
120
+ scope: z.ZodLiteral<"period">;
121
+ period: z.ZodEnum<{
122
+ day: "day";
123
+ week: "week";
124
+ month: "month";
125
+ }>;
126
+ }, z.core.$strict>], "scope">, z.ZodObject<{
127
+ kind: z.ZodLiteral<"balance">;
128
+ balance: z.ZodString;
129
+ minimum: z.ZodNumber;
130
+ }, z.core.$strict>, z.ZodObject<{
131
+ kind: z.ZodLiteral<"group">;
132
+ group: z.ZodString;
133
+ title: z.ZodString;
134
+ }, z.core.$strict>], "kind">;
135
+ type Prerequisite = z.infer<typeof prerequisiteSchema>;
136
+ declare const missingPrerequisiteSchema: z.ZodUnion<readonly [z.ZodObject<{
137
+ kind: z.ZodLiteral<"completion">;
138
+ quest: z.ZodString;
139
+ title: z.ZodString;
140
+ scope: z.ZodLiteral<"ever">;
141
+ }, z.core.$strip>, z.ZodObject<{
142
+ kind: z.ZodLiteral<"completion">;
143
+ quest: z.ZodString;
144
+ title: z.ZodString;
145
+ scope: z.ZodLiteral<"period">;
146
+ period: z.ZodEnum<{
147
+ day: "day";
148
+ week: "week";
149
+ month: "month";
150
+ }>;
151
+ resetsAt: z.ZodNumber;
152
+ }, z.core.$strip>, z.ZodObject<{
153
+ kind: z.ZodLiteral<"balance">;
154
+ balance: z.ZodString;
155
+ title: z.ZodString;
156
+ minimum: z.ZodNumber;
157
+ current: z.ZodNumber;
158
+ }, z.core.$strip>, z.ZodObject<{
159
+ kind: z.ZodLiteral<"group">;
160
+ group: z.ZodString;
161
+ title: z.ZodString;
162
+ }, z.core.$strip>]>;
163
+ type MissingPrerequisite = z.infer<typeof missingPrerequisiteSchema>;
164
+ declare function completed(quest: QuestHandle, options?: {
165
+ scope?: "ever";
166
+ } | {
167
+ scope: "period";
168
+ period: "day" | "week" | "month";
169
+ }): {
170
+ kind: "completion";
171
+ quest: string;
172
+ scope: "ever";
173
+ } | {
174
+ kind: "completion";
175
+ quest: string;
176
+ scope: "period";
177
+ period: "day" | "week" | "month";
178
+ };
179
+ declare function balanceAtLeast(balance: LedgerReference, minimum: number): {
180
+ kind: "balance";
181
+ balance: string;
182
+ minimum: number;
183
+ };
184
+ declare function inGroup(group: ProjectGroupReference): {
185
+ kind: "group";
186
+ group: string;
187
+ title: string;
188
+ };
189
+
190
+ declare const authProviderSchema: z.ZodEnum<{
191
+ discord: "discord";
192
+ google: "google";
193
+ apple: "apple";
194
+ x: "x";
195
+ }>;
196
+ type AuthProvider = z.infer<typeof authProviderSchema>;
197
+ declare const accountConnectionSchema: z.ZodObject<{
198
+ provider: z.ZodEnum<{
199
+ discord: "discord";
200
+ google: "google";
201
+ apple: "apple";
202
+ x: "x";
203
+ }>;
204
+ configured: z.ZodBoolean;
205
+ status: z.ZodEnum<{
206
+ disconnected: "disconnected";
207
+ connected: "connected";
208
+ reconnect: "reconnect";
209
+ }>;
210
+ subject: z.ZodNullable<z.ZodString>;
211
+ revision: z.ZodNumber;
212
+ }, z.core.$strip>;
213
+ type AccountConnection = z.infer<typeof accountConnectionSchema>;
214
+ declare const discordMemberInputSchema: z.ZodObject<{}, z.core.$strict>;
215
+ declare const discordMessageInputSchema: z.ZodObject<{
216
+ channelId: z.ZodString;
217
+ messageId: z.ZodString;
218
+ }, z.core.$strict>;
219
+ declare const discordMemberSchema: z.ZodObject<{
220
+ userId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
221
+ nickname: z.ZodDefault<z.ZodNullable<z.ZodString>>;
222
+ displayName: z.ZodDefault<z.ZodNullable<z.ZodString>>;
223
+ boostingSince: z.ZodDefault<z.ZodNullable<z.ZodString>>;
224
+ roles: z.ZodArray<z.ZodString>;
225
+ joinedAt: z.ZodNullable<z.ZodString>;
226
+ pending: z.ZodBoolean;
227
+ }, z.core.$strip>;
228
+ type DiscordMember = z.infer<typeof discordMemberSchema>;
229
+ /**
230
+ * Reads the project's connected Discord server for the member's linked Discord account. The
231
+ * account and the integration are pinned at the attempt's first Discord read: later links and
232
+ * unlinks do not change the attempt. Provider failures, and an integration that is not ready,
233
+ * throw `CapabilityError` with code `"provider-unavailable"`.
234
+ */
235
+ interface DiscordReader {
236
+ /** The member's server membership; null when they are not in the server or have not linked Discord. */
237
+ member(): Promise<DiscordMember | null>;
238
+ /**
239
+ * A message in the connected server; null when it does not exist. The bot reads it, so the
240
+ * member needs no linked Discord account. A channel outside the connected server, or one the
241
+ * bot cannot see, throws
242
+ * `CapabilityError` with code `"author-error"`.
243
+ */
244
+ message(input: {
245
+ channelId: string;
246
+ messageId: string;
247
+ }): Promise<DiscordMessage | null>;
248
+ }
249
+
250
+ declare const textOptionsSchema: z.ZodObject<{
251
+ required: z.ZodDefault<z.ZodBoolean>;
252
+ minLength: z.ZodDefault<z.ZodNumber>;
253
+ maxLength: z.ZodDefault<z.ZodNumber>;
254
+ }, z.core.$strict>;
255
+ declare const urlOptionsSchema: z.ZodObject<{
256
+ required: z.ZodDefault<z.ZodBoolean>;
257
+ allowedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
258
+ }, z.core.$strict>;
259
+ type TextOptions = z.input<typeof textOptionsSchema>;
260
+ type UrlOptions = z.input<typeof urlOptionsSchema>;
261
+ declare const textEvidenceSchema: z.ZodObject<{
262
+ kind: z.ZodLiteral<"text">;
263
+ value: z.ZodString;
264
+ }, z.core.$strict>;
265
+ declare const urlEvidenceSchema: z.ZodObject<{
266
+ kind: z.ZodLiteral<"url">;
267
+ value: z.ZodString;
268
+ }, z.core.$strict>;
269
+ declare const valueEvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
270
+ kind: z.ZodLiteral<"text">;
271
+ value: z.ZodString;
272
+ }, z.core.$strict>, z.ZodObject<{
273
+ kind: z.ZodLiteral<"url">;
274
+ value: z.ZodString;
275
+ }, z.core.$strict>], "kind">;
276
+ type TextEvidence = z.infer<typeof textEvidenceSchema>;
277
+ type UrlEvidence = z.infer<typeof urlEvidenceSchema>;
278
+ type ValueEvidence = z.infer<typeof valueEvidenceSchema>;
279
+ /** Validates a claim without fetching it or changing the captured value. */
280
+ declare function validateSubmissionValue(input: ValueEvidence, contract: {
281
+ input: "text";
282
+ constraints: z.output<typeof textOptionsSchema>;
283
+ } | {
284
+ input: "url";
285
+ constraints: z.output<typeof urlOptionsSchema>;
286
+ }): string | null;
287
+ /** Extract an ID only. The URL and its author name are untrusted claims. */
288
+ declare function xPostId(value: string): string | null;
289
+
290
+ export { type AccountConnection as A, inGroup as B, missingPrerequisiteSchema as C, type DiscordMember as D, prerequisiteSchema as E, textEvidenceSchema as F, textOptionsSchema as G, urlEvidenceSchema as H, urlOptionsSchema as I, validateSubmissionValue as J, valueEvidenceSchema as K, xPostId as L, type MissingPrerequisite as M, type Prerequisite as P, type TextEvidence as T, type UrlEvidence as U, type ValueEvidence as V, type AuthProvider as a, type TextOptions as b, type UrlOptions as c, type DiscordMessage as d, type DiscordMessageData as e, type DiscordMessageTextData as f, type DiscordReactionData as g, type DiscordReader as h, accountConnectionSchema as i, authProviderSchema as j, balanceAtLeast as k, balancePrerequisiteSchema as l, completed as m, completionPrerequisiteSchema as n, discordMemberInputSchema as o, discordMemberSchema as p, discordMessageDataSchema as q, discordMessageInputSchema as r, discordMessageSchema as s, discordMessageTextDataSchema as t, discordMessagesSourceSchema as u, discordReactionDataSchema as v, discordReactionsSourceSchema as w, discordResourceSourceSchema as x, discordRewardSchema as y, groupPrerequisiteSchema as z };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A decimal amount in whole tokens as raw integer units: `parseUnits("1.5", 6)` is `1500000n`.
3
+ * Rejects negative amounts, exponents and more fraction digits than the token has.
4
+ */
5
+ declare function parseUnits(value: string, decimals: number): bigint;
6
+ /** Raw integer units as a decimal amount in whole tokens: `formatUnits("1500000", 6)` is `"1.5"`. */
7
+ declare function formatUnits(amount: string | bigint, decimals: number): string;
8
+
9
+ export { formatUnits as f, parseUnits as p };
package/dist/vite.d.ts CHANGED
@@ -10,7 +10,7 @@ type ResolveContext = {
10
10
  };
11
11
  /**
12
12
  * Fails the build when browser code imports server-only code: the management
13
- * client (`@domino-sdk/relay-cli`), the participant proxy, or anything under
13
+ * client (`@domino-sdk/relay/server`), the CLI, the participant proxy, or anything under
14
14
  * the app's `server/` directory. Management credentials and app secrets live
15
15
  * in the Worker; this keeps them from ever reaching a browser bundle.
16
16
  *
package/dist/vite.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/vite.ts
2
2
  var SERVER_ONLY = [
3
+ /^@domino-sdk\/relay\/server$/,
3
4
  /^@domino-sdk\/relay-cli(?:\/|$)/,
4
5
  /^@domino-sdk\/relay\/portal-proxy$/
5
6
  ];
@@ -0,0 +1,228 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const solanaAddressSchema: z.ZodString;
4
+ /** A wallet's chain family: its CAIP-2 namespace. */
5
+ declare const walletChainSchema: z.ZodEnum<{
6
+ solana: "solana";
7
+ eip155: "eip155";
8
+ cosmos: "cosmos";
9
+ }>;
10
+ type WalletChain = z.infer<typeof walletChainSchema>;
11
+ /**
12
+ * A Cosmos SDK chain's CAIP-2 ID: `cosmos:` and the chain ID, such as `cosmos:cosmoshub-4`. Relay
13
+ * accepts any chain ID in CAIP-2 reference syntax; the app decides which chains it works with.
14
+ */
15
+ type CosmosNetwork = `cosmos:${string}`;
16
+ declare const cosmosNetworkSchema: z.ZodCustom<`cosmos:${string}`, `cosmos:${string}`>;
17
+ /** A Cosmos SDK bank denomination: 3–128 characters in the SDK's canonical denom syntax. */
18
+ type CosmosDenom = string;
19
+ declare const cosmosDenomSchema: z.ZodString;
20
+ /**
21
+ * A Cosmos SDK chain an app works with. Pass `chainInfo` (Keplr's `ChainInfo` shape) for a chain
22
+ * wallets may not know: the adapters suggest it to the wallet (`experimentalSuggestChain`).
23
+ */
24
+ type CosmosChain = {
25
+ /** The chain ID, such as `"cosmoshub-4"`. */
26
+ chainId: string;
27
+ chainInfo?: {
28
+ chainId: string;
29
+ } & Record<string, unknown>;
30
+ };
31
+ /** Reads the chain an app passes, a `CosmosChain` or its CAIP-2 ID, and adds the CAIP-2 ID. */
32
+ declare function cosmosChain(chain: CosmosChain | CosmosNetwork): CosmosChain & {
33
+ network: CosmosNetwork;
34
+ };
35
+ /** The CAIP-2 ID of Solana mainnet (its genesis hash, truncated to 32 characters). */
36
+ declare const solanaMainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
37
+ declare const evmAddressSchema: z.ZodString;
38
+ /** Bech32 with any prefix, in one case. The server checks the checksum and stores lowercase. */
39
+ declare const cosmosAddressSchema: z.ZodString;
40
+ /** What the wallet says its address is. The server checks the format and canonicalises it (EIP-55, lowercase bech32). */
41
+ declare const walletAddressInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
42
+ chain: z.ZodLiteral<"solana">;
43
+ address: z.ZodString;
44
+ }, z.core.$strict>, z.ZodObject<{
45
+ chain: z.ZodLiteral<"eip155">;
46
+ address: z.ZodString;
47
+ chainId: z.ZodOptional<z.ZodNumber>;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ chain: z.ZodLiteral<"cosmos">;
50
+ network: z.ZodCustom<`cosmos:${string}`, `cosmos:${string}`>;
51
+ address: z.ZodString;
52
+ }, z.core.$strict>], "chain">;
53
+ type WalletAddressInput = z.input<typeof walletAddressInputSchema>;
54
+ /** Not strict: newer servers may add fields. */
55
+ declare const walletMessageChallengeSchema: z.ZodObject<{
56
+ id: z.ZodString;
57
+ purpose: z.ZodEnum<{
58
+ link: "link";
59
+ "sign-in": "sign-in";
60
+ }>;
61
+ chain: z.ZodEnum<{
62
+ solana: "solana";
63
+ eip155: "eip155";
64
+ cosmos: "cosmos";
65
+ }>;
66
+ network: z.ZodNullable<z.ZodCustom<`cosmos:${string}`, `cosmos:${string}`>>;
67
+ address: z.ZodString;
68
+ message: z.ZodString;
69
+ expiresAt: z.ZodNumber;
70
+ }, z.core.$strip>;
71
+ type WalletMessageChallenge = z.infer<typeof walletMessageChallengeSchema>;
72
+ declare const walletSignatureSchema: z.ZodObject<{
73
+ challenge: z.ZodString;
74
+ signature: z.ZodString;
75
+ publicKey: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strict>;
77
+ type WalletSignature = z.infer<typeof walletSignatureSchema>;
78
+ declare const linkedWalletSchema: z.ZodObject<{
79
+ chain: z.ZodEnum<{
80
+ solana: "solana";
81
+ eip155: "eip155";
82
+ cosmos: "cosmos";
83
+ }>;
84
+ network: z.ZodNullable<z.ZodCustom<`cosmos:${string}`, `cosmos:${string}`>>;
85
+ address: z.ZodString;
86
+ verifiedAt: z.ZodNumber;
87
+ revision: z.ZodNumber;
88
+ signIn: z.ZodBoolean;
89
+ }, z.core.$strip>;
90
+ type LinkedWallet = z.infer<typeof linkedWalletSchema>;
91
+ declare const walletUnlinkInputSchema: z.ZodObject<{
92
+ chain: z.ZodEnum<{
93
+ solana: "solana";
94
+ eip155: "eip155";
95
+ cosmos: "cosmos";
96
+ }>;
97
+ address: z.ZodString;
98
+ }, z.core.$strict>;
99
+ type WalletUnlinkInput = z.infer<typeof walletUnlinkInputSchema>;
100
+ /**
101
+ * A wallet that can prove control of an address. `@domino-sdk/relay/browser` has adapters for
102
+ * injected EVM, Solana and Keplr-style wallets; tests and servers can implement it directly.
103
+ */
104
+ type WalletSigner = {
105
+ readonly chain: WalletChain;
106
+ /** Required when `chain` is `"cosmos"`: the app's chain, `cosmos:<chain ID>`. */
107
+ readonly network?: CosmosNetwork;
108
+ /** For UI, such as "Phantom". */
109
+ readonly name?: string;
110
+ /** Connect if needed and return the address to challenge. */
111
+ address(): Promise<string>;
112
+ /** EVM only: the wallet's current chain, shown in the message's Chain ID line. */
113
+ chainId?(): Promise<number>;
114
+ /** Sign the exact UTF-8 message and return the encoding `walletSignatureSchema` documents. */
115
+ sign(message: string, address: string): Promise<{
116
+ signature: string;
117
+ publicKey?: string;
118
+ }>;
119
+ };
120
+ /** Builds the challenge input for a signer's address. */
121
+ declare function walletAddressInput(signer: WalletSigner): Promise<WalletAddressInput>;
122
+ /**
123
+ * The most wallets of one chain family a member can have linked to one project at a time. Sign-in
124
+ * wallets do not count: signing in always links the wallet.
125
+ */
126
+ declare const WALLETS_PER_CHAIN = 5;
127
+ /** The wallet families a project can enable for sign-in, in their stored order. */
128
+ declare const walletSignInFamilies: readonly ["solana", "eip155", "cosmos"];
129
+ /**
130
+ * What a project enables wallet sign-in for: a chain family. A Cosmos wallet signs in on any
131
+ * Cosmos SDK chain the app offers. Off unless the project enables it.
132
+ */
133
+ declare const walletSignInNetworkSchema: z.ZodEnum<{
134
+ solana: "solana";
135
+ eip155: "eip155";
136
+ cosmos: "cosmos";
137
+ }>;
138
+ type WalletSignInNetwork = (typeof walletSignInFamilies)[number];
139
+ /** Enabled wallet families, once each, in their stored order. */
140
+ declare const walletSignInNetworksSchema: z.ZodPipe<z.ZodArray<z.ZodEnum<{
141
+ solana: "solana";
142
+ eip155: "eip155";
143
+ cosmos: "cosmos";
144
+ }>>, z.ZodTransform<("solana" | "eip155" | "cosmos")[], ("solana" | "eip155" | "cosmos")[]>>;
145
+ /** The sign-in setting a wallet account falls under: its chain family. */
146
+ declare function walletSignInNetwork(wallet: Pick<LinkedWallet, "chain" | "network">): WalletSignInNetwork;
147
+ /**
148
+ * The CAIP-10 account ID of a wallet on one network. Linked Solana and EVM wallets are
149
+ * chain-agnostic, so pass the network you mean; the defaults are Solana mainnet and Ethereum
150
+ * (`eip155:1`). A Cosmos wallet always uses the network it was linked on.
151
+ */
152
+ declare function caip10(wallet: Pick<LinkedWallet, "chain" | "network" | "address">, network?: string): string;
153
+ /** An EVM chain's CAIP-2 ID: `eip155:` and the chain ID in decimal, such as `"eip155:8453"` (Base). */
154
+ type EvmChainId = `eip155:${number}`;
155
+ /**
156
+ * Whether `value` is an EVM CAIP-2 ID in canonical form (no leading zeros, at most 16 digits).
157
+ * Syntax only: the chains Relay reads balances on are the platform's to list
158
+ * (`management.walletBalanceChains()`).
159
+ */
160
+ declare function isEvmChainId(value: string): value is EvmChainId;
161
+ /** {@link isEvmChainId} as a schema. */
162
+ declare const evmChainIdSchema: z.ZodCustom<`eip155:${number}`, `eip155:${number}`>;
163
+ /** What `ctx.wallet.balance()` reads. Omit `token` for a Solana or EVM native coin. */
164
+ type WalletBalanceQuery = {
165
+ /** Solana mainnet: `"solana"` or its CAIP-2 ID. */
166
+ chain: "solana" | typeof solanaMainnet;
167
+ /** An SPL or Token-2022 mint address (base58). */
168
+ token?: string;
169
+ /** One of the member's linked Solana wallets; omit to read all of them. */
170
+ address?: string;
171
+ } | {
172
+ /**
173
+ * An EVM chain's CAIP-2 ID, such as `"eip155:8453"` for Base. The platform reads the chains
174
+ * `management.walletBalanceChains()` lists, and fails the evaluation on any other.
175
+ */
176
+ chain: EvmChainId;
177
+ /** An ERC-20 contract address. */
178
+ token?: `0x${string}`;
179
+ /** One of the member's linked EVM wallets; omit to read all of them. */
180
+ address?: string;
181
+ } | {
182
+ /** A Cosmos SDK chain's CAIP-2 ID. Relay reads the chains its management API lists. */
183
+ chain: CosmosNetwork;
184
+ /** The bank denomination to read, such as `uatom` or `uosmo`. */
185
+ token: CosmosDenom;
186
+ /** One of the member's wallets linked on this exact Cosmos network; omit to read all. */
187
+ address?: string;
188
+ };
189
+ /** A balance read for the member's pinned linked wallets, in raw integer units. */
190
+ declare const walletBalanceSchema: z.ZodObject<{
191
+ chain: z.ZodString;
192
+ token: z.ZodNullable<z.ZodString>;
193
+ decimals: z.ZodNullable<z.ZodNumber>;
194
+ total: z.ZodString;
195
+ wallets: z.ZodArray<z.ZodObject<{
196
+ address: z.ZodString;
197
+ amount: z.ZodString;
198
+ }, z.core.$strict>>;
199
+ at: z.ZodObject<{
200
+ kind: z.ZodEnum<{
201
+ slot: "slot";
202
+ block: "block";
203
+ }>;
204
+ number: z.ZodString;
205
+ }, z.core.$strict>;
206
+ observedAt: z.ZodNumber;
207
+ }, z.core.$strict>;
208
+ type WalletBalance = z.infer<typeof walletBalanceSchema>;
209
+ /**
210
+ * Reads the wallets the member has linked to this project. They are pinned once per attempt, at
211
+ * its first wallet read: later links and unlinks do not change the attempt. Every method resolves
212
+ * to `null` when the member has no linked wallet it can read, so a non-null list is never empty
213
+ * and a non-null balance covers at least one wallet. Provider failures throw `CapabilityError`
214
+ * with code `"provider-unavailable"`; they never read as a zero balance.
215
+ */
216
+ interface WalletReader {
217
+ /** Every wallet the member has linked to this project, newest first within each chain. */
218
+ list(): Promise<LinkedWallet[] | null>;
219
+ /**
220
+ * The native or token balance of the member's linked wallets on one chain: all wallets of that
221
+ * family (or exact Cosmos network), or `address`. Null when the member has no linked wallet it
222
+ * can read. A chain Relay does not read, a malformed token, and an `address` the member never
223
+ * linked throw `CapabilityError` with code `"author-error"`.
224
+ */
225
+ balance(query: WalletBalanceQuery): Promise<WalletBalance | null>;
226
+ }
227
+
228
+ export { walletChainSchema as A, walletMessageChallengeSchema as B, type CosmosChain as C, walletSignInFamilies as D, type EvmChainId as E, walletSignInNetwork as F, walletSignInNetworkSchema as G, walletSignInNetworksSchema as H, walletSignatureSchema as I, walletUnlinkInputSchema as J, type LinkedWallet as L, type WalletAddressInput as W, type CosmosNetwork as a, type WalletChain as b, type WalletMessageChallenge as c, type WalletSignInNetwork as d, type WalletSignature as e, type WalletSigner as f, type WalletUnlinkInput as g, type CosmosDenom as h, WALLETS_PER_CHAIN as i, type WalletBalance as j, type WalletBalanceQuery as k, type WalletReader as l, caip10 as m, cosmosAddressSchema as n, cosmosChain as o, cosmosDenomSchema as p, cosmosNetworkSchema as q, evmAddressSchema as r, evmChainIdSchema as s, isEvmChainId as t, linkedWalletSchema as u, solanaAddressSchema as v, solanaMainnet as w, walletAddressInput as x, walletAddressInputSchema as y, walletBalanceSchema as z };