@worldcoin/minikit-js 1.9.11 → 1.11.0
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-YDNDO45D.js → chunk-62NZ34E4.js} +113 -4
- package/build/index.cjs +118 -4
- package/build/index.d.cts +49 -3
- package/build/index.d.ts +49 -3
- package/build/index.js +11 -1
- package/build/minikit-provider.cjs +90 -4
- package/build/minikit-provider.js +1 -1
- package/package.json +1 -1
|
@@ -21,6 +21,8 @@ var Command = /* @__PURE__ */ ((Command2) => {
|
|
|
21
21
|
Command2["SendHapticFeedback"] = "send-haptic-feedback";
|
|
22
22
|
Command2["Share"] = "share";
|
|
23
23
|
Command2["Chat"] = "chat";
|
|
24
|
+
Command2["Attestation"] = "attestation";
|
|
25
|
+
Command2["CloseMiniApp"] = "close-miniapp";
|
|
24
26
|
return Command2;
|
|
25
27
|
})(Command || {});
|
|
26
28
|
var ResponseEvent = /* @__PURE__ */ ((ResponseEvent3) => {
|
|
@@ -37,6 +39,7 @@ var ResponseEvent = /* @__PURE__ */ ((ResponseEvent3) => {
|
|
|
37
39
|
ResponseEvent3["MiniAppShare"] = "miniapp-share";
|
|
38
40
|
ResponseEvent3["MiniAppMicrophone"] = "miniapp-microphone";
|
|
39
41
|
ResponseEvent3["MiniAppChat"] = "miniapp-chat";
|
|
42
|
+
ResponseEvent3["MiniAppAttestation"] = "miniapp-attestation";
|
|
40
43
|
return ResponseEvent3;
|
|
41
44
|
})(ResponseEvent || {});
|
|
42
45
|
var COMMAND_VERSIONS = {
|
|
@@ -51,7 +54,9 @@ var COMMAND_VERSIONS = {
|
|
|
51
54
|
["get-permissions" /* GetPermissions */]: 1,
|
|
52
55
|
["send-haptic-feedback" /* SendHapticFeedback */]: 1,
|
|
53
56
|
["share" /* Share */]: 1,
|
|
54
|
-
["chat" /* Chat */]: 1
|
|
57
|
+
["chat" /* Chat */]: 1,
|
|
58
|
+
["attestation" /* Attestation */]: 1,
|
|
59
|
+
["close-miniapp" /* CloseMiniApp */]: 1
|
|
55
60
|
};
|
|
56
61
|
var commandAvailability = {
|
|
57
62
|
["verify" /* Verify */]: false,
|
|
@@ -65,7 +70,9 @@ var commandAvailability = {
|
|
|
65
70
|
["get-permissions" /* GetPermissions */]: false,
|
|
66
71
|
["send-haptic-feedback" /* SendHapticFeedback */]: false,
|
|
67
72
|
["share" /* Share */]: false,
|
|
68
|
-
["chat" /* Chat */]: false
|
|
73
|
+
["chat" /* Chat */]: false,
|
|
74
|
+
["attestation" /* Attestation */]: false,
|
|
75
|
+
["close-miniapp" /* CloseMiniApp */]: false
|
|
69
76
|
};
|
|
70
77
|
function isCommandAvailable(command) {
|
|
71
78
|
return commandAvailability[command];
|
|
@@ -106,6 +113,74 @@ function sendMiniKitEvent(payload) {
|
|
|
106
113
|
sendWebviewEvent(payload);
|
|
107
114
|
}
|
|
108
115
|
|
|
116
|
+
// commands/attestation.ts
|
|
117
|
+
var AttestationErrorCodes = /* @__PURE__ */ ((AttestationErrorCodes2) => {
|
|
118
|
+
AttestationErrorCodes2["Unauthorized"] = "unauthorized";
|
|
119
|
+
AttestationErrorCodes2["AttestationFailed"] = "attestation_failed";
|
|
120
|
+
AttestationErrorCodes2["IntegrityFailed"] = "integrity_failed";
|
|
121
|
+
AttestationErrorCodes2["InvalidInput"] = "invalid_input";
|
|
122
|
+
AttestationErrorCodes2["UnsupportedVersion"] = "unsupported_version";
|
|
123
|
+
return AttestationErrorCodes2;
|
|
124
|
+
})(AttestationErrorCodes || {});
|
|
125
|
+
var AttestationErrorMessage = {
|
|
126
|
+
["unauthorized" /* Unauthorized */]: "App is not whitelisted for attestation.",
|
|
127
|
+
["attestation_failed" /* AttestationFailed */]: "Failed to obtain token from attestation gateway.",
|
|
128
|
+
["integrity_failed" /* IntegrityFailed */]: "Platform integrity check failed.",
|
|
129
|
+
["invalid_input" /* InvalidInput */]: "Invalid request payload.",
|
|
130
|
+
["unsupported_version" /* UnsupportedVersion */]: "Command version is not supported."
|
|
131
|
+
};
|
|
132
|
+
function createAttestationCommand(_ctx) {
|
|
133
|
+
return (input) => {
|
|
134
|
+
if (typeof window === "undefined" || !isCommandAvailable("attestation" /* Attestation */)) {
|
|
135
|
+
console.error(
|
|
136
|
+
"'attestation' command is unavailable. Check MiniKit.install() or update the app version"
|
|
137
|
+
);
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
if (!input.requestHash || input.requestHash.length === 0) {
|
|
141
|
+
console.error("'attestation' command requires a non-empty requestHash");
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const payload = {
|
|
145
|
+
request_hash: input.requestHash
|
|
146
|
+
};
|
|
147
|
+
sendMiniKitEvent({
|
|
148
|
+
command: "attestation" /* Attestation */,
|
|
149
|
+
version: COMMAND_VERSIONS["attestation" /* Attestation */],
|
|
150
|
+
payload
|
|
151
|
+
});
|
|
152
|
+
return payload;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function createAttestationAsyncCommand(ctx, syncCommand) {
|
|
156
|
+
return async (input) => {
|
|
157
|
+
return new Promise((resolve, reject) => {
|
|
158
|
+
try {
|
|
159
|
+
const handleResponse = (response) => {
|
|
160
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
161
|
+
resolve({ commandPayload, finalPayload: response });
|
|
162
|
+
};
|
|
163
|
+
ctx.events.subscribe(
|
|
164
|
+
"miniapp-attestation" /* MiniAppAttestation */,
|
|
165
|
+
handleResponse
|
|
166
|
+
);
|
|
167
|
+
const commandPayload = syncCommand(input);
|
|
168
|
+
if (!commandPayload) {
|
|
169
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
170
|
+
reject(
|
|
171
|
+
new Error(
|
|
172
|
+
"'attestation' command failed: command unavailable or invalid input"
|
|
173
|
+
)
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
} catch (error) {
|
|
177
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
178
|
+
reject(error);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
109
184
|
// commands/chat.ts
|
|
110
185
|
var ChatErrorCodes = /* @__PURE__ */ ((ChatErrorCodes2) => {
|
|
111
186
|
ChatErrorCodes2["UserRejected"] = "user_rejected";
|
|
@@ -156,6 +231,24 @@ function createChatAsyncCommand(ctx, syncCommand) {
|
|
|
156
231
|
};
|
|
157
232
|
}
|
|
158
233
|
|
|
234
|
+
// commands/close-miniapp.ts
|
|
235
|
+
function createCloseMiniAppCommand(_ctx) {
|
|
236
|
+
return () => {
|
|
237
|
+
if (typeof window === "undefined" || !isCommandAvailable("close-miniapp" /* CloseMiniApp */)) {
|
|
238
|
+
console.error(
|
|
239
|
+
"'closeMiniApp' command is unavailable. Check MiniKit.install() or update the app version"
|
|
240
|
+
);
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
sendMiniKitEvent({
|
|
244
|
+
command: "close-miniapp" /* CloseMiniApp */,
|
|
245
|
+
version: COMMAND_VERSIONS["close-miniapp" /* CloseMiniApp */],
|
|
246
|
+
payload: {}
|
|
247
|
+
});
|
|
248
|
+
return true;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
159
252
|
// commands/get-permissions.ts
|
|
160
253
|
var GetPermissionsErrorCodes = /* @__PURE__ */ ((GetPermissionsErrorCodes2) => {
|
|
161
254
|
GetPermissionsErrorCodes2["GenericError"] = "generic_error";
|
|
@@ -806,6 +899,9 @@ var SignTypedDataErrorMessage = {
|
|
|
806
899
|
};
|
|
807
900
|
function createSignTypedDataCommand(_ctx) {
|
|
808
901
|
return (payload) => {
|
|
902
|
+
console.warn(
|
|
903
|
+
"signTypedData is deprecated. Use signMessage or sendTransaction instead."
|
|
904
|
+
);
|
|
809
905
|
if (typeof window === "undefined" || !isCommandAvailable("sign-typed-data" /* SignTypedData */)) {
|
|
810
906
|
console.error(
|
|
811
907
|
"'signTypedData' command is unavailable. Check MiniKit.install() or update the app version"
|
|
@@ -1302,13 +1398,16 @@ function createCommands(ctx) {
|
|
|
1302
1398
|
walletAuth: createWalletAuthCommand(ctx),
|
|
1303
1399
|
sendTransaction: createSendTransactionCommand(ctx),
|
|
1304
1400
|
signMessage: createSignMessageCommand(ctx),
|
|
1401
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
1305
1402
|
signTypedData: createSignTypedDataCommand(ctx),
|
|
1306
1403
|
shareContacts: createShareContactsCommand(ctx),
|
|
1307
1404
|
requestPermission: createRequestPermissionCommand(ctx),
|
|
1308
1405
|
getPermissions: createGetPermissionsCommand(ctx),
|
|
1309
1406
|
sendHapticFeedback: createSendHapticFeedbackCommand(ctx),
|
|
1310
1407
|
share: createShareCommand(ctx),
|
|
1311
|
-
chat: createChatCommand(ctx)
|
|
1408
|
+
chat: createChatCommand(ctx),
|
|
1409
|
+
attestation: createAttestationCommand(ctx),
|
|
1410
|
+
closeMiniApp: createCloseMiniAppCommand(ctx)
|
|
1312
1411
|
};
|
|
1313
1412
|
}
|
|
1314
1413
|
function createAsyncCommands(ctx, commands) {
|
|
@@ -1321,6 +1420,7 @@ function createAsyncCommands(ctx, commands) {
|
|
|
1321
1420
|
commands.sendTransaction
|
|
1322
1421
|
),
|
|
1323
1422
|
signMessage: createSignMessageAsyncCommand(ctx, commands.signMessage),
|
|
1423
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
1324
1424
|
signTypedData: createSignTypedDataAsyncCommand(ctx, commands.signTypedData),
|
|
1325
1425
|
shareContacts: createShareContactsAsyncCommand(ctx, commands.shareContacts),
|
|
1326
1426
|
requestPermission: createRequestPermissionAsyncCommand(
|
|
@@ -1336,7 +1436,8 @@ function createAsyncCommands(ctx, commands) {
|
|
|
1336
1436
|
commands.sendHapticFeedback
|
|
1337
1437
|
),
|
|
1338
1438
|
share: createShareAsyncCommand(ctx, commands.share),
|
|
1339
|
-
chat: createChatAsyncCommand(ctx, commands.chat)
|
|
1439
|
+
chat: createChatAsyncCommand(ctx, commands.chat),
|
|
1440
|
+
attestation: createAttestationAsyncCommand(ctx, commands.attestation)
|
|
1340
1441
|
};
|
|
1341
1442
|
}
|
|
1342
1443
|
|
|
@@ -1485,6 +1586,8 @@ var EventManager = class {
|
|
|
1485
1586
|
["miniapp-microphone" /* MiniAppMicrophone */]: () => {
|
|
1486
1587
|
},
|
|
1487
1588
|
["miniapp-chat" /* MiniAppChat */]: () => {
|
|
1589
|
+
},
|
|
1590
|
+
["miniapp-attestation" /* MiniAppAttestation */]: () => {
|
|
1488
1591
|
}
|
|
1489
1592
|
};
|
|
1490
1593
|
this.verifyActionProcessingOptionsQueue = [];
|
|
@@ -1597,6 +1700,7 @@ var MiniKitState = class {
|
|
|
1597
1700
|
initFromWorldApp(worldApp) {
|
|
1598
1701
|
if (!worldApp) return;
|
|
1599
1702
|
this.user.optedIntoOptionalAnalytics = worldApp.is_optional_analytics;
|
|
1703
|
+
this.user.preferredCurrency = worldApp.preferred_currency;
|
|
1600
1704
|
this.user.deviceOS = worldApp.device_os;
|
|
1601
1705
|
this.user.worldAppVersion = worldApp.world_app_version;
|
|
1602
1706
|
this.deviceProperties.safeAreaInsets = worldApp.safe_area_insets;
|
|
@@ -1919,10 +2023,15 @@ export {
|
|
|
1919
2023
|
setCommandAvailable,
|
|
1920
2024
|
validateCommands,
|
|
1921
2025
|
sendMiniKitEvent,
|
|
2026
|
+
AttestationErrorCodes,
|
|
2027
|
+
AttestationErrorMessage,
|
|
2028
|
+
createAttestationCommand,
|
|
2029
|
+
createAttestationAsyncCommand,
|
|
1922
2030
|
ChatErrorCodes,
|
|
1923
2031
|
ChatErrorMessage,
|
|
1924
2032
|
createChatCommand,
|
|
1925
2033
|
createChatAsyncCommand,
|
|
2034
|
+
createCloseMiniAppCommand,
|
|
1926
2035
|
GetPermissionsErrorCodes,
|
|
1927
2036
|
GetPermissionsErrorMessage,
|
|
1928
2037
|
Permission,
|
package/build/index.cjs
CHANGED
|
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// index.ts
|
|
21
21
|
var core_exports = {};
|
|
22
22
|
__export(core_exports, {
|
|
23
|
+
AttestationErrorCodes: () => AttestationErrorCodes,
|
|
24
|
+
AttestationErrorMessage: () => AttestationErrorMessage,
|
|
23
25
|
COMMAND_VERSIONS: () => COMMAND_VERSIONS,
|
|
24
26
|
ChatErrorCodes: () => ChatErrorCodes,
|
|
25
27
|
ChatErrorMessage: () => ChatErrorMessage,
|
|
@@ -56,8 +58,11 @@ __export(core_exports, {
|
|
|
56
58
|
WalletAuthErrorCodes: () => WalletAuthErrorCodes,
|
|
57
59
|
WalletAuthErrorMessage: () => WalletAuthErrorMessage,
|
|
58
60
|
createAsyncCommands: () => createAsyncCommands,
|
|
61
|
+
createAttestationAsyncCommand: () => createAttestationAsyncCommand,
|
|
62
|
+
createAttestationCommand: () => createAttestationCommand,
|
|
59
63
|
createChatAsyncCommand: () => createChatAsyncCommand,
|
|
60
64
|
createChatCommand: () => createChatCommand,
|
|
65
|
+
createCloseMiniAppCommand: () => createCloseMiniAppCommand,
|
|
61
66
|
createCommands: () => createCommands,
|
|
62
67
|
createGetPermissionsAsyncCommand: () => createGetPermissionsAsyncCommand,
|
|
63
68
|
createGetPermissionsCommand: () => createGetPermissionsCommand,
|
|
@@ -117,6 +122,8 @@ var Command = /* @__PURE__ */ ((Command2) => {
|
|
|
117
122
|
Command2["SendHapticFeedback"] = "send-haptic-feedback";
|
|
118
123
|
Command2["Share"] = "share";
|
|
119
124
|
Command2["Chat"] = "chat";
|
|
125
|
+
Command2["Attestation"] = "attestation";
|
|
126
|
+
Command2["CloseMiniApp"] = "close-miniapp";
|
|
120
127
|
return Command2;
|
|
121
128
|
})(Command || {});
|
|
122
129
|
var ResponseEvent = /* @__PURE__ */ ((ResponseEvent3) => {
|
|
@@ -133,6 +140,7 @@ var ResponseEvent = /* @__PURE__ */ ((ResponseEvent3) => {
|
|
|
133
140
|
ResponseEvent3["MiniAppShare"] = "miniapp-share";
|
|
134
141
|
ResponseEvent3["MiniAppMicrophone"] = "miniapp-microphone";
|
|
135
142
|
ResponseEvent3["MiniAppChat"] = "miniapp-chat";
|
|
143
|
+
ResponseEvent3["MiniAppAttestation"] = "miniapp-attestation";
|
|
136
144
|
return ResponseEvent3;
|
|
137
145
|
})(ResponseEvent || {});
|
|
138
146
|
var COMMAND_VERSIONS = {
|
|
@@ -147,7 +155,9 @@ var COMMAND_VERSIONS = {
|
|
|
147
155
|
["get-permissions" /* GetPermissions */]: 1,
|
|
148
156
|
["send-haptic-feedback" /* SendHapticFeedback */]: 1,
|
|
149
157
|
["share" /* Share */]: 1,
|
|
150
|
-
["chat" /* Chat */]: 1
|
|
158
|
+
["chat" /* Chat */]: 1,
|
|
159
|
+
["attestation" /* Attestation */]: 1,
|
|
160
|
+
["close-miniapp" /* CloseMiniApp */]: 1
|
|
151
161
|
};
|
|
152
162
|
var commandAvailability = {
|
|
153
163
|
["verify" /* Verify */]: false,
|
|
@@ -161,7 +171,9 @@ var commandAvailability = {
|
|
|
161
171
|
["get-permissions" /* GetPermissions */]: false,
|
|
162
172
|
["send-haptic-feedback" /* SendHapticFeedback */]: false,
|
|
163
173
|
["share" /* Share */]: false,
|
|
164
|
-
["chat" /* Chat */]: false
|
|
174
|
+
["chat" /* Chat */]: false,
|
|
175
|
+
["attestation" /* Attestation */]: false,
|
|
176
|
+
["close-miniapp" /* CloseMiniApp */]: false
|
|
165
177
|
};
|
|
166
178
|
function isCommandAvailable(command) {
|
|
167
179
|
return commandAvailability[command];
|
|
@@ -202,6 +214,74 @@ function sendMiniKitEvent(payload) {
|
|
|
202
214
|
sendWebviewEvent(payload);
|
|
203
215
|
}
|
|
204
216
|
|
|
217
|
+
// commands/attestation.ts
|
|
218
|
+
var AttestationErrorCodes = /* @__PURE__ */ ((AttestationErrorCodes2) => {
|
|
219
|
+
AttestationErrorCodes2["Unauthorized"] = "unauthorized";
|
|
220
|
+
AttestationErrorCodes2["AttestationFailed"] = "attestation_failed";
|
|
221
|
+
AttestationErrorCodes2["IntegrityFailed"] = "integrity_failed";
|
|
222
|
+
AttestationErrorCodes2["InvalidInput"] = "invalid_input";
|
|
223
|
+
AttestationErrorCodes2["UnsupportedVersion"] = "unsupported_version";
|
|
224
|
+
return AttestationErrorCodes2;
|
|
225
|
+
})(AttestationErrorCodes || {});
|
|
226
|
+
var AttestationErrorMessage = {
|
|
227
|
+
["unauthorized" /* Unauthorized */]: "App is not whitelisted for attestation.",
|
|
228
|
+
["attestation_failed" /* AttestationFailed */]: "Failed to obtain token from attestation gateway.",
|
|
229
|
+
["integrity_failed" /* IntegrityFailed */]: "Platform integrity check failed.",
|
|
230
|
+
["invalid_input" /* InvalidInput */]: "Invalid request payload.",
|
|
231
|
+
["unsupported_version" /* UnsupportedVersion */]: "Command version is not supported."
|
|
232
|
+
};
|
|
233
|
+
function createAttestationCommand(_ctx) {
|
|
234
|
+
return (input) => {
|
|
235
|
+
if (typeof window === "undefined" || !isCommandAvailable("attestation" /* Attestation */)) {
|
|
236
|
+
console.error(
|
|
237
|
+
"'attestation' command is unavailable. Check MiniKit.install() or update the app version"
|
|
238
|
+
);
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
if (!input.requestHash || input.requestHash.length === 0) {
|
|
242
|
+
console.error("'attestation' command requires a non-empty requestHash");
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
const payload = {
|
|
246
|
+
request_hash: input.requestHash
|
|
247
|
+
};
|
|
248
|
+
sendMiniKitEvent({
|
|
249
|
+
command: "attestation" /* Attestation */,
|
|
250
|
+
version: COMMAND_VERSIONS["attestation" /* Attestation */],
|
|
251
|
+
payload
|
|
252
|
+
});
|
|
253
|
+
return payload;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function createAttestationAsyncCommand(ctx, syncCommand) {
|
|
257
|
+
return async (input) => {
|
|
258
|
+
return new Promise((resolve, reject) => {
|
|
259
|
+
try {
|
|
260
|
+
const handleResponse = (response) => {
|
|
261
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
262
|
+
resolve({ commandPayload, finalPayload: response });
|
|
263
|
+
};
|
|
264
|
+
ctx.events.subscribe(
|
|
265
|
+
"miniapp-attestation" /* MiniAppAttestation */,
|
|
266
|
+
handleResponse
|
|
267
|
+
);
|
|
268
|
+
const commandPayload = syncCommand(input);
|
|
269
|
+
if (!commandPayload) {
|
|
270
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
271
|
+
reject(
|
|
272
|
+
new Error(
|
|
273
|
+
"'attestation' command failed: command unavailable or invalid input"
|
|
274
|
+
)
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
} catch (error) {
|
|
278
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
279
|
+
reject(error);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
205
285
|
// commands/chat.ts
|
|
206
286
|
var ChatErrorCodes = /* @__PURE__ */ ((ChatErrorCodes2) => {
|
|
207
287
|
ChatErrorCodes2["UserRejected"] = "user_rejected";
|
|
@@ -252,6 +332,24 @@ function createChatAsyncCommand(ctx, syncCommand) {
|
|
|
252
332
|
};
|
|
253
333
|
}
|
|
254
334
|
|
|
335
|
+
// commands/close-miniapp.ts
|
|
336
|
+
function createCloseMiniAppCommand(_ctx) {
|
|
337
|
+
return () => {
|
|
338
|
+
if (typeof window === "undefined" || !isCommandAvailable("close-miniapp" /* CloseMiniApp */)) {
|
|
339
|
+
console.error(
|
|
340
|
+
"'closeMiniApp' command is unavailable. Check MiniKit.install() or update the app version"
|
|
341
|
+
);
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
sendMiniKitEvent({
|
|
345
|
+
command: "close-miniapp" /* CloseMiniApp */,
|
|
346
|
+
version: COMMAND_VERSIONS["close-miniapp" /* CloseMiniApp */],
|
|
347
|
+
payload: {}
|
|
348
|
+
});
|
|
349
|
+
return true;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
255
353
|
// commands/get-permissions.ts
|
|
256
354
|
var GetPermissionsErrorCodes = /* @__PURE__ */ ((GetPermissionsErrorCodes2) => {
|
|
257
355
|
GetPermissionsErrorCodes2["GenericError"] = "generic_error";
|
|
@@ -902,6 +1000,9 @@ var SignTypedDataErrorMessage = {
|
|
|
902
1000
|
};
|
|
903
1001
|
function createSignTypedDataCommand(_ctx) {
|
|
904
1002
|
return (payload) => {
|
|
1003
|
+
console.warn(
|
|
1004
|
+
"signTypedData is deprecated. Use signMessage or sendTransaction instead."
|
|
1005
|
+
);
|
|
905
1006
|
if (typeof window === "undefined" || !isCommandAvailable("sign-typed-data" /* SignTypedData */)) {
|
|
906
1007
|
console.error(
|
|
907
1008
|
"'signTypedData' command is unavailable. Check MiniKit.install() or update the app version"
|
|
@@ -1392,13 +1493,16 @@ function createCommands(ctx) {
|
|
|
1392
1493
|
walletAuth: createWalletAuthCommand(ctx),
|
|
1393
1494
|
sendTransaction: createSendTransactionCommand(ctx),
|
|
1394
1495
|
signMessage: createSignMessageCommand(ctx),
|
|
1496
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
1395
1497
|
signTypedData: createSignTypedDataCommand(ctx),
|
|
1396
1498
|
shareContacts: createShareContactsCommand(ctx),
|
|
1397
1499
|
requestPermission: createRequestPermissionCommand(ctx),
|
|
1398
1500
|
getPermissions: createGetPermissionsCommand(ctx),
|
|
1399
1501
|
sendHapticFeedback: createSendHapticFeedbackCommand(ctx),
|
|
1400
1502
|
share: createShareCommand(ctx),
|
|
1401
|
-
chat: createChatCommand(ctx)
|
|
1503
|
+
chat: createChatCommand(ctx),
|
|
1504
|
+
attestation: createAttestationCommand(ctx),
|
|
1505
|
+
closeMiniApp: createCloseMiniAppCommand(ctx)
|
|
1402
1506
|
};
|
|
1403
1507
|
}
|
|
1404
1508
|
function createAsyncCommands(ctx, commands) {
|
|
@@ -1411,6 +1515,7 @@ function createAsyncCommands(ctx, commands) {
|
|
|
1411
1515
|
commands.sendTransaction
|
|
1412
1516
|
),
|
|
1413
1517
|
signMessage: createSignMessageAsyncCommand(ctx, commands.signMessage),
|
|
1518
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
1414
1519
|
signTypedData: createSignTypedDataAsyncCommand(ctx, commands.signTypedData),
|
|
1415
1520
|
shareContacts: createShareContactsAsyncCommand(ctx, commands.shareContacts),
|
|
1416
1521
|
requestPermission: createRequestPermissionAsyncCommand(
|
|
@@ -1426,7 +1531,8 @@ function createAsyncCommands(ctx, commands) {
|
|
|
1426
1531
|
commands.sendHapticFeedback
|
|
1427
1532
|
),
|
|
1428
1533
|
share: createShareAsyncCommand(ctx, commands.share),
|
|
1429
|
-
chat: createChatAsyncCommand(ctx, commands.chat)
|
|
1534
|
+
chat: createChatAsyncCommand(ctx, commands.chat),
|
|
1535
|
+
attestation: createAttestationAsyncCommand(ctx, commands.attestation)
|
|
1430
1536
|
};
|
|
1431
1537
|
}
|
|
1432
1538
|
|
|
@@ -1512,6 +1618,8 @@ var EventManager = class {
|
|
|
1512
1618
|
["miniapp-microphone" /* MiniAppMicrophone */]: () => {
|
|
1513
1619
|
},
|
|
1514
1620
|
["miniapp-chat" /* MiniAppChat */]: () => {
|
|
1621
|
+
},
|
|
1622
|
+
["miniapp-attestation" /* MiniAppAttestation */]: () => {
|
|
1515
1623
|
}
|
|
1516
1624
|
};
|
|
1517
1625
|
this.verifyActionProcessingOptionsQueue = [];
|
|
@@ -1650,6 +1758,7 @@ var MiniKitState = class {
|
|
|
1650
1758
|
initFromWorldApp(worldApp) {
|
|
1651
1759
|
if (!worldApp) return;
|
|
1652
1760
|
this.user.optedIntoOptionalAnalytics = worldApp.is_optional_analytics;
|
|
1761
|
+
this.user.preferredCurrency = worldApp.preferred_currency;
|
|
1653
1762
|
this.user.deviceOS = worldApp.device_os;
|
|
1654
1763
|
this.user.worldAppVersion = worldApp.world_app_version;
|
|
1655
1764
|
this.deviceProperties.safeAreaInsets = worldApp.safe_area_insets;
|
|
@@ -2053,6 +2162,8 @@ var getIsUserVerified = async (walletAddress, rpcUrl) => {
|
|
|
2053
2162
|
};
|
|
2054
2163
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2055
2164
|
0 && (module.exports = {
|
|
2165
|
+
AttestationErrorCodes,
|
|
2166
|
+
AttestationErrorMessage,
|
|
2056
2167
|
COMMAND_VERSIONS,
|
|
2057
2168
|
ChatErrorCodes,
|
|
2058
2169
|
ChatErrorMessage,
|
|
@@ -2089,8 +2200,11 @@ var getIsUserVerified = async (walletAddress, rpcUrl) => {
|
|
|
2089
2200
|
WalletAuthErrorCodes,
|
|
2090
2201
|
WalletAuthErrorMessage,
|
|
2091
2202
|
createAsyncCommands,
|
|
2203
|
+
createAttestationAsyncCommand,
|
|
2204
|
+
createAttestationCommand,
|
|
2092
2205
|
createChatAsyncCommand,
|
|
2093
2206
|
createChatCommand,
|
|
2207
|
+
createCloseMiniAppCommand,
|
|
2094
2208
|
createCommands,
|
|
2095
2209
|
createGetPermissionsAsyncCommand,
|
|
2096
2210
|
createGetPermissionsCommand,
|
package/build/index.d.cts
CHANGED
|
@@ -13,6 +13,7 @@ type User = {
|
|
|
13
13
|
contacts: boolean;
|
|
14
14
|
};
|
|
15
15
|
optedIntoOptionalAnalytics?: boolean;
|
|
16
|
+
preferredCurrency?: string;
|
|
16
17
|
/** @deprecated Moved to DeviceProperties */
|
|
17
18
|
worldAppVersion?: number;
|
|
18
19
|
/** @deprecated Moved to DeviceProperties */
|
|
@@ -100,7 +101,9 @@ declare enum Command {
|
|
|
100
101
|
GetPermissions = "get-permissions",
|
|
101
102
|
SendHapticFeedback = "send-haptic-feedback",
|
|
102
103
|
Share = "share",
|
|
103
|
-
Chat = "chat"
|
|
104
|
+
Chat = "chat",
|
|
105
|
+
Attestation = "attestation",
|
|
106
|
+
CloseMiniApp = "close-miniapp"
|
|
104
107
|
}
|
|
105
108
|
declare enum ResponseEvent {
|
|
106
109
|
MiniAppVerifyAction = "miniapp-verify-action",
|
|
@@ -115,7 +118,8 @@ declare enum ResponseEvent {
|
|
|
115
118
|
MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
|
|
116
119
|
MiniAppShare = "miniapp-share",
|
|
117
120
|
MiniAppMicrophone = "miniapp-microphone",
|
|
118
|
-
MiniAppChat = "miniapp-chat"
|
|
121
|
+
MiniAppChat = "miniapp-chat",
|
|
122
|
+
MiniAppAttestation = "miniapp-attestation"
|
|
119
123
|
}
|
|
120
124
|
declare const COMMAND_VERSIONS: Record<Command, number>;
|
|
121
125
|
declare function isCommandAvailable(command: Command): boolean;
|
|
@@ -153,6 +157,34 @@ type MiniKitInstallReturnType = {
|
|
|
153
157
|
};
|
|
154
158
|
declare function sendMiniKitEvent<T extends WebViewBasePayload = WebViewBasePayload>(payload: T): void;
|
|
155
159
|
|
|
160
|
+
type AttestationInput = {
|
|
161
|
+
/**
|
|
162
|
+
* Hex-encoded hash of the request to be attested.
|
|
163
|
+
* Hash must be generated per hashing spec documented in MiniKit docs.
|
|
164
|
+
*/
|
|
165
|
+
requestHash: string;
|
|
166
|
+
};
|
|
167
|
+
type AttestationPayload = {
|
|
168
|
+
request_hash: string;
|
|
169
|
+
};
|
|
170
|
+
declare enum AttestationErrorCodes {
|
|
171
|
+
Unauthorized = "unauthorized",
|
|
172
|
+
AttestationFailed = "attestation_failed",
|
|
173
|
+
IntegrityFailed = "integrity_failed",
|
|
174
|
+
InvalidInput = "invalid_input",
|
|
175
|
+
UnsupportedVersion = "unsupported_version"
|
|
176
|
+
}
|
|
177
|
+
declare const AttestationErrorMessage: Record<AttestationErrorCodes, string>;
|
|
178
|
+
type MiniAppAttestationSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
179
|
+
token: string;
|
|
180
|
+
};
|
|
181
|
+
type MiniAppAttestationErrorPayload = MiniAppBaseErrorPayload<AttestationErrorCodes> & {
|
|
182
|
+
description: string;
|
|
183
|
+
};
|
|
184
|
+
type MiniAppAttestationPayload = MiniAppAttestationSuccessPayload | MiniAppAttestationErrorPayload;
|
|
185
|
+
declare function createAttestationCommand(_ctx: CommandContext): (input: AttestationInput) => AttestationPayload | null;
|
|
186
|
+
declare function createAttestationAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createAttestationCommand>): (input: AttestationInput) => AsyncHandlerReturn<AttestationPayload | null, MiniAppAttestationPayload>;
|
|
187
|
+
|
|
156
188
|
type ChatPayload = {
|
|
157
189
|
to?: string[];
|
|
158
190
|
message: string;
|
|
@@ -325,6 +357,7 @@ type MiniAppShareContactsPayload = MiniAppShareContactsSuccessPayload | MiniAppS
|
|
|
325
357
|
declare function createShareContactsCommand(_ctx: CommandContext): (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
326
358
|
declare function createShareContactsAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createShareContactsCommand>): (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
327
359
|
|
|
360
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
328
361
|
type SignTypedDataInput = {
|
|
329
362
|
types: TypedData;
|
|
330
363
|
primaryType: string;
|
|
@@ -332,7 +365,9 @@ type SignTypedDataInput = {
|
|
|
332
365
|
domain?: TypedDataDomain;
|
|
333
366
|
chainId?: number;
|
|
334
367
|
};
|
|
368
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
335
369
|
type SignTypedDataPayload = SignTypedDataInput;
|
|
370
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
336
371
|
declare enum SignTypedDataErrorCodes {
|
|
337
372
|
InvalidOperation = "invalid_operation",
|
|
338
373
|
UserRejected = "user_rejected",
|
|
@@ -343,6 +378,7 @@ declare enum SignTypedDataErrorCodes {
|
|
|
343
378
|
InvalidContract = "invalid_contract",
|
|
344
379
|
MaliciousOperation = "malicious_operation"
|
|
345
380
|
}
|
|
381
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
346
382
|
declare const SignTypedDataErrorMessage: {
|
|
347
383
|
invalid_operation: string;
|
|
348
384
|
user_rejected: string;
|
|
@@ -353,13 +389,16 @@ declare const SignTypedDataErrorMessage: {
|
|
|
353
389
|
invalid_contract: string;
|
|
354
390
|
malicious_operation: string;
|
|
355
391
|
};
|
|
392
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
356
393
|
type MiniAppSignTypedDataSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
357
394
|
signature: string;
|
|
358
395
|
address: string;
|
|
359
396
|
};
|
|
397
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
360
398
|
type MiniAppSignTypedDataErrorPayload = MiniAppBaseErrorPayload<SignTypedDataErrorCodes> & {
|
|
361
399
|
details?: Record<string, any>;
|
|
362
400
|
};
|
|
401
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
363
402
|
type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
|
|
364
403
|
declare function createSignTypedDataCommand(_ctx: CommandContext): (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
365
404
|
declare function createSignTypedDataAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSignTypedDataCommand>): (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
@@ -552,12 +591,15 @@ type MiniAppVerifyActionPayload = MiniAppVerifyActionSuccessPayload | MiniAppVer
|
|
|
552
591
|
declare function createVerifyCommand(ctx: CommandContext): (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
553
592
|
declare function createVerifyAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createVerifyCommand>): (payload: VerifyCommandInput) => AsyncHandlerReturn<VerifyCommandPayload | null, MiniAppVerifyActionPayload>;
|
|
554
593
|
|
|
594
|
+
declare function createCloseMiniAppCommand(_ctx: CommandContext): () => boolean;
|
|
595
|
+
|
|
555
596
|
declare function createCommands(ctx: CommandContext): {
|
|
556
597
|
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
557
598
|
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
558
599
|
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
559
600
|
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
560
601
|
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
602
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
561
603
|
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
562
604
|
shareContacts: (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
563
605
|
requestPermission: (payload: RequestPermissionInput) => RequestPermissionPayload | null;
|
|
@@ -565,6 +607,8 @@ declare function createCommands(ctx: CommandContext): {
|
|
|
565
607
|
sendHapticFeedback: (payload: SendHapticFeedbackInput) => SendHapticFeedbackPayload | null;
|
|
566
608
|
share: (payload: ShareInput) => ShareInput | null;
|
|
567
609
|
chat: (payload: ChatPayload) => ChatPayload | null;
|
|
610
|
+
attestation: (input: AttestationInput) => AttestationPayload | null;
|
|
611
|
+
closeMiniApp: () => boolean;
|
|
568
612
|
};
|
|
569
613
|
type Commands = ReturnType<typeof createCommands>;
|
|
570
614
|
declare function createAsyncCommands(ctx: CommandContext, commands: Commands): {
|
|
@@ -573,6 +617,7 @@ declare function createAsyncCommands(ctx: CommandContext, commands: Commands): {
|
|
|
573
617
|
walletAuth: (payload: WalletAuthInput) => AsyncHandlerReturn<WalletAuthPayload | null, MiniAppWalletAuthPayload>;
|
|
574
618
|
sendTransaction: (payload: SendTransactionInput) => AsyncHandlerReturn<SendTransactionPayload | null, MiniAppSendTransactionPayload>;
|
|
575
619
|
signMessage: (payload: SignMessageInput) => AsyncHandlerReturn<SignMessagePayload | null, MiniAppSignMessagePayload>;
|
|
620
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
576
621
|
signTypedData: (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
577
622
|
shareContacts: (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
578
623
|
requestPermission: (payload: RequestPermissionInput) => AsyncHandlerReturn<RequestPermissionPayload | null, MiniAppRequestPermissionPayload>;
|
|
@@ -580,6 +625,7 @@ declare function createAsyncCommands(ctx: CommandContext, commands: Commands): {
|
|
|
580
625
|
sendHapticFeedback: (payload: SendHapticFeedbackInput) => AsyncHandlerReturn<SendHapticFeedbackPayload | null, MiniAppSendHapticFeedbackPayload>;
|
|
581
626
|
share: (payload: ShareInput) => AsyncHandlerReturn<ShareInput | null, MiniAppSharePayload>;
|
|
582
627
|
chat: (payload: ChatPayload) => AsyncHandlerReturn<ChatPayload | null, MiniAppChatPayload>;
|
|
628
|
+
attestation: (input: AttestationInput) => AsyncHandlerReturn<AttestationPayload | null, MiniAppAttestationPayload>;
|
|
583
629
|
};
|
|
584
630
|
type AsyncCommands = ReturnType<typeof createAsyncCommands>;
|
|
585
631
|
|
|
@@ -643,4 +689,4 @@ declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonc
|
|
|
643
689
|
|
|
644
690
|
declare const getIsUserVerified: (walletAddress: string, rpcUrl?: string) => Promise<boolean>;
|
|
645
691
|
|
|
646
|
-
export { type AsyncCommands, type AsyncHandlerReturn, COMMAND_VERSIONS, ChatErrorCodes, ChatErrorMessage, type ChatPayload, Command, type CommandContext, type Commands, type Contact, type ContractFunctionArgs, type ContractFunctionName, type DeviceProperties, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, type MiniAppBaseErrorPayload, type MiniAppBaseSuccessPayload, type MiniAppChatErrorPayload, type MiniAppChatPayload, type MiniAppChatSuccessPayload, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, MiniAppLaunchLocation, type MiniAppLocation, type MiniAppPaymentErrorPayload, type MiniAppPaymentPayload, type MiniAppPaymentSuccessPayload, type MiniAppRequestPermissionErrorPayload, type MiniAppRequestPermissionPayload, type MiniAppRequestPermissionSuccessPayload, type MiniAppSendHapticFeedbackErrorPayload, type MiniAppSendHapticFeedbackPayload, type MiniAppSendHapticFeedbackSuccessPayload, type MiniAppSendTransactionErrorPayload, type MiniAppSendTransactionPayload, type MiniAppSendTransactionSuccessPayload, type MiniAppShareContactsErrorPayload, type MiniAppShareContactsPayload, type MiniAppShareContactsSuccessPayload, type MiniAppShareErrorPayload, type MiniAppSharePayload, type MiniAppShareSuccessPayload, type MiniAppSignMessageErrorPayload, type MiniAppSignMessagePayload, type MiniAppSignMessageSuccessPayload, type MiniAppSignTypedDataErrorPayload, type MiniAppSignTypedDataPayload, type MiniAppSignTypedDataSuccessPayload, type MiniAppVerifyActionErrorPayload, type MiniAppVerifyActionMultiSuccessPayload, type MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload$1 as MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, Permission, type PermissionSettings, type Permit2, RequestPermissionErrorCodes, RequestPermissionErrorMessage, type RequestPermissionInput, type RequestPermissionPayload, ResponseEvent, SendHapticFeedbackErrorCodes, SendHapticFeedbackErrorMessage, type SendHapticFeedbackInput, type SendHapticFeedbackPayload, SendTransactionErrorCodes, SendTransactionErrorMessage, type SendTransactionInput, type SendTransactionPayload, ShareContactsErrorCodes, ShareContactsErrorMessage, type ShareContactsInput, type ShareContactsPayload, ShareFilesErrorCodes, ShareFilesErrorMessage, type ShareInput, type SharePayload, SignMessageErrorCodes, SignMessageErrorMessage, type SignMessageInput, type SignMessagePayload, SignTypedDataErrorCodes, SignTypedDataErrorMessage, type SignTypedDataInput, type SignTypedDataPayload, type SiweMessage, TokenDecimals, Tokens, type TokensPayload, type Transaction, type User, type UserNameService, type VerificationResult, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, createAsyncCommands, createChatAsyncCommand, createChatCommand, createCommands, createGetPermissionsAsyncCommand, createGetPermissionsCommand, createPayAsyncCommand, createPayCommand, createRequestPermissionAsyncCommand, createRequestPermissionCommand, createSendHapticFeedbackAsyncCommand, createSendHapticFeedbackCommand, createSendTransactionAsyncCommand, createSendTransactionCommand, createShareAsyncCommand, createShareCommand, createShareContactsAsyncCommand, createShareContactsCommand, createSignMessageAsyncCommand, createSignMessageCommand, createSignTypedDataAsyncCommand, createSignTypedDataCommand, createVerifyAsyncCommand, createVerifyCommand, createWalletAuthAsyncCommand, createWalletAuthCommand, getIsUserVerified, isCommandAvailable, mapWorldAppLaunchLocation, parseSiweMessage, sendMiniKitEvent, setCommandAvailable, tokenToDecimals, validateCommands, verifySiweMessage };
|
|
692
|
+
export { type AsyncCommands, type AsyncHandlerReturn, AttestationErrorCodes, AttestationErrorMessage, type AttestationInput, type AttestationPayload, COMMAND_VERSIONS, ChatErrorCodes, ChatErrorMessage, type ChatPayload, Command, type CommandContext, type Commands, type Contact, type ContractFunctionArgs, type ContractFunctionName, type DeviceProperties, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, type MiniAppAttestationErrorPayload, type MiniAppAttestationPayload, type MiniAppAttestationSuccessPayload, type MiniAppBaseErrorPayload, type MiniAppBaseSuccessPayload, type MiniAppChatErrorPayload, type MiniAppChatPayload, type MiniAppChatSuccessPayload, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, MiniAppLaunchLocation, type MiniAppLocation, type MiniAppPaymentErrorPayload, type MiniAppPaymentPayload, type MiniAppPaymentSuccessPayload, type MiniAppRequestPermissionErrorPayload, type MiniAppRequestPermissionPayload, type MiniAppRequestPermissionSuccessPayload, type MiniAppSendHapticFeedbackErrorPayload, type MiniAppSendHapticFeedbackPayload, type MiniAppSendHapticFeedbackSuccessPayload, type MiniAppSendTransactionErrorPayload, type MiniAppSendTransactionPayload, type MiniAppSendTransactionSuccessPayload, type MiniAppShareContactsErrorPayload, type MiniAppShareContactsPayload, type MiniAppShareContactsSuccessPayload, type MiniAppShareErrorPayload, type MiniAppSharePayload, type MiniAppShareSuccessPayload, type MiniAppSignMessageErrorPayload, type MiniAppSignMessagePayload, type MiniAppSignMessageSuccessPayload, type MiniAppSignTypedDataErrorPayload, type MiniAppSignTypedDataPayload, type MiniAppSignTypedDataSuccessPayload, type MiniAppVerifyActionErrorPayload, type MiniAppVerifyActionMultiSuccessPayload, type MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload$1 as MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, Permission, type PermissionSettings, type Permit2, RequestPermissionErrorCodes, RequestPermissionErrorMessage, type RequestPermissionInput, type RequestPermissionPayload, ResponseEvent, SendHapticFeedbackErrorCodes, SendHapticFeedbackErrorMessage, type SendHapticFeedbackInput, type SendHapticFeedbackPayload, SendTransactionErrorCodes, SendTransactionErrorMessage, type SendTransactionInput, type SendTransactionPayload, ShareContactsErrorCodes, ShareContactsErrorMessage, type ShareContactsInput, type ShareContactsPayload, ShareFilesErrorCodes, ShareFilesErrorMessage, type ShareInput, type SharePayload, SignMessageErrorCodes, SignMessageErrorMessage, type SignMessageInput, type SignMessagePayload, SignTypedDataErrorCodes, SignTypedDataErrorMessage, type SignTypedDataInput, type SignTypedDataPayload, type SiweMessage, TokenDecimals, Tokens, type TokensPayload, type Transaction, type User, type UserNameService, type VerificationResult, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, createAsyncCommands, createAttestationAsyncCommand, createAttestationCommand, createChatAsyncCommand, createChatCommand, createCloseMiniAppCommand, createCommands, createGetPermissionsAsyncCommand, createGetPermissionsCommand, createPayAsyncCommand, createPayCommand, createRequestPermissionAsyncCommand, createRequestPermissionCommand, createSendHapticFeedbackAsyncCommand, createSendHapticFeedbackCommand, createSendTransactionAsyncCommand, createSendTransactionCommand, createShareAsyncCommand, createShareCommand, createShareContactsAsyncCommand, createShareContactsCommand, createSignMessageAsyncCommand, createSignMessageCommand, createSignTypedDataAsyncCommand, createSignTypedDataCommand, createVerifyAsyncCommand, createVerifyCommand, createWalletAuthAsyncCommand, createWalletAuthCommand, getIsUserVerified, isCommandAvailable, mapWorldAppLaunchLocation, parseSiweMessage, sendMiniKitEvent, setCommandAvailable, tokenToDecimals, validateCommands, verifySiweMessage };
|
package/build/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ type User = {
|
|
|
13
13
|
contacts: boolean;
|
|
14
14
|
};
|
|
15
15
|
optedIntoOptionalAnalytics?: boolean;
|
|
16
|
+
preferredCurrency?: string;
|
|
16
17
|
/** @deprecated Moved to DeviceProperties */
|
|
17
18
|
worldAppVersion?: number;
|
|
18
19
|
/** @deprecated Moved to DeviceProperties */
|
|
@@ -100,7 +101,9 @@ declare enum Command {
|
|
|
100
101
|
GetPermissions = "get-permissions",
|
|
101
102
|
SendHapticFeedback = "send-haptic-feedback",
|
|
102
103
|
Share = "share",
|
|
103
|
-
Chat = "chat"
|
|
104
|
+
Chat = "chat",
|
|
105
|
+
Attestation = "attestation",
|
|
106
|
+
CloseMiniApp = "close-miniapp"
|
|
104
107
|
}
|
|
105
108
|
declare enum ResponseEvent {
|
|
106
109
|
MiniAppVerifyAction = "miniapp-verify-action",
|
|
@@ -115,7 +118,8 @@ declare enum ResponseEvent {
|
|
|
115
118
|
MiniAppSendHapticFeedback = "miniapp-send-haptic-feedback",
|
|
116
119
|
MiniAppShare = "miniapp-share",
|
|
117
120
|
MiniAppMicrophone = "miniapp-microphone",
|
|
118
|
-
MiniAppChat = "miniapp-chat"
|
|
121
|
+
MiniAppChat = "miniapp-chat",
|
|
122
|
+
MiniAppAttestation = "miniapp-attestation"
|
|
119
123
|
}
|
|
120
124
|
declare const COMMAND_VERSIONS: Record<Command, number>;
|
|
121
125
|
declare function isCommandAvailable(command: Command): boolean;
|
|
@@ -153,6 +157,34 @@ type MiniKitInstallReturnType = {
|
|
|
153
157
|
};
|
|
154
158
|
declare function sendMiniKitEvent<T extends WebViewBasePayload = WebViewBasePayload>(payload: T): void;
|
|
155
159
|
|
|
160
|
+
type AttestationInput = {
|
|
161
|
+
/**
|
|
162
|
+
* Hex-encoded hash of the request to be attested.
|
|
163
|
+
* Hash must be generated per hashing spec documented in MiniKit docs.
|
|
164
|
+
*/
|
|
165
|
+
requestHash: string;
|
|
166
|
+
};
|
|
167
|
+
type AttestationPayload = {
|
|
168
|
+
request_hash: string;
|
|
169
|
+
};
|
|
170
|
+
declare enum AttestationErrorCodes {
|
|
171
|
+
Unauthorized = "unauthorized",
|
|
172
|
+
AttestationFailed = "attestation_failed",
|
|
173
|
+
IntegrityFailed = "integrity_failed",
|
|
174
|
+
InvalidInput = "invalid_input",
|
|
175
|
+
UnsupportedVersion = "unsupported_version"
|
|
176
|
+
}
|
|
177
|
+
declare const AttestationErrorMessage: Record<AttestationErrorCodes, string>;
|
|
178
|
+
type MiniAppAttestationSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
179
|
+
token: string;
|
|
180
|
+
};
|
|
181
|
+
type MiniAppAttestationErrorPayload = MiniAppBaseErrorPayload<AttestationErrorCodes> & {
|
|
182
|
+
description: string;
|
|
183
|
+
};
|
|
184
|
+
type MiniAppAttestationPayload = MiniAppAttestationSuccessPayload | MiniAppAttestationErrorPayload;
|
|
185
|
+
declare function createAttestationCommand(_ctx: CommandContext): (input: AttestationInput) => AttestationPayload | null;
|
|
186
|
+
declare function createAttestationAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createAttestationCommand>): (input: AttestationInput) => AsyncHandlerReturn<AttestationPayload | null, MiniAppAttestationPayload>;
|
|
187
|
+
|
|
156
188
|
type ChatPayload = {
|
|
157
189
|
to?: string[];
|
|
158
190
|
message: string;
|
|
@@ -325,6 +357,7 @@ type MiniAppShareContactsPayload = MiniAppShareContactsSuccessPayload | MiniAppS
|
|
|
325
357
|
declare function createShareContactsCommand(_ctx: CommandContext): (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
326
358
|
declare function createShareContactsAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createShareContactsCommand>): (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
327
359
|
|
|
360
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
328
361
|
type SignTypedDataInput = {
|
|
329
362
|
types: TypedData;
|
|
330
363
|
primaryType: string;
|
|
@@ -332,7 +365,9 @@ type SignTypedDataInput = {
|
|
|
332
365
|
domain?: TypedDataDomain;
|
|
333
366
|
chainId?: number;
|
|
334
367
|
};
|
|
368
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
335
369
|
type SignTypedDataPayload = SignTypedDataInput;
|
|
370
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
336
371
|
declare enum SignTypedDataErrorCodes {
|
|
337
372
|
InvalidOperation = "invalid_operation",
|
|
338
373
|
UserRejected = "user_rejected",
|
|
@@ -343,6 +378,7 @@ declare enum SignTypedDataErrorCodes {
|
|
|
343
378
|
InvalidContract = "invalid_contract",
|
|
344
379
|
MaliciousOperation = "malicious_operation"
|
|
345
380
|
}
|
|
381
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
346
382
|
declare const SignTypedDataErrorMessage: {
|
|
347
383
|
invalid_operation: string;
|
|
348
384
|
user_rejected: string;
|
|
@@ -353,13 +389,16 @@ declare const SignTypedDataErrorMessage: {
|
|
|
353
389
|
invalid_contract: string;
|
|
354
390
|
malicious_operation: string;
|
|
355
391
|
};
|
|
392
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
356
393
|
type MiniAppSignTypedDataSuccessPayload = MiniAppBaseSuccessPayload & {
|
|
357
394
|
signature: string;
|
|
358
395
|
address: string;
|
|
359
396
|
};
|
|
397
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
360
398
|
type MiniAppSignTypedDataErrorPayload = MiniAppBaseErrorPayload<SignTypedDataErrorCodes> & {
|
|
361
399
|
details?: Record<string, any>;
|
|
362
400
|
};
|
|
401
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
363
402
|
type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
|
|
364
403
|
declare function createSignTypedDataCommand(_ctx: CommandContext): (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
365
404
|
declare function createSignTypedDataAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createSignTypedDataCommand>): (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
@@ -552,12 +591,15 @@ type MiniAppVerifyActionPayload = MiniAppVerifyActionSuccessPayload | MiniAppVer
|
|
|
552
591
|
declare function createVerifyCommand(ctx: CommandContext): (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
553
592
|
declare function createVerifyAsyncCommand(ctx: CommandContext, syncCommand: ReturnType<typeof createVerifyCommand>): (payload: VerifyCommandInput) => AsyncHandlerReturn<VerifyCommandPayload | null, MiniAppVerifyActionPayload>;
|
|
554
593
|
|
|
594
|
+
declare function createCloseMiniAppCommand(_ctx: CommandContext): () => boolean;
|
|
595
|
+
|
|
555
596
|
declare function createCommands(ctx: CommandContext): {
|
|
556
597
|
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
557
598
|
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
558
599
|
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
559
600
|
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
560
601
|
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
602
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
561
603
|
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
562
604
|
shareContacts: (payload: ShareContactsPayload) => ShareContactsPayload | null;
|
|
563
605
|
requestPermission: (payload: RequestPermissionInput) => RequestPermissionPayload | null;
|
|
@@ -565,6 +607,8 @@ declare function createCommands(ctx: CommandContext): {
|
|
|
565
607
|
sendHapticFeedback: (payload: SendHapticFeedbackInput) => SendHapticFeedbackPayload | null;
|
|
566
608
|
share: (payload: ShareInput) => ShareInput | null;
|
|
567
609
|
chat: (payload: ChatPayload) => ChatPayload | null;
|
|
610
|
+
attestation: (input: AttestationInput) => AttestationPayload | null;
|
|
611
|
+
closeMiniApp: () => boolean;
|
|
568
612
|
};
|
|
569
613
|
type Commands = ReturnType<typeof createCommands>;
|
|
570
614
|
declare function createAsyncCommands(ctx: CommandContext, commands: Commands): {
|
|
@@ -573,6 +617,7 @@ declare function createAsyncCommands(ctx: CommandContext, commands: Commands): {
|
|
|
573
617
|
walletAuth: (payload: WalletAuthInput) => AsyncHandlerReturn<WalletAuthPayload | null, MiniAppWalletAuthPayload>;
|
|
574
618
|
sendTransaction: (payload: SendTransactionInput) => AsyncHandlerReturn<SendTransactionPayload | null, MiniAppSendTransactionPayload>;
|
|
575
619
|
signMessage: (payload: SignMessageInput) => AsyncHandlerReturn<SignMessagePayload | null, MiniAppSignMessagePayload>;
|
|
620
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
576
621
|
signTypedData: (payload: SignTypedDataInput) => AsyncHandlerReturn<SignTypedDataPayload | null, MiniAppSignTypedDataPayload>;
|
|
577
622
|
shareContacts: (payload: ShareContactsPayload) => AsyncHandlerReturn<ShareContactsPayload | null, MiniAppShareContactsPayload>;
|
|
578
623
|
requestPermission: (payload: RequestPermissionInput) => AsyncHandlerReturn<RequestPermissionPayload | null, MiniAppRequestPermissionPayload>;
|
|
@@ -580,6 +625,7 @@ declare function createAsyncCommands(ctx: CommandContext, commands: Commands): {
|
|
|
580
625
|
sendHapticFeedback: (payload: SendHapticFeedbackInput) => AsyncHandlerReturn<SendHapticFeedbackPayload | null, MiniAppSendHapticFeedbackPayload>;
|
|
581
626
|
share: (payload: ShareInput) => AsyncHandlerReturn<ShareInput | null, MiniAppSharePayload>;
|
|
582
627
|
chat: (payload: ChatPayload) => AsyncHandlerReturn<ChatPayload | null, MiniAppChatPayload>;
|
|
628
|
+
attestation: (input: AttestationInput) => AsyncHandlerReturn<AttestationPayload | null, MiniAppAttestationPayload>;
|
|
583
629
|
};
|
|
584
630
|
type AsyncCommands = ReturnType<typeof createAsyncCommands>;
|
|
585
631
|
|
|
@@ -643,4 +689,4 @@ declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonc
|
|
|
643
689
|
|
|
644
690
|
declare const getIsUserVerified: (walletAddress: string, rpcUrl?: string) => Promise<boolean>;
|
|
645
691
|
|
|
646
|
-
export { type AsyncCommands, type AsyncHandlerReturn, COMMAND_VERSIONS, ChatErrorCodes, ChatErrorMessage, type ChatPayload, Command, type CommandContext, type Commands, type Contact, type ContractFunctionArgs, type ContractFunctionName, type DeviceProperties, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, type MiniAppBaseErrorPayload, type MiniAppBaseSuccessPayload, type MiniAppChatErrorPayload, type MiniAppChatPayload, type MiniAppChatSuccessPayload, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, MiniAppLaunchLocation, type MiniAppLocation, type MiniAppPaymentErrorPayload, type MiniAppPaymentPayload, type MiniAppPaymentSuccessPayload, type MiniAppRequestPermissionErrorPayload, type MiniAppRequestPermissionPayload, type MiniAppRequestPermissionSuccessPayload, type MiniAppSendHapticFeedbackErrorPayload, type MiniAppSendHapticFeedbackPayload, type MiniAppSendHapticFeedbackSuccessPayload, type MiniAppSendTransactionErrorPayload, type MiniAppSendTransactionPayload, type MiniAppSendTransactionSuccessPayload, type MiniAppShareContactsErrorPayload, type MiniAppShareContactsPayload, type MiniAppShareContactsSuccessPayload, type MiniAppShareErrorPayload, type MiniAppSharePayload, type MiniAppShareSuccessPayload, type MiniAppSignMessageErrorPayload, type MiniAppSignMessagePayload, type MiniAppSignMessageSuccessPayload, type MiniAppSignTypedDataErrorPayload, type MiniAppSignTypedDataPayload, type MiniAppSignTypedDataSuccessPayload, type MiniAppVerifyActionErrorPayload, type MiniAppVerifyActionMultiSuccessPayload, type MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload$1 as MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, Permission, type PermissionSettings, type Permit2, RequestPermissionErrorCodes, RequestPermissionErrorMessage, type RequestPermissionInput, type RequestPermissionPayload, ResponseEvent, SendHapticFeedbackErrorCodes, SendHapticFeedbackErrorMessage, type SendHapticFeedbackInput, type SendHapticFeedbackPayload, SendTransactionErrorCodes, SendTransactionErrorMessage, type SendTransactionInput, type SendTransactionPayload, ShareContactsErrorCodes, ShareContactsErrorMessage, type ShareContactsInput, type ShareContactsPayload, ShareFilesErrorCodes, ShareFilesErrorMessage, type ShareInput, type SharePayload, SignMessageErrorCodes, SignMessageErrorMessage, type SignMessageInput, type SignMessagePayload, SignTypedDataErrorCodes, SignTypedDataErrorMessage, type SignTypedDataInput, type SignTypedDataPayload, type SiweMessage, TokenDecimals, Tokens, type TokensPayload, type Transaction, type User, type UserNameService, type VerificationResult, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, createAsyncCommands, createChatAsyncCommand, createChatCommand, createCommands, createGetPermissionsAsyncCommand, createGetPermissionsCommand, createPayAsyncCommand, createPayCommand, createRequestPermissionAsyncCommand, createRequestPermissionCommand, createSendHapticFeedbackAsyncCommand, createSendHapticFeedbackCommand, createSendTransactionAsyncCommand, createSendTransactionCommand, createShareAsyncCommand, createShareCommand, createShareContactsAsyncCommand, createShareContactsCommand, createSignMessageAsyncCommand, createSignMessageCommand, createSignTypedDataAsyncCommand, createSignTypedDataCommand, createVerifyAsyncCommand, createVerifyCommand, createWalletAuthAsyncCommand, createWalletAuthCommand, getIsUserVerified, isCommandAvailable, mapWorldAppLaunchLocation, parseSiweMessage, sendMiniKitEvent, setCommandAvailable, tokenToDecimals, validateCommands, verifySiweMessage };
|
|
692
|
+
export { type AsyncCommands, type AsyncHandlerReturn, AttestationErrorCodes, AttestationErrorMessage, type AttestationInput, type AttestationPayload, COMMAND_VERSIONS, ChatErrorCodes, ChatErrorMessage, type ChatPayload, Command, type CommandContext, type Commands, type Contact, type ContractFunctionArgs, type ContractFunctionName, type DeviceProperties, GetPermissionsErrorCodes, GetPermissionsErrorMessage, type GetPermissionsInput, type GetPermissionsPayload, type MiniAppAttestationErrorPayload, type MiniAppAttestationPayload, type MiniAppAttestationSuccessPayload, type MiniAppBaseErrorPayload, type MiniAppBaseSuccessPayload, type MiniAppChatErrorPayload, type MiniAppChatPayload, type MiniAppChatSuccessPayload, type MiniAppGetPermissionsErrorPayload, type MiniAppGetPermissionsPayload, type MiniAppGetPermissionsSuccessPayload, MiniAppLaunchLocation, type MiniAppLocation, type MiniAppPaymentErrorPayload, type MiniAppPaymentPayload, type MiniAppPaymentSuccessPayload, type MiniAppRequestPermissionErrorPayload, type MiniAppRequestPermissionPayload, type MiniAppRequestPermissionSuccessPayload, type MiniAppSendHapticFeedbackErrorPayload, type MiniAppSendHapticFeedbackPayload, type MiniAppSendHapticFeedbackSuccessPayload, type MiniAppSendTransactionErrorPayload, type MiniAppSendTransactionPayload, type MiniAppSendTransactionSuccessPayload, type MiniAppShareContactsErrorPayload, type MiniAppShareContactsPayload, type MiniAppShareContactsSuccessPayload, type MiniAppShareErrorPayload, type MiniAppSharePayload, type MiniAppShareSuccessPayload, type MiniAppSignMessageErrorPayload, type MiniAppSignMessagePayload, type MiniAppSignMessageSuccessPayload, type MiniAppSignTypedDataErrorPayload, type MiniAppSignTypedDataPayload, type MiniAppSignTypedDataSuccessPayload, type MiniAppVerifyActionErrorPayload, type MiniAppVerifyActionMultiSuccessPayload, type MiniAppVerifyActionPayload, type MiniAppVerifyActionSuccessPayload, type MiniAppWalletAuthErrorPayload, type MiniAppWalletAuthPayload, type MiniAppWalletAuthSuccessPayload$1 as MiniAppWalletAuthSuccessPayload, MiniKit, MiniKitInstallErrorCodes, MiniKitInstallErrorMessage, type MiniKitInstallReturnType, Network, type PayCommandInput, type PayCommandPayload, PaymentErrorCodes, PaymentErrorMessage, Permission, type PermissionSettings, type Permit2, RequestPermissionErrorCodes, RequestPermissionErrorMessage, type RequestPermissionInput, type RequestPermissionPayload, ResponseEvent, SendHapticFeedbackErrorCodes, SendHapticFeedbackErrorMessage, type SendHapticFeedbackInput, type SendHapticFeedbackPayload, SendTransactionErrorCodes, SendTransactionErrorMessage, type SendTransactionInput, type SendTransactionPayload, ShareContactsErrorCodes, ShareContactsErrorMessage, type ShareContactsInput, type ShareContactsPayload, ShareFilesErrorCodes, ShareFilesErrorMessage, type ShareInput, type SharePayload, SignMessageErrorCodes, SignMessageErrorMessage, type SignMessageInput, type SignMessagePayload, SignTypedDataErrorCodes, SignTypedDataErrorMessage, type SignTypedDataInput, type SignTypedDataPayload, type SiweMessage, TokenDecimals, Tokens, type TokensPayload, type Transaction, type User, type UserNameService, type VerificationResult, type VerifyCommandInput, type VerifyCommandPayload, WalletAuthErrorCodes, WalletAuthErrorMessage, type WalletAuthInput, type WalletAuthPayload, type WebViewBasePayload, createAsyncCommands, createAttestationAsyncCommand, createAttestationCommand, createChatAsyncCommand, createChatCommand, createCloseMiniAppCommand, createCommands, createGetPermissionsAsyncCommand, createGetPermissionsCommand, createPayAsyncCommand, createPayCommand, createRequestPermissionAsyncCommand, createRequestPermissionCommand, createSendHapticFeedbackAsyncCommand, createSendHapticFeedbackCommand, createSendTransactionAsyncCommand, createSendTransactionCommand, createShareAsyncCommand, createShareCommand, createShareContactsAsyncCommand, createShareContactsCommand, createSignMessageAsyncCommand, createSignMessageCommand, createSignTypedDataAsyncCommand, createSignTypedDataCommand, createVerifyAsyncCommand, createVerifyCommand, createWalletAuthAsyncCommand, createWalletAuthCommand, getIsUserVerified, isCommandAvailable, mapWorldAppLaunchLocation, parseSiweMessage, sendMiniKitEvent, setCommandAvailable, tokenToDecimals, validateCommands, verifySiweMessage };
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppErrorCodes,
|
|
3
|
+
AttestationErrorCodes,
|
|
4
|
+
AttestationErrorMessage,
|
|
3
5
|
COMMAND_VERSIONS,
|
|
4
6
|
ChatErrorCodes,
|
|
5
7
|
ChatErrorMessage,
|
|
@@ -34,8 +36,11 @@ import {
|
|
|
34
36
|
WalletAuthErrorCodes,
|
|
35
37
|
WalletAuthErrorMessage,
|
|
36
38
|
createAsyncCommands,
|
|
39
|
+
createAttestationAsyncCommand,
|
|
40
|
+
createAttestationCommand,
|
|
37
41
|
createChatAsyncCommand,
|
|
38
42
|
createChatCommand,
|
|
43
|
+
createCloseMiniAppCommand,
|
|
39
44
|
createCommands,
|
|
40
45
|
createGetPermissionsAsyncCommand,
|
|
41
46
|
createGetPermissionsCommand,
|
|
@@ -67,7 +72,7 @@ import {
|
|
|
67
72
|
tokenToDecimals,
|
|
68
73
|
validateCommands,
|
|
69
74
|
verifySiweMessage
|
|
70
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-62NZ34E4.js";
|
|
71
76
|
|
|
72
77
|
// index.ts
|
|
73
78
|
import { VerificationLevel } from "@worldcoin/idkit-core";
|
|
@@ -127,6 +132,8 @@ var getIsUserVerified = async (walletAddress, rpcUrl) => {
|
|
|
127
132
|
}
|
|
128
133
|
};
|
|
129
134
|
export {
|
|
135
|
+
AttestationErrorCodes,
|
|
136
|
+
AttestationErrorMessage,
|
|
130
137
|
COMMAND_VERSIONS,
|
|
131
138
|
ChatErrorCodes,
|
|
132
139
|
ChatErrorMessage,
|
|
@@ -163,8 +170,11 @@ export {
|
|
|
163
170
|
WalletAuthErrorCodes,
|
|
164
171
|
WalletAuthErrorMessage,
|
|
165
172
|
createAsyncCommands,
|
|
173
|
+
createAttestationAsyncCommand,
|
|
174
|
+
createAttestationCommand,
|
|
166
175
|
createChatAsyncCommand,
|
|
167
176
|
createChatCommand,
|
|
177
|
+
createCloseMiniAppCommand,
|
|
168
178
|
createCommands,
|
|
169
179
|
createGetPermissionsAsyncCommand,
|
|
170
180
|
createGetPermissionsCommand,
|
|
@@ -49,7 +49,9 @@ var COMMAND_VERSIONS = {
|
|
|
49
49
|
["get-permissions" /* GetPermissions */]: 1,
|
|
50
50
|
["send-haptic-feedback" /* SendHapticFeedback */]: 1,
|
|
51
51
|
["share" /* Share */]: 1,
|
|
52
|
-
["chat" /* Chat */]: 1
|
|
52
|
+
["chat" /* Chat */]: 1,
|
|
53
|
+
["attestation" /* Attestation */]: 1,
|
|
54
|
+
["close-miniapp" /* CloseMiniApp */]: 1
|
|
53
55
|
};
|
|
54
56
|
var commandAvailability = {
|
|
55
57
|
["verify" /* Verify */]: false,
|
|
@@ -63,7 +65,9 @@ var commandAvailability = {
|
|
|
63
65
|
["get-permissions" /* GetPermissions */]: false,
|
|
64
66
|
["send-haptic-feedback" /* SendHapticFeedback */]: false,
|
|
65
67
|
["share" /* Share */]: false,
|
|
66
|
-
["chat" /* Chat */]: false
|
|
68
|
+
["chat" /* Chat */]: false,
|
|
69
|
+
["attestation" /* Attestation */]: false,
|
|
70
|
+
["close-miniapp" /* CloseMiniApp */]: false
|
|
67
71
|
};
|
|
68
72
|
function isCommandAvailable(command) {
|
|
69
73
|
return commandAvailability[command];
|
|
@@ -104,6 +108,59 @@ function sendMiniKitEvent(payload) {
|
|
|
104
108
|
sendWebviewEvent(payload);
|
|
105
109
|
}
|
|
106
110
|
|
|
111
|
+
// commands/attestation.ts
|
|
112
|
+
function createAttestationCommand(_ctx) {
|
|
113
|
+
return (input) => {
|
|
114
|
+
if (typeof window === "undefined" || !isCommandAvailable("attestation" /* Attestation */)) {
|
|
115
|
+
console.error(
|
|
116
|
+
"'attestation' command is unavailable. Check MiniKit.install() or update the app version"
|
|
117
|
+
);
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
if (!input.requestHash || input.requestHash.length === 0) {
|
|
121
|
+
console.error("'attestation' command requires a non-empty requestHash");
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const payload = {
|
|
125
|
+
request_hash: input.requestHash
|
|
126
|
+
};
|
|
127
|
+
sendMiniKitEvent({
|
|
128
|
+
command: "attestation" /* Attestation */,
|
|
129
|
+
version: COMMAND_VERSIONS["attestation" /* Attestation */],
|
|
130
|
+
payload
|
|
131
|
+
});
|
|
132
|
+
return payload;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function createAttestationAsyncCommand(ctx, syncCommand) {
|
|
136
|
+
return async (input) => {
|
|
137
|
+
return new Promise((resolve, reject) => {
|
|
138
|
+
try {
|
|
139
|
+
const handleResponse = (response) => {
|
|
140
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
141
|
+
resolve({ commandPayload, finalPayload: response });
|
|
142
|
+
};
|
|
143
|
+
ctx.events.subscribe(
|
|
144
|
+
"miniapp-attestation" /* MiniAppAttestation */,
|
|
145
|
+
handleResponse
|
|
146
|
+
);
|
|
147
|
+
const commandPayload = syncCommand(input);
|
|
148
|
+
if (!commandPayload) {
|
|
149
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
150
|
+
reject(
|
|
151
|
+
new Error(
|
|
152
|
+
"'attestation' command failed: command unavailable or invalid input"
|
|
153
|
+
)
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
} catch (error) {
|
|
157
|
+
ctx.events.unsubscribe("miniapp-attestation" /* MiniAppAttestation */);
|
|
158
|
+
reject(error);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
107
164
|
// commands/chat.ts
|
|
108
165
|
function createChatCommand(_ctx) {
|
|
109
166
|
return (payload) => {
|
|
@@ -143,6 +200,24 @@ function createChatAsyncCommand(ctx, syncCommand) {
|
|
|
143
200
|
};
|
|
144
201
|
}
|
|
145
202
|
|
|
203
|
+
// commands/close-miniapp.ts
|
|
204
|
+
function createCloseMiniAppCommand(_ctx) {
|
|
205
|
+
return () => {
|
|
206
|
+
if (typeof window === "undefined" || !isCommandAvailable("close-miniapp" /* CloseMiniApp */)) {
|
|
207
|
+
console.error(
|
|
208
|
+
"'closeMiniApp' command is unavailable. Check MiniKit.install() or update the app version"
|
|
209
|
+
);
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
sendMiniKitEvent({
|
|
213
|
+
command: "close-miniapp" /* CloseMiniApp */,
|
|
214
|
+
version: COMMAND_VERSIONS["close-miniapp" /* CloseMiniApp */],
|
|
215
|
+
payload: {}
|
|
216
|
+
});
|
|
217
|
+
return true;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
146
221
|
// commands/get-permissions.ts
|
|
147
222
|
function createGetPermissionsCommand(_ctx) {
|
|
148
223
|
return () => {
|
|
@@ -622,6 +697,9 @@ function createSignMessageAsyncCommand(ctx, syncCommand) {
|
|
|
622
697
|
// commands/sign-typed-data.ts
|
|
623
698
|
function createSignTypedDataCommand(_ctx) {
|
|
624
699
|
return (payload) => {
|
|
700
|
+
console.warn(
|
|
701
|
+
"signTypedData is deprecated. Use signMessage or sendTransaction instead."
|
|
702
|
+
);
|
|
625
703
|
if (typeof window === "undefined" || !isCommandAvailable("sign-typed-data" /* SignTypedData */)) {
|
|
626
704
|
console.error(
|
|
627
705
|
"'signTypedData' command is unavailable. Check MiniKit.install() or update the app version"
|
|
@@ -887,13 +965,16 @@ function createCommands(ctx) {
|
|
|
887
965
|
walletAuth: createWalletAuthCommand(ctx),
|
|
888
966
|
sendTransaction: createSendTransactionCommand(ctx),
|
|
889
967
|
signMessage: createSignMessageCommand(ctx),
|
|
968
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
890
969
|
signTypedData: createSignTypedDataCommand(ctx),
|
|
891
970
|
shareContacts: createShareContactsCommand(ctx),
|
|
892
971
|
requestPermission: createRequestPermissionCommand(ctx),
|
|
893
972
|
getPermissions: createGetPermissionsCommand(ctx),
|
|
894
973
|
sendHapticFeedback: createSendHapticFeedbackCommand(ctx),
|
|
895
974
|
share: createShareCommand(ctx),
|
|
896
|
-
chat: createChatCommand(ctx)
|
|
975
|
+
chat: createChatCommand(ctx),
|
|
976
|
+
attestation: createAttestationCommand(ctx),
|
|
977
|
+
closeMiniApp: createCloseMiniAppCommand(ctx)
|
|
897
978
|
};
|
|
898
979
|
}
|
|
899
980
|
function createAsyncCommands(ctx, commands) {
|
|
@@ -906,6 +987,7 @@ function createAsyncCommands(ctx, commands) {
|
|
|
906
987
|
commands.sendTransaction
|
|
907
988
|
),
|
|
908
989
|
signMessage: createSignMessageAsyncCommand(ctx, commands.signMessage),
|
|
990
|
+
/** @deprecated EIP-712 typed data signing is deprecated. Use signMessage or sendTransaction instead. */
|
|
909
991
|
signTypedData: createSignTypedDataAsyncCommand(ctx, commands.signTypedData),
|
|
910
992
|
shareContacts: createShareContactsAsyncCommand(ctx, commands.shareContacts),
|
|
911
993
|
requestPermission: createRequestPermissionAsyncCommand(
|
|
@@ -921,7 +1003,8 @@ function createAsyncCommands(ctx, commands) {
|
|
|
921
1003
|
commands.sendHapticFeedback
|
|
922
1004
|
),
|
|
923
1005
|
share: createShareAsyncCommand(ctx, commands.share),
|
|
924
|
-
chat: createChatAsyncCommand(ctx, commands.chat)
|
|
1006
|
+
chat: createChatAsyncCommand(ctx, commands.chat),
|
|
1007
|
+
attestation: createAttestationAsyncCommand(ctx, commands.attestation)
|
|
925
1008
|
};
|
|
926
1009
|
}
|
|
927
1010
|
|
|
@@ -1007,6 +1090,8 @@ var EventManager = class {
|
|
|
1007
1090
|
["miniapp-microphone" /* MiniAppMicrophone */]: () => {
|
|
1008
1091
|
},
|
|
1009
1092
|
["miniapp-chat" /* MiniAppChat */]: () => {
|
|
1093
|
+
},
|
|
1094
|
+
["miniapp-attestation" /* MiniAppAttestation */]: () => {
|
|
1010
1095
|
}
|
|
1011
1096
|
};
|
|
1012
1097
|
this.verifyActionProcessingOptionsQueue = [];
|
|
@@ -1137,6 +1222,7 @@ var MiniKitState = class {
|
|
|
1137
1222
|
initFromWorldApp(worldApp) {
|
|
1138
1223
|
if (!worldApp) return;
|
|
1139
1224
|
this.user.optedIntoOptionalAnalytics = worldApp.is_optional_analytics;
|
|
1225
|
+
this.user.preferredCurrency = worldApp.preferred_currency;
|
|
1140
1226
|
this.user.deviceOS = worldApp.device_os;
|
|
1141
1227
|
this.user.worldAppVersion = worldApp.world_app_version;
|
|
1142
1228
|
this.deviceProperties.safeAreaInsets = worldApp.safe_area_insets;
|