@worldcoin/minikit-js 1.9.5 → 1.9.6
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/build/{chunk-HO7P24JI.js → chunk-DKXMTG56.js} +331 -227
- package/build/index.cjs +325 -219
- package/build/index.d.cts +32 -4
- package/build/index.d.ts +32 -4
- package/build/index.js +5 -1
- package/build/minikit-provider.cjs +133 -41
- package/build/minikit-provider.d.cts +1 -1
- package/build/minikit-provider.d.ts +1 -1
- package/build/minikit-provider.js +8 -5
- package/package.json +1 -1
package/build/index.d.cts
CHANGED
|
@@ -40,6 +40,7 @@ declare enum SendTransactionErrorCodes {
|
|
|
40
40
|
TransactionFailed = "transaction_failed",
|
|
41
41
|
GenericError = "generic_error",
|
|
42
42
|
DisallowedOperation = "disallowed_operation",
|
|
43
|
+
ValidationError = "validation_error",
|
|
43
44
|
InvalidContract = "invalid_contract",
|
|
44
45
|
MaliciousOperation = "malicious_operation",
|
|
45
46
|
DailyTxLimitReached = "daily_tx_limit_reached",
|
|
@@ -139,9 +140,17 @@ declare const ShareFilesErrorMessage: {
|
|
|
139
140
|
generic_error: string;
|
|
140
141
|
invalid_file_name: string;
|
|
141
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
|
+
};
|
|
142
151
|
|
|
143
152
|
declare enum Tokens {
|
|
144
|
-
|
|
153
|
+
USDC = "USDCE",
|
|
145
154
|
WLD = "WLD"
|
|
146
155
|
}
|
|
147
156
|
declare const TokenDecimals: {
|
|
@@ -255,7 +264,8 @@ type ShareContactsInput = {
|
|
|
255
264
|
type ShareContactsPayload = ShareContactsInput;
|
|
256
265
|
declare enum Permission {
|
|
257
266
|
Notifications = "notifications",
|
|
258
|
-
Contacts = "contacts"
|
|
267
|
+
Contacts = "contacts",
|
|
268
|
+
Microphone = "microphone"
|
|
259
269
|
}
|
|
260
270
|
type RequestPermissionInput = {
|
|
261
271
|
permission: Permission;
|
|
@@ -314,7 +324,9 @@ type User = {
|
|
|
314
324
|
contacts: boolean;
|
|
315
325
|
};
|
|
316
326
|
optedIntoOptionalAnalytics?: boolean;
|
|
327
|
+
/** @deprecated Moved to DeviceProperties */
|
|
317
328
|
worldAppVersion?: number;
|
|
329
|
+
/** @deprecated Moved to DeviceProperties */
|
|
318
330
|
deviceOS?: string;
|
|
319
331
|
};
|
|
320
332
|
type DeviceProperties = {
|
|
@@ -324,6 +336,8 @@ type DeviceProperties = {
|
|
|
324
336
|
bottom: number;
|
|
325
337
|
left: number;
|
|
326
338
|
};
|
|
339
|
+
deviceOS?: string;
|
|
340
|
+
worldAppVersion?: number;
|
|
327
341
|
};
|
|
328
342
|
type UserNameService = {
|
|
329
343
|
walletAddress: string;
|
|
@@ -342,7 +356,8 @@ declare enum ResponseEvent {
|
|
|
342
356
|
MiniAppRequestPermission = "miniapp-request-permission",
|
|
343
357
|
MiniAppGetPermissions = "miniapp-get-permissions",
|
|
344
358
|
MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
|
|
345
|
-
MiniAppShare = "miniapp-share"
|
|
359
|
+
MiniAppShare = "miniapp-share",
|
|
360
|
+
MiniAppMicrophone = "miniapp-microphone"
|
|
346
361
|
}
|
|
347
362
|
type MiniAppVerifyActionSuccessPayload = {
|
|
348
363
|
status: 'success';
|
|
@@ -502,6 +517,17 @@ type MiniAppShareErrorPayload = {
|
|
|
502
517
|
version: number;
|
|
503
518
|
};
|
|
504
519
|
type MiniAppSharePayload = MiniAppShareSuccessPayload | MiniAppShareErrorPayload;
|
|
520
|
+
type MiniAppMicrophoneSuccessPayload = {
|
|
521
|
+
status: 'success';
|
|
522
|
+
version: number;
|
|
523
|
+
timestamp: string;
|
|
524
|
+
};
|
|
525
|
+
type MiniAppMicrophoneErrorPayload = {
|
|
526
|
+
status: 'error';
|
|
527
|
+
error_code: MicrophoneErrorCodes;
|
|
528
|
+
version: number;
|
|
529
|
+
};
|
|
530
|
+
type MiniAppMicrophonePayload = MiniAppMicrophoneSuccessPayload | MiniAppMicrophoneErrorPayload;
|
|
505
531
|
type EventPayloadMap = {
|
|
506
532
|
[ResponseEvent.MiniAppVerifyAction]: MiniAppVerifyActionPayload;
|
|
507
533
|
[ResponseEvent.MiniAppPayment]: MiniAppPaymentPayload;
|
|
@@ -514,12 +540,14 @@ type EventPayloadMap = {
|
|
|
514
540
|
[ResponseEvent.MiniAppGetPermissions]: MiniAppGetPermissionsPayload;
|
|
515
541
|
[ResponseEvent.MiniAppSendHapticFeedback]: MiniAppSendHapticFeedbackPayload;
|
|
516
542
|
[ResponseEvent.MiniAppShare]: MiniAppSharePayload;
|
|
543
|
+
[ResponseEvent.MiniAppMicrophone]: MiniAppMicrophonePayload;
|
|
517
544
|
};
|
|
518
545
|
type EventPayload<T extends ResponseEvent = ResponseEvent> = T extends keyof EventPayloadMap ? EventPayloadMap[T] : never;
|
|
519
546
|
type EventHandler<E extends ResponseEvent = ResponseEvent> = <T extends EventPayload<E>>(data: T) => void;
|
|
520
547
|
|
|
521
548
|
declare class MiniKit {
|
|
522
549
|
private static readonly MINIKIT_VERSION;
|
|
550
|
+
private static readonly MINIKIT_MINOR_VERSION;
|
|
523
551
|
private static readonly miniKitCommandVersion;
|
|
524
552
|
private static isCommandAvailable;
|
|
525
553
|
private static listeners;
|
|
@@ -601,4 +629,4 @@ declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonc
|
|
|
601
629
|
|
|
602
630
|
declare const getIsUserVerified: (walletAddress: string, rpcUrl?: string) => Promise<boolean>;
|
|
603
631
|
|
|
604
|
-
export { type AsyncHandlerReturn, Command, type CommandReturnPayload, type Contact, type DeviceProperties, type EventHandler, type EventPayload, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, 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 MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, PaymentValidationErrors, Permission, type PermissionSettings, 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 User, type UserNameService, VerificationErrorMessage, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, getIsUserVerified, parseSiweMessage, tokenToDecimals, verifySiweMessage };
|
|
632
|
+
export { type AsyncHandlerReturn, Command, type CommandReturnPayload, type Contact, type DeviceProperties, type EventHandler, type EventPayload, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, MicrophoneErrorCodes, MicrophoneErrorMessage, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, type MiniAppMicrophoneErrorPayload, type MiniAppMicrophonePayload, type MiniAppMicrophoneSuccessPayload, 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 MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, PaymentValidationErrors, Permission, type PermissionSettings, 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 User, type UserNameService, VerificationErrorMessage, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, getIsUserVerified, parseSiweMessage, tokenToDecimals, verifySiweMessage };
|
package/build/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare enum SendTransactionErrorCodes {
|
|
|
40
40
|
TransactionFailed = "transaction_failed",
|
|
41
41
|
GenericError = "generic_error",
|
|
42
42
|
DisallowedOperation = "disallowed_operation",
|
|
43
|
+
ValidationError = "validation_error",
|
|
43
44
|
InvalidContract = "invalid_contract",
|
|
44
45
|
MaliciousOperation = "malicious_operation",
|
|
45
46
|
DailyTxLimitReached = "daily_tx_limit_reached",
|
|
@@ -139,9 +140,17 @@ declare const ShareFilesErrorMessage: {
|
|
|
139
140
|
generic_error: string;
|
|
140
141
|
invalid_file_name: string;
|
|
141
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
|
+
};
|
|
142
151
|
|
|
143
152
|
declare enum Tokens {
|
|
144
|
-
|
|
153
|
+
USDC = "USDCE",
|
|
145
154
|
WLD = "WLD"
|
|
146
155
|
}
|
|
147
156
|
declare const TokenDecimals: {
|
|
@@ -255,7 +264,8 @@ type ShareContactsInput = {
|
|
|
255
264
|
type ShareContactsPayload = ShareContactsInput;
|
|
256
265
|
declare enum Permission {
|
|
257
266
|
Notifications = "notifications",
|
|
258
|
-
Contacts = "contacts"
|
|
267
|
+
Contacts = "contacts",
|
|
268
|
+
Microphone = "microphone"
|
|
259
269
|
}
|
|
260
270
|
type RequestPermissionInput = {
|
|
261
271
|
permission: Permission;
|
|
@@ -314,7 +324,9 @@ type User = {
|
|
|
314
324
|
contacts: boolean;
|
|
315
325
|
};
|
|
316
326
|
optedIntoOptionalAnalytics?: boolean;
|
|
327
|
+
/** @deprecated Moved to DeviceProperties */
|
|
317
328
|
worldAppVersion?: number;
|
|
329
|
+
/** @deprecated Moved to DeviceProperties */
|
|
318
330
|
deviceOS?: string;
|
|
319
331
|
};
|
|
320
332
|
type DeviceProperties = {
|
|
@@ -324,6 +336,8 @@ type DeviceProperties = {
|
|
|
324
336
|
bottom: number;
|
|
325
337
|
left: number;
|
|
326
338
|
};
|
|
339
|
+
deviceOS?: string;
|
|
340
|
+
worldAppVersion?: number;
|
|
327
341
|
};
|
|
328
342
|
type UserNameService = {
|
|
329
343
|
walletAddress: string;
|
|
@@ -342,7 +356,8 @@ declare enum ResponseEvent {
|
|
|
342
356
|
MiniAppRequestPermission = "miniapp-request-permission",
|
|
343
357
|
MiniAppGetPermissions = "miniapp-get-permissions",
|
|
344
358
|
MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
|
|
345
|
-
MiniAppShare = "miniapp-share"
|
|
359
|
+
MiniAppShare = "miniapp-share",
|
|
360
|
+
MiniAppMicrophone = "miniapp-microphone"
|
|
346
361
|
}
|
|
347
362
|
type MiniAppVerifyActionSuccessPayload = {
|
|
348
363
|
status: 'success';
|
|
@@ -502,6 +517,17 @@ type MiniAppShareErrorPayload = {
|
|
|
502
517
|
version: number;
|
|
503
518
|
};
|
|
504
519
|
type MiniAppSharePayload = MiniAppShareSuccessPayload | MiniAppShareErrorPayload;
|
|
520
|
+
type MiniAppMicrophoneSuccessPayload = {
|
|
521
|
+
status: 'success';
|
|
522
|
+
version: number;
|
|
523
|
+
timestamp: string;
|
|
524
|
+
};
|
|
525
|
+
type MiniAppMicrophoneErrorPayload = {
|
|
526
|
+
status: 'error';
|
|
527
|
+
error_code: MicrophoneErrorCodes;
|
|
528
|
+
version: number;
|
|
529
|
+
};
|
|
530
|
+
type MiniAppMicrophonePayload = MiniAppMicrophoneSuccessPayload | MiniAppMicrophoneErrorPayload;
|
|
505
531
|
type EventPayloadMap = {
|
|
506
532
|
[ResponseEvent.MiniAppVerifyAction]: MiniAppVerifyActionPayload;
|
|
507
533
|
[ResponseEvent.MiniAppPayment]: MiniAppPaymentPayload;
|
|
@@ -514,12 +540,14 @@ type EventPayloadMap = {
|
|
|
514
540
|
[ResponseEvent.MiniAppGetPermissions]: MiniAppGetPermissionsPayload;
|
|
515
541
|
[ResponseEvent.MiniAppSendHapticFeedback]: MiniAppSendHapticFeedbackPayload;
|
|
516
542
|
[ResponseEvent.MiniAppShare]: MiniAppSharePayload;
|
|
543
|
+
[ResponseEvent.MiniAppMicrophone]: MiniAppMicrophonePayload;
|
|
517
544
|
};
|
|
518
545
|
type EventPayload<T extends ResponseEvent = ResponseEvent> = T extends keyof EventPayloadMap ? EventPayloadMap[T] : never;
|
|
519
546
|
type EventHandler<E extends ResponseEvent = ResponseEvent> = <T extends EventPayload<E>>(data: T) => void;
|
|
520
547
|
|
|
521
548
|
declare class MiniKit {
|
|
522
549
|
private static readonly MINIKIT_VERSION;
|
|
550
|
+
private static readonly MINIKIT_MINOR_VERSION;
|
|
523
551
|
private static readonly miniKitCommandVersion;
|
|
524
552
|
private static isCommandAvailable;
|
|
525
553
|
private static listeners;
|
|
@@ -601,4 +629,4 @@ declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonc
|
|
|
601
629
|
|
|
602
630
|
declare const getIsUserVerified: (walletAddress: string, rpcUrl?: string) => Promise<boolean>;
|
|
603
631
|
|
|
604
|
-
export { type AsyncHandlerReturn, Command, type CommandReturnPayload, type Contact, type DeviceProperties, type EventHandler, type EventPayload, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, 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 MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, PaymentValidationErrors, Permission, type PermissionSettings, 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 User, type UserNameService, VerificationErrorMessage, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, getIsUserVerified, parseSiweMessage, tokenToDecimals, verifySiweMessage };
|
|
632
|
+
export { type AsyncHandlerReturn, Command, type CommandReturnPayload, type Contact, type DeviceProperties, type EventHandler, type EventPayload, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, MicrophoneErrorCodes, MicrophoneErrorMessage, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, type MiniAppMicrophoneErrorPayload, type MiniAppMicrophonePayload, type MiniAppMicrophoneSuccessPayload, 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 MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, PaymentValidationErrors, Permission, type PermissionSettings, 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 User, type UserNameService, VerificationErrorMessage, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, getIsUserVerified, parseSiweMessage, tokenToDecimals, verifySiweMessage };
|
package/build/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
Command,
|
|
4
4
|
GetPermissionsErrorCodes,
|
|
5
5
|
GetPermissionsErrorMessage,
|
|
6
|
+
MicrophoneErrorCodes,
|
|
7
|
+
MicrophoneErrorMessage,
|
|
6
8
|
MiniKit,
|
|
7
9
|
MiniKitInstallErrorCodes,
|
|
8
10
|
MiniKitInstallErrorMessage,
|
|
@@ -34,7 +36,7 @@ import {
|
|
|
34
36
|
parseSiweMessage,
|
|
35
37
|
tokenToDecimals,
|
|
36
38
|
verifySiweMessage
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-DKXMTG56.js";
|
|
38
40
|
|
|
39
41
|
// index.ts
|
|
40
42
|
import { VerificationLevel } from "@worldcoin/idkit-core";
|
|
@@ -97,6 +99,8 @@ export {
|
|
|
97
99
|
Command,
|
|
98
100
|
GetPermissionsErrorCodes,
|
|
99
101
|
GetPermissionsErrorMessage,
|
|
102
|
+
MicrophoneErrorCodes,
|
|
103
|
+
MicrophoneErrorMessage,
|
|
100
104
|
MiniKit,
|
|
101
105
|
MiniKitInstallErrorCodes,
|
|
102
106
|
MiniKitInstallErrorMessage,
|
|
@@ -31,12 +31,120 @@ var import_react = require("react");
|
|
|
31
31
|
var import_idkit_core3 = require("@worldcoin/idkit-core");
|
|
32
32
|
var import_hashing = require("@worldcoin/idkit-core/hashing");
|
|
33
33
|
|
|
34
|
+
// helpers/send-webview-event.ts
|
|
35
|
+
var sendWebviewEvent = (payload) => {
|
|
36
|
+
if (window.webkit) {
|
|
37
|
+
window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
|
|
38
|
+
} else if (window.Android) {
|
|
39
|
+
window.Android.postMessage?.(JSON.stringify(payload));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// types/errors.ts
|
|
44
|
+
var import_idkit_core = require("@worldcoin/idkit-core");
|
|
45
|
+
var import_idkit_core2 = require("@worldcoin/idkit-core");
|
|
46
|
+
var VerificationErrorMessage = {
|
|
47
|
+
[import_idkit_core.AppErrorCodes.VerificationRejected]: "You've cancelled the request in World App.",
|
|
48
|
+
[import_idkit_core.AppErrorCodes.MaxVerificationsReached]: "You have already verified the maximum number of times for this action.",
|
|
49
|
+
[import_idkit_core.AppErrorCodes.CredentialUnavailable]: "It seems you do not have the verification level required by this app.",
|
|
50
|
+
[import_idkit_core.AppErrorCodes.MalformedRequest]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
51
|
+
[import_idkit_core.AppErrorCodes.InvalidNetwork]: "Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details.",
|
|
52
|
+
[import_idkit_core.AppErrorCodes.InclusionProofFailed]: "There was an issue fetching your credential. Please try again.",
|
|
53
|
+
[import_idkit_core.AppErrorCodes.InclusionProofPending]: "Your identity is still being registered. Please wait a few minutes and try again.",
|
|
54
|
+
[import_idkit_core.AppErrorCodes.UnexpectedResponse]: "Unexpected response from your wallet. Please try again.",
|
|
55
|
+
[import_idkit_core.AppErrorCodes.FailedByHostApp]: "Verification failed by the app. Please contact the app owner for details.",
|
|
56
|
+
[import_idkit_core.AppErrorCodes.GenericError]: "Something unexpected went wrong. Please try again.",
|
|
57
|
+
[import_idkit_core.AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
|
|
58
|
+
};
|
|
59
|
+
var MiniKitInstallErrorMessage = {
|
|
60
|
+
["unknown" /* Unknown */]: "Failed to install MiniKit.",
|
|
61
|
+
["already_installed" /* AlreadyInstalled */]: "MiniKit is already installed.",
|
|
62
|
+
["outside_of_worldapp" /* OutsideOfWorldApp */]: "MiniApp launched outside of WorldApp.",
|
|
63
|
+
["not_on_client" /* NotOnClient */]: "Window object is not available.",
|
|
64
|
+
["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// helpers/microphone/index.ts
|
|
68
|
+
var microphoneSetupDone = false;
|
|
69
|
+
var setupMicrophone = () => {
|
|
70
|
+
if (microphoneSetupDone) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (typeof navigator !== "undefined" && !navigator.mediaDevices?.getUserMedia)
|
|
74
|
+
return;
|
|
75
|
+
const originalStop = MediaStreamTrack.prototype.stop;
|
|
76
|
+
MediaStreamTrack.prototype.stop = function() {
|
|
77
|
+
originalStop.call(this);
|
|
78
|
+
if (this.readyState === "ended") {
|
|
79
|
+
setTimeout(() => this.dispatchEvent(new Event("ended")), 0);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const realGUM = navigator.mediaDevices.getUserMedia.bind(
|
|
83
|
+
navigator.mediaDevices
|
|
84
|
+
);
|
|
85
|
+
const live = /* @__PURE__ */ new Set();
|
|
86
|
+
async function wrapped(constraints) {
|
|
87
|
+
const stream = await realGUM(constraints);
|
|
88
|
+
sendWebviewEvent({
|
|
89
|
+
command: "microphone-stream-started",
|
|
90
|
+
version: 1,
|
|
91
|
+
payload: {
|
|
92
|
+
streamId: stream.id
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
live.add(stream);
|
|
96
|
+
stream.getTracks().forEach((t) => {
|
|
97
|
+
t.addEventListener("ended", () => {
|
|
98
|
+
sendWebviewEvent({
|
|
99
|
+
command: "microphone-stream-ended",
|
|
100
|
+
version: 1,
|
|
101
|
+
payload: {
|
|
102
|
+
streamId: stream.id
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
live.delete(stream);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
return stream;
|
|
109
|
+
}
|
|
110
|
+
Object.defineProperty(navigator.mediaDevices, "getUserMedia", {
|
|
111
|
+
value: wrapped,
|
|
112
|
+
writable: false,
|
|
113
|
+
configurable: false,
|
|
114
|
+
enumerable: true
|
|
115
|
+
});
|
|
116
|
+
Object.freeze(navigator.mediaDevices);
|
|
117
|
+
const stopAllMiniAppMicrophoneStreams = () => {
|
|
118
|
+
live.forEach((s) => {
|
|
119
|
+
s.getTracks().forEach((t) => {
|
|
120
|
+
t.stop();
|
|
121
|
+
sendWebviewEvent({
|
|
122
|
+
command: "microphone-stream-ended",
|
|
123
|
+
version: 1,
|
|
124
|
+
payload: {
|
|
125
|
+
streamId: s.id
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
live.clear();
|
|
131
|
+
};
|
|
132
|
+
MiniKit.subscribe("miniapp-microphone" /* MiniAppMicrophone */, (payload) => {
|
|
133
|
+
if (payload.status === "error" && (payload.error_code === "mini_app_permission_not_enabled" /* MiniAppPermissionNotEnabled */ || payload.error_code === "world_app_permission_not_enabled" /* WorldAppPermissionNotEnabled */)) {
|
|
134
|
+
console.log("stopping all microphone streams", payload);
|
|
135
|
+
stopAllMiniAppMicrophoneStreams();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
window.__stopAllMiniAppMicrophoneStreams = stopAllMiniAppMicrophoneStreams;
|
|
139
|
+
microphoneSetupDone = true;
|
|
140
|
+
};
|
|
141
|
+
|
|
34
142
|
// helpers/payment/client.ts
|
|
35
143
|
var validatePaymentPayload = (payload) => {
|
|
36
144
|
if (payload.tokens.some(
|
|
37
|
-
(token) => token.symbol == "USDCE" && parseFloat(token.token_amount) < 0.1
|
|
145
|
+
(token) => token.symbol == "USDCE" /* USDC */ && parseFloat(token.token_amount) < 0.1
|
|
38
146
|
)) {
|
|
39
|
-
console.error("
|
|
147
|
+
console.error("USDC amount should be greater than $0.1");
|
|
40
148
|
return false;
|
|
41
149
|
}
|
|
42
150
|
if (payload.reference.length > 36) {
|
|
@@ -316,39 +424,6 @@ var getUserProfile = async (address) => {
|
|
|
316
424
|
return usernames?.[0] ?? { username: null, profile_picture_url: null };
|
|
317
425
|
};
|
|
318
426
|
|
|
319
|
-
// types/errors.ts
|
|
320
|
-
var import_idkit_core = require("@worldcoin/idkit-core");
|
|
321
|
-
var import_idkit_core2 = require("@worldcoin/idkit-core");
|
|
322
|
-
var VerificationErrorMessage = {
|
|
323
|
-
[import_idkit_core.AppErrorCodes.VerificationRejected]: "You've cancelled the request in World App.",
|
|
324
|
-
[import_idkit_core.AppErrorCodes.MaxVerificationsReached]: "You have already verified the maximum number of times for this action.",
|
|
325
|
-
[import_idkit_core.AppErrorCodes.CredentialUnavailable]: "It seems you do not have the verification level required by this app.",
|
|
326
|
-
[import_idkit_core.AppErrorCodes.MalformedRequest]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
327
|
-
[import_idkit_core.AppErrorCodes.InvalidNetwork]: "Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details.",
|
|
328
|
-
[import_idkit_core.AppErrorCodes.InclusionProofFailed]: "There was an issue fetching your credential. Please try again.",
|
|
329
|
-
[import_idkit_core.AppErrorCodes.InclusionProofPending]: "Your identity is still being registered. Please wait a few minutes and try again.",
|
|
330
|
-
[import_idkit_core.AppErrorCodes.UnexpectedResponse]: "Unexpected response from your wallet. Please try again.",
|
|
331
|
-
[import_idkit_core.AppErrorCodes.FailedByHostApp]: "Verification failed by the app. Please contact the app owner for details.",
|
|
332
|
-
[import_idkit_core.AppErrorCodes.GenericError]: "Something unexpected went wrong. Please try again.",
|
|
333
|
-
[import_idkit_core.AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
|
|
334
|
-
};
|
|
335
|
-
var MiniKitInstallErrorMessage = {
|
|
336
|
-
["unknown" /* Unknown */]: "Failed to install MiniKit.",
|
|
337
|
-
["already_installed" /* AlreadyInstalled */]: "MiniKit is already installed.",
|
|
338
|
-
["outside_of_worldapp" /* OutsideOfWorldApp */]: "MiniApp launched outside of WorldApp.",
|
|
339
|
-
["not_on_client" /* NotOnClient */]: "Window object is not available.",
|
|
340
|
-
["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
// helpers/send-webview-event.ts
|
|
344
|
-
var sendWebviewEvent = (payload) => {
|
|
345
|
-
if (window.webkit) {
|
|
346
|
-
window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
|
|
347
|
-
} else if (window.Android) {
|
|
348
|
-
window.Android.postMessage?.(JSON.stringify(payload));
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
|
|
352
427
|
// minikit.ts
|
|
353
428
|
var sendMiniKitEvent = (payload) => {
|
|
354
429
|
sendWebviewEvent(payload);
|
|
@@ -357,7 +432,10 @@ var _MiniKit = class _MiniKit {
|
|
|
357
432
|
static sendInit() {
|
|
358
433
|
sendWebviewEvent({
|
|
359
434
|
command: "init",
|
|
360
|
-
payload: {
|
|
435
|
+
payload: {
|
|
436
|
+
version: this.MINIKIT_VERSION,
|
|
437
|
+
minorVersion: this.MINIKIT_MINOR_VERSION
|
|
438
|
+
}
|
|
361
439
|
});
|
|
362
440
|
}
|
|
363
441
|
static subscribe(event, handler) {
|
|
@@ -473,6 +551,8 @@ var _MiniKit = class _MiniKit {
|
|
|
473
551
|
_MiniKit.user.deviceOS = window.WorldApp.device_os;
|
|
474
552
|
_MiniKit.user.worldAppVersion = window.WorldApp.world_app_version;
|
|
475
553
|
_MiniKit.deviceProperties.safeAreaInsets = window.WorldApp.safe_area_insets;
|
|
554
|
+
_MiniKit.deviceProperties.deviceOS = window.WorldApp.device_os;
|
|
555
|
+
_MiniKit.deviceProperties.worldAppVersion = window.WorldApp.world_app_version;
|
|
476
556
|
try {
|
|
477
557
|
window.MiniKit = _MiniKit;
|
|
478
558
|
this.sendInit();
|
|
@@ -488,6 +568,7 @@ var _MiniKit = class _MiniKit {
|
|
|
488
568
|
};
|
|
489
569
|
}
|
|
490
570
|
_MiniKit.isReady = true;
|
|
571
|
+
setupMicrophone();
|
|
491
572
|
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
492
573
|
return {
|
|
493
574
|
success: false,
|
|
@@ -508,6 +589,7 @@ var _MiniKit = class _MiniKit {
|
|
|
508
589
|
}
|
|
509
590
|
};
|
|
510
591
|
_MiniKit.MINIKIT_VERSION = 1;
|
|
592
|
+
_MiniKit.MINIKIT_MINOR_VERSION = 96;
|
|
511
593
|
_MiniKit.miniKitCommandVersion = {
|
|
512
594
|
["verify" /* Verify */]: 1,
|
|
513
595
|
["pay" /* Pay */]: 1,
|
|
@@ -556,6 +638,8 @@ _MiniKit.listeners = {
|
|
|
556
638
|
["miniapp-send-haptic-feedback" /* MiniAppSendHapticFeedback */]: () => {
|
|
557
639
|
},
|
|
558
640
|
["miniapp-share" /* MiniAppShare */]: () => {
|
|
641
|
+
},
|
|
642
|
+
["miniapp-microphone" /* MiniAppMicrophone */]: () => {
|
|
559
643
|
}
|
|
560
644
|
};
|
|
561
645
|
_MiniKit.appId = null;
|
|
@@ -792,7 +876,12 @@ _MiniKit.commands = {
|
|
|
792
876
|
);
|
|
793
877
|
return null;
|
|
794
878
|
}
|
|
795
|
-
if (_MiniKit.
|
|
879
|
+
if (_MiniKit.deviceProperties.deviceOS === "ios" && typeof navigator !== "undefined") {
|
|
880
|
+
sendMiniKitEvent({
|
|
881
|
+
command: "share" /* Share */,
|
|
882
|
+
version: _MiniKit.miniKitCommandVersion["share" /* Share */],
|
|
883
|
+
payload
|
|
884
|
+
});
|
|
796
885
|
navigator.share(payload);
|
|
797
886
|
} else {
|
|
798
887
|
formatShareInput(payload).then((formattedResult) => {
|
|
@@ -990,15 +1079,18 @@ var MiniKit = _MiniKit;
|
|
|
990
1079
|
// minikit-provider.tsx
|
|
991
1080
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
992
1081
|
var MiniKitContext = (0, import_react.createContext)({
|
|
993
|
-
isInstalled:
|
|
1082
|
+
isInstalled: void 0
|
|
994
1083
|
});
|
|
995
1084
|
var MiniKitProvider = ({
|
|
996
1085
|
children,
|
|
997
1086
|
props
|
|
998
1087
|
}) => {
|
|
999
|
-
const [isInstalled, setIsInstalled] = (0, import_react.useState)(
|
|
1088
|
+
const [isInstalled, setIsInstalled] = (0, import_react.useState)(
|
|
1089
|
+
void 0
|
|
1090
|
+
);
|
|
1000
1091
|
(0, import_react.useEffect)(() => {
|
|
1001
|
-
MiniKit.install(props?.appId);
|
|
1092
|
+
const { success } = MiniKit.install(props?.appId);
|
|
1093
|
+
if (!success) return setIsInstalled(false);
|
|
1002
1094
|
MiniKit.commandsAsync.getPermissions().then(({ commandPayload: _, finalPayload }) => {
|
|
1003
1095
|
if (finalPayload.status === "success") {
|
|
1004
1096
|
MiniKit.user.permissions = {
|
|
@@ -1007,7 +1099,7 @@ var MiniKitProvider = ({
|
|
|
1007
1099
|
};
|
|
1008
1100
|
}
|
|
1009
1101
|
});
|
|
1010
|
-
setIsInstalled(
|
|
1102
|
+
setIsInstalled(success);
|
|
1011
1103
|
}, [props?.appId]);
|
|
1012
1104
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MiniKitContext.Provider, { value: { isInstalled }, children });
|
|
1013
1105
|
};
|
|
@@ -9,7 +9,7 @@ declare const MiniKitProvider: ({ children, props, }: {
|
|
|
9
9
|
props?: MiniKitProps;
|
|
10
10
|
}) => react_jsx_runtime.JSX.Element;
|
|
11
11
|
declare const useMiniKit: () => {
|
|
12
|
-
isInstalled: boolean;
|
|
12
|
+
isInstalled: boolean | undefined;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export { MiniKitProvider, useMiniKit };
|
|
@@ -9,7 +9,7 @@ declare const MiniKitProvider: ({ children, props, }: {
|
|
|
9
9
|
props?: MiniKitProps;
|
|
10
10
|
}) => react_jsx_runtime.JSX.Element;
|
|
11
11
|
declare const useMiniKit: () => {
|
|
12
|
-
isInstalled: boolean;
|
|
12
|
+
isInstalled: boolean | undefined;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export { MiniKitProvider, useMiniKit };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
MiniKit
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DKXMTG56.js";
|
|
5
5
|
|
|
6
6
|
// minikit-provider.tsx
|
|
7
7
|
import {
|
|
@@ -12,15 +12,18 @@ import {
|
|
|
12
12
|
} from "react";
|
|
13
13
|
import { jsx } from "react/jsx-runtime";
|
|
14
14
|
var MiniKitContext = createContext({
|
|
15
|
-
isInstalled:
|
|
15
|
+
isInstalled: void 0
|
|
16
16
|
});
|
|
17
17
|
var MiniKitProvider = ({
|
|
18
18
|
children,
|
|
19
19
|
props
|
|
20
20
|
}) => {
|
|
21
|
-
const [isInstalled, setIsInstalled] = useState(
|
|
21
|
+
const [isInstalled, setIsInstalled] = useState(
|
|
22
|
+
void 0
|
|
23
|
+
);
|
|
22
24
|
useEffect(() => {
|
|
23
|
-
MiniKit.install(props?.appId);
|
|
25
|
+
const { success } = MiniKit.install(props?.appId);
|
|
26
|
+
if (!success) return setIsInstalled(false);
|
|
24
27
|
MiniKit.commandsAsync.getPermissions().then(({ commandPayload: _, finalPayload }) => {
|
|
25
28
|
if (finalPayload.status === "success") {
|
|
26
29
|
MiniKit.user.permissions = {
|
|
@@ -29,7 +32,7 @@ var MiniKitProvider = ({
|
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
34
|
});
|
|
32
|
-
setIsInstalled(
|
|
35
|
+
setIsInstalled(success);
|
|
33
36
|
}, [props?.appId]);
|
|
34
37
|
return /* @__PURE__ */ jsx(MiniKitContext.Provider, { value: { isInstalled }, children });
|
|
35
38
|
};
|