@alien_org/contract 1.1.1-alpha → 1.3.1-beta

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/README.md CHANGED
@@ -33,6 +33,7 @@ import type {
33
33
  // Launch parameters
34
34
  LaunchParams, // Host-injected params (authToken, contractVersion, etc.)
35
35
  Platform, // 'ios' | 'android'
36
+ DisplayMode, // 'standard' | 'fullscreen' | 'immersive'
36
37
 
37
38
  // Utilities
38
39
  Version, // Semantic version string type
@@ -42,10 +43,11 @@ import type {
42
43
  ### Constants
43
44
 
44
45
  ```typescript
45
- import { PLATFORMS, releases } from '@alien_org/contract';
46
+ import { DISPLAY_MODES, PLATFORMS, releases } from '@alien_org/contract';
46
47
 
47
- PLATFORMS // ['ios', 'android']
48
- releases // Record<Version, MethodName[]> - version to methods mapping
48
+ PLATFORMS // ['ios', 'android']
49
+ DISPLAY_MODES // ['standard', 'fullscreen', 'immersive']
50
+ releases // Record<Version, MethodName[]> - version to methods mapping
49
51
  ```
50
52
 
51
53
  ### Version Utilities
@@ -63,7 +65,7 @@ isMethodSupported('payment:request', '0.0.9'); // false
63
65
 
64
66
  // Get minimum version that supports a method
65
67
  getMethodMinVersion('app:ready'); // '0.0.9'
66
- getMethodMinVersion('payment:request'); // '0.0.14'
68
+ getMethodMinVersion('payment:request'); // '0.1.1'
67
69
 
68
70
  // Get version where a method was introduced
69
71
  getReleaseVersion('app:ready'); // '0.0.9'
@@ -74,17 +76,32 @@ getReleaseVersion('app:ready'); // '0.0.9'
74
76
  | Method | Since | Description |
75
77
  |--------|-------|-------------|
76
78
  | `app:ready` | 0.0.9 | Notify host that miniapp is ready |
77
- | `miniapp:close.ack` | 0.0.14 | Acknowledge close request |
78
- | `host.back.button:toggle` | 0.0.14 | Show/hide back button |
79
- | `payment:request` | 0.0.14 | Request payment |
79
+ | `payment:request` | 0.1.1 | Request payment |
80
+ | `clipboard:write` | 0.1.1 | Write text to clipboard |
81
+ | `clipboard:read` | 0.1.1 | Read text from clipboard |
82
+ | `link:open` | 0.1.3 | Open a URL |
83
+ | `haptic:impact` | 0.2.4 | Trigger haptic impact feedback |
84
+ | `haptic:notification` | 0.2.4 | Trigger haptic notification feedback |
85
+ | `haptic:selection` | 0.2.4 | Trigger haptic selection feedback |
86
+ | `wallet.solana:connect` | 1.0.0 | Request Solana wallet connection |
87
+ | `wallet.solana:disconnect` | 1.0.0 | Disconnect from Solana wallet |
88
+ | `wallet.solana:sign.transaction` | 1.0.0 | Sign a Solana transaction |
89
+ | `wallet.solana:sign.message` | 1.0.0 | Sign a Solana message |
90
+ | `wallet.solana:sign.send` | 1.0.0 | Sign and send a Solana transaction |
91
+ | `app:close` | 1.0.0 | Request host to close the miniapp |
92
+ | `host.back.button:toggle` | 1.0.0 | Show/hide back button |
80
93
 
81
94
  ## Available Events
82
95
 
83
96
  | Event | Since | Description |
84
97
  |-------|-------|-------------|
85
- | `miniapp:close` | 0.0.14 | Host is closing miniapp |
86
- | `host.back.button:clicked` | 0.0.14 | Back button was clicked |
87
- | `payment:response` | 0.0.14 | Payment result |
98
+ | `host.back.button:clicked` | 1.0.0 | Back button was clicked |
99
+ | `payment:response` | 0.1.1 | Payment result |
100
+ | `clipboard:response` | 0.1.1 | Clipboard read result |
101
+ | `wallet.solana:connect.response` | 1.0.0 | Wallet connection result |
102
+ | `wallet.solana:sign.transaction.response` | 1.0.0 | Transaction signing result |
103
+ | `wallet.solana:sign.message.response` | 1.0.0 | Message signing result |
104
+ | `wallet.solana:sign.send.response` | 1.0.0 | Sign and send result |
88
105
 
89
106
  ## LaunchParams
90
107
 
@@ -92,14 +109,28 @@ Parameters injected by the host app:
92
109
 
93
110
  ```typescript
94
111
  interface LaunchParams {
95
- authToken: string | undefined; // JWT auth token
96
- contractVersion: Version | undefined; // Host's contract version
97
- hostAppVersion: string | undefined; // Host app version
98
- platform: Platform | undefined; // 'ios' | 'android'
99
- startParam: string | undefined; // Custom param (referrals, etc.)
112
+ authToken: string | undefined; // JWT auth token
113
+ contractVersion: Version | undefined; // Host's contract version
114
+ hostAppVersion: string | undefined; // Host app version
115
+ platform: Platform | undefined; // 'ios' | 'android'
116
+ safeAreaInsets: SafeAreaInsets | undefined; // System UI insets (CSS px)
117
+ startParam: string | undefined; // Custom param (referrals, etc.)
118
+ displayMode: DisplayMode; // 'standard' | 'fullscreen' | 'immersive'
100
119
  }
101
120
  ```
102
121
 
122
+ ### DisplayMode
123
+
124
+ Controls how the host app renders the miniapp webview.
125
+
126
+ | Mode | Header | Close / Options | WebView area | Use case |
127
+ | ---- | ------ | --------------- | ------------ | -------- |
128
+ | `standard` | Visible (title, close, options) | In header | Below header | Default for most miniapps |
129
+ | `fullscreen` | Hidden | Floating overlay | Entire screen | Games, media, maps |
130
+ | `immersive` | Hidden | **None** | Entire screen | Custom UIs that provide their own exit (must call `app:close`) |
131
+
132
+ In all modes the miniapp receives `safeAreaInsets` and should respect them for system UI (status bar, notch, home indicator).
133
+
103
134
  ## Adding New Methods/Events
104
135
 
105
136
  1. Define in `src/methods/definitions/methods.ts` or `src/events/definitions/events.ts`
package/dist/index.cjs CHANGED
@@ -1,15 +1,35 @@
1
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/launch-params.ts
3
3
  /**
4
4
  * Supported platforms for miniapps.
5
5
  */
6
6
  const PLATFORMS = ["ios", "android"];
7
-
7
+ /**
8
+ * Supported display modes for miniapps.
9
+ *
10
+ * - `standard` — Default. Native header with close button, options menu, and
11
+ * miniapp title is visible. WebView is inset below the header. Safe area
12
+ * insets account for the header height.
13
+ *
14
+ * - `fullscreen` — WebView occupies the entire screen. The native close button
15
+ * and options menu remain as floating overlays so the user can always exit.
16
+ * The miniapp must respect safe area insets for system UI (status bar, notch,
17
+ * home indicator).
18
+ *
19
+ * - `immersive` — WebView occupies the entire screen with zero native UI.
20
+ * No close button, no options menu, no header — the miniapp owns the full
21
+ * viewport. The miniapp is responsible for providing its own exit mechanism
22
+ * (e.g. calling `app:close`). Safe area insets still apply for system UI.
23
+ */
24
+ const DISPLAY_MODES = [
25
+ "standard",
26
+ "fullscreen",
27
+ "immersive"
28
+ ];
8
29
  //#endregion
9
30
  //#region src/methods/versions/releases.ts
10
31
  const releases = {
11
32
  "0.0.9": ["app:ready"],
12
- "0.0.14": ["miniapp:close.ack", "host.back.button:toggle"],
13
33
  "0.1.1": [
14
34
  "payment:request",
15
35
  "clipboard:write",
@@ -26,11 +46,11 @@ const releases = {
26
46
  "wallet.solana:disconnect",
27
47
  "wallet.solana:sign.transaction",
28
48
  "wallet.solana:sign.message",
29
- "wallet.solana:sign.send"
30
- ],
31
- "1.1.0": ["fullscreen:request", "fullscreen:exit"]
49
+ "wallet.solana:sign.send",
50
+ "app:close",
51
+ "host.back.button:toggle"
52
+ ]
32
53
  };
33
-
34
54
  //#endregion
35
55
  //#region src/methods/versions/get-release-version.ts
36
56
  function getReleaseVersion(method, payload) {
@@ -43,7 +63,6 @@ function getReleaseVersion(method, payload) {
43
63
  });
44
64
  }) || null;
