@worldcoin/minikit-js 0.0.26-internal-alpha → 0.0.28-internal-alpha

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/index.js CHANGED
@@ -1,5 +1,199 @@
1
+ // types/errors.ts
2
+ import { AppErrorCodes } from "@worldcoin/idkit-core";
3
+ import { AppErrorCodes as AppErrorCodes2 } from "@worldcoin/idkit-core";
4
+ var VerificationErrorMessage = {
5
+ [AppErrorCodes.VerificationRejected]: "You\u2019ve cancelled the request in World App.",
6
+ [AppErrorCodes.MaxVerificationsReached]: "You have already verified the maximum number of times for this action.",
7
+ [AppErrorCodes.CredentialUnavailable]: "It seems you do not have the verification level required by this app.",
8
+ [AppErrorCodes.MalformedRequest]: "There was a problem with this request. Please try again or contact the app owner.",
9
+ [AppErrorCodes.InvalidNetwork]: "Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details.",
10
+ [AppErrorCodes.InclusionProofFailed]: "There was an issue fetching your credential. Please try again.",
11
+ [AppErrorCodes.InclusionProofPending]: "Your identity is still being registered. Please wait a few minutes and try again.",
12
+ [AppErrorCodes.UnexpectedResponse]: "Unexpected response from your wallet. Please try again.",
13
+ [AppErrorCodes.FailedByHostApp]: "Verification failed by the app. Please contact the app owner for details.",
14
+ [AppErrorCodes.GenericError]: "Something unexpected went wrong. Please try again.",
15
+ [AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
16
+ };
17
+ var PaymentErrorCodes = /* @__PURE__ */ ((PaymentErrorCodes2) => {
18
+ PaymentErrorCodes2["InputError"] = "input_error";
19
+ PaymentErrorCodes2["PaymentRejected"] = "payment_rejected";
20
+ PaymentErrorCodes2["InvalidReceiver"] = "invalid_receiver";
21
+ PaymentErrorCodes2["InsufficientBalance"] = "insufficient_balance";
22
+ PaymentErrorCodes2["TransactionFailed"] = "transaction_failed";
23
+ PaymentErrorCodes2["GenericError"] = "generic_error";
24
+ PaymentErrorCodes2["UserBlocked"] = "user_blocked";
25
+ return PaymentErrorCodes2;
26
+ })(PaymentErrorCodes || {});
27
+ var PaymentErrorMessage = {
28
+ ["input_error" /* InputError */]: "There was a problem with this request. Please try again or contact the app owner.",
29
+ ["payment_rejected" /* PaymentRejected */]: "You\u2019ve cancelled the payment in World App.",
30
+ ["invalid_receiver" /* InvalidReceiver */]: "The receiver address is invalid. Please contact the app owner.",
31
+ ["insufficient_balance" /* InsufficientBalance */]: "You do not have enough balance to complete this transaction.",
32
+ ["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again.",
33
+ ["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
34
+ ["user_blocked" /* UserBlocked */]: "User's region is blocked from making payments."
35
+ };
36
+ var PaymentValidationErrors = /* @__PURE__ */ ((PaymentValidationErrors2) => {
37
+ PaymentValidationErrors2["MalformedRequest"] = "There was a problem with this request. Please try again or contact the app owner.";
38
+ PaymentValidationErrors2["InvalidTokenAddress"] = "The token address is invalid. Please contact the app owner.";
39
+ PaymentValidationErrors2["InvalidAppId"] = "The app ID is invalid. Please contact the app owner.";
40
+ PaymentValidationErrors2["DuplicateReference"] = "This reference ID already exists please generate a new one and try again.";
41
+ return PaymentValidationErrors2;
42
+ })(PaymentValidationErrors || {});
43
+ var WalletAuthErrorCodes = /* @__PURE__ */ ((WalletAuthErrorCodes2) => {
44
+ WalletAuthErrorCodes2["MalformedRequest"] = "malformed_request";
45
+ WalletAuthErrorCodes2["UserRejected"] = "user_rejected";
46
+ WalletAuthErrorCodes2["GenericError"] = "generic_error";
47
+ return WalletAuthErrorCodes2;
48
+ })(WalletAuthErrorCodes || {});
49
+ var WalletAuthErrorMessage = {
50
+ ["malformed_request" /* MalformedRequest */]: "Provided parameters in the request are invalid.",
51
+ ["user_rejected" /* UserRejected */]: "User rejected the request.",
52
+ ["generic_error" /* GenericError */]: "Something unexpected went wrong."
53
+ };
54
+ var SendTransactionErrorCodes = /* @__PURE__ */ ((SendTransactionErrorCodes2) => {
55
+ SendTransactionErrorCodes2["InvalidOperation"] = "invalid_operation";
56
+ SendTransactionErrorCodes2["UserRejected"] = "user_rejected";
57
+ SendTransactionErrorCodes2["InputError"] = "input_error";
58
+ SendTransactionErrorCodes2["SimulationFailed"] = "simulation_failed";
59
+ SendTransactionErrorCodes2["TransactionFailed"] = "transaction_failed";
60
+ SendTransactionErrorCodes2["GenericError"] = "generic_error";
61
+ SendTransactionErrorCodes2["DisallowedOperation"] = "disallowed_operation";
62
+ SendTransactionErrorCodes2["InvalidContract"] = "invalid_contract";
63
+ SendTransactionErrorCodes2["MaliciousOperation"] = "malicious_operation";
64
+ return SendTransactionErrorCodes2;
65
+ })(SendTransactionErrorCodes || {});
66
+ var SendTransactionErrorMessage = {
67
+ ["invalid_operation" /* InvalidOperation */]: "Transaction included an operation that was invalid",
68
+ ["user_rejected" /* UserRejected */]: "User rejected the request.",
69
+ ["input_error" /* InputError */]: "Invalid payload.",
70
+ ["simulation_failed" /* SimulationFailed */]: "The transaction simulation failed.",
71
+ ["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again later.",
72
+ ["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
73
+ ["disallowed_operation" /* DisallowedOperation */]: "The operation requested is not allowed. Please refer to the docs.",
74
+ ["invalid_contract" /* InvalidContract */]: "The contract address is not allowed for your application. Please check your developer portal configurations",
75
+ ["malicious_operation" /* MaliciousOperation */]: "The operation requested is considered malicious."
76
+ };
77
+ var SignMessageErrorCodes = /* @__PURE__ */ ((SignMessageErrorCodes2) => {
78
+ SignMessageErrorCodes2["InvalidMessage"] = "invalid_message";
79
+ SignMessageErrorCodes2["UserRejected"] = "user_rejected";
80
+ SignMessageErrorCodes2["GenericError"] = "generic_error";
81
+ return SignMessageErrorCodes2;
82
+ })(SignMessageErrorCodes || {});
83
+ var SignMessageErrorMessage = {
84
+ ["invalid_message" /* InvalidMessage */]: "Invalid message requested",
85
+ ["user_rejected" /* UserRejected */]: "User rejected the request.",
86
+ ["generic_error" /* GenericError */]: "Something unexpected went wrong."
87
+ };
88
+ var SignTypedDataErrorCodes = /* @__PURE__ */ ((SignTypedDataErrorCodes2) => {
89
+ SignTypedDataErrorCodes2["InvalidOperation"] = "invalid_operation";
90
+ SignTypedDataErrorCodes2["UserRejected"] = "user_rejected";
91
+ SignTypedDataErrorCodes2["InputError"] = "input_error";
92
+ SignTypedDataErrorCodes2["SimulationFailed"] = "simulation_failed";
93
+ SignTypedDataErrorCodes2["GenericError"] = "generic_error";
94
+ SignTypedDataErrorCodes2["DisallowedOperation"] = "disallowed_operation";
95
+ SignTypedDataErrorCodes2["InvalidContract"] = "invalid_contract";
96
+ SignTypedDataErrorCodes2["MaliciousOperation"] = "malicious_operation";
97
+ return SignTypedDataErrorCodes2;
98
+ })(SignTypedDataErrorCodes || {});
99
+ var SignTypedDataErrorMessage = SendTransactionErrorMessage;
100
+ var MiniKitInstallErrorCodes = /* @__PURE__ */ ((MiniKitInstallErrorCodes2) => {
101
+ MiniKitInstallErrorCodes2["Unknown"] = "unknown";
102
+ MiniKitInstallErrorCodes2["AlreadyInstalled"] = "already_installed";
103
+ MiniKitInstallErrorCodes2["OutsideOfWorldApp"] = "outside_of_worldapp";
104
+ MiniKitInstallErrorCodes2["NotOnClient"] = "not_on_client";
105
+ MiniKitInstallErrorCodes2["AppOutOfDate"] = "app_out_of_date";
106
+ return MiniKitInstallErrorCodes2;
107
+ })(MiniKitInstallErrorCodes || {});
108
+ var MiniKitInstallErrorMessage = {
109
+ ["unknown" /* Unknown */]: "Failed to install MiniKit.",
110
+ ["already_installed" /* AlreadyInstalled */]: "MiniKit is already installed.",
111
+ ["outside_of_worldapp" /* OutsideOfWorldApp */]: "MiniApp launched outside of WorldApp.",
112
+ ["not_on_client" /* NotOnClient */]: "Window object is not available.",
113
+ ["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
114
+ };
115
+
116
+ // helpers/send-webview-event.ts
117
+ var sendWebviewEvent = (payload) => {
118
+ if (window.webkit) {
119
+ window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
120
+ } else if (window.Android) {
121
+ window.Android.postMessage?.(JSON.stringify(payload));
122
+ }
123
+ };
124
+
125
+ // types/commands.ts
126
+ var Command = /* @__PURE__ */ ((Command2) => {
127
+ Command2["Verify"] = "verify";
128
+ Command2["Pay"] = "pay";
129
+ Command2["WalletAuth"] = "wallet-auth";
130
+ Command2["SendTransaction"] = "send-transaction";
131
+ Command2["SignMessage"] = "sign-message";
132
+ Command2["SignTypedData"] = "sign-typed-data";
133
+ return Command2;
134
+ })(Command || {});
135
+
136
+ // types/responses.ts
137
+ var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
138
+ ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
139
+ ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
140
+ ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
141
+ ResponseEvent2["MiniAppSendTransaction"] = "miniapp-send-transaction";
142
+ ResponseEvent2["MiniAppSignMessage"] = "miniapp-sign-message";
143
+ ResponseEvent2["MiniAppSignTypedData"] = "miniapp-sign-typed-data";
144
+ return ResponseEvent2;
145
+ })(ResponseEvent || {});
146
+
147
+ // types/payment.ts
148
+ var Tokens = /* @__PURE__ */ ((Tokens2) => {
149
+ Tokens2["USDCE"] = "USDCE";
150
+ Tokens2["WLD"] = "WLD";
151
+ return Tokens2;
152
+ })(Tokens || {});
153
+ var TokenDecimals = {
154
+ ["USDCE" /* USDCE */]: 6,
155
+ ["WLD" /* WLD */]: 18
156
+ };
157
+ var Network = /* @__PURE__ */ ((Network2) => {
158
+ Network2["Optimism"] = "optimism";
159
+ Network2["WorldChain"] = "worldchain";
160
+ return Network2;
161
+ })(Network || {});
162
+
163
+ // minikit.ts
164
+ import { VerificationLevel } from "@worldcoin/idkit-core";
165
+
166
+ // helpers/siwe/validate-wallet-auth-command-input.ts
167
+ var validateWalletAuthCommandInput = (params) => {
168
+ if (!params.nonce) {
169
+ return { valid: false, message: "'nonce' is required" };
170
+ }
171
+ if (params.nonce.length < 8) {
172
+ return { valid: false, message: "'nonce' must be at least 8 characters" };
173
+ }
174
+ if (params.statement && params.statement.includes("\n")) {
175
+ return { valid: false, message: "'statement' must not contain newlines" };
176
+ }
177
+ if (params.expirationTime && new Date(params.expirationTime) < /* @__PURE__ */ new Date()) {
178
+ return { valid: false, message: "'expirationTime' must be in the future" };
179
+ }
180
+ if (params.expirationTime && new Date(params.expirationTime) > new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3)) {
181
+ return { valid: false, message: "'expirationTime' must be within 7 days" };
182
+ }
183
+ if (params.notBefore && new Date(params.notBefore) > new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3)) {
184
+ return { valid: false, message: "'notBefore' must be within 7 days" };
185
+ }
186
+ return { valid: true };
187
+ };
188
+
1
189
  // helpers/siwe/siwe.ts
2
- import { ethers } from "ethers";
190
+ import {
191
+ hashMessage,
192
+ createPublicClient,
193
+ http,
194
+ getContract
195
+ } from "viem";
196
+ import { optimism } from "viem/chains";
3
197
  var PREAMBLE = " wants you to sign in with your Ethereum account:";
4
198
  var URI_TAG = "URI: ";
5
199
  var VERSION_TAG = "Version: ";
@@ -152,158 +346,27 @@ var verifySiweMessage = async (payload, nonce, statement, requestId, userProvide
152
346
  `Request ID mismatch. Got: ${siweMessageData.request_id}, Expected: ${requestId}`
153
347
  );
154
348
  }
155
- let provider = userProvider || ethers.getDefaultProvider("https://mainnet.optimism.io");
349
+ let provider = userProvider || createPublicClient({ chain: optimism, transport: http() });
156
350
  const signedMessage = `${ERC_191_PREFIX}${message.length}${message}`;
157
351
  const messageBytes = Buffer.from(signedMessage, "utf8").toString("hex");
158
- const hashedMessage = ethers.hashMessage(signedMessage);
159
- const contract = new ethers.Contract(address, SAFE_CONTRACT_ABI, provider);
352
+ const hashedMessage = hashMessage(signedMessage);
353
+ const contract = getContract({
354
+ address,
355
+ abi: SAFE_CONTRACT_ABI,
356
+ client: provider
357
+ });
160
358
  try {
161
- await contract.checkSignatures(
359
+ await contract.read.checkSignatures([
162
360
  hashedMessage,
163
361
  `0x${messageBytes}`,
164
362
  `0x${signature}`
165
- );
363
+ ]);
166
364
  } catch (error) {
167
365
  throw new Error("Signature verification failed");
168
366
  }
169
367
  return { isValid: true, siweMessageData };
170
368
  };
