@worldcoin/minikit-js 1.11.0 → 2.0.0-dev.1
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 +107 -0
- package/build/address-book.cjs +81 -0
- package/build/address-book.d.cts +3 -0
- package/build/address-book.d.ts +3 -0
- package/build/address-book.js +54 -0
- package/build/chunk-2UPJKPQ6.js +272 -0
- package/build/chunk-EHBM7OXH.js +596 -0
- package/build/chunk-LHHKY77D.js +274 -0
- package/build/chunk-TGXD24YD.js +279 -0
- package/build/chunk-Z2UGRZJ2.js +1635 -0
- package/build/command-exports.cjs +1762 -0
- package/build/command-exports.d.cts +105 -0
- package/build/command-exports.d.ts +105 -0
- package/build/command-exports.js +129 -0
- package/build/connector/index.cjs +2601 -0
- package/build/connector/index.d.cts +55 -0
- package/build/connector/index.d.ts +55 -0
- package/build/connector/index.js +90 -0
- package/build/index.cjs +1634 -1627
- package/build/index.d.cts +143 -671
- package/build/index.d.ts +143 -671
- package/build/index.js +7 -206
- package/build/minikit-provider.cjs +1650 -948
- package/build/minikit-provider.d.cts +2 -1
- package/build/minikit-provider.d.ts +2 -1
- package/build/minikit-provider.js +13 -2
- package/build/provider-DeDUsLbs.d.cts +43 -0
- package/build/provider-DeDUsLbs.d.ts +43 -0
- package/build/siwe-exports.cjs +249 -0
- package/build/siwe-exports.d.cts +10 -0
- package/build/siwe-exports.d.ts +10 -0
- package/build/siwe-exports.js +8 -0
- package/build/types-CC2x79HX.d.ts +525 -0
- package/build/types-CSyzFDPt.d.cts +223 -0
- package/build/types-CSyzFDPt.d.ts +223 -0
- package/build/types-_jfLbcJW.d.cts +525 -0
- package/package.json +73 -11
- package/build/chunk-62NZ34E4.js +0 -2092
- package/index.ts +0 -29
package/build/index.d.cts
CHANGED
|
@@ -1,643 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
import { Client } from 'viem';
|
|
6
|
-
|
|
7
|
-
type User = {
|
|
8
|
-
walletAddress?: string;
|
|
9
|
-
username?: string;
|
|
10
|
-
profilePictureUrl?: string;
|
|
11
|
-
permissions?: {
|
|
12
|
-
notifications: boolean;
|
|
13
|
-
contacts: boolean;
|
|
14
|
-
};
|
|
15
|
-
optedIntoOptionalAnalytics?: boolean;
|
|
16
|
-
preferredCurrency?: string;
|
|
17
|
-
/** @deprecated Moved to DeviceProperties */
|
|
18
|
-
worldAppVersion?: number;
|
|
19
|
-
/** @deprecated Moved to DeviceProperties */
|
|
20
|
-
deviceOS?: string;
|
|
21
|
-
};
|
|
22
|
-
type DeviceProperties = {
|
|
23
|
-
safeAreaInsets?: {
|
|
24
|
-
top: number;
|
|
25
|
-
right: number;
|
|
26
|
-
bottom: number;
|
|
27
|
-
left: number;
|
|
28
|
-
};
|
|
29
|
-
deviceOS?: string;
|
|
30
|
-
worldAppVersion?: number;
|
|
31
|
-
};
|
|
32
|
-
type UserNameService = {
|
|
33
|
-
walletAddress: string;
|
|
34
|
-
username?: string;
|
|
35
|
-
profilePictureUrl?: string;
|
|
36
|
-
};
|
|
37
|
-
type MiniAppLocation = {
|
|
38
|
-
countryCode?: string;
|
|
39
|
-
regionCode?: string;
|
|
40
|
-
};
|
|
41
|
-
declare enum MiniAppLaunchLocation {
|
|
42
|
-
Chat = "chat",
|
|
43
|
-
Home = "home",
|
|
44
|
-
AppStore = "app-store",
|
|
45
|
-
DeepLink = "deep-link",
|
|
46
|
-
WalletTab = "wallet-tab"
|
|
47
|
-
}
|
|
48
|
-
declare const mapWorldAppLaunchLocation: (location: string | null | undefined) => MiniAppLaunchLocation | null;
|
|
49
|
-
|
|
50
|
-
type EventPayload<T extends ResponseEvent = ResponseEvent> = any;
|
|
51
|
-
type EventHandler<E extends ResponseEvent = ResponseEvent> = <T extends EventPayload<E>>(data: T) => void;
|
|
52
|
-
declare class EventManager {
|
|
53
|
-
private listeners;
|
|
54
|
-
private verifyActionProcessingOptionsQueue;
|
|
55
|
-
subscribe<E extends ResponseEvent>(event: E, handler: EventHandler<E>): void;
|
|
56
|
-
unsubscribe(event: ResponseEvent): void;
|
|
57
|
-
setVerifyActionProcessingOptions(options?: {
|
|
58
|
-
skip_proof_compression?: boolean;
|
|
59
|
-
}): void;
|
|
60
|
-
trigger(event: ResponseEvent, payload: EventPayload): void;
|
|
61
|
-
private processVerifyActionPayload;
|
|
62
|
-
private compressProofSafely;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare class MiniKitState {
|
|
66
|
-
appId: string | null;
|
|
67
|
-
user: User;
|
|
68
|
-
deviceProperties: DeviceProperties;
|
|
69
|
-
location: MiniAppLaunchLocation | null;
|
|
70
|
-
isReady: boolean;
|
|
71
|
-
initFromWorldApp(worldApp: typeof window.WorldApp): void;
|
|
72
|
-
updateUserFromWalletAuth(address: string): Promise<void>;
|
|
73
|
-
getUserByAddress(address?: string): Promise<UserNameService>;
|
|
74
|
-
getUserByUsername(username: string): Promise<UserNameService>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
declare enum MiniKitInstallErrorCodes {
|
|
78
|
-
Unknown = "unknown",
|
|
79
|
-
AlreadyInstalled = "already_installed",
|
|
80
|
-
OutsideOfWorldApp = "outside_of_worldapp",
|
|
81
|
-
NotOnClient = "not_on_client",
|
|
82
|
-
AppOutOfDate = "app_out_of_date"
|
|
83
|
-
}
|
|
84
|
-
declare const MiniKitInstallErrorMessage: {
|
|
85
|
-
unknown: string;
|
|
86
|
-
already_installed: string;
|
|
87
|
-
outside_of_worldapp: string;
|
|
88
|
-
not_on_client: string;
|
|
89
|
-
app_out_of_date: string;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
declare enum Command {
|
|
93
|
-
Verify = "verify",
|
|
94
|
-
Pay = "pay",
|
|
95
|
-
WalletAuth = "wallet-auth",
|
|
96
|
-
SendTransaction = "send-transaction",
|
|
97
|
-
SignMessage = "sign-message",
|
|
98
|
-
SignTypedData = "sign-typed-data",
|
|
99
|
-
ShareContacts = "share-contacts",
|
|
100
|
-
RequestPermission = "request-permission",
|
|
101
|
-
GetPermissions = "get-permissions",
|
|
102
|
-
SendHapticFeedback = "send-haptic-feedback",
|
|
103
|
-
Share = "share",
|
|
104
|
-
Chat = "chat",
|
|
105
|
-
Attestation = "attestation",
|
|
106
|
-
CloseMiniApp = "close-miniapp"
|
|
107
|
-
}
|
|
108
|
-
declare enum ResponseEvent {
|
|
109
|
-
MiniAppVerifyAction = "miniapp-verify-action",
|
|
110
|
-
MiniAppPayment = "miniapp-payment",
|
|
111
|
-
MiniAppWalletAuth = "miniapp-wallet-auth",
|
|
112
|
-
MiniAppSendTransaction = "miniapp-send-transaction",
|
|
113
|
-
MiniAppSignMessage = "miniapp-sign-message",
|
|
114
|
-
MiniAppSignTypedData = "miniapp-sign-typed-data",
|
|
115
|
-
MiniAppShareContacts = "miniapp-share-contacts",
|
|
116
|
-
MiniAppRequestPermission = "miniapp-request-permission",
|
|
117
|
-
MiniAppGetPermissions = "miniapp-get-permissions",
|
|
118
|
-
MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
|
|
119
|
-
MiniAppShare = "miniapp-share",
|
|
120
|
-
MiniAppMicrophone = "miniapp-microphone",
|
|
121
|
-
MiniAppChat = "miniapp-chat",
|
|
122
|
-
MiniAppAttestation = "miniapp-attestation"
|
|
123
|
-
}
|
|
124
|
-
declare const COMMAND_VERSIONS: Record<Command, number>;
|
|
125
|
-
declare function isCommandAvailable(command: Command): boolean;
|
|
126
|
-
declare function setCommandAvailable(command: Command, available: boolean): void;
|
|
127
|
-
declare function validateCommands(worldAppSupportedCommands: NonNullable<typeof window.WorldApp>['supported_commands']): boolean;
|
|
128
|
-
interface CommandContext {
|
|
129
|
-
events: EventManager;
|
|
130
|
-
state: MiniKitState;
|
|
131
|
-
}
|
|
132
|
-
type MiniAppBaseSuccessPayload = {
|
|
133
|
-
status: 'success';
|
|
134
|
-
version: number;
|
|
135
|
-
};
|
|
136
|
-
type MiniAppBaseErrorPayload<TErrorCode = string> = {
|
|
137
|
-
status: 'error';
|
|
138
|
-
error_code: TErrorCode;
|
|
139
|
-
version: number;
|
|
140
|
-
};
|
|
141
|
-
type AsyncHandlerReturn<CommandPayload, FinalPayload> = Promise<{
|
|
142
|
-
commandPayload: CommandPayload;
|
|
143
|
-
finalPayload: FinalPayload;
|
|
144
|
-
}>;
|
|
145
|
-
type WebViewBasePayload = {
|
|
146
|
-
command: Command;
|
|
147
|
-
version: number;
|
|
148
|
-
payload: Record<string, any>;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
type MiniKitInstallReturnType = {
|
|
152
|
-
success: true;
|
|
153
|
-
} | {
|
|
154
|
-
success: false;
|
|
155
|
-
errorCode: MiniKitInstallErrorCodes;
|
|
156
|
-
errorMessage: (typeof MiniKitInstallErrorMessage)[MiniKitInstallErrorCodes];
|
|
157
|
-
};
|
|
158
|
-
declare function sendMiniKitEvent<T extends WebViewBasePayload = WebViewBasePayload>(payload: T): void;
|
|
159
|
-
|
|
160
|
-
type AttestationInput = {
|
|
161
|
-
/**
|
|
162
|
-
* Hex-encoded hash of the request to be attested.
|
|
163
|
-
* Hash must be generated per hashing spec documented in MiniKit docs.
|
|
164
|
-
*/
|
|
165
|
-
requestHash: string;
|
|
166
|
-
};
|
|
167
|
-
type AttestationPayload = {
|
|
168
|
-
request_hash: string;
|
|
169
|
-
};
|
|
170
|
-
declare enum AttestationErrorCodes {
|
|
171
|
-
Unauthorized = "unauthorized",
|
|
172
|
-
AttestationFailed = "attestation_failed",
|
|
173
|
-
IntegrityFailed = "integrity_failed",
|
|
174
|
-
InvalidInput = "invalid_input",
|
|
175
|
-
UnsupportedVersion = "unsupported_version"
|
|
176
|
-
}
|
|
177
|
-
declare const AttestationErrorMessage: Record<AttestationErrorCodes, string>;
|
|
178
|
-
type MiniAppAttestationSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
179
|
-
token: string;
|
|
180
|
-
};
|
|
181
|
-
type MiniAppAttestationErrorPayload = MiniAppBaseErrorPayload<AttestationErrorCodes> & {
|
|
182
|
-
description: string;
|
|
183
|
-
};
|
|
184
|
-
type MiniAppAttestationPayload = MiniAppAttestationSuccessPayload | MiniAppAttestationErrorPayload;
|
|
185
|
-
declare function createAttestationCommand(_ctx: CommandContext): (input: AttestationInput) => AttestationPayload | null;
|
|
186
|
-
declare function createAttestationAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createAttestationCommand>): (input: AttestationInput) => AsyncHandlerReturn<AttestationPayload | null, MiniAppAttestationPayload>;
|
|
187
|
-
|
|
188
|
-
type ChatPayload = {
|
|
189
|
-
to?: string[];
|
|
190
|
-
message: string;
|
|
191
|
-
};
|
|
192
|
-
declare enum ChatErrorCodes {
|
|
193
|
-
UserRejected = "user_rejected",
|
|
194
|
-
SendFailed = "send_failed",
|
|
195
|
-
GenericError = "generic_error"
|
|
196
|
-
}
|
|
197
|
-
declare const ChatErrorMessage: {
|
|
198
|
-
user_rejected: string;
|
|
199
|
-
send_failed: string;
|
|
200
|
-
generic_error: string;
|
|
201
|
-
};
|
|
202
|
-
type MiniAppChatSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
203
|
-
count: number;
|
|
204
|
-
timestamp: string;
|
|
205
|
-
};
|
|
206
|
-
type MiniAppChatErrorPayload = MiniAppBaseErrorPayload<ChatErrorCodes>;
|
|
207
|
-
type MiniAppChatPayload = MiniAppChatSuccessPayload | MiniAppChatErrorPayload;
|
|
208
|
-
declare function createChatCommand(_ctx: CommandContext): (payload: ChatPayload) => ChatPayload | null;
|
|
209
|
-
declare function createChatAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createChatCommand>): (payload: ChatPayload) => AsyncHandlerReturn<ChatPayload | null, MiniAppChatPayload>;
|
|
210
|
-
|
|
211
|
-
type ShareInput = {
|
|
212
|
-
files?: File[];
|
|
213
|
-
title?: string;
|
|
214
|
-
text?: string;
|
|
215
|
-
url?: string;
|
|
216
|
-
};
|
|
217
|
-
type SharePayload = {
|
|
218
|
-
files?: Array<{
|
|
219
|
-
name: string;
|
|
220
|
-
type: string;
|
|
221
|
-
data: string;
|
|
222
|
-
}>;
|
|
223
|
-
title?: string;
|
|
224
|
-
text?: string;
|
|
225
|
-
url?: string;
|
|
226
|
-
};
|
|
227
|
-
declare enum ShareFilesErrorCodes {
|
|
228
|
-
UserRejected = "user_rejected",
|
|
229
|
-
GenericError = "generic_error",
|
|
230
|
-
InvalidFileName = "invalid_file_name"
|
|
231
|
-
}
|
|
232
|
-
declare const ShareFilesErrorMessage: {
|
|
233
|
-
user_rejected: string;
|
|
234
|
-
generic_error: string;
|
|
235
|
-
invalid_file_name: string;
|
|
236
|
-
};
|
|
237
|
-
type MiniAppShareSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
238
|
-
shared_files_count: number;
|
|
239
|
-
timestamp: string;
|
|
240
|
-
};
|
|
241
|
-
type MiniAppShareErrorPayload = MiniAppBaseErrorPayload<ShareFilesErrorCodes>;
|
|
242
|
-
type MiniAppSharePayload = MiniAppShareSuccessPayload | MiniAppShareErrorPayload;
|
|
243
|
-
declare function createShareCommand(ctx: CommandContext): (payload: ShareInput) => ShareInput | null;
|
|
244
|
-
declare function createShareAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createShareCommand>): (payload: ShareInput) => AsyncHandlerReturn<ShareInput | null, MiniAppSharePayload>;
|
|
245
|
-
|
|
246
|
-
type SendHapticFeedbackInput = {
|
|
247
|
-
hapticsType: 'notification';
|
|
248
|
-
style: 'error' | 'success' | 'warning';
|
|
249
|
-
} | {
|
|
250
|
-
hapticsType: 'selection-changed';
|
|
251
|
-
style?: never;
|
|
252
|
-
} | {
|
|
253
|
-
hapticsType: 'impact';
|
|
254
|
-
style: 'light' | 'medium' | 'heavy';
|
|
255
|
-
};
|
|
256
|
-
type SendHapticFeedbackPayload = SendHapticFeedbackInput;
|
|
257
|
-
declare enum SendHapticFeedbackErrorCodes {
|
|
258
|
-
GenericError = "generic_error",
|
|
259
|
-
UserRejected = "user_rejected"
|
|
260
|
-
}
|
|
261
|
-
declare const SendHapticFeedbackErrorMessage: {
|
|
262
|
-
generic_error: string;
|
|
263
|
-
user_rejected: string;
|
|
264
|
-
};
|
|
265
|
-
type MiniAppSendHapticFeedbackSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
266
|
-
timestamp: string;
|
|
267
|
-
};
|
|
268
|
-
type MiniAppSendHapticFeedbackErrorPayload = MiniAppBaseErrorPayload<SendHapticFeedbackErrorCodes>;
|
|
269
|
-
type MiniAppSendHapticFeedbackPayload = MiniAppSendHapticFeedbackSuccessPayload | MiniAppSendHapticFeedbackErrorPayload;
|
|
270
|
-
declare function createSendHapticFeedbackCommand(_ctx: CommandContext): (payload: SendHapticFeedbackInput) => SendHapticFeedbackPayload | null;
|
|
271
|
-
declare function createSendHapticFeedbackAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSendHapticFeedbackCommand>): (payload: SendHapticFeedbackInput) => AsyncHandlerReturn<SendHapticFeedbackPayload | null, MiniAppSendHapticFeedbackPayload>;
|
|
272
|
-
|
|
273
|
-
type GetPermissionsInput = {};
|
|
274
|
-
type GetPermissionsPayload = {
|
|
275
|
-
status?: string;
|
|
276
|
-
};
|
|
277
|
-
declare enum GetPermissionsErrorCodes {
|
|
278
|
-
GenericError = "generic_error"
|
|
279
|
-
}
|
|
280
|
-
declare const GetPermissionsErrorMessage: {
|
|
281
|
-
generic_error: string;
|
|
282
|
-
};
|
|
283
|
-
declare enum Permission {
|
|
284
|
-
Notifications = "notifications",
|
|
285
|
-
Contacts = "contacts",
|
|
286
|
-
Microphone = "microphone"
|
|
287
|
-
}
|
|
288
|
-
type PermissionSettings = {
|
|
289
|
-
[K in Permission]?: any;
|
|
290
|
-
};
|
|
291
|
-
type MiniAppGetPermissionsSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
292
|
-
permissions: PermissionSettings;
|
|
293
|
-
timestamp: string;
|
|
294
|
-
};
|
|
295
|
-
type MiniAppGetPermissionsErrorPayload = MiniAppBaseErrorPayload<GetPermissionsErrorCodes> & {
|
|
296
|
-
details: string;
|
|
297
|
-
};
|
|
298
|
-
type MiniAppGetPermissionsPayload = MiniAppGetPermissionsSuccessPayload | MiniAppGetPermissionsErrorPayload;
|
|
299
|
-
declare function createGetPermissionsCommand(_ctx: CommandContext): () => GetPermissionsPayload | null;
|
|
300
|
-
declare function createGetPermissionsAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createGetPermissionsCommand>): () => AsyncHandlerReturn<GetPermissionsPayload | null, MiniAppGetPermissionsPayload>;
|
|
301
|
-
|
|
302
|
-
type RequestPermissionInput = {
|
|
303
|
-
permission: Permission;
|
|
304
|
-
};
|
|
305
|
-
type RequestPermissionPayload = RequestPermissionInput;
|
|
306
|
-
declare enum RequestPermissionErrorCodes {
|
|
307
|
-
UserRejected = "user_rejected",
|
|
308
|
-
GenericError = "generic_error",
|
|
309
|
-
AlreadyRequested = "already_requested",
|
|
310
|
-
PermissionDisabled = "permission_disabled",
|
|
311
|
-
AlreadyGranted = "already_granted",
|
|
312
|
-
UnsupportedPermission = "unsupported_permission"
|
|
313
|
-
}
|
|
314
|
-
declare const RequestPermissionErrorMessage: {
|
|
315
|
-
user_rejected: string;
|
|
316
|
-
generic_error: string;
|
|
317
|
-
already_requested: string;
|
|
318
|
-
permission_disabled: string;
|
|
319
|
-
already_granted: string;
|
|
320
|
-
unsupported_permission: string;
|
|
321
|
-
};
|
|
322
|
-
type MiniAppRequestPermissionSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
323
|
-
permission: Permission;
|
|
324
|
-
timestamp: string;
|
|
325
|
-
};
|
|
326
|
-
type MiniAppRequestPermissionErrorPayload = MiniAppBaseErrorPayload<RequestPermissionErrorCodes> & {
|
|
327
|
-
description: string;
|
|
328
|
-
};
|
|
329
|
-
type MiniAppRequestPermissionPayload = MiniAppRequestPermissionSuccessPayload | MiniAppRequestPermissionErrorPayload;
|
|
330
|
-
declare function createRequestPermissionCommand(_ctx: CommandContext): (payload: RequestPermissionInput) => RequestPermissionPayload | null;
|
|
331
|
-
declare function createRequestPermissionAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createRequestPermissionCommand>): (payload: RequestPermissionInput) => AsyncHandlerReturn<RequestPermissionPayload | null, MiniAppRequestPermissionPayload>;
|
|
332
|
-
|
|
333
|
-
type ShareContactsInput = {
|
|
334
|
-
isMultiSelectEnabled: boolean;
|
|
335
|
-
inviteMessage?: string;
|
|
336
|
-
};
|
|
337
|
-
type ShareContactsPayload = ShareContactsInput;
|
|
338
|
-
declare enum ShareContactsErrorCodes {
|
|
339
|
-
UserRejected = "user_rejected",
|
|
340
|
-
GenericError = "generic_error"
|
|
341
|
-
}
|
|
342
|
-
declare const ShareContactsErrorMessage: {
|
|
343
|
-
user_rejected: string;
|
|
344
|
-
generic_error: string;
|
|
345
|
-
};
|
|
346
|
-
type Contact = {
|
|
347
|
-
username: string;
|
|
348
|
-
walletAddress: string;
|
|
349
|
-
profilePictureUrl: string | null;
|
|
350
|
-
};
|
|
351
|
-
type MiniAppShareContactsSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
352
|
-
contacts: Contact[];
|
|
353
|
-
timestamp: string;
|
|
354
|
-
};
|
|
355
|
-
type MiniAppShareContactsErrorPayload = MiniAppBaseErrorPayload<ShareContactsErrorCodes>;
|
|
356
|
-
type MiniAppShareContactsPayload = MiniAppShareContactsSuccessPayload | MiniAppShareContactsErrorPayload;
|
|
357
|
-
declare function createShareContactsCommand(_ctx: CommandContext): (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
358
|
-
declare function createShareContactsAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createShareContactsCommand>): (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
359
|
-
|
|
360
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
361
|
-
type SignTypedDataInput = {
|
|
362
|
-
types: TypedData;
|
|
363
|
-
primaryType: string;
|
|
364
|
-
message: Record<string, unknown>;
|
|
365
|
-
domain?: TypedDataDomain;
|
|
366
|
-
chainId?: number;
|
|
367
|
-
};
|
|
368
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
369
|
-
type SignTypedDataPayload = SignTypedDataInput;
|
|
370
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
371
|
-
declare enum SignTypedDataErrorCodes {
|
|
372
|
-
InvalidOperation = "invalid_operation",
|
|
373
|
-
UserRejected = "user_rejected",
|
|
374
|
-
InputError = "input_error",
|
|
375
|
-
SimulationFailed = "simulation_failed",
|
|
376
|
-
GenericError = "generic_error",
|
|
377
|
-
DisallowedOperation = "disallowed_operation",
|
|
378
|
-
InvalidContract = "invalid_contract",
|
|
379
|
-
MaliciousOperation = "malicious_operation"
|
|
380
|
-
}
|
|
381
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
382
|
-
declare const SignTypedDataErrorMessage: {
|
|
383
|
-
invalid_operation: string;
|
|
384
|
-
user_rejected: string;
|
|
385
|
-
input_error: string;
|
|
386
|
-
simulation_failed: string;
|
|
387
|
-
generic_error: string;
|
|
388
|
-
disallowed_operation: string;
|
|
389
|
-
invalid_contract: string;
|
|
390
|
-
malicious_operation: string;
|
|
391
|
-
};
|
|
392
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
393
|
-
type MiniAppSignTypedDataSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
394
|
-
signature: string;
|
|
395
|
-
address: string;
|
|
396
|
-
};
|
|
397
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
398
|
-
type MiniAppSignTypedDataErrorPayload = MiniAppBaseErrorPayload<SignTypedDataErrorCodes> & {
|
|
399
|
-
details?: Record<string, any>;
|
|
400
|
-
};
|
|
401
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
402
|
-
type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
|
|
403
|
-
declare function createSignTypedDataCommand(_ctx: CommandContext): (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
404
|
-
declare function createSignTypedDataAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSignTypedDataCommand>): (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
405
|
-
|
|
406
|
-
type SignMessageInput = {
|
|
407
|
-
message: string;
|
|
408
|
-
};
|
|
409
|
-
type SignMessagePayload = SignMessageInput;
|
|
410
|
-
declare enum SignMessageErrorCodes {
|
|
411
|
-
InvalidMessage = "invalid_message",
|
|
412
|
-
UserRejected = "user_rejected",
|
|
413
|
-
GenericError = "generic_error"
|
|
414
|
-
}
|
|
415
|
-
declare const SignMessageErrorMessage: {
|
|
416
|
-
invalid_message: string;
|
|
417
|
-
user_rejected: string;
|
|
418
|
-
generic_error: string;
|
|
419
|
-
};
|
|
420
|
-
type MiniAppSignMessageSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
421
|
-
signature: string;
|
|
422
|
-
address: string;
|
|
423
|
-
};
|
|
424
|
-
type MiniAppSignMessageErrorPayload = MiniAppBaseErrorPayload<SignMessageErrorCodes> & {
|
|
425
|
-
details?: Record<string, any>;
|
|
426
|
-
};
|
|
427
|
-
type MiniAppSignMessagePayload = MiniAppSignMessageSuccessPayload | MiniAppSignMessageErrorPayload;
|
|
428
|
-
declare function createSignMessageCommand(_ctx: CommandContext): (payload: SignMessageInput) => SignMessagePayload | null;
|
|
429
|
-
declare function createSignMessageAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSignMessageCommand>): (payload: SignMessageInput) => AsyncHandlerReturn<SignMessagePayload | null, MiniAppSignMessagePayload>;
|
|
430
|
-
|
|
431
|
-
declare enum Tokens {
|
|
432
|
-
USDC = "USDCE",
|
|
433
|
-
WLD = "WLD"
|
|
434
|
-
}
|
|
435
|
-
declare const TokenDecimals: {
|
|
436
|
-
[key in Tokens]: number;
|
|
437
|
-
};
|
|
438
|
-
declare enum Network {
|
|
439
|
-
Optimism = "optimism",
|
|
440
|
-
WorldChain = "worldchain"
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
type Permit2 = {
|
|
444
|
-
permitted: {
|
|
445
|
-
token: string;
|
|
446
|
-
amount: string | unknown;
|
|
447
|
-
};
|
|
448
|
-
spender: string;
|
|
449
|
-
nonce: string | unknown;
|
|
450
|
-
deadline: string | unknown;
|
|
451
|
-
};
|
|
452
|
-
type Transaction = {
|
|
453
|
-
address: string;
|
|
454
|
-
abi: Abi | readonly unknown[];
|
|
455
|
-
functionName: ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>;
|
|
456
|
-
value?: string | undefined;
|
|
457
|
-
args: ContractFunctionArgs<Abi | readonly unknown[], 'payable' | 'nonpayable', ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>>;
|
|
458
|
-
};
|
|
459
|
-
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;
|
|
460
|
-
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[];
|
|
461
|
-
|
|
462
|
-
type SendTransactionInput = {
|
|
463
|
-
transaction: Transaction[];
|
|
464
|
-
permit2?: Permit2[];
|
|
465
|
-
formatPayload?: boolean;
|
|
466
|
-
};
|
|
467
|
-
type SendTransactionPayload = SendTransactionInput;
|
|
468
|
-
declare enum SendTransactionErrorCodes {
|
|
469
|
-
InvalidOperation = "invalid_operation",
|
|
470
|
-
UserRejected = "user_rejected",
|
|
471
|
-
InputError = "input_error",
|
|
472
|
-
SimulationFailed = "simulation_failed",
|
|
473
|
-
TransactionFailed = "transaction_failed",
|
|
474
|
-
GenericError = "generic_error",
|
|
475
|
-
DisallowedOperation = "disallowed_operation",
|
|
476
|
-
ValidationError = "validation_error",
|
|
477
|
-
InvalidContract = "invalid_contract",
|
|
478
|
-
MaliciousOperation = "malicious_operation",
|
|
479
|
-
DailyTxLimitReached = "daily_tx_limit_reached",
|
|
480
|
-
PermittedAmountExceedsSlippage = "permitted_amount_exceeds_slippage",
|
|
481
|
-
PermittedAmountNotFound = "permitted_amount_not_found"
|
|
482
|
-
}
|
|
483
|
-
declare const SendTransactionErrorMessage: Record<SendTransactionErrorCodes, string>;
|
|
484
|
-
type MiniAppSendTransactionSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
485
|
-
transaction_status: 'submitted';
|
|
486
|
-
transaction_id: string;
|
|
487
|
-
reference: string;
|
|
488
|
-
from: string;
|
|
489
|
-
chain: Network;
|
|
490
|
-
timestamp: string;
|
|
491
|
-
mini_app_id?: string;
|
|
492
|
-
};
|
|
493
|
-
type MiniAppSendTransactionErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
|
|
494
|
-
details?: Record<string, any>;
|
|
495
|
-
mini_app_id?: string;
|
|
496
|
-
};
|
|
497
|
-
type MiniAppSendTransactionPayload = MiniAppSendTransactionSuccessPayload | MiniAppSendTransactionErrorPayload;
|
|
498
|
-
declare function createSendTransactionCommand(_ctx: CommandContext): (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
499
|
-
declare function createSendTransactionAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSendTransactionCommand>): (payload: SendTransactionInput) => AsyncHandlerReturn<SendTransactionPayload | null, MiniAppSendTransactionPayload>;
|
|
500
|
-
|
|
501
|
-
type WalletAuthInput = {
|
|
502
|
-
nonce: string;
|
|
503
|
-
statement?: string;
|
|
504
|
-
requestId?: string;
|
|
505
|
-
expirationTime?: Date;
|
|
506
|
-
notBefore?: Date;
|
|
507
|
-
};
|
|
508
|
-
type WalletAuthPayload = {
|
|
509
|
-
siweMessage: string;
|
|
510
|
-
};
|
|
511
|
-
declare enum WalletAuthErrorCodes {
|
|
512
|
-
MalformedRequest = "malformed_request",
|
|
513
|
-
UserRejected = "user_rejected",
|
|
514
|
-
GenericError = "generic_error"
|
|
515
|
-
}
|
|
516
|
-
declare const WalletAuthErrorMessage: {
|
|
517
|
-
malformed_request: string;
|
|
518
|
-
user_rejected: string;
|
|
519
|
-
generic_error: string;
|
|
520
|
-
};
|
|
521
|
-
type MiniAppWalletAuthSuccessPayload$1 = MiniAppBaseSuccessPayload & {
|
|
522
|
-
message: string;
|
|
523
|
-
signature: string;
|
|
524
|
-
address: string;
|
|
525
|
-
};
|
|
526
|
-
type MiniAppWalletAuthErrorPayload = MiniAppBaseErrorPayload<WalletAuthErrorCodes> & {
|
|
527
|
-
details: (typeof WalletAuthErrorMessage)[WalletAuthErrorCodes];
|
|
528
|
-
};
|
|
529
|
-
type MiniAppWalletAuthPayload = MiniAppWalletAuthSuccessPayload$1 | MiniAppWalletAuthErrorPayload;
|
|
530
|
-
declare function createWalletAuthCommand(ctx: CommandContext): (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
531
|
-
declare function createWalletAuthAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createWalletAuthCommand>): (payload: WalletAuthInput) => AsyncHandlerReturn<WalletAuthPayload | null, MiniAppWalletAuthPayload>;
|
|
532
|
-
|
|
533
|
-
type TokensPayload = {
|
|
534
|
-
symbol: Tokens;
|
|
535
|
-
token_amount: string;
|
|
536
|
-
};
|
|
537
|
-
type PayCommandInput = {
|
|
538
|
-
reference: string;
|
|
539
|
-
to: `0x${string}` | string;
|
|
540
|
-
tokens: TokensPayload[];
|
|
541
|
-
network?: Network;
|
|
542
|
-
description: string;
|
|
543
|
-
};
|
|
544
|
-
type PayCommandPayload = PayCommandInput;
|
|
545
|
-
declare enum PaymentErrorCodes {
|
|
546
|
-
InputError = "input_error",
|
|
547
|
-
UserRejected = "user_rejected",
|
|
548
|
-
PaymentRejected = "payment_rejected",
|
|
549
|
-
InvalidReceiver = "invalid_receiver",
|
|
550
|
-
InsufficientBalance = "insufficient_balance",
|
|
551
|
-
TransactionFailed = "transaction_failed",
|
|
552
|
-
GenericError = "generic_error",
|
|
553
|
-
UserBlocked = "user_blocked"
|
|
554
|
-
}
|
|
555
|
-
declare const PaymentErrorMessage: Record<PaymentErrorCodes, string>;
|
|
556
|
-
type MiniAppPaymentSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
557
|
-
transaction_status: 'submitted';
|
|
558
|
-
transaction_id: string;
|
|
559
|
-
reference: string;
|
|
560
|
-
from: string;
|
|
561
|
-
chain: Network;
|
|
562
|
-
timestamp: string;
|
|
563
|
-
};
|
|
564
|
-
type MiniAppPaymentErrorPayload = MiniAppBaseErrorPayload<PaymentErrorCodes>;
|
|
565
|
-
type MiniAppPaymentPayload = MiniAppPaymentSuccessPayload | MiniAppPaymentErrorPayload;
|
|
566
|
-
declare function createPayCommand(_ctx: CommandContext): (payload: PayCommandInput) => PayCommandPayload | null;
|
|
567
|
-
declare function createPayAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createPayCommand>): (payload: PayCommandInput) => AsyncHandlerReturn<PayCommandPayload | null, MiniAppPaymentPayload>;
|
|
568
|
-
|
|
569
|
-
type VerifyCommandInput = {
|
|
570
|
-
action: IDKitConfig['action'];
|
|
571
|
-
signal?: IDKitConfig['signal'];
|
|
572
|
-
verification_level?: VerificationLevel | [VerificationLevel, ...VerificationLevel[]];
|
|
573
|
-
skip_proof_compression?: boolean;
|
|
574
|
-
};
|
|
575
|
-
type VerifyCommandPayload = Omit<VerifyCommandInput, 'skip_proof_compression'> & {
|
|
576
|
-
timestamp: string;
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
type MiniAppVerifyActionSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
580
|
-
proof: string;
|
|
581
|
-
merkle_root: string;
|
|
582
|
-
nullifier_hash: string;
|
|
583
|
-
verification_level: VerificationLevel;
|
|
584
|
-
};
|
|
585
|
-
type VerificationResult = Omit<MiniAppVerifyActionSuccessPayload, 'status' | 'version'>;
|
|
586
|
-
type MiniAppVerifyActionMultiSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
587
|
-
verifications: VerificationResult[];
|
|
588
|
-
};
|
|
589
|
-
type MiniAppVerifyActionErrorPayload = MiniAppBaseErrorPayload<string>;
|
|
590
|
-
type MiniAppVerifyActionPayload = MiniAppVerifyActionSuccessPayload | MiniAppVerifyActionMultiSuccessPayload | MiniAppVerifyActionErrorPayload;
|
|
591
|
-
declare function createVerifyCommand(ctx: CommandContext): (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
592
|
-
declare function createVerifyAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createVerifyCommand>): (payload: VerifyCommandInput) => AsyncHandlerReturn<VerifyCommandPayload | null, MiniAppVerifyActionPayload>;
|
|
593
|
-
|
|
594
|
-
declare function createCloseMiniAppCommand(_ctx: CommandContext): () => boolean;
|
|
595
|
-
|
|
596
|
-
declare function createCommands(ctx: CommandContext): {
|
|
597
|
-
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
598
|
-
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
599
|
-
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
600
|
-
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
601
|
-
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
602
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
603
|
-
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
604
|
-
shareContacts: (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
605
|
-
requestPermission: (payload: RequestPermissionInput) => RequestPermissionPayload | null;
|
|
606
|
-
getPermissions: () => GetPermissionsPayload | null;
|
|
607
|
-
sendHapticFeedback: (payload: SendHapticFeedbackInput) => SendHapticFeedbackPayload | null;
|
|
608
|
-
share: (payload: ShareInput) => ShareInput | null;
|
|
609
|
-
chat: (payload: ChatPayload) => ChatPayload | null;
|
|
610
|
-
attestation: (input: AttestationInput) => AttestationPayload | null;
|
|
611
|
-
closeMiniApp: () => boolean;
|
|
612
|
-
};
|
|
613
|
-
type Commands = ReturnType<typeof createCommands>;
|
|
614
|
-
declare function createAsyncCommands(ctx: CommandContext, commands: Commands): {
|
|
615
|
-
verify: (payload: VerifyCommandInput) => AsyncHandlerReturn<VerifyCommandPayload | null, MiniAppVerifyActionPayload>;
|
|
616
|
-
pay: (payload: PayCommandInput) => AsyncHandlerReturn<PayCommandPayload | null, MiniAppPaymentPayload>;
|
|
617
|
-
walletAuth: (payload: WalletAuthInput) => AsyncHandlerReturn<WalletAuthPayload | null, MiniAppWalletAuthPayload>;
|
|
618
|
-
sendTransaction: (payload: SendTransactionInput) => AsyncHandlerReturn<SendTransactionPayload | null, MiniAppSendTransactionPayload>;
|
|
619
|
-
signMessage: (payload: SignMessageInput) => AsyncHandlerReturn<SignMessagePayload | null, MiniAppSignMessagePayload>;
|
|
620
|
-
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
621
|
-
signTypedData: (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
622
|
-
shareContacts: (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
623
|
-
requestPermission: (payload: RequestPermissionInput) => AsyncHandlerReturn<RequestPermissionPayload | null, MiniAppRequestPermissionPayload>;
|
|
624
|
-
getPermissions: () => AsyncHandlerReturn<GetPermissionsPayload | null, MiniAppGetPermissionsPayload>;
|
|
625
|
-
sendHapticFeedback: (payload: SendHapticFeedbackInput) => AsyncHandlerReturn<SendHapticFeedbackPayload | null, MiniAppSendHapticFeedbackPayload>;
|
|
626
|
-
share: (payload: ShareInput) => AsyncHandlerReturn<ShareInput | null, MiniAppSharePayload>;
|
|
627
|
-
chat: (payload: ChatPayload) => AsyncHandlerReturn<ChatPayload | null, MiniAppChatPayload>;
|
|
628
|
-
attestation: (input: AttestationInput) => AsyncHandlerReturn<AttestationPayload | null, MiniAppAttestationPayload>;
|
|
629
|
-
};
|
|
630
|
-
type AsyncCommands = ReturnType<typeof createAsyncCommands>;
|
|
1
|
+
import { W as WalletAuthResult, M as MiniKitWalletAuthOptions, C as CommandResultByVia, i as isInWorldApp, U as User, D as DeviceProperties, a as MiniAppLaunchLocation, R as ResponseEvent, b as MiniKitInstallReturnType, c as UserNameService } from './types-CSyzFDPt.cjs';
|
|
2
|
+
import { S as SendTransactionResult, M as MiniKitSendTransactionOptions, P as PayResult, a as MiniKitPayOptions, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions } from './types-_jfLbcJW.cjs';
|
|
3
|
+
export { W as WorldAppProvider, g as getWorldAppProvider } from './provider-DeDUsLbs.cjs';
|
|
4
|
+
import 'abitype';
|
|
631
5
|
|
|
632
6
|
declare class MiniKit {
|
|
633
7
|
private static eventManager;
|
|
634
|
-
private static
|
|
635
|
-
private static
|
|
636
|
-
private static
|
|
8
|
+
private static _appId;
|
|
9
|
+
private static _user;
|
|
10
|
+
private static _deviceProperties;
|
|
11
|
+
private static _location;
|
|
12
|
+
private static _isReady;
|
|
13
|
+
private static getActiveMiniKit;
|
|
14
|
+
/**
|
|
15
|
+
* Authenticate user via wallet signature (SIWE)
|
|
16
|
+
*
|
|
17
|
+
* Works in World App (native SIWE) and web (Wagmi + SIWE fallback).
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const result = await MiniKit.walletAuth({ nonce: 'randomnonce123' });
|
|
22
|
+
* console.log(result.data.address);
|
|
23
|
+
* console.log(result.executedWith); // 'minikit' | 'wagmi' | 'fallback'
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
static walletAuth<TFallback = WalletAuthResult>(options: MiniKitWalletAuthOptions<TFallback>): Promise<CommandResultByVia<WalletAuthResult, TFallback>>;
|
|
27
|
+
/**
|
|
28
|
+
* Send one or more transactions
|
|
29
|
+
*
|
|
30
|
+
* World App: batch + permit2 + gas sponsorship
|
|
31
|
+
* Web: sequential execution via Wagmi
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const result = await MiniKit.sendTransaction({
|
|
36
|
+
* chainId: 480,
|
|
37
|
+
* transactions: [{
|
|
38
|
+
* to: '0x...',
|
|
39
|
+
* data: '0x...',
|
|
40
|
+
* value: '0x0',
|
|
41
|
+
* }],
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
static sendTransaction<TFallback = SendTransactionResult>(options: MiniKitSendTransactionOptions<TFallback>): Promise<CommandResultByVia<SendTransactionResult, TFallback>>;
|
|
46
|
+
/**
|
|
47
|
+
* Send a payment (World App only)
|
|
48
|
+
*
|
|
49
|
+
* Requires custom fallback on web.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const result = await MiniKit.pay({
|
|
54
|
+
* reference: crypto.randomUUID(),
|
|
55
|
+
* to: '0x...',
|
|
56
|
+
* tokens: [{ symbol: Tokens.WLD, token_amount: '1.0' }],
|
|
57
|
+
* description: 'Payment for coffee',
|
|
58
|
+
* fallback: () => showStripeCheckout(),
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
static pay<TFallback = PayResult>(options: MiniKitPayOptions<TFallback>): Promise<CommandResultByVia<PayResult, TFallback, 'minikit'>>;
|
|
63
|
+
/**
|
|
64
|
+
* Open the contact picker (World App only)
|
|
65
|
+
*
|
|
66
|
+
* Requires custom fallback on web.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const result = await MiniKit.shareContacts({
|
|
71
|
+
* isMultiSelectEnabled: true,
|
|
72
|
+
* fallback: () => showManualAddressInput(),
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
static shareContacts<TFallback = ShareContactsResult>(options?: MiniKitShareContactsOptions<TFallback>): Promise<CommandResultByVia<ShareContactsResult, TFallback, 'minikit'>>;
|
|
77
|
+
/**
|
|
78
|
+
* Sign a message
|
|
79
|
+
*/
|
|
80
|
+
static signMessage<TFallback = MiniAppSignMessageSuccessPayload>(options: MiniKitSignMessageOptions<TFallback>): Promise<CommandResultByVia<MiniAppSignMessageSuccessPayload, TFallback>>;
|
|
81
|
+
/**
|
|
82
|
+
* Sign typed data (EIP-712)
|
|
83
|
+
*/
|
|
84
|
+
static signTypedData<TFallback = MiniAppSignTypedDataPayload>(options: MiniKitSignTypedDataOptions<TFallback>): Promise<CommandResultByVia<MiniAppSignTypedDataSuccessPayload, TFallback>>;
|
|
85
|
+
/**
|
|
86
|
+
* Send a chat message
|
|
87
|
+
*/
|
|
88
|
+
static chat<TFallback = MiniAppChatPayload>(options: MiniKitChatOptions<TFallback>): Promise<CommandResultByVia<MiniAppChatSuccessPayload, TFallback, 'minikit'>>;
|
|
89
|
+
/**
|
|
90
|
+
* Share files/text/URL
|
|
91
|
+
*/
|
|
92
|
+
static share<TFallback = MiniAppSharePayload>(options: MiniKitShareOptions<TFallback>): Promise<CommandResultByVia<MiniAppShareSuccessPayload, TFallback, 'minikit'>>;
|
|
93
|
+
/**
|
|
94
|
+
* Get current permission settings
|
|
95
|
+
*/
|
|
96
|
+
static getPermissions<TFallback = MiniAppGetPermissionsPayload>(options?: MiniKitGetPermissionsOptions<TFallback>): Promise<CommandResultByVia<MiniAppGetPermissionsSuccessPayload, TFallback, 'minikit'>>;
|
|
97
|
+
/**
|
|
98
|
+
* Request a permission from the user
|
|
99
|
+
*/
|
|
100
|
+
static requestPermission<TFallback = MiniAppRequestPermissionPayload>(options: MiniKitRequestPermissionOptions<TFallback>): Promise<CommandResultByVia<MiniAppRequestPermissionSuccessPayload, TFallback, 'minikit'>>;
|
|
101
|
+
/**
|
|
102
|
+
* Trigger haptic feedback
|
|
103
|
+
*/
|
|
104
|
+
static sendHapticFeedback<TFallback = MiniAppSendHapticFeedbackPayload>(options: MiniKitSendHapticFeedbackOptions<TFallback>): Promise<CommandResultByVia<MiniAppSendHapticFeedbackSuccessPayload, TFallback, 'minikit'>>;
|
|
105
|
+
/**
|
|
106
|
+
* Request app attestation token for a request hash
|
|
107
|
+
*/
|
|
108
|
+
static attestation<TFallback = MiniAppAttestationSuccessPayload>(options: MiniKitAttestationOptions<TFallback>): Promise<CommandResultByVia<MiniAppAttestationSuccessPayload, TFallback, 'minikit'>>;
|
|
109
|
+
/**
|
|
110
|
+
* Close the mini app
|
|
111
|
+
*/
|
|
112
|
+
static closeMiniApp<TFallback = CloseMiniAppResult>(options?: MiniKitCloseMiniAppOptions<TFallback>): Promise<CommandResultByVia<CloseMiniAppResult, TFallback, 'minikit'>>;
|
|
113
|
+
/**
|
|
114
|
+
* Check if running inside World App
|
|
115
|
+
*/
|
|
116
|
+
static isInWorldApp: typeof isInWorldApp;
|
|
637
117
|
static get appId(): string | null;
|
|
638
118
|
static set appId(value: string | null);
|
|
639
|
-
static get user():
|
|
640
|
-
static set user(value:
|
|
119
|
+
static get user(): User;
|
|
120
|
+
static set user(value: User);
|
|
641
121
|
static get deviceProperties(): DeviceProperties;
|
|
642
122
|
static get location(): MiniAppLaunchLocation | null;
|
|
643
123
|
static subscribe<E extends ResponseEvent>(event: E, handler: (payload: any) => void): void;
|
|
@@ -646,47 +126,39 @@ declare class MiniKit {
|
|
|
646
126
|
private static sendInit;
|
|
647
127
|
static install(appId?: string): MiniKitInstallReturnType;
|
|
648
128
|
static isInstalled(debug?: boolean): boolean;
|
|
129
|
+
private static initFromWorldApp;
|
|
130
|
+
private static updateUserFromWalletAuth;
|
|
649
131
|
private static getContext;
|
|
650
|
-
static get commands(): Commands;
|
|
651
|
-
static get commandsAsync(): AsyncCommands;
|
|
652
132
|
static getUserByAddress: (address?: string) => Promise<UserNameService>;
|
|
653
133
|
static getUserByUsername: (username: string) => Promise<UserNameService>;
|
|
654
134
|
static getUserInfo: (address?: string) => Promise<UserNameService>;
|
|
655
135
|
static getMiniAppUrl: (appId: string, path?: string) => string;
|
|
656
136
|
static showProfileCard: (username?: string, walletAddress?: string) => void;
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated Use `MiniKit.pay()`, `MiniKit.walletAuth()`, etc. directly.
|
|
139
|
+
*
|
|
140
|
+
* Migration guide:
|
|
141
|
+
* - `MiniKit.commands.pay(payload)` → `await MiniKit.pay(options)`
|
|
142
|
+
* - `MiniKit.commands.walletAuth(payload)` → `await MiniKit.walletAuth(options)`
|
|
143
|
+
* - `MiniKit.commands.sendTransaction(payload)` → `await MiniKit.sendTransaction(options)`
|
|
144
|
+
* - `MiniKit.commands.signMessage(payload)` → `await MiniKit.signMessage(input)`
|
|
145
|
+
* - `MiniKit.commands.signTypedData(payload)` → `await MiniKit.signTypedData(input)`
|
|
146
|
+
* - `MiniKit.commands.shareContacts(payload)` → `await MiniKit.shareContacts(options)`
|
|
147
|
+
* - `MiniKit.commands.chat(payload)` → `await MiniKit.chat(input)`
|
|
148
|
+
* - `MiniKit.commands.share(payload)` → `await MiniKit.share(input)`
|
|
149
|
+
* - `MiniKit.commands.getPermissions()` → `await MiniKit.getPermissions()`
|
|
150
|
+
* - `MiniKit.commands.requestPermission(payload)` → `await MiniKit.requestPermission(input)`
|
|
151
|
+
* - `MiniKit.commands.sendHapticFeedback(payload)` → `await MiniKit.sendHapticFeedback(input)`
|
|
152
|
+
* - `MiniKit.commands.attestation(payload)` → `await MiniKit.attestation(options)`
|
|
153
|
+
* - `MiniKit.commands.closeMiniApp()` → `await MiniKit.closeMiniApp()`
|
|
154
|
+
*/
|
|
155
|
+
static get commands(): never;
|
|
156
|
+
/**
|
|
157
|
+
* @deprecated Use `MiniKit.pay()`, `MiniKit.walletAuth()`, etc. directly. All commands are now async by default.
|
|
158
|
+
*
|
|
159
|
+
* See `MiniKit.commands` deprecation notice for the full migration guide.
|
|
160
|
+
*/
|
|
161
|
+
static get commandsAsync(): never;
|
|
657
162
|
}
|
|
658
163
|
|
|
659
|
-
|
|
660
|
-
scheme?: string;
|
|
661
|
-
domain: string;
|
|
662
|
-
address?: string;
|
|
663
|
-
statement?: string;
|
|
664
|
-
uri: string;
|
|
665
|
-
version: string;
|
|
666
|
-
chain_id: number;
|
|
667
|
-
nonce: string;
|
|
668
|
-
issued_at: string;
|
|
669
|
-
expiration_time?: string;
|
|
670
|
-
not_before?: string;
|
|
671
|
-
request_id?: string;
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
declare const tokenToDecimals: (amount: number, token: Tokens) => number;
|
|
675
|
-
|
|
676
|
-
type MiniAppWalletAuthSuccessPayload = {
|
|
677
|
-
status: 'success';
|
|
678
|
-
message: string;
|
|
679
|
-
signature: string;
|
|
680
|
-
address: string;
|
|
681
|
-
version: number;
|
|
682
|
-
};
|
|
683
|
-
|
|
684
|
-
declare const parseSiweMessage: (inputString: string) => SiweMessage;
|
|
685
|
-
declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonce: string, statement?: string, requestId?: string, userProvider?: Client) => Promise<{
|
|
686
|
-
isValid: boolean;
|
|
687
|
-
siweMessageData: SiweMessage;
|
|
688
|
-
}>;
|
|
689
|
-
|
|
690
|
-
declare const getIsUserVerified: (walletAddress: string, rpcUrl?: string) => Promise<boolean>;
|
|
691
|
-
|
|
692
|
-
export { type AsyncCommands, type AsyncHandlerReturn, AttestationErrorCodes, AttestationErrorMessage, type AttestationInput, type AttestationPayload, COMMAND_VERSIONS, ChatErrorCodes, ChatErrorMessage, type ChatPayload, Command, type CommandContext, type Commands, type Contact, type ContractFunctionArgs, type ContractFunctionName, type DeviceProperties, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, type MiniAppAttestationErrorPayload, type MiniAppAttestationPayload, type MiniAppAttestationSuccessPayload, type MiniAppBaseErrorPayload, type MiniAppBaseSuccessPayload, type MiniAppChatErrorPayload, type MiniAppChatPayload, type MiniAppChatSuccessPayload, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, MiniAppLaunchLocation, type MiniAppLocation, type MiniAppPaymentErrorPayload, type MiniAppPaymentPayload, type MiniAppPaymentSuccessPayload, type MiniAppRequestPermissionErrorPayload, type MiniAppRequestPermissionPayload, type MiniAppRequestPermissionSuccessPayload, type MiniAppSendHapticFeedbackErrorPayload, type MiniAppSendHapticFeedbackPayload, type MiniAppSendHapticFeedbackSuccessPayload, type MiniAppSendTransactionErrorPayload, type MiniAppSendTransactionPayload, type MiniAppSendTransactionSuccessPayload, type MiniAppShareContactsErrorPayload, type MiniAppShareContactsPayload, type MiniAppShareContactsSuccessPayload, type MiniAppShareErrorPayload, type MiniAppSharePayload, type MiniAppShareSuccessPayload, type MiniAppSignMessageErrorPayload, type MiniAppSignMessagePayload, type MiniAppSignMessageSuccessPayload, type MiniAppSignTypedDataErrorPayload, type MiniAppSignTypedDataPayload, type MiniAppSignTypedDataSuccessPayload, type MiniAppVerifyActionErrorPayload, type MiniAppVerifyActionMultiSuccessPayload, type MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload$1 as MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, Permission, type PermissionSettings, type Permit2, RequestPermissionErrorCodes, RequestPermissionErrorMessage, type RequestPermissionInput, type RequestPermissionPayload, ResponseEvent, SendHapticFeedbackErrorCodes, SendHapticFeedbackErrorMessage, type SendHapticFeedbackInput, type SendHapticFeedbackPayload, SendTransactionErrorCodes, SendTransactionErrorMessage, type SendTransactionInput, type SendTransactionPayload, ShareContactsErrorCodes, ShareContactsErrorMessage, type ShareContactsInput, type ShareContactsPayload, ShareFilesErrorCodes, ShareFilesErrorMessage, type ShareInput, type SharePayload, SignMessageErrorCodes, SignMessageErrorMessage, type SignMessageInput, type SignMessagePayload, SignTypedDataErrorCodes, SignTypedDataErrorMessage, type SignTypedDataInput, type SignTypedDataPayload, type SiweMessage, TokenDecimals, Tokens, type TokensPayload, type Transaction, type User, type UserNameService, type VerificationResult, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, createAsyncCommands, createAttestationAsyncCommand, createAttestationCommand, createChatAsyncCommand, createChatCommand, createCloseMiniAppCommand, createCommands, createGetPermissionsAsyncCommand, createGetPermissionsCommand, createPayAsyncCommand, createPayCommand, createRequestPermissionAsyncCommand, createRequestPermissionCommand, createSendHapticFeedbackAsyncCommand, createSendHapticFeedbackCommand, createSendTransactionAsyncCommand, createSendTransactionCommand, createShareAsyncCommand, createShareCommand, createShareContactsAsyncCommand, createShareContactsCommand, createSignMessageAsyncCommand, createSignMessageCommand, createSignTypedDataAsyncCommand, createSignTypedDataCommand, createVerifyAsyncCommand, createVerifyCommand, createWalletAuthAsyncCommand, createWalletAuthCommand, getIsUserVerified, isCommandAvailable, mapWorldAppLaunchLocation, parseSiweMessage, sendMiniKitEvent, setCommandAvailable, tokenToDecimals, validateCommands, verifySiweMessage };
|
|
164
|
+
export { MiniKit };
|