45
65
  }
46
-
47
66
  //#endregion
48
67
  //#region src/methods/versions/index.ts
49
68
  /**
@@ -90,7 +109,6 @@ function getMethodMinVersion(method) {
90
109
  if (methods.some((m) => typeof m === "string" ? m === method : m.method === method)) return version;
91
110
  }
92
111
  }
93
-
94
112
  //#endregion
95
113
  //#region src/utils.ts
96
114
  /**
@@ -113,11 +131,11 @@ const WALLET_ERROR = {
113
131
  INTERNAL_ERROR: -32603,
114
132
  REQUEST_EXPIRED: 8e3
115
133
  };
116
-
117
134
  //#endregion
135
+ exports.DISPLAY_MODES = DISPLAY_MODES;
118
136
  exports.PLATFORMS = PLATFORMS;
119
137
  exports.WALLET_ERROR = WALLET_ERROR;
120
138
  exports.getMethodMinVersion = getMethodMinVersion;
121
139
  exports.getReleaseVersion = getReleaseVersion;
122
140
  exports.isMethodSupported = isMethodSupported;
123
- exports.releases = releases;
141
+ exports.releases = releases;
package/dist/index.d.cts CHANGED
@@ -87,14 +87,6 @@ type PaymentWebhookStatus = 'finalized' | 'failed';
87
87
  * @schema
88
88
  */
89
89
  type PaymentTestScenario = 'paid' | 'paid:failed' | 'cancelled' | `error:${PaymentErrorCode}`;
90
- /**
91
- * Fullscreen error codes.
92
- * Returned in `fullscreen:failed` event when fullscreen request fails.
93
- * - `ALREADY_FULLSCREEN`: Miniapp is already in fullscreen mode
94
- * @since 1.1.0
95
- * @schema
96
- */
97
- type FullscreenErrorCode = 'ALREADY_FULLSCREEN';
98
90
  /**
99
91
  * Haptic impact feedback styles.
100
92
  * Maps to UIImpactFeedbackGenerator styles on iOS
@@ -143,13 +135,9 @@ type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
143
135
  * @since 1.0.0
144
136
  */
