@alien_org/contract 0.2.3 → 1.0.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 +37 -1
- package/dist/index.d.cts +228 -1
- package/dist/index.d.mts +228 -1
- package/dist/index.mjs +37 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,19 @@ const releases = {
|
|
|
15
15
|
"clipboard:write",
|
|
16
16
|
"clipboard:read"
|
|
17
17
|
],
|
|
18
|
-
"0.1.3": ["link:open"]
|
|
18
|
+
"0.1.3": ["link:open"],
|
|
19
|
+
"0.2.4": [
|
|
20
|
+
"haptic:impact",
|
|
21
|
+
"haptic:notification",
|
|
22
|
+
"haptic:selection"
|
|
23
|
+
],
|
|
24
|
+
"0.3.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
|
+
]
|
|
19
31
|
};
|
|
20
32
|
|
|
21
33
|
//#endregion
|
|
@@ -78,8 +90,32 @@ function getMethodMinVersion(method) {
|
|
|
78
90
|
}
|
|
79
91
|
}
|
|
80
92
|
|
|
93
|
+
//#endregion
|
|
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 0.3.0
|
|
108
|
+
*/
|
|
109
|
+
const WALLET_ERROR = {
|
|
110
|
+
USER_REJECTED: 5e3,
|
|
111
|
+
INVALID_PARAMS: -32602,
|
|
112
|
+
INTERNAL_ERROR: -32603,
|
|
113
|
+
REQUEST_EXPIRED: 8e3
|
|
114
|
+
};
|
|
115
|
+
|
|
81
116
|
//#endregion
|
|
82
117
|
exports.PLATFORMS = PLATFORMS;
|
|
118
|
+
exports.WALLET_ERROR = WALLET_ERROR;
|
|
83
119
|
exports.getMethodMinVersion = getMethodMinVersion;
|
|
84
120
|
exports.getReleaseVersion = getReleaseVersion;
|
|
85
121
|
exports.isMethodSupported = isMethodSupported;
|
package/dist/index.d.cts
CHANGED
|
@@ -87,6 +87,77 @@ type PaymentWebhookStatus = 'finalized' | 'failed';
|
|
|
87
87
|
* @schema
|
|
88
88
|
*/
|
|
89
89
|
type PaymentTestScenario = 'paid' | 'paid:failed' | 'cancelled' | `error:${PaymentErrorCode}`;
|
|
90
|
+
/**
|
|
91
|
+
* Haptic impact feedback styles.
|
|
92
|
+
* Maps to UIImpactFeedbackGenerator styles on iOS
|
|
93
|
+
* and VibrationEffect on Android.
|
|
94
|
+
* @since 0.2.4
|
|
95
|
+
* @schema
|
|
96
|
+
*/
|
|
97
|
+
type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
|
|
98
|
+
/**
|
|
99
|
+
* Haptic notification feedback types.
|
|
100
|
+
* Maps to UINotificationFeedbackGenerator types on iOS.
|
|
101
|
+
* @since 0.2.4
|
|
102
|
+
* @schema
|
|
103
|
+
*/
|
|
104
|
+
type HapticNotificationType = 'success' | 'warning' | 'error';
|
|
105
|
+
/**
|
|
106
|
+
* Solana wallet error codes (WalletConnect-compatible numeric codes).
|
|
107
|
+
*
|
|
108
|
+
* These codes are identical to WalletConnect JSON-RPC error codes,
|
|
109
|
+
* so the mobile app produces the same `(code, message)` pair for
|
|
110
|
+
* both bridge and relay transports — no mapping needed.
|
|
111
|
+
*
|
|
112
|
+
* | Code | Meaning | WC Name |
|
|
113
|
+
* |------|---------|---------|
|
|
114
|
+
* | `5000` | User rejected the request | `userRejected` |
|
|
115
|
+
* | `-32602` | Invalid params (malformed transaction, bad input) | JSON-RPC standard |
|
|
116
|
+
* | `-32603` | Internal error (send failed, unexpected error) | JSON-RPC standard |
|
|
117
|
+
* | `8000` | Request expired / timed out | `sessionRequestExpired` |
|
|
118
|
+
*
|
|
119
|
+
* @since 0.3.0
|
|
120
|
+
* @schema
|
|
121
|
+
*/
|
|
122
|
+
type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
|
|
123
|
+
/**
|
|
124
|
+
* Named constants for {@link WalletSolanaErrorCode}.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { WALLET_ERROR } from '@alien_org/contract';
|
|
129
|
+
*
|
|
130
|
+
* if (response.errorCode === WALLET_ERROR.USER_REJECTED) {
|
|
131
|
+
* // user cancelled
|
|
132
|
+
* }
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @since 0.3.0
|
|
136
|
+
*/
|
|
137
|
+
declare const WALLET_ERROR: {
|
|
138
|
+
/** User rejected the request (cancelled approval screen). */
|
|
139
|
+
readonly USER_REJECTED: 5000;
|
|
140
|
+
/** Invalid params — transaction deserialization failed, malformed input. */
|
|
141
|
+
readonly INVALID_PARAMS: -32602;
|
|
142
|
+
/** Internal error — transaction broadcast failed, unexpected error. */
|
|
143
|
+
readonly INTERNAL_ERROR: -32603;
|
|
144
|
+
/** Request expired before the user responded. */
|
|
145
|
+
readonly REQUEST_EXPIRED: 8000;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Solana commitment levels for send options.
|
|
149
|
+
* @since 0.3.0
|
|
150
|
+
* @schema
|
|
151
|
+
*/
|
|
152
|
+
type SolanaCommitment = 'processed' | 'confirmed' | 'finalized';
|
|
153
|
+
/**
|
|
154
|
+
* Solana chain identifiers (wallet-standard format).
|
|
155
|
+
* Used by `wallet.solana:sign.send` to tell the host app
|
|
156
|
+
* which cluster to broadcast to.
|
|
157
|
+
* @since 0.3.0
|
|
158
|
+
* @schema
|
|
159
|
+
*/
|
|
160
|
+
type SolanaChain = 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
|
|
90
161
|
//#endregion
|
|
91
162
|
//#region src/events/types/payload.d.ts
|
|
92
163
|
/**
|
|
@@ -180,6 +251,60 @@ interface Events {
|
|
|
180
251
|
*/
|
|
181
252
|
errorCode?: 'permission_denied' | 'unavailable';
|
|
182
253
|
}>>;
|
|
254
|
+
/**
|
|
255
|
+
* Solana wallet connection response.
|
|
256
|
+
* @since 0.3.0
|
|
257
|
+
* @schema
|
|
258
|
+
*/
|
|
259
|
+
'wallet.solana:connect.response': CreateEventPayload<WithReqId<{
|
|
260
|
+
/** Base58-encoded public key of the connected wallet */
|
|
261
|
+
publicKey?: string;
|
|
262
|
+
/** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
|
|
263
|
+
errorCode?: WalletSolanaErrorCode;
|
|
264
|
+
/** Human-readable error description */
|
|
265
|
+
errorMessage?: string;
|
|
266
|
+
}>>;
|
|
267
|
+
/**
|
|
268
|
+
* Solana transaction signing response.
|
|
269
|
+
* @since 0.3.0
|
|
270
|
+
* @schema
|
|
271
|
+
*/
|
|
272
|
+
'wallet.solana:sign.transaction.response': CreateEventPayload<WithReqId<{
|
|
273
|
+
/** Base64-encoded signed transaction */
|
|
274
|
+
signedTransaction?: string;
|
|
275
|
+
/** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
|
|
276
|
+
errorCode?: WalletSolanaErrorCode;
|
|
277
|
+
/** Human-readable error description */
|
|
278
|
+
errorMessage?: string;
|
|
279
|
+
}>>;
|
|
280
|
+
/**
|
|
281
|
+
* Solana message signing response.
|
|
282
|
+
* @since 0.3.0
|
|
283
|
+
* @schema
|
|
284
|
+
*/
|
|
285
|
+
'wallet.solana:sign.message.response': CreateEventPayload<WithReqId<{
|
|
286
|
+
/** Base58-encoded Ed25519 signature (64 bytes) */
|
|
287
|
+
signature?: string;
|
|
288
|
+
/** Base58-encoded public key that signed the message */
|
|
289
|
+
publicKey?: string;
|
|
290
|
+
/** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
|
|
291
|
+
errorCode?: WalletSolanaErrorCode;
|
|
292
|
+
/** Human-readable error description */
|
|
293
|
+
errorMessage?: string;
|
|
294
|
+
}>>;
|
|
295
|
+
/**
|
|
296
|
+
* Solana sign-and-send transaction response.
|
|
297
|
+
* @since 0.3.0
|
|
298
|
+
* @schema
|
|
299
|
+
*/
|
|
300
|
+
'wallet.solana:sign.send.response': CreateEventPayload<WithReqId<{
|
|
301
|
+
/** Base58-encoded transaction signature */
|
|
302
|
+
signature?: string;
|
|
303
|
+
/** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
|
|
304
|
+
errorCode?: WalletSolanaErrorCode;
|
|
305
|
+
/** Human-readable error description */
|
|
306
|
+
errorMessage?: string;
|
|
307
|
+
}>>;
|
|
183
308
|
}
|
|
184
309
|
//#endregion
|
|
185
310
|
//#region src/events/types/event-types.d.ts
|
|
@@ -431,6 +556,108 @@ interface Methods {
|
|
|
431
556
|
*/
|
|
432
557
|
openMode?: 'external' | 'internal';
|
|
433
558
|
}>;
|
|
559
|
+
/**
|
|
560
|
+
* Trigger haptic impact feedback.
|
|
561
|
+
* Fire-and-forget — no response expected.
|
|
562
|
+
* @since 0.2.4
|
|
563
|
+
* @schema
|
|
564
|
+
*/
|
|
565
|
+
'haptic:impact': CreateMethodPayload<{
|
|
566
|
+
/**
|
|
567
|
+
* The impact feedback style.
|
|
568
|
+
* @since 0.2.4
|
|
569
|
+
* @schema
|
|
570
|
+
*/
|
|
571
|
+
style: HapticImpactStyle;
|
|
572
|
+
}>;
|
|
573
|
+
/**
|
|
574
|
+
* Trigger haptic notification feedback.
|
|
575
|
+
* Fire-and-forget — no response expected.
|
|
576
|
+
* @since 0.2.4
|
|
577
|
+
* @schema
|
|
578
|
+
*/
|
|
579
|
+
'haptic:notification': CreateMethodPayload<{
|
|
580
|
+
/**
|
|
581
|
+
* The notification feedback type.
|
|
582
|
+
* @since 0.2.4
|
|
583
|
+
* @schema
|
|
584
|
+
*/
|
|
585
|
+
type: HapticNotificationType;
|
|
586
|
+
}>;
|
|
587
|
+
/**
|
|
588
|
+
* Trigger haptic selection change feedback.
|
|
589
|
+
* Fire-and-forget — no response expected.
|
|
590
|
+
* @since 0.2.4
|
|
591
|
+
* @schema
|
|
592
|
+
*/
|
|
593
|
+
'haptic:selection': CreateMethodPayload<Empty>;
|
|
594
|
+
/**
|
|
595
|
+
* Request Solana wallet connection.
|
|
596
|
+
* Returns the wallet's public key on success.
|
|
597
|
+
* @since 0.3.0
|
|
598
|
+
* @schema
|
|
599
|
+
*/
|
|
600
|
+
'wallet.solana:connect': CreateMethodPayload<WithReqId<Empty>>;
|
|
601
|
+
/**
|
|
602
|
+
* Disconnect from Solana wallet.
|
|
603
|
+
* Fire-and-forget — no response expected.
|
|
604
|
+
* @since 0.3.0
|
|
605
|
+
* @schema
|
|
606
|
+
*/
|
|
607
|
+
'wallet.solana:disconnect': CreateMethodPayload<Empty>;
|
|
608
|
+
/**
|
|
609
|
+
* Request Solana transaction signing.
|
|
610
|
+
* Returns the signed transaction bytes.
|
|
611
|
+
* @since 0.3.0
|
|
612
|
+
* @schema
|
|
613
|
+
*/
|
|
614
|
+
'wallet.solana:sign.transaction': CreateMethodPayload<WithReqId<{
|
|
615
|
+
/** Base64-encoded serialized transaction (legacy or versioned) */
|
|
616
|
+
transaction: string;
|
|
617
|
+
}>>;
|
|
618
|
+
/**
|
|
619
|
+
* Request Solana message signing.
|
|
620
|
+
* Returns the Ed25519 signature.
|
|
621
|
+
* @since 0.3.0
|
|
622
|
+
* @schema
|
|
623
|
+
*/
|
|
624
|
+
'wallet.solana:sign.message': CreateMethodPayload<WithReqId<{
|
|
625
|
+
/** Base58-encoded message bytes */
|
|
626
|
+
message: string;
|
|
627
|
+
}>>;
|
|
628
|
+
/**
|
|
629
|
+
* Request Solana transaction signing and sending.
|
|
630
|
+
* The host app signs and broadcasts the transaction.
|
|
631
|
+
* Returns the transaction signature.
|
|
632
|
+
* @since 0.3.0
|
|
633
|
+
* @schema
|
|
634
|
+
*/
|
|
635
|
+
'wallet.solana:sign.send': CreateMethodPayload<WithReqId<{
|
|
636
|
+
/** Base64-encoded serialized transaction (legacy or versioned) */
|
|
637
|
+
transaction: string;
|
|
638
|
+
/**
|
|
639
|
+
* Target Solana cluster for broadcasting.
|
|
640
|
+
* In bridge mode the host app can infer this from miniapp config,
|
|
641
|
+
* but in relay mode (QR/WebSocket) this is required so the host
|
|
642
|
+
* app knows which RPC to broadcast to.
|
|
643
|
+
* @since 0.3.0
|
|
644
|
+
* @schema
|
|
645
|
+
*/
|
|
646
|
+
chain?: SolanaChain;
|
|
647
|
+
/** Optional send options */
|
|
648
|
+
options?: {
|
|
649
|
+
skipPreflight?: boolean;
|
|
650
|
+
preflightCommitment?: SolanaCommitment;
|
|
651
|
+
/** Desired commitment level for transaction confirmation. */
|
|
652
|
+
commitment?: SolanaCommitment;
|
|
653
|
+
/**
|
|
654
|
+
* The minimum slot that the request can be evaluated at.
|
|
655
|
+
* Ensures the read is not served by a node lagging behind.
|
|
656
|
+
*/
|
|
657
|
+
minContextSlot?: number;
|
|
658
|
+
maxRetries?: number;
|
|
659
|
+
};
|
|
660
|
+
}>>;
|
|
434
661
|
}
|
|
435
662
|
//#endregion
|
|
436
663
|
//#region src/methods/types/method-types.d.ts
|
|
@@ -485,4 +712,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
|
|
|
485
712
|
*/
|
|
486
713
|
declare function getMethodMinVersion(method: MethodName): Version | undefined;
|
|
487
714
|
//#endregion
|
|
488
|
-
export { type CreateEventPayload, type CreateMethodPayload, type EventName, type EventPayload, type Events, 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 };
|
|
715
|
+
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 SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
|
package/dist/index.d.mts
CHANGED
|
@@ -87,6 +87,77 @@ type PaymentWebhookStatus = 'finalized' | 'failed';
|
|
|
87
87
|
* @schema
|
|
88
88
|
*/
|
|
89
89
|
type PaymentTestScenario = 'paid' | 'paid:failed' | 'cancelled' | `error:${PaymentErrorCode}`;
|
|
90
|
+
/**
|
|
91
|
+
* Haptic impact feedback styles.
|
|
92
|
+
* Maps to UIImpactFeedbackGenerator styles on iOS
|
|
93
|
+
* and VibrationEffect on Android.
|
|
94
|
+
* @since 0.2.4
|
|
95
|
+
* @schema
|
|
96
|
+
*/
|
|
97
|
+
type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
|
|
98
|
+
/**
|
|
99
|
+
* Haptic notification feedback types.
|
|
100
|
+
* Maps to UINotificationFeedbackGenerator types on iOS.
|
|
101
|
+
* @since 0.2.4
|
|
102
|
+
* @schema
|
|
103
|
+
*/
|
|
104
|
+
type HapticNotificationType = 'success' | 'warning' | 'error';
|
|
105
|
+
/**
|
|
106
|
+
* Solana wallet error codes (WalletConnect-compatible numeric codes).
|
|
107
|
+
*
|
|
108
|
+
* These codes are identical to WalletConnect JSON-RPC error codes,
|
|
109
|
+
* so the mobile app produces the same `(code, message)` pair for
|
|
110
|
+
* both bridge and relay transports — no mapping needed.
|
|
111
|
+
*
|
|
112
|
+
* | Code | Meaning | WC Name |
|
|
113
|
+
* |------|---------|---------|
|
|
114
|
+
* | `5000` | User rejected the request | `userRejected` |
|
|
115
|
+
* | `-32602` | Invalid params (malformed transaction, bad input) | JSON-RPC standard |
|
|
116
|
+
* | `-32603` | Internal error (send failed, unexpected error) | JSON-RPC standard |
|
|
117
|
+
* | `8000` | Request expired / timed out | `sessionRequestExpired` |
|
|
118
|
+
*
|
|
119
|
+
* @since 0.3.0
|
|
120
|
+
* @schema
|
|
121
|
+
*/
|
|
122
|
+
type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
|
|
123
|
+
/**
|
|
124
|
+
* Named constants for {@link WalletSolanaErrorCode}.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { WALLET_ERROR } from '@alien_org/contract';
|
|
129
|
+
*
|
|
130
|
+
* if (response.errorCode === WALLET_ERROR.USER_REJECTED) {
|
|
131
|
+
* // user cancelled
|
|
132
|
+
* }
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @since 0.3.0
|
|
136
|
+
*/
|
|
137
|
+
declare const WALLET_ERROR: {
|
|
138
|
+
/** User rejected the request (cancelled approval screen). */
|
|
139
|
+
readonly USER_REJECTED: 5000;
|
|
140
|
+
/** Invalid params — transaction deserialization failed, malformed input. */
|
|
141
|
+
readonly INVALID_PARAMS: -32602;
|
|
142
|
+
/** Internal error — transaction broadcast failed, unexpected error. */
|
|
143
|
+
readonly INTERNAL_ERROR: -32603;
|
|
144
|
+
/** Request expired before the user responded. */
|
|
145
|
+
readonly REQUEST_EXPIRED: 8000;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Solana commitment levels for send options.
|
|
149
|
+
* @since 0.3.0
|
|
150
|
+
* @schema
|
|
151
|
+
*/
|
|
152
|
+
type SolanaCommitment = 'processed' | 'confirmed' | 'finalized';
|
|
153
|
+
/**
|
|
154
|
+
* Solana chain identifiers (wallet-standard format).
|
|
155
|
+
* Used by `wallet.solana:sign.send` to tell the host app
|
|
156
|
+
* which cluster to broadcast to.
|
|
157
|
+
* @since 0.3.0
|
|
158
|
+
* @schema
|
|
159
|
+
*/
|
|
160
|
+
type SolanaChain = 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
|
|
90
161
|
//#endregion
|
|
91
162
|
//#region src/events/types/payload.d.ts
|
|
92
163
|
/**
|
|
@@ -180,6 +251,60 @@ interface Events {
|
|
|
180
251
|
*/
|
|
181
252
|
errorCode?: 'permission_denied' | 'unavailable';
|
|
182
253
|
}>>;
|
|
254
|
+
/**
|
|
255
|
+
* Solana wallet connection response.
|
|
256
|
+
* @since 0.3.0
|
|
257
|
+
* @schema
|
|
258
|
+
*/
|
|
259
|
+
'wallet.solana:connect.response': CreateEventPayload<WithReqId<{
|
|
260
|
+
/** Base58-encoded public key of the connected wallet */
|
|
261
|
+
publicKey?: string;
|
|
262
|
+
/** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
|
|
263
|
+
errorCode?: WalletSolanaErrorCode;
|
|
264
|
+
/** Human-readable error description */
|
|
265
|
+
errorMessage?: string;
|
|
266
|
+
}>>;
|
|
267
|
+
/**
|
|
268
|
+
* Solana transaction signing response.
|
|
269
|
+
* @since 0.3.0
|
|
270
|
+
* @schema
|
|
271
|
+
*/
|
|
272
|
+
'wallet.solana:sign.transaction.response': CreateEventPayload<WithReqId<{
|
|
273
|
+
/** Base64-encoded signed transaction */
|
|
274
|
+
signedTransaction?: string;
|
|
275
|
+
/** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
|
|
276
|
+
errorCode?: WalletSolanaErrorCode;
|
|
277
|
+
/** Human-readable error description */
|
|
278
|
+
errorMessage?: string;
|
|
279
|
+
}>>;
|
|
280
|
+
/**
|
|
281
|
+
* Solana message signing response.
|
|
282
|
+
* @since 0.3.0
|
|
283
|
+
* @schema
|
|
284
|
+
*/
|
|
285
|
+
'wallet.solana:sign.message.response': CreateEventPayload<WithReqId<{
|
|
286
|
+
/** Base58-encoded Ed25519 signature (64 bytes) */
|
|
287
|
+
signature?: string;
|
|
288
|
+
/** Base58-encoded public key that signed the message */
|
|
289
|
+
publicKey?: string;
|
|
290
|
+
/** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
|
|
291
|
+
errorCode?: WalletSolanaErrorCode;
|
|
292
|
+
/** Human-readable error description */
|
|
293
|
+
errorMessage?: string;
|
|
294
|
+
}>>;
|
|
295
|
+
/**
|
|
296
|
+
* Solana sign-and-send transaction response.
|
|
297
|
+
* @since 0.3.0
|
|
298
|
+
* @schema
|
|
299
|
+
*/
|
|
300
|
+
'wallet.solana:sign.send.response': CreateEventPayload<WithReqId<{
|
|
301
|
+
/** Base58-encoded transaction signature */
|
|
302
|
+
signature?: string;
|
|
303
|
+
/** Numeric error code (WalletConnect-compatible). See {@link WalletSolanaErrorCode}. */
|
|
304
|
+
errorCode?: WalletSolanaErrorCode;
|
|
305
|
+
/** Human-readable error description */
|
|
306
|
+
errorMessage?: string;
|
|
307
|
+
}>>;
|
|
183
308
|
}
|
|
184
309
|
//#endregion
|
|
185
310
|
//#region src/events/types/event-types.d.ts
|
|
@@ -431,6 +556,108 @@ interface Methods {
|
|
|
431
556
|
*/
|
|
432
557
|
openMode?: 'external' | 'internal';
|
|
433
558
|
}>;
|
|
559
|
+
/**
|
|
560
|
+
* Trigger haptic impact feedback.
|
|
561
|
+
* Fire-and-forget — no response expected.
|
|
562
|
+
* @since 0.2.4
|
|
563
|
+
* @schema
|
|
564
|
+
*/
|
|
565
|
+
'haptic:impact': CreateMethodPayload<{
|
|
566
|
+
/**
|
|
567
|
+
* The impact feedback style.
|
|
568
|
+
* @since 0.2.4
|
|
569
|
+
* @schema
|
|
570
|
+
*/
|
|
571
|
+
style: HapticImpactStyle;
|
|
572
|
+
}>;
|
|
573
|
+
/**
|
|
574
|
+
* Trigger haptic notification feedback.
|
|
575
|
+
* Fire-and-forget — no response expected.
|
|
576
|
+
* @since 0.2.4
|
|
577
|
+
* @schema
|
|
578
|
+
*/
|
|
579
|
+
'haptic:notification': CreateMethodPayload<{
|
|
580
|
+
/**
|
|
581
|
+
* The notification feedback type.
|
|
582
|
+
* @since 0.2.4
|
|
583
|
+
* @schema
|
|
584
|
+
*/
|
|
585
|
+
type: HapticNotificationType;
|
|
586
|
+
}>;
|
|
587
|
+
/**
|
|
588
|
+
* Trigger haptic selection change feedback.
|
|
589
|
+
* Fire-and-forget — no response expected.
|
|
590
|
+
* @since 0.2.4
|
|
591
|
+
* @schema
|
|
592
|
+
*/
|
|
593
|
+
'haptic:selection': CreateMethodPayload<Empty>;
|
|
594
|
+
/**
|
|
595
|
+
* Request Solana wallet connection.
|
|
596
|
+
* Returns the wallet's public key on success.
|
|
597
|
+
* @since 0.3.0
|
|
598
|
+
* @schema
|
|
599
|
+
*/
|
|
600
|
+
'wallet.solana:connect': CreateMethodPayload<WithReqId<Empty>>;
|
|
601
|
+
/**
|
|
602
|
+
* Disconnect from Solana wallet.
|
|
603
|
+
* Fire-and-forget — no response expected.
|
|
604
|
+
* @since 0.3.0
|
|
605
|
+
* @schema
|
|
606
|
+
*/
|
|
607
|
+
'wallet.solana:disconnect': CreateMethodPayload<Empty>;
|
|
608
|
+
/**
|
|
609
|
+
* Request Solana transaction signing.
|
|
610
|
+
* Returns the signed transaction bytes.
|
|
611
|
+
* @since 0.3.0
|
|
612
|
+
* @schema
|
|
613
|
+
*/
|
|
614
|
+
'wallet.solana:sign.transaction': CreateMethodPayload<WithReqId<{
|
|
615
|
+
/** Base64-encoded serialized transaction (legacy or versioned) */
|
|
616
|
+
transaction: string;
|
|
617
|
+
}>>;
|
|
618
|
+
/**
|
|
619
|
+
* Request Solana message signing.
|
|
620
|
+
* Returns the Ed25519 signature.
|
|
621
|
+
* @since 0.3.0
|
|
622
|
+
* @schema
|
|
623
|
+
*/
|
|
624
|
+
'wallet.solana:sign.message': CreateMethodPayload<WithReqId<{
|
|
625
|
+
/** Base58-encoded message bytes */
|
|
626
|
+
message: string;
|
|
627
|
+
}>>;
|
|
628
|
+
/**
|
|
629
|
+
* Request Solana transaction signing and sending.
|
|
630
|
+
* The host app signs and broadcasts the transaction.
|
|
631
|
+
* Returns the transaction signature.
|
|
632
|
+
* @since 0.3.0
|
|
633
|
+
* @schema
|
|
634
|
+
*/
|
|
635
|
+
'wallet.solana:sign.send': CreateMethodPayload<WithReqId<{
|
|
636
|
+
/** Base64-encoded serialized transaction (legacy or versioned) */
|
|
637
|
+
transaction: string;
|
|
638
|
+
/**
|
|
639
|
+
* Target Solana cluster for broadcasting.
|
|
640
|
+
* In bridge mode the host app can infer this from miniapp config,
|
|
641
|
+
* but in relay mode (QR/WebSocket) this is required so the host
|
|
642
|
+
* app knows which RPC to broadcast to.
|
|
643
|
+
* @since 0.3.0
|
|
644
|
+
* @schema
|
|
645
|
+
*/
|
|
646
|
+
chain?: SolanaChain;
|
|
647
|
+
/** Optional send options */
|
|
648
|
+
options?: {
|
|
649
|
+
skipPreflight?: boolean;
|
|
650
|
+
preflightCommitment?: SolanaCommitment;
|
|
651
|
+
/** Desired commitment level for transaction confirmation. */
|
|
652
|
+
commitment?: SolanaCommitment;
|
|
653
|
+
/**
|
|
654
|
+
* The minimum slot that the request can be evaluated at.
|
|
655
|
+
* Ensures the read is not served by a node lagging behind.
|
|
656
|
+
*/
|
|
657
|
+
minContextSlot?: number;
|
|
658
|
+
maxRetries?: number;
|
|
659
|
+
};
|
|
660
|
+
}>>;
|
|
434
661
|
}
|
|
435
662
|
//#endregion
|
|
436
663
|
//#region src/methods/types/method-types.d.ts
|
|
@@ -485,4 +712,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
|
|
|
485
712
|
*/
|
|
486
713
|
declare function getMethodMinVersion(method: MethodName): Version | undefined;
|
|
487
714
|
//#endregion
|
|
488
|
-
export { type CreateEventPayload, type CreateMethodPayload, type EventName, type EventPayload, type Events, 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 };
|
|
715
|
+
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 SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
|
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,19 @@ const releases = {
|
|
|
14
14
|
"clipboard:write",
|
|
15
15
|
"clipboard:read"
|
|
16
16
|
],
|
|
17
|
-
"0.1.3": ["link:open"]
|
|
17
|
+
"0.1.3": ["link:open"],
|
|
18
|
+
"0.2.4": [
|
|
19
|
+
"haptic:impact",
|
|
20
|
+
"haptic:notification",
|
|
21
|
+
"haptic:selection"
|
|
22
|
+
],
|
|
23
|
+
"0.3.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
|
+
]
|
|
18
30
|
};
|
|
19
31
|
|
|
20
32
|
//#endregion
|
|
@@ -78,4 +90,27 @@ function getMethodMinVersion(method) {
|
|
|
78
90
|
}
|
|
79
91
|
|
|
80
92
|
//#endregion
|
|
81
|
-
|
|
93
|
+
//#region src/utils.ts
|
|
94
|
+
/**
|
|
95
|
+
* Named constants for {@link WalletSolanaErrorCode}.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* import { WALLET_ERROR } from '@alien_org/contract';
|
|
100
|
+
*
|
|
101
|
+
* if (response.errorCode === WALLET_ERROR.USER_REJECTED) {
|
|
102
|
+
* // user cancelled
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @since 0.3.0
|
|
107
|
+
*/
|
|
108
|
+
const WALLET_ERROR = {
|
|
109
|
+
USER_REJECTED: 5e3,
|
|
110
|
+
INVALID_PARAMS: -32602,
|
|
111
|
+
INTERNAL_ERROR: -32603,
|
|
112
|
+
REQUEST_EXPIRED: 8e3
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
export { PLATFORMS, WALLET_ERROR, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
|