@domino-sdk/relay 1.5.2 → 1.6.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 (43) hide show
  1. package/dist/{activity-DeKJsRry.d.ts → activity-mPUN4v5Q.d.ts} +147 -116
  2. package/dist/authoring.d.ts +59 -47
  3. package/dist/authoring.js +3 -3
  4. package/dist/{automatic-outcomes-B1xrETxm.d.ts → automatic-outcomes-DmuqzQiH.d.ts} +224 -13
  5. package/dist/browser.d.ts +22 -10
  6. package/dist/browser.js +6 -6
  7. package/dist/{capability-error-DNMwKmlL.d.ts → capability-error-Bv996M-h.d.ts} +2 -0
  8. package/dist/{chunk-GQKYAQM6.js → chunk-23QJ7WH4.js} +1 -1
  9. package/dist/{chunk-XFMSUPNS.js → chunk-6ON4RMEN.js} +1 -1
  10. package/dist/{chunk-VFHHLN6A.js → chunk-6RBF3UDA.js} +49 -6
  11. package/dist/chunk-AXRMT33W.js +112 -0
  12. package/dist/{chunk-24AFCBZN.js → chunk-BFZHJA2B.js} +2 -2
  13. package/dist/{chunk-EYH5RDIE.js → chunk-C25TDFHN.js} +4 -2
  14. package/dist/{chunk-36HTX2BM.js → chunk-GMPPLZKH.js} +61 -4
  15. package/dist/{chunk-BGGKNIRP.js → chunk-JW4G3SY5.js} +1 -1
  16. package/dist/{chunk-JON5SESL.js → chunk-KGJSKGKI.js} +84 -6
  17. package/dist/{chunk-WJSSJ7AF.js → chunk-QGLHZ2E5.js} +24 -4
  18. package/dist/{chunk-DGWMLN35.js → chunk-ZOUEEK5L.js} +16 -5
  19. package/dist/{client-gqnRUHpC.d.ts → client-CQuTAjSs.d.ts} +88 -41
  20. package/dist/{groups-Ck-OxzjD.d.ts → groups-D08JtrZu.d.ts} +175 -3
  21. package/dist/{identity-integration-GxAHdKR2.d.ts → identity-integration-BPovus6e.d.ts} +1 -1
  22. package/dist/{images-Dv-P5VBw.d.ts → images-D7en0Awp.d.ts} +1 -1
  23. package/dist/index.d.ts +9 -9
  24. package/dist/index.js +5 -5
  25. package/dist/internal.d.ts +34 -27
  26. package/dist/internal.js +18 -24
  27. package/dist/{offers-Cy-e4o5x.d.ts → offers-BENZl5l5.d.ts} +3 -2
  28. package/dist/{outcomes-kVB-Juzs.d.ts → pages-CBa-_u_n.d.ts} +142 -99
  29. package/dist/{pages-BBYD21IE.d.ts → participant-activity-DkL3nY5a.d.ts} +1 -14
  30. package/dist/portal-proxy.js +48 -36
  31. package/dist/react/index.d.ts +25 -3949
  32. package/dist/react/index.js +8 -7
  33. package/dist/{request-error-DWduJCGV.d.ts → request-error-D_dUPLwo.d.ts} +5 -0
  34. package/dist/{schema-DfJzH2ci.d.ts → schema-BPdHSCAc.d.ts} +122 -37
  35. package/dist/schema.d.ts +10 -10
  36. package/dist/schema.js +48 -6
  37. package/dist/server/index.d.ts +9672 -66110
  38. package/dist/server/index.js +1009 -548
  39. package/dist/sign-in-options-FPKoZMfo.d.ts +202 -0
  40. package/dist/{submission-input-BZkm6ohU.d.ts → submission-input-BzIWutQi.d.ts} +2 -2
  41. package/package.json +1 -1
  42. package/dist/browser-D_3s8B5e.d.ts +0 -4154
  43. package/dist/chunk-GUP7YRR4.js +0 -42
