@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.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,320 @@ 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
|
+
const hasAudioTrack = stream.getAudioTracks().length > 0;
|
|
314
|
+
if (hasAudioTrack) {
|
|
315
|
+
sendWebviewEvent({
|
|
316
|
+
command: "microphone-stream-started",
|
|
317
|
+
version: 1,
|
|
318
|
+
payload: {
|
|
319
|
+
streamId: stream.id
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
live.add(stream);
|
|
323
|
+
stream.getAudioTracks().forEach((t) => {
|
|
324
|
+
t.addEventListener("ended", () => {
|
|
325
|
+
const allAudioTracksEnded = stream.getAudioTracks().every((track) => track.readyState === "ended");
|
|
326
|
+
if (allAudioTracksEnded) {
|
|
327
|
+
sendWebviewEvent({
|
|
328
|
+
command: "microphone-stream-ended",
|
|
329
|
+
version: 1,
|
|
330
|
+
payload: {
|
|
331
|
+
streamId: stream.id
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
live.delete(stream);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
return stream;
|
|
340
|
+
}
|
|
341
|
+
Object.defineProperty(navigator.mediaDevices, "getUserMedia", {
|
|
342
|
+
value: wrapped,
|
|
343
|
+
writable: false,
|
|
344
|
+
configurable: false,
|
|
345
|
+
enumerable: true
|
|
346
|
+
});
|
|
347
|
+
Object.freeze(navigator.mediaDevices);
|
|
348
|
+
const stopAllMiniAppMicrophoneStreams = () => {
|
|
349
|
+
live.forEach((s) => {
|
|
350
|
+
const audioTracks = s.getAudioTracks();
|
|
351
|
+
if (audioTracks.length > 0) {
|
|
352
|
+
audioTracks.forEach((t) => {
|
|
353
|
+
t.stop();
|
|
354
|
+
});
|
|
355
|
+
sendWebviewEvent({
|
|
356
|
+
command: "microphone-stream-ended",
|
|
357
|
+
version: 1,
|
|
358
|
+
payload: {
|
|
359
|
+
streamId: s.id
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
live.clear();
|
|
365
|
+
};
|
|
366
|
+
MiniKit.subscribe("miniapp-microphone" /* MiniAppMicrophone */, (payload) => {
|
|
367
|
+
if (payload.status === "error" && (payload.error_code === "mini_app_permission_not_enabled" /* MiniAppPermissionNotEnabled */ || payload.error_code === "world_app_permission_not_enabled" /* WorldAppPermissionNotEnabled */)) {
|
|
368
|
+
console.log("stopping all microphone streams", payload);
|
|
369
|
+
stopAllMiniAppMicrophoneStreams();
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
window.__stopAllMiniAppMicrophoneStreams = stopAllMiniAppMicrophoneStreams;
|
|
373
|
+
microphoneSetupDone = true;
|
|
374
|
+
};
|
|
375
|
+
|
|
68
376
|
// types/payment.ts
|
|
69
|
-
var Tokens = /* @__PURE__ */ ((
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return
|
|
377
|
+
var Tokens = /* @__PURE__ */ ((Tokens2) => {
|
|
378
|
+
Tokens2["USDC"] = "USDCE";
|
|
379
|
+
Tokens2["WLD"] = "WLD";
|
|
380
|
+
return Tokens2;
|
|
73
381
|
})(Tokens || {});
|
|
74
382
|
var TokenDecimals = {
|
|
75
|
-
["USDCE" /*
|
|
383
|
+
["USDCE" /* USDC */]: 6,
|
|
76
384
|
["WLD" /* WLD */]: 18
|
|
77
385
|
};
|
|
78
386
|
var Network = /* @__PURE__ */ ((Network2) => {
|
|
@@ -96,9 +404,9 @@ var tokenToDecimals = (amount, token) => {
|
|
|
96
404
|
};
|
|
97
405
|
var validatePaymentPayload = (payload) => {
|
|
98
406
|
if (payload.tokens.some(
|
|
99
|
-
(token) => token.symbol == "USDCE" && parseFloat(token.token_amount) < 0.1
|
|
407
|
+
(token) => token.symbol == "USDCE" /* USDC */ && parseFloat(token.token_amount) < 0.1
|
|
100
408
|
)) {
|
|
101
|
-
console.error("
|
|
409
|
+
console.error("USDC amount should be greater than $0.1");
|
|
102
410
|
return false;
|
|
103
411
|
}
|
|
104
412
|
if (payload.reference.length > 36) {
|
|
@@ -383,8 +691,8 @@ var generateSiweMessage = (siweMessageData) => {
|
|
|
383
691
|
return siweMessage;
|
|
384
692
|
};
|
|
385
693
|
var verifySiweMessage = (payload, nonce, statement, requestId, userProvider) => {
|
|
386
|
-
if (payload.version ===
|
|
387
|
-
return
|
|
694
|
+
if (payload.version === 1) {
|
|
695
|
+
return verifySiweMessageV1(
|
|
388
696
|
payload,
|
|
389
697
|
nonce,
|
|
390
698
|
statement,
|
|
@@ -392,7 +700,7 @@ var verifySiweMessage = (payload, nonce, statement, requestId, userProvider) =>
|
|
|
392
700
|
userProvider
|
|
393
701
|
);
|
|
394
702
|
} else {
|
|
395
|
-
return
|
|
703
|
+
return verifySiweMessageV2(
|
|
396
704
|
payload,
|
|
397
705
|
nonce,
|
|
398
706
|
statement,
|
|
@@ -610,219 +918,10 @@ var Command = /* @__PURE__ */ ((Command2) => {
|
|
|
610
918
|
var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
611
919
|
Permission2["Notifications"] = "notifications";
|
|
612
920
|
Permission2["Contacts"] = "contacts";
|
|
921
|
+
Permission2["Microphone"] = "microphone";
|
|
613
922
|
return Permission2;
|
|
614
923
|
})(Permission || {});
|
|
615
924
|
|
|
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
925
|
// minikit.ts
|
|
827
926
|
var sendMiniKitEvent = (payload) => {
|
|
828
927
|
sendWebviewEvent(payload);
|
|
@@ -831,7 +930,10 @@ var _MiniKit = class _MiniKit {
|
|
|
831
930
|
static sendInit() {
|
|
832
931
|
sendWebviewEvent({
|
|
833
932
|
command: "init",
|
|
834
|
-
payload: {
|
|
933
|
+
payload: {
|
|
934
|
+
version: this.MINIKIT_VERSION,
|
|
935
|
+
minorVersion: this.MINIKIT_MINOR_VERSION
|
|
936
|
+
}
|
|
835
937
|
});
|
|
836
938
|
}
|
|
837
939
|
static subscribe(event, handler) {
|
|
@@ -947,6 +1049,8 @@ var _MiniKit = class _MiniKit {
|
|
|
947
1049
|
_MiniKit.user.deviceOS = window.WorldApp.device_os;
|
|
948
1050
|
_MiniKit.user.worldAppVersion = window.WorldApp.world_app_version;
|
|
949
1051
|
_MiniKit.deviceProperties.safeAreaInsets = window.WorldApp.safe_area_insets;
|
|
1052
|
+
_MiniKit.deviceProperties.deviceOS = window.WorldApp.device_os;
|
|
1053
|
+
_MiniKit.deviceProperties.worldAppVersion = window.WorldApp.world_app_version;
|
|
950
1054
|
try {
|
|
951
1055
|
window.MiniKit = _MiniKit;
|
|
952
1056
|
this.sendInit();
|
|
@@ -962,6 +1066,7 @@ var _MiniKit = class _MiniKit {
|
|
|
962
1066
|
};
|
|
963
1067
|
}
|
|
964
1068
|
_MiniKit.isReady = true;
|
|
1069
|
+
setupMicrophone();
|
|
965
1070
|
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
966
1071
|
return {
|
|
967
1072
|
success: false,
|
|
@@ -982,6 +1087,7 @@ var _MiniKit = class _MiniKit {
|
|
|
982
1087
|
}
|
|
983
1088
|
};
|
|
984
1089
|
_MiniKit.MINIKIT_VERSION = 1;
|
|
1090
|
+
_MiniKit.MINIKIT_MINOR_VERSION = 96;
|
|
985
1091
|
_MiniKit.miniKitCommandVersion = {
|
|
986
1092
|
["verify" /* Verify */]: 1,
|
|
987
1093
|
["pay" /* Pay */]: 1,
|
|
@@ -1030,12 +1136,14 @@ _MiniKit.listeners = {
|
|
|
1030
1136
|
["miniapp-send-haptic-feedback" /* MiniAppSendHapticFeedback */]: () => {
|
|
1031
1137
|
},
|
|
1032
1138
|
["miniapp-share" /* MiniAppShare */]: () => {
|
|
1139
|
+
},
|
|
1140
|
+
["miniapp-microphone" /* MiniAppMicrophone */]: () => {
|
|
1033
1141
|
}
|
|
1034
1142
|
};
|
|
1035
1143
|
_MiniKit.appId = null;
|
|
1036
1144
|
_MiniKit.user = {};
|
|
1037
|
-
_MiniKit.isReady = false;
|
|
1038
1145
|
_MiniKit.deviceProperties = {};
|
|
1146
|
+
_MiniKit.isReady = false;
|
|
1039
1147
|
_MiniKit.getUserByAddress = async (address) => {
|
|
1040
1148
|
const userProfile = await getUserProfile(
|
|
1041
1149
|
address ?? _MiniKit.user.walletAddress
|
|
@@ -1266,7 +1374,12 @@ _MiniKit.commands = {
|
|
|
1266
1374
|
);
|
|
1267
1375
|
return null;
|
|
1268
1376
|
}
|
|
1269
|
-
if (_MiniKit.
|
|
1377
|
+
if (_MiniKit.deviceProperties.deviceOS === "ios" && typeof navigator !== "undefined") {
|
|
1378
|
+
sendMiniKitEvent({
|
|
1379
|
+
command: "share" /* Share */,
|
|
1380
|
+
version: _MiniKit.miniKitCommandVersion["share" /* Share */],
|
|
1381
|
+
payload
|
|
1382
|
+
});
|
|
1270
1383
|
navigator.share(payload);
|
|
1271
1384
|
} else {
|
|
1272
1385
|
formatShareInput(payload).then((formattedResult) => {
|
|
@@ -1521,6 +1634,8 @@ var getIsUserVerified = async (walletAddress, rpcUrl) => {
|
|
|
1521
1634
|
Command,
|
|
1522
1635
|
GetPermissionsErrorCodes,
|
|
1523
1636
|
GetPermissionsErrorMessage,
|
|
1637
|
+
MicrophoneErrorCodes,
|
|
1638
|
+
MicrophoneErrorMessage,
|
|
1524
1639
|
MiniKit,
|
|
1525
1640
|
MiniKitInstallErrorCodes,
|
|
1526
1641
|
MiniKitInstallErrorMessage,
|