@alien_org/contract 0.2.4 → 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 +31 -0
- package/dist/index.d.cts +178 -1
- package/dist/index.d.mts +178 -1
- package/dist/index.mjs +31 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,13 @@ const releases = {
|
|
|
20
20
|
"haptic:impact",
|
|
21
21
|
"haptic:notification",
|
|
22
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"
|
|
23
30
|
]
|
|
24
31
|
};
|
|
25
32
|
|
|
@@ -83,8 +90,32 @@ function getMethodMinVersion(method) {
|
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
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
|
+
|
|
86
116
|
//#endregion
|
|
87
117
|
exports.PLATFORMS = PLATFORMS;
|
|
118
|
+
exports.WALLET_ERROR = WALLET_ERROR;
|
|
88
119
|
exports.getMethodMinVersion = getMethodMinVersion;
|
|
89
120
|
exports.getReleaseVersion = getReleaseVersion;
|
|
90
121
|
exports.isMethodSupported = isMethodSupported;
|
package/dist/index.d.cts
CHANGED
|
@@ -102,6 +102,62 @@ type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
|
|
|
102
102
|
* @schema
|
|
103
103
|
*/
|
|
104
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';
|
|
105
161
|
//#endregion
|
|
106
162
|
//#region src/events/types/payload.d.ts
|
|
107
163
|
/**
|
|
@@ -195,6 +251,60 @@ interface Events {
|
|
|
195
251
|
*/
|
|
196
252
|
errorCode?: 'permission_denied' | 'unavailable';
|
|
197
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
|
+
}>>;
|
|
198
308
|
}
|
|
199
309
|
//#endregion
|
|
200
310
|
//#region src/events/types/event-types.d.ts
|
|
@@ -481,6 +591,73 @@ interface Methods {
|
|
|
481
591
|
* @schema
|
|
482
592
|
*/
|
|
483
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
|
+
}>>;
|
|
484
661
|
}
|
|
485
662
|
//#endregion
|
|
486
663
|
//#region src/methods/types/method-types.d.ts
|
|
@@ -535,4 +712,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
|
|
|
535
712
|
*/
|
|
536
713
|
declare function getMethodMinVersion(method: MethodName): Version | undefined;
|
|
537
714
|
//#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 };
|
|
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
|
@@ -102,6 +102,62 @@ type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
|
|
|
102
102
|
* @schema
|
|
103
103
|
*/
|
|
104
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';
|
|
105
161
|
//#endregion
|
|
106
162
|
//#region src/events/types/payload.d.ts
|
|
107
163
|
/**
|
|
@@ -195,6 +251,60 @@ interface Events {
|
|
|
195
251
|
*/
|
|
196
252
|
errorCode?: 'permission_denied' | 'unavailable';
|
|
197
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
|
+
}>>;
|
|
198
308
|
}
|
|
199
309
|
//#endregion
|
|
200
310
|
//#region src/events/types/event-types.d.ts
|
|
@@ -481,6 +591,73 @@ interface Methods {
|
|
|
481
591
|
* @schema
|
|
482
592
|
*/
|
|
483
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
|
+
}>>;
|
|
484
661
|
}
|
|
485
662
|
//#endregion
|
|
486
663
|
//#region src/methods/types/method-types.d.ts
|
|
@@ -535,4 +712,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
|
|
|
535
712
|
*/
|
|
536
713
|
declare function getMethodMinVersion(method: MethodName): Version | undefined;
|
|
537
714
|
//#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 };
|
|
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
|
@@ -19,6 +19,13 @@ const releases = {
|
|
|
19
19
|
"haptic:impact",
|
|
20
20
|
"haptic:notification",
|
|
21
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"
|
|
22
29
|
]
|
|
23
30
|
};
|
|
24
31
|
|
|
@@ -83,4 +90,27 @@ function getMethodMinVersion(method) {
|
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
//#endregion
|
|
86
|
-
|
|
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 };
|