@domino-sdk/relay 1.56.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.
- package/CHANGELOG.md +74 -0
- package/dist/{accounts-DRPENuZe.d.ts → accounts-CVonEkdb.d.ts} +18 -7
- package/dist/{attempt-captures-CxxO7DeD.d.ts → attempt-captures-DBj-rxak.d.ts} +1 -1
- package/dist/authoring.d.ts +180 -28
- package/dist/authoring.js +236 -11
- package/dist/{automatic-outcomes-DxW_v5Wc.d.ts → automatic-outcomes-FS9okvBP.d.ts} +1 -1
- package/dist/avatar.d.ts +1 -2
- package/dist/browser.d.ts +8 -9
- package/dist/browser.js +10 -10
- package/dist/{capability-error-DSd8EMQC.d.ts → capability-error-DDJl0LY-.d.ts} +0 -6
- package/dist/{chunk-OTITLABX.js → chunk-2LKGAL63.js} +2 -2
- package/dist/{chunk-NK6EER33.js → chunk-577DG2IT.js} +8 -8
- package/dist/{chunk-RBPMT53S.js → chunk-6U5WWH3W.js} +19 -4
- package/dist/{chunk-BHHUSBSD.js → chunk-AWWCEP7F.js} +1402 -881
- package/dist/{chunk-QNQNKIAA.js → chunk-EQF4ID47.js} +1 -1
- package/dist/{chunk-CK7HO32Z.js → chunk-IBROKMFV.js} +2 -2
- package/dist/{chunk-MNU6UPXY.js → chunk-KBCTII6C.js} +1 -1
- package/dist/{chunk-INSWI2VZ.js → chunk-KYUQEZZA.js} +1 -1
- package/dist/{chunk-G6XVBYH7.js → chunk-LDLOB2UZ.js} +4 -4
- package/dist/{chunk-CXKXPB7K.js → chunk-M2JQPDUX.js} +34 -9
- package/dist/{chunk-KBVH4XZC.js → chunk-R4S6BFOH.js} +1 -1
- package/dist/{chunk-ABJ4G47X.js → chunk-TZJT5CRF.js} +1 -1
- package/dist/{chunk-BJYMTCWG.js → chunk-UEMLYPKJ.js} +7 -4
- package/dist/{chunk-ULQU7KC4.js → chunk-W42KMMH5.js} +1 -5
- package/dist/{chunk-VSHV7FEA.js → chunk-XGXDINGM.js} +16 -3
- package/dist/{chunk-H2MD6E7Z.js → chunk-YMWRLAAP.js} +1 -1
- package/dist/{chunk-W5U2WXG3.js → chunk-YRSU2X2P.js} +2 -2
- package/dist/{client-bX3oTpRu.d.ts → client-3b9HjSzZ.d.ts} +115 -116
- package/dist/{deployments-D3lxfQMB.d.ts → deployments-BydFVj4Q.d.ts} +314 -175
- package/dist/{groups-DPE004_V.d.ts → groups-CFuTfFqG.d.ts} +11 -7
- package/dist/index.d.ts +9 -10
- package/dist/index.js +9 -9
- package/dist/{integrations-CcD5NPEA.d.ts → integrations-DrbKQSTD.d.ts} +3 -32
- package/dist/internal.d.ts +10 -10
- package/dist/internal.js +8 -8
- package/dist/{offers-CtzMeB7O.d.ts → offers-DAfe1O3_.d.ts} +6 -2
- package/dist/{pages-BlLqB8ZQ.d.ts → pages-ChDVLrgR.d.ts} +39 -10
- package/dist/portal-proxy.js +3 -3
- package/dist/react/index.d.ts +71 -72
- package/dist/react/index.js +10 -10
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/BG43KQ2T.js +1 -0
- package/dist/runtime/chunks/EWU4OKSY.js +62 -0
- package/dist/runtime/manifest.json +5 -5
- package/dist/runtime/schema.js +1 -1
- package/dist/runtime/zod.js +1 -1
- package/dist/{schema-C4m9RhCR.d.ts → schema-BA0nRRlt.d.ts} +184 -35
- package/dist/schema.d.ts +754 -432
- package/dist/schema.js +77 -13
- package/dist/server/index.d.ts +10 -10
- package/dist/server/index.js +434 -55
- package/dist/{submission-input-wTiYGdgA.d.ts → submission-input-DxQ6RnKo.d.ts} +2 -2
- package/dist/{telegram-browser-Bh3i0HiH.d.ts → telegram-browser-o3OIxGrJ.d.ts} +3 -3
- package/dist/testing.d.ts +89 -9
- package/dist/testing.js +215 -10
- package/dist/{transport-CnKA-_RL.d.ts → transport-D_Eqf78J.d.ts} +3997 -2030
- package/dist/wallet-B06zvDXp.d.ts +972 -0
- package/dist/{x-1czZFVUW.d.ts → x-C28SNifw.d.ts} +2 -2
- package/package.json +2 -2
- package/dist/profiles-BoOK03cR.d.ts +0 -299
- package/dist/runtime/chunks/IDOMZWRY.js +0 -40
- package/dist/runtime/chunks/NDB42VFF.js +0 -1
- package/dist/util.d-w9f9t3ua.d.ts +0 -5
- package/dist/wallet-Ac7OFpOr.d.ts +0 -228
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
import { L as LedgerReference,
|
|
3
|
-
import { k as ProjectGroupReference } from './groups-
|
|
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-
|
|
2
|
-
import { p as createRelayClient, k as RelayRequestOptions, g as RelayError } from './client-
|
|
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,
|
|
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 {
|
|
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 {
|
|
4
|
-
import { b as CapabilityFailure, h as memberCompletionSchema } from './capability-error-
|
|
5
|
-
export { C as CapabilityError } from './capability-error-
|
|
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-
|
|
7
|
-
import {
|
|
8
|
-
|
|
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()`, `
|
|
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-
|
|
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-
|
|
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-
|
|
16
|
+
} from "./chunk-IBROKMFV.js";
|
|
17
17
|
import {
|
|
18
18
|
pointBalanceSchema,
|
|
19
19
|
profileReferralSchema,
|
|
20
20
|
telegramChatMemberSchema,
|
|
21
21
|
telegramMemberInputSchema
|
|
22
|
-
} from "./chunk-
|
|
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
|
-
|
|
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
|
|
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 =
|
|
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) =>
|
|
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()",
|