@alien_org/contract 0.2.4 → 1.1.0-alpha

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/dist/index.cjs CHANGED
@@ -20,7 +20,15 @@ const releases = {
20
20
  "haptic:impact",
21
21
  "haptic:notification",
22
22
  "haptic:selection"
23
- ]
23
+ ],
24
+ "1.0.0": [
25
+ "wallet.solana:connect",
26
+ "wallet.solana:disconnect",
27
+ "wallet.solana:sign.transaction",
28
+ "wallet.solana:sign.message",
29
+ "wallet.solana:sign.send"
30
+ ],
31
+ "1.1.0": ["fullscreen:request", "fullscreen:exit"]
24
32
  };
25
33
 
26
34
  //#endregion
@@ -83,8 +91,32 @@ function getMethodMinVersion(method) {
83
91
  }
84
92
  }
85
93
 
94
+ //#endregion
95
+ //#region src/utils.ts
96
+ /**
97
+ * Named constants for {@link WalletSolanaErrorCode}.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * import { WALLET_ERROR } from '@alien_org/contract';
102
+ *
103
+ * if (response.errorCode === WALLET_ERROR.USER_REJECTED) {
104
+ * // user cancelled
105
+ * }
106
+ * ```
107
+ *
108
+ * @since 1.0.0
109
+ */
110
+ const WALLET_ERROR = {
111
+ USER_REJECTED: 5e3,
112
+ INVALID_PARAMS: -32602,
113
+ INTERNAL_ERROR: -32603,
114
+ REQUEST_EXPIRED: 8e3
115
+ };
116
+
86
117
  //#endregion
87
118
  exports.PLATFORMS = PLATFORMS;
119
+ exports.WALLET_ERROR = WALLET_ERROR;
88
120
  exports.getMethodMinVersion = getMethodMinVersion;
89
121
  exports.getReleaseVersion = getReleaseVersion;
90
122
  exports.isMethodSupported = isMethodSupported;
package/dist/index.d.cts CHANGED
@@ -87,6 +87,14 @@ 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';
90
98
  /**
91
99
  * Haptic impact feedback styles.
92
100
  * Maps to UIImpactFeedbackGenerator styles on iOS
@@ -102,6 +110,62 @@ type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
102
110
  * @schema
103
111
  */
104
112
  type HapticNotificationType = 'success' | 'warning' | 'error';
113
+ /**
114
+ * Solana wallet error codes (WalletConnect-compatible numeric codes).
115
+ *
116
+ * These codes are identical to WalletConnect JSON-RPC error codes,
117
+ * so the mobile app produces the same `(code, message)` pair for
118
+ * both bridge and relay transports — no mapping needed.
119
+ *
120
+ * | Code | Meaning | WC Name |
121
+ * |------|---------|---------|
122
+ * | `5000` | User rejected the request | `userRejected` |
123
+ * | `-32602` | Invalid params (malformed transaction, bad input) | JSON-RPC standard |
124
+ * | `-32603` | Internal error (send failed, unexpected error) | JSON-RPC standard |
125
+ * | `8000` | Request expired / timed out | `sessionRequestExpired` |
126
+ *
127
+ * @since 1.0.0
128
+ * @schema
129
+ */
130
+ type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
131
+ /**
132
+ * Named constants for {@link WalletSolanaErrorCode}.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * import { WALLET_ERROR } from '@alien_org/contract';
137
+ *
138
+ * if (response.errorCode === WALLET_ERROR.USER_REJECTED) {
139
+ * // user cancelled
140
+ * }
141
+ * ```
142
+ *
143
+ * @since 1.0.0
144
+ */
145
+ 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. */
153
+ readonly REQUEST_EXPIRED: 8000;
154
+ };
155
+ /**
156
+ * Solana commitment levels for send options.
157
+ * @since 1.0.0
158
+ * @schema
159
+ */
160
+ type SolanaCommitment = 'processed' | 'confirmed' | 'finalized';
161
+ /**
162
+ * Solana chain identifiers (wallet-standard format).
163
+ * Used by `wallet.solana:sign.send` to tell the host app
164
+ * which cluster to broadcast to.
165
+ * @since 1.0.0
166
+ * @schema
167
+ */
168
+ type SolanaChain = 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
105
169
  //#endregion
106
170
  //#region src/events/types/payload.d.ts
107
171
  /**
@@ -195,6 +259,89 @@ interface Events {
195
259
  */
196
260
  errorCode?: 'permission_denied' | 'unavailable';
