@domino-sdk/relay 1.55.0 → 1.59.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/{accounts-DRPENuZe.d.ts → accounts-CVonEkdb.d.ts} +18 -7
  3. package/dist/{attempt-captures-CxxO7DeD.d.ts → attempt-captures-DBj-rxak.d.ts} +1 -1
  4. package/dist/authoring.d.ts +306 -72
  5. package/dist/authoring.js +264 -9
  6. package/dist/{automatic-outcomes-DxW_v5Wc.d.ts → automatic-outcomes-FS9okvBP.d.ts} +1 -1
  7. package/dist/avatar.d.ts +1 -2
  8. package/dist/browser.d.ts +8 -9
  9. package/dist/browser.js +10 -10
  10. package/dist/{capability-error-DSd8EMQC.d.ts → capability-error-DDJl0LY-.d.ts} +0 -6
  11. package/dist/{chunk-IZRITLVV.js → chunk-2LKGAL63.js} +2 -2
  12. package/dist/{chunk-GL43VQ5D.js → chunk-577DG2IT.js} +38 -8
  13. package/dist/{chunk-UY6KMLQG.js → chunk-6U5WWH3W.js} +141 -100
  14. package/dist/{chunk-YCOKTQ4E.js → chunk-AWWCEP7F.js} +1403 -882
  15. package/dist/{chunk-56DBFNR2.js → chunk-EQF4ID47.js} +1 -1
  16. package/dist/{chunk-YEVD4A5X.js → chunk-IBROKMFV.js} +2 -2
  17. package/dist/{chunk-XALIFNMD.js → chunk-KBCTII6C.js} +1 -1
  18. package/dist/{chunk-WHG5WE43.js → chunk-KYUQEZZA.js} +1 -1
  19. package/dist/{chunk-WUEQOKJH.js → chunk-LDLOB2UZ.js} +4 -4
  20. package/dist/{chunk-IUF7DW76.js → chunk-M2JQPDUX.js} +39 -9
  21. package/dist/{chunk-MLIXJPKL.js → chunk-MHPKEVEW.js} +1 -0
  22. package/dist/{chunk-TLK2MD4S.js → chunk-R4S6BFOH.js} +1 -1
  23. package/dist/{chunk-VFBQVY4X.js → chunk-TZJT5CRF.js} +1 -1
  24. package/dist/{chunk-C7QZ4UBB.js → chunk-UEMLYPKJ.js} +21 -5
  25. package/dist/{chunk-F6HECAXA.js → chunk-W42KMMH5.js} +140 -101
  26. package/dist/{chunk-WHMXXHPX.js → chunk-XGXDINGM.js} +16 -3
  27. package/dist/{chunk-SABMNPF2.js → chunk-YMWRLAAP.js} +1 -1
  28. package/dist/{chunk-YE3XYB2F.js → chunk-YRSU2X2P.js} +2 -2
  29. package/dist/{client-C4zUZKpj.d.ts → client-3b9HjSzZ.d.ts} +191 -117
  30. package/dist/{deployments-B32QS1CI.d.ts → deployments-BydFVj4Q.d.ts} +798 -235
  31. package/dist/{groups-O6onGPmC.d.ts → groups-CFuTfFqG.d.ts} +15 -9
  32. package/dist/index.d.ts +9 -10
  33. package/dist/index.js +9 -9
  34. package/dist/{integrations-C6_uUh-s.d.ts → integrations-DrbKQSTD.d.ts} +42 -22
  35. package/dist/internal.d.ts +10 -10
  36. package/dist/internal.js +9 -9
  37. package/dist/{offers-BMDNcvwB.d.ts → offers-DAfe1O3_.d.ts} +211 -2
  38. package/dist/{pages-BFloMpyQ.d.ts → pages-ChDVLrgR.d.ts} +95 -10
  39. package/dist/portal-proxy.js +4 -4
  40. package/dist/react/index.d.ts +149 -72
  41. package/dist/react/index.js +65 -10
  42. package/dist/runtime/authoring.js +1 -1
  43. package/dist/runtime/chunks/BG43KQ2T.js +1 -0
  44. package/dist/runtime/chunks/EWU4OKSY.js +62 -0
  45. package/dist/runtime/manifest.json +5 -5
  46. package/dist/runtime/schema.js +1 -1
  47. package/dist/runtime/zod.js +1 -1
  48. package/dist/{schema-C4m9RhCR.d.ts → schema-BA0nRRlt.d.ts} +184 -35
  49. package/dist/schema.d.ts +1265 -697
  50. package/dist/schema.js +96 -12
  51. package/dist/server/index.d.ts +10 -10
  52. package/dist/server/index.js +1644 -1105
  53. package/dist/{submission-input-BbdawqVy.d.ts → submission-input-DxQ6RnKo.d.ts} +2 -2
  54. package/dist/{telegram-browser-CwaxROAZ.d.ts → telegram-browser-o3OIxGrJ.d.ts} +3 -3
  55. package/dist/testing.d.ts +89 -9
  56. package/dist/testing.js +215 -10
  57. package/dist/{transport-CZJOW5Sr.d.ts → transport-D_Eqf78J.d.ts} +8592 -4384
  58. package/dist/wallet-B06zvDXp.d.ts +972 -0
  59. package/dist/{x-1czZFVUW.d.ts → x-C28SNifw.d.ts} +2 -2
  60. package/package.json +2 -2
  61. package/dist/profiles-BoOK03cR.d.ts +0 -299
  62. package/dist/runtime/chunks/IDOMZWRY.js +0 -40
  63. package/dist/runtime/chunks/WKATKZXE.js +0 -1
  64. package/dist/util.d-w9f9t3ua.d.ts +0 -5
  65. package/dist/wallet-Ac7OFpOr.d.ts +0 -228