@@ -0,0 +1,202 @@
1
+ import { a as AuthProvider } from './submission-input-BzIWutQi.js';
2
+ import { n as createRelayClient, g as RelayError } from './client-CQuTAjSs.js';
3
+ import { C as CosmosChain, a as CosmosNetwork, f as WalletSigner, d as WalletSignInNetwork } from './wallet-YssWxGg8.js';
4
+
5
+ /** An EIP-1193 provider, such as `window.ethereum` or an EIP-6963 announcement's provider. */
6
+ type Eip1193Provider = {
7
+ request(args: {
8
+ method: string;
9
+ params?: unknown[] | object;
10
+ }): Promise<unknown>;
11
+ };
12
+ /** The legacy injected Solana shape Phantom, Solflare and Backpack expose. */
13
+ type SolanaInjectedProvider = {
14
+ connect(): Promise<unknown>;
15
+ publicKey?: {
16
+ toBase58(): string;
17
+ } | null;
18
+ signMessage(message: Uint8Array, display?: "utf8"): Promise<{
19
+ signature: Uint8Array;
20
+ } | Uint8Array>;
21
+ };
22
+ /** The part of a Wallet Standard account Relay uses. */
23
+ type StandardWalletAccount = {
24
+ readonly address: string;
25
+ readonly chains: readonly string[];
26
+ };
27
+ /** The part of a Wallet Standard wallet Relay uses; any conforming wallet object fits. */
28
+ type StandardWallet = {
29
+ readonly name: string;
30
+ readonly icon?: string;
31
+ readonly chains: readonly string[];
32
+ readonly accounts: readonly StandardWalletAccount[];
33
+ readonly features: Readonly<Record<string, unknown>>;
34
+ };
35
+ /** Keplr's API, which Leap and Cosmostation also implement. */
36
+ type KeplrLike = {
37
+ enable(chainId: string | string[]): Promise<void>;
38
+ getKey(chainId: string): Promise<{
39
+ bech32Address: string;
40
+ }>;
41
+ signArbitrary(chainId: string, signer: string, data: string): Promise<{
42
+ signature: string;
43
+ pub_key: {
44
+ type: string;
45
+ value: string;
46
+ };
47
+ }>;
48
+ /** Adds a chain the wallet does not know, after the user approves it. */
49
+ experimentalSuggestChain?(chainInfo: CosmosChain["chainInfo"]): Promise<void>;
50
+ };
51
+ /** A wallet found in the page, ready to pass to `relay.wallets.link`. */
52
+ type DiscoveredWallet = {
53
+ id: string;
54
+ name: string;
55
+ icon?: string;
56
+ signer: WalletSigner;
57
+ };
58
+ /** Signs with an EIP-1193 provider through `personal_sign`. */
59
+ declare function evmSigner(provider: Eip1193Provider, info?: {
60
+ name?: string;
61
+ }): WalletSigner;
62
+ /** Signs with a legacy injected Solana provider, such as `window.phantom.solana`. */
63
+ declare function solanaSigner(provider: SolanaInjectedProvider, info?: {
64
+ name?: string;
65
+ }): WalletSigner;
66
+ /** Signs with a Wallet Standard wallet's `solana:signMessage` feature. */
67
+ declare function walletStandardSolanaSigner(wallet: StandardWallet): WalletSigner;
68
+ /**
69
+ * Signs an ADR-36 message with Keplr or a wallet that implements its API, on the app's chain:
70
+ * `{ chainId, chainInfo? }` or `"cosmos:<chain ID>"`. When the wallet does not know the chain and
71
+ * `chainInfo` is given, it suggests the chain to the wallet (`experimentalSuggestChain`) and tries
72
+ * again; without `chainInfo`, or with a wallet that cannot add chains, it throws an error that
73
+ * names the chain. Other failures, such as a rejected request, pass through.
74
+ */
75
+ declare function cosmosSigner(provider: KeplrLike, chain: CosmosChain | CosmosNetwork, info?: {
76
+ name?: string;
77
+ }): WalletSigner;
78
+ /** EIP-6963 wallets, or `window.ethereum` when none announce themselves within `timeoutMs`. */
79
+ declare function discoverEvmWallets(timeoutMs?: number): Promise<DiscoveredWallet[]>;
80
+ /** Wallet Standard wallets that can sign Solana messages, then legacy injected providers. */
81
+ declare function discoverSolanaWallets(): DiscoveredWallet[];
82
+ /**
83
+ * Keplr, Leap and Cosmostation, each signing on the app's chain (see `cosmosSigner`). IDs end with
84
+ * the chain ID.
85
+ */
86
+ declare function discoverCosmosWallets(chain: CosmosChain | CosmosNetwork): DiscoveredWallet[];
87
+ /**
88
+ * The Cosmos SDK chains an app offers wallets on: one chain or several, each as
89
+ * `{ chainId, chainInfo? }` or `"cosmos:<chain ID>"`. Relay has no chain list of its own.
90
+ */
91
+ type CosmosChains = CosmosChain | CosmosNetwork | readonly (CosmosChain | CosmosNetwork)[];
92
+ /** The chains in `CosmosChains`, as a list. */
93
+ declare function cosmosChainList(chains: CosmosChains | undefined): (CosmosChain | CosmosNetwork)[];
94
+ /** An installed wallet that can sign in on one of the project's enabled wallet families. */
95
+ type SignInWallet = DiscoveredWallet & {
96
+ network: WalletSignInNetwork;
97
+ };
98
+ /**
99
+ * The wallets installed in this browser that can sign in with `families`: EVM wallets first, then
100
+ * Solana wallets, then Cosmos wallets once per chain in `cosmos`. Without `cosmos` there are no
101
+ * Cosmos wallets. Empty during SSR.
102
+ */
103
+ declare function discoverSignInWallets(families: readonly WalletSignInNetwork[], cosmos?: CosmosChains): Promise<SignInWallet[]>;
104
+
105
+ type Auth = ReturnType<typeof createRelayClient>["auth"];
106
+ /** The part of a Relay client sign-in options use. */
107
+ type SignInClient = {
108
+ auth: Pick<Auth, "providers" | "start" | "emailStart" | "emailVerify"> & {
109
+ wallet: Pick<Auth["wallet"], "signIn">;
110
+ };
111
+ };
112
+ /** The sign-in methods a project takes: the platform's OAuth providers and email, and its wallet families. */
113
+ type SignInMethods = {
114
+ providers: AuthProvider[];
115
+ email: boolean;
116
+ /** The wallet families this project enabled for sign-in in Console. */
117
+ wallets: WalletSignInNetwork[];
118
+ /**
119
+ * Set when the methods could not be read, such as when the network failed: they are then email
120
+ * alone, and the server has the final say when the participant uses it.
121
+ */
122
+ error?: RelayError;
123
+ };
124
+ /** Which icon to draw: an OAuth provider's logo, a mail icon, or a generic wallet icon. */
125
+ type SignInIcon = AuthProvider | "email" | "wallet";
126
+ type OAuthSignInOption = {
127
+ kind: "oauth";
128
+ /** The provider, such as `"google"`. */
129
+ id: AuthProvider;
130
+ /** The provider's name, such as "Google". */
131
+ label: string;
132
+ icon: AuthProvider;
133
+ /** Leaves the page for the provider's consent screen. See `SignInOption` for failures. */
134
+ start(): Promise<void>;
135
+ };
136
+ type EmailSignInOption = {
137
+ kind: "email";
138
+ id: "email";
139
+ label: string;
140
+ icon: "email";
141
+ /** Emails a one-time code to the address. */
142
+ sendCode(email: string): Promise<void>;
143
+ /** Signs in with the code sent last. */
144
+ verifyCode(code: string): Promise<void>;
145
+ };
146
+ type WalletSignInOption = {
147
+ kind: "wallet";
148
+ /** Unique among the options, such as `"wallet:eip155:io.metamask"`. */
149
+ id: string;
150
+ /** The wallet's name, with its family or chain when another installed wallet has the same name. */
151
+ label: string;
152
+ icon: "wallet";
153
+ /** The wallet's own icon, a data or HTTPS URL, when it announces one. */
154
+ iconUrl?: string;
155
+ /** The wallet family it signs in with. */
156
+ family: WalletSignInNetwork;
157
+ /** The signer, for `useWallets().link` or `relay.wallets.link`. */
158
+ signer: WalletSigner;
159
+ /** Asks the wallet to sign a message, then signs in, or signs up. See `SignInOption` for failures. */
160
+ start(): Promise<void>;
161
+ };
162
+ /**
163
+ * One way to sign in that this project takes and this browser can use. From `useSignInOptions()`
164
+ * its actions never reject: a failure lands in the hook's `error`. From `signInOptions()` they
165
+ * reject with the failure.
166
+ */
167
+ type SignInOption = OAuthSignInOption | EmailSignInOption | WalletSignInOption;
168
+ /**
169
+ * A sign-in method the project enabled that is not offered, and why:
170
+ * - `cosmos-chains-missing`: the project takes Cosmos wallets but the app named no Cosmos chains.
171
+ * For the app's developer; pass `cosmos` to offer them.
172
+ * - `cosmos-chains-invalid`: the project takes Cosmos wallets but a chain in `cosmos` is not one,
173
+ * such as `"cosmoshub-4"` without the `cosmos:` prefix. For the app's developer; `message` says
174
+ * what is wrong.
175
+ * - `no-wallet-installed`: the project takes wallets but this browser has none for its families.
176
+ * For the participant; `message` says which to install.
177
+ */
178
+ type SignInUnavailable = {
179
+ reason: "cosmos-chains-missing" | "cosmos-chains-invalid" | "no-wallet-installed";
180
+ families: WalletSignInNetwork[];
181
+ message: string;
182
+ };
183
+ type SignInOptions = {
184
+ /** OAuth providers first, then installed wallets, then email. */
185
+ options: SignInOption[];
186
+ unavailable: SignInUnavailable[];
187
+ /** Why the project's methods could not be read; the options are then email alone. */
188
+ methodsError?: RelayError;
189
+ };
190
+ /**
191
+ * Every way a participant can sign in to this project from this browser, for apps without React:
192
+ * the OAuth providers and email the platform configured, and the installed wallets of the families
193
+ * the project enabled. Cosmos wallets need the app's chains in `cosmos`; without them, or when one
194
+ * is invalid, they are not offered and `unavailable` says so. Each option signs in with this
195
+ * client: OAuth leaves the page, email sends a code and then verifies it, a wallet signs a
196
+ * message. The actions reject when they fail.
197
+ */
198
+ declare function signInOptions(relay: SignInClient, input?: {
199
+ cosmos?: CosmosChains;
200
+ }): Promise<SignInOptions>;
201
+
202
+ export { type CosmosChains as C, type DiscoveredWallet as D, type Eip1193Provider as E, type KeplrLike as K, type OAuthSignInOption as O, type SignInClient as S, type WalletSignInOption as W, type EmailSignInOption as a, type SignInIcon as b, type SignInMethods as c, type SignInOption as d, type SignInOptions as e, type SignInUnavailable as f, type SignInWallet as g, type SolanaInjectedProvider as h, type StandardWallet as i, type StandardWalletAccount as j, cosmosChainList as k, cosmosSigner as l, discoverCosmosWallets as m, discoverEvmWallets as n, discoverSignInWallets as o, discoverSolanaWallets as p, evmSigner as q, solanaSigner as r, signInOptions as s, walletStandardSolanaSigner as w };
@@ -1,6 +1,6 @@
1
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';
2
+ import { cP as LedgerReference, cO as QuestHandle } from './schema-BPdHSCAc.js';
3
+ import { p as ProjectGroupReference } from './groups-D08JtrZu.js';
4
4
 
5
5
  /** A Discord message as `ctx.discord.message()` reads it, from the project's Discord server. */
6
6
  declare const discordMessageSchema: z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domino-sdk/relay",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {