@worldcoin/minikit-js 0.0.2 → 0.0.21-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
@@ -182,13 +182,19 @@ var verifySiweMessage = async (payload, nonce, statement, requestId, userProvide
182
182
  }
183
183
  }
184
184
  if (nonce && siweMessageData.nonce !== nonce) {
185
- throw new Error("Nonce mismatch");
185
+ throw new Error(
186
+ `Nonce mismatch. Got: ${siweMessageData.nonce}, Expected: ${nonce}`
187
+ );
186
188
  }
187
189
  if (statement && siweMessageData.statement !== statement) {
188
- throw new Error("Statement mismatch");
190
+ throw new Error(
191
+ `Statement mismatch. Got: ${siweMessageData.statement}, Expected: ${statement}`
192
+ );
189
193
  }
190
194
  if (requestId && siweMessageData.request_id !== requestId) {
191
- throw new Error("Request ID mismatch");
195
+ throw new Error(
196
+ `Request ID mismatch. Got: ${siweMessageData.request_id}, Expected: ${requestId}`
197
+ );
192
198
  }
193
199
  let provider = userProvider || import_ethers.ethers.getDefaultProvider("https://mainnet.optimism.io");
194
200
  const signedMessage = `${ERC_191_PREFIX}${message.length}${message}`;
@@ -199,7 +205,7 @@ var verifySiweMessage = async (payload, nonce, statement, requestId, userProvide
199
205
  await contract.checkSignatures(
200
206
  hashedMessage,
201
207
  `0x${messageBytes}`,
202
- signature
208
+ `0x${signature}`
203
209
  );
204
210
  } catch (error) {
205
211
  throw new Error("Signature verification failed");
@@ -231,15 +237,12 @@ var VerificationErrorMessage = {
231
237
  [import_idkit_core.AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
232
238
  };
233
239
  var PaymentErrorCodes = /* @__PURE__ */ ((PaymentErrorCodes2) => {
234
- PaymentErrorCodes2["MalformedRequest"] = "malformed_request";
240
+ PaymentErrorCodes2["InputError"] = "input_error";
235
241
  PaymentErrorCodes2["PaymentRejected"] = "payment_rejected";
236
242
  PaymentErrorCodes2["InvalidReceiver"] = "invalid_receiver";
237
243
  PaymentErrorCodes2["InsufficientBalance"] = "insufficient_balance";
238
244
  PaymentErrorCodes2["TransactionFailed"] = "transaction_failed";
239
- PaymentErrorCodes2["InvalidTokenAddress"] = "invalid_token_address";
240
- PaymentErrorCodes2["InvalidAppId"] = "invalid_app_id";
241
245
  PaymentErrorCodes2["GenericError"] = "generic_error";
242
- PaymentErrorCodes2["DuplicateReference"] = "duplicate_reference";
243
246
  return PaymentErrorCodes2;
244
247
  })(PaymentErrorCodes || {});
245
248
  var PaymentErrorMessage = /* @__PURE__ */ ((PaymentErrorMessage2) => {
@@ -293,12 +296,12 @@ var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
293
296
 
294
297
  // types/payment.ts
295
298
  var Tokens = /* @__PURE__ */ ((Tokens2) => {
296
- Tokens2["USDC"] = "USDC";
299
+ Tokens2["USDCE"] = "USDCE";
297
300
  Tokens2["WLD"] = "WLD";
298
301
  return Tokens2;
299
302
  })(Tokens || {});
300
303
  var TokenDecimals = {
301
- ["USDC" /* USDC */]: 6,
304
+ ["USDCE" /* USDCE */]: 6,
302
305
  ["WLD" /* WLD */]: 18
303
306
  };
304
307
  var Network = /* @__PURE__ */ ((Network2) => {
package/build/index.d.cts CHANGED
@@ -19,7 +19,7 @@ type SiweMessage = {
19
19
  };
20
20
 
21
21
  declare enum Tokens {
22
- USDC = "USDC",
22
+ USDCE = "USDCE",
23
23
  WLD = "WLD"
24
24
  }
25
25
  declare const TokenDecimals: {
@@ -31,15 +31,12 @@ declare enum Network {
31
31
 
32
32
  declare const VerificationErrorMessage: Record<AppErrorCodes, string>;
33
33
  declare enum PaymentErrorCodes {
34
- MalformedRequest = "malformed_request",
34
+ InputError = "input_error",
35
35
  PaymentRejected = "payment_rejected",
36
36
  InvalidReceiver = "invalid_receiver",
37
37
  InsufficientBalance = "insufficient_balance",
38
38
  TransactionFailed = "transaction_failed",
39
- InvalidTokenAddress = "invalid_token_address",
40
- InvalidAppId = "invalid_app_id",
41
- GenericError = "generic_error",
42
- DuplicateReference = "duplicate_reference"
39
+ GenericError = "generic_error"
43
40
  }
44
41
  declare enum PaymentErrorMessage {
45
42
  MalformedRequest = "There was a problem with this request. Please try again or contact the app owner.",
@@ -83,6 +80,7 @@ type MiniAppVerifyActionPayload = MiniAppVerifyActionSuccessPayload | MiniAppVer
83
80
  type MiniAppPaymentSuccessEventPayload = {
84
81
  status: "success";
85
82
  transaction_status: "submitted";
83
+ transaction_id: string;
86
84
  reference: string;
87
85
  from: string;
88
86
  chain: Network;
@@ -137,7 +135,7 @@ type VerifyCommandInput = {
137
135
  type PayCommandInput = {
138
136
  reference: string;
139
137
  to: string;
140
- token_amount: number;
138
+ token_amount: string;
141
139
  token: Tokens;
142
140
  network?: Network;
143
141
  description: string;
package/build/index.d.ts CHANGED
@@ -19,7 +19,7 @@ type SiweMessage = {
19
19
  };
20
20
 
21
21
  declare enum Tokens {
22
- USDC = "USDC",
22
+ USDCE = "USDCE",
23
23
  WLD = "WLD"
24
24
  }
25
25
  declare const TokenDecimals: {
@@ -31,15 +31,12 @@ declare enum Network {
31
31
 
32
32
  declare const VerificationErrorMessage: Record<AppErrorCodes, string>;
33
33
  declare enum PaymentErrorCodes {
34
- MalformedRequest = "malformed_request",
34
+ InputError = "input_error",
35
35
  PaymentRejected = "payment_rejected",
36
36
  InvalidReceiver = "invalid_receiver",
37
37
  InsufficientBalance = "insufficient_balance",
38
38
  TransactionFailed = "transaction_failed",
39
- InvalidTokenAddress = "invalid_token_address",
40
- InvalidAppId = "invalid_app_id",
41
- GenericError = "generic_error",
42
- DuplicateReference = "duplicate_reference"
39
+ GenericError = "generic_error"
43
40
  }
44
41
  declare enum PaymentErrorMessage {
45
42
  MalformedRequest = "There was a problem with this request. Please try again or contact the app owner.",
@@ -83,6 +80,7 @@ type MiniAppVerifyActionPayload = MiniAppVerifyActionSuccessPayload | MiniAppVer
83
80
  type MiniAppPaymentSuccessEventPayload = {
84
81
  status: "success";
85
82
  transaction_status: "submitted";
83
+ transaction_id: string;
86
84
  reference: string;
87
85
  from: string;
88
86
  chain: Network;
@@ -137,7 +135,7 @@ type VerifyCommandInput = {
137
135
  type PayCommandInput = {
138
136
  reference: string;
139
137
  to: string;
140
- token_amount: number;
138
+ token_amount: string;
141
139
  token: Tokens;
142
140
  network?: Network;
143
141
  description: string;
package/build/index.js CHANGED
@@ -139,13 +139,19 @@ var verifySiweMessage = async (payload, nonce, statement, requestId, userProvide
139
139
  }
140
140
  }
141
141
  if (nonce && siweMessageData.nonce !== nonce) {
142
- throw new Error("Nonce mismatch");
142
+ throw new Error(
143
+ `Nonce mismatch. Got: ${siweMessageData.nonce}, Expected: ${nonce}`
144
+ );
143
145
  }
144
146
  if (statement && siweMessageData.statement !== statement) {
145
- throw new Error("Statement mismatch");
147
+ throw new Error(
148
+ `Statement mismatch. Got: ${siweMessageData.statement}, Expected: ${statement}`
149
+ );
146
150
  }
147
151
  if (requestId && siweMessageData.request_id !== requestId) {
148
- throw new Error("Request ID mismatch");
152
+ throw new Error(
153
+ `Request ID mismatch. Got: ${siweMessageData.request_id}, Expected: ${requestId}`
154
+ );
149
155
  }
150
156
  let provider = userProvider || ethers.getDefaultProvider("https://mainnet.optimism.io");
151
157
  const signedMessage = `${ERC_191_PREFIX}${message.length}${message}`;
@@ -156,7 +162,7 @@ var verifySiweMessage = async (payload, nonce, statement, requestId, userProvide
156
162
  await contract.checkSignatures(
157
163
  hashedMessage,
158
164
  `0x${messageBytes}`,
159
- signature
165
+ `0x${signature}`
160
166
  );
161
167
  } catch (error) {
162
168
  throw new Error("Signature verification failed");
@@ -188,15 +194,12 @@ var VerificationErrorMessage = {
188
194
  [AppErrorCodes.ConnectionFailed]: "Connection to your wallet failed. Please try again."
189
195
  };
190
196
  var PaymentErrorCodes = /* @__PURE__ */ ((PaymentErrorCodes2) => {
191
- PaymentErrorCodes2["MalformedRequest"] = "malformed_request";
197
+ PaymentErrorCodes2["InputError"] = "input_error";
192
198
  PaymentErrorCodes2["PaymentRejected"] = "payment_rejected";
193
199
  PaymentErrorCodes2["InvalidReceiver"] = "invalid_receiver";
194
200
  PaymentErrorCodes2["InsufficientBalance"] = "insufficient_balance";
195
201
  PaymentErrorCodes2["TransactionFailed"] = "transaction_failed";
196
- PaymentErrorCodes2["InvalidTokenAddress"] = "invalid_token_address";
197
- PaymentErrorCodes2["InvalidAppId"] = "invalid_app_id";
198
202
  PaymentErrorCodes2["GenericError"] = "generic_error";
199
- PaymentErrorCodes2["DuplicateReference"] = "duplicate_reference";
200
203
  return PaymentErrorCodes2;
201
204
  })(PaymentErrorCodes || {});
202
205
  var PaymentErrorMessage = /* @__PURE__ */ ((PaymentErrorMessage2) => {
@@ -250,12 +253,12 @@ var ResponseEvent = /* @__PURE__ */ ((ResponseEvent2) => {
250
253
 
251
254
  // types/payment.ts
252
255
  var Tokens = /* @__PURE__ */ ((Tokens2) => {
253
- Tokens2["USDC"] = "USDC";
256
+ Tokens2["USDCE"] = "USDCE";
254
257
  Tokens2["WLD"] = "WLD";
255
258
  return Tokens2;
256
259
  })(Tokens || {});
257
260
  var TokenDecimals = {
258
- ["USDC" /* USDC */]: 6,
261
+ ["USDCE" /* USDCE */]: 6,
259
262
  ["WLD" /* WLD */]: 18
260
263
  };
261
264
  var Network = /* @__PURE__ */ ((Network2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/minikit-js",
3
- "version": "0.0.2",
3
+ "version": "0.0.21-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",
@@ -25,8 +25,7 @@
25
25
  "miniapps"
26
26
  ],
27
27
  "dependencies": {
28
- "@worldcoin/idkit-core": "^1.2.0",
29
- "apg-js": "^4.4.0"
28
+ "@worldcoin/idkit-core": "^1.2.0"
30
29
  },
31
30
  "devDependencies": {
32
31
  "@typescript-eslint/eslint-plugin": "^7.7.0",