@@ -1,6 +1,6 @@
1
1
  import * as z from 'zod';
2
- import { L as LedgerReference, D as QuestHandle } from './schema-C4m9RhCR.js';
3
- import { k as ProjectGroupReference } from './groups-O6onGPmC.js';
2
+ import { L as LedgerReference, x as QuestHandle } from './schema-BA0nRRlt.js';
3
+ import { k as ProjectGroupReference } from './groups-CFuTfFqG.js';
4
4
 
5
5
  declare const completionPrerequisiteSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6
6
  kind: z.ZodLiteral<"completion">;
@@ -1,7 +1,7 @@
1
- import { a as AuthProvider, b as TelegramSignInMethods } from './accounts-DRPENuZe.js';
2
- import { p as createRelayClient, k as RelayRequestOptions, g as RelayError } from './client-C4zUZKpj.js';
1
+ import { a as AuthProvider, b as TelegramSignInMethods } from './accounts-CVonEkdb.js';
2
+ import { p as createRelayClient, k as RelayRequestOptions, g as RelayError } from './client-3b9HjSzZ.js';
3
3
  import { b as ParticipantSession } from './participant-activity-iciCEs_8.js';
4
- import { C as CosmosChain, a as CosmosNetwork, f as WalletSigner, d as WalletSignInNetwork } from './wallet-Ac7OFpOr.js';
4
+ import { C as CosmosChain, a as CosmosNetwork, m as WalletSigner, k as WalletSignInNetwork } from './wallet-B06zvDXp.js';
5
5
 
6
6
  /** An EIP-1193 provider, such as `window.ethereum` or an EIP-6963 announcement's provider. */