197
261
  }>>;
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
+ /**
292
+ * Solana wallet connection response.
293
+ * @since 1.0.0
294
+ * @schema
295
+ */
296
+ '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 */
302
+ errorMessage?: string;
303
+ }>>;
304
+ /**
305
+ * Solana transaction signing response.
306
+ * @since 1.0.0
307
+ * @schema
308
+ */
309
+ '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 */
315
+ errorMessage?: string;
316
+ }>>;
317
+ /**
318
+ * Solana message signing response.
319
+ * @since 1.0.0
320
+ * @schema
321
+ */
322
+ '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 */
330
+ errorMessage?: string;
331
+ }>>;
332
+ /**
333
+ * Solana sign-and-send transaction response.
334
+ * @since 1.0.0
335
+ * @schema
336
+ */
337
+ '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 */
343
+ errorMessage?: string;
344
+ }>>;
198
345
  }
199
346
  //#endregion
200
347
  //#region src/events/types/event-types.d.ts
@@ -239,6 +386,11 @@ interface LaunchParams {
239
386
  * Used for referral codes, campaign tracking, or custom routing.
240
387
  */
241
388
  startParam: string | undefined;
389
+ /**
390
+ * Whether the miniapp was launched in fullscreen mode.
391
+ * @since 1.1.0
392
+ */
393
+ isFullscreen: boolean | undefined;
242
394
  }
243
395
  //#endregion
244
396
  //#region src/methods/types/payload.d.ts
@@ -481,6 +633,95 @@ interface Methods {
481
633
  * @schema
482
634
  */
483
635
  'haptic:selection': CreateMethodPayload<Empty>;
636
+ /**
637
+ * Request Solana wallet connection.
638
+ * Returns the wallet's public key on success.
639
+ * @since 1.0.0
640
+ * @schema
641
+ */
642
+ 'wallet.solana:connect': CreateMethodPayload<WithReqId<Empty>>;
643
+ /**
644
+ * Disconnect from Solana wallet.
645
+ * Fire-and-forget — no response expected.
646
+ * @since 1.0.0
647
+ * @schema
648
+ */
649
+ 'wallet.solana:disconnect': CreateMethodPayload<Empty>;
650
+ /**
651
+ * Request Solana transaction signing.
652
+ * Returns the signed transaction bytes.
653
+ * @since 1.0.0
654
+ * @schema
655
+ */
656
+ 'wallet.solana:sign.transaction': CreateMethodPayload<WithReqId<{
657
+ /** Base64-encoded serialized transaction (legacy or versioned) */
658
+ transaction: string;
659
+ }>>;
660
+ /**
661
+ * Request Solana message signing.
662
+ * Returns the Ed25519 signature.
663
+ * @since 1.0.0
664
+ * @schema
665
+ */
666
+ 'wallet.solana:sign.message': CreateMethodPayload<WithReqId<{
667
+ /** Base58-encoded message bytes */
668
+ message: string;
669
+ }>>;
670
+ /**
671
+ * Request Solana transaction signing and sending.
672
+ * The host app signs and broadcasts the transaction.
673
+ * Returns the transaction signature.
674
+ * @since 1.0.0
675
+ * @schema
676
+ */
677
+ 'wallet.solana:sign.send': CreateMethodPayload<WithReqId<{
678
+ /** Base64-encoded serialized transaction (legacy or versioned) */
679
+ transaction: string;
680
+ /**
681
+ * Target Solana cluster for broadcasting.
682
+ * In bridge mode the host app can infer this from miniapp config,
683
+ * but in relay mode (QR/WebSocket) this is required so the host
684
+ * app knows which RPC to broadcast to.
685
+ * @since 1.0.0
686
+ * @schema
687
+ */
688
+ chain?: SolanaChain;
689
+ /** Optional send options */
690
+ options?: {
691
+ skipPreflight?: boolean;
692
+ preflightCommitment?: SolanaCommitment;
693
+ /** Desired commitment level for transaction confirmation. */
694
+ commitment?: SolanaCommitment;
695
+ /**
696
+ * The minimum slot that the request can be evaluated at.
697
+ * Ensures the read is not served by a node lagging behind.
698
+ */
699
+ minContextSlot?: number;
700
+ maxRetries?: number;
701
+ };
702
+ }>>;
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>;
484
725
  }
485
726
  //#endregion
486
727
  //#region src/methods/types/method-types.d.ts
@@ -535,4 +776,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
535
776
  */
536
777
  declare function getMethodMinVersion(method: MethodName): Version | undefined;
