@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
|
@@ -1,11 +1,224 @@
|
|
|
1
|
+
// types/errors.ts
|
|
2
|
+
import { AppErrorCodes } from "@worldcoin/idkit-core";
|
|
3
|
+
import { AppErrorCodes as AppErrorCodes2 } from "@worldcoin/idkit-core";
|
|
4
|
+
var VerificationErrorMessage = {
|
|
5
|
+
[AppErrorCodes.VerificationRejected]: "You've cancelled the request in World App.",
|
|
6
|
+
[AppErrorCodes.MaxVerificationsReached]: "You have already verified the maximum number of times for this action.",
|
|
7
|
+
[AppErrorCodes.CredentialUnavailable]: "It seems you do not have the verification level required by this app.",
|
|
8
|
+
[AppErrorCodes.MalformedRequest]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
9
|
+
[AppErrorCodes.InvalidNetwork]: "Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details.",
|
|
10
|
+
[AppErrorCodes.InclusionProofFailed]: "There was an issue fetching your credential. Please try again.",
|
|
11
|
+
[AppErrorCodes.InclusionProofPending]: "Your identity is still being registered. Please wait a few minutes and try again.",
|
|
12
|
+
[AppErrorCodes.UnexpectedResponse]: "Unexpected response from your wallet. Please try again.",
|
|
13
|
+
[AppErrorCodes.FailedByHostApp]: "Verification failed by the app. Please contact the app owner for details.",
|
|
14
|
+
[AppErrorCodes.GenericError]: "Something unexpected went wrong. Please try again.",
|
|
15
|
+
[AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
|
|
16
|
+
};
|
|
17
|
+
var PaymentErrorCodes = /* @__PURE__ */ ((PaymentErrorCodes2) => {
|
|
18
|
+
PaymentErrorCodes2["InputError"] = "input_error";
|
|
19
|
+
PaymentErrorCodes2["UserRejected"] = "user_rejected";
|
|
20
|
+
PaymentErrorCodes2["PaymentRejected"] = "payment_rejected";
|
|
21
|
+
PaymentErrorCodes2["InvalidReceiver"] = "invalid_receiver";
|
|
22
|
+
PaymentErrorCodes2["InsufficientBalance"] = "insufficient_balance";
|
|
23
|
+
PaymentErrorCodes2["TransactionFailed"] = "transaction_failed";
|
|
24
|
+
PaymentErrorCodes2["GenericError"] = "generic_error";
|
|
25
|
+
PaymentErrorCodes2["UserBlocked"] = "user_blocked";
|
|
26
|
+
return PaymentErrorCodes2;
|
|
27
|
+
})(PaymentErrorCodes || {});
|
|
28
|
+
var PaymentErrorMessage = {
|
|
29
|
+
["input_error" /* InputError */]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
30
|
+
["user_rejected" /* UserRejected */]: "You have cancelled the payment in World App.",
|
|
31
|
+
["payment_rejected" /* PaymentRejected */]: "You've cancelled the payment in World App.",
|
|
32
|
+
["invalid_receiver" /* InvalidReceiver */]: "The receiver address is invalid. Please contact the app owner.",
|
|
33
|
+
["insufficient_balance" /* InsufficientBalance */]: "You do not have enough balance to complete this transaction.",
|
|
34
|
+
["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again.",
|
|
35
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
36
|
+
["user_blocked" /* UserBlocked */]: "User's region is blocked from making payments."
|
|
37
|
+
};
|
|
38
|
+
var PaymentValidationErrors = /* @__PURE__ */ ((PaymentValidationErrors2) => {
|
|
39
|
+
PaymentValidationErrors2["MalformedRequest"] = "There was a problem with this request. Please try again or contact the app owner.";
|
|
40
|
+
PaymentValidationErrors2["InvalidTokenAddress"] = "The token address is invalid. Please contact the app owner.";
|
|
41
|
+
PaymentValidationErrors2["InvalidAppId"] = "The app ID is invalid. Please contact the app owner.";
|
|
42
|
+
PaymentValidationErrors2["DuplicateReference"] = "This reference ID already exists please generate a new one and try again.";
|
|
43
|
+
return PaymentValidationErrors2;
|
|
44
|
+
})(PaymentValidationErrors || {});
|
|
45
|
+
var WalletAuthErrorCodes = /* @__PURE__ */ ((WalletAuthErrorCodes2) => {
|
|
46
|
+
WalletAuthErrorCodes2["MalformedRequest"] = "malformed_request";
|
|
47
|
+
WalletAuthErrorCodes2["UserRejected"] = "user_rejected";
|
|
48
|
+
WalletAuthErrorCodes2["GenericError"] = "generic_error";
|
|
49
|
+
return WalletAuthErrorCodes2;
|
|
50
|
+
})(WalletAuthErrorCodes || {});
|
|
51
|
+
var WalletAuthErrorMessage = {
|
|
52
|
+
["malformed_request" /* MalformedRequest */]: "Provided parameters in the request are invalid.",
|
|
53
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
54
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
55
|
+
};
|
|
56
|
+
var SendTransactionErrorCodes = /* @__PURE__ */ ((SendTransactionErrorCodes2) => {
|
|
57
|
+
SendTransactionErrorCodes2["InvalidOperation"] = "invalid_operation";
|
|
58
|
+
SendTransactionErrorCodes2["UserRejected"] = "user_rejected";
|
|
59
|
+
SendTransactionErrorCodes2["InputError"] = "input_error";
|
|
60
|
+
SendTransactionErrorCodes2["SimulationFailed"] = "simulation_failed";
|
|
61
|
+
SendTransactionErrorCodes2["TransactionFailed"] = "transaction_failed";
|
|
62
|
+
SendTransactionErrorCodes2["GenericError"] = "generic_error";
|
|
63
|
+
SendTransactionErrorCodes2["DisallowedOperation"] = "disallowed_operation";
|
|
64
|
+
SendTransactionErrorCodes2["ValidationError"] = "validation_error";
|
|
65
|
+
SendTransactionErrorCodes2["InvalidContract"] = "invalid_contract";
|
|
66
|
+
SendTransactionErrorCodes2["MaliciousOperation"] = "malicious_operation";
|
|
67
|
+
SendTransactionErrorCodes2["DailyTxLimitReached"] = "daily_tx_limit_reached";
|
|
68
|
+
SendTransactionErrorCodes2["PermittedAmountExceedsSlippage"] = "permitted_amount_exceeds_slippage";
|
|
69
|
+
SendTransactionErrorCodes2["PermittedAmountNotFound"] = "permitted_amount_not_found";
|
|
70
|
+
return SendTransactionErrorCodes2;
|
|
71
|
+
})(SendTransactionErrorCodes || {});
|
|
72
|
+
var SendTransactionErrorMessage = {
|
|
73
|
+
["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
|
|
74
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
75
|
+
["input_error" /* InputError */]: "Invalid payload.",
|
|
76
|
+
["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
|
|
77
|
+
["validation_error" /* ValidationError */]: "The transaction validation failed. Please try again.",
|
|
78
|
+
["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again later.",
|
|
79
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
80
|
+
["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
|
|
81
|
+
["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
|
|
82
|
+
["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious.",
|
|
83
|
+
["daily_tx_limit_reached" /* DailyTxLimitReached */]: "Daily transaction limit reached. Max 100 transactions per day. Wait until the next day.",
|
|
84
|
+
["permitted_amount_exceeds_slippage" /* PermittedAmountExceedsSlippage */]: "Permitted amount exceeds slippage. You must spend at least 90% of the permitted amount.",
|
|
85
|
+
["permitted_amount_not_found" /* PermittedAmountNotFound */]: "Permitted amount not found in permit2 payload."
|
|
86
|
+
};
|
|
87
|
+
var SignMessageErrorCodes = /* @__PURE__ */ ((SignMessageErrorCodes2) => {
|
|
88
|
+
SignMessageErrorCodes2["InvalidMessage"] = "invalid_message";
|
|
89
|
+
SignMessageErrorCodes2["UserRejected"] = "user_rejected";
|
|
90
|
+
SignMessageErrorCodes2["GenericError"] = "generic_error";
|
|
91
|
+
return SignMessageErrorCodes2;
|
|
92
|
+
})(SignMessageErrorCodes || {});
|
|
93
|
+
var SignMessageErrorMessage = {
|
|
94
|
+
["invalid_message" /* InvalidMessage */]: "Invalid message requested",
|
|
95
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
96
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
97
|
+
};
|
|
98
|
+
var SignTypedDataErrorCodes = /* @__PURE__ */ ((SignTypedDataErrorCodes2) => {
|
|
99
|
+
SignTypedDataErrorCodes2["InvalidOperation"] = "invalid_operation";
|
|
100
|
+
SignTypedDataErrorCodes2["UserRejected"] = "user_rejected";
|
|
101
|
+
SignTypedDataErrorCodes2["InputError"] = "input_error";
|
|
102
|
+
SignTypedDataErrorCodes2["SimulationFailed"] = "simulation_failed";
|
|
103
|
+
SignTypedDataErrorCodes2["GenericError"] = "generic_error";
|
|
104
|
+
SignTypedDataErrorCodes2["DisallowedOperation"] = "disallowed_operation";
|
|
105
|
+
SignTypedDataErrorCodes2["InvalidContract"] = "invalid_contract";
|
|
106
|
+
SignTypedDataErrorCodes2["MaliciousOperation"] = "malicious_operation";
|
|
107
|
+
return SignTypedDataErrorCodes2;
|
|
108
|
+
})(SignTypedDataErrorCodes || {});
|
|
109
|
+
var SignTypedDataErrorMessage = {
|
|
110
|
+
["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
|
|
111
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
112
|
+
["input_error" /* InputError */]: "Invalid payload.",
|
|
113
|
+
["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
|
|
114
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
115
|
+
["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
|
|
116
|
+
["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
|
|
117
|
+
["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious."
|
|
118
|
+
};
|
|
119
|
+
var MiniKitInstallErrorCodes = /* @__PURE__ */ ((MiniKitInstallErrorCodes2) => {
|
|
120
|
+
MiniKitInstallErrorCodes2["Unknown"] = "unknown";
|
|
121
|
+
MiniKitInstallErrorCodes2["AlreadyInstalled"] = "already_installed";
|
|
122
|
+
MiniKitInstallErrorCodes2["OutsideOfWorldApp"] = "outside_of_worldapp";
|
|
123
|
+
MiniKitInstallErrorCodes2["NotOnClient"] = "not_on_client";
|
|
124
|
+
MiniKitInstallErrorCodes2["AppOutOfDate"] = "app_out_of_date";
|
|
125
|
+
return MiniKitInstallErrorCodes2;
|
|
126
|
+
})(MiniKitInstallErrorCodes || {});
|
|
127
|
+
var MiniKitInstallErrorMessage = {
|
|
128
|
+
["unknown" /* Unknown */]: "Failed to install MiniKit.",
|
|
129
|
+
["already_installed" /* AlreadyInstalled */]: "MiniKit is already installed.",
|
|
130
|
+
["outside_of_worldapp" /* OutsideOfWorldApp */]: "MiniApp launched outside of WorldApp.",
|
|
131
|
+
["not_on_client" /* NotOnClient */]: "Window object is not available.",
|
|
132
|
+
["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
|
|
133
|
+
};
|
|
134
|
+
var ShareContactsErrorCodes = /* @__PURE__ */ ((ShareContactsErrorCodes2) => {
|
|
135
|
+
ShareContactsErrorCodes2["UserRejected"] = "user_rejected";
|
|
136
|
+
ShareContactsErrorCodes2["GenericError"] = "generic_error";
|
|
137
|
+
return ShareContactsErrorCodes2;
|
|
138
|
+
})(ShareContactsErrorCodes || {});
|
|
139
|
+
var ShareContactsErrorMessage = {
|
|
140
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
141
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
142
|
+
};
|
|
143
|
+
var RequestPermissionErrorCodes = /* @__PURE__ */ ((RequestPermissionErrorCodes2) => {
|
|
144
|
+
RequestPermissionErrorCodes2["UserRejected"] = "user_rejected";
|
|
145
|
+
RequestPermissionErrorCodes2["GenericError"] = "generic_error";
|
|
146
|
+
RequestPermissionErrorCodes2["AlreadyRequested"] = "already_requested";
|
|
147
|
+
RequestPermissionErrorCodes2["PermissionDisabled"] = "permission_disabled";
|
|
148
|
+
RequestPermissionErrorCodes2["AlreadyGranted"] = "already_granted";
|
|
149
|
+
RequestPermissionErrorCodes2["UnsupportedPermission"] = "unsupported_permission";
|
|
150
|
+
return RequestPermissionErrorCodes2;
|
|
151
|
+
})(RequestPermissionErrorCodes || {});
|
|
152
|
+
var RequestPermissionErrorMessage = {
|
|
153
|
+
["user_rejected" /* UserRejected */]: "User declined sharing contacts",
|
|
154
|
+
["generic_error" /* GenericError */]: "Request failed for unknown reason.",
|
|
155
|
+
["already_requested" /* AlreadyRequested */]: "User has already declined turning on notifications once",
|
|
156
|
+
["permission_disabled" /* PermissionDisabled */]: "User does not have this permission enabled in World App",
|
|
157
|
+
["already_granted" /* AlreadyGranted */]: "If the user has already granted this mini app permission",
|
|
158
|
+
["unsupported_permission" /* UnsupportedPermission */]: "The permission requested is not supported by this mini app"
|
|
159
|
+
};
|
|
160
|
+
var GetPermissionsErrorCodes = /* @__PURE__ */ ((GetPermissionsErrorCodes2) => {
|
|
161
|
+
GetPermissionsErrorCodes2["GenericError"] = "generic_error";
|
|
162
|
+
return GetPermissionsErrorCodes2;
|
|
163
|
+
})(GetPermissionsErrorCodes || {});
|
|
164
|
+
var GetPermissionsErrorMessage = {
|
|
165
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again."
|
|
166
|
+
};
|
|
167
|
+
var SendHapticFeedbackErrorCodes = /* @__PURE__ */ ((SendHapticFeedbackErrorCodes2) => {
|
|
168
|
+
SendHapticFeedbackErrorCodes2["GenericError"] = "generic_error";
|
|
169
|
+
SendHapticFeedbackErrorCodes2["UserRejected"] = "user_rejected";
|
|
170
|
+
return SendHapticFeedbackErrorCodes2;
|
|
171
|
+
})(SendHapticFeedbackErrorCodes || {});
|
|
172
|
+
var SendHapticFeedbackErrorMessage = {
|
|
173
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong.",
|
|
174
|
+
["user_rejected" /* UserRejected */]: "User rejected the request."
|
|
175
|
+
};
|
|
176
|
+
var ShareFilesErrorCodes = /* @__PURE__ */ ((ShareFilesErrorCodes2) => {
|
|
177
|
+
ShareFilesErrorCodes2["UserRejected"] = "user_rejected";
|
|
178
|
+
ShareFilesErrorCodes2["GenericError"] = "generic_error";
|
|
179
|
+
ShareFilesErrorCodes2["InvalidFileName"] = "invalid_file_name";
|
|
180
|
+
return ShareFilesErrorCodes2;
|
|
181
|
+
})(ShareFilesErrorCodes || {});
|
|
182
|
+
var ShareFilesErrorMessage = {
|
|
183
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
184
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong.",
|
|
185
|
+
["invalid_file_name" /* InvalidFileName */]: "Invalid file name. Make sure you include the extension"
|
|
186
|
+
};
|
|
187
|
+
var MicrophoneErrorCodes = /* @__PURE__ */ ((MicrophoneErrorCodes2) => {
|
|
188
|
+
MicrophoneErrorCodes2["MiniAppPermissionNotEnabled"] = "mini_app_permission_not_enabled";
|
|
189
|
+
MicrophoneErrorCodes2["WorldAppPermissionNotEnabled"] = "world_app_permission_not_enabled";
|
|
190
|
+
return MicrophoneErrorCodes2;
|
|
191
|
+
})(MicrophoneErrorCodes || {});
|
|
192
|
+
var MicrophoneErrorMessage = {
|
|
193
|
+
["mini_app_permission_not_enabled" /* MiniAppPermissionNotEnabled */]: "Microphone permission not enabled for your Mini App",
|
|
194
|
+
["world_app_permission_not_enabled" /* WorldAppPermissionNotEnabled */]: "Microphone permission not enabled in World App"
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// types/responses.ts
|
|
198
|
+
var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
|
|
199
|
+
ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
|
|
200
|
+
ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
|
|
201
|
+
ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
|
|
202
|
+
ResponseEvent2["MiniAppSendTransaction"] = "miniapp-send-transaction";
|
|
203
|
+
ResponseEvent2["MiniAppSignMessage"] = "miniapp-sign-message";
|
|
204
|
+
ResponseEvent2["MiniAppSignTypedData"] = "miniapp-sign-typed-data";
|
|
205
|
+
ResponseEvent2["MiniAppShareContacts"] = "miniapp-share-contacts";
|
|
206
|
+
ResponseEvent2["MiniAppRequestPermission"] = "miniapp-request-permission";
|
|
207
|
+
ResponseEvent2["MiniAppGetPermissions"] = "miniapp-get-permissions";
|
|
208
|
+
ResponseEvent2["MiniAppSendHapticFeedback"] = "miniapp-send-haptic-feedback";
|
|
209
|
+
ResponseEvent2["MiniAppShare"] = "miniapp-share";
|
|
210
|
+
ResponseEvent2["MiniAppMicrophone"] = "miniapp-microphone";
|
|
211
|
+
return ResponseEvent2;
|
|
212
|
+
})(ResponseEvent || {});
|
|
213
|
+
|
|
1
214
|
// types/payment.ts
|
|
2
|
-
var Tokens = /* @__PURE__ */ ((
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return
|
|
215
|
+
var Tokens = /* @__PURE__ */ ((Tokens2) => {
|
|
216
|
+
Tokens2["USDC"] = "USDCE";
|
|
217
|
+
Tokens2["WLD"] = "WLD";
|
|
218
|
+
return Tokens2;
|
|
6
219
|
})(Tokens || {});
|
|
7
220
|
var TokenDecimals = {
|
|
8
|
-
["USDCE" /*
|
|
221
|
+
["USDCE" /* USDC */]: 6,
|
|
9
222
|
["WLD" /* WLD */]: 18
|
|
10
223
|
};
|
|
11
224
|
var Network = /* @__PURE__ */ ((Network2) => {
|
|
@@ -29,9 +242,9 @@ var tokenToDecimals = (amount, token) => {
|
|
|
29
242
|
};
|
|
30
243
|
var validatePaymentPayload = (payload) => {
|
|
31
244
|
if (payload.tokens.some(
|
|
32
|
-
(token) => token.symbol == "USDCE" && parseFloat(token.token_amount) < 0.1
|
|
245
|
+
(token) => token.symbol == "USDCE" /* USDC */ && parseFloat(token.token_amount) < 0.1
|
|
33
246
|
)) {
|
|
34
|
-
console.error("
|
|
247
|
+
console.error("USDC amount should be greater than $0.1");
|
|
35
248
|
return false;
|
|
36
249
|
}
|
|
37
250
|
if (payload.reference.length > 36) {
|
|
@@ -206,8 +419,8 @@ var generateSiweMessage = (siweMessageData) => {
|
|
|
206
419
|
return siweMessage;
|
|
207
420
|
};
|
|
208
421
|
var verifySiweMessage = (payload, nonce, statement, requestId, userProvider) => {
|
|
209
|
-
if (payload.version ===
|
|
210
|
-
return
|
|
422
|
+
if (payload.version === 1) {
|
|
423
|
+
return verifySiweMessageV1(
|
|
211
424
|
payload,
|
|
212
425
|
nonce,
|
|
213
426
|
statement,
|
|
@@ -215,7 +428,7 @@ var verifySiweMessage = (payload, nonce, statement, requestId, userProvider) =>
|
|
|
215
428
|
userProvider
|
|
216
429
|
);
|
|
217
430
|
} else {
|
|
218
|
-
return
|
|
431
|
+
return verifySiweMessageV2(
|
|
219
432
|
payload,
|
|
220
433
|
nonce,
|
|
221
434
|
statement,
|
|
@@ -331,214 +544,107 @@ var Command = /* @__PURE__ */ ((Command2) => {
|
|
|
331
544
|
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
332
545
|
Permission2["Notifications"] = "notifications";
|
|
333
546
|
Permission2["Contacts"] = "contacts";
|
|
547
|
+
Permission2["Microphone"] = "microphone";
|
|
334
548
|
return Permission2;
|
|
335
549
|
})(Permission || {});
|
|
336
550
|
|
|
337
|
-
// types/errors.ts
|
|
338
|
-
import { AppErrorCodes } from "@worldcoin/idkit-core";
|
|
339
|
-
import { AppErrorCodes as AppErrorCodes2 } from "@worldcoin/idkit-core";
|
|
340
|
-
var VerificationErrorMessage = {
|
|
341
|
-
[AppErrorCodes.VerificationRejected]: "You've cancelled the request in World App.",
|
|
342
|
-
[AppErrorCodes.MaxVerificationsReached]: "You have already verified the maximum number of times for this action.",
|
|
343
|
-
[AppErrorCodes.CredentialUnavailable]: "It seems you do not have the verification level required by this app.",
|
|
344
|
-
[AppErrorCodes.MalformedRequest]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
345
|
-
[AppErrorCodes.InvalidNetwork]: "Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details.",
|
|
346
|
-
[AppErrorCodes.InclusionProofFailed]: "There was an issue fetching your credential. Please try again.",
|
|
347
|
-
[AppErrorCodes.InclusionProofPending]: "Your identity is still being registered. Please wait a few minutes and try again.",
|
|
348
|
-
[AppErrorCodes.UnexpectedResponse]: "Unexpected response from your wallet. Please try again.",
|
|
349
|
-
[AppErrorCodes.FailedByHostApp]: "Verification failed by the app. Please contact the app owner for details.",
|
|
350
|
-
[AppErrorCodes.GenericError]: "Something unexpected went wrong. Please try again.",
|
|
351
|
-
[AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
|
|
352
|
-
};
|
|
353
|
-
var PaymentErrorCodes = /* @__PURE__ */ ((PaymentErrorCodes2) => {
|
|
354
|
-
PaymentErrorCodes2["InputError"] = "input_error";
|
|
355
|
-
PaymentErrorCodes2["UserRejected"] = "user_rejected";
|
|
356
|
-
PaymentErrorCodes2["PaymentRejected"] = "payment_rejected";
|
|
357
|
-
PaymentErrorCodes2["InvalidReceiver"] = "invalid_receiver";
|
|
358
|
-
PaymentErrorCodes2["InsufficientBalance"] = "insufficient_balance";
|
|
359
|
-
PaymentErrorCodes2["TransactionFailed"] = "transaction_failed";
|
|
360
|
-
PaymentErrorCodes2["GenericError"] = "generic_error";
|
|
361
|
-
PaymentErrorCodes2["UserBlocked"] = "user_blocked";
|
|
362
|
-
return PaymentErrorCodes2;
|
|
363
|
-
})(PaymentErrorCodes || {});
|
|
364
|
-
var PaymentErrorMessage = {
|
|
365
|
-
["input_error" /* InputError */]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
366
|
-
["user_rejected" /* UserRejected */]: "You have cancelled the payment in World App.",
|
|
367
|
-
["payment_rejected" /* PaymentRejected */]: "You've cancelled the payment in World App.",
|
|
368
|
-
["invalid_receiver" /* InvalidReceiver */]: "The receiver address is invalid. Please contact the app owner.",
|
|
369
|
-
["insufficient_balance" /* InsufficientBalance */]: "You do not have enough balance to complete this transaction.",
|
|
370
|
-
["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again.",
|
|
371
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
372
|
-
["user_blocked" /* UserBlocked */]: "User's region is blocked from making payments."
|
|
373
|
-
};
|
|
374
|
-
var PaymentValidationErrors = /* @__PURE__ */ ((PaymentValidationErrors2) => {
|
|
375
|
-
PaymentValidationErrors2["MalformedRequest"] = "There was a problem with this request. Please try again or contact the app owner.";
|
|
376
|
-
PaymentValidationErrors2["InvalidTokenAddress"] = "The token address is invalid. Please contact the app owner.";
|
|
377
|
-
PaymentValidationErrors2["InvalidAppId"] = "The app ID is invalid. Please contact the app owner.";
|
|
378
|
-
PaymentValidationErrors2["DuplicateReference"] = "This reference ID already exists please generate a new one and try again.";
|
|
379
|
-
return PaymentValidationErrors2;
|
|
380
|
-
})(PaymentValidationErrors || {});
|
|
381
|
-
var WalletAuthErrorCodes = /* @__PURE__ */ ((WalletAuthErrorCodes2) => {
|
|
382
|
-
WalletAuthErrorCodes2["MalformedRequest"] = "malformed_request";
|
|
383
|
-
WalletAuthErrorCodes2["UserRejected"] = "user_rejected";
|
|
384
|
-
WalletAuthErrorCodes2["GenericError"] = "generic_error";
|
|
385
|
-
return WalletAuthErrorCodes2;
|
|
386
|
-
})(WalletAuthErrorCodes || {});
|
|
387
|
-
var WalletAuthErrorMessage = {
|
|
388
|
-
["malformed_request" /* MalformedRequest */]: "Provided parameters in the request are invalid.",
|
|
389
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
390
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
391
|
-
};
|
|
392
|
-
var SendTransactionErrorCodes = /* @__PURE__ */ ((SendTransactionErrorCodes2) => {
|
|
393
|
-
SendTransactionErrorCodes2["InvalidOperation"] = "invalid_operation";
|
|
394
|
-
SendTransactionErrorCodes2["UserRejected"] = "user_rejected";
|
|
395
|
-
SendTransactionErrorCodes2["InputError"] = "input_error";
|
|
396
|
-
SendTransactionErrorCodes2["SimulationFailed"] = "simulation_failed";
|
|
397
|
-
SendTransactionErrorCodes2["TransactionFailed"] = "transaction_failed";
|
|
398
|
-
SendTransactionErrorCodes2["GenericError"] = "generic_error";
|
|
399
|
-
SendTransactionErrorCodes2["DisallowedOperation"] = "disallowed_operation";
|
|
400
|
-
SendTransactionErrorCodes2["InvalidContract"] = "invalid_contract";
|
|
401
|
-
SendTransactionErrorCodes2["MaliciousOperation"] = "malicious_operation";
|
|
402
|
-
SendTransactionErrorCodes2["DailyTxLimitReached"] = "daily_tx_limit_reached";
|
|
403
|
-
SendTransactionErrorCodes2["PermittedAmountExceedsSlippage"] = "permitted_amount_exceeds_slippage";
|
|
404
|
-
SendTransactionErrorCodes2["PermittedAmountNotFound"] = "permitted_amount_not_found";
|
|
405
|
-
return SendTransactionErrorCodes2;
|
|
406
|
-
})(SendTransactionErrorCodes || {});
|
|
407
|
-
var SendTransactionErrorMessage = {
|
|
408
|
-
["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
|
|
409
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
410
|
-
["input_error" /* InputError */]: "Invalid payload.",
|
|
411
|
-
["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
|
|
412
|
-
["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again later.",
|
|
413
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
414
|
-
["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
|
|
415
|
-
["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
|
|
416
|
-
["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious.",
|
|
417
|
-
["daily_tx_limit_reached" /* DailyTxLimitReached */]: "Daily transaction limit reached. Max 100 transactions per day. Wait until the next day.",
|
|
418
|
-
["permitted_amount_exceeds_slippage" /* PermittedAmountExceedsSlippage */]: "Permitted amount exceeds slippage. You must spend at least 90% of the permitted amount.",
|
|
419
|
-
["permitted_amount_not_found" /* PermittedAmountNotFound */]: "Permitted amount not found in permit2 payload."
|
|
420
|
-
};
|
|
421
|
-
var SignMessageErrorCodes = /* @__PURE__ */ ((SignMessageErrorCodes2) => {
|
|
422
|
-
SignMessageErrorCodes2["InvalidMessage"] = "invalid_message";
|
|
423
|
-
SignMessageErrorCodes2["UserRejected"] = "user_rejected";
|
|
424
|
-
SignMessageErrorCodes2["GenericError"] = "generic_error";
|
|
425
|
-
return SignMessageErrorCodes2;
|
|
426
|
-
})(SignMessageErrorCodes || {});
|
|
427
|
-
var SignMessageErrorMessage = {
|
|
428
|
-
["invalid_message" /* InvalidMessage */]: "Invalid message requested",
|
|
429
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
430
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
431
|
-
};
|
|
432
|
-
var SignTypedDataErrorCodes = /* @__PURE__ */ ((SignTypedDataErrorCodes2) => {
|
|
433
|
-
SignTypedDataErrorCodes2["InvalidOperation"] = "invalid_operation";
|
|
434
|
-
SignTypedDataErrorCodes2["UserRejected"] = "user_rejected";
|
|
435
|
-
SignTypedDataErrorCodes2["InputError"] = "input_error";
|
|
436
|
-
SignTypedDataErrorCodes2["SimulationFailed"] = "simulation_failed";
|
|
437
|
-
SignTypedDataErrorCodes2["GenericError"] = "generic_error";
|
|
438
|
-
SignTypedDataErrorCodes2["DisallowedOperation"] = "disallowed_operation";
|
|
439
|
-
SignTypedDataErrorCodes2["InvalidContract"] = "invalid_contract";
|
|
440
|
-
SignTypedDataErrorCodes2["MaliciousOperation"] = "malicious_operation";
|
|
441
|
-
return SignTypedDataErrorCodes2;
|
|
442
|
-
})(SignTypedDataErrorCodes || {});
|
|
443
|
-
var SignTypedDataErrorMessage = {
|
|
444
|
-
["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
|
|
445
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
446
|
-
["input_error" /* InputError */]: "Invalid payload.",
|
|
447
|
-
["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
|
|
448
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
449
|
-
["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
|
|
450
|
-
["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
|
|
451
|
-
["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious."
|
|
452
|
-
};
|
|
453
|
-
var MiniKitInstallErrorCodes = /* @__PURE__ */ ((MiniKitInstallErrorCodes2) => {
|
|
454
|
-
MiniKitInstallErrorCodes2["Unknown"] = "unknown";
|
|
455
|
-
MiniKitInstallErrorCodes2["AlreadyInstalled"] = "already_installed";
|
|
456
|
-
MiniKitInstallErrorCodes2["OutsideOfWorldApp"] = "outside_of_worldapp";
|
|
457
|
-
MiniKitInstallErrorCodes2["NotOnClient"] = "not_on_client";
|
|
458
|
-
MiniKitInstallErrorCodes2["AppOutOfDate"] = "app_out_of_date";
|
|
459
|
-
return MiniKitInstallErrorCodes2;
|
|
460
|
-
})(MiniKitInstallErrorCodes || {});
|
|
461
|
-
var MiniKitInstallErrorMessage = {
|
|
462
|
-
["unknown" /* Unknown */]: "Failed to install MiniKit.",
|
|
463
|
-
["already_installed" /* AlreadyInstalled */]: "MiniKit is already installed.",
|
|
464
|
-
["outside_of_worldapp" /* OutsideOfWorldApp */]: "MiniApp launched outside of WorldApp.",
|
|
465
|
-
["not_on_client" /* NotOnClient */]: "Window object is not available.",
|
|
466
|
-
["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
|
|
467
|
-
};
|
|
468
|
-
var ShareContactsErrorCodes = /* @__PURE__ */ ((ShareContactsErrorCodes2) => {
|
|
469
|
-
ShareContactsErrorCodes2["UserRejected"] = "user_rejected";
|
|
470
|
-
ShareContactsErrorCodes2["GenericError"] = "generic_error";
|
|
471
|
-
return ShareContactsErrorCodes2;
|
|
472
|
-
})(ShareContactsErrorCodes || {});
|
|
473
|
-
var ShareContactsErrorMessage = {
|
|
474
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
475
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
476
|
-
};
|
|
477
|
-
var RequestPermissionErrorCodes = /* @__PURE__ */ ((RequestPermissionErrorCodes2) => {
|
|
478
|
-
RequestPermissionErrorCodes2["UserRejected"] = "user_rejected";
|
|
479
|
-
RequestPermissionErrorCodes2["GenericError"] = "generic_error";
|
|
480
|
-
RequestPermissionErrorCodes2["AlreadyRequested"] = "already_requested";
|
|
481
|
-
RequestPermissionErrorCodes2["PermissionDisabled"] = "permission_disabled";
|
|
482
|
-
RequestPermissionErrorCodes2["AlreadyGranted"] = "already_granted";
|
|
483
|
-
RequestPermissionErrorCodes2["UnsupportedPermission"] = "unsupported_permission";
|
|
484
|
-
return RequestPermissionErrorCodes2;
|
|
485
|
-
})(RequestPermissionErrorCodes || {});
|
|
486
|
-
var RequestPermissionErrorMessage = {
|
|
487
|
-
["user_rejected" /* UserRejected */]: "User declined sharing contacts",
|
|
488
|
-
["generic_error" /* GenericError */]: "Request failed for unknown reason.",
|
|
489
|
-
["already_requested" /* AlreadyRequested */]: "User has already declined turning on notifications once",
|
|
490
|
-
["permission_disabled" /* PermissionDisabled */]: "User does not have this permission enabled in World App",
|
|
491
|
-
["already_granted" /* AlreadyGranted */]: "If the user has already granted this mini app permission",
|
|
492
|
-
["unsupported_permission" /* UnsupportedPermission */]: "The permission requested is not supported by this mini app"
|
|
493
|
-
};
|
|
494
|
-
var GetPermissionsErrorCodes = /* @__PURE__ */ ((GetPermissionsErrorCodes2) => {
|
|
495
|
-
GetPermissionsErrorCodes2["GenericError"] = "generic_error";
|
|
496
|
-
return GetPermissionsErrorCodes2;
|
|
497
|
-
})(GetPermissionsErrorCodes || {});
|
|
498
|
-
var GetPermissionsErrorMessage = {
|
|
499
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again."
|
|
500
|
-
};
|
|
501
|
-
var SendHapticFeedbackErrorCodes = /* @__PURE__ */ ((SendHapticFeedbackErrorCodes2) => {
|
|
502
|
-
SendHapticFeedbackErrorCodes2["GenericError"] = "generic_error";
|
|
503
|
-
SendHapticFeedbackErrorCodes2["UserRejected"] = "user_rejected";
|
|
504
|
-
return SendHapticFeedbackErrorCodes2;
|
|
505
|
-
})(SendHapticFeedbackErrorCodes || {});
|
|
506
|
-
var SendHapticFeedbackErrorMessage = {
|
|
507
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong.",
|
|
508
|
-
["user_rejected" /* UserRejected */]: "User rejected the request."
|
|
509
|
-
};
|
|
510
|
-
var ShareFilesErrorCodes = /* @__PURE__ */ ((ShareFilesErrorCodes2) => {
|
|
511
|
-
ShareFilesErrorCodes2["UserRejected"] = "user_rejected";
|
|
512
|
-
ShareFilesErrorCodes2["GenericError"] = "generic_error";
|
|
513
|
-
ShareFilesErrorCodes2["InvalidFileName"] = "invalid_file_name";
|
|
514
|
-
return ShareFilesErrorCodes2;
|
|
515
|
-
})(ShareFilesErrorCodes || {});
|
|
516
|
-
var ShareFilesErrorMessage = {
|
|
517
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
518
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong.",
|
|
519
|
-
["invalid_file_name" /* InvalidFileName */]: "Invalid file name. Make sure you include the extension"
|
|
520
|
-
};
|
|
521
|
-
|
|
522
|
-
// types/responses.ts
|
|
523
|
-
var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
|
|
524
|
-
ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
|
|
525
|
-
ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
|
|
526
|
-
ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
|
|
527
|
-
ResponseEvent2["MiniAppSendTransaction"] = "miniapp-send-transaction";
|
|
528
|
-
ResponseEvent2["MiniAppSignMessage"] = "miniapp-sign-message";
|
|
529
|
-
ResponseEvent2["MiniAppSignTypedData"] = "miniapp-sign-typed-data";
|
|
530
|
-
ResponseEvent2["MiniAppShareContacts"] = "miniapp-share-contacts";
|
|
531
|
-
ResponseEvent2["MiniAppRequestPermission"] = "miniapp-request-permission";
|
|
532
|
-
ResponseEvent2["MiniAppGetPermissions"] = "miniapp-get-permissions";
|
|
533
|
-
ResponseEvent2["MiniAppSendHapticFeedback"] = "miniapp-send-haptic-feedback";
|
|
534
|
-
ResponseEvent2["MiniAppShare"] = "miniapp-share";
|
|
535
|
-
return ResponseEvent2;
|
|
536
|
-
})(ResponseEvent || {});
|
|
537
|
-
|
|
538
551
|
// minikit.ts
|
|
539
552
|
import { VerificationLevel } from "@worldcoin/idkit-core";
|
|
540
553
|
import { encodeAction, generateSignal } from "@worldcoin/idkit-core/hashing";
|
|
541
554
|
|
|
555
|
+
// helpers/send-webview-event.ts
|
|
556
|
+
var sendWebviewEvent = (payload) => {
|
|
557
|
+
if (window.webkit) {
|
|
558
|
+
window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
|
|
559
|
+
} else if (window.Android) {
|
|
560
|
+
window.Android.postMessage?.(JSON.stringify(payload));
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
// helpers/microphone/index.ts
|
|
565
|
+
var microphoneSetupDone = false;
|
|
566
|
+
var setupMicrophone = () => {
|
|
567
|
+
if (microphoneSetupDone) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
if (typeof navigator !== "undefined" && !navigator.mediaDevices?.getUserMedia)
|
|
571
|
+
return;
|
|
572
|
+
const originalStop = MediaStreamTrack.prototype.stop;
|
|
573
|
+
MediaStreamTrack.prototype.stop = function() {
|
|
574
|
+
originalStop.call(this);
|
|
575
|
+
if (this.readyState === "ended") {
|
|
576
|
+
setTimeout(() => this.dispatchEvent(new Event("ended")), 0);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
const realGUM = navigator.mediaDevices.getUserMedia.bind(
|
|
580
|
+
navigator.mediaDevices
|
|
581
|
+
);
|
|
582
|
+
const live = /* @__PURE__ */ new Set();
|
|
583
|
+
async function wrapped(constraints) {
|
|
584
|
+
const stream = await realGUM(constraints);
|
|
585
|
+
const hasAudioTrack = stream.getAudioTracks().length > 0;
|
|
586
|
+
if (hasAudioTrack) {
|
|
587
|
+
sendWebviewEvent({
|
|
588
|
+
command: "microphone-stream-started",
|
|
589
|
+
version: 1,
|
|
590
|
+
payload: {
|
|
591
|
+
streamId: stream.id
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
live.add(stream);
|
|
595
|
+
stream.getAudioTracks().forEach((t) => {
|
|
596
|
+
t.addEventListener("ended", () => {
|
|
597
|
+
const allAudioTracksEnded = stream.getAudioTracks().every((track) => track.readyState === "ended");
|
|
598
|
+
if (allAudioTracksEnded) {
|
|
599
|
+
sendWebviewEvent({
|
|
600
|
+
command: "microphone-stream-ended",
|
|
601
|
+
version: 1,
|
|
602
|
+
payload: {
|
|
603
|
+
streamId: stream.id
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
live.delete(stream);
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
return stream;
|
|
612
|
+
}
|
|
613
|
+
Object.defineProperty(navigator.mediaDevices, "getUserMedia", {
|
|
614
|
+
value: wrapped,
|
|
615
|
+
writable: false,
|
|
616
|
+
configurable: false,
|
|
617
|
+
enumerable: true
|
|
618
|
+
});
|
|
619
|
+
Object.freeze(navigator.mediaDevices);
|
|
620
|
+
const stopAllMiniAppMicrophoneStreams = () => {
|
|
621
|
+
live.forEach((s) => {
|
|
622
|
+
const audioTracks = s.getAudioTracks();
|
|
623
|
+
if (audioTracks.length > 0) {
|
|
624
|
+
audioTracks.forEach((t) => {
|
|
625
|
+
t.stop();
|
|
626
|
+
});
|
|
627
|
+
sendWebviewEvent({
|
|
628
|
+
command: "microphone-stream-ended",
|
|
629
|
+
version: 1,
|
|
630
|
+
payload: {
|
|
631
|
+
streamId: s.id
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
live.clear();
|
|
637
|
+
};
|
|
638
|
+
MiniKit.subscribe("miniapp-microphone" /* MiniAppMicrophone */, (payload) => {
|
|
639
|
+
if (payload.status === "error" && (payload.error_code === "mini_app_permission_not_enabled" /* MiniAppPermissionNotEnabled */ || payload.error_code === "world_app_permission_not_enabled" /* WorldAppPermissionNotEnabled */)) {
|
|
640
|
+
console.log("stopping all microphone streams", payload);
|
|
641
|
+
stopAllMiniAppMicrophoneStreams();
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
window.__stopAllMiniAppMicrophoneStreams = stopAllMiniAppMicrophoneStreams;
|
|
645
|
+
microphoneSetupDone = true;
|
|
646
|
+
};
|
|
647
|
+
|
|
542
648
|
// helpers/proof/index.ts
|
|
543
649
|
import {
|
|
544
650
|
createPublicClient as createPublicClient2,
|
|
@@ -762,15 +868,6 @@ var getUserProfile = async (address) => {
|
|
|
762
868
|
return usernames?.[0] ?? { username: null, profile_picture_url: null };
|
|
763
869
|
};
|
|
764
870
|
|
|
765
|
-
// helpers/send-webview-event.ts
|
|
766
|
-
var sendWebviewEvent = (payload) => {
|
|
767
|
-
if (window.webkit) {
|
|
768
|
-
window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
|
|
769
|
-
} else if (window.Android) {
|
|
770
|
-
window.Android.postMessage?.(JSON.stringify(payload));
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
|
|
774
871
|
// minikit.ts
|
|
775
872
|
var sendMiniKitEvent = (payload) => {
|
|
776
873
|
sendWebviewEvent(payload);
|
|
@@ -779,7 +876,10 @@ var _MiniKit = class _MiniKit {
|
|
|
779
876
|
static sendInit() {
|
|
780
877
|
sendWebviewEvent({
|
|
781
878
|
command: "init",
|
|
782
|
-
payload: {
|
|
879
|
+
payload: {
|
|
880
|
+
version: this.MINIKIT_VERSION,
|
|
881
|
+
minorVersion: this.MINIKIT_MINOR_VERSION
|
|
882
|
+
}
|
|
783
883
|
});
|
|
784
884
|
}
|
|
785
885
|
static subscribe(event, handler) {
|
|
@@ -895,6 +995,8 @@ var _MiniKit = class _MiniKit {
|
|
|
895
995
|
_MiniKit.user.deviceOS = window.WorldApp.device_os;
|
|
896
996
|
_MiniKit.user.worldAppVersion = window.WorldApp.world_app_version;
|
|
897
997
|
_MiniKit.deviceProperties.safeAreaInsets = window.WorldApp.safe_area_insets;
|
|
998
|
+
_MiniKit.deviceProperties.deviceOS = window.WorldApp.device_os;
|
|
999
|
+
_MiniKit.deviceProperties.worldAppVersion = window.WorldApp.world_app_version;
|
|
898
1000
|
try {
|
|
899
1001
|
window.MiniKit = _MiniKit;
|
|
900
1002
|
this.sendInit();
|
|
@@ -910,6 +1012,7 @@ var _MiniKit = class _MiniKit {
|
|
|
910
1012
|
};
|
|
911
1013
|
}
|
|
912
1014
|
_MiniKit.isReady = true;
|
|
1015
|
+
setupMicrophone();
|
|
913
1016
|
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
914
1017
|
return {
|
|
915
1018
|
success: false,
|
|
@@ -930,6 +1033,7 @@ var _MiniKit = class _MiniKit {
|
|
|
930
1033
|
}
|
|
931
1034
|
};
|
|
932
1035
|
_MiniKit.MINIKIT_VERSION = 1;
|
|
1036
|
+
_MiniKit.MINIKIT_MINOR_VERSION = 96;
|
|
933
1037
|
_MiniKit.miniKitCommandVersion = {
|
|
934
1038
|
["verify" /* Verify */]: 1,
|
|
935
1039
|
["pay" /* Pay */]: 1,
|
|
@@ -978,12 +1082,14 @@ _MiniKit.listeners = {
|
|
|
978
1082
|
["miniapp-send-haptic-feedback" /* MiniAppSendHapticFeedback */]: () => {
|
|
979
1083
|
},
|
|
980
1084
|
["miniapp-share" /* MiniAppShare */]: () => {
|
|
1085
|
+
},
|
|
1086
|
+
["miniapp-microphone" /* MiniAppMicrophone */]: () => {
|
|
981
1087
|
}
|
|
982
1088
|
};
|
|
983
1089
|
_MiniKit.appId = null;
|
|
984
1090
|
_MiniKit.user = {};
|
|
985
|
-
_MiniKit.isReady = false;
|
|
986
1091
|
_MiniKit.deviceProperties = {};
|
|
1092
|
+
_MiniKit.isReady = false;
|
|
987
1093
|
_MiniKit.getUserByAddress = async (address) => {
|
|
988
1094
|
const userProfile = await getUserProfile(
|
|
989
1095
|
address ?? _MiniKit.user.walletAddress
|
|
@@ -1214,7 +1320,12 @@ _MiniKit.commands = {
|
|
|
1214
1320
|
);
|
|
1215
1321
|
return null;
|
|
1216
1322
|
}
|
|
1217
|
-
if (_MiniKit.
|
|
1323
|
+
if (_MiniKit.deviceProperties.deviceOS === "ios" && typeof navigator !== "undefined") {
|
|
1324
|
+
sendMiniKitEvent({
|
|
1325
|
+
command: "share" /* Share */,
|
|
1326
|
+
version: _MiniKit.miniKitCommandVersion["share" /* Share */],
|
|
1327
|
+
payload
|
|
1328
|
+
});
|
|
1218
1329
|
navigator.share(payload);
|
|
1219
1330
|
} else {
|
|
1220
1331
|
formatShareInput(payload).then((formattedResult) => {
|
|
@@ -1410,14 +1521,6 @@ _MiniKit.commandsAsync = {
|
|
|
1410
1521
|
var MiniKit = _MiniKit;
|
|
1411
1522
|
|
|
1412
1523
|
export {
|
|
1413
|
-
Tokens,
|
|
1414
|
-
TokenDecimals,
|
|
1415
|
-
Network,
|
|
1416
|
-
tokenToDecimals,
|
|
1417
|
-
parseSiweMessage,
|
|
1418
|
-
verifySiweMessage,
|
|
1419
|
-
Command,
|
|
1420
|
-
Permission,
|
|
1421
1524
|
VerificationErrorMessage,
|
|
1422
1525
|
PaymentErrorCodes,
|
|
1423
1526
|
PaymentErrorMessage,
|
|
@@ -1442,7 +1545,17 @@ export {
|
|
|
1442
1545
|
SendHapticFeedbackErrorMessage,
|
|
1443
1546
|
ShareFilesErrorCodes,
|
|
1444
1547
|
ShareFilesErrorMessage,
|
|
1548
|
+
MicrophoneErrorCodes,
|
|
1549
|
+
MicrophoneErrorMessage,
|
|
1445
1550
|
AppErrorCodes2 as AppErrorCodes,
|
|
1446
1551
|
ResponseEvent,
|
|
1552
|
+
Tokens,
|
|
1553
|
+
TokenDecimals,
|
|
1554
|
+
Network,
|
|
1555
|
+
tokenToDecimals,
|
|
1556
|
+
parseSiweMessage,
|
|
1557
|
+
verifySiweMessage,
|
|
1558
|
+
Command,
|
|
1559
|
+
Permission,
|
|
1447
1560
|
MiniKit
|
|
1448
1561
|
};
|