7
7
  type Eip1193Provider = {
package/dist/testing.d.ts CHANGED
@@ -1,12 +1,11 @@
1
- import { bZ as memberIdentitySchema, c8 as pointBalanceSchema, dn as trackerQuerySchema, di as trackerPageSchema, dx as trackerSummarySchema, a_ as TrackerContentQuery, d3 as trackerContentSchema, c2 as photoResultSchema, a6 as TextReviewInput, R as Reward, a9 as Decision, aW as TrackerAttribution, N as Tracker, U as TrackerData, ae as ContentBody, a4 as TrackerTriggerContext, ak as TrackerPage } from './schema-C4m9RhCR.js';
1
+ import { c5 as memberIdentitySchema, cg as pointBalanceSchema, dw as trackerQuerySchema, dr as trackerPageSchema, dF as trackerSummarySchema, b1 as TrackerContentQuery, db as trackerContentSchema, ca as photoResultSchema, a7 as TextReviewInput, R as Reward, a9 as Decision, aZ as TrackerAttribution, U as Tracker, V as TrackerData, ae as ContentBody, a5 as TrackerTriggerContext, ak as TrackerPage } from './schema-BA0nRRlt.js';
2
2
  import * as z from 'zod';
3
- import { t as discordMemberSchema, w as discordMessageSchema, G as telegramChatMemberSchema } from './accounts-DRPENuZe.js';
4
- import { b as CapabilityFailure, h as memberCompletionSchema } from './capability-error-DSd8EMQC.js';
5
- export { C as CapabilityError } from './capability-error-DSd8EMQC.js';
6
- import { z as xConnectionSchema, C as xProfileSchema, B as xPostSchema, f as ImageReference, s as imageInspectionSchema, o as imageComparisonSchema, v as imageSightingsSchema } from './x-1czZFVUW.js';
7
- import { v as linkedWalletSchema, A as walletBalanceSchema } from './wallet-Ac7OFpOr.js';
8
- import { C as profileReferralSchema } from './profiles-BoOK03cR.js';
9
- export { A as AttemptCapture, C as CapturedFact } from './attempt-captures-CxxO7DeD.js';
3
+ import { u as discordMemberSchema, x as discordMessageSchema, H as telegramChatMemberSchema } from './accounts-CVonEkdb.js';
4
+ import { b as CapabilityFailure, h as memberCompletionSchema } from './capability-error-DDJl0LY-.js';
5
+ export { C as CapabilityError } from './capability-error-DDJl0LY-.js';
6
+ import { z as xConnectionSchema, C as xProfileSchema, B as xPostSchema, f as ImageReference, s as imageInspectionSchema, o as imageComparisonSchema, v as imageSightingsSchema } from './x-C28SNifw.js';
7
+ import { aO as profileReferralSchema, aE as linkedWalletSchema, aY as walletBalanceSchema, b2 as walletNftsSchema, K as WalletCallArgument, aZ as walletCallSchema, a$ as walletDelegationsSchema, T as WalletEventCondition, b0 as walletEventsSchema, b7 as walletTransactionsSchema } from './wallet-B06zvDXp.js';
8
+ export { A as AttemptCapture, C as CapturedFact } from './attempt-captures-DBj-rxak.js';
10
9
 
11
10
  /** One project time-zone change: from `effectiveAt` on, days are counted in `timeZone`. */
12
11
  type CalendarSegment = {
@@ -239,6 +238,46 @@ type WalletBalanceRequest = {
239
238
  token: string | null;
240
239
  address: string | null;
241
240
  };
241
+ /** An NFT query as Relay receives it: `address` is null to read every linked EVM wallet. */
242
+ type WalletNftsQueryRequest = {
243
+ collection: string;
244
+ address: string | null;
245
+ };
246
+ /** A contract call as Relay receives it: `args` is `[]` without arguments, `address` null to read every linked EVM wallet. */
247
+ type WalletCallQueryRequest = {
248
+ call: string;
249
+ args: WalletCallArgument[];
250
+ address: string | null;
251
+ };
252
+ /** A delegation read as Relay receives it: `validator` and `address` are null when omitted. */
253
+ type WalletDelegationsQueryRequest = {
254
+ chain: string;
255
+ validator: string | null;
256
+ address: string | null;
257
+ };
258
+ /**
259
+ * An event query as Relay receives it: `afterActivation` false, and `where` and `address` null,
260
+ * when the quest leaves them out.
261
+ */
262
+ type WalletEventsQueryRequest = {
263
+ event: string;
264
+ account: string;
265
+ since: number;
266
+ afterActivation: boolean;
267
+ where: Record<string, WalletEventCondition> | null;
268
+ address: string | null;
269
+ };
270
+ /**
271
+ * A transaction query as Relay receives it: `afterActivation` false, and `mint` and `address`
272
+ * null, when the quest leaves them out.
273
+ */
274
+ type WalletTransactionsQueryRequest = {
275
+ program: string;
276
+ since: number;
277
+ afterActivation: boolean;
278
+ mint: string | null;
279
+ address: string | null;
280
+ };
242
281
  /** A tracker read as Relay receives it: defaults applied, and `asOf` set (`eligibleAt` unless given). */
243
282
  type TrackerReadRequest = z.output<typeof trackerQuerySchema> & {
244
283
  asOf: number;
@@ -260,7 +299,8 @@ type TrackerFacts = {
260
299
  * `wallet`, `x`, `discord`, `telegram`, `trackers` (by tracker key), `images` and `review`.
261
300
  *
262
301
  * Reads of the member's own accounts default to a member who has linked nothing:
263
- * `member.identities()`, `wallet.list()`, `wallet.balance()`, `x.connection()`, `x.profile()`,
302
+ * `member.identities()`, `wallet.list()`, `wallet.balance()`, `wallet.nfts()`, `wallet.call()`,
303
+ * `wallet.delegations()`, `x.connection()`, `x.profile()`,
264
304
  * `x.follows()`, `x.reposted()`, `discord.member()` and `telegram.member()` resolve to null. Once the test links an
265
305
  * account (`wallet.list` or `x.connection` set to a value), supply every read of it the quest
266
306
  * makes. Every other read (the member's balances, completions, groups, campaigns and referrals, an
@@ -308,6 +348,46 @@ type TestFacts = {
308
348
  balance?: FakeAnswer<[
309
349
  query: WalletBalanceRequest
310
350
  ], Result<typeof walletBalanceSchema> | null>;
351
+ /**
352
+ * `ctx.wallet.nfts({ collection })`. Like `balance`, it reads null while the member has no
353
+ * linked wallet of the collection's family (EVM or Solana). A run's `calls` does not list NFT reads: its request type is closed in
354
+ * SDK 1.x.
355
+ */
356
+ nfts?: FakeAnswer<[
357
+ query: WalletNftsQueryRequest
358
+ ], Result<typeof walletNftsSchema> | null>;
359
+ /**
360
+ * `ctx.wallet.call({ call, args })`. Like `balance`, it reads null while the member has no
361
+ * linked EVM wallet. A run's `calls` does not list contract calls: its request type is closed
362
+ * in SDK 1.x.
363
+ */
364
+ call?: FakeAnswer<[
365
+ query: WalletCallQueryRequest
366
+ ], Result<typeof walletCallSchema> | null>;
367
+ /**
368
+ * `ctx.wallet.delegations({ chain, validator })`. Like `balance`, it reads null while the member
369
+ * has no wallet linked on that Cosmos network. A run's `calls` does not list delegation reads.
370
+ */
371
+ delegations?: FakeAnswer<[
372
+ query: WalletDelegationsQueryRequest
373
+ ], Result<typeof walletDelegationsSchema> | null>;
374
+ /**
375
+ * `ctx.wallet.events({ event, account, since })`. Like `balance`, it reads null while the
376
+ * member has no linked EVM wallet. The kit does not apply `where` or `since`: answer with the
377
+ * logs Relay would return. A run's `calls` does not list event reads.
378
+ */
379
+ events?: FakeAnswer<[
380
+ query: WalletEventsQueryRequest
381
+ ], Result<typeof walletEventsSchema> | null>;
382
+ /**
383
+ * `ctx.wallet.transactions({ program, since })`. Like `balance`, it reads null while the
384
+ * member has no linked Solana wallet. The kit does not apply `program`, `since` or `mint`:
385
+ * answer with the transactions Relay would return, with `instructions` when the program's
386
+ * setting has an Anchor IDL. A run's `calls` does not list transaction reads.
387
+ */
388
+ transactions?: FakeAnswer<[
389
+ query: WalletTransactionsQueryRequest
390
+ ], Result<typeof walletTransactionsSchema> | null>;
311
391
  };
312
392
  x?: {
313
393
  connection?: FakeAnswer<[], Result<typeof xConnectionSchema> | null>;
package/dist/testing.js CHANGED
@@ -1,27 +1,28 @@
1
1
  import {
2
2
  attemptCaptureSchema
3
- } from "./chunk-XALIFNMD.js";
3
+ } from "./chunk-KBCTII6C.js";
4
4
  import {
5
5
  CapabilityError
6
6
  } from "./chunk-4OC7REYX.js";
7
7
  import {
8
8
  parseImageResult
9
- } from "./chunk-YE3XYB2F.js";
9
+ } from "./chunk-YRSU2X2P.js";
10
10
  import {
11
11
  imageRequestSchema,
12
12
  xConnectionSchema,
13
13
  xPostSchema,
14
14
  xProfileSchema,
15
15
  xRequestSchema
16
- } from "./chunk-YEVD4A5X.js";
16
+ } from "./chunk-IBROKMFV.js";
17
17
  import {
18
18
  pointBalanceSchema,
19
19
  profileReferralSchema,
20
20
  telegramChatMemberSchema,
21
21
  telegramMemberInputSchema
22
- } from "./chunk-WHMXXHPX.js";
22
+ } from "./chunk-XGXDINGM.js";
23
23
  import {
24
24
  contentPerformanceSnapshotSchema,
25
+ cosmosAddressSchema,
25
26
  cosmosNetworkSchema,
26
27
  discordMemberInputSchema,
27
28
  discordMemberSchema,
@@ -29,6 +30,10 @@ import {
29
30
  discordMessageSchema,
30
31
  evmChainIdSchema,
31
32
  identifier,
33
+ isContractCall,
34
+ isContractEvent,
35
+ isNftCollection,
36
+ isSolanaProgram,
32
37
  linkedWalletSchema,
33
38
  maxMemberCompletions,
34
39
  memberCompletionSchema,
@@ -36,6 +41,7 @@ import {
36
41
  photoResultSchema,
37
42
  quizEvidenceSchema,
38
43
  rewardKey,
44
+ solanaAddressSchema,
39
45
  solanaMainnet,
40
46
  textEvidenceSchema,
41
47
  textResultSchema,
@@ -49,8 +55,13 @@ import {
49
55
  triggerSchema,
50
56
  urlEvidenceSchema,
51
57
  validateSubmissionValue,
52
- walletBalanceSchema
53
- } from "./chunk-YCOKTQ4E.js";
58
+ walletBalanceSchema,
59
+ walletCallSchema,
60
+ walletDelegationsSchema,
61
+ walletEventsSchema,
62
+ walletNftsSchema,
63
+ walletTransactionsSchema
64
+ } from "./chunk-AWWCEP7F.js";
54
65
 
55
66
  // src/testing/run.ts
56
67
  import * as z3 from "zod";
@@ -193,6 +204,55 @@ var telegramRequestSchema = z.strictObject({
193
204
  kind: z.literal("telegram"),
194
205
  input: telegramMemberInputSchema
195
206
  });
207
+ var walletNftsRequestSchema = z.strictObject({
208
+ kind: z.literal("wallet-nfts"),
209
+ collection: z.string().max(200).refine(isNftCollection),
210
+ address: z.string().min(1).max(100).nullable()
211
+ });
212
+ var walletEventConditionSchema = z.union([
213
+ z.string().min(1).max(200),
214
+ z.boolean(),
215
+ z.strictObject({ gte: z.string().regex(/^-?(0|[1-9][0-9]{0,77})$/) })
216
+ ]);
217
+ var walletEventsRequestSchema = z.strictObject({
218
+ kind: z.literal("wallet-events"),
219
+ event: z.string().max(1e3).refine(isContractEvent),
220
+ account: z.string().min(1).max(100),
221
+ since: z.number().int().nonnegative().safe(),
222
+ afterActivation: z.boolean(),
223
+ where: z.record(z.string().min(1).max(100), walletEventConditionSchema).refine((where) => Object.keys(where).length <= 10).nullable(),
224
+ address: z.string().min(1).max(100).nullable()
225
+ });
226
+ var walletTransactionsRequestSchema = z.strictObject({
227
+ kind: z.literal("wallet-transactions"),
228
+ program: z.string().max(44).refine(isSolanaProgram),
229
+ since: z.number().int().nonnegative().safe(),
230
+ afterActivation: z.boolean(),
231
+ mint: solanaAddressSchema.nullable(),
232
+ address: z.string().min(1).max(100).nullable()
233
+ });
234
+ var walletCallRequestSchema = z.strictObject({
235
+ kind: z.literal("wallet-call"),
236
+ call: z.string().max(400).refine(isContractCall),
237
+ args: z.array(
238
+ z.union([
239
+ z.strictObject({ wallet: z.literal(true) }),
240
+ z.string().max(1e3),
241
+ z.number().finite(),
242
+ z.boolean()
243
+ ])
244
+ ).max(16).refine(
245
+ (args) => args.filter((arg) => typeof arg === "object").length <= 1,
246
+ "Pass the member's wallet ({ wallet: true }) at most once"
247
+ ),
248
+ address: z.string().min(1).max(100).nullable()
249
+ });
250
+ var walletDelegationsRequestSchema = z.strictObject({
251
+ kind: z.literal("wallet-delegations"),
252
+ chain: cosmosNetworkSchema,
253
+ validator: cosmosAddressSchema.nullable(),
254
+ address: z.string().min(1).max(100).nullable()
255
+ });
196
256
  var memberStateRequestSchemas = {
197
257
  "member-balance": z.strictObject({
198
258
  kind: z.literal("member-balance"),
@@ -215,7 +275,7 @@ var memberStateRequestSchemas = {
215
275
  })
216
276
  };
217
277
  function unlistedRequest(request) {
218
- return request.kind === "telegram" || request.kind === "member-balance" || request.kind === "member-completions" || request.kind === "member-groups" || request.kind === "member-enrolled" || request.kind === "member-referrals";
278
+ return request.kind === "telegram" || request.kind === "wallet-nfts" || request.kind === "wallet-call" || request.kind === "wallet-delegations" || request.kind === "wallet-events" || request.kind === "wallet-transactions" || request.kind === "member-balance" || request.kind === "member-completions" || request.kind === "member-groups" || request.kind === "member-enrolled" || request.kind === "member-referrals";
219
279
  }
220
280
  var capabilityRequestSchema = z.discriminatedUnion("kind", [
221
281
  capabilityRequestSchemas["wallet-balance"],
@@ -230,6 +290,11 @@ var capabilityRequestSchema = z.discriminatedUnion("kind", [
230
290
  capabilityRequestSchemas["wallet-list"],
231
291
  capabilityRequestSchemas["member-identities"],
232
292
  telegramRequestSchema,
293
+ walletNftsRequestSchema,
294
+ walletCallRequestSchema,
295
+ walletDelegationsRequestSchema,
296
+ walletEventsRequestSchema,
297
+ walletTransactionsRequestSchema,
233
298
  memberStateRequestSchemas["member-balance"],
234
299
  memberStateRequestSchemas["member-completions"],
235
300
  memberStateRequestSchemas["member-groups"],
@@ -278,6 +343,16 @@ function parseCapabilityResult(request, value) {
278
343
  return z.array(memberIdentitySchema).min(1).nullable().parse(value);
279
344
  case "telegram":
280
345
  return telegramChatMemberSchema.nullable().parse(value);
346
+ case "wallet-nfts":
347
+ return walletNftsSchema.nullable().parse(value);
348
+ case "wallet-call":
349
+ return walletCallSchema.nullable().parse(value);
350
+ case "wallet-delegations":
351
+ return walletDelegationsSchema.nullable().parse(value);
352
+ case "wallet-events":
353
+ return walletEventsSchema.nullable().parse(value);
354
+ case "wallet-transactions":
355
+ return walletTransactionsSchema.nullable().parse(value);
281
356
  case "member-balance":
282
357
  return pointBalanceSchema.parse(value);
283
358
  case "member-completions":
@@ -393,6 +468,40 @@ var readerFactories = {
393
468
  chain: query.chain === "solana" ? solanaMainnet : query.chain,
394
469
  token: query.token ?? null,
395
470
  address: query.address ?? null
471
+ }),
472
+ nfts: (query) => call({
473
+ kind: "wallet-nfts",
474
+ collection: query.collection,
475
+ address: query.address ?? null
476
+ }),
477
+ call: (query) => call({
478
+ kind: "wallet-call",
479
+ call: query.call,
480
+ args: query.args ?? [],
481
+ address: query.address ?? null
482
+ }),
483
+ delegations: (query) => call({
484
+ kind: "wallet-delegations",
485
+ chain: query.chain,
486
+ validator: query.validator ?? null,
487
+ address: query.address ?? null
488
+ }),
489
+ events: (query) => call({
490
+ kind: "wallet-events",
491
+ event: query.event,
492
+ account: query.account,
493
+ since: query.since,
494
+ afterActivation: query.afterActivation ?? false,
495
+ where: query.where ?? null,
496
+ address: query.address ?? null
497
+ }),
498
+ transactions: (query) => call({
499
+ kind: "wallet-transactions",
500
+ program: query.program,
501
+ since: query.since,
502
+ afterActivation: query.afterActivation ?? false,
503
+ mint: query.mint ?? null,
504
+ address: query.address ?? null
396
505
  })
397
506
  })
398
507
  };
@@ -630,6 +739,46 @@ function fakeFor(facts, request) {
630
739
  args: [{ chain, token, address }]
631
740
  };
632
741
  }
742
+ case "wallet-nfts": {
743
+ const { collection, address } = request;
744
+ return {
745
+ name: "wallet.nfts",
746
+ answer: facts.wallet?.nfts,
747
+ args: [{ collection, address }]
748
+ };
749
+ }
750
+ case "wallet-call": {
751
+ const { call, args, address } = request;
752
+ return {
753
+ name: "wallet.call",
754
+ answer: facts.wallet?.call,
755
+ args: [{ call, args, address }]
756
+ };
757
+ }
758
+ case "wallet-delegations": {
759
+ const { chain, validator, address } = request;
760
+ return {
761
+ name: "wallet.delegations",
762
+ answer: facts.wallet?.delegations,
763
+ args: [{ chain, validator, address }]
764
+ };
765
+ }
766
+ case "wallet-events": {
767
+ const { kind: _, ...query } = request;
768
+ return {
769
+ name: "wallet.events",
770
+ answer: facts.wallet?.events,
771
+ args: [query]
772
+ };
773
+ }
774
+ case "wallet-transactions": {
775
+ const { kind: _, ...query } = request;
776
+ return {
777
+ name: "wallet.transactions",
778
+ answer: facts.wallet?.transactions,
779
+ args: [query]
780
+ };
781
+ }
633
782
  case "x": {
634
783
  const { operation, ...input } = request.input;
635
784
  return {
@@ -884,6 +1033,51 @@ function factsAnswerer(facts) {
884
1033
  }
885
1034
  return wallets.length ? ask(fake) : { value: null };
886
1035
  }
1036
+ case "wallet-nfts":
1037
+ case "wallet-call":
1038
+ case "wallet-delegations": {
1039
+ const pinned = await pin(walletList);
1040
+ if ("error" in pinned) {
1041
+ return pinned;
1042
+ }
1043
+ const chain = request.kind === "wallet-nfts" ? request.collection.split("/")[0] : request.kind === "wallet-call" ? request.call.split(":").slice(0, 2).join(":") : request.chain;
1044
+ const wallets = (pinned.value ?? []).filter(
1045
+ (wallet) => covers(wallet, chain)
1046
+ );
1047
+ const { address } = request;
1048
+ if (address !== null && !wallets.some((wallet) => sameAddress(wallet.address, address, chain))) {
1049
+ return failure(
1050
+ "author-error",
1051
+ "Read only the member's linked wallets"
1052
+ );
1053
+ }
1054
+ if (pinned.value === null) {
1055
+ return own(fake, null, "wallet.list");
1056
+ }
1057
+ return wallets.length ? ask(fake) : { value: null };
1058
+ }
1059
+ case "wallet-events":
1060
+ case "wallet-transactions": {
1061
+ const pinned = await pin(walletList);
1062
+ if ("error" in pinned) {
1063
+ return pinned;
1064
+ }
1065
+ const chain = request.kind === "wallet-events" ? request.event.split(":").slice(0, 2).join(":") : solanaMainnet;
1066
+ const wallets = (pinned.value ?? []).filter(
1067
+ (wallet) => covers(wallet, chain)
1068
+ );
1069
+ const { address } = request;
1070
+ if (address !== null && !wallets.some((wallet) => sameAddress(wallet.address, address, chain))) {
1071
+ return failure(
1072
+ "author-error",
1073
+ "Read only the member's linked wallets"
1074
+ );
1075
+ }
1076
+ if (pinned.value === null) {
1077
+ return own(fake, null, "wallet.list");
1078
+ }
1079
+ return wallets.length ? ask(fake) : { value: null };
1080
+ }
887
1081
  case "discord":
888
1082
  return "channelId" in request.input || fake.answer !== void 0 ? ask(fake) : { value: null };
889
1083
  // Without an answer, the member has not linked Telegram.
@@ -1380,7 +1574,7 @@ function expectProgress(run, reason) {
1380
1574
  }
1381
1575
 
1382
1576
  // src/testing/trackers.ts
1383
- function record(input, source) {
1577
+ function record2(input, source) {
1384
1578
  const occurredAt = time(input.occurredAt ?? defaultNow);
1385
1579
  const observedAt = time(input.observedAt ?? occurredAt);
1386
1580
  return {
@@ -1396,7 +1590,7 @@ function record(input, source) {
1396
1590
  }
1397
1591
  function trackerObservation(tracker, observation) {
1398
1592
  const member = observation.member ?? defaultMember;
1399
- const pinned = record(
1593
+ const pinned = record2(
1400
1594
  { ...observation, id: observation.id ?? "record_test" },
1401
1595
  tracker.source.kind
1402
1596
  );
@@ -1425,7 +1619,7 @@ function trackerPage(tracker, records, options = {}) {
1425
1619
  return trackerPageSchema.parse({
1426
1620
  tracker: key,
1427
1621
  items: records.map(
1428
- (item, index) => record({ ...item, id: item.id ?? `record_${index + 1}` }, source.kind)
1622
+ (item, index) => record2({ ...item, id: item.id ?? `record_${index + 1}` }, source.kind)
1429
1623
  ),
1430
1624
  nextCursor: options.nextCursor ?? null,
1431
1625
  total: options.total ?? records.length,
@@ -1492,6 +1686,17 @@ function captureAnswerer(facts, fallback, diverged) {
1492
1686
  if (!answerFallback) {
1493
1687
  const [reader, fact2] = {
1494
1688
  telegram: ["ctx.telegram.member()", "facts.telegram"],
1689
+ "wallet-nfts": ["ctx.wallet.nfts()", "facts.wallet.nfts"],
1690
+ "wallet-call": ["ctx.wallet.call()", "facts.wallet.call"],
1691
+ "wallet-delegations": [
1692
+ "ctx.wallet.delegations()",
1693
+ "facts.wallet.delegations"
1694
+ ],
1695
+ "wallet-events": ["ctx.wallet.events()", "facts.wallet.events"],
1696
+ "wallet-transactions": [
1697
+ "ctx.wallet.transactions()",
1698
+ "facts.wallet.transactions"
1699
+ ],
1495
1700
  "member-balance": ["ctx.member.balance()", "facts.member.balances"],
1496
1701
  "member-completions": [
1497
1702
  "ctx.member.completions()",