@worldcoin/minikit-js 1.9.5 → 1.9.7
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-Q55KYUW6.js} +344 -231
- package/build/index.cjs +338 -223
- package/build/index.d.cts +33 -5
- package/build/index.d.ts +33 -5
- package/build/index.js +5 -1
- package/build/minikit-provider.cjs +145 -44
- package/build/minikit-provider.d.cts +4 -3
- package/build/minikit-provider.d.ts +4 -3
- package/build/minikit-provider.js +10 -7
- 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,19 +540,21 @@ 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;
|
|
526
554
|
static appId: string | null;
|
|
527
555
|
static user: User;
|
|
528
|
-
private static isReady;
|
|
529
556
|
static deviceProperties: DeviceProperties;
|
|
557
|
+
private static isReady;
|
|
530
558
|
private static sendInit;
|
|
531
559
|
static subscribe<E extends ResponseEvent>(event: E, handler: EventHandler<E>): void;
|
|
532
560
|
static unsubscribe(event: ResponseEvent): void;
|
|
@@ -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,19 +540,21 @@ 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;
|
|
526
554
|
static appId: string | null;
|
|
527
555
|
static user: User;
|
|
528
|
-
private static isReady;
|
|
529
556
|
static deviceProperties: DeviceProperties;
|
|
557
|
+
private static isReady;
|
|
530
558
|
private static sendInit;
|
|
531
559
|
static subscribe<E extends ResponseEvent>(event: E, handler: EventHandler<E>): void;
|
|
532
560
|
static unsubscribe(event: ResponseEvent): void;
|
|
@@ -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-Q55KYUW6.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,129 @@ 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
|
+
const hasAudioTrack = stream.getAudioTracks().length > 0;
|
|
89
|
+
if (hasAudioTrack) {
|
|
90
|
+
sendWebviewEvent({
|
|
91
|
+
command: "microphone-stream-started",
|
|
92
|
+
version: 1,
|
|
93
|
+
payload: {
|
|
94
|
+
streamId: stream.id
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
live.add(stream);
|
|
98
|
+
stream.getAudioTracks().forEach((t) => {
|
|
99
|
+
t.addEventListener("ended", () => {
|
|
100
|
+
const allAudioTracksEnded = stream.getAudioTracks().every((track) => track.readyState === "ended");
|
|
101
|
+
if (allAudioTracksEnded) {
|
|
102
|
+
sendWebviewEvent({
|
|
103
|
+
command: "microphone-stream-ended",
|
|
104
|
+
version: 1,
|
|
105
|
+
payload: {
|
|
106
|
+
streamId: stream.id
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
live.delete(stream);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return stream;
|
|
115
|
+
}
|
|
116
|
+
Object.defineProperty(navigator.mediaDevices, "getUserMedia", {
|
|
117
|
+
value: wrapped,
|
|
118
|
+
writable: false,
|
|
119
|
+
configurable: false,
|
|
120
|
+
enumerable: true
|
|
121
|
+
});
|
|
122
|
+
Object.freeze(navigator.mediaDevices);
|
|
123
|
+
const stopAllMiniAppMicrophoneStreams = () => {
|
|
124
|
+
live.forEach((s) => {
|
|
125
|
+
const audioTracks = s.getAudioTracks();
|
|
126
|
+
if (audioTracks.length > 0) {
|
|
127
|
+
audioTracks.forEach((t) => {
|
|
128
|
+
t.stop();
|
|
129
|
+
});
|
|
130
|
+
sendWebviewEvent({
|
|
131
|
+
command: "microphone-stream-ended",
|
|
132
|
+
version: 1,
|
|
133
|
+
payload: {
|
|
134
|
+
streamId: s.id
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
live.clear();
|
|
140
|
+
};
|
|
141
|
+
MiniKit.subscribe("miniapp-microphone" /* MiniAppMicrophone */, (payload) => {
|
|
142
|
+
if (payload.status === "error" && (payload.error_code === "mini_app_permission_not_enabled" /* MiniAppPermissionNotEnabled */ || payload.error_code === "world_app_permission_not_enabled" /* WorldAppPermissionNotEnabled */)) {
|
|
143
|
+
console.log("stopping all microphone streams", payload);
|
|
144
|
+
stopAllMiniAppMicrophoneStreams();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
window.__stopAllMiniAppMicrophoneStreams = stopAllMiniAppMicrophoneStreams;
|
|
148
|
+
microphoneSetupDone = true;
|
|
149
|
+
};
|
|
150
|
+
|
|
34
151
|
// helpers/payment/client.ts
|
|
35
152
|
var validatePaymentPayload = (payload) => {
|
|
36
153
|
if (payload.tokens.some(
|
|
37
|
-
(token) => token.symbol == "USDCE" && parseFloat(token.token_amount) < 0.1
|
|
154
|
+
(token) => token.symbol == "USDCE" /* USDC */ && parseFloat(token.token_amount) < 0.1
|
|
38
155
|
)) {
|
|
39
|
-
console.error("
|
|
156
|
+
console.error("USDC amount should be greater than $0.1");
|
|
40
157
|
return false;
|
|
41
158
|
}
|
|
42
159
|
if (payload.reference.length > 36) {
|
|
@@ -316,39 +433,6 @@ var getUserProfile = async (address) => {
|
|
|
316
433
|
return usernames?.[0] ?? { username: null, profile_picture_url: null };
|
|
317
434
|
};
|
|
318
435
|
|
|
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
436
|
// minikit.ts
|
|
353
437
|
var sendMiniKitEvent = (payload) => {
|
|
354
438
|
sendWebviewEvent(payload);
|
|
@@ -357,7 +441,10 @@ var _MiniKit = class _MiniKit {
|
|
|
357
441
|
static sendInit() {
|
|
358
442
|
sendWebviewEvent({
|
|
359
443
|
command: "init",
|
|
360
|
-
payload: {
|
|
444
|
+
payload: {
|
|
445
|
+
version: this.MINIKIT_VERSION,
|
|
446
|
+
minorVersion: this.MINIKIT_MINOR_VERSION
|
|
447
|
+
}
|
|
361
448
|
});
|
|
362
449
|
}
|
|
363
450
|
static subscribe(event, handler) {
|
|
@@ -473,6 +560,8 @@ var _MiniKit = class _MiniKit {
|
|
|
473
560
|
_MiniKit.user.deviceOS = window.WorldApp.device_os;
|
|
474
561
|
_MiniKit.user.worldAppVersion = window.WorldApp.world_app_version;
|
|
475
562
|
_MiniKit.deviceProperties.safeAreaInsets = window.WorldApp.safe_area_insets;
|
|
563
|
+
_MiniKit.deviceProperties.deviceOS = window.WorldApp.device_os;
|
|
564
|
+
_MiniKit.deviceProperties.worldAppVersion = window.WorldApp.world_app_version;
|
|
476
565
|
try {
|
|
477
566
|
window.MiniKit = _MiniKit;
|
|
478
567
|
this.sendInit();
|
|
@@ -488,6 +577,7 @@ var _MiniKit = class _MiniKit {
|
|
|
488
577
|
};
|
|
489
578
|
}
|
|
490
579
|
_MiniKit.isReady = true;
|
|
580
|
+
setupMicrophone();
|
|
491
581
|
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
492
582
|
return {
|
|
493
583
|
success: false,
|
|
@@ -508,6 +598,7 @@ var _MiniKit = class _MiniKit {
|
|
|
508
598
|
}
|
|
509
599
|
};
|
|
510
600
|
_MiniKit.MINIKIT_VERSION = 1;
|
|
601
|
+
_MiniKit.MINIKIT_MINOR_VERSION = 96;
|
|
511
602
|
_MiniKit.miniKitCommandVersion = {
|
|
512
603
|
["verify" /* Verify */]: 1,
|
|
513
604
|
["pay" /* Pay */]: 1,
|
|
@@ -556,12 +647,14 @@ _MiniKit.listeners = {
|
|
|
556
647
|
["miniapp-send-haptic-feedback" /* MiniAppSendHapticFeedback */]: () => {
|
|
557
648
|
},
|
|
558
649
|
["miniapp-share" /* MiniAppShare */]: () => {
|
|
650
|
+
},
|
|
651
|
+
["miniapp-microphone" /* MiniAppMicrophone */]: () => {
|
|
559
652
|
}
|
|
560
653
|
};
|
|
561
654
|
_MiniKit.appId = null;
|
|
562
655
|
_MiniKit.user = {};
|
|
563
|
-
_MiniKit.isReady = false;
|
|
564
656
|
_MiniKit.deviceProperties = {};
|
|
657
|
+
_MiniKit.isReady = false;
|
|
565
658
|
_MiniKit.getUserByAddress = async (address) => {
|
|
566
659
|
const userProfile = await getUserProfile(
|
|
567
660
|
address ?? _MiniKit.user.walletAddress
|
|
@@ -792,7 +885,12 @@ _MiniKit.commands = {
|
|
|
792
885
|
);
|
|
793
886
|
return null;
|
|
794
887
|
}
|
|
795
|
-
if (_MiniKit.
|
|
888
|
+
if (_MiniKit.deviceProperties.deviceOS === "ios" && typeof navigator !== "undefined") {
|
|
889
|
+
sendMiniKitEvent({
|
|
890
|
+
command: "share" /* Share */,
|
|
891
|
+
version: _MiniKit.miniKitCommandVersion["share" /* Share */],
|
|
892
|
+
payload
|
|
893
|
+
});
|
|
796
894
|
navigator.share(payload);
|
|
797
895
|
} else {
|
|
798
896
|
formatShareInput(payload).then((formattedResult) => {
|
|
@@ -989,16 +1087,19 @@ var MiniKit = _MiniKit;
|
|
|
989
1087
|
|
|
990
1088
|
// minikit-provider.tsx
|
|
991
1089
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
992
|
-
var MiniKitContext = (0, import_react.createContext)(
|
|
993
|
-
|
|
994
|
-
|
|
1090
|
+
var MiniKitContext = (0, import_react.createContext)(
|
|
1091
|
+
void 0
|
|
1092
|
+
);
|
|
995
1093
|
var MiniKitProvider = ({
|
|
996
1094
|
children,
|
|
997
1095
|
props
|
|
998
1096
|
}) => {
|
|
999
|
-
const [isInstalled, setIsInstalled] = (0, import_react.useState)(
|
|
1097
|
+
const [isInstalled, setIsInstalled] = (0, import_react.useState)(
|
|
1098
|
+
void 0
|
|
1099
|
+
);
|
|
1000
1100
|
(0, import_react.useEffect)(() => {
|
|
1001
|
-
MiniKit.install(props?.appId);
|
|
1101
|
+
const { success } = MiniKit.install(props?.appId);
|
|
1102
|
+
if (!success) return setIsInstalled(false);
|
|
1002
1103
|
MiniKit.commandsAsync.getPermissions().then(({ commandPayload: _, finalPayload }) => {
|
|
1003
1104
|
if (finalPayload.status === "success") {
|
|
1004
1105
|
MiniKit.user.permissions = {
|
|
@@ -1007,7 +1108,7 @@ var MiniKitProvider = ({
|
|
|
1007
1108
|
};
|
|
1008
1109
|
}
|
|
1009
1110
|
});
|
|
1010
|
-
setIsInstalled(
|
|
1111
|
+
setIsInstalled(success);
|
|
1011
1112
|
}, [props?.appId]);
|
|
1012
1113
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MiniKitContext.Provider, { value: { isInstalled }, children });
|
|
1013
1114
|
};
|
|
@@ -4,12 +4,13 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
type MiniKitProps = {
|
|
5
5
|
appId: string;
|
|
6
6
|
};
|
|
7
|
+
type MiniKitContextValue = {
|
|
8
|
+
isInstalled: boolean | undefined;
|
|
9
|
+
};
|
|
7
10
|
declare const MiniKitProvider: ({ children, props, }: {
|
|
8
11
|
children: ReactNode;
|
|
9
12
|
props?: MiniKitProps;
|
|
10
13
|
}) => react_jsx_runtime.JSX.Element;
|
|
11
|
-
declare const useMiniKit: () =>
|
|
12
|
-
isInstalled: boolean;
|
|
13
|
-
};
|
|
14
|
+
declare const useMiniKit: () => MiniKitContextValue;
|
|
14
15
|
|
|
15
16
|
export { MiniKitProvider, useMiniKit };
|
|
@@ -4,12 +4,13 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
type MiniKitProps = {
|
|
5
5
|
appId: string;
|
|
6
6
|
};
|
|
7
|
+
type MiniKitContextValue = {
|
|
8
|
+
isInstalled: boolean | undefined;
|
|
9
|
+
};
|
|
7
10
|
declare const MiniKitProvider: ({ children, props, }: {
|
|
8
11
|
children: ReactNode;
|
|
9
12
|
props?: MiniKitProps;
|
|
10
13
|
}) => react_jsx_runtime.JSX.Element;
|
|
11
|
-
declare const useMiniKit: () =>
|
|
12
|
-
isInstalled: boolean;
|
|
13
|
-
};
|
|
14
|
+
declare const useMiniKit: () => MiniKitContextValue;
|
|
14
15
|
|
|
15
16
|
export { MiniKitProvider, useMiniKit };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
MiniKit
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q55KYUW6.js";
|
|
5
5
|
|
|
6
6
|
// minikit-provider.tsx
|
|
7
7
|
import {
|
|
@@ -11,16 +11,19 @@ import {
|
|
|
11
11
|
useState
|
|
12
12
|
} from "react";
|
|
13
13
|
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
var MiniKitContext = createContext(
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
var MiniKitContext = createContext(
|
|
15
|
+
void 0
|
|
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
|
};
|