@worldcoin/minikit-js 0.0.31-internal-alpha → 0.0.33-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.cjs CHANGED
@@ -50,6 +50,53 @@ __export(src_exports, {
50
50
  });
51
51
  module.exports = __toCommonJS(src_exports);
52
52
 
53
+ // helpers/send-webview-event.ts
54
+ var sendWebviewEvent = (payload) => {
55
+ if (window.webkit) {
56
+ window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
57
+ } else if (window.Android) {
58
+ window.Android.postMessage?.(JSON.stringify(payload));
59
+ }
60
+ };
61
+
62
+ // types/commands.ts
63
+ var Command = /* @__PURE__ */ ((Command2) => {
64
+ Command2["Verify"] = "verify";
65
+ Command2["Pay"] = "pay";
66
+ Command2["WalletAuth"] = "wallet-auth";
67
+ Command2["SendTransaction"] = "send-transaction";
68
+ Command2["SignMessage"] = "sign-message";
69
+ Command2["SignTypedData"] = "sign-typed-data";
70
+ return Command2;
71
+ })(Command || {});
72
+
73
+ // types/responses.ts
74
+ var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
75
+ ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
76
+ ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
77
+ ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
78
+ ResponseEvent2["MiniAppSendTransaction"] = "miniapp-send-transaction";
79
+ ResponseEvent2["MiniAppSignMessage"] = "miniapp-sign-message";
80
+ ResponseEvent2["MiniAppSignTypedData"] = "miniapp-sign-typed-data";
81
+ return ResponseEvent2;
82
+ })(ResponseEvent || {});
83
+
84
+ // types/payment.ts
85
+ var Tokens = /* @__PURE__ */ ((Tokens2) => {
86
+ Tokens2["USDCE"] = "USDCE";
87
+ Tokens2["WLD"] = "WLD";
88
+ return Tokens2;
89
+ })(Tokens || {});
90
+ var TokenDecimals = {
91
+ ["USDCE" /* USDCE */]: 6,
92
+ ["WLD" /* WLD */]: 18
93
+ };
94
+ var Network = /* @__PURE__ */ ((Network2) => {
95
+ Network2["Optimism"] = "optimism";
96
+ Network2["WorldChain"] = "worldchain";
97
+ return Network2;
98
+ })(Network || {});
99
+
53
100
  // types/errors.ts
54
101
  var import_idkit_core = require("@worldcoin/idkit-core");
55
102
  var import_idkit_core2 = require("@worldcoin/idkit-core");
@@ -165,53 +212,6 @@ var MiniKitInstallErrorMessage = {
165
212
  ["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
166
213
  };
167
214
 
168
- // helpers/send-webview-event.ts
169
- var sendWebviewEvent = (payload) => {
170
- if (window.webkit) {
171
- window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
172
- } else if (window.Android) {
173
- window.Android.postMessage?.(JSON.stringify(payload));
174
- }
175
- };
176
-
177
- // types/commands.ts
178
- var Command = /* @__PURE__ */ ((Command2) => {
179
- Command2["Verify"] = "verify";
180
- Command2["Pay"] = "pay";
181
- Command2["WalletAuth"] = "wallet-auth";
182
- Command2["SendTransaction"] = "send-transaction";
183
- Command2["SignMessage"] = "sign-message";
184
- Command2["SignTypedData"] = "sign-typed-data";
185
- return Command2;
186
- })(Command || {});
187
-
188
- // types/responses.ts
189
- var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
190
- ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
191
- ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
192
- ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
193
- ResponseEvent2["MiniAppSendTransaction"] = "miniapp-send-transaction";
194
- ResponseEvent2["MiniAppSignMessage"] = "miniapp-sign-message";
195
- ResponseEvent2["MiniAppSignTypedData"] = "miniapp-sign-typed-data";
196
- return ResponseEvent2;
197
- })(ResponseEvent || {});
198
-
199
- // types/payment.ts
200
- var Tokens = /* @__PURE__ */ ((Tokens2) => {
201
- Tokens2["USDCE"] = "USDCE";
202
- Tokens2["WLD"] = "WLD";
203
- return Tokens2;
204
- })(Tokens || {});
205
- var TokenDecimals = {
206
- ["USDCE" /* USDCE */]: 6,
207
- ["WLD" /* WLD */]: 18
208
- };
209
- var Network = /* @__PURE__ */ ((Network2) => {
210
- Network2["Optimism"] = "optimism";
211
- Network2["WorldChain"] = "worldchain";
212
- return Network2;
213
- })(Network || {});
214
-
215
215
  // minikit.ts
