@worldcoin/minikit-js 1.9.8 → 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-Q55KYUW6.js → chunk-XFGJKKI2.js} +1476 -1086
- package/build/index.cjs +1713 -1292
- package/build/index.d.cts +495 -486
- package/build/index.d.ts +495 -486
- package/build/index.js +71 -9
- package/build/minikit-provider.cjs +1174 -816
- package/build/minikit-provider.js +1 -1
- package/index.ts +12 -3
- package/package.json +5 -1
package/build/index.d.ts
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,93 +83,6 @@ declare const MiniKitInstallErrorMessage: {
|
|
|
92
83
|
not_on_client: string;
|
|
93
84
|
app_out_of_date: string;
|
|
94
85
|
};
|
|
95
|
-
declare enum ShareContactsErrorCodes {
|
|
96
|
-
UserRejected = "user_rejected",
|
|
97
|
-
GenericError = "generic_error"
|
|
98
|
-
}
|
|
99
|
-
declare const ShareContactsErrorMessage: {
|
|
100
|
-
user_rejected: string;
|
|
101
|
-
generic_error: string;
|
|
102
|
-
};
|
|
103
|
-
declare enum RequestPermissionErrorCodes {
|
|
104
|
-
UserRejected = "user_rejected",
|
|
105
|
-
GenericError = "generic_error",
|
|
106
|
-
AlreadyRequested = "already_requested",
|
|
107
|
-
PermissionDisabled = "permission_disabled",
|
|
108
|
-
AlreadyGranted = "already_granted",
|
|
109
|
-
UnsupportedPermission = "unsupported_permission"
|
|
110
|
-
}
|
|
111
|
-
declare const RequestPermissionErrorMessage: {
|
|
112
|
-
user_rejected: string;
|
|
113
|
-
generic_error: string;
|
|
114
|
-
already_requested: string;
|
|
115
|
-
permission_disabled: string;
|
|
116
|
-
already_granted: string;
|
|
117
|
-
unsupported_permission: string;
|
|
118
|
-
};
|
|
119
|
-
declare enum GetPermissionsErrorCodes {
|
|
120
|
-
GenericError = "generic_error"
|
|
121
|
-
}
|
|
122
|
-
declare const GetPermissionsErrorMessage: {
|
|
123
|
-
generic_error: string;
|
|
124
|
-
};
|
|
125
|
-
declare enum SendHapticFeedbackErrorCodes {
|
|
126
|
-
GenericError = "generic_error",
|
|
127
|
-
UserRejected = "user_rejected"
|
|
128
|
-
}
|
|
129
|
-
declare const SendHapticFeedbackErrorMessage: {
|
|
130
|
-
generic_error: string;
|
|
131
|
-
user_rejected: string;
|
|
132
|
-
};
|
|
133
|
-
declare enum ShareFilesErrorCodes {
|
|
134
|
-
UserRejected = "user_rejected",
|
|
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;
|
|
142
|
-
};
|
|
143
|
-
declare enum MicrophoneErrorCodes {
|
|
144
|
-
MiniAppPermissionNotEnabled = "mini_app_permission_not_enabled",
|
|
145
|
-
WorldAppPermissionNotEnabled = "world_app_permission_not_enabled"
|
|
146
|
-
}
|
|
147
|
-
declare const MicrophoneErrorMessage: {
|
|
148
|
-
mini_app_permission_not_enabled: string;
|
|
149
|
-
world_app_permission_not_enabled: string;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
declare enum Tokens {
|
|
153
|
-
USDC = "USDCE",
|
|
154
|
-
WLD = "WLD"
|
|
155
|
-
}
|
|
156
|
-
declare const TokenDecimals: {
|
|
157
|
-
[key in Tokens]: number;
|
|
158
|
-
};
|
|
159
|
-
declare enum Network {
|
|
160
|
-
Optimism = "optimism",
|
|
161
|
-
WorldChain = "worldchain"
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
type Permit2 = {
|
|
165
|
-
permitted: {
|
|
166
|
-
token: string;
|
|
167
|
-
amount: string | unknown;
|
|
168
|
-
};
|
|
169
|
-
spender: string;
|
|
170
|
-
nonce: string | unknown;
|
|
171
|
-
deadline: string | unknown;
|
|
172
|
-
};
|
|
173
|
-
type Transaction = {
|
|
174
|
-
address: string;
|
|
175
|
-
abi: Abi | readonly unknown[];
|
|
176
|
-
functionName: ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>;
|
|
177
|
-
value?: string | undefined;
|
|
178
|
-
args: ContractFunctionArgs<Abi | readonly unknown[], 'payable' | 'nonpayable', ContractFunctionName<Abi | readonly unknown[], 'payable' | 'nonpayable'>>;
|
|
179
|
-
};
|
|
180
|
-
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;
|
|
181
|
-
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[];
|
|
182
86
|
|
|
183
87
|
declare enum Command {
|
|
184
88
|
Verify = "verify",
|
|
@@ -191,47 +95,51 @@ declare enum Command {
|
|
|
191
95
|
RequestPermission = "request-permission",
|
|
192
96
|
GetPermissions = "get-permissions",
|
|
193
97
|
SendHapticFeedback = "send-haptic-feedback",
|
|
194
|
-
Share = "share"
|
|
98
|
+
Share = "share",
|
|
99
|
+
Chat = "chat"
|
|
195
100
|
}
|
|
196
|
-
|
|
197
|
-
|
|
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;
|
|
198
131
|
version: number;
|
|
199
|
-
payload: Record<string, any>;
|
|
200
132
|
};
|
|
201
133
|
type AsyncHandlerReturn<CommandPayload, FinalPayload> = Promise<{
|
|
202
134
|
commandPayload: CommandPayload;
|
|
203
135
|
finalPayload: FinalPayload;
|
|
204
136
|
}>;
|
|
205
|
-
type
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
};
|
|
210
|
-
type VerifyCommandPayload = VerifyCommandInput & {
|
|
211
|
-
timestamp: string;
|
|
212
|
-
};
|
|
213
|
-
type TokensPayload = {
|
|
214
|
-
symbol: Tokens;
|
|
215
|
-
token_amount: string;
|
|
216
|
-
};
|
|
217
|
-
type PayCommandInput = {
|
|
218
|
-
reference: string;
|
|
219
|
-
to: `0x${string}` | string;
|
|
220
|
-
tokens: TokensPayload[];
|
|
221
|
-
network?: Network;
|
|
222
|
-
description: string;
|
|
223
|
-
};
|
|
224
|
-
type PayCommandPayload = PayCommandInput;
|
|
225
|
-
type WalletAuthInput = {
|
|
226
|
-
nonce: string;
|
|
227
|
-
statement?: string;
|
|
228
|
-
requestId?: string;
|
|
229
|
-
expirationTime?: Date;
|
|
230
|
-
notBefore?: Date;
|
|
231
|
-
};
|
|
232
|
-
type WalletAuthPayload = {
|
|
233
|
-
siweMessage: string;
|
|
137
|
+
type WebViewBasePayload = {
|
|
138
|
+
command: Command;
|
|
139
|
+
version: number;
|
|
140
|
+
payload: Record<string, any>;
|
|
234
141
|
};
|
|
142
|
+
|
|
235
143
|
type MiniKitInstallReturnType = {
|
|
236
144
|
success: true;
|
|
237
145
|
} | {
|
|
@@ -239,51 +147,31 @@ type MiniKitInstallReturnType = {
|
|
|
239
147
|
errorCode: MiniKitInstallErrorCodes;
|
|
240
148
|
errorMessage: (typeof MiniKitInstallErrorMessage)[MiniKitInstallErrorCodes];
|
|
241
149
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
};
|
|
247
|
-
type SendTransactionPayload = SendTransactionInput;
|
|
248
|
-
type SignMessageInput = {
|
|
150
|
+
declare function sendMiniKitEvent<T extends WebViewBasePayload = WebViewBasePayload>(payload: T): void;
|
|
151
|
+
|
|
152
|
+
type ChatPayload = {
|
|
153
|
+
to?: string[];
|
|
249
154
|
message: string;
|
|
250
155
|
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
message: Record<string, unknown>;
|
|
256
|
-
domain?: TypedDataDomain;
|
|
257
|
-
chainId?: number;
|
|
258
|
-
};
|
|
259
|
-
type SignTypedDataPayload = SignTypedDataInput;
|
|
260
|
-
type ShareContactsInput = {
|
|
261
|
-
isMultiSelectEnabled: boolean;
|
|
262
|
-
inviteMessage?: string;
|
|
263
|
-
};
|
|
264
|
-
type ShareContactsPayload = ShareContactsInput;
|
|
265
|
-
declare enum Permission {
|
|
266
|
-
Notifications = "notifications",
|
|
267
|
-
Contacts = "contacts",
|
|
268
|
-
Microphone = "microphone"
|
|
156
|
+
declare enum ChatErrorCodes {
|
|
157
|
+
UserRejected = "user_rejected",
|
|
158
|
+
SendFailed = "send_failed",
|
|
159
|
+
GenericError = "generic_error"
|
|
269
160
|
}
|
|
270
|
-
|
|
271
|
-
|
|
161
|
+
declare const ChatErrorMessage: {
|
|
162
|
+
user_rejected: string;
|
|
163
|
+
send_failed: string;
|
|
164
|
+
generic_error: string;
|
|
272
165
|
};
|
|
273
|
-
type
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
type SendHapticFeedbackInput = {
|
|
277
|
-
hapticsType: 'notification';
|
|
278
|
-
style: 'error' | 'success' | 'warning';
|
|
279
|
-
} | {
|
|
280
|
-
hapticsType: 'selection-changed';
|
|
281
|
-
style?: never;
|
|
282
|
-
} | {
|
|
283
|
-
hapticsType: 'impact';
|
|
284
|
-
style: 'light' | 'medium' | 'heavy';
|
|
166
|
+
type MiniAppChatSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
167
|
+
count: number;
|
|
168
|
+
timestamp: string;
|
|
285
169
|
};
|
|
286
|
-
type
|
|
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
|
+
|
|
287
175
|
type ShareInput = {
|
|
288
176
|
files?: File[];
|
|
289
177
|
title?: string;
|
|
@@ -300,308 +188,421 @@ type SharePayload = {
|
|
|
300
188
|
text?: string;
|
|
301
189
|
url?: string;
|
|
302
190
|
};
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
191
|
+
declare enum ShareFilesErrorCodes {
|
|
192
|
+
UserRejected = "user_rejected",
|
|
193
|
+
GenericError = "generic_error",
|
|
194
|
+
InvalidFileName = "invalid_file_name"
|
|
195
|
+
}
|
|
196
|
+
declare const ShareFilesErrorMessage: {
|
|
197
|
+
user_rejected: string;
|
|
198
|
+
generic_error: string;
|
|
199
|
+
invalid_file_name: string;
|
|
200
|
+
};
|
|
201
|
+
type MiniAppShareSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
202
|
+
shared_files_count: number;
|
|
203
|
+
timestamp: string;
|
|
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>;
|
|
317
209
|
|
|
318
|
-
type
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
/** @deprecated Moved to DeviceProperties */
|
|
328
|
-
worldAppVersion?: number;
|
|
329
|
-
/** @deprecated Moved to DeviceProperties */
|
|
330
|
-
deviceOS?: string;
|
|
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';
|
|
331
219
|
};
|
|
332
|
-
type
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
220
|
+
type SendHapticFeedbackPayload = SendHapticFeedbackInput;
|
|
221
|
+
declare enum SendHapticFeedbackErrorCodes {
|
|
222
|
+
GenericError = "generic_error",
|
|
223
|
+
UserRejected = "user_rejected"
|
|
224
|
+
}
|
|
225
|
+
declare const SendHapticFeedbackErrorMessage: {
|
|
226
|
+
generic_error: string;
|
|
227
|
+
user_rejected: string;
|
|
228
|
+
};
|
|
229
|
+
type MiniAppSendHapticFeedbackSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
230
|
+
timestamp: string;
|
|
231
|
+
};
|
|
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;
|
|
240
|
+
};
|
|
241
|
+
declare enum GetPermissionsErrorCodes {
|
|
242
|
+
GenericError = "generic_error"
|
|
243
|
+
}
|
|
244
|
+
declare const GetPermissionsErrorMessage: {
|
|
245
|
+
generic_error: string;
|
|
246
|
+
};
|
|
247
|
+
declare enum Permission {
|
|
248
|
+
Notifications = "notifications",
|
|
249
|
+
Contacts = "contacts",
|
|
250
|
+
Microphone = "microphone"
|
|
251
|
+
}
|
|
252
|
+
type PermissionSettings = {
|
|
253
|
+
[K in Permission]?: any;
|
|
254
|
+
};
|
|
255
|
+
type MiniAppGetPermissionsSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
256
|
+
permissions: PermissionSettings;
|
|
257
|
+
timestamp: string;
|
|
258
|
+
};
|
|
259
|
+
type MiniAppGetPermissionsErrorPayload = MiniAppBaseErrorPayload<GetPermissionsErrorCodes> & {
|
|
260
|
+
details: string;
|
|
261
|
+
};
|
|
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>;
|
|
265
|
+
|
|
266
|
+
type RequestPermissionInput = {
|
|
267
|
+
permission: Permission;
|
|
268
|
+
};
|
|
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;
|
|
285
|
+
};
|
|
286
|
+
type MiniAppRequestPermissionSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
287
|
+
permission: Permission;
|
|
288
|
+
timestamp: string;
|
|
289
|
+
};
|
|
290
|
+
type MiniAppRequestPermissionErrorPayload = MiniAppBaseErrorPayload<RequestPermissionErrorCodes> & {
|
|
291
|
+
description: string;
|
|
292
|
+
};
|
|
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;
|
|
300
|
+
};
|
|
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;
|
|
309
|
+
};
|
|
310
|
+
type Contact = {
|
|
311
|
+
username: string;
|
|
312
|
+
walletAddress: string;
|
|
313
|
+
profilePictureUrl: string | null;
|
|
314
|
+
};
|
|
315
|
+
type MiniAppShareContactsSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
316
|
+
contacts: Contact[];
|
|
317
|
+
timestamp: string;
|
|
318
|
+
};
|
|
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
|
+
|
|
324
|
+
type SignTypedDataInput = {
|
|
325
|
+
types: TypedData;
|
|
326
|
+
primaryType: string;
|
|
327
|
+
message: Record<string, unknown>;
|
|
328
|
+
domain?: TypedDataDomain;
|
|
329
|
+
chainId?: number;
|
|
330
|
+
};
|
|
331
|
+
type SignTypedDataPayload = SignTypedDataInput;
|
|
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"
|
|
341
|
+
}
|
|
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;
|
|
341
351
|
};
|
|
342
|
-
type
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
352
|
+
type MiniAppSignTypedDataSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
353
|
+
signature: string;
|
|
354
|
+
address: string;
|
|
355
|
+
};
|
|
356
|
+
type MiniAppSignTypedDataErrorPayload = MiniAppBaseErrorPayload<SignTypedDataErrorCodes> & {
|
|
357
|
+
details?: Record<string, any>;
|
|
346
358
|
};
|
|
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>;
|
|
347
362
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
MiniAppRequestPermission = "miniapp-request-permission",
|
|
357
|
-
MiniAppGetPermissions = "miniapp-get-permissions",
|
|
358
|
-
MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
|
|
359
|
-
MiniAppShare = "miniapp-share",
|
|
360
|
-
MiniAppMicrophone = "miniapp-microphone"
|
|
363
|
+
type SignMessageInput = {
|
|
364
|
+
message: string;
|
|
365
|
+
};
|
|
366
|
+
type SignMessagePayload = SignMessageInput;
|
|
367
|
+
declare enum SignMessageErrorCodes {
|
|
368
|
+
InvalidMessage = "invalid_message",
|
|
369
|
+
UserRejected = "user_rejected",
|
|
370
|
+
GenericError = "generic_error"
|
|
361
371
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
nullifier_hash: string;
|
|
367
|
-
verification_level: VerificationLevel;
|
|
368
|
-
version: number;
|
|
372
|
+
declare const SignMessageErrorMessage: {
|
|
373
|
+
invalid_message: string;
|
|
374
|
+
user_rejected: string;
|
|
375
|
+
generic_error: string;
|
|
369
376
|
};
|
|
370
|
-
type
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
version: number;
|
|
377
|
+
type MiniAppSignMessageSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
378
|
+
signature: string;
|
|
379
|
+
address: string;
|
|
374
380
|
};
|
|
375
|
-
type
|
|
376
|
-
|
|
377
|
-
status: 'success';
|
|
378
|
-
transaction_status: 'submitted';
|
|
379
|
-
transaction_id: string;
|
|
380
|
-
reference: string;
|
|
381
|
-
from: string;
|
|
382
|
-
chain: Network;
|
|
383
|
-
timestamp: string;
|
|
384
|
-
version: number;
|
|
381
|
+
type MiniAppSignMessageErrorPayload = MiniAppBaseErrorPayload<SignMessageErrorCodes> & {
|
|
382
|
+
details?: Record<string, any>;
|
|
385
383
|
};
|
|
386
|
-
type
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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>;
|
|
387
|
+
|
|
388
|
+
declare enum Tokens {
|
|
389
|
+
USDC = "USDCE",
|
|
390
|
+
WLD = "WLD"
|
|
391
|
+
}
|
|
392
|
+
declare const TokenDecimals: {
|
|
393
|
+
[key in Tokens]: number;
|
|
390
394
|
};
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
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;
|
|
408
|
+
};
|
|
409
|
+
type Transaction = {
|
|
396
410
|
address: string;
|
|
397
|
-
|
|
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'>>;
|
|
398
415
|
};
|
|
399
|
-
type
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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;
|
|
404
423
|
};
|
|
405
|
-
type
|
|
406
|
-
|
|
407
|
-
|
|
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 & {
|
|
408
442
|
transaction_status: 'submitted';
|
|
409
443
|
transaction_id: string;
|
|
410
444
|
reference: string;
|
|
411
445
|
from: string;
|
|
412
446
|
chain: Network;
|
|
413
447
|
timestamp: string;
|
|
414
|
-
version: number;
|
|
415
448
|
mini_app_id?: string;
|
|
416
449
|
};
|
|
417
|
-
type MiniAppSendTransactionErrorPayload = {
|
|
418
|
-
status: 'error';
|
|
419
|
-
error_code: SendTransactionErrorCodes;
|
|
450
|
+
type MiniAppSendTransactionErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
|
|
420
451
|
details?: Record<string, any>;
|
|
421
|
-
version: number;
|
|
422
452
|
mini_app_id?: string;
|
|
423
453
|
};
|
|
424
454
|
type MiniAppSendTransactionPayload = MiniAppSendTransactionSuccessPayload | MiniAppSendTransactionErrorPayload;
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
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;
|
|
430
464
|
};
|
|
431
|
-
type
|
|
432
|
-
|
|
433
|
-
error_code: SignMessageErrorCodes;
|
|
434
|
-
details?: Record<string, any>;
|
|
435
|
-
version: number;
|
|
465
|
+
type WalletAuthPayload = {
|
|
466
|
+
siweMessage: string;
|
|
436
467
|
};
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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;
|
|
440
480
|
signature: string;
|
|
441
481
|
address: string;
|
|
442
|
-
version: number;
|
|
443
|
-
};
|
|
444
|
-
type MiniAppSignTypedDataErrorPayload = {
|
|
445
|
-
status: 'error';
|
|
446
|
-
error_code: SignTypedDataErrorCodes;
|
|
447
|
-
details?: Record<string, any>;
|
|
448
|
-
version: number;
|
|
449
|
-
};
|
|
450
|
-
type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
|
|
451
|
-
type Contact = {
|
|
452
|
-
username: string;
|
|
453
|
-
walletAddress: string;
|
|
454
|
-
profilePictureUrl: string | null;
|
|
455
|
-
};
|
|
456
|
-
type MiniAppShareContactsSuccessPayload = {
|
|
457
|
-
status: 'success';
|
|
458
|
-
contacts: Contact[];
|
|
459
|
-
version: number;
|
|
460
|
-
timestamp: string;
|
|
461
482
|
};
|
|
462
|
-
type
|
|
463
|
-
|
|
464
|
-
error_code: ShareContactsErrorCodes;
|
|
465
|
-
version: number;
|
|
483
|
+
type MiniAppWalletAuthErrorPayload = MiniAppBaseErrorPayload<WalletAuthErrorCodes> & {
|
|
484
|
+
details: (typeof WalletAuthErrorMessage)[WalletAuthErrorCodes];
|
|
466
485
|
};
|
|
467
|
-
type
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
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;
|
|
473
493
|
};
|
|
474
|
-
type
|
|
475
|
-
|
|
476
|
-
|
|
494
|
+
type PayCommandInput = {
|
|
495
|
+
reference: string;
|
|
496
|
+
to: `0x${string}` | string;
|
|
497
|
+
tokens: TokensPayload[];
|
|
498
|
+
network?: Network;
|
|
477
499
|
description: string;
|
|
478
|
-
version: number;
|
|
479
|
-
};
|
|
480
|
-
type MiniAppRequestPermissionPayload = MiniAppRequestPermissionSuccessPayload | MiniAppRequestPermissionErrorPayload;
|
|
481
|
-
type PermissionSettings = {
|
|
482
|
-
[K in Permission]?: any;
|
|
483
|
-
};
|
|
484
|
-
type MiniAppGetPermissionsSuccessPayload = {
|
|
485
|
-
status: 'success';
|
|
486
|
-
permissions: PermissionSettings;
|
|
487
|
-
version: number;
|
|
488
|
-
timestamp: string;
|
|
489
500
|
};
|
|
490
|
-
type
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
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;
|
|
500
519
|
timestamp: string;
|
|
501
520
|
};
|
|
502
|
-
type
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
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[]];
|
|
506
530
|
};
|
|
507
|
-
type
|
|
508
|
-
type MiniAppShareSuccessPayload = {
|
|
509
|
-
status: 'success';
|
|
510
|
-
shared_files_count: number;
|
|
511
|
-
version: number;
|
|
531
|
+
type VerifyCommandPayload = VerifyCommandInput & {
|
|
512
532
|
timestamp: string;
|
|
513
533
|
};
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
type MiniAppMicrophoneSuccessPayload = {
|
|
521
|
-
status: 'success';
|
|
522
|
-
version: number;
|
|
523
|
-
timestamp: string;
|
|
534
|
+
|
|
535
|
+
type MiniAppVerifyActionSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
536
|
+
proof: string;
|
|
537
|
+
merkle_root: string;
|
|
538
|
+
nullifier_hash: string;
|
|
539
|
+
verification_level: VerificationLevel;
|
|
524
540
|
};
|
|
525
|
-
type
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
version: number;
|
|
541
|
+
type VerificationResult = Omit<MiniAppVerifyActionSuccessPayload, 'status' | 'version'>;
|
|
542
|
+
type MiniAppVerifyActionMultiSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
543
|
+
verifications: VerificationResult[];
|
|
529
544
|
};
|
|
530
|
-
type
|
|
531
|
-
type
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
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>;
|
|
547
580
|
|
|
548
581
|
declare class MiniKit {
|
|
549
|
-
private static
|
|
550
|
-
private static
|
|
551
|
-
private static
|
|
552
|
-
private static
|
|
553
|
-
|
|
554
|
-
static appId: string | null;
|
|
555
|
-
static user:
|
|
556
|
-
static
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
static subscribe<E extends ResponseEvent>(event: E, handler:
|
|
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;
|
|
560
593
|
static unsubscribe(event: ResponseEvent): void;
|
|
561
|
-
static trigger(event: ResponseEvent, payload:
|
|
562
|
-
private static
|
|
563
|
-
private static commandsValid;
|
|
594
|
+
static trigger(event: ResponseEvent, payload: any): void;
|
|
595
|
+
private static sendInit;
|
|
564
596
|
static install(appId?: string): MiniKitInstallReturnType;
|
|
565
597
|
static isInstalled(debug?: boolean): boolean;
|
|
598
|
+
private static getContext;
|
|
599
|
+
static get commands(): Commands;
|
|
600
|
+
static get commandsAsync(): AsyncCommands;
|
|
566
601
|
static getUserByAddress: (address?: string) => Promise<UserNameService>;
|
|
567
602
|
static getUserByUsername: (username: string) => Promise<UserNameService>;
|
|
568
603
|
static getUserInfo: (address?: string) => Promise<UserNameService>;
|
|
569
|
-
static
|
|
570
|
-
|
|
571
|
-
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
572
|
-
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
573
|
-
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
574
|
-
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
575
|
-
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
576
|
-
shareContacts: (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
577
|
-
requestPermission: (payload: RequestPermissionInput) => RequestPermissionPayload | null;
|
|
578
|
-
getPermissions: () => GetPermissionsPayload | null;
|
|
579
|
-
sendHapticFeedback: (payload: SendHapticFeedbackInput) => SendHapticFeedbackPayload | null;
|
|
580
|
-
share: (payload: ShareInput) => ShareInput | null;
|
|
581
|
-
};
|
|
582
|
-
/**
|
|
583
|
-
* This object contains async versions of all the commands.
|
|
584
|
-
* Instead of using event listeners, you can just `await` these.
|
|
585
|
-
*
|
|
586
|
-
* They return a standardized object
|
|
587
|
-
*
|
|
588
|
-
* commandPayload - object returned by the command function
|
|
589
|
-
*
|
|
590
|
-
* finalPayload - object returned by the event listener, or in other words, WorldApp response
|
|
591
|
-
*/
|
|
592
|
-
static commandsAsync: {
|
|
593
|
-
verify: (payload: VerifyCommandInput) => AsyncHandlerReturn<VerifyCommandPayload | null, MiniAppVerifyActionPayload>;
|
|
594
|
-
pay: (payload: PayCommandInput) => AsyncHandlerReturn<PayCommandPayload | null, MiniAppPaymentPayload>;
|
|
595
|
-
walletAuth: (payload: WalletAuthInput) => AsyncHandlerReturn<WalletAuthPayload | null, MiniAppWalletAuthPayload>;
|
|
596
|
-
sendTransaction: (payload: SendTransactionInput) => AsyncHandlerReturn<SendTransactionPayload | null, MiniAppSendTransactionPayload>;
|
|
597
|
-
signMessage: (payload: SignMessageInput) => AsyncHandlerReturn<SignMessagePayload | null, MiniAppSignMessagePayload>;
|
|
598
|
-
signTypedData: (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
599
|
-
shareContacts: (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
600
|
-
requestPermission: (payload: RequestPermissionInput) => AsyncHandlerReturn<RequestPermissionPayload | null, MiniAppRequestPermissionPayload>;
|
|
601
|
-
getPermissions: () => AsyncHandlerReturn<GetPermissionsPayload | null, MiniAppGetPermissionsPayload>;
|
|
602
|
-
sendHapticFeedback: (payload: SendHapticFeedbackInput) => AsyncHandlerReturn<SendHapticFeedbackPayload | null, MiniAppSendHapticFeedbackPayload>;
|
|
603
|
-
share: (payload: ShareInput) => AsyncHandlerReturn<ShareInput | null, MiniAppSharePayload>;
|
|
604
|
-
};
|
|
604
|
+
static getMiniAppUrl: (appId: string, path?: string) => string;
|
|
605
|
+
static showProfileCard: (username?: string, walletAddress?: string) => void;
|
|
605
606
|
}
|
|
606
607
|
|
|
607
608
|
type SiweMessage = {
|
|
@@ -621,6 +622,14 @@ type SiweMessage = {
|
|
|
621
622
|
|
|
622
623
|
declare const tokenToDecimals: (amount: number, token: Tokens) => number;
|
|
623
624
|
|
|
625
|
+
type MiniAppWalletAuthSuccessPayload = {
|
|
626
|
+
status: 'success';
|
|
627
|
+
message: string;
|
|
628
|
+
signature: string;
|
|
629
|
+
address: string;
|
|
630
|
+
version: number;
|
|
631
|
+
};
|
|
632
|
+
|
|
624
633
|
declare const parseSiweMessage: (inputString: string) => SiweMessage;
|
|
625
634
|
declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonce: string, statement?: string, requestId?: string, userProvider?: Client) => Promise<{
|
|
626
635
|
isValid: boolean;
|
|
@@ -629,4 +638,4 @@ declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonc
|
|
|
629
638
|
|
|
630
639
|
declare const getIsUserVerified: (walletAddress: string, rpcUrl?: string) => Promise<boolean>;
|
|
631
640
|
|
|
632
|
-
export { type AsyncHandlerReturn, 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 };
|