@domino-sdk/relay 1.67.0 → 1.68.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 +43 -0
- package/dist/{accounts-C2O8mpB8.d.ts → accounts-DnpKoJCo.d.ts} +210 -3
- package/dist/{attempt-captures-ClHAoo_n.d.ts → attempt-captures-DMNFMYFb.d.ts} +9 -1
- package/dist/authoring.d.ts +349 -38
- package/dist/authoring.js +125 -18
- package/dist/{automatic-outcomes-BEnPn4Uh.d.ts → automatic-outcomes-CQ3vpiQl.d.ts} +2 -2
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +10 -9
- package/dist/browser.js +12 -13
- package/dist/{catalog-CbiftcxQ.d.ts → catalog-BLGie8Lh.d.ts} +60 -2
- package/dist/chunk-4JSPMFO2.js +427 -0
- package/dist/{chunk-5DZNMLDM.js → chunk-55WJVFWC.js} +2 -2
- package/dist/{chunk-Q5QVAF7R.js → chunk-5AKD4ZF3.js} +37 -25
- package/dist/{chunk-DSJ46QLB.js → chunk-6UBFSMCM.js} +1 -1
- package/dist/{chunk-P33ZAJMS.js → chunk-6YTSRWRB.js} +1199 -677
- package/dist/{chunk-RDUSFUXX.js → chunk-75KF633N.js} +9 -1
- package/dist/{chunk-Q6KTTVOI.js → chunk-7YSVZA7A.js} +1 -1
- package/dist/{chunk-BMJHFWVT.js → chunk-CZ7NQ7W7.js} +10 -43
- package/dist/{chunk-X3FMVRMM.js → chunk-DDJN2T5A.js} +1 -1
- package/dist/{chunk-KUNPCDN6.js → chunk-DNPDR4Z7.js} +16 -9
- package/dist/{chunk-RWR2LOPA.js → chunk-EXZVWQOQ.js} +2 -2
- package/dist/{chunk-MVQQDPQX.js → chunk-HXTKI34N.js} +14 -2
- package/dist/{chunk-FGXLXENM.js → chunk-IW46TW3A.js} +21 -1
- package/dist/{chunk-5SBA6X5X.js → chunk-KKHENO57.js} +2 -2
- package/dist/{chunk-U66GUVSG.js → chunk-LZXDYSUH.js} +2 -0
- package/dist/{chunk-QYC3CZVD.js → chunk-MEUAJIVO.js} +2 -2
- package/dist/{chunk-BQXRCJ3N.js → chunk-P4TPW4SY.js} +1 -1
- package/dist/{chunk-NRMQVK2W.js → chunk-R3MNZKNJ.js} +1 -1
- package/dist/{chunk-Z2Z5DBNW.js → chunk-SD74HD75.js} +45 -9
- package/dist/{chunk-JK3XV2CR.js → chunk-TYZFVL73.js} +50 -8
- package/dist/chunk-VAGGGB6B.js +87 -0
- package/dist/{chunk-2HHZV7U3.js → chunk-VRZZB7CQ.js} +1 -1
- package/dist/{client-CZPewB9h.d.ts → client-BMif22WQ.d.ts} +133 -7
- package/dist/{dashboards-jGPM3AxF.d.ts → dashboards-DMk-vL1q.d.ts} +4 -4
- package/dist/{deployments-BVFd7ddA.d.ts → deployments-BCr418BX.d.ts} +582 -173
- package/dist/{identity-integration-W1Vo3Ql9.d.ts → identity-integration-r76xaAax.d.ts} +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/internal.d.ts +137 -14
- package/dist/internal.js +240 -19
- package/dist/{limits-C4RzrOV4.d.ts → limits-ByVRQePO.d.ts} +6 -1
- package/dist/{offers-BpYenB9i.d.ts → offers-xcPbYaEv.d.ts} +2 -2
- package/dist/portal-proxy.d.ts +2 -2
- package/dist/portal-proxy.js +11 -11
- package/dist/react/index.d.ts +37 -15
- package/dist/react/index.js +12 -13
- package/dist/{reward-deliveries-BOWpMytr.d.ts → reward-deliveries-0VvT6LMj.d.ts} +1 -1
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/2UDZ6TPL.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/schema.d.ts +398 -104
- package/dist/schema.js +62 -8
- package/dist/server/index.d.ts +12 -12
- package/dist/server/index.js +2046 -886
- package/dist/{sign-in-providers-BRYVOSlG.d.ts → sign-in-providers-C5_753DZ.d.ts} +2 -2
- package/dist/solana.d.ts +171 -0
- package/dist/solana.js +364 -0
- package/dist/{submission-input-C152xIdn.d.ts → submission-input-CaL8drIh.d.ts} +2 -2
- package/dist/{telegram-browser-657QqiQl.d.ts → telegram-browser-DLtHPRBI.d.ts} +6 -108
- package/dist/telegram.d.ts +8 -8
- package/dist/telegram.js +2 -2
- package/dist/testing.d.ts +85 -13
- package/dist/testing.js +101 -11
- package/dist/{tracker-data-BqY-9Vu-.d.ts → tracker-data-CAK942sx.d.ts} +298 -1
- package/dist/{transport-CthYgZXK.d.ts → transport-CkidqTOk.d.ts} +5250 -1226
- package/dist/{wallet-Btng186v.d.ts → wallet-DQtJelQQ.d.ts} +367 -13
- package/dist/wallet-browser-dpmr22Xv.d.ts +106 -0
- package/package.json +16 -1
- package/dist/chunk-UWUS4OOV.js +0 -59
- package/dist/chunk-UYVJZR33.js +0 -34
- package/dist/runtime/chunks/C2MGLQXC.js +0 -1
|
@@ -2,13 +2,14 @@ import {
|
|
|
2
2
|
capabilityFailureSchema
|
|
3
3
|
} from "./chunk-MWMCQLCG.js";
|
|
4
4
|
import {
|
|
5
|
+
attemptActionSchema,
|
|
5
6
|
contentPerformanceSnapshotSchema,
|
|
6
7
|
decisionSchema,
|
|
7
8
|
identifier,
|
|
8
9
|
rewardBundleSchema,
|
|
9
10
|
settingsValuesSchema,
|
|
10
11
|
trackerTriggerContextSchema
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6YTSRWRB.js";
|
|
12
13
|
|
|
13
14
|
// src/server/attempt-captures.ts
|
|
14
15
|
import * as z from "zod";
|
|
@@ -57,6 +58,13 @@ var attemptCaptureSchema = /* @__PURE__ */ (() => z.object({
|
|
|
57
58
|
member: identifier,
|
|
58
59
|
input: z.record(z.string(), z.json()),
|
|
59
60
|
tracker: trackerTriggerContextSchema.nullable(),
|
|
61
|
+
/**
|
|
62
|
+
* The action that started the attempt, `ctx.action`. Absent from captures Relay made before it
|
|
63
|
+
* recorded actions.
|
|
64
|
+
*
|
|
65
|
+
* @experimental A minor release can change quest actions.
|
|
66
|
+
*/
|
|
67
|
+
action: attemptActionSchema.nullable().optional(),
|
|
60
68
|
eligibleAt: timestamp,
|
|
61
69
|
calendar: z.object({
|
|
62
70
|
segments: z.array(
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SD74HD75.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
connectSolanaAccount,
|
|
6
|
+
noAccount,
|
|
7
|
+
registeredWallets
|
|
8
|
+
} from "./chunk-VAGGGB6B.js";
|
|
7
9
|
import {
|
|
10
|
+
base58,
|
|
8
11
|
cosmosChain
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6YTSRWRB.js";
|
|
10
13
|
import {
|
|
11
14
|
RelayErrorCode,
|
|
12
15
|
asRelayError,
|
|
13
16
|
clientError
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IW46TW3A.js";
|
|
15
18
|
|
|
16
19
|
// src/wallet-browser.ts
|
|
17
20
|
function injected() {
|
|
@@ -27,7 +30,6 @@ function utf8Hex(message) {
|
|
|
27
30
|
}
|
|
28
31
|
return hex;
|
|
29
32
|
}
|
|
30
|
-
var noAccount = "The wallet didn't share an account. Unlock it and try again.";
|
|
31
33
|
function evmSigner(provider, info = {}) {
|
|
32
34
|
return {
|
|
33
35
|
chain: "eip155",
|
|
@@ -128,14 +130,7 @@ function walletStandardSolanaSigner(wallet) {
|
|
|
128
130
|
chain: "solana",
|
|
129
131
|
name: wallet.name,
|
|
130
132
|
async address() {
|
|
131
|
-
|
|
132
|
-
const available = accounts.length ? accounts : wallet.accounts;
|
|
133
|
-
connected = available.find(
|
|
134
|
-
(account) => account.chains.some((chain) => chain.startsWith("solana:"))
|
|
135
|
-
) ?? available[0];
|
|
136
|
-
if (!connected) {
|
|
137
|
-
throw new Error(noAccount);
|
|
138
|
-
}
|
|
133
|
+
connected = await connectSolanaAccount(wallet);
|
|
139
134
|
return connected.address;
|
|
140
135
|
},
|
|
141
136
|
async sign(message, address) {
|
|
@@ -251,35 +246,7 @@ function discoverSolanaWallets() {
|
|
|
251
246
|
if (!target) {
|
|
252
247
|
return [];
|
|
253
248
|
}
|
|
254
|
-
const standard =
|
|
255
|
-
const api = {
|
|
256
|
-
register(...wallets2) {
|
|
257
|
-
for (const wallet of wallets2) {
|
|
258
|
-
if (!standard.includes(wallet)) {
|
|
259
|
-
standard.push(wallet);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return () => {
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
const registered = (event) => {
|
|
267
|
-
const callback = event.detail;
|
|
268
|
-
if (typeof callback === "function") {
|
|
269
|
-
try {
|
|
270
|
-
callback(api);
|
|
271
|
-
} catch {
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
target.addEventListener("wallet-standard:register-wallet", registered);
|
|
276
|
-
try {
|
|
277
|
-
target.dispatchEvent(
|
|
278
|
-
new CustomEvent("wallet-standard:app-ready", { detail: api })
|
|
279
|
-
);
|
|
280
|
-
} finally {
|
|
281
|
-
target.removeEventListener("wallet-standard:register-wallet", registered);
|
|
282
|
-
}
|
|
249
|
+
const standard = registeredWallets(target);
|
|
283
250
|
const wallets = [];
|
|
284
251
|
const seen = /* @__PURE__ */ new Set();
|
|
285
252
|
function add(name, signer, icon) {
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
imageSightingsSchema,
|
|
7
7
|
imageUploadsSchema,
|
|
8
8
|
publishedImageSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DDJN2T5A.js";
|
|
10
10
|
import {
|
|
11
11
|
dashboardArtifactSchema,
|
|
12
12
|
dashboardIssue,
|
|
13
13
|
dashboardPreviewSchema,
|
|
14
14
|
normalizeDashboard
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MEUAJIVO.js";
|
|
16
16
|
import {
|
|
17
17
|
authProvidersSchema,
|
|
18
18
|
collectionPassSchema,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
questOutcomePageSchema,
|
|
24
24
|
questOutcomeSchema,
|
|
25
25
|
rewardDeliveriesSchema
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-R3MNZKNJ.js";
|
|
27
27
|
import {
|
|
28
28
|
catalogDeploymentSchema,
|
|
29
29
|
collectionViewSchema,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
questExperienceSchema,
|
|
38
38
|
questTypeVersionSchema,
|
|
39
39
|
questViewSchema
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-6UBFSMCM.js";
|
|
41
41
|
import {
|
|
42
42
|
engagementArtifactSchema,
|
|
43
43
|
engagementBoundaryPageSchema,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
referralDefinitionSchema,
|
|
53
53
|
referralHistorySchema,
|
|
54
54
|
referralSummarySchema
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-55WJVFWC.js";
|
|
56
56
|
import {
|
|
57
57
|
accountConnectionSchema,
|
|
58
58
|
attemptSchema,
|
|
@@ -114,10 +114,13 @@ import {
|
|
|
114
114
|
walletEventsSchema,
|
|
115
115
|
walletMessageChallengeSchema,
|
|
116
116
|
walletNftsSchema,
|
|
117
|
+
walletProgramAccountSchema,
|
|
117
118
|
walletSignInNetworksSchema,
|
|
119
|
+
walletStakeSchema,
|
|
120
|
+
walletTransactionChallengeSchema,
|
|
118
121
|
walletTransactionsSchema,
|
|
119
122
|
whereSettings
|
|
120
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-6YTSRWRB.js";
|
|
121
124
|
|
|
122
125
|
// src/deployments.ts
|
|
123
126
|
import * as z from "zod";
|
|
@@ -288,7 +291,9 @@ var capabilityResponseTables = /* @__PURE__ */ (() => responseTables({
|
|
|
288
291
|
walletCallSchema: () => walletCallSchema,
|
|
289
292
|
walletDelegationsSchema: () => walletDelegationsSchema,
|
|
290
293
|
walletEventsSchema: () => walletEventsSchema,
|
|
291
|
-
walletTransactionsSchema: () => walletTransactionsSchema
|
|
294
|
+
walletTransactionsSchema: () => walletTransactionsSchema,
|
|
295
|
+
walletProgramAccountSchema: () => walletProgramAccountSchema,
|
|
296
|
+
walletStakeSchema: () => walletStakeSchema
|
|
292
297
|
}))();
|
|
293
298
|
var capabilityResponseSchemas = capabilityResponseTables.known;
|
|
294
299
|
var capabilityResponses = capabilityResponseTables.tolerant;
|
|
@@ -304,7 +309,8 @@ var activityTypes = {
|
|
|
304
309
|
reviewPending: "review.pending",
|
|
305
310
|
rewardDeliveryFailed: "reward.delivery.failed",
|
|
306
311
|
entitlementCollected: "entitlement.collected",
|
|
307
|
-
referralQualified: "referral.qualified"
|
|
312
|
+
referralQualified: "referral.qualified",
|
|
313
|
+
walletLinked: "wallet.linked"
|
|
308
314
|
};
|
|
309
315
|
var activityTypeSchema = /* @__PURE__ */ (() => z2.string().min(1).max(100))();
|
|
310
316
|
|
|
@@ -511,7 +517,8 @@ var participantResponseTables = /* @__PURE__ */ (() => responseTables({
|
|
|
511
517
|
rewardDeliveriesSchema: () => rewardDeliveriesSchema,
|
|
512
518
|
tieredRewardReferenceSchema: () => tieredRewardReferenceSchema,
|
|
513
519
|
walletMessageChallengeSchema: () => walletMessageChallengeSchema,
|
|
514
|
-
walletSignInNetworksSchema: () => walletSignInNetworksSchema
|
|
520
|
+
walletSignInNetworksSchema: () => walletSignInNetworksSchema,
|
|
521
|
+
walletTransactionChallengeSchema: () => walletTransactionChallengeSchema
|
|
515
522
|
}))();
|
|
516
523
|
var participantResponseSchemas = participantResponseTables.known;
|
|
517
524
|
var participantResponses = participantResponseTables.tolerant;
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
imageFieldsSchema,
|
|
5
5
|
imageInspectionSchema,
|
|
6
6
|
imageSightingsSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DDJN2T5A.js";
|
|
8
8
|
import {
|
|
9
9
|
photoResultSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6YTSRWRB.js";
|
|
11
11
|
|
|
12
12
|
// src/image-results.ts
|
|
13
13
|
import * as z from "zod";
|
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
discordMessageTextDataSchema,
|
|
4
4
|
discordReactionDataSchema,
|
|
5
5
|
isKnownTrackerSource,
|
|
6
|
+
takesSolanaTransaction,
|
|
6
7
|
trackerDataSchema,
|
|
7
8
|
xAccountRoles
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6YTSRWRB.js";
|
|
9
10
|
|
|
10
11
|
// src/quest-shape.ts
|
|
11
12
|
function validateQuestShape(description, options = {}) {
|
|
@@ -16,7 +17,8 @@ function validateQuestShape(description, options = {}) {
|
|
|
16
17
|
performance,
|
|
17
18
|
retryCooldownMs,
|
|
18
19
|
completionCooldownMs,
|
|
19
|
-
authorBudgets = []
|
|
20
|
+
authorBudgets = [],
|
|
21
|
+
stations
|
|
20
22
|
} = description;
|
|
21
23
|
const tracker = trigger.kind === "automatic" ? trigger.tracker : void 0;
|
|
22
24
|
const content = tracker?.content === true;
|
|
@@ -55,6 +57,16 @@ function validateQuestShape(description, options = {}) {
|
|
|
55
57
|
);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
60
|
+
if (stations && options.template) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
"Reusable quest types cannot declare check-in stations: declare them on a quest written in code"
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (stations && !takesSolanaTransaction(trigger)) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
"Stations are for quests a signed Solana transaction completes: a member-submitted manual() quest without input"
|
|
68
|
+
);
|
|
69
|
+
}
|
|
58
70
|
if (trigger.kind === "automatic" && !tracker) {
|
|
59
71
|
if (!options.template && requires.length === 0) {
|
|
60
72
|
throw new Error("Automatic quests need at least one prerequisite");
|
|
@@ -156,7 +156,27 @@ var RelayErrorCode = {
|
|
|
156
156
|
/** The wallet sign-in challenge expired, was used or changed; start sign-in again. */
|
|
157
157
|
ChallengeExpired: "challenge-expired",
|
|
158
158
|
/** Too many requests; `retryAfter` says how long to wait when Relay knows. */
|
|
159
|
-
RateLimited: "rate-limited"
|
|
159
|
+
RateLimited: "rate-limited",
|
|
160
|
+
/**
|
|
161
|
+
* `wallets.linkByTransaction`: the transaction is not finalized yet. Send the same signature
|
|
162
|
+
* again in a few seconds.
|
|
163
|
+
*
|
|
164
|
+
* @experimental A minor release can change linking by transaction.
|
|
165
|
+
*/
|
|
166
|
+
TransactionNotFinal: "transaction-not-final",
|
|
167
|
+
/** `wallets.linkByTransaction`: Solana mainnet has no transaction with this signature. @experimental */
|
|
168
|
+
TransactionNotFound: "transaction-not-found",
|
|
169
|
+
/** `wallets.linkByTransaction`: the transaction failed, so it proves nothing. @experimental */
|
|
170
|
+
TransactionFailed: "transaction-failed",
|
|
171
|
+
/**
|
|
172
|
+
* `wallets.linkByTransaction`: no memo in the transaction carries one of the member's open
|
|
173
|
+
* challenges for the address, with the address as signer.
|
|
174
|
+
*
|
|
175
|
+
* @experimental A minor release can change linking by transaction.
|
|
176
|
+
*/
|
|
177
|
+
ProofMismatch: "proof-mismatch",
|
|
178
|
+
/** `wallets.linkByTransaction`: another transaction already used the challenge. @experimental */
|
|
179
|
+
ChallengeUsed: "challenge-used"
|
|
160
180
|
};
|
|
161
181
|
var relayErrorBrand = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RelayError"))();
|
|
162
182
|
function isRelayError(value) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isRequestError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IW46TW3A.js";
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
6
|
var name = "@domino-sdk/relay";
|
|
7
|
-
var version = "1.
|
|
7
|
+
var version = "1.68.0";
|
|
8
8
|
|
|
9
9
|
// src/client-identity.ts
|
|
10
10
|
function clientIdentity() {
|
|
@@ -48,6 +48,8 @@ var participantRoutes = [
|
|
|
48
48
|
{ method: "GET", path: "/v1/me/wallets" },
|
|
49
49
|
{ method: "POST", path: "/v1/me/wallets/challenge" },
|
|
50
50
|
{ method: "POST", path: "/v1/me/wallets/verify" },
|
|
51
|
+
{ method: "POST", path: "/v1/me/wallets/transaction-challenge" },
|
|
52
|
+
{ method: "POST", path: "/v1/me/wallets/link-transaction" },
|
|
51
53
|
{ method: "POST", path: "/v1/me/wallets/unlink" },
|
|
52
54
|
// Profiles: the member's own, and the reads keyed by a public profile ID.
|
|
53
55
|
{ method: "GET", path: "/v1/me/profile" },
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
limits,
|
|
4
4
|
resourceHandle,
|
|
5
5
|
responseShape
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6YTSRWRB.js";
|
|
7
7
|
import {
|
|
8
8
|
parseDefinition
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IW46TW3A.js";
|
|
10
10
|
|
|
11
11
|
// src/server/analytics.ts
|
|
12
12
|
import * as z from "zod";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayAction,
|
|
3
3
|
withActionId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P4TPW4SY.js";
|
|
5
5
|
import {
|
|
6
6
|
setPluginTransport
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VRZZB7CQ.js";
|
|
8
8
|
import {
|
|
9
9
|
createHttpExchange,
|
|
10
10
|
untilAborted,
|
|
11
11
|
withQuery
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7YSVZA7A.js";
|
|
13
13
|
import {
|
|
14
14
|
PARTICIPANT_TIMEOUT,
|
|
15
15
|
lifetime,
|
|
16
16
|
retrying,
|
|
17
17
|
validTimeout
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-KKHENO57.js";
|
|
19
19
|
import {
|
|
20
20
|
authProvidersSchema,
|
|
21
21
|
collectionPassSchema,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
questOutcomeSchema,
|
|
35
35
|
rewardDeliveriesSchema,
|
|
36
36
|
rewardDeliveryQuerySchema
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-R3MNZKNJ.js";
|
|
38
38
|
import {
|
|
39
39
|
exchangeResultSchema,
|
|
40
40
|
exchangeSchema,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
participantSessionSchema,
|
|
45
45
|
questExperienceSchema,
|
|
46
46
|
sessionMember
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-6UBFSMCM.js";
|
|
48
48
|
import {
|
|
49
49
|
engagementBoundaryPageSchema,
|
|
50
50
|
engagementPageQuerySchema,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
referralDefinitionSchema,
|
|
56
56
|
referralHistorySchema,
|
|
57
57
|
referralSummarySchema
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-55WJVFWC.js";
|
|
59
59
|
import {
|
|
60
60
|
AVATAR_UPLOAD_LIMIT,
|
|
61
61
|
accountConnectionSchema,
|
|
@@ -110,8 +110,10 @@ import {
|
|
|
110
110
|
walletAddressInputSchema,
|
|
111
111
|
walletMessageChallengeSchema,
|
|
112
112
|
walletSignatureSchema,
|
|
113
|
+
walletTransactionChallengeSchema,
|
|
114
|
+
walletTransactionProofSchema,
|
|
113
115
|
walletUnlinkInputSchema
|
|
114
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-6YTSRWRB.js";
|
|
115
117
|
import {
|
|
116
118
|
RelayError,
|
|
117
119
|
RelayErrorCode,
|
|
@@ -119,7 +121,7 @@ import {
|
|
|
119
121
|
isRelayError,
|
|
120
122
|
isRequestError,
|
|
121
123
|
parseInput
|
|
122
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-IW46TW3A.js";
|
|
123
125
|
|
|
124
126
|
// src/legacy-submissions.ts
|
|
125
127
|
import * as z from "zod";
|
|
@@ -1820,6 +1822,40 @@ function relayClient(options) {
|
|
|
1820
1822
|
replaySafe: unusedChallengeExpires
|
|
1821
1823
|
}),
|
|
1822
1824
|
verify: async (value, requestOptions) => linkVerify(value, await bound(requestOptions)),
|
|
1825
|
+
/**
|
|
1826
|
+
* A challenge for linking a Solana account that cannot sign messages, such as a Squads vault:
|
|
1827
|
+
* the account executes a transaction with an SPL Memo instruction that carries `memo` and lists
|
|
1828
|
+
* the account, then `linkByTransaction` submits its signature. The challenge belongs to the
|
|
1829
|
+
* member, not the session, and lasts 7 days, since a multisig approval can take that long. A
|
|
1830
|
+
* repeat for the same address answers the open challenge.
|
|
1831
|
+
*
|
|
1832
|
+
* @experimental A minor release can change linking by transaction.
|
|
1833
|
+
*/
|
|
1834
|
+
transactionChallenge: async (value, requestOptions) => request(
|
|
1835
|
+
"/v1/me/wallets/transaction-challenge",
|
|
1836
|
+
walletTransactionChallengeSchema,
|
|
1837
|
+
{
|
|
1838
|
+
json: parseInput(walletAddressInputSchema, value),
|
|
1839
|
+
options: await bound(requestOptions),
|
|
1840
|
+
replaySafe: true
|
|
1841
|
+
}
|
|
1842
|
+
),
|
|
1843
|
+
/**
|
|
1844
|
+
* Links the account a finalized Solana mainnet transaction proves: it succeeded, and an SPL
|
|
1845
|
+
* Memo instruction in it, top-level or inner, carries an open challenge's `memo` and lists
|
|
1846
|
+
* the account. A transaction that is not final yet is refused with `transaction-not-final`;
|
|
1847
|
+
* try again shortly. Retrying the same signature answers the same wallet.
|
|
1848
|
+
*
|
|
1849
|
+
* @experimental A minor release can change linking by transaction.
|
|
1850
|
+
*/
|
|
1851
|
+
linkByTransaction: async (value, requestOptions) => {
|
|
1852
|
+
const proof = parseInput(walletTransactionProofSchema, value);
|
|
1853
|
+
return request("/v1/me/wallets/link-transaction", linkedWalletSchema, {
|
|
1854
|
+
json: proof,
|
|
1855
|
+
options: await bound(requestOptions),
|
|
1856
|
+
operationId: proof.signature
|
|
1857
|
+
});
|
|
1858
|
+
},
|
|
1823
1859
|
/** The address stays bound to this member: another member still cannot link it. */
|
|
1824
1860
|
unlink: async (wallet, requestOptions) => request("/v1/me/wallets/unlink", ok, {
|
|
1825
1861
|
json: parseInput(walletUnlinkInputSchema, {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
base58Bytes
|
|
3
|
-
} from "./chunk-UWUS4OOV.js";
|
|
4
1
|
import {
|
|
5
2
|
createHttpExchange,
|
|
6
3
|
uncertainStatuses
|
|
7
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7YSVZA7A.js";
|
|
8
5
|
import {
|
|
9
6
|
MANAGEMENT_TIMEOUT,
|
|
10
7
|
lifetime,
|
|
11
8
|
retrying,
|
|
12
9
|
validTimeout
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KKHENO57.js";
|
|
14
11
|
import {
|
|
12
|
+
base58Bytes,
|
|
15
13
|
evmAddressSchema,
|
|
16
|
-
knownResponse
|
|
17
|
-
|
|
14
|
+
knownResponse,
|
|
15
|
+
solanaDevnet,
|
|
16
|
+
solanaMainnet
|
|
17
|
+
} from "./chunk-6YTSRWRB.js";
|
|
18
18
|
import {
|
|
19
19
|
RequestError,
|
|
20
20
|
isRequestError
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-IW46TW3A.js";
|
|
22
22
|
|
|
23
23
|
// src/configuration.ts
|
|
24
24
|
function questConfiguration(release) {
|
|
@@ -116,6 +116,45 @@ async function walletSignatureValid(input) {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
// src/solana-rpc.ts
|
|
120
|
+
var solanaPublicEndpoints = {
|
|
121
|
+
[solanaMainnet]: "https://api.mainnet-beta.solana.com",
|
|
122
|
+
[solanaDevnet]: "https://api.devnet.solana.com"
|
|
123
|
+
};
|
|
124
|
+
async function solanaRpc(url, method, params) {
|
|
125
|
+
const response = await fetch(url, {
|
|
126
|
+
method: "POST",
|
|
127
|
+
headers: { "Content-Type": "application/json" },
|
|
128
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
|
|
129
|
+
signal: AbortSignal.timeout(3e4)
|
|
130
|
+
});
|
|
131
|
+
const answer = await response.json();
|
|
132
|
+
if (answer.error) {
|
|
133
|
+
throw new Error(answer.error.message ?? JSON.stringify(answer.error));
|
|
134
|
+
}
|
|
135
|
+
return answer.result;
|
|
136
|
+
}
|
|
137
|
+
async function confirmedSignature(url, signature, lastValidBlockHeight) {
|
|
138
|
+
for (; ; ) {
|
|
139
|
+
const {
|
|
140
|
+
value: [status]
|
|
141
|
+
} = await solanaRpc(url, "getSignatureStatuses", [[signature]]);
|
|
142
|
+
if (status?.err) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
if (status?.confirmationStatus === "confirmed" || status?.confirmationStatus === "finalized") {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
const height = await solanaRpc(url, "getBlockHeight", [
|
|
149
|
+
{ commitment: "confirmed" }
|
|
150
|
+
]);
|
|
151
|
+
if (height > lastValidBlockHeight) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
119
158
|
// src/server/errors.ts
|
|
120
159
|
import * as z from "zod";
|
|
121
160
|
var ManagementErrorCode = {
|
|
@@ -403,6 +442,9 @@ export {
|
|
|
403
442
|
hex,
|
|
404
443
|
canonicalWalletAddress,
|
|
405
444
|
walletSignatureValid,
|
|
445
|
+
solanaPublicEndpoints,
|
|
446
|
+
solanaRpc,
|
|
447
|
+
confirmedSignature,
|
|
406
448
|
ManagementErrorCode,
|
|
407
449
|
managementErrorSchema,
|
|
408
450
|
isManagementError,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/wallet-standard.ts
|
|
2
|
+
var noAccount = "The wallet didn't share an account. Unlock it and try again.";
|
|
3
|
+
function registeredWallets(target) {
|
|
4
|
+
const standard = [];
|
|
5
|
+
const api = {
|
|
6
|
+
register(...wallets) {
|
|
7
|
+
for (const wallet of wallets) {
|
|
8
|
+
if (!standard.includes(wallet)) {
|
|
9
|
+
standard.push(wallet);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return () => {
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const registered = (event) => {
|
|
17
|
+
const callback = event.detail;
|
|
18
|
+
if (typeof callback === "function") {
|
|
19
|
+
try {
|
|
20
|
+
callback(api);
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
target.addEventListener("wallet-standard:register-wallet", registered);
|
|
26
|
+
try {
|
|
27
|
+
target.dispatchEvent(
|
|
28
|
+
new CustomEvent("wallet-standard:app-ready", { detail: api })
|
|
29
|
+
);
|
|
30
|
+
} finally {
|
|
31
|
+
target.removeEventListener("wallet-standard:register-wallet", registered);
|
|
32
|
+
}
|
|
33
|
+
return standard;
|
|
34
|
+
}
|
|
35
|
+
async function connectSolanaAccount(wallet) {
|
|
36
|
+
const connect = wallet.features["standard:connect"];
|
|
37
|
+
if (!connect) {
|
|
38
|
+
throw new Error(`${wallet.name} doesn't support standard:connect.`);
|
|
39
|
+
}
|
|
40
|
+
const { accounts } = await connect.connect();
|
|
41
|
+
const available = accounts.length ? accounts : wallet.accounts;
|
|
42
|
+
const account = available.find(
|
|
43
|
+
(candidate) => candidate.chains.some((chain) => chain.startsWith("solana:"))
|
|
44
|
+
) ?? available[0];
|
|
45
|
+
if (!account) {
|
|
46
|
+
throw new Error(noAccount);
|
|
47
|
+
}
|
|
48
|
+
return account;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/host-environment.ts
|
|
52
|
+
import * as z from "zod";
|
|
53
|
+
var hostEnvironmentPath = "/__domino/environment";
|
|
54
|
+
var hostEnvironmentSchema = /* @__PURE__ */ (() => z.object({
|
|
55
|
+
environment: z.enum(["test", "live"]),
|
|
56
|
+
kind: z.enum(["staging", "preview", "live"])
|
|
57
|
+
}))();
|
|
58
|
+
var pending;
|
|
59
|
+
async function readHostEnvironment() {
|
|
60
|
+
try {
|
|
61
|
+
const response = await fetch(hostEnvironmentPath, {
|
|
62
|
+
headers: { Accept: "application/json" }
|
|
63
|
+
});
|
|
64
|
+
if (response.status !== 200) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const parsed = hostEnvironmentSchema.safeParse(await response.json());
|
|
68
|
+
return parsed.success ? parsed.data : null;
|
|
69
|
+
} catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function getHostEnvironment() {
|
|
74
|
+
if (!globalThis.location) {
|
|
75
|
+
return Promise.resolve(null);
|
|
76
|
+
}
|
|
77
|
+
return pending ??= readHostEnvironment();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export {
|
|
81
|
+
noAccount,
|
|
82
|
+
registeredWallets,
|
|
83
|
+
connectSolanaAccount,
|
|
84
|
+
hostEnvironmentPath,
|
|
85
|
+
hostEnvironmentSchema,
|
|
86
|
+
getHostEnvironment
|
|
87
|
+
};
|