216
216
  var import_idkit_core3 = require("@worldcoin/idkit-core");
217
217
 
@@ -533,7 +533,12 @@ var _MiniKit = class _MiniKit {
533
533
  }
534
534
  static isInstalled(debug) {
535
535
  if (debug) console.log("MiniKit is alive!");
536
- return Boolean(window.MiniKit);
536
+ const isInstalled = Boolean(window.MiniKit);
537
+ if (!isInstalled)
538
+ console.error(
539
+ "MiniKit is not installed. Make sure you're running the application inside of World App"
540
+ );
541
+ return isInstalled;
537
542
  }
538
543
  };
539
544
  _MiniKit.MINIKIT_VERSION = 1;
package/build/index.d.cts CHANGED
@@ -4,6 +4,36 @@ import { Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimit
4
4
  export { IVerifyResponse, verifyCloudProof } from '@worldcoin/idkit-core/backend';
5
5
  import { Client } from 'viem';
6
6
 
7
+ declare enum Tokens {
8
+ USDCE = "USDCE",
9
+ WLD = "WLD"
10
+ }
11
+ declare const TokenDecimals: {
12
+ [key in Tokens]: number;
13
+ };
14
+ declare enum Network {
15
+ Optimism = "optimism",
16
+ WorldChain = "worldchain"
17
+ }
18
+
19
+ type Permit2 = {
20
+ permitted: {
21
+ token: string;
22
+ amount: string | unknown;
23
+ };
24
+ spender: string;
25
+ nonce: string | unknown;
26
+ deadline: string | unknown;
27
+ };
28
+ type Transaction = {
29
+ address: string;
30
+ abi: Abi | readonly unknown[];
31
+ functionName: ContractFunctionName<Abi | readonly unknown[], "payable" | "nonpayable">;
32
+ args: ContractFunctionArgs<Abi | readonly unknown[], "payable" | "nonpayable", ContractFunctionName<Abi | readonly unknown[], "payable" | "nonpayable">>;
33
+ };
34
+ type ContractFunctionName<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability> = ExtractAbiFunctionNames<abi extends Abi ? abi : Abi, mutability> extends infer functionName extends string ? [functionName] extends [never] ? string : functionName : string;
35
+ type ContractFunctionArgs<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability, functionName extends ContractFunctionName<abi, mutability> = ContractFunctionName<abi, mutability>> = AbiParametersToPrimitiveTypes<ExtractAbiFunction<abi extends Abi ? abi : Abi, functionName, mutability>["inputs"], "inputs"> extends infer args ? [args] extends [never] ? readonly unknown[] : args : readonly unknown[];
36
+
7
37
  declare const VerificationErrorMessage: Record<AppErrorCodes, string>;
8
38
  declare enum PaymentErrorCodes {
9
39
  InputError = "input_error",
@@ -99,36 +129,6 @@ declare const MiniKitInstallErrorMessage: {
99
129
  app_out_of_date: string;
100
130
  };
101
131
 
102
- declare enum Tokens {
103
- USDCE = "USDCE",
104
- WLD = "WLD"
105
- }
106
- declare const TokenDecimals: {
107
- [key in Tokens]: number;
108
- };
109
- declare enum Network {
110
- Optimism = "optimism",
111
- WorldChain = "worldchain"
112
- }
113
-
114
- type Permit2 = {
115
- permitted: {
116
- token: string;
117
- amount: string | unknown;
118
- };
119
- spender: string;
120
- nonce: string | unknown;
121
- deadline: string | unknown;
122
- };
123
- type Transaction = {
124
- address: string;
125
- abi: Abi | readonly unknown[];
126
- functionName: ContractFunctionName<Abi | readonly unknown[], "payable" | "nonpayable">;
127
- args: ContractFunctionArgs<Abi | readonly unknown[], "payable" | "nonpayable", ContractFunctionName<Abi | readonly unknown[], "payable" | "nonpayable">>;
128
- };
129
- type ContractFunctionName<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability> = ExtractAbiFunctionNames<abi extends Abi ? abi : Abi, mutability> extends infer functionName extends string ? [functionName] extends [never] ? string : functionName : string;
130
- type ContractFunctionArgs<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability, functionName extends ContractFunctionName<abi, mutability> = ContractFunctionName<abi, mutability>> = AbiParametersToPrimitiveTypes<ExtractAbiFunction<abi extends Abi ? abi : Abi, functionName, mutability>["inputs"], "inputs"> extends infer args ? [args] extends [never] ? readonly unknown[] : args : readonly unknown[];
131
-
132
132
  declare enum Command {
133
133
  Verify = "verify",
134
134
  Pay = "pay",
@@ -261,6 +261,7 @@ type MiniAppSendTransactionSuccessPayload = {
261
261
  type MiniAppSendTransactionErrorPayload = {
262
262
  status: "error";
263
263
  error_code: SendTransactionErrorCodes;
264
+ debugUrl?: string;
264
265
  version: number;
265
266
  };
266
267
  type MiniAppSendTransactionPayload = MiniAppSendTransactionSuccessPayload | MiniAppSendTransactionErrorPayload;
@@ -273,6 +274,7 @@ type MiniAppSignMessageSuccessPayload = {
273
274
  type MiniAppSignMessageErrorPayload = {
274
275
  status: "error";
275
276
  error_code: SignMessageErrorCodes;
277
+ debugUrl?: string;
276
278
  version: number;
277
279
  };
278
280
  type MiniAppSignMessagePayload = MiniAppSignMessageSuccessPayload | MiniAppSignMessageErrorPayload;
@@ -285,6 +287,7 @@ type MiniAppSignTypedDataSuccessPayload = {
285
287
  type MiniAppSignTypedDataErrorPayload = {
286
288
  status: "error";
287
289
  error_code: SignTypedDataErrorCodes;
290
+ debugUrl?: string;
288
291
  version: number;
289
292
  };
290
293
  type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
package/build/index.d.ts CHANGED
@@ -4,6 +4,36 @@ import { Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimit
4
4
  export { IVerifyResponse, verifyCloudProof } from '@worldcoin/idkit-core/backend';
5
5
  import { Client } from 'viem';
6
6
 
7
+ declare enum Tokens {
8
+ USDCE = "USDCE",
9
+ WLD = "WLD"
10
+ }
11
+ declare const TokenDecimals: {
12
+ [key in Tokens]: number;
13
+ };
14
+ declare enum Network {
15
+ Optimism = "optimism",
16
+ WorldChain = "worldchain"
17
+ }
18
+
19
+ type Permit2 = {
20
+ permitted: {
21
+ token: string;
22
+ amount: string | unknown;
23
+ };
24
+ spender: string;
25
+ nonce: string | unknown;
26
+ deadline: string | unknown;
27
+ };
28
+ type Transaction = {
29
+ address: string;
30
+ abi: Abi | readonly unknown[];
31
+ functionName: ContractFunctionName<Abi | readonly unknown[], "payable" | "nonpayable">;
32
+ args: ContractFunctionArgs<Abi | readonly unknown[], "payable" | "nonpayable", ContractFunctionName<Abi | readonly unknown[], "payable" | "nonpayable">>;
33
+ };
34
+ type ContractFunctionName<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability> = ExtractAbiFunctionNames<abi extends Abi ? abi : Abi, mutability> extends infer functionName extends string ? [functionName] extends [never] ? string : functionName : string;
35
+ type ContractFunctionArgs<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability, functionName extends ContractFunctionName<abi, mutability> = ContractFunctionName<abi, mutability>> = AbiParametersToPrimitiveTypes<ExtractAbiFunction<abi extends Abi ? abi : Abi, functionName, mutability>["inputs"], "inputs"> extends infer args ? [args] extends [never] ? readonly unknown[] : args : readonly unknown[];
36
+
7
37
  declare const VerificationErrorMessage: Record<AppErrorCodes, string>;
8
38
  declare enum PaymentErrorCodes {
9
39
  InputError = "input_error",
@@ -99,36 +129,6 @@ declare const MiniKitInstallErrorMessage: {
99
129
  app_out_of_date: string;
100
130
  };
101
131
 
102
- declare enum Tokens {
103
- USDCE = "USDCE",
104
- WLD = "WLD"
105
- }
106
- declare const TokenDecimals: {
107
- [key in Tokens]: number;
108
- };
109
- declare enum Network {
110
- Optimism = "optimism",
111
- WorldChain = "worldchain"
112
- }
113
-
114
- type Permit2 = {
115
- permitted: {
116
- token: string;
117
- amount: string | unknown;
118
- };
119
- spender: string;
120
- nonce: string | unknown;
121
- deadline: string | unknown;
122
- };
123
- type Transaction = {
124
- address: string;
125
- abi: Abi | readonly unknown[];
126
- functionName: ContractFunctionName<Abi | readonly unknown[], "payable" | "nonpayable">;
127
- args: ContractFunctionArgs<Abi | readonly unknown[], "payable" | "nonpayable", ContractFunctionName<Abi | readonly unknown[], "payable" | "nonpayable">>;
128
- };
129
- type ContractFunctionName<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability> = ExtractAbiFunctionNames<abi extends Abi ? abi : Abi, mutability> extends infer functionName extends string ? [functionName] extends [never] ? string : functionName : string;
130
- type ContractFunctionArgs<abi extends Abi | readonly unknown[] = Abi, mutability extends AbiStateMutability = AbiStateMutability, functionName extends ContractFunctionName<abi, mutability> = ContractFunctionName<abi, mutability>> = AbiParametersToPrimitiveTypes<ExtractAbiFunction<abi extends Abi ? abi : Abi, functionName, mutability>["inputs"], "inputs"> extends infer args ? [args] extends [never] ? readonly unknown[] : args : readonly unknown[];
131
-
132
132
  declare enum Command {
133
133
  Verify = "verify",
134
134
  Pay = "pay",
@@ -261,6 +261,7 @@ type MiniAppSendTransactionSuccessPayload = {
261
261
  type MiniAppSendTransactionErrorPayload = {
262
262
  status: "error";
263
263
  error_code: SendTransactionErrorCodes;
264
+ debugUrl?: string;
264
265
  version: number;
265
266
  };
266
267
  type MiniAppSendTransactionPayload = MiniAppSendTransactionSuccessPayload | MiniAppSendTransactionErrorPayload;
@@ -273,6 +274,7 @@ type MiniAppSignMessageSuccessPayload = {
273
274
  type MiniAppSignMessageErrorPayload = {
274
275
  status: "error";
275
276
  error_code: SignMessageErrorCodes;
277
+ debugUrl?: string;
276
278
  version: number;
277
279
  };
278
280
  type MiniAppSignMessagePayload = MiniAppSignMessageSuccessPayload | MiniAppSignMessageErrorPayload;
@@ -285,6 +287,7 @@ type MiniAppSignTypedDataSuccessPayload = {
285
287
  type MiniAppSignTypedDataErrorPayload = {
286
288
  status: "error";
287
289
  error_code: SignTypedDataErrorCodes;
290
+ debugUrl?: string;
288
291
  version: number;
289
292
  };
290
293
  type MiniAppSignTypedDataPayload = MiniAppSignTypedDataSuccessPayload | MiniAppSignTypedDataErrorPayload;
package/build/index.js CHANGED
@@ -1,3 +1,50 @@
1
+ // helpers/send-webview-event.ts
2
+ var sendWebviewEvent = (payload) => {
3
+ if (window.webkit) {
4
+ window.webkit?.messageHandlers?.minikit?.postMessage?.(payload);
5
+ } else if (window.Android) {
6
+ window.Android.postMessage?.(JSON.stringify(payload));
7
+ }
8
+ };
9
+
10
+ // types/commands.ts
11
+ var Command = /* @__PURE__ */ ((Command2) => {
12
+ Command2["Verify"] = "verify";
13
+ Command2["Pay"] = "pay";
14
+ Command2["WalletAuth"] = "wallet-auth";
15
+ Command2["SendTransaction"] = "send-transaction";
16
+ Command2["SignMessage"] = "sign-message";
17
+ Command2["SignTypedData"] = "sign-typed-data";
18
+ return Command2;
19
+ })(Command || {});
20
+
21
+ // types/responses.ts
22
+ var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
23
+ ResponseEvent2["MiniAppVerifyAction"] = "miniapp-verify-action";
24
+ ResponseEvent2["MiniAppPayment"] = "miniapp-payment";
25
+ ResponseEvent2["MiniAppWalletAuth"] = "miniapp-wallet-auth";
26
+ ResponseEvent2["MiniAppSendTransaction"] = "miniapp-send-transaction";
27
+ ResponseEvent2["MiniAppSignMessage"] = "miniapp-sign-message";
28
+ ResponseEvent2["MiniAppSignTypedData"] = "miniapp-sign-typed-data";
29
+ return ResponseEvent2;
30
+ })(ResponseEvent || {});
31
+
32
+ // types/payment.ts
33
+ var Tokens = /* @__PURE__ */ ((Tokens2) => {
34
+ Tokens2["USDCE"] = "USDCE";
35
+ Tokens2["WLD"] = "WLD";
36
+ return Tokens2;
37
+ })(Tokens || {});
38
+ var TokenDecimals = {
39
+ ["USDCE" /* USDCE */]: 6,
40
+ ["WLD" /* WLD */]: 18
41
+ };
42
+ var Network = /* @__PURE__ */ ((Network2) => {
43
+ Network2["Optimism"] = "optimism";
44
+ Network2["WorldChain"] = "worldchain";
45
+ return Network2;
46
+ })(Network || {});
47
+
1
48
  // types/errors.ts
2
49
  import { AppErrorCodes } from "@worldcoin/idkit-core";
3
50
  import { AppErrorCodes as AppErrorCodes2 } from "@worldcoin/idkit-core";
@@ -113,53 +160,6 @@ var MiniKitInstallErrorMessage = {
113
160
  ["app_out_of_date" /* AppOutOfDate */]: "WorldApp is out of date. Please update the app."
114
161
  };
115
162
 
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
163
  // minikit.ts
164
164
  import { VerificationLevel } from "@worldcoin/idkit-core";
165
165
 
@@ -486,7 +486,12 @@ var _MiniKit = class _MiniKit {
486
486
  }
487
487
  static isInstalled(debug) {
488
488
  if (debug) console.log("MiniKit is alive!");
489
- return Boolean(window.MiniKit);
489
+ const isInstalled = Boolean(window.MiniKit);
490
+ if (!isInstalled)
491
+ console.error(
492
+ "MiniKit is not installed. Make sure you're running the application inside of World App"
493
+ );
494
+ return isInstalled;
490
495
  }
491
496
  };
492
497
  _MiniKit.MINIKIT_VERSION = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/minikit-js",
3
- "version": "0.0.31-internal-alpha",
3
+ "version": "0.0.33-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",
@@ -8,13 +8,18 @@
8
8
  "type": "module",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./build/index.js",
12
- "types": "./build/index.d.ts",
13
- "require": "./build/index.cjs"
11
+ "import": {
12
+ "types": "./build/index.d.ts",
13
+ "default": "./build/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./build/index.d.cts",
17
+ "default": "./build/index.cjs"
18
+ }
14
19
  }
15
20
  },
16
21
  "engines": {
17
- "node": ">=18"
22
+ "node": ">=16"
18
23
  },
19
24
  "files": [
20
25
  "./build/**",