145
137
  declare const WALLET_ERROR: {
146
- /** User rejected the request (cancelled approval screen). */
147
- readonly USER_REJECTED: 5000;
148
- /** Invalid params transaction deserialization failed, malformed input. */
149
- readonly INVALID_PARAMS: -32602;
150
- /** Internal error — transaction broadcast failed, unexpected error. */
151
- readonly INTERNAL_ERROR: -32603;
152
- /** Request expired before the user responded. */
138
+ /** User rejected the request (cancelled approval screen). */readonly USER_REJECTED: 5000; /** Invalid params — transaction deserialization failed, malformed input. */
139
+ readonly INVALID_PARAMS: -32602; /** Internal error — transaction broadcast failed, unexpected error. */
140
+ readonly INTERNAL_ERROR: -32603; /** Request expired before the user responded. */
153
141
  readonly REQUEST_EXPIRED: 8000;
154
142
  };
155
143
  /**
@@ -182,15 +170,9 @@ interface CreateEventPayload<Payload = never> {
182
170
  * @schema
183
171
  */
184
172
  interface Events {
185
- /**
186
- * Miniapp close event, fired by the host app just before the miniapp is closed.
187
- * @since 0.0.14
188
- * @schema
189
- */
190
- 'miniapp:close': CreateEventPayload<Empty>;
191
173
  /**
192
174
  * Host app's back button clicked event.
193
- * @since 0.0.14
175
+ * @since 1.0.0
194
176
  * @schema
195
177
  */
196
178
  'host.back.button:clicked': CreateEventPayload<Empty>;
@@ -259,46 +241,14 @@ interface Events {
259
241
  */
260
242
  errorCode?: 'permission_denied' | 'unavailable';
261
243
  }>>;
262
- /**
263
- * Fullscreen state changed, fired by the host app
264
- * after `fullscreen:request` or `fullscreen:exit`.
265
- * @since 1.1.0
266
- * @schema
267
- */
268
- 'fullscreen:changed': CreateEventPayload<{
269
- /**
270
- * Whether the miniapp is currently in fullscreen mode.
271
- * @since 1.1.0
272
- * @schema
273
- */
274
- isFullscreen: boolean;
275
- }>;
276
- /**
277
- * Fullscreen request failed.
278
- * Fired by the host app when `fullscreen:request` cannot be fulfilled
279
- * (e.g., the miniapp is already in fullscreen mode).
280
- * @since 1.1.0
281
- * @schema
282
- */
283
- 'fullscreen:failed': CreateEventPayload<{
284
- /**
285
- * Error code indicating why the fullscreen request failed.
286
- * @since 1.1.0
287
- * @schema
288
- */
289
- error: FullscreenErrorCode;
290
- }>;
291
244
  /**
292
245
  * Solana wallet connection response.
293
246
  * @since 1.0.0
294
247
  * @schema
295
248
  */
296
249
  'wallet.solana:connect.response': CreateEventPayload<WithReqId<{
297
- /** Base58-encoded public key of the connected wallet */
298
- publicKey?: string;
299
- /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
300
- errorCode?: WalletSolanaErrorCode;
301
- /** Human-readable error description */
250
+ /** Base58-encoded public key of the connected wallet */publicKey?: string; /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
251
+ errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
302
252
  errorMessage?: string;
303
253
  }>>;
304
254
  /**
@@ -307,11 +257,8 @@ interface Events {
307
257
  * @schema
308
258
  */
309
259
  'wallet.solana:sign.transaction.response': CreateEventPayload<WithReqId<{
310
- /** Base64-encoded signed transaction */
311
- signedTransaction?: string;
312
- /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
313
- errorCode?: WalletSolanaErrorCode;
314
- /** Human-readable error description */
260
+ /** Base64-encoded signed transaction */signedTransaction?: string; /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
261
+ errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
315
262
  errorMessage?: string;
316
263
  }>>;
317
264
  /**
@@ -320,13 +267,9 @@ interface Events {
320
267
  * @schema
321
268
  */
322
269
  'wallet.solana:sign.message.response': CreateEventPayload<WithReqId<{
323
- /** Base58-encoded Ed25519 signature (64 bytes) */
324
- signature?: string;
325
- /** Base58-encoded public key that signed the message */
326
- publicKey?: string;
327
- /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
328
- errorCode?: WalletSolanaErrorCode;
329
- /** Human-readable error description */
270
+ /** Base58-encoded Ed25519 signature (64 bytes) */signature?: string; /** Base58-encoded public key that signed the message */
271
+ publicKey?: string; /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
272
+ errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
330
273
  errorMessage?: string;
331
274
  }>>;
332
275
  /**
@@ -335,11 +278,8 @@ interface Events {
335
278
  * @schema
336
279
  */
337
280
  'wallet.solana:sign.send.response': CreateEventPayload<WithReqId<{
338
- /** Base58-encoded transaction signature */
339
- signature?: string;
340
- /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
341
- errorCode?: WalletSolanaErrorCode;
342
- /** Human-readable error description */
281
+ /** Base58-encoded transaction signature */signature?: string; /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
282
+ errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
343
283
  errorMessage?: string;
344
284
  }>>;
345
285
  }
@@ -357,6 +297,28 @@ declare const PLATFORMS: readonly ["ios", "android"];
357
297
  * Platform the miniapp is running on.
358
298
  */
359
299
  type Platform = (typeof PLATFORMS)[number];
