@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.cjs
CHANGED
|
@@ -23,6 +23,8 @@ __export(core_exports, {
|
|
|
23
23
|
Command: () => Command,
|
|
24
24
|
GetPermissionsErrorCodes: () => GetPermissionsErrorCodes,
|
|
25
25
|
GetPermissionsErrorMessage: () => GetPermissionsErrorMessage,
|
|
26
|
+
MicrophoneErrorCodes: () => MicrophoneErrorCodes,
|
|
27
|
+
MicrophoneErrorMessage: () => MicrophoneErrorMessage,
|
|
26
28
|
MiniKit: () => MiniKit,
|
|
27
29
|
MiniKitInstallErrorCodes: () => MiniKitInstallErrorCodes,
|
|
28
30
|
MiniKitInstallErrorMessage: () => MiniKitInstallErrorMessage,
|
|
@@ -65,14 +67,311 @@ module.exports = __toCommonJS(core_exports);
|
|
|
65
67
|
var import_idkit_core3 = require("@worldcoin/idkit-core");
|
|
66
68
|
var import_hashing = require("@worldcoin/idkit-core/hashing");
|
|
67
69
|
|
|
70
|
+
// helpers/send-webview-event.ts
|
|
71
|
+
var sendWebviewEvent = (payload) => {
|
|
72
|
+
if (window.webkit) {
|
|
73
|
+
window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
|
|
74
|
+
} else if (window.Android) {
|
|
75
|
+
window.Android.postMessage?.(JSON.stringify(payload));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// types/errors.ts
|
|
80
|
+
var import_idkit_core = require("@worldcoin/idkit-core");
|
|
81
|
+
var import_idkit_core2 = require("@worldcoin/idkit-core");
|
|
82
|
+
var VerificationErrorMessage = {
|
|
83
|
+
[import_idkit_core.AppErrorCodes.VerificationRejected]: "You've cancelled the request in World App.",
|
|
84
|
+
[import_idkit_core.AppErrorCodes.MaxVerificationsReached]: "You have already verified the maximum number of times for this action.",
|
|
85
|
+
[import_idkit_core.AppErrorCodes.CredentialUnavailable]: "It seems you do not have the verification level required by this app.",
|
|
86
|
+
[import_idkit_core.AppErrorCodes.MalformedRequest]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
87
|
+
[import_idkit_core.AppErrorCodes.InvalidNetwork]: "Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details.",
|
|
88
|
+
[import_idkit_core.AppErrorCodes.InclusionProofFailed]: "There was an issue fetching your credential. Please try again.",
|
|
89
|
+
[import_idkit_core.AppErrorCodes.InclusionProofPending]: "Your identity is still being registered. Please wait a few minutes and try again.",
|
|
90
|
+
[import_idkit_core.AppErrorCodes.UnexpectedResponse]: "Unexpected response from your wallet. Please try again.",
|
|
91
|
+
[import_idkit_core.AppErrorCodes.FailedByHostApp]: "Verification failed by the app. Please contact the app owner for details.",
|
|
92
|
+
[import_idkit_core.AppErrorCodes.GenericError]: "Something unexpected went wrong. Please try again.",
|
|
93
|
+
[import_idkit_core.AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
|
|
94
|
+
};
|
|
95
|
+
var PaymentErrorCodes = /* @__PURE__ */ ((PaymentErrorCodes2) => {
|
|
96
|
+
PaymentErrorCodes2["InputError"] = "input_error";
|
|
97
|
+
PaymentErrorCodes2["UserRejected"] = "user_rejected";
|
|
98
|
+
PaymentErrorCodes2["PaymentRejected"] = "payment_rejected";
|
|
99
|
+
PaymentErrorCodes2["InvalidReceiver"] = "invalid_receiver";
|
|
100
|
+
PaymentErrorCodes2["InsufficientBalance"] = "insufficient_balance";
|
|
101
|
+
PaymentErrorCodes2["TransactionFailed"] = "transaction_failed";
|
|
102
|
+
PaymentErrorCodes2["GenericError"] = "generic_error";
|
|
103
|
+
PaymentErrorCodes2["UserBlocked"] = "user_blocked";
|
|
104
|
+
return PaymentErrorCodes2;
|
|
105
|
+
})(PaymentErrorCodes || {});
|
|
106
|
+
var PaymentErrorMessage = {
|
|
107
|
+
["input_error" /* InputError */]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
108
|
+
["user_rejected" /* UserRejected */]: "You have cancelled the payment in World App.",
|
|
109
|
+
["payment_rejected" /* PaymentRejected */]: "You've cancelled the payment in World App.",
|
|
110
|
+
["invalid_receiver" /* InvalidReceiver */]: "The receiver address is invalid. Please contact the app owner.",
|
|
111
|
+
["insufficient_balance" /* InsufficientBalance */]: "You do not have enough balance to complete this transaction.",
|
|
112
|
+
["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again.",
|
|
113
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
114
|
+
["user_blocked" /* UserBlocked */]: "User's region is blocked from making payments."
|
|
115
|
+
};
|
|
116
|
+
var PaymentValidationErrors = /* @__PURE__ */ ((PaymentValidationErrors2) => {
|
|
117
|
+
PaymentValidationErrors2["MalformedRequest"] = "There was a problem with this request. Please try again or contact the app owner.";
|
|
118
|
+
PaymentValidationErrors2["InvalidTokenAddress"] = "The token address is invalid. Please contact the app owner.";
|
|
119
|
+
PaymentValidationErrors2["InvalidAppId"] = "The app ID is invalid. Please contact the app owner.";
|
|
120
|
+
PaymentValidationErrors2["DuplicateReference"] = "This reference ID already exists please generate a new one and try again.";
|
|
121
|
+
return PaymentValidationErrors2;
|
|
122
|
+
})(PaymentValidationErrors || {});
|
|
123
|
+
var WalletAuthErrorCodes = /* @__PURE__ */ ((WalletAuthErrorCodes2) => {
|
|
124
|
+
WalletAuthErrorCodes2["MalformedRequest"] = "malformed_request";
|
|
125
|
+
WalletAuthErrorCodes2["UserRejected"] = "user_rejected";
|
|
126
|
+
WalletAuthErrorCodes2["GenericError"] = "generic_error";
|
|
127
|
+
return WalletAuthErrorCodes2;
|
|
128
|
+
})(WalletAuthErrorCodes || {});
|
|
129
|
+
var WalletAuthErrorMessage = {
|
|
130
|
+
["malformed_request" /* MalformedRequest */]: "Provided parameters in the request are invalid.",
|
|
131
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
132
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
133
|
+
};
|
|
134
|
+
var SendTransactionErrorCodes = /* @__PURE__ */ ((SendTransactionErrorCodes2) => {
|
|
135
|
+
SendTransactionErrorCodes2["InvalidOperation"] = "invalid_operation";
|
|
136
|
+
SendTransactionErrorCodes2["UserRejected"] = "user_rejected";
|
|
137
|
+
SendTransactionErrorCodes2["InputError"] = "input_error";
|
|
138
|
+
SendTransactionErrorCodes2["SimulationFailed"] = "simulation_failed";
|
|
139
|
+
SendTransactionErrorCodes2["TransactionFailed"] = "transaction_failed";
|
|
140
|
+
SendTransactionErrorCodes2["GenericError"] = "generic_error";
|
|
141
|
+
SendTransactionErrorCodes2["DisallowedOperation"] = "disallowed_operation";
|
|
142
|
+
SendTransactionErrorCodes2["ValidationError"] = "validation_error";
|
|
143
|
+
SendTransactionErrorCodes2["InvalidContract"] = "invalid_contract";
|
|
144
|
+
SendTransactionErrorCodes2["MaliciousOperation"] = "malicious_operation";
|
|
145
|
+
SendTransactionErrorCodes2["DailyTxLimitReached"] = "daily_tx_limit_reached";
|
|
146
|
+
SendTransactionErrorCodes2["PermittedAmountExceedsSlippage"] = "permitted_amount_exceeds_slippage";
|
|
147
|
+
SendTransactionErrorCodes2["PermittedAmountNotFound"] = "permitted_amount_not_found";
|
|
148
|
+
return SendTransactionErrorCodes2;
|
|
149
|
+
})(SendTransactionErrorCodes || {});
|
|
150
|
+
var SendTransactionErrorMessage = {
|
|
151
|
+
["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
|
|
152
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
153
|
+
["input_error" /* InputError */]: "Invalid payload.",
|
|
154
|
+
["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
|
|
155
|
+
["validation_error" /* ValidationError */]: "The transaction validation failed. Please try again.",
|
|
156
|
+
["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again later.",
|
|
157
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
158
|
+
["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
|
|
159
|
+
["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
|
|
160
|
+
["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious.",
|
|
161
|
+
["daily_tx_limit_reached" /* DailyTxLimitReached */]: "Daily transaction limit reached. Max 100 transactions per day. Wait until the next day.",
|
|
162
|
+
["permitted_amount_exceeds_slippage" /* PermittedAmountExceedsSlippage */]: "Permitted amount exceeds slippage. You must spend at least 90% of the permitted amount.",
|
|
163
|
+
["permitted_amount_not_found" /* PermittedAmountNotFound */]: "Permitted amount not found in permit2 payload."
|
|
164
|
+
};
|
|
165
|
+
var SignMessageErrorCodes = /* @__PURE__ */ ((SignMessageErrorCodes2) => {
|
|
166
|
+
SignMessageErrorCodes2["InvalidMessage"] = "invalid_message";
|
|
167
|
+
SignMessageErrorCodes2["UserRejected"] = "user_rejected";
|
|
168
|
+
SignMessageErrorCodes2["GenericError"] = "generic_error";
|
|
169
|
+
return SignMessageErrorCodes2;
|
|
170
|
+
})(SignMessageErrorCodes || {});
|
|
171
|
+
var SignMessageErrorMessage = {
|
|
172
|
+
["invalid_message" /* InvalidMessage */]: "Invalid message requested",
|
|
173
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
174
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
175
|
+
};
|
|
176
|
+
var SignTypedDataErrorCodes = /* @__PURE__ */ ((SignTypedDataErrorCodes2) => {
|
|
177
|
+
SignTypedDataErrorCodes2["InvalidOperation"] = "invalid_operation";
|
|
178
|
+
SignTypedDataErrorCodes2["UserRejected"] = "user_rejected";
|
|
179
|
+
SignTypedDataErrorCodes2["InputError"] = "input_error";
|
|
180
|
+
SignTypedDataErrorCodes2["SimulationFailed"] = "simulation_failed";
|
|
181
|
+
SignTypedDataErrorCodes2["GenericError"] = "generic_error";
|
|
182
|
+
SignTypedDataErrorCodes2["DisallowedOperation"] = "disallowed_operation";
|
|
183
|
+
SignTypedDataErrorCodes2["InvalidContract"] = "invalid_contract";
|
|
184
|
+
SignTypedDataErrorCodes2["MaliciousOperation"] = "malicious_operation";
|
|
185
|
+
return SignTypedDataErrorCodes2;
|
|
186
|
+
})(SignTypedDataErrorCodes || {});
|
|
187
|
+
var SignTypedDataErrorMessage = {
|
|
188
|
+
["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
|
|
189
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
190
|
+
["input_error" /* InputError */]: "Invalid payload.",
|
|
191
|
+
["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
|
|
192
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
193
|
+
["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
|
|
194
|
+
["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
|
|
195
|
+
["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious."
|
|
196
|
+
};
|
|
197
|
+
var MiniKitInstallErrorCodes = /* @__PURE__ */ ((MiniKitInstallErrorCodes2) => {
|
|
198
|
+
MiniKitInstallErrorCodes2["Unknown"] = "unknown";
|
|
199
|
+
MiniKitInstallErrorCodes2["AlreadyInstalled"] = "already_installed";
|
|
200
|
+
MiniKitInstallErrorCodes2["OutsideOfWorldApp"] = "outside_of_worldapp";
|
|
201
|
+
MiniKitInstallErrorCodes2["NotOnClient"] = "not_on_client";
|
|
202
|
+
MiniKitInstallErrorCodes2["AppOutOfDate"] = "app_out_of_date";
|
|
203
|
+
return MiniKitInstallErrorCodes2;
|
|
204
|
+
})(MiniKitInstallErrorCodes || {});
|
|
205
|
+
var MiniKitInstallErrorMessage = {
|
|
206
|
+
["unknown" /* Unknown */]: "Failed to install MiniKit.",
|
|
207
|
+
["already_installed" /* AlreadyInstalled */]: "MiniKit is already installed.",
|
|
208
|
+
["outside_of_worldapp" /* OutsideOfWorldApp */]: "MiniApp launched outside of WorldApp.",
|
|
209
|
+
["not_on_client" /* NotOnClient */]: "Window object is not available.",
|
|
210
|
+
["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
|
|
211
|
+
};
|
|
212
|
+
var ShareContactsErrorCodes = /* @__PURE__ */ ((ShareContactsErrorCodes2) => {
|
|
213
|
+
ShareContactsErrorCodes2["UserRejected"] = "user_rejected";
|
|
214
|
+
ShareContactsErrorCodes2["GenericError"] = "generic_error";
|
|
215
|
+
return ShareContactsErrorCodes2;
|
|
216
|
+
})(ShareContactsErrorCodes || {});
|
|
217
|
+
var ShareContactsErrorMessage = {
|
|
218
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
219
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
220
|
+
};
|
|
221
|
+
var RequestPermissionErrorCodes = /* @__PURE__ */ ((RequestPermissionErrorCodes2) => {
|
|
222
|
+
RequestPermissionErrorCodes2["UserRejected"] = "user_rejected";
|
|
223
|
+
RequestPermissionErrorCodes2["GenericError"] = "generic_error";
|
|
224
|
+
RequestPermissionErrorCodes2["AlreadyRequested"] = "already_requested";
|
|
225
|
+
RequestPermissionErrorCodes2["PermissionDisabled"] = "permission_disabled";
|
|
226
|
+
RequestPermissionErrorCodes2["AlreadyGranted"] = "already_granted";
|
|
227
|
+
RequestPermissionErrorCodes2["UnsupportedPermission"] = "unsupported_permission";
|
|
228
|
+
return RequestPermissionErrorCodes2;
|
|
229
|
+
})(RequestPermissionErrorCodes || {});
|
|
230
|
+
var RequestPermissionErrorMessage = {
|
|
231
|
+
["user_rejected" /* UserRejected */]: "User declined sharing contacts",
|
|
232
|
+
["generic_error" /* GenericError */]: "Request failed for unknown reason.",
|
|
233
|
+
["already_requested" /* AlreadyRequested */]: "User has already declined turning on notifications once",
|
|
234
|
+
["permission_disabled" /* PermissionDisabled */]: "User does not have this permission enabled in World App",
|
|
235
|
+
["already_granted" /* AlreadyGranted */]: "If the user has already granted this mini app permission",
|
|
236
|
+
["unsupported_permission" /* UnsupportedPermission */]: "The permission requested is not supported by this mini app"
|
|
237
|
+
};
|
|
238
|
+
var GetPermissionsErrorCodes = /* @__PURE__ */ ((GetPermissionsErrorCodes2) => {
|
|
239
|
+
GetPermissionsErrorCodes2["GenericError"] = "generic_error";
|
|
240
|
+
return GetPermissionsErrorCodes2;
|
|
241
|
+
})(GetPermissionsErrorCodes || {});
|
|
242
|
+
var GetPermissionsErrorMessage = {
|
|
243
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again."
|
|
244
|
+
};
|
|
245
|
+
var SendHapticFeedbackErrorCodes = /* @__PURE__ */ ((SendHapticFeedbackErrorCodes2) => {
|
|
246
|
+
SendHapticFeedbackErrorCodes2["GenericError"] = "generic_error";
|
|
247
|
+
SendHapticFeedbackErrorCodes2["UserRejected"] = "user_rejected";
|
|
248
|
+
return SendHapticFeedbackErrorCodes2;
|
|
249
|
+
})(SendHapticFeedbackErrorCodes || {});
|
|
250
|
+
var SendHapticFeedbackErrorMessage = {
|
|
251
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong.",
|
|
252
|
+
["user_rejected" /* UserRejected */]: "User rejected the request."
|
|
253
|
+
};
|
|
254
|
+
var ShareFilesErrorCodes = /* @__PURE__ */ ((ShareFilesErrorCodes2) => {
|
|
255
|
+
ShareFilesErrorCodes2["UserRejected"] = "user_rejected";
|
|
256
|
+
ShareFilesErrorCodes2["GenericError"] = "generic_error";
|
|
257
|
+
ShareFilesErrorCodes2["InvalidFileName"] = "invalid_file_name";
|
|
258
|
+
return ShareFilesErrorCodes2;
|
|
259
|
+
})(ShareFilesErrorCodes || {});
|
|
260
|
+
var ShareFilesErrorMessage = {
|
|
261
|
+
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
262
|
+
["generic_error" /* GenericError */]: "Something unexpected went wrong.",
|
|
263
|
+
["invalid_file_name" /* InvalidFileName */]: "Invalid file name. Make sure you include the extension"
|
|
264
|
+
};
|
|
265
|
+
var MicrophoneErrorCodes = /* @__PURE__ */ ((MicrophoneErrorCodes2) => {
|
|
266
|
+
MicrophoneErrorCodes2["MiniAppPermissionNotEnabled"] = "mini_app_permission_not_enabled";
|
|
267
|
+
MicrophoneErrorCodes2["WorldAppPermissionNotEnabled"] = "world_app_permission_not_enabled";
|
|
268
|
+
return MicrophoneErrorCodes2;
|
|
269
|
+
})(MicrophoneErrorCodes || {});
|
|
270
|
+
var MicrophoneErrorMessage = {
|
|
271
|
+
["mini_app_permission_not_enabled" /* MiniAppPermissionNotEnabled */]: "Microphone permission not enabled for your Mini App",
|
|
272
|
+
["world_app_permission_not_enabled" /* WorldAppPermissionNotEnabled */]: "Microphone permission not enabled in World App"
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// types/responses.ts
|
|
276
|
+
var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
|
|
277
|
+
ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
|
|
278
|
+
ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
|
|
279
|
+
ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
|
|
280
|
+
ResponseEvent2["MiniAppSendTransaction"] = "miniapp-send-transaction";
|
|
281
|
+
ResponseEvent2["MiniAppSignMessage"] = "miniapp-sign-message";
|
|
282
|
+
ResponseEvent2["MiniAppSignTypedData"] = "miniapp-sign-typed-data";
|
|
283
|
+
ResponseEvent2["MiniAppShareContacts"] = "miniapp-share-contacts";
|
|
284
|
+
ResponseEvent2["MiniAppRequestPermission"] = "miniapp-request-permission";
|
|
285
|
+
ResponseEvent2["MiniAppGetPermissions"] = "miniapp-get-permissions";
|
|
286
|
+
ResponseEvent2["MiniAppSendHapticFeedback"] = "miniapp-send-haptic-feedback";
|
|
287
|
+
ResponseEvent2["MiniAppShare"] = "miniapp-share";
|
|
288
|
+
ResponseEvent2["MiniAppMicrophone"] = "miniapp-microphone";
|
|
289
|
+
return ResponseEvent2;
|
|
290
|
+
})(ResponseEvent || {});
|
|
291
|
+
|
|
292
|
+
// helpers/microphone/index.ts
|
|
293
|
+
var microphoneSetupDone = false;
|
|
294
|
+
var setupMicrophone = () => {
|
|
295
|
+
if (microphoneSetupDone) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (typeof navigator !== "undefined" && !navigator.mediaDevices?.getUserMedia)
|
|
299
|
+
return;
|
|
300
|
+
const originalStop = MediaStreamTrack.prototype.stop;
|
|
301
|
+
MediaStreamTrack.prototype.stop = function() {
|
|
302
|
+
originalStop.call(this);
|
|
303
|
+
if (this.readyState === "ended") {
|
|
304
|
+
setTimeout(() => this.dispatchEvent(new Event("ended")), 0);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
const realGUM = navigator.mediaDevices.getUserMedia.bind(
|
|
308
|
+
navigator.mediaDevices
|
|
309
|
+
);
|
|
310
|
+
const live = /* @__PURE__ */ new Set();
|
|
311
|
+
async function wrapped(constraints) {
|
|
312
|
+
const stream = await realGUM(constraints);
|
|
313
|
+
sendWebviewEvent({
|
|
314
|
+
command: "microphone-stream-started",
|
|
315
|
+
version: 1,
|
|
316
|
+
payload: {
|
|
317
|
+
streamId: stream.id
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
live.add(stream);
|
|
321
|
+
stream.getTracks().forEach((t) => {
|
|
322
|
+
t.addEventListener("ended", () => {
|
|
323
|
+
sendWebviewEvent({
|
|
324
|
+
command: "microphone-stream-ended",
|
|
325
|
+
version: 1,
|
|
326
|
+
payload: {
|
|
327
|
+
streamId: stream.id
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
live.delete(stream);
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
return stream;
|
|
334
|
+
}
|
|
335
|
+
Object.defineProperty(navigator.mediaDevices, "getUserMedia", {
|
|
336
|
+
value: wrapped,
|
|
337
|
+
writable: false,
|
|
338
|
+
configurable: false,
|
|
339
|
+
enumerable: true
|
|
340
|
+
});
|
|
341
|
+
Object.freeze(navigator.mediaDevices);
|
|
342
|
+
const stopAllMiniAppMicrophoneStreams = () => {
|
|
343
|
+
live.forEach((s) => {
|
|
344
|
+
s.getTracks().forEach((t) => {
|
|
345
|
+
t.stop();
|
|
346
|
+
sendWebviewEvent({
|
|
347
|
+
command: "microphone-stream-ended",
|
|
348
|
+
version: 1,
|
|
349
|
+
payload: {
|
|
350
|
+
streamId: s.id
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
live.clear();
|
|
356
|
+
};
|
|
357
|
+
MiniKit.subscribe("miniapp-microphone" /* MiniAppMicrophone */, (payload) => {
|
|
358
|
+
if (payload.status === "error" && (payload.error_code === "mini_app_permission_not_enabled" /* MiniAppPermissionNotEnabled */ || payload.error_code === "world_app_permission_not_enabled" /* WorldAppPermissionNotEnabled */)) {
|
|
359
|
+
console.log("stopping all microphone streams", payload);
|
|
360
|
+
stopAllMiniAppMicrophoneStreams();
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
window.__stopAllMiniAppMicrophoneStreams = stopAllMiniAppMicrophoneStreams;
|
|
364
|
+
microphoneSetupDone = true;
|
|
365
|
+
};
|
|
366
|
+
|
|
68
367
|
// types/payment.ts
|
|
69
|
-
var Tokens = /* @__PURE__ */ ((
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return
|
|
368
|
+
var Tokens = /* @__PURE__ */ ((Tokens2) => {
|
|
369
|
+
Tokens2["USDC"] = "USDCE";
|
|
370
|
+
Tokens2["WLD"] = "WLD";
|
|
371
|
+
return Tokens2;
|
|
73
372
|
})(Tokens || {});
|
|
74
373
|
var TokenDecimals = {
|
|
75
|
-
["USDCE" /*
|
|
374
|
+
["USDCE" /* USDC */]: 6,
|
|
76
375
|
["WLD" /* WLD */]: 18
|
|
77
376
|
};
|
|
78
377
|
var Network = /* @__PURE__ */ ((Network2) => {
|
|
@@ -96,9 +395,9 @@ var tokenToDecimals = (amount, token) => {
|
|
|
96
395
|
};
|
|
97
396
|
var validatePaymentPayload = (payload) => {
|
|
98
397
|
if (payload.tokens.some(
|
|
99
|
-
(token) => token.symbol == "USDCE" && parseFloat(token.token_amount) < 0.1
|
|
398
|
+
(token) => token.symbol == "USDCE" /* USDC */ && parseFloat(token.token_amount) < 0.1
|
|
100
399
|
)) {
|
|
101
|
-
console.error("
|
|
400
|
+
console.error("USDC amount should be greater than $0.1");
|
|
102
401
|
return false;
|
|
103
402
|
}
|
|
104
403
|
if (payload.reference.length > 36) {
|
|
@@ -610,219 +909,10 @@ var Command = /* @__PURE__ */ ((Command2) => {
|
|
|
610
909
|
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
611
910
|
Permission2["Notifications"] = "notifications";
|
|
612
911
|
Permission2["Contacts"] = "contacts";
|
|
912
|
+
Permission2["Microphone"] = "microphone";
|
|
613
913
|
return Permission2;
|
|
614
914
|
})(Permission || {});
|
|
615
915
|
|
|
616
|
-
// types/errors.ts
|
|
617
|
-
var import_idkit_core = require("@worldcoin/idkit-core");
|
|
618
|
-
var import_idkit_core2 = require("@worldcoin/idkit-core");
|
|
619
|
-
var VerificationErrorMessage = {
|
|
620
|
-
[import_idkit_core.AppErrorCodes.VerificationRejected]: "You've cancelled the request in World App.",
|
|
621
|
-
[import_idkit_core.AppErrorCodes.MaxVerificationsReached]: "You have already verified the maximum number of times for this action.",
|
|
622
|
-
[import_idkit_core.AppErrorCodes.CredentialUnavailable]: "It seems you do not have the verification level required by this app.",
|
|
623
|
-
[import_idkit_core.AppErrorCodes.MalformedRequest]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
624
|
-
[import_idkit_core.AppErrorCodes.InvalidNetwork]: "Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details.",
|
|
625
|
-
[import_idkit_core.AppErrorCodes.InclusionProofFailed]: "There was an issue fetching your credential. Please try again.",
|
|
626
|
-
[import_idkit_core.AppErrorCodes.InclusionProofPending]: "Your identity is still being registered. Please wait a few minutes and try again.",
|
|
627
|
-
[import_idkit_core.AppErrorCodes.UnexpectedResponse]: "Unexpected response from your wallet. Please try again.",
|
|
628
|
-
[import_idkit_core.AppErrorCodes.FailedByHostApp]: "Verification failed by the app. Please contact the app owner for details.",
|
|
629
|
-
[import_idkit_core.AppErrorCodes.GenericError]: "Something unexpected went wrong. Please try again.",
|
|
630
|
-
[import_idkit_core.AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
|
|
631
|
-
};
|
|
632
|
-
var PaymentErrorCodes = /* @__PURE__ */ ((PaymentErrorCodes2) => {
|
|
633
|
-
PaymentErrorCodes2["InputError"] = "input_error";
|
|
634
|
-
PaymentErrorCodes2["UserRejected"] = "user_rejected";
|
|
635
|
-
PaymentErrorCodes2["PaymentRejected"] = "payment_rejected";
|
|
636
|
-
PaymentErrorCodes2["InvalidReceiver"] = "invalid_receiver";
|
|
637
|
-
PaymentErrorCodes2["InsufficientBalance"] = "insufficient_balance";
|
|
638
|
-
PaymentErrorCodes2["TransactionFailed"] = "transaction_failed";
|
|
639
|
-
PaymentErrorCodes2["GenericError"] = "generic_error";
|
|
640
|
-
PaymentErrorCodes2["UserBlocked"] = "user_blocked";
|
|
641
|
-
return PaymentErrorCodes2;
|
|
642
|
-
})(PaymentErrorCodes || {});
|
|
643
|
-
var PaymentErrorMessage = {
|
|
644
|
-
["input_error" /* InputError */]: "There was a problem with this request. Please try again or contact the app owner.",
|
|
645
|
-
["user_rejected" /* UserRejected */]: "You have cancelled the payment in World App.",
|
|
646
|
-
["payment_rejected" /* PaymentRejected */]: "You've cancelled the payment in World App.",
|
|
647
|
-
["invalid_receiver" /* InvalidReceiver */]: "The receiver address is invalid. Please contact the app owner.",
|
|
648
|
-
["insufficient_balance" /* InsufficientBalance */]: "You do not have enough balance to complete this transaction.",
|
|
649
|
-
["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again.",
|
|
650
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
651
|
-
["user_blocked" /* UserBlocked */]: "User's region is blocked from making payments."
|
|
652
|
-
};
|
|
653
|
-
var PaymentValidationErrors = /* @__PURE__ */ ((PaymentValidationErrors2) => {
|
|
654
|
-
PaymentValidationErrors2["MalformedRequest"] = "There was a problem with this request. Please try again or contact the app owner.";
|
|
655
|
-
PaymentValidationErrors2["InvalidTokenAddress"] = "The token address is invalid. Please contact the app owner.";
|
|
656
|
-
PaymentValidationErrors2["InvalidAppId"] = "The app ID is invalid. Please contact the app owner.";
|
|
657
|
-
PaymentValidationErrors2["DuplicateReference"] = "This reference ID already exists please generate a new one and try again.";
|
|
658
|
-
return PaymentValidationErrors2;
|
|
659
|
-
})(PaymentValidationErrors || {});
|
|
660
|
-
var WalletAuthErrorCodes = /* @__PURE__ */ ((WalletAuthErrorCodes2) => {
|
|
661
|
-
WalletAuthErrorCodes2["MalformedRequest"] = "malformed_request";
|
|
662
|
-
WalletAuthErrorCodes2["UserRejected"] = "user_rejected";
|
|
663
|
-
WalletAuthErrorCodes2["GenericError"] = "generic_error";
|
|
664
|
-
return WalletAuthErrorCodes2;
|
|
665
|
-
})(WalletAuthErrorCodes || {});
|
|
666
|
-
var WalletAuthErrorMessage = {
|
|
667
|
-
["malformed_request" /* MalformedRequest */]: "Provided parameters in the request are invalid.",
|
|
668
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
669
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
670
|
-
};
|
|
671
|
-
var SendTransactionErrorCodes = /* @__PURE__ */ ((SendTransactionErrorCodes2) => {
|
|
672
|
-
SendTransactionErrorCodes2["InvalidOperation"] = "invalid_operation";
|
|
673
|
-
SendTransactionErrorCodes2["UserRejected"] = "user_rejected";
|
|
674
|
-
SendTransactionErrorCodes2["InputError"] = "input_error";
|
|
675
|
-
SendTransactionErrorCodes2["SimulationFailed"] = "simulation_failed";
|
|
676
|
-
SendTransactionErrorCodes2["TransactionFailed"] = "transaction_failed";
|
|
677
|
-
SendTransactionErrorCodes2["GenericError"] = "generic_error";
|
|
678
|
-
SendTransactionErrorCodes2["DisallowedOperation"] = "disallowed_operation";
|
|
679
|
-
SendTransactionErrorCodes2["InvalidContract"] = "invalid_contract";
|
|
680
|
-
SendTransactionErrorCodes2["MaliciousOperation"] = "malicious_operation";
|
|
681
|
-
SendTransactionErrorCodes2["DailyTxLimitReached"] = "daily_tx_limit_reached";
|
|
682
|
-
SendTransactionErrorCodes2["PermittedAmountExceedsSlippage"] = "permitted_amount_exceeds_slippage";
|
|
683
|
-
SendTransactionErrorCodes2["PermittedAmountNotFound"] = "permitted_amount_not_found";
|
|
684
|
-
return SendTransactionErrorCodes2;
|
|
685
|
-
})(SendTransactionErrorCodes || {});
|
|
686
|
-
var SendTransactionErrorMessage = {
|
|
687
|
-
["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
|
|
688
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
689
|
-
["input_error" /* InputError */]: "Invalid payload.",
|
|
690
|
-
["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
|
|
691
|
-
["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again later.",
|
|
692
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
693
|
-
["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
|
|
694
|
-
["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
|
|
695
|
-
["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious.",
|
|
696
|
-
["daily_tx_limit_reached" /* DailyTxLimitReached */]: "Daily transaction limit reached. Max 100 transactions per day. Wait until the next day.",
|
|
697
|
-
["permitted_amount_exceeds_slippage" /* PermittedAmountExceedsSlippage */]: "Permitted amount exceeds slippage. You must spend at least 90% of the permitted amount.",
|
|
698
|
-
["permitted_amount_not_found" /* PermittedAmountNotFound */]: "Permitted amount not found in permit2 payload."
|
|
699
|
-
};
|
|
700
|
-
var SignMessageErrorCodes = /* @__PURE__ */ ((SignMessageErrorCodes2) => {
|
|
701
|
-
SignMessageErrorCodes2["InvalidMessage"] = "invalid_message";
|
|
702
|
-
SignMessageErrorCodes2["UserRejected"] = "user_rejected";
|
|
703
|
-
SignMessageErrorCodes2["GenericError"] = "generic_error";
|
|
704
|
-
return SignMessageErrorCodes2;
|
|
705
|
-
})(SignMessageErrorCodes || {});
|
|
706
|
-
var SignMessageErrorMessage = {
|
|
707
|
-
["invalid_message" /* InvalidMessage */]: "Invalid message requested",
|
|
708
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
709
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
710
|
-
};
|
|
711
|
-
var SignTypedDataErrorCodes = /* @__PURE__ */ ((SignTypedDataErrorCodes2) => {
|
|
712
|
-
SignTypedDataErrorCodes2["InvalidOperation"] = "invalid_operation";
|
|
713
|
-
SignTypedDataErrorCodes2["UserRejected"] = "user_rejected";
|
|
714
|
-
SignTypedDataErrorCodes2["InputError"] = "input_error";
|
|
715
|
-
SignTypedDataErrorCodes2["SimulationFailed"] = "simulation_failed";
|
|
716
|
-
SignTypedDataErrorCodes2["GenericError"] = "generic_error";
|
|
717
|
-
SignTypedDataErrorCodes2["DisallowedOperation"] = "disallowed_operation";
|
|
718
|
-
SignTypedDataErrorCodes2["InvalidContract"] = "invalid_contract";
|
|
719
|
-
SignTypedDataErrorCodes2["MaliciousOperation"] = "malicious_operation";
|
|
720
|
-
return SignTypedDataErrorCodes2;
|
|
721
|
-
})(SignTypedDataErrorCodes || {});
|
|
722
|
-
var SignTypedDataErrorMessage = {
|
|
723
|
-
["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
|
|
724
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
725
|
-
["input_error" /* InputError */]: "Invalid payload.",
|
|
726
|
-
["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
|
|
727
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
|
|
728
|
-
["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
|
|
729
|
-
["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
|
|
730
|
-
["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious."
|
|
731
|
-
};
|
|
732
|
-
var MiniKitInstallErrorCodes = /* @__PURE__ */ ((MiniKitInstallErrorCodes2) => {
|
|
733
|
-
MiniKitInstallErrorCodes2["Unknown"] = "unknown";
|
|
734
|
-
MiniKitInstallErrorCodes2["AlreadyInstalled"] = "already_installed";
|
|
735
|
-
MiniKitInstallErrorCodes2["OutsideOfWorldApp"] = "outside_of_worldapp";
|
|
736
|
-
MiniKitInstallErrorCodes2["NotOnClient"] = "not_on_client";
|
|
737
|
-
MiniKitInstallErrorCodes2["AppOutOfDate"] = "app_out_of_date";
|
|
738
|
-
return MiniKitInstallErrorCodes2;
|
|
739
|
-
})(MiniKitInstallErrorCodes || {});
|
|
740
|
-
var MiniKitInstallErrorMessage = {
|
|
741
|
-
["unknown" /* Unknown */]: "Failed to install MiniKit.",
|
|
742
|
-
["already_installed" /* AlreadyInstalled */]: "MiniKit is already installed.",
|
|
743
|
-
["outside_of_worldapp" /* OutsideOfWorldApp */]: "MiniApp launched outside of WorldApp.",
|
|
744
|
-
["not_on_client" /* NotOnClient */]: "Window object is not available.",
|
|
745
|
-
["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
|
|
746
|
-
};
|
|
747
|
-
var ShareContactsErrorCodes = /* @__PURE__ */ ((ShareContactsErrorCodes2) => {
|
|
748
|
-
ShareContactsErrorCodes2["UserRejected"] = "user_rejected";
|
|
749
|
-
ShareContactsErrorCodes2["GenericError"] = "generic_error";
|
|
750
|
-
return ShareContactsErrorCodes2;
|
|
751
|
-
})(ShareContactsErrorCodes || {});
|
|
752
|
-
var ShareContactsErrorMessage = {
|
|
753
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
754
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong."
|
|
755
|
-
};
|
|
756
|
-
var RequestPermissionErrorCodes = /* @__PURE__ */ ((RequestPermissionErrorCodes2) => {
|
|
757
|
-
RequestPermissionErrorCodes2["UserRejected"] = "user_rejected";
|
|
758
|
-
RequestPermissionErrorCodes2["GenericError"] = "generic_error";
|
|
759
|
-
RequestPermissionErrorCodes2["AlreadyRequested"] = "already_requested";
|
|
760
|
-
RequestPermissionErrorCodes2["PermissionDisabled"] = "permission_disabled";
|
|
761
|
-
RequestPermissionErrorCodes2["AlreadyGranted"] = "already_granted";
|
|
762
|
-
RequestPermissionErrorCodes2["UnsupportedPermission"] = "unsupported_permission";
|
|
763
|
-
return RequestPermissionErrorCodes2;
|
|
764
|
-
})(RequestPermissionErrorCodes || {});
|
|
765
|
-
var RequestPermissionErrorMessage = {
|
|
766
|
-
["user_rejected" /* UserRejected */]: "User declined sharing contacts",
|
|
767
|
-
["generic_error" /* GenericError */]: "Request failed for unknown reason.",
|
|
768
|
-
["already_requested" /* AlreadyRequested */]: "User has already declined turning on notifications once",
|
|
769
|
-
["permission_disabled" /* PermissionDisabled */]: "User does not have this permission enabled in World App",
|
|
770
|
-
["already_granted" /* AlreadyGranted */]: "If the user has already granted this mini app permission",
|
|
771
|
-
["unsupported_permission" /* UnsupportedPermission */]: "The permission requested is not supported by this mini app"
|
|
772
|
-
};
|
|
773
|
-
var GetPermissionsErrorCodes = /* @__PURE__ */ ((GetPermissionsErrorCodes2) => {
|
|
774
|
-
GetPermissionsErrorCodes2["GenericError"] = "generic_error";
|
|
775
|
-
return GetPermissionsErrorCodes2;
|
|
776
|
-
})(GetPermissionsErrorCodes || {});
|
|
777
|
-
var GetPermissionsErrorMessage = {
|
|
778
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again."
|
|
779
|
-
};
|
|
780
|
-
var SendHapticFeedbackErrorCodes = /* @__PURE__ */ ((SendHapticFeedbackErrorCodes2) => {
|
|
781
|
-
SendHapticFeedbackErrorCodes2["GenericError"] = "generic_error";
|
|
782
|
-
SendHapticFeedbackErrorCodes2["UserRejected"] = "user_rejected";
|
|
783
|
-
return SendHapticFeedbackErrorCodes2;
|
|
784
|
-
})(SendHapticFeedbackErrorCodes || {});
|
|
785
|
-
var SendHapticFeedbackErrorMessage = {
|
|
786
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong.",
|
|
787
|
-
["user_rejected" /* UserRejected */]: "User rejected the request."
|
|
788
|
-
};
|
|
789
|
-
var ShareFilesErrorCodes = /* @__PURE__ */ ((ShareFilesErrorCodes2) => {
|
|
790
|
-
ShareFilesErrorCodes2["UserRejected"] = "user_rejected";
|
|
791
|
-
ShareFilesErrorCodes2["GenericError"] = "generic_error";
|
|
792
|
-
ShareFilesErrorCodes2["InvalidFileName"] = "invalid_file_name";
|
|
793
|
-
return ShareFilesErrorCodes2;
|
|
794
|
-
})(ShareFilesErrorCodes || {});
|
|
795
|
-
var ShareFilesErrorMessage = {
|
|
796
|
-
["user_rejected" /* UserRejected */]: "User rejected the request.",
|
|
797
|
-
["generic_error" /* GenericError */]: "Something unexpected went wrong.",
|
|
798
|
-
["invalid_file_name" /* InvalidFileName */]: "Invalid file name. Make sure you include the extension"
|
|
799
|
-
};
|
|
800
|
-
|
|
801
|
-
// helpers/send-webview-event.ts
|
|
802
|
-
var sendWebviewEvent = (payload) => {
|
|
803
|
-
if (window.webkit) {
|
|
804
|
-
window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
|
|
805
|
-
} else if (window.Android) {
|
|
806
|
-
window.Android.postMessage?.(JSON.stringify(payload));
|
|
807
|
-
}
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
// types/responses.ts
|
|
811
|
-
var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
|
|
812
|
-
ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
|
|
813
|
-
ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
|
|
814
|
-
ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
|
|
815
|
-
ResponseEvent2["MiniAppSendTransaction"] = "miniapp-send-transaction";
|
|
816
|
-
ResponseEvent2["MiniAppSignMessage"] = "miniapp-sign-message";
|
|
817
|
-
ResponseEvent2["MiniAppSignTypedData"] = "miniapp-sign-typed-data";
|
|
818
|
-
ResponseEvent2["MiniAppShareContacts"] = "miniapp-share-contacts";
|
|
819
|
-
ResponseEvent2["MiniAppRequestPermission"] = "miniapp-request-permission";
|
|
820
|
-
ResponseEvent2["MiniAppGetPermissions"] = "miniapp-get-permissions";
|
|
821
|
-
ResponseEvent2["MiniAppSendHapticFeedback"] = "miniapp-send-haptic-feedback";
|
|
822
|
-
ResponseEvent2["MiniAppShare"] = "miniapp-share";
|
|
823
|
-
return ResponseEvent2;
|
|
824
|
-
})(ResponseEvent || {});
|
|
825
|
-
|
|
826
916
|
// minikit.ts
|
|
827
917
|
var sendMiniKitEvent = (payload) => {
|
|
828
918
|
sendWebviewEvent(payload);
|
|
@@ -831,7 +921,10 @@ var _MiniKit = class _MiniKit {
|
|
|
831
921
|
static sendInit() {
|
|
832
922
|
sendWebviewEvent({
|
|
833
923
|
command: "init",
|
|
834
|
-
payload: {
|
|
924
|
+
payload: {
|
|
925
|
+
version: this.MINIKIT_VERSION,
|
|
926
|
+
minorVersion: this.MINIKIT_MINOR_VERSION
|
|
927
|
+
}
|
|
835
928
|
});
|
|
836
929
|
}
|
|
837
930
|
static subscribe(event, handler) {
|
|
@@ -947,6 +1040,8 @@ var _MiniKit = class _MiniKit {
|
|
|
947
1040
|
_MiniKit.user.deviceOS = window.WorldApp.device_os;
|
|
948
1041
|
_MiniKit.user.worldAppVersion = window.WorldApp.world_app_version;
|
|
949
1042
|
_MiniKit.deviceProperties.safeAreaInsets = window.WorldApp.safe_area_insets;
|
|
1043
|
+
_MiniKit.deviceProperties.deviceOS = window.WorldApp.device_os;
|
|
1044
|
+
_MiniKit.deviceProperties.worldAppVersion = window.WorldApp.world_app_version;
|
|
950
1045
|
try {
|
|
951
1046
|
window.MiniKit = _MiniKit;
|
|
952
1047
|
this.sendInit();
|
|
@@ -962,6 +1057,7 @@ var _MiniKit = class _MiniKit {
|
|
|
962
1057
|
};
|
|
963
1058
|
}
|
|
964
1059
|
_MiniKit.isReady = true;
|
|
1060
|
+
setupMicrophone();
|
|
965
1061
|
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
966
1062
|
return {
|
|
967
1063
|
success: false,
|
|
@@ -982,6 +1078,7 @@ var _MiniKit = class _MiniKit {
|
|
|
982
1078
|
}
|
|
983
1079
|
};
|
|
984
1080
|
_MiniKit.MINIKIT_VERSION = 1;
|
|
1081
|
+
_MiniKit.MINIKIT_MINOR_VERSION = 96;
|
|
985
1082
|
_MiniKit.miniKitCommandVersion = {
|
|
986
1083
|
["verify" /* Verify */]: 1,
|
|
987
1084
|
["pay" /* Pay */]: 1,
|
|
@@ -1030,6 +1127,8 @@ _MiniKit.listeners = {
|
|
|
1030
1127
|
["miniapp-send-haptic-feedback" /* MiniAppSendHapticFeedback */]: () => {
|
|
1031
1128
|
},
|
|
1032
1129
|
["miniapp-share" /* MiniAppShare */]: () => {
|
|
1130
|
+
},
|
|
1131
|
+
["miniapp-microphone" /* MiniAppMicrophone */]: () => {
|
|
1033
1132
|
}
|
|
1034
1133
|
};
|
|
1035
1134
|
_MiniKit.appId = null;
|
|
@@ -1266,7 +1365,12 @@ _MiniKit.commands = {
|
|
|
1266
1365
|
);
|
|
1267
1366
|
return null;
|
|
1268
1367
|
}
|
|
1269
|
-
if (_MiniKit.
|
|
1368
|
+
if (_MiniKit.deviceProperties.deviceOS === "ios" && typeof navigator !== "undefined") {
|
|
1369
|
+
sendMiniKitEvent({
|
|
1370
|
+
command: "share" /* Share */,
|
|
1371
|
+
version: _MiniKit.miniKitCommandVersion["share" /* Share */],
|
|
1372
|
+
payload
|
|
1373
|
+
});
|
|
1270
1374
|
navigator.share(payload);
|
|
1271
1375
|
} else {
|
|
1272
1376
|
formatShareInput(payload).then((formattedResult) => {
|
|
@@ -1521,6 +1625,8 @@ var getIsUserVerified = async (walletAddress, rpcUrl) => {
|
|
|
1521
1625
|
Command,
|
|
1522
1626
|
GetPermissionsErrorCodes,
|
|
1523
1627
|
GetPermissionsErrorMessage,
|
|
1628
|
+
MicrophoneErrorCodes,
|
|
1629
|
+
MicrophoneErrorMessage,
|
|
1524
1630
|
MiniKit,
|
|
1525
1631
|
MiniKitInstallErrorCodes,
|
|
1526
1632
|
MiniKitInstallErrorMessage,
|