@alien_org/contract 1.3.1 → 2.0.0-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 +1 -1
- package/dist/index.cjs +5 -3
- package/dist/index.d.cts +80 -39
- package/dist/index.d.mts +80 -39
- package/dist/index.mjs +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ getReleaseVersion('app:ready'); // '0.0.9'
|
|
|
83
83
|
| `haptic:impact` | 0.2.4 | Trigger haptic impact feedback |
|
|
84
84
|
| `haptic:notification` | 0.2.4 | Trigger haptic notification feedback |
|
|
85
85
|
| `haptic:selection` | 0.2.4 | Trigger haptic selection feedback |
|
|
86
|
-
| `wallet.solana:connect` | 1.0.0 |
|
|
86
|
+
| `wallet.solana:connect` | 1.0.0 | Bridge/injected-wallet account authorization |
|
|
87
87
|
| `wallet.solana:disconnect` | 1.0.0 | Disconnect from Solana wallet |
|
|
88
88
|
| `wallet.solana:sign.transaction` | 1.0.0 | Sign a Solana transaction |
|
|
89
89
|
| `wallet.solana:sign.message` | 1.0.0 | Sign a Solana message |
|
package/dist/index.cjs
CHANGED
|
@@ -118,7 +118,7 @@ function getMethodMinVersion(method) {
|
|
|
118
118
|
* ```ts
|
|
119
119
|
* import { WALLET_ERROR } from '@alien_org/contract';
|
|
120
120
|
*
|
|
121
|
-
* if (response.
|
|
121
|
+
* if (response.error?.code === WALLET_ERROR.USER_REJECTED) {
|
|
122
122
|
* // user cancelled
|
|
123
123
|
* }
|
|
124
124
|
* ```
|
|
@@ -126,10 +126,12 @@ function getMethodMinVersion(method) {
|
|
|
126
126
|
* @since 1.0.0
|
|
127
127
|
*/
|
|
128
128
|
const WALLET_ERROR = {
|
|
129
|
-
USER_REJECTED:
|
|
129
|
+
USER_REJECTED: 4001,
|
|
130
|
+
TRANSACTION_REJECTED: -32003,
|
|
130
131
|
INVALID_PARAMS: -32602,
|
|
131
132
|
INTERNAL_ERROR: -32603,
|
|
132
|
-
REQUEST_EXPIRED: 8e3
|
|
133
|
+
REQUEST_EXPIRED: 8e3,
|
|
134
|
+
METHOD_NOT_FOUND: -32601
|
|
133
135
|
};
|
|
134
136
|
//#endregion
|
|
135
137
|
exports.DISPLAY_MODES = DISPLAY_MODES;
|
package/dist/index.d.cts
CHANGED
|
@@ -103,23 +103,26 @@ type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
|
|
|
103
103
|
*/
|
|
104
104
|
type HapticNotificationType = 'success' | 'warning' | 'error';
|
|
105
105
|
/**
|
|
106
|
-
* Solana wallet error codes (
|
|
106
|
+
* Solana wallet error codes (EIP-1193 / JSON-RPC 2.0 compatible).
|
|
107
107
|
*
|
|
108
|
-
* These codes
|
|
109
|
-
*
|
|
110
|
-
*
|
|
108
|
+
* These codes follow the EIP-1193 and JSON-RPC 2.0 standards so that
|
|
109
|
+
* dapp SDKs (viem, wagmi, wallet-adapter) can detect them without mapping.
|
|
110
|
+
* The mobile app produces the same `{ code, message }` pair for
|
|
111
|
+
* both bridge and relay transports.
|
|
111
112
|
*
|
|
112
|
-
* | Code | Meaning |
|
|
113
|
-
*
|
|
114
|
-
* | `
|
|
113
|
+
* | Code | Meaning | Standard |
|
|
114
|
+
* |------|---------|----------|
|
|
115
|
+
* | `4001` | User rejected the request | EIP-1193 |
|
|
116
|
+
* | `-32003` | Transaction rejected (simulation/broadcast failure) | JSON-RPC server error |
|
|
115
117
|
* | `-32602` | Invalid params (malformed transaction, bad input) | JSON-RPC standard |
|
|
116
|
-
* | `-32603` | Internal error (
|
|
117
|
-
* | `8000` | Request expired / timed out |
|
|
118
|
+
* | `-32603` | Internal error (unexpected error) | JSON-RPC standard |
|
|
119
|
+
* | `8000` | Request expired / timed out | WalletConnect |
|
|
120
|
+
* | `-32601` | Method not found (unknown wallet method) | JSON-RPC standard |
|
|
118
121
|
*
|
|
119
122
|
* @since 1.0.0
|
|
120
123
|
* @schema
|
|
121
124
|
*/
|
|
122
|
-
type WalletSolanaErrorCode =
|
|
125
|
+
type WalletSolanaErrorCode = 4001 | -32003 | -32602 | -32603 | 8000 | -32601;
|
|
123
126
|
/**
|
|
124
127
|
* Named constants for {@link WalletSolanaErrorCode}.
|
|
125
128
|
*
|
|
@@ -127,7 +130,7 @@ type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
|
|
|
127
130
|
* ```ts
|
|
128
131
|
* import { WALLET_ERROR } from '@alien_org/contract';
|
|
129
132
|
*
|
|
130
|
-
* if (response.
|
|
133
|
+
* if (response.error?.code === WALLET_ERROR.USER_REJECTED) {
|
|
131
134
|
* // user cancelled
|
|
132
135
|
* }
|
|
133
136
|
* ```
|
|
@@ -135,10 +138,12 @@ type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
|
|
|
135
138
|
* @since 1.0.0
|
|
136
139
|
*/
|
|
137
140
|
declare const WALLET_ERROR: {
|
|
138
|
-
/** User rejected the request (cancelled approval screen). */readonly USER_REJECTED:
|
|
139
|
-
readonly
|
|
141
|
+
/** User rejected the request (cancelled approval screen). EIP-1193 code 4001. */readonly USER_REJECTED: 4001; /** Transaction rejected — simulation failed or broadcast rejected by the cluster. */
|
|
142
|
+
readonly TRANSACTION_REJECTED: -32003; /** Invalid params — transaction deserialization failed, malformed input. */
|
|
143
|
+
readonly INVALID_PARAMS: -32602; /** Internal error — unexpected error. */
|
|
140
144
|
readonly INTERNAL_ERROR: -32603; /** Request expired before the user responded. */
|
|
141
|
-
readonly REQUEST_EXPIRED: 8000;
|
|
145
|
+
readonly REQUEST_EXPIRED: 8000; /** Method not found — unknown wallet method name. */
|
|
146
|
+
readonly METHOD_NOT_FOUND: -32601;
|
|
142
147
|
};
|
|
143
148
|
/**
|
|
144
149
|
* Solana commitment levels for send options.
|
|
@@ -164,6 +169,25 @@ interface CreateEventPayload<Payload = never> {
|
|
|
164
169
|
}
|
|
165
170
|
//#endregion
|
|
166
171
|
//#region src/events/definitions/events.d.ts
|
|
172
|
+
/** JSON-RPC 2.0 error payload for wallet responses. */
|
|
173
|
+
type WalletError = {
|
|
174
|
+
/** Numeric error code. See {@link WalletSolanaErrorCode}. */code: WalletSolanaErrorCode; /** Human-readable error description. */
|
|
175
|
+
message: string; /** Optional structured error details. */
|
|
176
|
+
data?: Record<string, unknown>;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* JSON-RPC 2.0 aligned wallet response envelope (discriminated union).
|
|
180
|
+
* Exactly one of `result` or `error` is present — never both, never neither.
|
|
181
|
+
* @since 1.0.0
|
|
182
|
+
* @schema
|
|
183
|
+
*/
|
|
184
|
+
type WalletResponse<TResult> = WithReqId<{
|
|
185
|
+
result: TResult;
|
|
186
|
+
error?: never;
|
|
187
|
+
} | {
|
|
188
|
+
result?: never /** Error payload. */;
|
|
189
|
+
error: WalletError;
|
|
190
|
+
}>;
|
|
167
191
|
/**
|
|
168
192
|
* Events interface defining all available events and their payloads.
|
|
169
193
|
* @since 0.0.1
|
|
@@ -243,44 +267,40 @@ interface Events {
|
|
|
243
267
|
}>>;
|
|
244
268
|
/**
|
|
245
269
|
* Solana wallet connection response.
|
|
270
|
+
* Uses JSON-RPC 2.0 aligned `result`/`error` envelope.
|
|
246
271
|
* @since 1.0.0
|
|
247
272
|
* @schema
|
|
248
273
|
*/
|
|
249
|
-
'wallet.solana:connect.response': CreateEventPayload<
|
|
250
|
-
/** Base58-encoded public key of the connected wallet */publicKey
|
|
251
|
-
errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
|
|
252
|
-
errorMessage?: string;
|
|
274
|
+
'wallet.solana:connect.response': CreateEventPayload<WalletResponse<{
|
|
275
|
+
/** Base58-encoded public key of the connected wallet */publicKey: string;
|
|
253
276
|
}>>;
|
|
254
277
|
/**
|
|
255
278
|
* Solana transaction signing response.
|
|
279
|
+
* Uses JSON-RPC 2.0 aligned `result`/`error` envelope.
|
|
256
280
|
* @since 1.0.0
|
|
257
281
|
* @schema
|
|
258
282
|
*/
|
|
259
|
-
'wallet.solana:sign.transaction.response': CreateEventPayload<
|
|
260
|
-
/** Base64-encoded signed transaction */
|
|
261
|
-
errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
|
|
262
|
-
errorMessage?: string;
|
|
283
|
+
'wallet.solana:sign.transaction.response': CreateEventPayload<WalletResponse<{
|
|
284
|
+
/** Base64-encoded signed transaction */transaction: string;
|
|
263
285
|
}>>;
|
|
264
286
|
/**
|
|
265
287
|
* Solana message signing response.
|
|
288
|
+
* Uses JSON-RPC 2.0 aligned `result`/`error` envelope.
|
|
266
289
|
* @since 1.0.0
|
|
267
290
|
* @schema
|
|
268
291
|
*/
|
|
269
|
-
'wallet.solana:sign.message.response': CreateEventPayload<
|
|
270
|
-
/** Base58-encoded Ed25519 signature (64 bytes) */signature
|
|
271
|
-
publicKey
|
|
272
|
-
errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
|
|
273
|
-
errorMessage?: string;
|
|
292
|
+
'wallet.solana:sign.message.response': CreateEventPayload<WalletResponse<{
|
|
293
|
+
/** Base58-encoded Ed25519 signature (64 bytes) */signature: string; /** Base58-encoded public key that produced the signature */
|
|
294
|
+
publicKey: string;
|
|
274
295
|
}>>;
|
|
275
296
|
/**
|
|
276
297
|
* Solana sign-and-send transaction response.
|
|
298
|
+
* Uses JSON-RPC 2.0 aligned `result`/`error` envelope.
|
|
277
299
|
* @since 1.0.0
|
|
278
300
|
* @schema
|
|
279
301
|
*/
|
|
280
|
-
'wallet.solana:sign.send.response': CreateEventPayload<
|
|
281
|
-
/** Base58-encoded transaction signature */signature
|
|
282
|
-
errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
|
|
283
|
-
errorMessage?: string;
|
|
302
|
+
'wallet.solana:sign.send.response': CreateEventPayload<WalletResponse<{
|
|
303
|
+
/** Base58-encoded transaction signature */signature: string;
|
|
284
304
|
}>>;
|
|
285
305
|
}
|
|
286
306
|
//#endregion
|
|
@@ -597,8 +617,10 @@ interface Methods {
|
|
|
597
617
|
*/
|
|
598
618
|
'haptic:selection': CreateMethodPayload<Empty>;
|
|
599
619
|
/**
|
|
600
|
-
* Request Solana wallet connection.
|
|
601
|
-
*
|
|
620
|
+
* Request Solana wallet connection in bridge/injected mode.
|
|
621
|
+
* This is the bridge wrapper around the injected-wallet account
|
|
622
|
+
* authorization step and returns the wallet's public key on success.
|
|
623
|
+
* WalletConnect relay uses account RPC methods instead.
|
|
602
624
|
* @since 1.0.0
|
|
603
625
|
* @schema
|
|
604
626
|
*/
|
|
@@ -617,7 +639,20 @@ interface Methods {
|
|
|
617
639
|
* @schema
|
|
618
640
|
*/
|
|
619
641
|
'wallet.solana:sign.transaction': CreateMethodPayload<WithReqId<{
|
|
620
|
-
/** Base64-encoded serialized transaction (legacy or versioned) */transaction: string;
|
|
642
|
+
/** Base64-encoded serialized transaction (legacy or versioned) */transaction: string; /** Base58-encoded public key of the signing account */
|
|
643
|
+
pubkey?: string;
|
|
644
|
+
/**
|
|
645
|
+
* Target Solana cluster.
|
|
646
|
+
* Optional in bridge mode (host app infers from config),
|
|
647
|
+
* but may be forwarded for simulation context.
|
|
648
|
+
* @since 1.0.0
|
|
649
|
+
* @schema
|
|
650
|
+
*/
|
|
651
|
+
chain?: SolanaChain; /** Optional simulation/preflight options */
|
|
652
|
+
options?: {
|
|
653
|
+
/** Preflight commitment level. */preflightCommitment?: SolanaCommitment; /** Minimum slot that the request can be evaluated at. */
|
|
654
|
+
minContextSlot?: number;
|
|
655
|
+
};
|
|
621
656
|
}>>;
|
|
622
657
|
/**
|
|
623
658
|
* Request Solana message signing.
|
|
@@ -626,7 +661,8 @@ interface Methods {
|
|
|
626
661
|
* @schema
|
|
627
662
|
*/
|
|
628
663
|
'wallet.solana:sign.message': CreateMethodPayload<WithReqId<{
|
|
629
|
-
/** Base58-encoded message bytes */message: string;
|
|
664
|
+
/** Base58-encoded message bytes */message: string; /** Base58-encoded public key of the signing account */
|
|
665
|
+
pubkey?: string;
|
|
630
666
|
}>>;
|
|
631
667
|
/**
|
|
632
668
|
* Request Solana transaction signing and sending.
|
|
@@ -636,7 +672,8 @@ interface Methods {
|
|
|
636
672
|
* @schema
|
|
637
673
|
*/
|
|
638
674
|
'wallet.solana:sign.send': CreateMethodPayload<WithReqId<{
|
|
639
|
-
/** Base64-encoded serialized transaction (legacy or versioned) */transaction: string;
|
|
675
|
+
/** Base64-encoded serialized transaction (legacy or versioned) */transaction: string; /** Base58-encoded public key of the signing account */
|
|
676
|
+
pubkey?: string;
|
|
640
677
|
/**
|
|
641
678
|
* Target Solana cluster for broadcasting.
|
|
642
679
|
* In bridge mode the host app can infer this from miniapp config,
|
|
@@ -645,8 +682,12 @@ interface Methods {
|
|
|
645
682
|
* @since 1.0.0
|
|
646
683
|
* @schema
|
|
647
684
|
*/
|
|
648
|
-
chain?: SolanaChain;
|
|
649
|
-
|
|
685
|
+
chain?: SolanaChain;
|
|
686
|
+
/**
|
|
687
|
+
* Send options passed to Solana RPC `sendTransaction`.
|
|
688
|
+
* Field name matches WalletConnect `solana_signAndSendTransaction`.
|
|
689
|
+
*/
|
|
690
|
+
sendOptions?: {
|
|
650
691
|
skipPreflight?: boolean;
|
|
651
692
|
preflightCommitment?: SolanaCommitment; /** Desired commitment level for transaction confirmation. */
|
|
652
693
|
commitment?: SolanaCommitment;
|
|
@@ -712,4 +753,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
|
|
|
712
753
|
*/
|
|
713
754
|
declare function getMethodMinVersion(method: MethodName): Version | undefined;
|
|
714
755
|
//#endregion
|
|
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 };
|
|
756
|
+
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 WalletError, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
|
package/dist/index.d.mts
CHANGED
|
@@ -103,23 +103,26 @@ type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
|
|
|
103
103
|
*/
|
|
104
104
|
type HapticNotificationType = 'success' | 'warning' | 'error';
|
|
105
105
|
/**
|
|
106
|
-
* Solana wallet error codes (
|
|
106
|
+
* Solana wallet error codes (EIP-1193 / JSON-RPC 2.0 compatible).
|
|
107
107
|
*
|
|
108
|
-
* These codes
|
|
109
|
-
*
|
|
110
|
-
*
|
|
108
|
+
* These codes follow the EIP-1193 and JSON-RPC 2.0 standards so that
|
|
109
|
+
* dapp SDKs (viem, wagmi, wallet-adapter) can detect them without mapping.
|
|
110
|
+
* The mobile app produces the same `{ code, message }` pair for
|
|
111
|
+
* both bridge and relay transports.
|
|
111
112
|
*
|
|
112
|
-
* | Code | Meaning |
|
|
113
|
-
*
|
|
114
|
-
* | `
|
|
113
|
+
* | Code | Meaning | Standard |
|
|
114
|
+
* |------|---------|----------|
|
|
115
|
+
* | `4001` | User rejected the request | EIP-1193 |
|
|
116
|
+
* | `-32003` | Transaction rejected (simulation/broadcast failure) | JSON-RPC server error |
|
|
115
117
|
* | `-32602` | Invalid params (malformed transaction, bad input) | JSON-RPC standard |
|
|
116
|
-
* | `-32603` | Internal error (
|
|
117
|
-
* | `8000` | Request expired / timed out |
|
|
118
|
+
* | `-32603` | Internal error (unexpected error) | JSON-RPC standard |
|
|
119
|
+
* | `8000` | Request expired / timed out | WalletConnect |
|
|
120
|
+
* | `-32601` | Method not found (unknown wallet method) | JSON-RPC standard |
|
|
118
121
|
*
|
|
119
122
|
* @since 1.0.0
|
|
120
123
|
* @schema
|
|
121
124
|
*/
|
|
122
|
-
type WalletSolanaErrorCode =
|
|
125
|
+
type WalletSolanaErrorCode = 4001 | -32003 | -32602 | -32603 | 8000 | -32601;
|
|
123
126
|
/**
|
|
124
127
|
* Named constants for {@link WalletSolanaErrorCode}.
|
|
125
128
|
*
|
|
@@ -127,7 +130,7 @@ type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
|
|
|
127
130
|
* ```ts
|
|
128
131
|
* import { WALLET_ERROR } from '@alien_org/contract';
|
|
129
132
|
*
|
|
130
|
-
* if (response.
|
|
133
|
+
* if (response.error?.code === WALLET_ERROR.USER_REJECTED) {
|
|
131
134
|
* // user cancelled
|
|
132
135
|
* }
|
|
133
136
|
* ```
|
|
@@ -135,10 +138,12 @@ type WalletSolanaErrorCode = 5000 | -32602 | -32603 | 8000;
|
|
|
135
138
|
* @since 1.0.0
|
|
136
139
|
*/
|
|
137
140
|
declare const WALLET_ERROR: {
|
|
138
|
-
/** User rejected the request (cancelled approval screen). */readonly USER_REJECTED:
|
|
139
|
-
readonly
|
|
141
|
+
/** User rejected the request (cancelled approval screen). EIP-1193 code 4001. */readonly USER_REJECTED: 4001; /** Transaction rejected — simulation failed or broadcast rejected by the cluster. */
|
|
142
|
+
readonly TRANSACTION_REJECTED: -32003; /** Invalid params — transaction deserialization failed, malformed input. */
|
|
143
|
+
readonly INVALID_PARAMS: -32602; /** Internal error — unexpected error. */
|
|
140
144
|
readonly INTERNAL_ERROR: -32603; /** Request expired before the user responded. */
|
|
141
|
-
readonly REQUEST_EXPIRED: 8000;
|
|
145
|
+
readonly REQUEST_EXPIRED: 8000; /** Method not found — unknown wallet method name. */
|
|
146
|
+
readonly METHOD_NOT_FOUND: -32601;
|
|
142
147
|
};
|
|
143
148
|
/**
|
|
144
149
|
* Solana commitment levels for send options.
|
|
@@ -164,6 +169,25 @@ interface CreateEventPayload<Payload = never> {
|
|
|
164
169
|
}
|
|
165
170
|
//#endregion
|
|
166
171
|
//#region src/events/definitions/events.d.ts
|
|
172
|
+
/** JSON-RPC 2.0 error payload for wallet responses. */
|
|
173
|
+
type WalletError = {
|
|
174
|
+
/** Numeric error code. See {@link WalletSolanaErrorCode}. */code: WalletSolanaErrorCode; /** Human-readable error description. */
|
|
175
|
+
message: string; /** Optional structured error details. */
|
|
176
|
+
data?: Record<string, unknown>;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* JSON-RPC 2.0 aligned wallet response envelope (discriminated union).
|
|
180
|
+
* Exactly one of `result` or `error` is present — never both, never neither.
|
|
181
|
+
* @since 1.0.0
|
|
182
|
+
* @schema
|
|
183
|
+
*/
|
|
184
|
+
type WalletResponse<TResult> = WithReqId<{
|
|
185
|
+
result: TResult;
|
|
186
|
+
error?: never;
|
|
187
|
+
} | {
|
|
188
|
+
result?: never /** Error payload. */;
|
|
189
|
+
error: WalletError;
|
|
190
|
+
}>;
|
|
167
191
|
/**
|
|
168
192
|
* Events interface defining all available events and their payloads.
|
|
169
193
|
* @since 0.0.1
|
|
@@ -243,44 +267,40 @@ interface Events {
|
|
|
243
267
|
}>>;
|
|
244
268
|
/**
|
|
245
269
|
* Solana wallet connection response.
|
|
270
|
+
* Uses JSON-RPC 2.0 aligned `result`/`error` envelope.
|
|
246
271
|
* @since 1.0.0
|
|
247
272
|
* @schema
|
|
248
273
|
*/
|
|
249
|
-
'wallet.solana:connect.response': CreateEventPayload<
|
|
250
|
-
/** Base58-encoded public key of the connected wallet */publicKey
|
|
251
|
-
errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
|
|
252
|
-
errorMessage?: string;
|
|
274
|
+
'wallet.solana:connect.response': CreateEventPayload<WalletResponse<{
|
|
275
|
+
/** Base58-encoded public key of the connected wallet */publicKey: string;
|
|
253
276
|
}>>;
|
|
254
277
|
/**
|
|
255
278
|
* Solana transaction signing response.
|
|
279
|
+
* Uses JSON-RPC 2.0 aligned `result`/`error` envelope.
|
|
256
280
|
* @since 1.0.0
|
|
257
281
|
* @schema
|
|
258
282
|
*/
|
|
259
|
-
'wallet.solana:sign.transaction.response': CreateEventPayload<
|
|
260
|
-
/** Base64-encoded signed transaction */
|
|
261
|
-
errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
|
|
262
|
-
errorMessage?: string;
|
|
283
|
+
'wallet.solana:sign.transaction.response': CreateEventPayload<WalletResponse<{
|
|
284
|
+
/** Base64-encoded signed transaction */transaction: string;
|
|
263
285
|
}>>;
|
|
264
286
|
/**
|
|
265
287
|
* Solana message signing response.
|
|
288
|
+
* Uses JSON-RPC 2.0 aligned `result`/`error` envelope.
|
|
266
289
|
* @since 1.0.0
|
|
267
290
|
* @schema
|
|
268
291
|
*/
|
|
269
|
-
'wallet.solana:sign.message.response': CreateEventPayload<
|
|
270
|
-
/** Base58-encoded Ed25519 signature (64 bytes) */signature
|
|
271
|
-
publicKey
|
|
272
|
-
errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
|
|
273
|
-
errorMessage?: string;
|
|
292
|
+
'wallet.solana:sign.message.response': CreateEventPayload<WalletResponse<{
|
|
293
|
+
/** Base58-encoded Ed25519 signature (64 bytes) */signature: string; /** Base58-encoded public key that produced the signature */
|
|
294
|
+
publicKey: string;
|
|
274
295
|
}>>;
|
|
275
296
|
/**
|
|
276
297
|
* Solana sign-and-send transaction response.
|
|
298
|
+
* Uses JSON-RPC 2.0 aligned `result`/`error` envelope.
|
|
277
299
|
* @since 1.0.0
|
|
278
300
|
* @schema
|
|
279
301
|
*/
|
|
280
|
-
'wallet.solana:sign.send.response': CreateEventPayload<
|
|
281
|
-
/** Base58-encoded transaction signature */signature
|
|
282
|
-
errorCode?: WalletSolanaErrorCode; /** Human-readable error description */
|
|
283
|
-
errorMessage?: string;
|
|
302
|
+
'wallet.solana:sign.send.response': CreateEventPayload<WalletResponse<{
|
|
303
|
+
/** Base58-encoded transaction signature */signature: string;
|
|
284
304
|
}>>;
|
|
285
305
|
}
|
|
286
306
|
//#endregion
|
|
@@ -597,8 +617,10 @@ interface Methods {
|
|
|
597
617
|
*/
|
|
598
618
|
'haptic:selection': CreateMethodPayload<Empty>;
|
|
599
619
|
/**
|
|
600
|
-
* Request Solana wallet connection.
|
|
601
|
-
*
|
|
620
|
+
* Request Solana wallet connection in bridge/injected mode.
|
|
621
|
+
* This is the bridge wrapper around the injected-wallet account
|
|
622
|
+
* authorization step and returns the wallet's public key on success.
|
|
623
|
+
* WalletConnect relay uses account RPC methods instead.
|
|
602
624
|
* @since 1.0.0
|
|
603
625
|
* @schema
|
|
604
626
|
*/
|
|
@@ -617,7 +639,20 @@ interface Methods {
|
|
|
617
639
|
* @schema
|
|
618
640
|
*/
|
|
619
641
|
'wallet.solana:sign.transaction': CreateMethodPayload<WithReqId<{
|
|
620
|
-
/** Base64-encoded serialized transaction (legacy or versioned) */transaction: string;
|
|
642
|
+
/** Base64-encoded serialized transaction (legacy or versioned) */transaction: string; /** Base58-encoded public key of the signing account */
|
|
643
|
+
pubkey?: string;
|
|
644
|
+
/**
|
|
645
|
+
* Target Solana cluster.
|
|
646
|
+
* Optional in bridge mode (host app infers from config),
|
|
647
|
+
* but may be forwarded for simulation context.
|
|
648
|
+
* @since 1.0.0
|
|
649
|
+
* @schema
|
|
650
|
+
*/
|
|
651
|
+
chain?: SolanaChain; /** Optional simulation/preflight options */
|
|
652
|
+
options?: {
|
|
653
|
+
/** Preflight commitment level. */preflightCommitment?: SolanaCommitment; /** Minimum slot that the request can be evaluated at. */
|
|
654
|
+
minContextSlot?: number;
|
|
655
|
+
};
|
|
621
656
|
}>>;
|
|
622
657
|
/**
|
|
623
658
|
* Request Solana message signing.
|
|
@@ -626,7 +661,8 @@ interface Methods {
|
|
|
626
661
|
* @schema
|
|
627
662
|
*/
|
|
628
663
|
'wallet.solana:sign.message': CreateMethodPayload<WithReqId<{
|
|
629
|
-
/** Base58-encoded message bytes */message: string;
|
|
664
|
+
/** Base58-encoded message bytes */message: string; /** Base58-encoded public key of the signing account */
|
|
665
|
+
pubkey?: string;
|
|
630
666
|
}>>;
|
|
631
667
|
/**
|
|
632
668
|
* Request Solana transaction signing and sending.
|
|
@@ -636,7 +672,8 @@ interface Methods {
|
|
|
636
672
|
* @schema
|
|
637
673
|
*/
|
|
638
674
|
'wallet.solana:sign.send': CreateMethodPayload<WithReqId<{
|
|
639
|
-
/** Base64-encoded serialized transaction (legacy or versioned) */transaction: string;
|
|
675
|
+
/** Base64-encoded serialized transaction (legacy or versioned) */transaction: string; /** Base58-encoded public key of the signing account */
|
|
676
|
+
pubkey?: string;
|
|
640
677
|
/**
|
|
641
678
|
* Target Solana cluster for broadcasting.
|
|
642
679
|
* In bridge mode the host app can infer this from miniapp config,
|
|
@@ -645,8 +682,12 @@ interface Methods {
|
|
|
645
682
|
* @since 1.0.0
|
|
646
683
|
* @schema
|
|
647
684
|
*/
|
|
648
|
-
chain?: SolanaChain;
|
|
649
|
-
|
|
685
|
+
chain?: SolanaChain;
|
|
686
|
+
/**
|
|
687
|
+
* Send options passed to Solana RPC `sendTransaction`.
|
|
688
|
+
* Field name matches WalletConnect `solana_signAndSendTransaction`.
|
|
689
|
+
*/
|
|
690
|
+
sendOptions?: {
|
|
650
691
|
skipPreflight?: boolean;
|
|
651
692
|
preflightCommitment?: SolanaCommitment; /** Desired commitment level for transaction confirmation. */
|
|
652
693
|
commitment?: SolanaCommitment;
|
|
@@ -712,4 +753,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
|
|
|
712
753
|
*/
|
|
713
754
|
declare function getMethodMinVersion(method: MethodName): Version | undefined;
|
|
714
755
|
//#endregion
|
|
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 };
|
|
756
|
+
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 WalletError, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
|
package/dist/index.mjs
CHANGED
|
@@ -117,7 +117,7 @@ function getMethodMinVersion(method) {
|
|
|
117
117
|
* ```ts
|
|
118
118
|
* import { WALLET_ERROR } from '@alien_org/contract';
|
|
119
119
|
*
|
|
120
|
-
* if (response.
|
|
120
|
+
* if (response.error?.code === WALLET_ERROR.USER_REJECTED) {
|
|
121
121
|
* // user cancelled
|
|
122
122
|
* }
|
|
123
123
|
* ```
|
|
@@ -125,10 +125,12 @@ function getMethodMinVersion(method) {
|
|
|
125
125
|
* @since 1.0.0
|
|
126
126
|
*/
|
|
127
127
|
const WALLET_ERROR = {
|
|
128
|
-
USER_REJECTED:
|
|
128
|
+
USER_REJECTED: 4001,
|
|
129
|
+
TRANSACTION_REJECTED: -32003,
|
|
129
130
|
INVALID_PARAMS: -32602,
|
|
130
131
|
INTERNAL_ERROR: -32603,
|
|
131
|
-
REQUEST_EXPIRED: 8e3
|
|
132
|
+
REQUEST_EXPIRED: 8e3,
|
|
133
|
+
METHOD_NOT_FOUND: -32601
|
|
132
134
|
};
|
|
133
135
|
//#endregion
|
|
134
136
|
export { DISPLAY_MODES, PLATFORMS, WALLET_ERROR, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
|