300
+ /**
301
+ * Supported display modes for miniapps.
302
+ *
303
+ * - `standard` — Default. Native header with close button, options menu, and
304
+ * miniapp title is visible. WebView is inset below the header. Safe area
305
+ * insets account for the header height.
306
+ *
307
+ * - `fullscreen` — WebView occupies the entire screen. The native close button
308
+ * and options menu remain as floating overlays so the user can always exit.
309
+ * The miniapp must respect safe area insets for system UI (status bar, notch,
310
+ * home indicator).
311
+ *
312
+ * - `immersive` — WebView occupies the entire screen with zero native UI.
313
+ * No close button, no options menu, no header — the miniapp owns the full
314
+ * viewport. The miniapp is responsible for providing its own exit mechanism
315
+ * (e.g. calling `app:close`). Safe area insets still apply for system UI.
316
+ */
317
+ declare const DISPLAY_MODES: readonly ["standard", "fullscreen", "immersive"];
318
+ /**
319
+ * Display mode for the miniapp webview.
320
+ */
321
+ type DisplayMode = (typeof DISPLAY_MODES)[number];
360
322
  /**
361
323
  * Safe area insets in CSS pixels, injected by the host app.
362
324
  * Accounts for system UI (status bar, notch, home indicator, nav bar).
@@ -387,10 +349,11 @@ interface LaunchParams {
387
349
  */
388
350
  startParam: string | undefined;
389
351
  /**
390
- * Whether the miniapp was launched in fullscreen mode.
391
- * @since 1.1.0
352
+ * Display mode for the miniapp webview.
353
+ * Defaults to `'standard'` when not provided by the host app.
354
+ * @since 1.0.0
392
355
  */
393
- isFullscreen: boolean | undefined;
356
+ displayMode: DisplayMode;
394
357
  }
395
358
  //#endregion
396
359
  //#region src/methods/types/payload.d.ts