537
778
  //#endregion
538
- export { type CreateEventPayload, type CreateMethodPayload, 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 Version, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
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 };
package/dist/index.d.mts CHANGED
@@ -87,6 +87,14 @@ 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';
90
98
  /**
91
99
  * Haptic impact feedback styles.
92
100
  * Maps to UIImpactFeedbackGenerator styles on iOS
@@ -102,6 +110,62 @@ type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
102
110
  * @schema
103
111
  */
104
112
  type HapticNotificationType = 'success' | 'warning' | 'error';
113
+ /**
114
+ * Solana wallet error codes (WalletConnect-compatible numeric codes).
115
+ *
116
+ * These codes are identical to WalletConnect JSON-RPC error codes,
117
+ * so the mobile app produces the same `(code, message)` pair for
118
+ * both bridge and relay transports — no mapping needed.
119
+ *
120
+ * | Code | Meaning | WC Name |
121
+ * |------|---------|---------|
122
+ * | `5000` | User rejected the request | `userRejected` |
123
+ * | `-32602` | Invalid params (malformed transaction, bad input) | JSON-RPC standard |
124
+ * | `-32603` | Internal error (send failed, unexpected error) | JSON-RPC standard |
125
+ * | `8000` | Request expired / timed out | `sessionRequestExpired` |
126
+ *
127
+ * @since 1.0.0
128
+ * @schema
129
+ */
130
+ type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
131
+ /**
132
+ * Named constants for {@link WalletSolanaErrorCode}.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * import { WALLET_ERROR } from '@alien_org/contract';
137
+ *
138
+ * if (response.errorCode === WALLET_ERROR.USER_REJECTED) {
139
+ * // user cancelled
140
+ * }
141
+ * ```
142
+ *
143
+ * @since 1.0.0
144
+ */
145
+ 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. */
153
+ readonly REQUEST_EXPIRED: 8000;
154
+ };
155
+ /**
156
+ * Solana commitment levels for send options.
157
+ * @since 1.0.0
158
+ * @schema
159
+ */
160
+ type SolanaCommitment = 'processed' | 'confirmed' | 'finalized';
161
+ /**
162
+ * Solana chain identifiers (wallet-standard format).
163
+ * Used by `wallet.solana:sign.send` to tell the host app
164
+ * which cluster to broadcast to.
165
+ * @since 1.0.0
166
+ * @schema
167
+ */
168
+ type SolanaChain = 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
105
169
  //#endregion
106
170
  //#region src/events/types/payload.d.ts
107
171
  /**
@@ -195,6 +259,89 @@ interface Events {
195
259
  */
196
260
  errorCode?: 'permission_denied' | 'unavailable';
197
261
  }>>;
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
+ /**
292
+ * Solana wallet connection response.
293
+ * @since 1.0.0
294
+ * @schema
295
+ */
296
+ '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 */
302
+ errorMessage?: string;
303
+ }>>;
304
+ /**
305
+ * Solana transaction signing response.
306
+ * @since 1.0.0
307
+ * @schema
308
+ */
309
+ '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 */
315
+ errorMessage?: string;
316
+ }>>;
317
+ /**
318
+ * Solana message signing response.
319
+ * @since 1.0.0
320
+ * @schema
321
+ */
322
+ '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 */
330
+ errorMessage?: string;
331
+ }>>;
332
+ /**
333
+ * Solana sign-and-send transaction response.
334
+ * @since 1.0.0
335
+ * @schema
336
+ */
337
+ '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 */
343
+ errorMessage?: string;
344
+ }>>;
198
345
  }
199
346
  //#endregion
200
347
  //#region src/events/types/event-types.d.ts
@@ -239,6 +386,11 @@ interface LaunchParams {
239
386
  * Used for referral codes, campaign tracking, or custom routing.
240
387
  */
241
388
  startParam: string | undefined;
389
+ /**
390
+ * Whether the miniapp was launched in fullscreen mode.
391
+ * @since 1.1.0
392
+ */
393
+ isFullscreen: boolean | undefined;
242
394
  }
243
395
  //#endregion
244
396
  //#region src/methods/types/payload.d.ts