171
369
 
172
- // types/errors.ts
173
- import { AppErrorCodes } from "@worldcoin/idkit-core";
174
- import { AppErrorCodes as AppErrorCodes2 } from "@worldcoin/idkit-core";
175
- var VerificationErrorMessage = {
176
- [AppErrorCodes.VerificationRejected]: "You\u2019ve cancelled the request in World App.",
177
- [AppErrorCodes.MaxVerificationsReached]: "You have already verified the maximum number of times for this action.",
178
- [AppErrorCodes.CredentialUnavailable]: "It seems you do not have the verification level required by this app.",
179
- [AppErrorCodes.MalformedRequest]: "There was a problem with this request. Please try again or contact the app owner.",
180
- [AppErrorCodes.InvalidNetwork]: "Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details.",
181
- [AppErrorCodes.InclusionProofFailed]: "There was an issue fetching your credential. Please try again.",
182
- [AppErrorCodes.InclusionProofPending]: "Your identity is still being registered. Please wait a few minutes and try again.",
183
- [AppErrorCodes.UnexpectedResponse]: "Unexpected response from your wallet. Please try again.",
184
- [AppErrorCodes.FailedByHostApp]: "Verification failed by the app. Please contact the app owner for details.",
185
- [AppErrorCodes.GenericError]: "Something unexpected went wrong. Please try again.",
186
- [AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
187
- };
188
- var PaymentErrorCodes = /* @__PURE__ */ ((PaymentErrorCodes2) => {
189
- PaymentErrorCodes2["InputError"] = "input_error";
190
- PaymentErrorCodes2["PaymentRejected"] = "payment_rejected";
191
- PaymentErrorCodes2["InvalidReceiver"] = "invalid_receiver";
192
- PaymentErrorCodes2["InsufficientBalance"] = "insufficient_balance";
193
- PaymentErrorCodes2["TransactionFailed"] = "transaction_failed";
194
- PaymentErrorCodes2["GenericError"] = "generic_error";
195
- PaymentErrorCodes2["UserBlocked"] = "user_blocked";
196
- return PaymentErrorCodes2;
197
- })(PaymentErrorCodes || {});
198
- var PaymentErrorMessage = {
199
- ["input_error" /* InputError */]: "There was a problem with this request. Please try again or contact the app owner.",
200
- ["payment_rejected" /* PaymentRejected */]: "You\u2019ve cancelled the payment in World App.",
201
- ["invalid_receiver" /* InvalidReceiver */]: "The receiver address is invalid. Please contact the app owner.",
202
- ["insufficient_balance" /* InsufficientBalance */]: "You do not have enough balance to complete this transaction.",
203
- ["transaction_failed" /* TransactionFailed */]: "The transaction failed. Please try again.",
204
- ["generic_error" /* GenericError */]: "Something unexpected went wrong. Please try again.",
205
- ["user_blocked" /* UserBlocked */]: "User's region is blocked from making payments."
206
- };
207
- var PaymentValidationErrors = /* @__PURE__ */ ((PaymentValidationErrors2) => {
208
- PaymentValidationErrors2["MalformedRequest"] = "There was a problem with this request. Please try again or contact the app owner.";
209
- PaymentValidationErrors2["InvalidTokenAddress"] = "The token address is invalid. Please contact the app owner.";
210
- PaymentValidationErrors2["InvalidAppId"] = "The app ID is invalid. Please contact the app owner.";
211
- PaymentValidationErrors2["DuplicateReference"] = "This reference ID already exists please generate a new one and try again.";
212
- return PaymentValidationErrors2;
213
- })(PaymentValidationErrors || {});
214
- var WalletAuthErrorCodes = /* @__PURE__ */ ((WalletAuthErrorCodes2) => {
215
- WalletAuthErrorCodes2["MalformedRequest"] = "malformed_request";
216
- WalletAuthErrorCodes2["UserRejected"] = "user_rejected";
217
- WalletAuthErrorCodes2["GenericError"] = "generic_error";
218
- return WalletAuthErrorCodes2;
219
- })(WalletAuthErrorCodes || {});
220
- var WalletAuthErrorMessage = {
221
- ["malformed_request" /* MalformedRequest */]: "Provided parameters in the request are invalid.",
222
- ["user_rejected" /* UserRejected */]: "User rejected the request.",
223
- ["generic_error" /* GenericError */]: "Something unexpected went wrong."
224
- };
225
- var MiniKitInstallErrorCode = /* @__PURE__ */ ((MiniKitInstallErrorCode2) => {
226
- MiniKitInstallErrorCode2["Unknown"] = "unknown";
227
- MiniKitInstallErrorCode2["AlreadyInstalled"] = "already_installed";
228
- MiniKitInstallErrorCode2["OutsideOfWorldApp"] = "outside_of_worldapp";
229
- MiniKitInstallErrorCode2["NotOnClient"] = "not_on_client";
230
- MiniKitInstallErrorCode2["AppOutOfDate"] = "app_out_of_date";
231
- return MiniKitInstallErrorCode2;
232
- })(MiniKitInstallErrorCode || {});
233
- var MiniKitInstallErrorMessage = {
234
- ["unknown" /* Unknown */]: "Failed to install MiniKit.",
235
- ["already_installed" /* AlreadyInstalled */]: "MiniKit is already installed.",
236
- ["outside_of_worldapp" /* OutsideOfWorldApp */]: "MiniApp launched outside of WorldApp.",
237
- ["not_on_client" /* NotOnClient */]: "Window object is not available.",
238
- ["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
239
- };
240
-
241
- // helpers/send-webview-event.ts
242
- var sendWebviewEvent = (payload) => {
243
- if (window.webkit) {
244
- window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
245
- } else if (window.Android) {
246
- window.Android.postMessage?.(JSON.stringify(payload));
247
- }
248
- };
249
-
250
- // types/commands.ts
251
- var Command = /* @__PURE__ */ ((Command2) => {
252
- Command2["Verify"] = "verify";
253
- Command2["Pay"] = "pay";
254
- Command2["WalletAuth"] = "wallet-auth";
255
- return Command2;
256
- })(Command || {});
257
-
258
- // types/responses.ts
259
- var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
260
- ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
261
- ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
262
- ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
263
- return ResponseEvent2;
264
- })(ResponseEvent || {});
265
-
266
- // types/payment.ts
267
- var Tokens = /* @__PURE__ */ ((Tokens2) => {
268
- Tokens2["USDCE"] = "USDCE";
269
- Tokens2["WLD"] = "WLD";
270
- return Tokens2;
271
- })(Tokens || {});
272
- var TokenDecimals = {
273
- ["USDCE" /* USDCE */]: 6,
274
- ["WLD" /* WLD */]: 18
275
- };
276
- var Network = /* @__PURE__ */ ((Network2) => {
277
- Network2["Optimism"] = "optimism";
278
- return Network2;
279
- })(Network || {});
280
-
281
- // minikit.ts
282
- import { VerificationLevel } from "@worldcoin/idkit-core";
283
-
284
- // helpers/siwe/validate-wallet-auth-command-input.ts
285
- var validateWalletAuthCommandInput = (params) => {
286
- if (!params.nonce) {
287
- return { valid: false, message: "'nonce' is required" };
288
- }
289
- if (params.nonce.length < 8) {
290
- return { valid: false, message: "'nonce' must be at least 8 characters" };
291
- }
292
- if (params.statement && params.statement.includes("\n")) {
293
- return { valid: false, message: "'statement' must not contain newlines" };
294
- }
295
- if (params.expirationTime && new Date(params.expirationTime) < /* @__PURE__ */ new Date()) {
296
- return { valid: false, message: "'expirationTime' must be in the future" };
297
- }
298
- if (params.expirationTime && new Date(params.expirationTime) > new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3)) {
299
- return { valid: false, message: "'expirationTime' must be within 7 days" };
300
- }
301
- if (params.notBefore && new Date(params.notBefore) > new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3)) {
302
- return { valid: false, message: "'notBefore' must be within 7 days" };
303
- }
304
- return { valid: true };
305
- };
306
-
307
370
  // helpers/payment/client.ts
