@worldcoin/minikit-js 1.9.11 → 2.0.0-dev.0

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.
@@ -0,0 +1,220 @@
1
+ type EventPayload = any;
2
+ type EventHandler<E extends ResponseEvent = ResponseEvent> = (data: EventPayload) => void;
3
+ declare class EventManager {
4
+ private listeners;
5
+ subscribe<E extends ResponseEvent>(event: E, handler: EventHandler<E>): void;
6
+ unsubscribe(event: ResponseEvent): void;
7
+ trigger(event: ResponseEvent, payload: EventPayload): void;
8
+ }
9
+
10
+ type User = {
11
+ walletAddress?: string;
12
+ username?: string;
13
+ profilePictureUrl?: string;
14
+ permissions?: {
15
+ notifications: boolean;
16
+ contacts: boolean;
17
+ };
18
+ optedIntoOptionalAnalytics?: boolean;
19
+ };
20
+ type DeviceProperties = {
21
+ safeAreaInsets?: {
22
+ top: number;
23
+ right: number;
24
+ bottom: number;
25
+ left: number;
26
+ };
27
+ deviceOS?: string;
28
+ worldAppVersion?: number;
29
+ };
30
+ type UserNameService = {
31
+ walletAddress: string;
32
+ username?: string;
33
+ profilePictureUrl?: string;
34
+ };
35
+ type MiniAppLocation = {
36
+ countryCode?: string;
37
+ regionCode?: string;
38
+ };
39
+ declare enum MiniAppLaunchLocation {
40
+ Chat = "chat",
41
+ Home = "home",
42
+ AppStore = "app-store",
43
+ DeepLink = "deep-link",
44
+ WalletTab = "wallet-tab"
45
+ }
46
+ declare enum MiniKitInstallErrorCodes {
47
+ Unknown = "unknown",
48
+ AlreadyInstalled = "already_installed",
49
+ OutsideOfWorldApp = "outside_of_worldapp",
50
+ NotOnClient = "not_on_client",
51
+ AppOutOfDate = "app_out_of_date"
52
+ }
53
+ declare const MiniKitInstallErrorMessage: {
54
+ unknown: string;
55
+ already_installed: string;
56
+ outside_of_worldapp: string;
57
+ not_on_client: string;
58
+ app_out_of_date: string;
59
+ };
60
+ type MiniKitInstallReturnType = {
61
+ success: true;
62
+ } | {
63
+ success: false;
64
+ errorCode: MiniKitInstallErrorCodes;
65
+ errorMessage: (typeof MiniKitInstallErrorMessage)[MiniKitInstallErrorCodes];
66
+ };
67
+
68
+ declare enum Command {
69
+ Pay = "pay",
70
+ WalletAuth = "wallet-auth",
71
+ SendTransaction = "send-transaction",
72
+ SignMessage = "sign-message",
73
+ SignTypedData = "sign-typed-data",
74
+ ShareContacts = "share-contacts",
75
+ RequestPermission = "request-permission",
76
+ GetPermissions = "get-permissions",
77
+ SendHapticFeedback = "send-haptic-feedback",
78
+ Share = "share",
79
+ Chat = "chat"
80
+ }
81
+ declare enum ResponseEvent {
82
+ MiniAppPayment = "miniapp-payment",
83
+ MiniAppWalletAuth = "miniapp-wallet-auth",
84
+ MiniAppSendTransaction = "miniapp-send-transaction",
85
+ MiniAppSignMessage = "miniapp-sign-message",
86
+ MiniAppSignTypedData = "miniapp-sign-typed-data",
87
+ MiniAppShareContacts = "miniapp-share-contacts",
88
+ MiniAppRequestPermission = "miniapp-request-permission",
89
+ MiniAppGetPermissions = "miniapp-get-permissions",
90
+ MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
91
+ MiniAppShare = "miniapp-share",
92
+ MiniAppMicrophone = "miniapp-microphone",
93
+ MiniAppChat = "miniapp-chat"
94
+ }
95
+ declare const COMMAND_VERSIONS: Record<Command, number>;
96
+ declare function isCommandAvailable(command: Command | string): boolean;
97
+ declare function setCommandAvailable(command: Command, available: boolean): void;
98
+ declare function validateCommands(worldAppSupportedCommands: NonNullable<typeof window.WorldApp>['supported_commands']): boolean;
99
+ interface CommandState {
100
+ deviceProperties: DeviceProperties;
101
+ }
102
+ interface CommandContext {
103
+ events: EventManager;
104
+ state: CommandState;
105
+ }
106
+ type WebViewBasePayload = {
107
+ command: Command;
108
+ version: number;
109
+ payload: Record<string, any>;
110
+ };
111
+ declare function sendMiniKitEvent<T extends Record<string, any>>(payload: T): void;
112
+ type MiniAppBaseSuccessPayload = {
113
+ status: 'success';
114
+ version: number;
115
+ };
116
+ type MiniAppBaseErrorPayload<TErrorCode = string> = {
117
+ status: 'error';
118
+ error_code: TErrorCode;
119
+ version: number;
120
+ };
121
+ declare function isInWorldApp(): boolean;
122
+ type CommandVia = 'minikit' | 'wagmi' | 'fallback';
123
+ interface CommandResult<T> {
124
+ data: T;
125
+ executedWith: CommandVia;
126
+ }
127
+ type CommandResultByVia<TNative, TFallback = TNative, TViaNative extends CommandVia = Exclude<CommandVia, 'fallback'>> = {
128
+ executedWith: TViaNative;
129
+ data: TNative;
130
+ } | {
131
+ executedWith: 'fallback';
132
+ data: TFallback;
133
+ };
134
+ interface FallbackConfig<TFallback = unknown> {
135
+ /**
136
+ * Optional custom fallback executor.
137
+ * The fallback return type can differ from the native/Wagmi success payload.
138
+ */
139
+ fallback?: () => Promise<TFallback> | TFallback;
140
+ }
141
+ type FallbackReason = 'notInWorldApp' | 'commandNotSupported' | 'oldAppVersion';
142
+ declare class FallbackRequiredError extends Error {
143
+ constructor(command: string);
144
+ }
145
+ declare class CommandUnavailableError extends Error {
146
+ readonly reason: FallbackReason;
147
+ constructor(command: string, reason: FallbackReason);
148
+ }
149
+
150
+ /** @deprecated Use {@link MiniKitWalletAuthOptions} instead */
151
+ type WalletAuthInput = {
152
+ nonce: string;
153
+ statement?: string;
154
+ requestId?: string;
155
+ expirationTime?: Date;
156
+ notBefore?: Date;
157
+ };
158
+ type WalletAuthPayload = {
159
+ siweMessage: string;
160
+ };
161
+ declare enum WalletAuthErrorCodes {
162
+ MalformedRequest = "malformed_request",
163
+ UserRejected = "user_rejected",
164
+ GenericError = "generic_error"
165
+ }
166
+ declare const WalletAuthErrorMessage: {
167
+ malformed_request: string;
168
+ user_rejected: string;
169
+ generic_error: string;
170
+ };
171
+ type MiniAppWalletAuthSuccessPayload = MiniAppBaseSuccessPayload & {
172
+ message: string;
173
+ signature: string;
174
+ address: string;
175
+ };
176
+ type MiniAppWalletAuthErrorPayload = MiniAppBaseErrorPayload<WalletAuthErrorCodes> & {
177
+ details: (typeof WalletAuthErrorMessage)[WalletAuthErrorCodes];
178
+ };
179
+ type MiniAppWalletAuthPayload = MiniAppWalletAuthSuccessPayload | MiniAppWalletAuthErrorPayload;
180
+ interface MiniKitWalletAuthOptions<TCustomFallback = WalletAuthResult> extends FallbackConfig<TCustomFallback> {
181
+ /** Nonce for SIWE message (alphanumeric, at least 8 chars) */
182
+ nonce: string;
183
+ /** Optional statement to include in SIWE message */
184
+ statement?: string;
185
+ /** Optional request ID for tracking */
186
+ requestId?: string;
187
+ /** Optional expiration time for the SIWE message */
188
+ expirationTime?: Date;
189
+ /** Optional not-before time for the SIWE message */
190
+ notBefore?: Date;
191
+ }
192
+ interface WalletAuthResult {
193
+ /** Wallet address */
194
+ address: string;
195
+ /** Signed SIWE message */
196
+ message: string;
197
+ /** Signature */
198
+ signature: string;
199
+ }
200
+ type SiweMessage = {
201
+ scheme?: string;
202
+ domain: string;
203
+ address?: string;
204
+ statement?: string;
205
+ uri: string;
206
+ version: string;
207
+ chain_id: number;
208
+ nonce: string;
209
+ issued_at: string;
210
+ expiration_time?: string;
211
+ not_before?: string;
212
+ request_id?: string;
213
+ };
214
+ declare class WalletAuthError extends Error {
215
+ readonly code: string;
216
+ readonly details?: string;
217
+ constructor(code: string, details?: string);
218
+ }
219
+
220
+ export { type MiniAppWalletAuthPayload as A, WalletAuthError as B, type CommandResultByVia as C, type DeviceProperties as D, type MiniAppLocation as E, type FallbackConfig as F, MiniKitInstallErrorCodes as G, MiniKitInstallErrorMessage as H, type MiniKitWalletAuthOptions as M, ResponseEvent as R, type SiweMessage as S, type User as U, type WalletAuthResult as W, MiniAppLaunchLocation as a, type MiniKitInstallReturnType as b, type UserNameService as c, type CommandContext as d, Command as e, COMMAND_VERSIONS as f, isCommandAvailable as g, type CommandState as h, isInWorldApp as i, type WebViewBasePayload as j, sendMiniKitEvent as k, type MiniAppBaseSuccessPayload as l, type MiniAppBaseErrorPayload as m, type CommandVia as n, type CommandResult as o, type FallbackReason as p, FallbackRequiredError as q, CommandUnavailableError as r, setCommandAvailable as s, type WalletAuthInput as t, type WalletAuthPayload as u, validateCommands as v, WalletAuthErrorCodes as w, WalletAuthErrorMessage as x, type MiniAppWalletAuthSuccessPayload as y, type MiniAppWalletAuthErrorPayload as z };
@@ -0,0 +1,438 @@
1
+ import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-CKn5C-Ro.cjs';
2
+ import { Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimitiveTypes, ExtractAbiFunction, TypedData, TypedDataDomain } from 'abitype';
3
+
4
+ type ChatParams = {
5
+ to?: string[];
6
+ message: string;
7
+ };
8
+ /** @deprecated Use {@link MiniKitChatOptions} instead */
9
+ type ChatInput = ChatParams;
10
+ interface MiniKitChatOptions<TCustomFallback = MiniAppChatPayload> extends ChatParams, FallbackConfig<TCustomFallback> {
11
+ }
12
+ declare enum ChatErrorCodes {
13
+ UserRejected = "user_rejected",
14
+ SendFailed = "send_failed",
15
+ GenericError = "generic_error"
16
+ }
17
+ type MiniAppChatSuccessPayload = MiniAppBaseSuccessPayload & {
18
+ count: number;
19
+ timestamp: string;
20
+ };
21
+ type MiniAppChatErrorPayload = MiniAppBaseErrorPayload<ChatErrorCodes>;
22
+ type MiniAppChatPayload = MiniAppChatSuccessPayload | MiniAppChatErrorPayload;
23
+ declare class ChatError extends Error {
24
+ readonly error_code: ChatErrorCodes;
25
+ constructor(error_code: ChatErrorCodes);
26
+ }
27
+
28
+ declare enum GetPermissionsErrorCodes {
29
+ GenericError = "generic_error"
30
+ }
31
+ declare enum Permission {
32
+ Notifications = "notifications",
33
+ Contacts = "contacts",
34
+ Microphone = "microphone"
35
+ }
36
+ type PermissionSettings = {
37
+ [K in Permission]?: any;
38
+ };
39
+ type MiniAppGetPermissionsSuccessPayload = MiniAppBaseSuccessPayload & {
40
+ permissions: PermissionSettings;
41
+ timestamp: string;
42
+ };
43
+ type MiniAppGetPermissionsErrorPayload = MiniAppBaseErrorPayload<GetPermissionsErrorCodes> & {
44
+ details: string;
45
+ };
46
+ type MiniAppGetPermissionsPayload = MiniAppGetPermissionsSuccessPayload | MiniAppGetPermissionsErrorPayload;
47
+ interface MiniKitGetPermissionsOptions<TCustomFallback = MiniAppGetPermissionsPayload> extends FallbackConfig<TCustomFallback> {
48
+ }
49
+ declare class GetPermissionsError extends Error {
50
+ readonly error_code: GetPermissionsErrorCodes;
51
+ constructor(error_code: GetPermissionsErrorCodes);
52
+ }
53
+
54
+ declare enum Tokens {
55
+ USDC = "USDCE",
56
+ WLD = "WLD"
57
+ }
58
+ declare const TokenDecimals: {
59
+ [key in Tokens]: number;
60
+ };
61
+ declare enum Network {
62
+ Optimism = "optimism",
63
+ WorldChain = "worldchain"
64
+ }
65
+ type TokensPayload = {
66
+ symbol: Tokens;
67
+ token_amount: string;
68
+ };
69
+ /** @deprecated Use {@link MiniKitPayOptions} instead */
70
+ type PayCommandInput = {
71
+ reference: string;
72
+ to: `0x${string}` | string;
73
+ tokens: TokensPayload[];
74
+ network?: Network;
75
+ description: string;
76
+ };
77
+ /** @deprecated Use {@link MiniKitPayOptions} instead */
78
+ type PayCommandPayload = PayCommandInput;
79
+ declare enum PaymentErrorCodes {
80
+ InputError = "input_error",
81
+ UserRejected = "user_rejected",
82
+ PaymentRejected = "payment_rejected",
83
+ InvalidReceiver = "invalid_receiver",
84
+ InsufficientBalance = "insufficient_balance",
85
+ TransactionFailed = "transaction_failed",
86
+ GenericError = "generic_error",
87
+ UserBlocked = "user_blocked"
88
+ }
89
+ declare const PaymentErrorMessage: Record<PaymentErrorCodes, string>;
90
+ type MiniAppPaymentSuccessPayload = MiniAppBaseSuccessPayload & {
91
+ transaction_status: 'submitted';
92
+ transaction_id: string;
93
+ reference: string;
94
+ from: string;
95
+ chain: Network;
96
+ timestamp: string;
97
+ };
98
+ type MiniAppPaymentErrorPayload = MiniAppBaseErrorPayload<PaymentErrorCodes>;
99
+ type MiniAppPaymentPayload = MiniAppPaymentSuccessPayload | MiniAppPaymentErrorPayload;
100
+ interface MiniKitPayOptions<TCustomFallback = PayResult> extends FallbackConfig<TCustomFallback> {
101
+ /** Unique reference for this payment (for tracking) */
102
+ reference: string;
103
+ /** Recipient address */
104
+ to: `0x${string}` | string;
105
+ /** Token(s) and amount(s) to send */
106
+ tokens: TokensPayload[];
107
+ /** Payment description shown to user */
108
+ description: string;
109
+ /** Network (defaults to World Chain) */
110
+ network?: Network;
111
+ }
112
+ interface PayResult {
113
+ /** Transaction hash/ID */
114
+ transactionId: string;
115
+ /** Reference that was passed in */
116
+ reference: string;
117
+ /** From address */
118
+ from: string;
119
+ /** Chain used */
120
+ chain: Network;
121
+ /** Timestamp */
122
+ timestamp: string;
123
+ }
124
+ declare class PayError extends Error {
125
+ readonly code: string;
126
+ constructor(code: string);
127
+ }
128
+
129
+ type RequestPermissionParams = {
130
+ permission: Permission;
131
+ };
132
+ /** @deprecated Use {@link MiniKitRequestPermissionOptions} instead */
133
+ type RequestPermissionInput = RequestPermissionParams;
134
+ declare enum RequestPermissionErrorCodes {
135
+ UserRejected = "user_rejected",
136
+ GenericError = "generic_error",
137
+ AlreadyRequested = "already_requested",
138
+ PermissionDisabled = "permission_disabled",
139
+ AlreadyGranted = "already_granted",
140
+ UnsupportedPermission = "unsupported_permission"
141
+ }
142
+ type MiniAppRequestPermissionSuccessPayload = MiniAppBaseSuccessPayload & {
143
+ permission: Permission;
144
+ timestamp: string;
145
+ };
146
+ type MiniAppRequestPermissionErrorPayload = MiniAppBaseErrorPayload<RequestPermissionErrorCodes> & {
147
+ description: string;
148
+ };
149
+ type MiniAppRequestPermissionPayload = MiniAppRequestPermissionSuccessPayload | MiniAppRequestPermissionErrorPayload;
150
+ interface MiniKitRequestPermissionOptions<TCustomFallback = MiniAppRequestPermissionPayload> extends RequestPermissionParams, FallbackConfig<TCustomFallback> {
151
+ }
152
+ declare class RequestPermissionError extends Error {
153
+ readonly error_code: RequestPermissionErrorCodes;
154
+ constructor(error_code: RequestPermissionErrorCodes);
155
+ }
156
+
157
+ type SendHapticFeedbackParams = {
158
+ hapticsType: 'notification';
159
+ style: 'error' | 'success' | 'warning';
160
+ } | {
161
+ hapticsType: 'selection-changed';
162
+ style?: never;
163
+ } | {
164
+ hapticsType: 'impact';
165
+ style: 'light' | 'medium' | 'heavy';
166
+ };
167
+ /** @deprecated Use {@link MiniKitSendHapticFeedbackOptions} instead */
168
+ type SendHapticFeedbackInput = SendHapticFeedbackParams;
169
+ declare enum SendHapticFeedbackErrorCodes {
170
+ GenericError = "generic_error",
171
+ UserRejected = "user_rejected"
172
+ }
173
+ type MiniAppSendHapticFeedbackSuccessPayload = MiniAppBaseSuccessPayload & {
174
+ timestamp: string;
175
+ };
176
+ type MiniAppSendHapticFeedbackErrorPayload = MiniAppBaseErrorPayload<SendHapticFeedbackErrorCodes>;
177
+ type MiniAppSendHapticFeedbackPayload = MiniAppSendHapticFeedbackSuccessPayload | MiniAppSendHapticFeedbackErrorPayload;
178
+ type MiniKitSendHapticFeedbackOptions<TCustomFallback = MiniAppSendHapticFeedbackPayload> = SendHapticFeedbackParams & FallbackConfig<TCustomFallback>;
179
+ declare class SendHapticFeedbackError extends Error {
180
+ readonly error_code: SendHapticFeedbackErrorCodes;
181
+ constructor(error_code: SendHapticFeedbackErrorCodes);
182
+ }
183
+
184
+ type Permit2 = {
185
+ permitted: {
186
+ token: string;
187
+ amount: string | unknown;
188
+ };
189
+ spender: string;
190
+ nonce: string | unknown;
191
+ deadline: string | unknown;
192
+ };
193
+ type Transaction = {
194
+ address: string;
195
+ value?: string | undefined;
196
+ /** Raw calldata. If provided, it takes precedence over ABI/functionName/args. */
197
+ data?: string;
198
+ abi?: Abi | readonly unknown[];
199
+ functionName?: ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>;
200
+ args?: ContractFunctionArgs<Abi | readonly unknown[], 'payable' | 'nonpayable', ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>>;
201
+ };
202
+ type ContractFunctionName<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability> = ExtractAbiFunctionNames<abi extends Abi ? abi : Abi, mutability> extends infer functionName extends string ? [functionName] extends [never] ? string : functionName : string;
203
+ type ContractFunctionArgs<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability, functionName extends ContractFunctionName<abi, mutability> = ContractFunctionName<abi, mutability>> = AbiParametersToPrimitiveTypes<ExtractAbiFunction<abi extends Abi ? abi : Abi, functionName, mutability>['inputs'], 'inputs'> extends infer args ? [args] extends [never] ? readonly unknown[] : args : readonly unknown[];
204
+ /** @deprecated Use {@link MiniKitSendTransactionOptions} instead */
205
+ type SendTransactionInput = {
206
+ transaction: Transaction[];
207
+ permit2?: Permit2[];
208
+ formatPayload?: boolean;
209
+ };
210
+ /** @deprecated Use {@link MiniKitSendTransactionOptions} instead */
211
+ type SendTransactionPayload = SendTransactionInput;
212
+ declare enum SendTransactionErrorCodes {
213
+ InvalidOperation = "invalid_operation",
214
+ UserRejected = "user_rejected",
215
+ InputError = "input_error",
216
+ SimulationFailed = "simulation_failed",
217
+ TransactionFailed = "transaction_failed",
218
+ GenericError = "generic_error",
219
+ DisallowedOperation = "disallowed_operation",
220
+ ValidationError = "validation_error",
221
+ InvalidContract = "invalid_contract",
222
+ MaliciousOperation = "malicious_operation",
223
+ DailyTxLimitReached = "daily_tx_limit_reached",
224
+ PermittedAmountExceedsSlippage = "permitted_amount_exceeds_slippage",
225
+ PermittedAmountNotFound = "permitted_amount_not_found"
226
+ }
227
+ declare const SendTransactionErrorMessage: Record<SendTransactionErrorCodes, string>;
228
+ type MiniAppSendTransactionSuccessPayload = MiniAppBaseSuccessPayload & {
229
+ transaction_status: 'submitted';
230
+ transaction_id: string;
231
+ reference?: string;
232
+ from: string;
233
+ chain: Network;
234
+ timestamp: string;
235
+ userOpHash?: string;
236
+ mini_app_id?: string;
237
+ };
238
+ type MiniAppSendTransactionErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
239
+ details?: Record<string, any>;
240
+ mini_app_id?: string;
241
+ };
242
+ type MiniAppSendTransactionPayload = MiniAppSendTransactionSuccessPayload | MiniAppSendTransactionErrorPayload;
243
+ interface MiniKitSendTransactionOptions<TCustomFallback = SendTransactionResult> extends FallbackConfig<TCustomFallback> {
244
+ /** Transactions to execute */
245
+ transaction: Transaction[];
246
+ /**
247
+ * Optional chain ID to execute on.
248
+ * - World App currently only supports World Chain (480).
249
+ * - On web (wagmi fallback), this is forwarded to wagmi.
250
+ */
251
+ chainId?: number;
252
+ /** Permit2 data for token approvals (World App only) */
253
+ permit2?: Permit2[];
254
+ /** Whether to format the payload (default: true) */
255
+ formatPayload?: boolean;
256
+ }
257
+ interface SendTransactionResult {
258
+ /** On-chain transaction hash (Wagmi fallback) */
259
+ transactionHash?: string | null;
260
+ /** User operation hash (World App only) */
261
+ userOpHash?: string | null;
262
+ /** Mini App ID (World App only) */
263
+ mini_app_id?: string | null;
264
+ /** Result status */
265
+ status?: 'success' | null;
266
+ /** Payload version */
267
+ version?: number | null;
268
+ /** Transaction ID (World App only) */
269
+ transactionId?: string | null;
270
+ /** Reference (World App only) */
271
+ reference?: string | null;
272
+ /** From address */
273
+ from?: string | null;
274
+ /** Chain identifier */
275
+ chain?: string | null;
276
+ /** Timestamp */
277
+ timestamp?: string | null;
278
+ /** @deprecated Use `transactionId` instead */
279
+ transaction_id?: string | null;
280
+ /** @deprecated Success is implicit (errors throw). Always `'submitted'` when present. */
281
+ transaction_status?: 'submitted';
282
+ }
283
+ interface FeatureSupport {
284
+ /** Whether batch transactions are supported */
285
+ batch: boolean;
286
+ /** Whether Permit2 is supported */
287
+ permit2: boolean;
288
+ /** Whether gas sponsorship is available */
289
+ gasSponsorship: boolean;
290
+ }
291
+ declare const WORLD_APP_FEATURES: FeatureSupport;
292
+ declare const WEB_FEATURES: FeatureSupport;
293
+ declare class SendTransactionError extends Error {
294
+ readonly code: string;
295
+ readonly details?: Record<string, unknown>;
296
+ constructor(code: string, details?: Record<string, unknown>);
297
+ }
298
+
299
+ type ShareParams = {
300
+ files?: File[];
301
+ title?: string;
302
+ text?: string;
303
+ url?: string;
304
+ };
305
+ /** @deprecated Use {@link MiniKitShareOptions} instead */
306
+ type ShareInput = ShareParams;
307
+ interface MiniKitShareOptions<TCustomFallback = MiniAppSharePayload> extends ShareParams, FallbackConfig<TCustomFallback> {
308
+ }
309
+ type SharePayload = {
310
+ files?: Array<{
311
+ name: string;
312
+ type: string;
313
+ data: string;
314
+ }>;
315
+ title?: string;
316
+ text?: string;
317
+ url?: string;
318
+ };
319
+ declare enum ShareFilesErrorCodes {
320
+ UserRejected = "user_rejected",
321
+ GenericError = "generic_error",
322
+ InvalidFileName = "invalid_file_name"
323
+ }
324
+ type MiniAppShareSuccessPayload = MiniAppBaseSuccessPayload & {
325
+ shared_files_count: number;
326
+ timestamp: string;
327
+ };
328
+ type MiniAppShareErrorPayload = MiniAppBaseErrorPayload<ShareFilesErrorCodes>;
329
+ type MiniAppSharePayload = MiniAppShareSuccessPayload | MiniAppShareErrorPayload;
330
+ declare class ShareError extends Error {
331
+ readonly error_code: ShareFilesErrorCodes;
332
+ constructor(error_code: ShareFilesErrorCodes);
333
+ }
334
+
335
+ type ShareContactsParams = {
336
+ isMultiSelectEnabled: boolean;
337
+ inviteMessage?: string;
338
+ };
339
+ /** @deprecated Use {@link MiniKitShareContactsOptions} instead */
340
+ type ShareContactsInput = ShareContactsParams;
341
+ /** @deprecated Use {@link MiniKitShareContactsOptions} instead */
342
+ type ShareContactsPayload = ShareContactsInput;
343
+ declare enum ShareContactsErrorCodes {
344
+ UserRejected = "user_rejected",
345
+ GenericError = "generic_error"
346
+ }
347
+ declare const ShareContactsErrorMessage: {
348
+ user_rejected: string;
349
+ generic_error: string;
350
+ };
351
+ type Contact = {
352
+ username: string;
353
+ walletAddress: string;
354
+ profilePictureUrl: string | null;
355
+ };
356
+ type MiniAppShareContactsSuccessPayload = MiniAppBaseSuccessPayload & {
357
+ contacts: Contact[];
358
+ timestamp: string;
359
+ };
360
+ type MiniAppShareContactsErrorPayload = MiniAppBaseErrorPayload<ShareContactsErrorCodes>;
361
+ type MiniAppShareContactsPayload = MiniAppShareContactsSuccessPayload | MiniAppShareContactsErrorPayload;
362
+ interface MiniKitShareContactsOptions<TCustomFallback = ShareContactsResult> extends FallbackConfig<TCustomFallback> {
363
+ /** Enable multi-select in the contact picker */
364
+ isMultiSelectEnabled?: boolean;
365
+ /** Custom invite message for sharing */
366
+ inviteMessage?: string;
367
+ }
368
+ interface ShareContactsResult {
369
+ /** Selected contacts */
370
+ contacts: Contact[];
371
+ /** Timestamp */
372
+ timestamp: string;
373
+ }
374
+ declare class ShareContactsError extends Error {
375
+ readonly code: string;
376
+ constructor(code: string);
377
+ }
378
+
379
+ type SignMessageParams = {
380
+ message: string;
381
+ };
382
+ /** @deprecated Use {@link MiniKitSignMessageOptions} instead */
383
+ type SignMessageInput = SignMessageParams;
384
+ interface MiniKitSignMessageOptions<TCustomFallback = MiniAppSignMessageSuccessPayload> extends SignMessageParams, FallbackConfig<TCustomFallback> {
385
+ }
386
+ declare enum SignMessageErrorCodes {
387
+ InvalidMessage = "invalid_message",
388
+ UserRejected = "user_rejected",
389
+ GenericError = "generic_error"
390
+ }
391
+ type MiniAppSignMessageSuccessPayload = MiniAppBaseSuccessPayload & {
392
+ signature: string;
393
+ address: string;
394
+ };
395
+ type MiniAppSignMessageErrorPayload = MiniAppBaseErrorPayload<SignMessageErrorCodes> & {
396
+ details?: Record<string, any>;
397
+ };
398
+ type MiniAppSignMessagePayload = MiniAppSignMessageSuccessPayload | MiniAppSignMessageErrorPayload;
399
+ declare class SignMessageError extends Error {
400
+ readonly error_code: SignMessageErrorCodes;
401
+ constructor(error_code: SignMessageErrorCodes);
402
+ }
403
+
404
+ type SignTypedDataParams = {
405
+ types: TypedData;
406
+ primaryType: string;
407
+ message: Record<string, unknown>;
408
+ domain?: TypedDataDomain;
409
+ chainId?: number;
410
+ };
411
+ /** @deprecated Use {@link MiniKitSignTypedDataOptions} instead */
412
+ type SignTypedDataInput = SignTypedDataParams;
413
+ interface MiniKitSignTypedDataOptions<TCustomFallback = MiniAppSignTypedDataPayload> extends SignTypedDataParams, FallbackConfig<TCustomFallback> {
414
+ }
415
+ declare enum SignTypedDataErrorCodes {
416
+ InvalidOperation = "invalid_operation",
417
+ UserRejected = "user_rejected",
418
+ InputError = "input_error",
419
+ SimulationFailed = "simulation_failed",
420
+ GenericError = "generic_error",
421
+ DisallowedOperation = "disallowed_operation",
422
+ InvalidContract = "invalid_contract",
423
+ MaliciousOperation = "malicious_operation"
424
+ }
425
+ type MiniAppSignTypedDataSuccessPayload = MiniAppBaseSuccessPayload & {
426
+ signature: string;
427
+ address: string;
428
+ };
429
+ type MiniAppSignTypedDataErrorPayload = MiniAppBaseErrorPayload<SignTypedDataErrorCodes> & {
430
+ details?: Record<string, any>;
431
+ };
432
+ type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
433
+ declare class SignTypedDataError extends Error {
434
+ readonly error_code: SignTypedDataErrorCodes;
435
+ constructor(error_code: SignTypedDataErrorCodes);
436
+ }
437
+
438
+ export { type MiniAppSendHapticFeedbackErrorPayload as $, Permission as A, type PermissionSettings as B, type ChatInput as C, type MiniAppGetPermissionsErrorPayload as D, GetPermissionsError as E, TokenDecimals as F, GetPermissionsErrorCodes as G, type TokensPayload as H, type PayCommandInput as I, type PayCommandPayload as J, PaymentErrorCodes as K, PaymentErrorMessage as L, type MiniKitSendTransactionOptions as M, Network as N, type MiniAppPaymentSuccessPayload as O, type PayResult as P, type MiniAppPaymentErrorPayload as Q, type MiniAppPaymentPayload as R, type SendTransactionResult as S, Tokens as T, PayError as U, type RequestPermissionInput as V, RequestPermissionErrorCodes as W, type MiniAppRequestPermissionErrorPayload as X, RequestPermissionError as Y, type SendHapticFeedbackInput as Z, SendHapticFeedbackErrorCodes as _, type MiniKitPayOptions as a, SendHapticFeedbackError as a0, type Permit2 as a1, type Transaction as a2, type ContractFunctionName as a3, type ContractFunctionArgs as a4, type SendTransactionInput as a5, type SendTransactionPayload as a6, SendTransactionErrorCodes as a7, SendTransactionErrorMessage as a8, type MiniAppSendTransactionSuccessPayload as a9, SignTypedDataErrorCodes as aA, type MiniAppSignTypedDataErrorPayload as aB, SignTypedDataError as aC, type MiniAppSendTransactionErrorPayload as aa, type MiniAppSendTransactionPayload as ab, type FeatureSupport as ac, WORLD_APP_FEATURES as ad, WEB_FEATURES as ae, SendTransactionError as af, type ShareInput as ag, type SharePayload as ah, ShareFilesErrorCodes as ai, type MiniAppShareErrorPayload as aj, ShareError as ak, type ShareContactsInput as al, type ShareContactsPayload as am, ShareContactsErrorCodes as an, ShareContactsErrorMessage as ao, type Contact as ap, type MiniAppShareContactsSuccessPayload as aq, type MiniAppShareContactsErrorPayload as ar, type MiniAppShareContactsPayload as as, ShareContactsError as at, type SignMessageInput as au, SignMessageErrorCodes as av, type MiniAppSignMessageErrorPayload as aw, type MiniAppSignMessagePayload as ax, SignMessageError as ay, type SignTypedDataInput as az, type ShareContactsResult as b, type MiniKitShareContactsOptions as c, type MiniAppSignMessageSuccessPayload as d, type MiniKitSignMessageOptions as e, type MiniAppSignTypedDataPayload as f, type MiniKitSignTypedDataOptions as g, type MiniAppSignTypedDataSuccessPayload as h, type MiniAppChatPayload as i, type MiniKitChatOptions as j, type MiniAppChatSuccessPayload as k, type MiniAppSharePayload as l, type MiniKitShareOptions as m, type MiniAppShareSuccessPayload as n, type MiniAppGetPermissionsPayload as o, type MiniKitGetPermissionsOptions as p, type MiniAppGetPermissionsSuccessPayload as q, type MiniAppRequestPermissionPayload as r, type MiniKitRequestPermissionOptions as s, type MiniAppRequestPermissionSuccessPayload as t, type MiniAppSendHapticFeedbackPayload as u, type MiniKitSendHapticFeedbackOptions as v, type MiniAppSendHapticFeedbackSuccessPayload as w, ChatErrorCodes as x, type MiniAppChatErrorPayload as y, ChatError as z };