@@ -481,6 +633,95 @@ interface Methods {
481
633
  * @schema
482
634
  */
483
635
  'haptic:selection': CreateMethodPayload<Empty>;
636
+ /**
637
+ * Request Solana wallet connection.
638
+ * Returns the wallet's public key on success.
639
+ * @since 1.0.0
640
+ * @schema
641
+ */
642
+ 'wallet.solana:connect': CreateMethodPayload<WithReqId<Empty>>;
643
+ /**
644
+ * Disconnect from Solana wallet.
645
+ * Fire-and-forget — no response expected.
646
+ * @since 1.0.0
647
+ * @schema
648
+ */
649
+ 'wallet.solana:disconnect': CreateMethodPayload<Empty>;
650
+ /**
651
+ * Request Solana transaction signing.
652
+ * Returns the signed transaction bytes.
653
+ * @since 1.0.0
654
+ * @schema
655
+ */
656
+ 'wallet.solana:sign.transaction': CreateMethodPayload<WithReqId<{
657
+ /** Base64-encoded serialized transaction (legacy or versioned) */
658
+ transaction: string;
659
+ }>>;
660
+ /**
661
+ * Request Solana message signing.
662
+ * Returns the Ed25519 signature.
663
+ * @since 1.0.0
664
+ * @schema
665
+ */
666
+ 'wallet.solana:sign.message': CreateMethodPayload<WithReqId<{
667
+ /** Base58-encoded message bytes */
668
+ message: string;
669
+ }>>;
670
+ /**
671
+ * Request Solana transaction signing and sending.
672
+ * The host app signs and broadcasts the transaction.
673
+ * Returns the transaction signature.
674
+ * @since 1.0.0
675
+ * @schema
676
+ */
677
+ 'wallet.solana:sign.send': CreateMethodPayload<WithReqId<{
678
+ /** Base64-encoded serialized transaction (legacy or versioned) */
679
+ transaction: string;
680
+ /**
681
+ * Target Solana cluster for broadcasting.
682
+ * In bridge mode the host app can infer this from miniapp config,
683
+ * but in relay mode (QR/WebSocket) this is required so the host
684
+ * app knows which RPC to broadcast to.
685
+ * @since 1.0.0
686
+ * @schema
687
+ */
688
+ chain?: SolanaChain;
689
+ /** Optional send options */
690
+ options?: {
691
+ skipPreflight?: boolean;
692
+ preflightCommitment?: SolanaCommitment;
693
+ /** Desired commitment level for transaction confirmation. */
694
+ commitment?: SolanaCommitment;
695
+ /**
696
+ * The minimum slot that the request can be evaluated at.
697
+ * Ensures the read is not served by a node lagging behind.
698
+ */
699
+ minContextSlot?: number;
700
+ maxRetries?: number;
701
+ };
702
+ }>>;
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>;
484
725
  }
485
726
  //#endregion
486
727
  //#region src/methods/types/method-types.d.ts
@@ -535,4 +776,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
535
776
  */
536
777
  declare function getMethodMinVersion(method: MethodName): Version | undefined;
537
778
  //#endregion
538
- export { type CreateEventPayload, type CreateMethodPayload, 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 Version, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
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 };
package/dist/index.mjs CHANGED
@@ -19,7 +19,15 @@ const releases = {
19
19
  "haptic:impact",
20
20
  "haptic:notification",
21
21
  "haptic:selection"
22
- ]
22
+ ],
23
+ "1.0.0": [
24
+ "wallet.solana:connect",
25
+ "wallet.solana:disconnect",
26
+ "wallet.solana:sign.transaction",
27
+ "wallet.solana:sign.message",
28
+ "wallet.solana:sign.send"
29
+ ],
30
+ "1.1.0": ["fullscreen:request", "fullscreen:exit"]
23
31
  };
24
32
 
25
33
  //#endregion
@@ -83,4 +91,27 @@ function getMethodMinVersion(method) {
83
91
  }
84
92
 
85
93
  //#endregion
86
- export { PLATFORMS, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
94
+ //#region src/utils.ts
95
+ /**
96
+ * Named constants for {@link WalletSolanaErrorCode}.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * import { WALLET_ERROR } from '@alien_org/contract';
101
+ *
102
+ * if (response.errorCode === WALLET_ERROR.USER_REJECTED) {
103
+ * // user cancelled
104
+ * }
105
+ * ```
106
+ *
107
+ * @since 1.0.0
108
+ */
109
+ const WALLET_ERROR = {
110
+ USER_REJECTED: 5e3,
111
+ INVALID_PARAMS: -32602,
112
+ INTERNAL_ERROR: -32603,
113
+ REQUEST_EXPIRED: 8e3
114
+ };
115
+
116
+ //#endregion
117
+ export { 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": "0.2.4",
3
+ "version": "1.1.0-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",