308
371
  var tokenToDecimals = (amount, token) => {
309
372
  const decimals = TokenDecimals[token];
@@ -399,8 +462,7 @@ var _MiniKit = class _MiniKit {
399
462
  return { success: true };
400
463
  }
401
464
  static isInstalled(debug) {
402
- if (debug)
403
- console.log("MiniKit is alive!");
465
+ if (debug) console.log("MiniKit is alive!");
404
466
  return Boolean(window.MiniKit);
405
467
  }
406
468
  };
@@ -408,7 +470,10 @@ _MiniKit.MINIKIT_VERSION = 1;
408
470
  _MiniKit.commandVersion = {
409
471
  ["verify" /* Verify */]: 1,
410
472
  ["pay" /* Pay */]: 1,
411
- ["wallet-auth" /* WalletAuth */]: 1
473
+ ["wallet-auth" /* WalletAuth */]: 1,
474
+ ["send-transaction" /* SendTransaction */]: 1,
475
+ ["sign-message" /* SignMessage */]: 1,
476
+ ["sign-typed-data" /* SignTypedData */]: 1
412
477
  };
413
478
  _MiniKit.listeners = {
414
479
  ["miniapp-verify-action" /* MiniAppVerifyAction */]: () => {
@@ -416,6 +481,12 @@ _MiniKit.listeners = {
416
481
  ["miniapp-payment" /* MiniAppPayment */]: () => {
417
482
  },
418
483
  ["miniapp-wallet-auth" /* MiniAppWalletAuth */]: () => {
484
+ },
485
+ ["miniapp-send-transaction" /* MiniAppSendTransaction */]: () => {
486
+ },
487
+ ["miniapp-sign-message" /* MiniAppSignMessage */]: () => {
488
+ },
489
+ ["miniapp-sign-typed-data" /* MiniAppSignTypedData */]: () => {
419
490
  }
420
491
  };
421
492
  _MiniKit.commands = {
@@ -500,8 +571,29 @@ _MiniKit.commands = {
500
571
  });
501
572
  return walletAuthPayload;
502
573
  },
503
- closeWebview: () => {
504
- sendWebviewEvent({ command: "close" });
574
+ sendTransaction: (payload) => {
575
+ sendMiniKitEvent({
576
+ command: "send-transaction" /* SendTransaction */,
577
+ version: 1,
578
+ payload
579
+ });
580
+ return payload;
581
+ },
582
+ signMessage: (payload) => {
583
+ sendMiniKitEvent({
584
+ command: "sign-message" /* SignMessage */,
585
+ version: 1,
586
+ payload
587
+ });
588
+ return payload;
589
+ },
590
+ signTypedData: (payload) => {
591
+ sendMiniKitEvent({
592
+ command: "sign-typed-data" /* SignTypedData */,
593
+ version: 1,
594
+ payload
595
+ });
596
+ return payload;
505
597
  }
506
598
  };
507
599
  var MiniKit = _MiniKit;
@@ -514,7 +606,7 @@ import {
514
606
  export {
515
607
  Command,
516
608
  MiniKit,
517
- MiniKitInstallErrorCode,
609
+ MiniKitInstallErrorCodes,
518
610
  MiniKitInstallErrorMessage,
519
611
  Network,
520
612
  PaymentErrorCodes,
@@ -522,6 +614,12 @@ export {
522
614
  PaymentValidationErrors,
523
615
  ResponseEvent,
524
616
  SAFE_CONTRACT_ABI,
617
+ SendTransactionErrorCodes,
618
+ SendTransactionErrorMessage,
619
+ SignMessageErrorCodes,
620
+ SignMessageErrorMessage,
621
+ SignTypedDataErrorCodes,
622
+ SignTypedDataErrorMessage,
525
623
  TokenDecimals,
526
624
  Tokens,
527
625
  AppErrorCodes2 as VerificationErrorCodes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/minikit-js",
3
- "version": "0.0.26-internal-alpha",
3
+ "version": "0.0.28-internal-alpha",
4
4
  "homepage": "https://docs.worldcoin.org/id/minikit",
5
5
  "description": "Internal Alpha: Mini-kit JS is a lightweight sdk for building mini-apps compatible with World App",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  }
15
15
  },
16
16
  "engines": {
17
- "node": ">=12.4"
17
+ "node": ">=18"
18
18
  },
19
19
  "files": [
20
20
  "./build/**",
@@ -25,24 +25,26 @@
25
25
  "miniapps"
26
26
  ],
27
27
  "dependencies": {
28
- "@worldcoin/idkit-core": "^1.2.2"
28
+ "@worldcoin/idkit-core": "^1.3.0",
29
+ "abitype": "^1.0.6",
30
+ "turbo": "^2.1.1"
29
31
  },
30
32
  "devDependencies": {
33
+ "@types/node": "^20",
31
34
  "@typescript-eslint/eslint-plugin": "^7.7.0",
32
35
  "@typescript-eslint/parser": "^7.7.0",
33
36
  "prettier": "^3.2.5",
34
37
  "prettier-plugin-sort-imports-desc": "^1.0.0",
35
38
  "tsup": "^8.0.2",
36
- "turbo": "^1.13.2",
37
39
  "typescript": "^5.4.5"
38
40
  },
39
41
  "peerDependencies": {
40
- "ethers": "^6.0.8"
42
+ "viem": "^2.0.0"
41
43
  },
42
44
  "scripts": {
43
45
  "build": "tsup",
44
46
  "dev": "tsup --watch",
45
47
  "lint": "eslint ./ --ext .ts",
46
- "typecheck": "tsc --noEmit"
48
+ "type-check": "tsc --noEmit"
47
49
  }
48
50
  }