@worldcoin/minikit-js 1.9.9 → 1.9.10
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 +7 -0
- package/build/{chunk-VWX7SELF.js → chunk-XFGJKKI2.js} +1431 -1157
- package/build/index.cjs +1542 -1241
- package/build/index.d.cts +489 -527
- package/build/index.d.ts +489 -527
- package/build/index.js +63 -9
- package/build/minikit-provider.cjs +1125 -858
- package/build/minikit-provider.js +1 -1
- package/index.ts +12 -3
- package/package.json +1 -1
package/build/index.d.cts
CHANGED
|
@@ -1,83 +1,74 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypedData, TypedDataDomain, Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
|
|
2
|
+
import { IDKitConfig, VerificationLevel } from '@worldcoin/idkit-core';
|
|
2
3
|
export { ISuccessResult, AppErrorCodes as VerificationErrorCodes, VerificationLevel } from '@worldcoin/idkit-core';
|
|
3
|
-
import { Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimitiveTypes, ExtractAbiFunction, TypedData, TypedDataDomain } from 'abitype';
|
|
4
4
|
export { IVerifyResponse, verifyCloudProof } from '@worldcoin/idkit-core/backend';
|
|
5
5
|
import { Client } from 'viem';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
MalformedRequest = "There was a problem with this request. Please try again or contact the app owner.",
|
|
21
|
-
InvalidTokenAddress = "The token address is invalid. Please contact the app owner.",
|
|
22
|
-
InvalidAppId = "The app ID is invalid. Please contact the app owner.",
|
|
23
|
-
DuplicateReference = "This reference ID already exists please generate a new one and try again."
|
|
24
|
-
}
|
|
25
|
-
declare enum WalletAuthErrorCodes {
|
|
26
|
-
MalformedRequest = "malformed_request",
|
|
27
|
-
UserRejected = "user_rejected",
|
|
28
|
-
GenericError = "generic_error"
|
|
29
|
-
}
|
|
30
|
-
declare const WalletAuthErrorMessage: {
|
|
31
|
-
malformed_request: string;
|
|
32
|
-
user_rejected: string;
|
|
33
|
-
generic_error: string;
|
|
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
|
+
/** @deprecated Moved to DeviceProperties */
|
|
17
|
+
worldAppVersion?: number;
|
|
18
|
+
/** @deprecated Moved to DeviceProperties */
|
|
19
|
+
deviceOS?: string;
|
|
34
20
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
21
|
+
type DeviceProperties = {
|
|
22
|
+
safeAreaInsets?: {
|
|
23
|
+
top: number;
|
|
24
|
+
right: number;
|
|
25
|
+
bottom: number;
|
|
26
|
+
left: number;
|
|
27
|
+
};
|
|
28
|
+
deviceOS?: string;
|
|
29
|
+
worldAppVersion?: number;
|
|
30
|
+
};
|
|
31
|
+
type UserNameService = {
|
|
32
|
+
walletAddress: string;
|
|
33
|
+
username?: string;
|
|
34
|
+
profilePictureUrl?: string;
|
|
35
|
+
};
|
|
36
|
+
type MiniAppLocation = {
|
|
37
|
+
countryCode?: string;
|
|
38
|
+
regionCode?: string;
|
|
39
|
+
};
|
|
40
|
+
declare enum MiniAppLaunchLocation {
|
|
41
|
+
Chat = "chat",
|
|
42
|
+
Home = "home",
|
|
43
|
+
AppStore = "app-store",
|
|
44
|
+
DeepLink = "deep-link",
|
|
45
|
+
WalletTab = "wallet-tab"
|
|
49
46
|
}
|
|
50
|
-
declare const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
declare const mapWorldAppLaunchLocation: (location: string | null | undefined) => MiniAppLaunchLocation | null;
|
|
48
|
+
|
|
49
|
+
type EventPayload<T extends ResponseEvent = ResponseEvent> = any;
|
|
50
|
+
type EventHandler<E extends ResponseEvent = ResponseEvent> = <T extends EventPayload<E>>(data: T) => void;
|
|
51
|
+
declare class EventManager {
|
|
52
|
+
private listeners;
|
|
53
|
+
subscribe<E extends ResponseEvent>(event: E, handler: EventHandler<E>): void;
|
|
54
|
+
unsubscribe(event: ResponseEvent): void;
|
|
55
|
+
trigger(event: ResponseEvent, payload: EventPayload): void;
|
|
56
|
+
private processVerifyActionPayload;
|
|
57
|
+
private compressProofSafely;
|
|
55
58
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
DisallowedOperation = "disallowed_operation",
|
|
68
|
-
InvalidContract = "invalid_contract",
|
|
69
|
-
MaliciousOperation = "malicious_operation"
|
|
59
|
+
|
|
60
|
+
declare class MiniKitState {
|
|
61
|
+
appId: string | null;
|
|
62
|
+
user: User;
|
|
63
|
+
deviceProperties: DeviceProperties;
|
|
64
|
+
location: MiniAppLaunchLocation | null;
|
|
65
|
+
isReady: boolean;
|
|
66
|
+
initFromWorldApp(worldApp: typeof window.WorldApp): void;
|
|
67
|
+
updateUserFromWalletAuth(address: string): Promise<void>;
|
|
68
|
+
getUserByAddress(address?: string): Promise<UserNameService>;
|
|
69
|
+
getUserByUsername(username: string): Promise<UserNameService>;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
invalid_operation: string;
|
|
73
|
-
user_rejected: string;
|
|
74
|
-
input_error: string;
|
|
75
|
-
simulation_failed: string;
|
|
76
|
-
generic_error: string;
|
|
77
|
-
disallowed_operation: string;
|
|
78
|
-
invalid_contract: string;
|
|
79
|
-
malicious_operation: string;
|
|
80
|
-
};
|
|
71
|
+
|
|
81
72
|
declare enum MiniKitInstallErrorCodes {
|
|
82
73
|
Unknown = "unknown",
|
|
83
74
|
AlreadyInstalled = "already_installed",
|
|
@@ -92,36 +83,141 @@ declare const MiniKitInstallErrorMessage: {
|
|
|
92
83
|
not_on_client: string;
|
|
93
84
|
app_out_of_date: string;
|
|
94
85
|
};
|
|
95
|
-
|
|
86
|
+
|
|
87
|
+
declare enum Command {
|
|
88
|
+
Verify = "verify",
|
|
89
|
+
Pay = "pay",
|
|
90
|
+
WalletAuth = "wallet-auth",
|
|
91
|
+
SendTransaction = "send-transaction",
|
|
92
|
+
SignMessage = "sign-message",
|
|
93
|
+
SignTypedData = "sign-typed-data",
|
|
94
|
+
ShareContacts = "share-contacts",
|
|
95
|
+
RequestPermission = "request-permission",
|
|
96
|
+
GetPermissions = "get-permissions",
|
|
97
|
+
SendHapticFeedback = "send-haptic-feedback",
|
|
98
|
+
Share = "share",
|
|
99
|
+
Chat = "chat"
|
|
100
|
+
}
|
|
101
|
+
declare enum ResponseEvent {
|
|
102
|
+
MiniAppVerifyAction = "miniapp-verify-action",
|
|
103
|
+
MiniAppPayment = "miniapp-payment",
|
|
104
|
+
MiniAppWalletAuth = "miniapp-wallet-auth",
|
|
105
|
+
MiniAppSendTransaction = "miniapp-send-transaction",
|
|
106
|
+
MiniAppSignMessage = "miniapp-sign-message",
|
|
107
|
+
MiniAppSignTypedData = "miniapp-sign-typed-data",
|
|
108
|
+
MiniAppShareContacts = "miniapp-share-contacts",
|
|
109
|
+
MiniAppRequestPermission = "miniapp-request-permission",
|
|
110
|
+
MiniAppGetPermissions = "miniapp-get-permissions",
|
|
111
|
+
MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
|
|
112
|
+
MiniAppShare = "miniapp-share",
|
|
113
|
+
MiniAppMicrophone = "miniapp-microphone",
|
|
114
|
+
MiniAppChat = "miniapp-chat"
|
|
115
|
+
}
|
|
116
|
+
declare const COMMAND_VERSIONS: Record<Command, number>;
|
|
117
|
+
declare function isCommandAvailable(command: Command): boolean;
|
|
118
|
+
declare function setCommandAvailable(command: Command, available: boolean): void;
|
|
119
|
+
declare function validateCommands(worldAppSupportedCommands: NonNullable<typeof window.WorldApp>['supported_commands']): boolean;
|
|
120
|
+
interface CommandContext {
|
|
121
|
+
events: EventManager;
|
|
122
|
+
state: MiniKitState;
|
|
123
|
+
}
|
|
124
|
+
type MiniAppBaseSuccessPayload = {
|
|
125
|
+
status: 'success';
|
|
126
|
+
version: number;
|
|
127
|
+
};
|
|
128
|
+
type MiniAppBaseErrorPayload<TErrorCode = string> = {
|
|
129
|
+
status: 'error';
|
|
130
|
+
error_code: TErrorCode;
|
|
131
|
+
version: number;
|
|
132
|
+
};
|
|
133
|
+
type AsyncHandlerReturn<CommandPayload, FinalPayload> = Promise<{
|
|
134
|
+
commandPayload: CommandPayload;
|
|
135
|
+
finalPayload: FinalPayload;
|
|
136
|
+
}>;
|
|
137
|
+
type WebViewBasePayload = {
|
|
138
|
+
command: Command;
|
|
139
|
+
version: number;
|
|
140
|
+
payload: Record<string, any>;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
type MiniKitInstallReturnType = {
|
|
144
|
+
success: true;
|
|
145
|
+
} | {
|
|
146
|
+
success: false;
|
|
147
|
+
errorCode: MiniKitInstallErrorCodes;
|
|
148
|
+
errorMessage: (typeof MiniKitInstallErrorMessage)[MiniKitInstallErrorCodes];
|
|
149
|
+
};
|
|
150
|
+
declare function sendMiniKitEvent<T extends WebViewBasePayload = WebViewBasePayload>(payload: T): void;
|
|
151
|
+
|
|
152
|
+
type ChatPayload = {
|
|
153
|
+
to?: string[];
|
|
154
|
+
message: string;
|
|
155
|
+
};
|
|
156
|
+
declare enum ChatErrorCodes {
|
|
96
157
|
UserRejected = "user_rejected",
|
|
158
|
+
SendFailed = "send_failed",
|
|
97
159
|
GenericError = "generic_error"
|
|
98
160
|
}
|
|
99
|
-
declare const
|
|
161
|
+
declare const ChatErrorMessage: {
|
|
100
162
|
user_rejected: string;
|
|
163
|
+
send_failed: string;
|
|
101
164
|
generic_error: string;
|
|
102
165
|
};
|
|
103
|
-
|
|
166
|
+
type MiniAppChatSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
167
|
+
count: number;
|
|
168
|
+
timestamp: string;
|
|
169
|
+
};
|
|
170
|
+
type MiniAppChatErrorPayload = MiniAppBaseErrorPayload<ChatErrorCodes>;
|
|
171
|
+
type MiniAppChatPayload = MiniAppChatSuccessPayload | MiniAppChatErrorPayload;
|
|
172
|
+
declare function createChatCommand(_ctx: CommandContext): (payload: ChatPayload) => ChatPayload | null;
|
|
173
|
+
declare function createChatAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createChatCommand>): (payload: ChatPayload) => AsyncHandlerReturn<ChatPayload | null, MiniAppChatPayload>;
|
|
174
|
+
|
|
175
|
+
type ShareInput = {
|
|
176
|
+
files?: File[];
|
|
177
|
+
title?: string;
|
|
178
|
+
text?: string;
|
|
179
|
+
url?: string;
|
|
180
|
+
};
|
|
181
|
+
type SharePayload = {
|
|
182
|
+
files?: Array<{
|
|
183
|
+
name: string;
|
|
184
|
+
type: string;
|
|
185
|
+
data: string;
|
|
186
|
+
}>;
|
|
187
|
+
title?: string;
|
|
188
|
+
text?: string;
|
|
189
|
+
url?: string;
|
|
190
|
+
};
|
|
191
|
+
declare enum ShareFilesErrorCodes {
|
|
104
192
|
UserRejected = "user_rejected",
|
|
105
193
|
GenericError = "generic_error",
|
|
106
|
-
|
|
107
|
-
PermissionDisabled = "permission_disabled",
|
|
108
|
-
AlreadyGranted = "already_granted",
|
|
109
|
-
UnsupportedPermission = "unsupported_permission"
|
|
194
|
+
InvalidFileName = "invalid_file_name"
|
|
110
195
|
}
|
|
111
|
-
declare const
|
|
196
|
+
declare const ShareFilesErrorMessage: {
|
|
112
197
|
user_rejected: string;
|
|
113
198
|
generic_error: string;
|
|
114
|
-
|
|
115
|
-
permission_disabled: string;
|
|
116
|
-
already_granted: string;
|
|
117
|
-
unsupported_permission: string;
|
|
199
|
+
invalid_file_name: string;
|
|
118
200
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
declare const GetPermissionsErrorMessage: {
|
|
123
|
-
generic_error: string;
|
|
201
|
+
type MiniAppShareSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
202
|
+
shared_files_count: number;
|
|
203
|
+
timestamp: string;
|
|
124
204
|
};
|
|
205
|
+
type MiniAppShareErrorPayload = MiniAppBaseErrorPayload<ShareFilesErrorCodes>;
|
|
206
|
+
type MiniAppSharePayload = MiniAppShareSuccessPayload | MiniAppShareErrorPayload;
|
|
207
|
+
declare function createShareCommand(ctx: CommandContext): (payload: ShareInput) => ShareInput | null;
|
|
208
|
+
declare function createShareAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createShareCommand>): (payload: ShareInput) => AsyncHandlerReturn<ShareInput | null, MiniAppSharePayload>;
|
|
209
|
+
|
|
210
|
+
type SendHapticFeedbackInput = {
|
|
211
|
+
hapticsType: 'notification';
|
|
212
|
+
style: 'error' | 'success' | 'warning';
|
|
213
|
+
} | {
|
|
214
|
+
hapticsType: 'selection-changed';
|
|
215
|
+
style?: never;
|
|
216
|
+
} | {
|
|
217
|
+
hapticsType: 'impact';
|
|
218
|
+
style: 'light' | 'medium' | 'heavy';
|
|
219
|
+
};
|
|
220
|
+
type SendHapticFeedbackPayload = SendHapticFeedbackInput;
|
|
125
221
|
declare enum SendHapticFeedbackErrorCodes {
|
|
126
222
|
GenericError = "generic_error",
|
|
127
223
|
UserRejected = "user_rejected"
|
|
@@ -130,136 +226,101 @@ declare const SendHapticFeedbackErrorMessage: {
|
|
|
130
226
|
generic_error: string;
|
|
131
227
|
user_rejected: string;
|
|
132
228
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
GenericError = "generic_error",
|
|
136
|
-
InvalidFileName = "invalid_file_name"
|
|
137
|
-
}
|
|
138
|
-
declare const ShareFilesErrorMessage: {
|
|
139
|
-
user_rejected: string;
|
|
140
|
-
generic_error: string;
|
|
141
|
-
invalid_file_name: string;
|
|
229
|
+
type MiniAppSendHapticFeedbackSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
230
|
+
timestamp: string;
|
|
142
231
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
232
|
+
type MiniAppSendHapticFeedbackErrorPayload = MiniAppBaseErrorPayload<SendHapticFeedbackErrorCodes>;
|
|
233
|
+
type MiniAppSendHapticFeedbackPayload = MiniAppSendHapticFeedbackSuccessPayload | MiniAppSendHapticFeedbackErrorPayload;
|
|
234
|
+
declare function createSendHapticFeedbackCommand(_ctx: CommandContext): (payload: SendHapticFeedbackInput) => SendHapticFeedbackPayload | null;
|
|
235
|
+
declare function createSendHapticFeedbackAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSendHapticFeedbackCommand>): (payload: SendHapticFeedbackInput) => AsyncHandlerReturn<SendHapticFeedbackPayload | null, MiniAppSendHapticFeedbackPayload>;
|
|
236
|
+
|
|
237
|
+
type GetPermissionsInput = {};
|
|
238
|
+
type GetPermissionsPayload = {
|
|
239
|
+
status?: string;
|
|
150
240
|
};
|
|
151
|
-
declare enum
|
|
152
|
-
UserRejected = "user_rejected",
|
|
153
|
-
SendFailed = "send_failed",
|
|
241
|
+
declare enum GetPermissionsErrorCodes {
|
|
154
242
|
GenericError = "generic_error"
|
|
155
243
|
}
|
|
156
|
-
declare const
|
|
157
|
-
user_rejected: string;
|
|
158
|
-
send_failed: string;
|
|
244
|
+
declare const GetPermissionsErrorMessage: {
|
|
159
245
|
generic_error: string;
|
|
160
246
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
247
|
+
declare enum Permission {
|
|
248
|
+
Notifications = "notifications",
|
|
249
|
+
Contacts = "contacts",
|
|
250
|
+
Microphone = "microphone"
|
|
165
251
|
}
|
|
166
|
-
|
|
167
|
-
[
|
|
252
|
+
type PermissionSettings = {
|
|
253
|
+
[K in Permission]?: any;
|
|
168
254
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
type Permit2 = {
|
|
175
|
-
permitted: {
|
|
176
|
-
token: string;
|
|
177
|
-
amount: string | unknown;
|
|
178
|
-
};
|
|
179
|
-
spender: string;
|
|
180
|
-
nonce: string | unknown;
|
|
181
|
-
deadline: string | unknown;
|
|
255
|
+
type MiniAppGetPermissionsSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
256
|
+
permissions: PermissionSettings;
|
|
257
|
+
timestamp: string;
|
|
182
258
|
};
|
|
183
|
-
type
|
|
184
|
-
|
|
185
|
-
abi: Abi | readonly unknown[];
|
|
186
|
-
functionName: ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>;
|
|
187
|
-
value?: string | undefined;
|
|
188
|
-
args: ContractFunctionArgs<Abi | readonly unknown[], 'payable' | 'nonpayable', ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>>;
|
|
259
|
+
type MiniAppGetPermissionsErrorPayload = MiniAppBaseErrorPayload<GetPermissionsErrorCodes> & {
|
|
260
|
+
details: string;
|
|
189
261
|
};
|
|
190
|
-
type
|
|
191
|
-
|
|
262
|
+
type MiniAppGetPermissionsPayload = MiniAppGetPermissionsSuccessPayload | MiniAppGetPermissionsErrorPayload;
|
|
263
|
+
declare function createGetPermissionsCommand(_ctx: CommandContext): () => GetPermissionsPayload | null;
|
|
264
|
+
declare function createGetPermissionsAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createGetPermissionsCommand>): () => AsyncHandlerReturn<GetPermissionsPayload | null, MiniAppGetPermissionsPayload>;
|
|
192
265
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
Pay = "pay",
|
|
196
|
-
WalletAuth = "wallet-auth",
|
|
197
|
-
SendTransaction = "send-transaction",
|
|
198
|
-
SignMessage = "sign-message",
|
|
199
|
-
SignTypedData = "sign-typed-data",
|
|
200
|
-
ShareContacts = "share-contacts",
|
|
201
|
-
RequestPermission = "request-permission",
|
|
202
|
-
GetPermissions = "get-permissions",
|
|
203
|
-
SendHapticFeedback = "send-haptic-feedback",
|
|
204
|
-
Share = "share",
|
|
205
|
-
Chat = "chat"
|
|
206
|
-
}
|
|
207
|
-
type WebViewBasePayload = {
|
|
208
|
-
command: Command;
|
|
209
|
-
version: number;
|
|
210
|
-
payload: Record<string, any>;
|
|
266
|
+
type RequestPermissionInput = {
|
|
267
|
+
permission: Permission;
|
|
211
268
|
};
|
|
212
|
-
type
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
269
|
+
type RequestPermissionPayload = RequestPermissionInput;
|
|
270
|
+
declare enum RequestPermissionErrorCodes {
|
|
271
|
+
UserRejected = "user_rejected",
|
|
272
|
+
GenericError = "generic_error",
|
|
273
|
+
AlreadyRequested = "already_requested",
|
|
274
|
+
PermissionDisabled = "permission_disabled",
|
|
275
|
+
AlreadyGranted = "already_granted",
|
|
276
|
+
UnsupportedPermission = "unsupported_permission"
|
|
277
|
+
}
|
|
278
|
+
declare const RequestPermissionErrorMessage: {
|
|
279
|
+
user_rejected: string;
|
|
280
|
+
generic_error: string;
|
|
281
|
+
already_requested: string;
|
|
282
|
+
permission_disabled: string;
|
|
283
|
+
already_granted: string;
|
|
284
|
+
unsupported_permission: string;
|
|
220
285
|
};
|
|
221
|
-
type
|
|
286
|
+
type MiniAppRequestPermissionSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
287
|
+
permission: Permission;
|
|
222
288
|
timestamp: string;
|
|
223
289
|
};
|
|
224
|
-
type
|
|
225
|
-
symbol: Tokens;
|
|
226
|
-
token_amount: string;
|
|
227
|
-
};
|
|
228
|
-
type PayCommandInput = {
|
|
229
|
-
reference: string;
|
|
230
|
-
to: `0x${string}` | string;
|
|
231
|
-
tokens: TokensPayload[];
|
|
232
|
-
network?: Network;
|
|
290
|
+
type MiniAppRequestPermissionErrorPayload = MiniAppBaseErrorPayload<RequestPermissionErrorCodes> & {
|
|
233
291
|
description: string;
|
|
234
292
|
};
|
|
235
|
-
type
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
};
|
|
243
|
-
type WalletAuthPayload = {
|
|
244
|
-
siweMessage: string;
|
|
293
|
+
type MiniAppRequestPermissionPayload = MiniAppRequestPermissionSuccessPayload | MiniAppRequestPermissionErrorPayload;
|
|
294
|
+
declare function createRequestPermissionCommand(_ctx: CommandContext): (payload: RequestPermissionInput) => RequestPermissionPayload | null;
|
|
295
|
+
declare function createRequestPermissionAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createRequestPermissionCommand>): (payload: RequestPermissionInput) => AsyncHandlerReturn<RequestPermissionPayload | null, MiniAppRequestPermissionPayload>;
|
|
296
|
+
|
|
297
|
+
type ShareContactsInput = {
|
|
298
|
+
isMultiSelectEnabled: boolean;
|
|
299
|
+
inviteMessage?: string;
|
|
245
300
|
};
|
|
246
|
-
type
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
301
|
+
type ShareContactsPayload = ShareContactsInput;
|
|
302
|
+
declare enum ShareContactsErrorCodes {
|
|
303
|
+
UserRejected = "user_rejected",
|
|
304
|
+
GenericError = "generic_error"
|
|
305
|
+
}
|
|
306
|
+
declare const ShareContactsErrorMessage: {
|
|
307
|
+
user_rejected: string;
|
|
308
|
+
generic_error: string;
|
|
252
309
|
};
|
|
253
|
-
type
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
310
|
+
type Contact = {
|
|
311
|
+
username: string;
|
|
312
|
+
walletAddress: string;
|
|
313
|
+
profilePictureUrl: string | null;
|
|
257
314
|
};
|
|
258
|
-
type
|
|
259
|
-
|
|
260
|
-
|
|
315
|
+
type MiniAppShareContactsSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
316
|
+
contacts: Contact[];
|
|
317
|
+
timestamp: string;
|
|
261
318
|
};
|
|
262
|
-
type
|
|
319
|
+
type MiniAppShareContactsErrorPayload = MiniAppBaseErrorPayload<ShareContactsErrorCodes>;
|
|
320
|
+
type MiniAppShareContactsPayload = MiniAppShareContactsSuccessPayload | MiniAppShareContactsErrorPayload;
|
|
321
|
+
declare function createShareContactsCommand(_ctx: CommandContext): (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
322
|
+
declare function createShareContactsAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createShareContactsCommand>): (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
323
|
+
|
|
263
324
|
type SignTypedDataInput = {
|
|
264
325
|
types: TypedData;
|
|
265
326
|
primaryType: string;
|
|
@@ -268,387 +329,280 @@ type SignTypedDataInput = {
|
|
|
268
329
|
chainId?: number;
|
|
269
330
|
};
|
|
270
331
|
type SignTypedDataPayload = SignTypedDataInput;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
332
|
+
declare enum SignTypedDataErrorCodes {
|
|
333
|
+
InvalidOperation = "invalid_operation",
|
|
334
|
+
UserRejected = "user_rejected",
|
|
335
|
+
InputError = "input_error",
|
|
336
|
+
SimulationFailed = "simulation_failed",
|
|
337
|
+
GenericError = "generic_error",
|
|
338
|
+
DisallowedOperation = "disallowed_operation",
|
|
339
|
+
InvalidContract = "invalid_contract",
|
|
340
|
+
MaliciousOperation = "malicious_operation"
|
|
280
341
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
} | {
|
|
291
|
-
hapticsType: 'selection-changed';
|
|
292
|
-
style?: never;
|
|
293
|
-
} | {
|
|
294
|
-
hapticsType: 'impact';
|
|
295
|
-
style: 'light' | 'medium' | 'heavy';
|
|
296
|
-
};
|
|
297
|
-
type SendHapticFeedbackPayload = SendHapticFeedbackInput;
|
|
298
|
-
type ShareInput = {
|
|
299
|
-
files?: File[];
|
|
300
|
-
title?: string;
|
|
301
|
-
text?: string;
|
|
302
|
-
url?: string;
|
|
342
|
+
declare const SignTypedDataErrorMessage: {
|
|
343
|
+
invalid_operation: string;
|
|
344
|
+
user_rejected: string;
|
|
345
|
+
input_error: string;
|
|
346
|
+
simulation_failed: string;
|
|
347
|
+
generic_error: string;
|
|
348
|
+
disallowed_operation: string;
|
|
349
|
+
invalid_contract: string;
|
|
350
|
+
malicious_operation: string;
|
|
303
351
|
};
|
|
304
|
-
type
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
type: string;
|
|
308
|
-
data: string;
|
|
309
|
-
}>;
|
|
310
|
-
title?: string;
|
|
311
|
-
text?: string;
|
|
312
|
-
url?: string;
|
|
352
|
+
type MiniAppSignTypedDataSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
353
|
+
signature: string;
|
|
354
|
+
address: string;
|
|
313
355
|
};
|
|
314
|
-
type
|
|
315
|
-
|
|
316
|
-
message: string;
|
|
356
|
+
type MiniAppSignTypedDataErrorPayload = MiniAppBaseErrorPayload<SignTypedDataErrorCodes> & {
|
|
357
|
+
details?: Record<string, any>;
|
|
317
358
|
};
|
|
318
|
-
type
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
[Command.WalletAuth]: WalletAuthPayload;
|
|
322
|
-
[Command.SendTransaction]: SendTransactionPayload;
|
|
323
|
-
[Command.SignMessage]: SignMessagePayload;
|
|
324
|
-
[Command.SignTypedData]: SignTypedDataPayload;
|
|
325
|
-
[Command.ShareContacts]: ShareContactsPayload;
|
|
326
|
-
[Command.RequestPermission]: RequestPermissionPayload;
|
|
327
|
-
[Command.GetPermissions]: GetPermissionsPayload;
|
|
328
|
-
[Command.SendHapticFeedback]: SendHapticFeedbackPayload;
|
|
329
|
-
[Command.Share]: SharePayload;
|
|
330
|
-
[Command.Chat]: ChatPayload;
|
|
331
|
-
};
|
|
332
|
-
type CommandReturnPayload<T extends Command> = T extends keyof CommandReturnPayloadMap ? CommandReturnPayloadMap[T] : never;
|
|
359
|
+
type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
|
|
360
|
+
declare function createSignTypedDataCommand(_ctx: CommandContext): (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
361
|
+
declare function createSignTypedDataAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSignTypedDataCommand>): (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
333
362
|
|
|
334
|
-
type
|
|
335
|
-
|
|
336
|
-
username?: string;
|
|
337
|
-
profilePictureUrl?: string;
|
|
338
|
-
permissions?: {
|
|
339
|
-
notifications: boolean;
|
|
340
|
-
contacts: boolean;
|
|
341
|
-
};
|
|
342
|
-
optedIntoOptionalAnalytics?: boolean;
|
|
343
|
-
/** @deprecated Moved to DeviceProperties */
|
|
344
|
-
worldAppVersion?: number;
|
|
345
|
-
/** @deprecated Moved to DeviceProperties */
|
|
346
|
-
deviceOS?: string;
|
|
363
|
+
type SignMessageInput = {
|
|
364
|
+
message: string;
|
|
347
365
|
};
|
|
348
|
-
type
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
366
|
+
type SignMessagePayload = SignMessageInput;
|
|
367
|
+
declare enum SignMessageErrorCodes {
|
|
368
|
+
InvalidMessage = "invalid_message",
|
|
369
|
+
UserRejected = "user_rejected",
|
|
370
|
+
GenericError = "generic_error"
|
|
371
|
+
}
|
|
372
|
+
declare const SignMessageErrorMessage: {
|
|
373
|
+
invalid_message: string;
|
|
374
|
+
user_rejected: string;
|
|
375
|
+
generic_error: string;
|
|
357
376
|
};
|
|
358
|
-
type
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
profilePictureUrl?: string;
|
|
377
|
+
type MiniAppSignMessageSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
378
|
+
signature: string;
|
|
379
|
+
address: string;
|
|
362
380
|
};
|
|
363
|
-
type
|
|
364
|
-
|
|
365
|
-
regionCode?: string;
|
|
381
|
+
type MiniAppSignMessageErrorPayload = MiniAppBaseErrorPayload<SignMessageErrorCodes> & {
|
|
382
|
+
details?: Record<string, any>;
|
|
366
383
|
};
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
AppStore = "app-store",
|
|
371
|
-
DeepLink = "deep-link",
|
|
372
|
-
WalletTab = "wallet-tab"
|
|
373
|
-
}
|
|
374
|
-
declare const mapWorldAppLaunchLocation: (location: string | null | undefined) => MiniAppLaunchLocation | null;
|
|
384
|
+
type MiniAppSignMessagePayload = MiniAppSignMessageSuccessPayload | MiniAppSignMessageErrorPayload;
|
|
385
|
+
declare function createSignMessageCommand(_ctx: CommandContext): (payload: SignMessageInput) => SignMessagePayload | null;
|
|
386
|
+
declare function createSignMessageAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSignMessageCommand>): (payload: SignMessageInput) => AsyncHandlerReturn<SignMessagePayload | null, MiniAppSignMessagePayload>;
|
|
375
387
|
|
|
376
|
-
declare enum
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
MiniAppWalletAuth = "miniapp-wallet-auth",
|
|
380
|
-
MiniAppSendTransaction = "miniapp-send-transaction",
|
|
381
|
-
MiniAppSignMessage = "miniapp-sign-message",
|
|
382
|
-
MiniAppSignTypedData = "miniapp-sign-typed-data",
|
|
383
|
-
MiniAppShareContacts = "miniapp-share-contacts",
|
|
384
|
-
MiniAppRequestPermission = "miniapp-request-permission",
|
|
385
|
-
MiniAppGetPermissions = "miniapp-get-permissions",
|
|
386
|
-
MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
|
|
387
|
-
MiniAppShare = "miniapp-share",
|
|
388
|
-
MiniAppMicrophone = "miniapp-microphone",
|
|
389
|
-
MiniAppChat = "miniapp-chat"
|
|
388
|
+
declare enum Tokens {
|
|
389
|
+
USDC = "USDCE",
|
|
390
|
+
WLD = "WLD"
|
|
390
391
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
proof: string;
|
|
394
|
-
merkle_root: string;
|
|
395
|
-
nullifier_hash: string;
|
|
396
|
-
verification_level: VerificationLevel;
|
|
397
|
-
version: number;
|
|
398
|
-
};
|
|
399
|
-
type MiniAppVerifyActionErrorPayload = {
|
|
400
|
-
status: 'error';
|
|
401
|
-
error_code: AppErrorCodes;
|
|
402
|
-
version: number;
|
|
403
|
-
};
|
|
404
|
-
type MiniAppVerifyActionPayload = MiniAppVerifyActionSuccessPayload | MiniAppVerifyActionErrorPayload;
|
|
405
|
-
type MiniAppPaymentSuccessPayload = {
|
|
406
|
-
status: 'success';
|
|
407
|
-
transaction_status: 'submitted';
|
|
408
|
-
transaction_id: string;
|
|
409
|
-
reference: string;
|
|
410
|
-
from: string;
|
|
411
|
-
chain: Network;
|
|
412
|
-
timestamp: string;
|
|
413
|
-
version: number;
|
|
392
|
+
declare const TokenDecimals: {
|
|
393
|
+
[key in Tokens]: number;
|
|
414
394
|
};
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
395
|
+
declare enum Network {
|
|
396
|
+
Optimism = "optimism",
|
|
397
|
+
WorldChain = "worldchain"
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
type Permit2 = {
|
|
401
|
+
permitted: {
|
|
402
|
+
token: string;
|
|
403
|
+
amount: string | unknown;
|
|
404
|
+
};
|
|
405
|
+
spender: string;
|
|
406
|
+
nonce: string | unknown;
|
|
407
|
+
deadline: string | unknown;
|
|
419
408
|
};
|
|
420
|
-
type
|
|
421
|
-
type MiniAppWalletAuthSuccessPayload = {
|
|
422
|
-
status: 'success';
|
|
423
|
-
message: string;
|
|
424
|
-
signature: string;
|
|
409
|
+
type Transaction = {
|
|
425
410
|
address: string;
|
|
426
|
-
|
|
411
|
+
abi: Abi | readonly unknown[];
|
|
412
|
+
functionName: ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>;
|
|
413
|
+
value?: string | undefined;
|
|
414
|
+
args: ContractFunctionArgs<Abi | readonly unknown[], 'payable' | 'nonpayable', ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>>;
|
|
427
415
|
};
|
|
428
|
-
type
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
416
|
+
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;
|
|
417
|
+
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[];
|
|
418
|
+
|
|
419
|
+
type SendTransactionInput = {
|
|
420
|
+
transaction: Transaction[];
|
|
421
|
+
permit2?: Permit2[];
|
|
422
|
+
formatPayload?: boolean;
|
|
433
423
|
};
|
|
434
|
-
type
|
|
435
|
-
|
|
436
|
-
|
|
424
|
+
type SendTransactionPayload = SendTransactionInput;
|
|
425
|
+
declare enum SendTransactionErrorCodes {
|
|
426
|
+
InvalidOperation = "invalid_operation",
|
|
427
|
+
UserRejected = "user_rejected",
|
|
428
|
+
InputError = "input_error",
|
|
429
|
+
SimulationFailed = "simulation_failed",
|
|
430
|
+
TransactionFailed = "transaction_failed",
|
|
431
|
+
GenericError = "generic_error",
|
|
432
|
+
DisallowedOperation = "disallowed_operation",
|
|
433
|
+
ValidationError = "validation_error",
|
|
434
|
+
InvalidContract = "invalid_contract",
|
|
435
|
+
MaliciousOperation = "malicious_operation",
|
|
436
|
+
DailyTxLimitReached = "daily_tx_limit_reached",
|
|
437
|
+
PermittedAmountExceedsSlippage = "permitted_amount_exceeds_slippage",
|
|
438
|
+
PermittedAmountNotFound = "permitted_amount_not_found"
|
|
439
|
+
}
|
|
440
|
+
declare const SendTransactionErrorMessage: Record<SendTransactionErrorCodes, string>;
|
|
441
|
+
type MiniAppSendTransactionSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
437
442
|
transaction_status: 'submitted';
|
|
438
443
|
transaction_id: string;
|
|
439
444
|
reference: string;
|
|
440
445
|
from: string;
|
|
441
446
|
chain: Network;
|
|
442
447
|
timestamp: string;
|
|
443
|
-
version: number;
|
|
444
448
|
mini_app_id?: string;
|
|
445
449
|
};
|
|
446
|
-
type MiniAppSendTransactionErrorPayload = {
|
|
447
|
-
status: 'error';
|
|
448
|
-
error_code: SendTransactionErrorCodes;
|
|
450
|
+
type MiniAppSendTransactionErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
|
|
449
451
|
details?: Record<string, any>;
|
|
450
|
-
version: number;
|
|
451
452
|
mini_app_id?: string;
|
|
452
453
|
};
|
|
453
454
|
type MiniAppSendTransactionPayload = MiniAppSendTransactionSuccessPayload | MiniAppSendTransactionErrorPayload;
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
455
|
+
declare function createSendTransactionCommand(_ctx: CommandContext): (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
456
|
+
declare function createSendTransactionAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSendTransactionCommand>): (payload: SendTransactionInput) => AsyncHandlerReturn<SendTransactionPayload | null, MiniAppSendTransactionPayload>;
|
|
457
|
+
|
|
458
|
+
type WalletAuthInput = {
|
|
459
|
+
nonce: string;
|
|
460
|
+
statement?: string;
|
|
461
|
+
requestId?: string;
|
|
462
|
+
expirationTime?: Date;
|
|
463
|
+
notBefore?: Date;
|
|
459
464
|
};
|
|
460
|
-
type
|
|
461
|
-
|
|
462
|
-
error_code: SignMessageErrorCodes;
|
|
463
|
-
details?: Record<string, any>;
|
|
464
|
-
version: number;
|
|
465
|
+
type WalletAuthPayload = {
|
|
466
|
+
siweMessage: string;
|
|
465
467
|
};
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
468
|
+
declare enum WalletAuthErrorCodes {
|
|
469
|
+
MalformedRequest = "malformed_request",
|
|
470
|
+
UserRejected = "user_rejected",
|
|
471
|
+
GenericError = "generic_error"
|
|
472
|
+
}
|
|
473
|
+
declare const WalletAuthErrorMessage: {
|
|
474
|
+
malformed_request: string;
|
|
475
|
+
user_rejected: string;
|
|
476
|
+
generic_error: string;
|
|
477
|
+
};
|
|
478
|
+
type MiniAppWalletAuthSuccessPayload$1 = MiniAppBaseSuccessPayload & {
|
|
479
|
+
message: string;
|
|
469
480
|
signature: string;
|
|
470
481
|
address: string;
|
|
471
|
-
version: number;
|
|
472
|
-
};
|
|
473
|
-
type MiniAppSignTypedDataErrorPayload = {
|
|
474
|
-
status: 'error';
|
|
475
|
-
error_code: SignTypedDataErrorCodes;
|
|
476
|
-
details?: Record<string, any>;
|
|
477
|
-
version: number;
|
|
478
|
-
};
|
|
479
|
-
type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
|
|
480
|
-
type Contact = {
|
|
481
|
-
username: string;
|
|
482
|
-
walletAddress: string;
|
|
483
|
-
profilePictureUrl: string | null;
|
|
484
|
-
};
|
|
485
|
-
type MiniAppShareContactsSuccessPayload = {
|
|
486
|
-
status: 'success';
|
|
487
|
-
contacts: Contact[];
|
|
488
|
-
version: number;
|
|
489
|
-
timestamp: string;
|
|
490
482
|
};
|
|
491
|
-
type
|
|
492
|
-
|
|
493
|
-
error_code: ShareContactsErrorCodes;
|
|
494
|
-
version: number;
|
|
483
|
+
type MiniAppWalletAuthErrorPayload = MiniAppBaseErrorPayload<WalletAuthErrorCodes> & {
|
|
484
|
+
details: (typeof WalletAuthErrorMessage)[WalletAuthErrorCodes];
|
|
495
485
|
};
|
|
496
|
-
type
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
486
|
+
type MiniAppWalletAuthPayload = MiniAppWalletAuthSuccessPayload$1 | MiniAppWalletAuthErrorPayload;
|
|
487
|
+
declare function createWalletAuthCommand(ctx: CommandContext): (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
488
|
+
declare function createWalletAuthAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createWalletAuthCommand>): (payload: WalletAuthInput) => AsyncHandlerReturn<WalletAuthPayload | null, MiniAppWalletAuthPayload>;
|
|
489
|
+
|
|
490
|
+
type TokensPayload = {
|
|
491
|
+
symbol: Tokens;
|
|
492
|
+
token_amount: string;
|
|
502
493
|
};
|
|
503
|
-
type
|
|
504
|
-
|
|
505
|
-
|
|
494
|
+
type PayCommandInput = {
|
|
495
|
+
reference: string;
|
|
496
|
+
to: `0x${string}` | string;
|
|
497
|
+
tokens: TokensPayload[];
|
|
498
|
+
network?: Network;
|
|
506
499
|
description: string;
|
|
507
|
-
version: number;
|
|
508
|
-
};
|
|
509
|
-
type MiniAppRequestPermissionPayload = MiniAppRequestPermissionSuccessPayload | MiniAppRequestPermissionErrorPayload;
|
|
510
|
-
type PermissionSettings = {
|
|
511
|
-
[K in Permission]?: any;
|
|
512
|
-
};
|
|
513
|
-
type MiniAppGetPermissionsSuccessPayload = {
|
|
514
|
-
status: 'success';
|
|
515
|
-
permissions: PermissionSettings;
|
|
516
|
-
version: number;
|
|
517
|
-
timestamp: string;
|
|
518
|
-
};
|
|
519
|
-
type MiniAppGetPermissionsErrorPayload = {
|
|
520
|
-
status: 'error';
|
|
521
|
-
error_code: GetPermissionsErrorCodes;
|
|
522
|
-
details: string;
|
|
523
|
-
version: number;
|
|
524
|
-
};
|
|
525
|
-
type MiniAppGetPermissionsPayload = MiniAppGetPermissionsSuccessPayload | MiniAppGetPermissionsErrorPayload;
|
|
526
|
-
type MiniAppSendHapticFeedbackSuccessPayload = {
|
|
527
|
-
status: 'success';
|
|
528
|
-
version: number;
|
|
529
|
-
timestamp: string;
|
|
530
|
-
};
|
|
531
|
-
type MiniAppSendHapticFeedbackErrorPayload = {
|
|
532
|
-
status: 'error';
|
|
533
|
-
error_code: SendHapticFeedbackErrorCodes;
|
|
534
|
-
version: number;
|
|
535
500
|
};
|
|
536
|
-
type
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
501
|
+
type PayCommandPayload = PayCommandInput;
|
|
502
|
+
declare enum PaymentErrorCodes {
|
|
503
|
+
InputError = "input_error",
|
|
504
|
+
UserRejected = "user_rejected",
|
|
505
|
+
PaymentRejected = "payment_rejected",
|
|
506
|
+
InvalidReceiver = "invalid_receiver",
|
|
507
|
+
InsufficientBalance = "insufficient_balance",
|
|
508
|
+
TransactionFailed = "transaction_failed",
|
|
509
|
+
GenericError = "generic_error",
|
|
510
|
+
UserBlocked = "user_blocked"
|
|
511
|
+
}
|
|
512
|
+
declare const PaymentErrorMessage: Record<PaymentErrorCodes, string>;
|
|
513
|
+
type MiniAppPaymentSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
514
|
+
transaction_status: 'submitted';
|
|
515
|
+
transaction_id: string;
|
|
516
|
+
reference: string;
|
|
517
|
+
from: string;
|
|
518
|
+
chain: Network;
|
|
541
519
|
timestamp: string;
|
|
542
520
|
};
|
|
543
|
-
type
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
521
|
+
type MiniAppPaymentErrorPayload = MiniAppBaseErrorPayload<PaymentErrorCodes>;
|
|
522
|
+
type MiniAppPaymentPayload = MiniAppPaymentSuccessPayload | MiniAppPaymentErrorPayload;
|
|
523
|
+
declare function createPayCommand(_ctx: CommandContext): (payload: PayCommandInput) => PayCommandPayload | null;
|
|
524
|
+
declare function createPayAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createPayCommand>): (payload: PayCommandInput) => AsyncHandlerReturn<PayCommandPayload | null, MiniAppPaymentPayload>;
|
|
525
|
+
|
|
526
|
+
type VerifyCommandInput = {
|
|
527
|
+
action: IDKitConfig['action'];
|
|
528
|
+
signal?: IDKitConfig['signal'];
|
|
529
|
+
verification_level?: VerificationLevel | [VerificationLevel, ...VerificationLevel[]];
|
|
547
530
|
};
|
|
548
|
-
type
|
|
549
|
-
type MiniAppMicrophoneSuccessPayload = {
|
|
550
|
-
status: 'success';
|
|
551
|
-
version: number;
|
|
531
|
+
type VerifyCommandPayload = VerifyCommandInput & {
|
|
552
532
|
timestamp: string;
|
|
553
533
|
};
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
type MiniAppChatSuccessPayload = {
|
|
561
|
-
status: 'success';
|
|
562
|
-
count: number;
|
|
563
|
-
timestamp: string;
|
|
564
|
-
version: number;
|
|
534
|
+
|
|
535
|
+
type MiniAppVerifyActionSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
536
|
+
proof: string;
|
|
537
|
+
merkle_root: string;
|
|
538
|
+
nullifier_hash: string;
|
|
539
|
+
verification_level: VerificationLevel;
|
|
565
540
|
};
|
|
566
|
-
type
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
version: number;
|
|
541
|
+
type VerificationResult = Omit<MiniAppVerifyActionSuccessPayload, 'status' | 'version'>;
|
|
542
|
+
type MiniAppVerifyActionMultiSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
543
|
+
verifications: VerificationResult[];
|
|
570
544
|
};
|
|
571
|
-
type
|
|
572
|
-
type
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
545
|
+
type MiniAppVerifyActionErrorPayload = MiniAppBaseErrorPayload<string>;
|
|
546
|
+
type MiniAppVerifyActionPayload = MiniAppVerifyActionSuccessPayload | MiniAppVerifyActionMultiSuccessPayload | MiniAppVerifyActionErrorPayload;
|
|
547
|
+
declare function createVerifyCommand(_ctx: CommandContext): (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
548
|
+
declare function createVerifyAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createVerifyCommand>): (payload: VerifyCommandInput) => AsyncHandlerReturn<VerifyCommandPayload | null, MiniAppVerifyActionPayload>;
|
|
549
|
+
|
|
550
|
+
declare function createCommands(ctx: CommandContext): {
|
|
551
|
+
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
552
|
+
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
553
|
+
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
554
|
+
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
555
|
+
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
556
|
+
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
557
|
+
shareContacts: (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
558
|
+
requestPermission: (payload: RequestPermissionInput) => RequestPermissionPayload | null;
|
|
559
|
+
getPermissions: () => GetPermissionsPayload | null;
|
|
560
|
+
sendHapticFeedback: (payload: SendHapticFeedbackInput) => SendHapticFeedbackPayload | null;
|
|
561
|
+
share: (payload: ShareInput) => ShareInput | null;
|
|
562
|
+
chat: (payload: ChatPayload) => ChatPayload | null;
|
|
563
|
+
};
|
|
564
|
+
type Commands = ReturnType<typeof createCommands>;
|
|
565
|
+
declare function createAsyncCommands(ctx: CommandContext, commands: Commands): {
|
|
566
|
+
verify: (payload: VerifyCommandInput) => AsyncHandlerReturn<VerifyCommandPayload | null, MiniAppVerifyActionPayload>;
|
|
567
|
+
pay: (payload: PayCommandInput) => AsyncHandlerReturn<PayCommandPayload | null, MiniAppPaymentPayload>;
|
|
568
|
+
walletAuth: (payload: WalletAuthInput) => AsyncHandlerReturn<WalletAuthPayload | null, MiniAppWalletAuthPayload>;
|
|
569
|
+
sendTransaction: (payload: SendTransactionInput) => AsyncHandlerReturn<SendTransactionPayload | null, MiniAppSendTransactionPayload>;
|
|
570
|
+
signMessage: (payload: SignMessageInput) => AsyncHandlerReturn<SignMessagePayload | null, MiniAppSignMessagePayload>;
|
|
571
|
+
signTypedData: (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
572
|
+
shareContacts: (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
573
|
+
requestPermission: (payload: RequestPermissionInput) => AsyncHandlerReturn<RequestPermissionPayload | null, MiniAppRequestPermissionPayload>;
|
|
574
|
+
getPermissions: () => AsyncHandlerReturn<GetPermissionsPayload | null, MiniAppGetPermissionsPayload>;
|
|
575
|
+
sendHapticFeedback: (payload: SendHapticFeedbackInput) => AsyncHandlerReturn<SendHapticFeedbackPayload | null, MiniAppSendHapticFeedbackPayload>;
|
|
576
|
+
share: (payload: ShareInput) => AsyncHandlerReturn<ShareInput | null, MiniAppSharePayload>;
|
|
577
|
+
chat: (payload: ChatPayload) => AsyncHandlerReturn<ChatPayload | null, MiniAppChatPayload>;
|
|
578
|
+
};
|
|
579
|
+
type AsyncCommands = ReturnType<typeof createAsyncCommands>;
|
|
589
580
|
|
|
590
581
|
declare class MiniKit {
|
|
591
|
-
private static
|
|
592
|
-
private static
|
|
593
|
-
private static
|
|
594
|
-
private static
|
|
595
|
-
|
|
596
|
-
static appId: string | null;
|
|
597
|
-
static user:
|
|
598
|
-
static
|
|
599
|
-
static
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
static subscribe<E extends ResponseEvent>(event: E, handler: EventHandler<E>): void;
|
|
582
|
+
private static eventManager;
|
|
583
|
+
private static stateManager;
|
|
584
|
+
private static commandsInstance;
|
|
585
|
+
private static asyncCommandsInstance;
|
|
586
|
+
static get appId(): string | null;
|
|
587
|
+
static set appId(value: string | null);
|
|
588
|
+
static get user(): typeof MiniKit.stateManager.user;
|
|
589
|
+
static set user(value: typeof MiniKit.stateManager.user);
|
|
590
|
+
static get deviceProperties(): DeviceProperties;
|
|
591
|
+
static get location(): MiniAppLaunchLocation | null;
|
|
592
|
+
static subscribe<E extends ResponseEvent>(event: E, handler: (payload: any) => void): void;
|
|
603
593
|
static unsubscribe(event: ResponseEvent): void;
|
|
604
|
-
static trigger(event: ResponseEvent, payload:
|
|
605
|
-
private static
|
|
606
|
-
private static commandsValid;
|
|
594
|
+
static trigger(event: ResponseEvent, payload: any): void;
|
|
595
|
+
private static sendInit;
|
|
607
596
|
static install(appId?: string): MiniKitInstallReturnType;
|
|
608
597
|
static isInstalled(debug?: boolean): boolean;
|
|
598
|
+
private static getContext;
|
|
599
|
+
static get commands(): Commands;
|
|
600
|
+
static get commandsAsync(): AsyncCommands;
|
|
609
601
|
static getUserByAddress: (address?: string) => Promise<UserNameService>;
|
|
610
602
|
static getUserByUsername: (username: string) => Promise<UserNameService>;
|
|
603
|
+
static getUserInfo: (address?: string) => Promise<UserNameService>;
|
|
611
604
|
static getMiniAppUrl: (appId: string, path?: string) => string;
|
|
612
605
|
static showProfileCard: (username?: string, walletAddress?: string) => void;
|
|
613
|
-
static getUserInfo: (address?: string) => Promise<UserNameService>;
|
|
614
|
-
static commands: {
|
|
615
|
-
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
616
|
-
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
617
|
-
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
618
|
-
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
619
|
-
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
620
|
-
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
621
|
-
shareContacts: (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
622
|
-
requestPermission: (payload: RequestPermissionInput) => RequestPermissionPayload | null;
|
|
623
|
-
getPermissions: () => GetPermissionsPayload | null;
|
|
624
|
-
sendHapticFeedback: (payload: SendHapticFeedbackInput) => SendHapticFeedbackPayload | null;
|
|
625
|
-
share: (payload: ShareInput) => ShareInput | null;
|
|
626
|
-
chat: (payload: ChatPayload) => ChatPayload | null;
|
|
627
|
-
};
|
|
628
|
-
/**
|
|
629
|
-
* This object contains async versions of all the commands.
|
|
630
|
-
* Instead of using event listeners, you can just `await` these.
|
|
631
|
-
*
|
|
632
|
-
* They return a standardized object
|
|
633
|
-
*
|
|
634
|
-
* commandPayload - object returned by the command function
|
|
635
|
-
*
|
|
636
|
-
* finalPayload - object returned by the event listener, or in other words, WorldApp response
|
|
637
|
-
*/
|
|
638
|
-
static commandsAsync: {
|
|
639
|
-
verify: (payload: VerifyCommandInput) => AsyncHandlerReturn<VerifyCommandPayload | null, MiniAppVerifyActionPayload>;
|
|
640
|
-
pay: (payload: PayCommandInput) => AsyncHandlerReturn<PayCommandPayload | null, MiniAppPaymentPayload>;
|
|
641
|
-
walletAuth: (payload: WalletAuthInput) => AsyncHandlerReturn<WalletAuthPayload | null, MiniAppWalletAuthPayload>;
|
|
642
|
-
sendTransaction: (payload: SendTransactionInput) => AsyncHandlerReturn<SendTransactionPayload | null, MiniAppSendTransactionPayload>;
|
|
643
|
-
signMessage: (payload: SignMessageInput) => AsyncHandlerReturn<SignMessagePayload | null, MiniAppSignMessagePayload>;
|
|
644
|
-
signTypedData: (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
645
|
-
shareContacts: (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
646
|
-
requestPermission: (payload: RequestPermissionInput) => AsyncHandlerReturn<RequestPermissionPayload | null, MiniAppRequestPermissionPayload>;
|
|
647
|
-
getPermissions: () => AsyncHandlerReturn<GetPermissionsPayload | null, MiniAppGetPermissionsPayload>;
|
|
648
|
-
sendHapticFeedback: (payload: SendHapticFeedbackInput) => AsyncHandlerReturn<SendHapticFeedbackPayload | null, MiniAppSendHapticFeedbackPayload>;
|
|
649
|
-
share: (payload: ShareInput) => AsyncHandlerReturn<ShareInput | null, MiniAppSharePayload>;
|
|
650
|
-
chat: (payload: ChatPayload) => AsyncHandlerReturn<ChatPayload | null, MiniAppChatPayload>;
|
|
651
|
-
};
|
|
652
606
|
}
|
|
653
607
|
|
|
654
608
|
type SiweMessage = {
|
|
@@ -668,6 +622,14 @@ type SiweMessage = {
|
|
|
668
622
|
|
|
669
623
|
declare const tokenToDecimals: (amount: number, token: Tokens) => number;
|
|
670
624
|
|
|
625
|
+
type MiniAppWalletAuthSuccessPayload = {
|
|
626
|
+
status: 'success';
|
|
627
|
+
message: string;
|
|
628
|
+
signature: string;
|
|
629
|
+
address: string;
|
|
630
|
+
version: number;
|
|
631
|
+
};
|
|
632
|
+
|
|
671
633
|
declare const parseSiweMessage: (inputString: string) => SiweMessage;
|
|
672
634
|
declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonce: string, statement?: string, requestId?: string, userProvider?: Client) => Promise<{
|
|
673
635
|
isValid: boolean;
|
|
@@ -676,4 +638,4 @@ declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonc
|
|
|
676
638
|
|
|
677
639
|
declare const getIsUserVerified: (walletAddress: string, rpcUrl?: string) => Promise<boolean>;
|
|
678
640
|
|
|
679
|
-
export { type AsyncHandlerReturn, ChatErrorCodes, ChatErrorMessage, type ChatPayload, Command, type
|
|
641
|
+
export { type AsyncCommands, type AsyncHandlerReturn, 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 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, createChatAsyncCommand, createChatCommand, 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 };
|