@@ -411,27 +374,27 @@ interface Methods {
411
374
  /**
412
375
  * Miniapp ready method.
413
376
  * Sent by the miniapp to notify the host app that it has loaded and is ready to be displayed.
414
- * @since 0.0.1
377
+ * @since 0.0.9
415
378
  * @schema
416
379
  */
417
380
  'app:ready': CreateMethodPayload<Empty>;
418
381
  /**
419
- * Miniapp close acknowledgment method.
420
- * Sent by the miniapp to notify the host app that it has completed cleanup and is ready to be closed.
421
- * Note that if the miniapp takes longer than 10 seconds to close, the host app will force close the miniapp.
422
- * @since 0.0.14
382
+ * Close the miniapp.
383
+ * Sent by the miniapp to request the host app to close it.
384
+ * Fire-and-forget no response expected.
385
+ * @since 1.0.0
423
386
  * @schema
424
387
  */
425
- 'miniapp:close.ack': CreateMethodPayload<Empty>;
388
+ 'app:close': CreateMethodPayload<Empty>;
426
389
  /**
427
390
  * Toggle host app's back button visibility.
428
- * @since 0.0.14
391
+ * @since 1.0.0
429
392
  * @schema
430
393
  */
431
394
  'host.back.button:toggle': CreateMethodPayload<{
432
395
  /**
433
396
  * Whether to show or hide the back button.
434
- * @since 0.0.14
397
+ * @since 1.0.0
435
398
  * @schema
436
399
  */
437
400
  visible: boolean;
@@ -654,8 +617,7 @@ interface Methods {
654
617
  * @schema
655
618
  */
656
619
  'wallet.solana:sign.transaction': CreateMethodPayload<WithReqId<{
657
- /** Base64-encoded serialized transaction (legacy or versioned) */
658
- transaction: string;
620
+ /** Base64-encoded serialized transaction (legacy or versioned) */transaction: string;
659
621
  }>>;
660
622
  /**
661
623
  * Request Solana message signing.
@@ -664,8 +626,7 @@ interface Methods {
664
626
  * @schema
665
627
  */
666
628
  'wallet.solana:sign.message': CreateMethodPayload<WithReqId<{
667
- /** Base58-encoded message bytes */
668
- message: string;
629
+ /** Base58-encoded message bytes */message: string;
669
630
  }>>;
670
631
  /**
671
632
  * Request Solana transaction signing and sending.
@@ -675,8 +636,7 @@ interface Methods {
675
636
  * @schema
676
637
  */
677
638
  'wallet.solana:sign.send': CreateMethodPayload<WithReqId<{
678
- /** Base64-encoded serialized transaction (legacy or versioned) */
679
- transaction: string;
639
+ /** Base64-encoded serialized transaction (legacy or versioned) */transaction: string;
680
640
  /**
681
641
  * Target Solana cluster for broadcasting.
682
642
  * In bridge mode the host app can infer this from miniapp config,
@@ -685,12 +645,10 @@ interface Methods {
685
645
  * @since 1.0.0
686
646
  * @schema
687
647
  */
688
- chain?: SolanaChain;
689
- /** Optional send options */
648
+ chain?: SolanaChain; /** Optional send options */
690
649
  options?: {
691
650
  skipPreflight?: boolean;
692
- preflightCommitment?: SolanaCommitment;
693
- /** Desired commitment level for transaction confirmation. */
651
+ preflightCommitment?: SolanaCommitment; /** Desired commitment level for transaction confirmation. */
694
652
  commitment?: SolanaCommitment;
695
653
  /**
696
654
  * The minimum slot that the request can be evaluated at.
@@ -700,33 +658,11 @@ interface Methods {
700
658
  maxRetries?: number;
701
659
  };
702
660
  }>>;
703
- /**
704
- * Request fullscreen mode.
705
- * Fire-and-forget — host app responds with `fullscreen:changed` or `fullscreen:failed` event.
706
- *
707
- * @example
708
- * send('fullscreen:request', {});
709
- *
710
- * @since 1.1.0
711
- * @schema
712
- */
713
- 'fullscreen:request': CreateMethodPayload<Empty>;
714
- /**
715
- * Exit fullscreen mode.
716
- * Fire-and-forget — host app responds with `fullscreen:changed` event.
717
- *
718
- * @example
719
- * send('fullscreen:exit', {});
720
- *
721
- * @since 1.1.0
722
- * @schema
723
- */
724
- 'fullscreen:exit': CreateMethodPayload<Empty>;
725
661
  }
726
662
  //#endregion
727
663
  //#region src/methods/types/method-types.d.ts
728
664
  type MethodName = keyof Methods;
729
- type MethodPayload<M$1 extends MethodName> = Methods[M$1]['payload'];
665
+ type MethodPayload<M extends MethodName> = Methods[M]['payload'];
730
666
  /**
731
667
  * Method names which have versioned payload.
732
668
  */
@@ -734,7 +670,7 @@ type MethodNameWithVersionedPayload = { [M in MethodName]: If<IsNever<Methods[M]
734
670
  /**
735
671
  * Method payload which appear only in the specific version.
736
672
  */
737
- type MethodVersionedPayload<M$1 extends MethodNameWithVersionedPayload> = Methods[M$1]['versionedPayload'];
673
+ type MethodVersionedPayload<M extends MethodNameWithVersionedPayload> = Methods[M]['versionedPayload'];
738
674
  //#endregion
739
675
  //#region src/methods/versions/get-release-version.d.ts
740
676
  /**
@@ -743,7 +679,7 @@ type MethodVersionedPayload<M$1 extends MethodNameWithVersionedPayload> = Method
743
679
  * @param method - method name
744
680
  * @param param - method parameter
745
681
  */
746
- declare function getReleaseVersion<M$1 extends MethodNameWithVersionedPayload>(method: M$1, payload: MethodVersionedPayload<M$1>): Version | null;
682
+ declare function getReleaseVersion<M extends MethodNameWithVersionedPayload>(method: M, payload: MethodVersionedPayload<M>): Version | null;
747
683
  declare function getReleaseVersion(method: MethodName): Version | null;
748
684
  //#endregion
749
685
  //#region src/methods/versions/releases.d.ts
@@ -776,4 +712,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
776
712
  */
777
713
  declare function getMethodMinVersion(method: MethodName): Version | undefined;
778
714
  //#endregion
779
- export { type CreateEventPayload, type CreateMethodPayload, type EventName, type EventPayload, type Events, type FullscreenErrorCode, type HapticImpactStyle, type HapticNotificationType, type LaunchParams, type MethodName, type MethodNameWithVersionedPayload, type MethodPayload, type MethodVersionedPayload, type Methods, PLATFORMS, type PaymentErrorCode, type PaymentTestScenario, type PaymentWebhookStatus, type Platform, type SafeAreaInsets, type SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
715
+ export { type CreateEventPayload, type CreateMethodPayload, DISPLAY_MODES, type DisplayMode, type EventName, type EventPayload, type Events, type HapticImpactStyle, type HapticNotificationType, type LaunchParams, type MethodName, type MethodNameWithVersionedPayload, type MethodPayload, type MethodVersionedPayload, type Methods, PLATFORMS, type PaymentErrorCode, type PaymentTestScenario, type PaymentWebhookStatus, type Platform, type SafeAreaInsets, type SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
package/dist/index.d.mts CHANGED
@@ -87,14 +87,6 @@ type PaymentWebhookStatus = 'finalized' | 'failed';
87
87
  * @schema
88
88
  */
89
89
  type PaymentTestScenario = 'paid' | 'paid:failed' | 'cancelled' | `error:${PaymentErrorCode}`;
90
- /**
91
- * Fullscreen error codes.
92
- * Returned in `fullscreen:failed` event when fullscreen request fails.
93
- * - `ALREADY_FULLSCREEN`: Miniapp is already in fullscreen mode
94
- * @since 1.1.0
95
- * @schema
96
- */
97
- type FullscreenErrorCode = 'ALREADY_FULLSCREEN';
98
90
  /**
99
91
  * Haptic impact feedback styles.
100
92
  * Maps to UIImpactFeedbackGenerator styles on iOS
@@ -143,13 +135,9 @@ type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
143
135
  * @since 1.0.0
144
136
  */
145
137
  declare const WALLET_ERROR: {
146
- /** User rejected the request (cancelled approval screen). */
147
- readonly USER_REJECTED: 5000;
148
- /** Invalid params transaction deserialization failed, malformed input. */
149
- readonly INVALID_PARAMS: -32602;
150
- /** Internal error — transaction broadcast failed, unexpected error. */
151
- readonly INTERNAL_ERROR: -32603;
152
- /** Request expired before the user responded. */
138
+ /** User rejected the request (cancelled approval screen). */readonly USER_REJECTED: 5000; /** Invalid params — transaction deserialization failed, malformed input. */
139
+ readonly INVALID_PARAMS: -32602; /** Internal error — transaction broadcast failed, unexpected error. */
140
+ readonly INTERNAL_ERROR: -32603; /** Request expired before the user responded. */
153
141
  readonly REQUEST_EXPIRED: 8000;
154
142
  };
155
143
  /**
@@ -182,15 +170,9 @@ interface CreateEventPayload<Payload = never> {
182
170
  * @schema
183
171
  */
184
172
  interface Events {
185
- /**
186
- * Miniapp close event, fired by the host app just before the miniapp is closed.
187
- * @since 0.0.14
188
- * @schema
189
- */
190
- 'miniapp:close': CreateEventPayload<Empty>;
191
173
  /**
192
174
  * Host app's back button clicked event.
193
- * @since 0.0.14
175
+ * @since 1.0.0
194
176
  * @schema
195
177
  */
196
178
  'host.back.button:clicked': CreateEventPayload<Empty>;
@@ -259,46 +241,14 @@ interface Events {
259
241
  */
260
242
  errorCode?: 'permission_denied' | 'unavailable';
261
243
  }>>;
262
- /**
263
- * Fullscreen state changed, fired by the host app
264
- * after `fullscreen:request` or `fullscreen:exit`.
265
- * @since 1.1.0
266
- * @schema
267
- */
268
- 'fullscreen:changed': CreateEventPayload<{
269
- /**
270
- * Whether the miniapp is currently in fullscreen mode.
271
- * @since 1.1.0
272
- * @schema
273
- */
274
- isFullscreen: boolean;
275
- }>;
276
- /**
277
- * Fullscreen request failed.
278
- * Fired by the host app when `fullscreen:request` cannot be fulfilled
279
- * (e.g., the miniapp is already in fullscreen mode).
280
- * @since 1.1.0
281
- * @schema
282
- */
283
- 'fullscreen:failed': CreateEventPayload<{
284
- /**
285
- * Error code indicating why the fullscreen request failed.
286
- * @since 1.1.0
287
- * @schema
288
- */
289
- error: FullscreenErrorCode;
290
- }>;
291
244
  /**
292
245
  * Solana wallet connection response.
293
246
  * @since 1.0.0
294
247
  * @schema
295
248
  */
296
249
  'wallet.solana:connect.response': CreateEventPayload<WithReqId<{
297
- /** Base58-encoded public key of the connected wallet */
298
- publicKey?: string;
299
- /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
300
- errorCode?: WalletSolanaErrorCode;
301
- /** Human-readable error description */
250
+ /** Base58-encoded public key of the connected wallet */publicKey?: string; /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
251
+ errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
302
252
  errorMessage?: string;
303
253
  }>>;
304
254
  /**
@@ -307,11 +257,8 @@ interface Events {
307
257
  * @schema
308
258
  */
309
259
  'wallet.solana:sign.transaction.response': CreateEventPayload<WithReqId<{
310
- /** Base64-encoded signed transaction */
311
- signedTransaction?: string;
312
- /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
313
- errorCode?: WalletSolanaErrorCode;
314
- /** Human-readable error description */
260
+ /** Base64-encoded signed transaction */signedTransaction?: string; /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
261
+ errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
315
262
  errorMessage?: string;
316
263
  }>>;
317
264
  /**
@@ -320,13 +267,9 @@ interface Events {
320
267
  * @schema
321
268
  */
322
269
  'wallet.solana:sign.message.response': CreateEventPayload<WithReqId<{
323
- /** Base58-encoded Ed25519 signature (64 bytes) */
324
- signature?: string;
325
- /** Base58-encoded public key that signed the message */
326
- publicKey?: string;
327
- /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
328
- errorCode?: WalletSolanaErrorCode;
329
- /** Human-readable error description */
270
+ /** Base58-encoded Ed25519 signature (64 bytes) */signature?: string; /** Base58-encoded public key that signed the message */
271
+ publicKey?: string; /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
272
+ errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
330
273
  errorMessage?: string;
331
274
  }>>;
332
275
  /**
@@ -335,11 +278,8 @@ interface Events {
335
278
  * @schema
336
279
  */
337
280
  'wallet.solana:sign.send.response': CreateEventPayload<WithReqId<{
338
- /** Base58-encoded transaction signature */
339
- signature?: string;
340
- /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
341
- errorCode?: WalletSolanaErrorCode;
342
- /** Human-readable error description */
281
+ /** Base58-encoded transaction signature */signature?: string; /** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
282
+ errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
343
283
  errorMessage?: string;
344
284
  }>>;
345
285
  }
@@ -357,6 +297,28 @@ declare const PLATFORMS: readonly ["ios", "android"];
357
297
  * Platform the miniapp is running on.
358
298
  */
359
299
  type Platform = (typeof PLATFORMS)[number];
300
+ /**
301
+ * Supported display modes for miniapps.
302
+ *
303
+ * - `standard` — Default. Native header with close button, options menu, and
304
+ * miniapp title is visible. WebView is inset below the header. Safe area
305
+ * insets account for the header height.
306
+ *
307
+ * - `fullscreen` — WebView occupies the entire screen. The native close button
308
+ * and options menu remain as floating overlays so the user can always exit.
309
+ * The miniapp must respect safe area insets for system UI (status bar, notch,
310
+ * home indicator).
311
+ *
312
+ * - `immersive` — WebView occupies the entire screen with zero native UI.
313
+ * No close button, no options menu, no header — the miniapp owns the full
314
+ * viewport. The miniapp is responsible for providing its own exit mechanism
315
+ * (e.g. calling `app:close`). Safe area insets still apply for system UI.
316
+ */
317
+ declare const DISPLAY_MODES: readonly ["standard", "fullscreen", "immersive"];
318
+ /**
319
+ * Display mode for the miniapp webview.
320
+ */
321
+ type DisplayMode = (typeof DISPLAY_MODES)[number];
360
322
  /**
361
323
  * Safe area insets in CSS pixels, injected by the host app.
362
324
  * Accounts for system UI (status bar, notch, home indicator, nav bar).
@@ -387,10 +349,11 @@ interface LaunchParams {
387
349
  */
388
350
  startParam: string | undefined;
389
351
  /**
390
- * Whether the miniapp was launched in fullscreen mode.
391
- * @since 1.1.0
352
+ * Display mode for the miniapp webview.
353
+ * Defaults to `'standard'` when not provided by the host app.
354
+ * @since 1.0.0
392
355
  */
393
- isFullscreen: boolean | undefined;
356
+ displayMode: DisplayMode;
394
357
  }
395
358
  //#endregion
396
359
  //#region src/methods/types/payload.d.ts
@@ -411,27 +374,27 @@ interface Methods {
411
374
  /**
412
375
  * Miniapp ready method.
413
376
  * Sent by the miniapp to notify the host app that it has loaded and is ready to be displayed.
414
- * @since 0.0.1
377
+ * @since 0.0.9
415
378
  * @schema
416
379
  */
417
380
  'app:ready': CreateMethodPayload<Empty>;
418
381
  /**
419
- * Miniapp close acknowledgment method.
420
- * Sent by the miniapp to notify the host app that it has completed cleanup and is ready to be closed.
421
- * Note that if the miniapp takes longer than 10 seconds to close, the host app will force close the miniapp.
422
- * @since 0.0.14
382
+ * Close the miniapp.
383
+ * Sent by the miniapp to request the host app to close it.
384
+ * Fire-and-forget no response expected.
385
+ * @since 1.0.0
423
386
  * @schema
424
387
  */
425
- 'miniapp:close.ack': CreateMethodPayload<Empty>;
388
+ 'app:close': CreateMethodPayload<Empty>;
426
389
  /**
427
390
  * Toggle host app's back button visibility.
428
- * @since 0.0.14
391
+ * @since 1.0.0
429
392
  * @schema
430
393
  */
431
394
  'host.back.button:toggle': CreateMethodPayload<{
432
395
  /**
433
396
  * Whether to show or hide the back button.
434
- * @since 0.0.14
397
+ * @since 1.0.0
435
398
  * @schema
436
399
  */
437
400
  visible: boolean;
@@ -654,8 +617,7 @@ interface Methods {
654
617
  * @schema
655
618
  */
656
619
  'wallet.solana:sign.transaction': CreateMethodPayload<WithReqId<{
657
- /** Base64-encoded serialized transaction (legacy or versioned) */
658
- transaction: string;
620
+ /** Base64-encoded serialized transaction (legacy or versioned) */transaction: string;
659
621
  }>>;
660
622
  /**
661
623
  * Request Solana message signing.
@@ -664,8 +626,7 @@ interface Methods {
664
626
  * @schema
665
627
  */
666
628
  'wallet.solana:sign.message': CreateMethodPayload<WithReqId<{
667
- /** Base58-encoded message bytes */
668
- message: string;
629
+ /** Base58-encoded message bytes */message: string;
669
630
  }>>;
670
631
  /**
671
632
  * Request Solana transaction signing and sending.
@@ -675,8 +636,7 @@ interface Methods {
675
636
  * @schema
676
637
  */
677
638
  'wallet.solana:sign.send': CreateMethodPayload<WithReqId<{
678
- /** Base64-encoded serialized transaction (legacy or versioned) */
679
- transaction: string;
639
+ /** Base64-encoded serialized transaction (legacy or versioned) */transaction: string;
680
640
  /**
681
641
  * Target Solana cluster for broadcasting.
682
642
  * In bridge mode the host app can infer this from miniapp config,
@@ -685,12 +645,10 @@ interface Methods {
685
645
  * @since 1.0.0
686
646
  * @schema
687
647
  */
688
- chain?: SolanaChain;
689
- /** Optional send options */
648
+ chain?: SolanaChain; /** Optional send options */
690
649
  options?: {
691
650
  skipPreflight?: boolean;
692
- preflightCommitment?: SolanaCommitment;
693
- /** Desired commitment level for transaction confirmation. */
651
+ preflightCommitment?: SolanaCommitment; /** Desired commitment level for transaction confirmation. */
694
652
  commitment?: SolanaCommitment;
695
653
  /**
696
654
  * The minimum slot that the request can be evaluated at.
@@ -700,33 +658,11 @@ interface Methods {
700
658
  maxRetries?: number;
701
659
  };
702
660
  }>>;
703
- /**
704
- * Request fullscreen mode.
705
- * Fire-and-forget — host app responds with `fullscreen:changed` or `fullscreen:failed` event.
706
- *
707
- * @example
708
- * send('fullscreen:request', {});
709
- *
710
- * @since 1.1.0
711
- * @schema
712
- */
713
- 'fullscreen:request': CreateMethodPayload<Empty>;
714
- /**
715
- * Exit fullscreen mode.
716
- * Fire-and-forget — host app responds with `fullscreen:changed` event.
717
- *
718
- * @example
719
- * send('fullscreen:exit', {});
720
- *
721
- * @since 1.1.0
722
- * @schema
723
- */
724
- 'fullscreen:exit': CreateMethodPayload<Empty>;
725
661
  }
726
662
  //#endregion
727
663
  //#region src/methods/types/method-types.d.ts
728
664
  type MethodName = keyof Methods;
729
- type MethodPayload<M$1 extends MethodName> = Methods[M$1]['payload'];
665
+ type MethodPayload<M extends MethodName> = Methods[M]['payload'];
730
666
  /**
731
667
  * Method names which have versioned payload.
732
668
  */
@@ -734,7 +670,7 @@ type MethodNameWithVersionedPayload = { [M in MethodName]: If<IsNever<Methods[M]
734
670
  /**
735
671
  * Method payload which appear only in the specific version.
736
672
  */
737
- type MethodVersionedPayload<M$1 extends MethodNameWithVersionedPayload> = Methods[M$1]['versionedPayload'];
673
+ type MethodVersionedPayload<M extends MethodNameWithVersionedPayload> = Methods[M]['versionedPayload'];
738
674
  //#endregion
739
675
  //#region src/methods/versions/get-release-version.d.ts
740
676
  /**
@@ -743,7 +679,7 @@ type MethodVersionedPayload<M$1 extends MethodNameWithVersionedPayload> = Method
743
679
  * @param method - method name
744
680
  * @param param - method parameter
745
681
  */
746
- declare function getReleaseVersion<M$1 extends MethodNameWithVersionedPayload>(method: M$1, payload: MethodVersionedPayload<M$1>): Version | null;
682
+ declare function getReleaseVersion<M extends MethodNameWithVersionedPayload>(method: M, payload: MethodVersionedPayload<M>): Version | null;
747
683
  declare function getReleaseVersion(method: MethodName): Version | null;
748
684
  //#endregion
749
685
  //#region src/methods/versions/releases.d.ts
@@ -776,4 +712,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
776
712
  */
777
713
  declare function getMethodMinVersion(method: MethodName): Version | undefined;
778
714
  //#endregion
779
- export { type CreateEventPayload, type CreateMethodPayload, type EventName, type EventPayload, type Events, type FullscreenErrorCode, type HapticImpactStyle, type HapticNotificationType, type LaunchParams, type MethodName, type MethodNameWithVersionedPayload, type MethodPayload, type MethodVersionedPayload, type Methods, PLATFORMS, type PaymentErrorCode, type PaymentTestScenario, type PaymentWebhookStatus, type Platform, type SafeAreaInsets, type SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
715
+ export { type CreateEventPayload, type CreateMethodPayload, DISPLAY_MODES, type DisplayMode, type EventName, type EventPayload, type Events, type HapticImpactStyle, type HapticNotificationType, type LaunchParams, type MethodName, type MethodNameWithVersionedPayload, type MethodPayload, type MethodVersionedPayload, type Methods, PLATFORMS, type PaymentErrorCode, type PaymentTestScenario, type PaymentWebhookStatus, type Platform, type SafeAreaInsets, type SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
package/dist/index.mjs CHANGED
@@ -3,12 +3,32 @@
3
3
  * Supported platforms for miniapps.
4
4
  */
5
5
  const PLATFORMS = ["ios", "android"];
6
-
6
+ /**
7
+ * Supported display modes for miniapps.
8
+ *
9
+ * - `standard` — Default. Native header with close button, options menu, and
10
+ * miniapp title is visible. WebView is inset below the header. Safe area
11
+ * insets account for the header height.
12
+ *
13
+ * - `fullscreen` — WebView occupies the entire screen. The native close button
14
+ * and options menu remain as floating overlays so the user can always exit.
15
+ * The miniapp must respect safe area insets for system UI (status bar, notch,
16
+ * home indicator).
17
+ *
18
+ * - `immersive` — WebView occupies the entire screen with zero native UI.
19
+ * No close button, no options menu, no header — the miniapp owns the full
20
+ * viewport. The miniapp is responsible for providing its own exit mechanism
21
+ * (e.g. calling `app:close`). Safe area insets still apply for system UI.
22
+ */
23
+ const DISPLAY_MODES = [
24
+ "standard",
25
+ "fullscreen",
26
+ "immersive"
27
+ ];
7
28
  //#endregion
8
29
  //#region src/methods/versions/releases.ts
9
30
  const releases = {
10
31
  "0.0.9": ["app:ready"],
11
- "0.0.14": ["miniapp:close.ack", "host.back.button:toggle"],
12
32
  "0.1.1": [
13
33
  "payment:request",
14
34
  "clipboard:write",
@@ -25,11 +45,11 @@ const releases = {
25
45
  "wallet.solana:disconnect",
26
46
  "wallet.solana:sign.transaction",
27
47
  "wallet.solana:sign.message",
28
- "wallet.solana:sign.send"
29
- ],
30
- "1.1.0": ["fullscreen:request", "fullscreen:exit"]
48
+ "wallet.solana:sign.send",
49
+ "app:close",
50
+ "host.back.button:toggle"
51
+ ]
31
52
  };
32
-
33
53
  //#endregion
34
54
  //#region src/methods/versions/get-release-version.ts
35
55
  function getReleaseVersion(method, payload) {
@@ -42,7 +62,6 @@ function getReleaseVersion(method, payload) {
42
62
  });
43
63
  }) || null;
44
64
  }
45
-
46
65
  //#endregion
47
66
  //#region src/methods/versions/index.ts
48
67
  /**
@@ -89,7 +108,6 @@ function getMethodMinVersion(method) {
89
108
  if (methods.some((m) => typeof m === "string" ? m === method : m.method === method)) return version;
90
109
  }
91
110
  }
92
-
93
111
  //#endregion
94
112
  //#region src/utils.ts
95
113
  /**
@@ -112,6 +130,5 @@ const WALLET_ERROR = {
112
130
  INTERNAL_ERROR: -32603,
113
131
  REQUEST_EXPIRED: 8e3
114
132
  };
115
-
116
133
  //#endregion
117
- export { PLATFORMS, WALLET_ERROR, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
134
+ export { DISPLAY_MODES, PLATFORMS, WALLET_ERROR, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alien_org/contract",
3
- "version": "1.1.1-alpha",
3
+ "version": "1.3.1-beta",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -36,9 +36,9 @@
36
36
  "generate-schemas": "bun run scripts/generate-schemas.ts"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/bun": "^1.3.5",
40
- "@types/node": "^25.0.3",
41
- "tsdown": "^0.18.1",
39
+ "@types/bun": "^1.3.10",
40
+ "@types/node": "^25.3.5",
41
+ "tsdown": "^0.21.0",
42
42
  "typescript-json-schema": "^0.67.1"
43
43
  },
44
44
  "peerDependencies": {