@worldcoin/minikit-js 2.0.0-dev.0 → 2.0.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.
@@ -37,7 +37,6 @@ var IAT_TAG = "Issued At: ";
37
37
  var EXP_TAG = "Expiration Time: ";
38
38
  var NBF_TAG = "Not Before: ";
39
39
  var RID_TAG = "Request ID: ";
40
- var ERC_191_PREFIX = "Ethereum Signed Message:\n";
41
40
  var EIP1271_MAGICVALUE = "0x1626ba7e";
42
41
  var SAFE_CONTRACT_ABI = [
43
42
  {
@@ -136,14 +135,8 @@ var parseSiweMessage = (inputString) => {
136
135
  return siweMessageData;
137
136
  };
138
137
  var verifySiweMessage = (payload, nonce, statement, requestId, userProvider) => {
139
- if (payload.version === 1) {
140
- return verifySiweMessageV1(
141
- payload,
142
- nonce,
143
- statement,
144
- requestId,
145
- userProvider
146
- );
138
+ if (payload.version !== 2) {
139
+ throw new Error("Unsupported version returned");
147
140
  } else {
148
141
  return verifySiweMessageV2(
149
142
  payload,
@@ -184,39 +177,14 @@ var validateMessage = (siweMessageData, nonce, statement, requestId) => {
184
177
  }
185
178
  return true;
186
179
  };
187
- var verifySiweMessageV1 = async (payload, nonce, statement, requestId, userProvider) => {
188
- if (typeof window !== "undefined") {
189
- throw new Error("Wallet auth payload can only be verified in the backend");
190
- }
191
- const { message, signature, address } = payload;
192
- const siweMessageData = parseSiweMessage(message);
193
- validateMessage(siweMessageData, nonce, statement, requestId);
194
- let provider = userProvider || (0, import_viem.createPublicClient)({ chain: import_chains.worldchain, transport: (0, import_viem.http)() });
195
- const signedMessage = `${ERC_191_PREFIX}${message.length}${message}`;
196
- const hashedMessage = (0, import_viem.hashMessage)(signedMessage);
197
- const contract = (0, import_viem.getContract)({
198
- address,
199
- abi: SAFE_CONTRACT_ABI,
200
- client: provider
201
- });
202
- try {
203
- const recoveredAddress = await (0, import_viem.recoverAddress)({
204
- hash: hashedMessage,
205
- signature: `0x${signature}`
206
- });
207
- const isOwner = await contract.read.isOwner([recoveredAddress]);
208
- if (!isOwner) {
209
- throw new Error("Signature verification failed, invalid owner");
210
- }
211
- } catch (error) {
212
- throw new Error("Signature verification failed");
213
- }
214
- return { isValid: true, siweMessageData };
215
- };
216
180
  var verifySiweMessageV2 = async (payload, nonce, statement, requestId, userProvider) => {
217
181
  if (typeof window !== "undefined") {
218
182
  throw new Error("Wallet auth payload can only be verified in the backend");
219
183
  }
184
+ const NONCE_REGEX = /^[a-zA-Z0-9]+$/;
185
+ if (!NONCE_REGEX.test(nonce)) {
186
+ throw new Error("Invalid nonce: must be alphanumeric only (per ERC-4361)");
187
+ }
220
188
  const { message, signature, address } = payload;
221
189
  const siweMessageData = parseSiweMessage(message);
222
190
  if (!validateMessage(siweMessageData, nonce, statement, requestId)) {
@@ -1,5 +1,5 @@
1
1
  import { Client } from 'viem';
2
- import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-CKn5C-Ro.cjs';
2
+ import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-CSyzFDPt.cjs';
3
3
 
4
4
  declare const parseSiweMessage: (inputString: string) => SiweMessage;
5
5
  declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonce: string, statement?: string, requestId?: string, userProvider?: Client) => Promise<{
@@ -1,5 +1,5 @@
1
1
  import { Client } from 'viem';
2
- import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-CKn5C-Ro.js';
2
+ import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-CSyzFDPt.js';
3
3
 
4
4
  declare const parseSiweMessage: (inputString: string) => SiweMessage;
5
5
  declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonce: string, statement?: string, requestId?: string, userProvider?: Client) => Promise<{
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parseSiweMessage,
3
3
  verifySiweMessage
4
- } from "./chunk-LHHKY77D.js";
4
+ } from "./chunk-IYL4VCWR.js";
5
5
  export {
6
6
  parseSiweMessage,
7
7
  verifySiweMessage
@@ -1,6 +1,35 @@
1
- import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-CKn5C-Ro.cjs';
1
+ import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-CSyzFDPt.js';
2
2
  import { Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimitiveTypes, ExtractAbiFunction, TypedData, TypedDataDomain } from 'abitype';
3
3
 
4
+ type AttestationParams = {
5
+ /**
6
+ * Hex-encoded hash of the request body to attest.
7
+ */
8
+ requestHash: string;
9
+ };
10
+ /** @deprecated Use {@link MiniKitAttestationOptions} instead */
11
+ type AttestationInput = AttestationParams;
12
+ interface MiniKitAttestationOptions<TCustomFallback = MiniAppAttestationSuccessPayload> extends AttestationParams, FallbackConfig<TCustomFallback> {
13
+ }
14
+ declare enum AttestationErrorCodes {
15
+ Unauthorized = "unauthorized",
16
+ AttestationFailed = "attestation_failed",
17
+ IntegrityFailed = "integrity_failed",
18
+ InvalidInput = "invalid_input",
19
+ UnsupportedVersion = "unsupported_version"
20
+ }
21
+ type MiniAppAttestationSuccessPayload = MiniAppBaseSuccessPayload & {
22
+ token: string;
23
+ };
24
+ type MiniAppAttestationErrorPayload = MiniAppBaseErrorPayload<AttestationErrorCodes> & {
25
+ description: string;
26
+ };
27
+ type MiniAppAttestationPayload = MiniAppAttestationSuccessPayload | MiniAppAttestationErrorPayload;
28
+ declare class AttestationError extends Error {
29
+ readonly error_code: AttestationErrorCodes;
30
+ constructor(error_code: AttestationErrorCodes);
31
+ }
32
+
4
33
  type ChatParams = {
5
34
  to?: string[];
6
35
  message: string;
@@ -25,6 +54,13 @@ declare class ChatError extends Error {
25
54
  constructor(error_code: ChatErrorCodes);
26
55
  }
27
56
 
57
+ type CloseMiniAppResult = {
58
+ status: 'success';
59
+ version: number;
60
+ };
61
+ interface MiniKitCloseMiniAppOptions<TCustomFallback = CloseMiniAppResult> extends FallbackConfig<TCustomFallback> {
62
+ }
63
+
28
64
  declare enum GetPermissionsErrorCodes {
29
65
  GenericError = "generic_error"
30
66
  }
@@ -53,13 +89,19 @@ declare class GetPermissionsError extends Error {
53
89
 
54
90
  declare enum Tokens {
55
91
  USDC = "USDCE",
56
- WLD = "WLD"
92
+ WLD = "WLD",
93
+ WARS = "WARS",
94
+ WCOP = "WCOP",
95
+ WMXN = "WMXN",
96
+ WBRL = "WBRL",
97
+ WPEN = "WPEN",
98
+ WCLP = "WCLP",
99
+ EURC = "EURC"
57
100
  }
58
101
  declare const TokenDecimals: {
59
102
  [key in Tokens]: number;
60
103
  };
61
104
  declare enum Network {
62
- Optimism = "optimism",
63
105
  WorldChain = "worldchain"
64
106
  }
65
107
  type TokensPayload = {
@@ -190,7 +232,15 @@ type Permit2 = {
190
232
  nonce: string | unknown;
191
233
  deadline: string | unknown;
192
234
  };
193
- type Transaction = {
235
+ type CalldataTransaction = {
236
+ to: string;
237
+ /** Raw calldata hex string */
238
+ data?: string;
239
+ /** Hex encoded value */
240
+ value?: string | undefined;
241
+ };
242
+ /** @deprecated Use {@link CalldataTransaction} in `transactions` */
243
+ type LegacyTransaction = {
194
244
  address: string;
195
245
  value?: string | undefined;
196
246
  /** Raw calldata. If provided, it takes precedence over ABI/functionName/args. */
@@ -201,14 +251,26 @@ type Transaction = {
201
251
  };
202
252
  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;
203
253
  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[];
204
- /** @deprecated Use {@link MiniKitSendTransactionOptions} instead */
205
- type SendTransactionInput = {
206
- transaction: Transaction[];
254
+ /** @deprecated Use {@link CalldataTransaction} */
255
+ type Transaction = LegacyTransaction;
256
+ /** @deprecated sendTransaction v1 payload (legacy) */
257
+ type SendTransactionV1Input = {
258
+ transactions: CalldataTransaction[];
259
+ network: Network;
207
260
  permit2?: Permit2[];
208
261
  formatPayload?: boolean;
209
262
  };
210
- /** @deprecated Use {@link MiniKitSendTransactionOptions} instead */
211
- type SendTransactionPayload = SendTransactionInput;
263
+ /** @deprecated sendTransaction v1 payload (legacy) */
264
+ type SendTransactionV1Payload = SendTransactionV1Input;
265
+ /** sendTransaction v2 payload sent to mobile */
266
+ type SendTransactionV2Input = {
267
+ transactions: CalldataTransaction[];
268
+ chainId: number;
269
+ };
270
+ type SendTransactionV2Payload = SendTransactionV2Input;
271
+ /** Current sendTransaction payload */
272
+ type SendTransactionInput = SendTransactionV2Input;
273
+ type SendTransactionPayload = SendTransactionV2Payload;
212
274
  declare enum SendTransactionErrorCodes {
213
275
  InvalidOperation = "invalid_operation",
214
276
  UserRejected = "user_rejected",
@@ -225,61 +287,86 @@ declare enum SendTransactionErrorCodes {
225
287
  PermittedAmountNotFound = "permitted_amount_not_found"
226
288
  }
227
289
  declare const SendTransactionErrorMessage: Record<SendTransactionErrorCodes, string>;
228
- type MiniAppSendTransactionSuccessPayload = MiniAppBaseSuccessPayload & {
290
+ /** @deprecated sendTransaction v1 success payload */
291
+ type MiniAppSendTransactionV1SuccessPayload = MiniAppBaseSuccessPayload & {
229
292
  transaction_status: 'submitted';
230
- transaction_id: string;
293
+ transaction_id?: string;
231
294
  reference?: string;
232
- from: string;
295
+ from?: string;
233
296
  chain: Network;
234
- timestamp: string;
297
+ timestamp?: string;
235
298
  userOpHash?: string;
236
299
  mini_app_id?: string;
237
300
  };
238
- type MiniAppSendTransactionErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
301
+ /** sendTransaction v2 success payload */
302
+ type MiniAppSendTransactionV2SuccessPayload = MiniAppBaseSuccessPayload & {
303
+ userOpHash: string;
304
+ from: string;
305
+ network: Network;
306
+ timestamp: string;
307
+ };
308
+ type MiniAppSendTransactionSuccessPayload = MiniAppSendTransactionV2SuccessPayload;
309
+ /** @deprecated sendTransaction v1 error payload */
310
+ type MiniAppSendTransactionV1ErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
239
311
  details?: Record<string, any>;
240
312
  mini_app_id?: string;
241
313
  };
242
- type MiniAppSendTransactionPayload = MiniAppSendTransactionSuccessPayload | MiniAppSendTransactionErrorPayload;
314
+ /** sendTransaction v2 error payload */
315
+ type MiniAppSendTransactionV2ErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
316
+ details?: Record<string, any>;
317
+ };
318
+ type MiniAppSendTransactionErrorPayload = MiniAppSendTransactionV2ErrorPayload;
319
+ /** @deprecated sendTransaction v1 payload */
320
+ type MiniAppSendTransactionV1Payload = MiniAppSendTransactionV1SuccessPayload | MiniAppSendTransactionV1ErrorPayload;
321
+ /** sendTransaction v2 payload */
322
+ type MiniAppSendTransactionV2Payload = MiniAppSendTransactionV2SuccessPayload | MiniAppSendTransactionV2ErrorPayload;
323
+ type MiniAppSendTransactionPayload = MiniAppSendTransactionV2Payload;
243
324
  interface MiniKitSendTransactionOptions<TCustomFallback = SendTransactionResult> extends FallbackConfig<TCustomFallback> {
244
- /** Transactions to execute */
245
- transaction: Transaction[];
246
- /**
247
- * Optional chain ID to execute on.
248
- * - World App currently only supports World Chain (480).
249
- * - On web (wagmi fallback), this is forwarded to wagmi.
250
- */
325
+ /** Transactions to execute (calldata first) */
326
+ transactions: CalldataTransaction[];
327
+ /** Chain ID to execute on */
328
+ chainId: number;
329
+ }
330
+ /** @deprecated sendTransaction v1 options (legacy) */
331
+ interface MiniKitSendTransactionV1Options<TCustomFallback = SendTransactionResult> extends FallbackConfig<TCustomFallback> {
332
+ transactions?: CalldataTransaction[];
333
+ transaction?: LegacyTransaction[];
334
+ network?: Network;
251
335
  chainId?: number;
252
- /** Permit2 data for token approvals (World App only) */
253
336
  permit2?: Permit2[];
254
- /** Whether to format the payload (default: true) */
255
337
  formatPayload?: boolean;
256
338
  }
257
- interface SendTransactionResult {
258
- /** On-chain transaction hash (Wagmi fallback) */
339
+ /** sendTransaction v2 options */
340
+ type MiniKitSendTransactionV2Options<TCustomFallback = SendTransactionResult> = MiniKitSendTransactionOptions<TCustomFallback>;
341
+ /** @deprecated sendTransaction v1 result shape */
342
+ interface SendTransactionV1Result {
259
343
  transactionHash?: string | null;
260
- /** User operation hash (World App only) */
261
344
  userOpHash?: string | null;
262
- /** Mini App ID (World App only) */
263
345
  mini_app_id?: string | null;
264
- /** Result status */
265
346
  status?: 'success' | null;
266
- /** Payload version */
267
347
  version?: number | null;
268
- /** Transaction ID (World App only) */
269
348
  transactionId?: string | null;
270
- /** Reference (World App only) */
271
349
  reference?: string | null;
272
- /** From address */
273
350
  from?: string | null;
274
- /** Chain identifier */
275
351
  chain?: string | null;
276
- /** Timestamp */
277
352
  timestamp?: string | null;
278
- /** @deprecated Use `transactionId` instead */
279
353
  transaction_id?: string | null;
280
- /** @deprecated Success is implicit (errors throw). Always `'submitted'` when present. */
281
354
  transaction_status?: 'submitted';
282
355
  }
356
+ /** sendTransaction v2 result shape */
357
+ interface SendTransactionV2Result {
358
+ /** User operation hash (or tx hash in web fallback) */
359
+ userOpHash: string;
360
+ /** Result status */
361
+ status: 'success';
362
+ /** Payload version */
363
+ version: number;
364
+ /** From address */
365
+ from: string;
366
+ /** Timestamp */
367
+ timestamp: string;
368
+ }
369
+ type SendTransactionResult = SendTransactionV2Result;
283
370
  interface FeatureSupport {
284
371
  /** Whether batch transactions are supported */
285
372
  batch: boolean;
@@ -435,4 +522,4 @@ declare class SignTypedDataError extends Error {
435
522
  constructor(error_code: SignTypedDataErrorCodes);
436
523
  }
437
524
 
438
- export { type MiniAppSendHapticFeedbackErrorPayload as $, Permission as A, type PermissionSettings as B, type ChatInput as C, type MiniAppGetPermissionsErrorPayload as D, GetPermissionsError as E, TokenDecimals as F, GetPermissionsErrorCodes as G, type TokensPayload as H, type PayCommandInput as I, type PayCommandPayload as J, PaymentErrorCodes as K, PaymentErrorMessage as L, type MiniKitSendTransactionOptions as M, Network as N, type MiniAppPaymentSuccessPayload as O, type PayResult as P, type MiniAppPaymentErrorPayload as Q, type MiniAppPaymentPayload as R, type SendTransactionResult as S, Tokens as T, PayError as U, type RequestPermissionInput as V, RequestPermissionErrorCodes as W, type MiniAppRequestPermissionErrorPayload as X, RequestPermissionError as Y, type SendHapticFeedbackInput as Z, SendHapticFeedbackErrorCodes as _, type MiniKitPayOptions as a, SendHapticFeedbackError as a0, type Permit2 as a1, type Transaction as a2, type ContractFunctionName as a3, type ContractFunctionArgs as a4, type SendTransactionInput as a5, type SendTransactionPayload as a6, SendTransactionErrorCodes as a7, SendTransactionErrorMessage as a8, type MiniAppSendTransactionSuccessPayload as a9, SignTypedDataErrorCodes as aA, type MiniAppSignTypedDataErrorPayload as aB, SignTypedDataError as aC, type MiniAppSendTransactionErrorPayload as aa, type MiniAppSendTransactionPayload as ab, type FeatureSupport as ac, WORLD_APP_FEATURES as ad, WEB_FEATURES as ae, SendTransactionError as af, type ShareInput as ag, type SharePayload as ah, ShareFilesErrorCodes as ai, type MiniAppShareErrorPayload as aj, ShareError as ak, type ShareContactsInput as al, type ShareContactsPayload as am, ShareContactsErrorCodes as an, ShareContactsErrorMessage as ao, type Contact as ap, type MiniAppShareContactsSuccessPayload as aq, type MiniAppShareContactsErrorPayload as ar, type MiniAppShareContactsPayload as as, ShareContactsError as at, type SignMessageInput as au, SignMessageErrorCodes as av, type MiniAppSignMessageErrorPayload as aw, type MiniAppSignMessagePayload as ax, SignMessageError as ay, type SignTypedDataInput as az, type ShareContactsResult as b, type MiniKitShareContactsOptions as c, type MiniAppSignMessageSuccessPayload as d, type MiniKitSignMessageOptions as e, type MiniAppSignTypedDataPayload as f, type MiniKitSignTypedDataOptions as g, type MiniAppSignTypedDataSuccessPayload as h, type MiniAppChatPayload as i, type MiniKitChatOptions as j, type MiniAppChatSuccessPayload as k, type MiniAppSharePayload as l, type MiniKitShareOptions as m, type MiniAppShareSuccessPayload as n, type MiniAppGetPermissionsPayload as o, type MiniKitGetPermissionsOptions as p, type MiniAppGetPermissionsSuccessPayload as q, type MiniAppRequestPermissionPayload as r, type MiniKitRequestPermissionOptions as s, type MiniAppRequestPermissionSuccessPayload as t, type MiniAppSendHapticFeedbackPayload as u, type MiniKitSendHapticFeedbackOptions as v, type MiniAppSendHapticFeedbackSuccessPayload as w, ChatErrorCodes as x, type MiniAppChatErrorPayload as y, ChatError as z };
525
+ export { type MiniAppPaymentErrorPayload as $, type AttestationInput as A, AttestationErrorCodes as B, type CloseMiniAppResult as C, type MiniAppAttestationErrorPayload as D, type MiniAppAttestationPayload as E, AttestationError as F, type ChatInput as G, ChatErrorCodes as H, type MiniAppChatErrorPayload as I, ChatError as J, GetPermissionsErrorCodes as K, Permission as L, type MiniKitSendTransactionOptions as M, type PermissionSettings as N, type MiniAppGetPermissionsErrorPayload as O, type PayResult as P, GetPermissionsError as Q, TokenDecimals as R, type SendTransactionResult as S, Tokens as T, Network as U, type TokensPayload as V, type PayCommandInput as W, type PayCommandPayload as X, PaymentErrorCodes as Y, PaymentErrorMessage as Z, type MiniAppPaymentSuccessPayload as _, type MiniKitPayOptions as a, SignTypedDataError as a$, type MiniAppPaymentPayload as a0, PayError as a1, type RequestPermissionInput as a2, RequestPermissionErrorCodes as a3, type MiniAppRequestPermissionErrorPayload as a4, RequestPermissionError as a5, type SendHapticFeedbackInput as a6, SendHapticFeedbackErrorCodes as a7, type MiniAppSendHapticFeedbackErrorPayload as a8, SendHapticFeedbackError as a9, type SendTransactionV2Result as aA, type FeatureSupport as aB, WORLD_APP_FEATURES as aC, WEB_FEATURES as aD, SendTransactionError as aE, type ShareInput as aF, type SharePayload as aG, ShareFilesErrorCodes as aH, type MiniAppShareErrorPayload as aI, ShareError as aJ, type ShareContactsInput as aK, type ShareContactsPayload as aL, ShareContactsErrorCodes as aM, ShareContactsErrorMessage as aN, type Contact as aO, type MiniAppShareContactsSuccessPayload as aP, type MiniAppShareContactsErrorPayload as aQ, type MiniAppShareContactsPayload as aR, ShareContactsError as aS, type SignMessageInput as aT, SignMessageErrorCodes as aU, type MiniAppSignMessageErrorPayload as aV, type MiniAppSignMessagePayload as aW, SignMessageError as aX, type SignTypedDataInput as aY, SignTypedDataErrorCodes as aZ, type MiniAppSignTypedDataErrorPayload as a_, type Permit2 as aa, type CalldataTransaction as ab, type LegacyTransaction as ac, type ContractFunctionName as ad, type ContractFunctionArgs as ae, type Transaction as af, type SendTransactionV1Input as ag, type SendTransactionV1Payload as ah, type SendTransactionV2Input as ai, type SendTransactionV2Payload as aj, type SendTransactionInput as ak, type SendTransactionPayload as al, SendTransactionErrorCodes as am, SendTransactionErrorMessage as an, type MiniAppSendTransactionV1SuccessPayload as ao, type MiniAppSendTransactionV2SuccessPayload as ap, type MiniAppSendTransactionSuccessPayload as aq, type MiniAppSendTransactionV1ErrorPayload as ar, type MiniAppSendTransactionV2ErrorPayload as as, type MiniAppSendTransactionErrorPayload as at, type MiniAppSendTransactionV1Payload as au, type MiniAppSendTransactionV2Payload as av, type MiniAppSendTransactionPayload as aw, type MiniKitSendTransactionV1Options as ax, type MiniKitSendTransactionV2Options as ay, type SendTransactionV1Result as az, type ShareContactsResult as b, type MiniKitShareContactsOptions as c, type MiniAppSignMessageSuccessPayload as d, type MiniKitSignMessageOptions as e, type MiniAppSignTypedDataPayload as f, type MiniKitSignTypedDataOptions as g, type MiniAppSignTypedDataSuccessPayload as h, type MiniAppChatPayload as i, type MiniKitChatOptions as j, type MiniAppChatSuccessPayload as k, type MiniAppSharePayload as l, type MiniKitShareOptions as m, type MiniAppShareSuccessPayload as n, type MiniAppGetPermissionsPayload as o, type MiniKitGetPermissionsOptions as p, type MiniAppGetPermissionsSuccessPayload as q, type MiniAppRequestPermissionPayload as r, type MiniKitRequestPermissionOptions as s, type MiniAppRequestPermissionSuccessPayload as t, type MiniAppSendHapticFeedbackPayload as u, type MiniKitSendHapticFeedbackOptions as v, type MiniAppSendHapticFeedbackSuccessPayload as w, type MiniAppAttestationSuccessPayload as x, type MiniKitAttestationOptions as y, type MiniKitCloseMiniAppOptions as z };
@@ -66,6 +66,7 @@ type MiniKitInstallReturnType = {
66
66
  };
67
67
 
68
68
  declare enum Command {
69
+ Attestation = "attestation",
69
70
  Pay = "pay",
70
71
  WalletAuth = "wallet-auth",
71
72
  SendTransaction = "send-transaction",
@@ -76,9 +77,11 @@ declare enum Command {
76
77
  GetPermissions = "get-permissions",
77
78
  SendHapticFeedback = "send-haptic-feedback",
78
79
  Share = "share",
79
- Chat = "chat"
80
+ Chat = "chat",
81
+ CloseMiniApp = "close-miniapp"
80
82
  }
81
83
  declare enum ResponseEvent {
84
+ MiniAppAttestation = "miniapp-attestation",
82
85
  MiniAppPayment = "miniapp-payment",
83
86
  MiniAppWalletAuth = "miniapp-wallet-auth",
84
87
  MiniAppSendTransaction = "miniapp-send-transaction",
@@ -66,6 +66,7 @@ type MiniKitInstallReturnType = {
66
66
  };
67
67
 
68
68
  declare enum Command {
69
+ Attestation = "attestation",
69
70
  Pay = "pay",
70
71
  WalletAuth = "wallet-auth",
71
72
  SendTransaction = "send-transaction",
@@ -76,9 +77,11 @@ declare enum Command {
76
77
  GetPermissions = "get-permissions",
77
78
  SendHapticFeedback = "send-haptic-feedback",
78
79
  Share = "share",
79
- Chat = "chat"
80
+ Chat = "chat",
81
+ CloseMiniApp = "close-miniapp"
80
82
  }
81
83
  declare enum ResponseEvent {
84
+ MiniAppAttestation = "miniapp-attestation",
82
85
  MiniAppPayment = "miniapp-payment",
83
86
  MiniAppWalletAuth = "miniapp-wallet-auth",
84
87
  MiniAppSendTransaction = "miniapp-send-transaction",
@@ -1,6 +1,35 @@
1
- import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-CKn5C-Ro.js';
1
+ import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-CSyzFDPt.cjs';
2
2
  import { Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimitiveTypes, ExtractAbiFunction, TypedData, TypedDataDomain } from 'abitype';
3
3
 
4
+ type AttestationParams = {
5
+ /**
6
+ * Hex-encoded hash of the request body to attest.
7
+ */
8
+ requestHash: string;
9
+ };
10
+ /** @deprecated Use {@link MiniKitAttestationOptions} instead */
11
+ type AttestationInput = AttestationParams;
12
+ interface MiniKitAttestationOptions<TCustomFallback = MiniAppAttestationSuccessPayload> extends AttestationParams, FallbackConfig<TCustomFallback> {
13
+ }
14
+ declare enum AttestationErrorCodes {
15
+ Unauthorized = "unauthorized",
16
+ AttestationFailed = "attestation_failed",
17
+ IntegrityFailed = "integrity_failed",
18
+ InvalidInput = "invalid_input",
19
+ UnsupportedVersion = "unsupported_version"
20
+ }
21
+ type MiniAppAttestationSuccessPayload = MiniAppBaseSuccessPayload & {
22
+ token: string;
23
+ };
24
+ type MiniAppAttestationErrorPayload = MiniAppBaseErrorPayload<AttestationErrorCodes> & {
25
+ description: string;
26
+ };
27
+ type MiniAppAttestationPayload = MiniAppAttestationSuccessPayload | MiniAppAttestationErrorPayload;
28
+ declare class AttestationError extends Error {
29
+ readonly error_code: AttestationErrorCodes;
30
+ constructor(error_code: AttestationErrorCodes);
31
+ }
32
+
4
33
  type ChatParams = {
5
34
  to?: string[];
6
35
  message: string;
@@ -25,6 +54,13 @@ declare class ChatError extends Error {
25
54
  constructor(error_code: ChatErrorCodes);
26
55
  }
27
56
 
57
+ type CloseMiniAppResult = {
58
+ status: 'success';
59
+ version: number;
60
+ };
61
+ interface MiniKitCloseMiniAppOptions<TCustomFallback = CloseMiniAppResult> extends FallbackConfig<TCustomFallback> {
62
+ }
63
+
28
64
  declare enum GetPermissionsErrorCodes {
29
65
  GenericError = "generic_error"
30
66
  }
@@ -53,13 +89,19 @@ declare class GetPermissionsError extends Error {
53
89
 
54
90
  declare enum Tokens {
55
91
  USDC = "USDCE",
56
- WLD = "WLD"
92
+ WLD = "WLD",
93
+ WARS = "WARS",
94
+ WCOP = "WCOP",
95
+ WMXN = "WMXN",
96
+ WBRL = "WBRL",
97
+ WPEN = "WPEN",
98
+ WCLP = "WCLP",
99
+ EURC = "EURC"
57
100
  }
58
101
  declare const TokenDecimals: {
59
102
  [key in Tokens]: number;
60
103
  };
61
104
  declare enum Network {
62
- Optimism = "optimism",
63
105
  WorldChain = "worldchain"
64
106
  }
65
107
  type TokensPayload = {
@@ -190,7 +232,15 @@ type Permit2 = {
190
232
  nonce: string | unknown;
191
233
  deadline: string | unknown;
192
234
  };
193
- type Transaction = {
235
+ type CalldataTransaction = {
236
+ to: string;
237
+ /** Raw calldata hex string */
238
+ data?: string;
239
+ /** Hex encoded value */
240
+ value?: string | undefined;
241
+ };
242
+ /** @deprecated Use {@link CalldataTransaction} in `transactions` */
243
+ type LegacyTransaction = {
194
244
  address: string;
195
245
  value?: string | undefined;
196
246
  /** Raw calldata. If provided, it takes precedence over ABI/functionName/args. */
@@ -201,14 +251,26 @@ type Transaction = {
201
251
  };
202
252
  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;
203
253
  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[];
204
- /** @deprecated Use {@link MiniKitSendTransactionOptions} instead */
205
- type SendTransactionInput = {
206
- transaction: Transaction[];
254
+ /** @deprecated Use {@link CalldataTransaction} */
255
+ type Transaction = LegacyTransaction;
256
+ /** @deprecated sendTransaction v1 payload (legacy) */
257
+ type SendTransactionV1Input = {
258
+ transactions: CalldataTransaction[];
259
+ network: Network;
207
260
  permit2?: Permit2[];
208
261
  formatPayload?: boolean;
209
262
  };
210
- /** @deprecated Use {@link MiniKitSendTransactionOptions} instead */
211
- type SendTransactionPayload = SendTransactionInput;
263
+ /** @deprecated sendTransaction v1 payload (legacy) */
264
+ type SendTransactionV1Payload = SendTransactionV1Input;
265
+ /** sendTransaction v2 payload sent to mobile */
266
+ type SendTransactionV2Input = {
267
+ transactions: CalldataTransaction[];
268
+ chainId: number;
269
+ };
270
+ type SendTransactionV2Payload = SendTransactionV2Input;
271
+ /** Current sendTransaction payload */
272
+ type SendTransactionInput = SendTransactionV2Input;
273
+ type SendTransactionPayload = SendTransactionV2Payload;
212
274
  declare enum SendTransactionErrorCodes {
213
275
  InvalidOperation = "invalid_operation",
214
276
  UserRejected = "user_rejected",
@@ -225,61 +287,86 @@ declare enum SendTransactionErrorCodes {
225
287
  PermittedAmountNotFound = "permitted_amount_not_found"
226
288
  }
227
289
  declare const SendTransactionErrorMessage: Record<SendTransactionErrorCodes, string>;
228
- type MiniAppSendTransactionSuccessPayload = MiniAppBaseSuccessPayload & {
290
+ /** @deprecated sendTransaction v1 success payload */
291
+ type MiniAppSendTransactionV1SuccessPayload = MiniAppBaseSuccessPayload & {
229
292
  transaction_status: 'submitted';
230
- transaction_id: string;
293
+ transaction_id?: string;
231
294
  reference?: string;
232
- from: string;
295
+ from?: string;
233
296
  chain: Network;
234
- timestamp: string;
297
+ timestamp?: string;
235
298
  userOpHash?: string;
236
299
  mini_app_id?: string;
237
300
  };
238
- type MiniAppSendTransactionErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
301
+ /** sendTransaction v2 success payload */
302
+ type MiniAppSendTransactionV2SuccessPayload = MiniAppBaseSuccessPayload & {
303
+ userOpHash: string;
304
+ from: string;
305
+ network: Network;
306
+ timestamp: string;
307
+ };
308
+ type MiniAppSendTransactionSuccessPayload = MiniAppSendTransactionV2SuccessPayload;
309
+ /** @deprecated sendTransaction v1 error payload */
310
+ type MiniAppSendTransactionV1ErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
239
311
  details?: Record<string, any>;
240
312
  mini_app_id?: string;
241
313
  };
242
- type MiniAppSendTransactionPayload = MiniAppSendTransactionSuccessPayload | MiniAppSendTransactionErrorPayload;
314
+ /** sendTransaction v2 error payload */
315
+ type MiniAppSendTransactionV2ErrorPayload = MiniAppBaseErrorPayload<SendTransactionErrorCodes> & {
316
+ details?: Record<string, any>;
317
+ };
318
+ type MiniAppSendTransactionErrorPayload = MiniAppSendTransactionV2ErrorPayload;
319
+ /** @deprecated sendTransaction v1 payload */
320
+ type MiniAppSendTransactionV1Payload = MiniAppSendTransactionV1SuccessPayload | MiniAppSendTransactionV1ErrorPayload;
321
+ /** sendTransaction v2 payload */
322
+ type MiniAppSendTransactionV2Payload = MiniAppSendTransactionV2SuccessPayload | MiniAppSendTransactionV2ErrorPayload;
323
+ type MiniAppSendTransactionPayload = MiniAppSendTransactionV2Payload;
243
324
  interface MiniKitSendTransactionOptions<TCustomFallback = SendTransactionResult> extends FallbackConfig<TCustomFallback> {
244
- /** Transactions to execute */
245
- transaction: Transaction[];
246
- /**
247
- * Optional chain ID to execute on.
248
- * - World App currently only supports World Chain (480).
249
- * - On web (wagmi fallback), this is forwarded to wagmi.
250
- */
325
+ /** Transactions to execute (calldata first) */
326
+ transactions: CalldataTransaction[];
327
+ /** Chain ID to execute on */
328
+ chainId: number;
329
+ }
330
+ /** @deprecated sendTransaction v1 options (legacy) */
331
+ interface MiniKitSendTransactionV1Options<TCustomFallback = SendTransactionResult> extends FallbackConfig<TCustomFallback> {
332
+ transactions?: CalldataTransaction[];
333
+ transaction?: LegacyTransaction[];
334
+ network?: Network;
251
335
  chainId?: number;
252
- /** Permit2 data for token approvals (World App only) */
253
336
  permit2?: Permit2[];
254
- /** Whether to format the payload (default: true) */
255
337
  formatPayload?: boolean;
256
338
  }
257
- interface SendTransactionResult {
258
- /** On-chain transaction hash (Wagmi fallback) */
339
+ /** sendTransaction v2 options */
340
+ type MiniKitSendTransactionV2Options<TCustomFallback = SendTransactionResult> = MiniKitSendTransactionOptions<TCustomFallback>;
341
+ /** @deprecated sendTransaction v1 result shape */
342
+ interface SendTransactionV1Result {
259
343
  transactionHash?: string | null;
260
- /** User operation hash (World App only) */
261
344
  userOpHash?: string | null;
262
- /** Mini App ID (World App only) */
263
345
  mini_app_id?: string | null;
264
- /** Result status */
265
346
  status?: 'success' | null;
266
- /** Payload version */
267
347
  version?: number | null;
268
- /** Transaction ID (World App only) */
269
348
  transactionId?: string | null;
270
- /** Reference (World App only) */
271
349
  reference?: string | null;
272
- /** From address */
273
350
  from?: string | null;
274
- /** Chain identifier */
275
351
  chain?: string | null;
276
- /** Timestamp */
277
352
  timestamp?: string | null;
278
- /** @deprecated Use `transactionId` instead */
279
353
  transaction_id?: string | null;
280
- /** @deprecated Success is implicit (errors throw). Always `'submitted'` when present. */
281
354
  transaction_status?: 'submitted';
282
355
  }
356
+ /** sendTransaction v2 result shape */
357
+ interface SendTransactionV2Result {
358
+ /** User operation hash (or tx hash in web fallback) */
359
+ userOpHash: string;
360
+ /** Result status */
361
+ status: 'success';
362
+ /** Payload version */
363
+ version: number;
364
+ /** From address */
365
+ from: string;
366
+ /** Timestamp */
367
+ timestamp: string;
368
+ }
369
+ type SendTransactionResult = SendTransactionV2Result;
283
370
  interface FeatureSupport {
284
371
  /** Whether batch transactions are supported */
285
372
  batch: boolean;
@@ -435,4 +522,4 @@ declare class SignTypedDataError extends Error {
435
522
  constructor(error_code: SignTypedDataErrorCodes);
436
523
  }
437
524
 
438
- export { type MiniAppSendHapticFeedbackErrorPayload as $, Permission as A, type PermissionSettings as B, type ChatInput as C, type MiniAppGetPermissionsErrorPayload as D, GetPermissionsError as E, TokenDecimals as F, GetPermissionsErrorCodes as G, type TokensPayload as H, type PayCommandInput as I, type PayCommandPayload as J, PaymentErrorCodes as K, PaymentErrorMessage as L, type MiniKitSendTransactionOptions as M, Network as N, type MiniAppPaymentSuccessPayload as O, type PayResult as P, type MiniAppPaymentErrorPayload as Q, type MiniAppPaymentPayload as R, type SendTransactionResult as S, Tokens as T, PayError as U, type RequestPermissionInput as V, RequestPermissionErrorCodes as W, type MiniAppRequestPermissionErrorPayload as X, RequestPermissionError as Y, type SendHapticFeedbackInput as Z, SendHapticFeedbackErrorCodes as _, type MiniKitPayOptions as a, SendHapticFeedbackError as a0, type Permit2 as a1, type Transaction as a2, type ContractFunctionName as a3, type ContractFunctionArgs as a4, type SendTransactionInput as a5, type SendTransactionPayload as a6, SendTransactionErrorCodes as a7, SendTransactionErrorMessage as a8, type MiniAppSendTransactionSuccessPayload as a9, SignTypedDataErrorCodes as aA, type MiniAppSignTypedDataErrorPayload as aB, SignTypedDataError as aC, type MiniAppSendTransactionErrorPayload as aa, type MiniAppSendTransactionPayload as ab, type FeatureSupport as ac, WORLD_APP_FEATURES as ad, WEB_FEATURES as ae, SendTransactionError as af, type ShareInput as ag, type SharePayload as ah, ShareFilesErrorCodes as ai, type MiniAppShareErrorPayload as aj, ShareError as ak, type ShareContactsInput as al, type ShareContactsPayload as am, ShareContactsErrorCodes as an, ShareContactsErrorMessage as ao, type Contact as ap, type MiniAppShareContactsSuccessPayload as aq, type MiniAppShareContactsErrorPayload as ar, type MiniAppShareContactsPayload as as, ShareContactsError as at, type SignMessageInput as au, SignMessageErrorCodes as av, type MiniAppSignMessageErrorPayload as aw, type MiniAppSignMessagePayload as ax, SignMessageError as ay, type SignTypedDataInput as az, type ShareContactsResult as b, type MiniKitShareContactsOptions as c, type MiniAppSignMessageSuccessPayload as d, type MiniKitSignMessageOptions as e, type MiniAppSignTypedDataPayload as f, type MiniKitSignTypedDataOptions as g, type MiniAppSignTypedDataSuccessPayload as h, type MiniAppChatPayload as i, type MiniKitChatOptions as j, type MiniAppChatSuccessPayload as k, type MiniAppSharePayload as l, type MiniKitShareOptions as m, type MiniAppShareSuccessPayload as n, type MiniAppGetPermissionsPayload as o, type MiniKitGetPermissionsOptions as p, type MiniAppGetPermissionsSuccessPayload as q, type MiniAppRequestPermissionPayload as r, type MiniKitRequestPermissionOptions as s, type MiniAppRequestPermissionSuccessPayload as t, type MiniAppSendHapticFeedbackPayload as u, type MiniKitSendHapticFeedbackOptions as v, type MiniAppSendHapticFeedbackSuccessPayload as w, ChatErrorCodes as x, type MiniAppChatErrorPayload as y, ChatError as z };
525
+ export { type MiniAppPaymentErrorPayload as $, type AttestationInput as A, AttestationErrorCodes as B, type CloseMiniAppResult as C, type MiniAppAttestationErrorPayload as D, type MiniAppAttestationPayload as E, AttestationError as F, type ChatInput as G, ChatErrorCodes as H, type MiniAppChatErrorPayload as I, ChatError as J, GetPermissionsErrorCodes as K, Permission as L, type MiniKitSendTransactionOptions as M, type PermissionSettings as N, type MiniAppGetPermissionsErrorPayload as O, type PayResult as P, GetPermissionsError as Q, TokenDecimals as R, type SendTransactionResult as S, Tokens as T, Network as U, type TokensPayload as V, type PayCommandInput as W, type PayCommandPayload as X, PaymentErrorCodes as Y, PaymentErrorMessage as Z, type MiniAppPaymentSuccessPayload as _, type MiniKitPayOptions as a, SignTypedDataError as a$, type MiniAppPaymentPayload as a0, PayError as a1, type RequestPermissionInput as a2, RequestPermissionErrorCodes as a3, type MiniAppRequestPermissionErrorPayload as a4, RequestPermissionError as a5, type SendHapticFeedbackInput as a6, SendHapticFeedbackErrorCodes as a7, type MiniAppSendHapticFeedbackErrorPayload as a8, SendHapticFeedbackError as a9, type SendTransactionV2Result as aA, type FeatureSupport as aB, WORLD_APP_FEATURES as aC, WEB_FEATURES as aD, SendTransactionError as aE, type ShareInput as aF, type SharePayload as aG, ShareFilesErrorCodes as aH, type MiniAppShareErrorPayload as aI, ShareError as aJ, type ShareContactsInput as aK, type ShareContactsPayload as aL, ShareContactsErrorCodes as aM, ShareContactsErrorMessage as aN, type Contact as aO, type MiniAppShareContactsSuccessPayload as aP, type MiniAppShareContactsErrorPayload as aQ, type MiniAppShareContactsPayload as aR, ShareContactsError as aS, type SignMessageInput as aT, SignMessageErrorCodes as aU, type MiniAppSignMessageErrorPayload as aV, type MiniAppSignMessagePayload as aW, SignMessageError as aX, type SignTypedDataInput as aY, SignTypedDataErrorCodes as aZ, type MiniAppSignTypedDataErrorPayload as a_, type Permit2 as aa, type CalldataTransaction as ab, type LegacyTransaction as ac, type ContractFunctionName as ad, type ContractFunctionArgs as ae, type Transaction as af, type SendTransactionV1Input as ag, type SendTransactionV1Payload as ah, type SendTransactionV2Input as ai, type SendTransactionV2Payload as aj, type SendTransactionInput as ak, type SendTransactionPayload as al, SendTransactionErrorCodes as am, SendTransactionErrorMessage as an, type MiniAppSendTransactionV1SuccessPayload as ao, type MiniAppSendTransactionV2SuccessPayload as ap, type MiniAppSendTransactionSuccessPayload as aq, type MiniAppSendTransactionV1ErrorPayload as ar, type MiniAppSendTransactionV2ErrorPayload as as, type MiniAppSendTransactionErrorPayload as at, type MiniAppSendTransactionV1Payload as au, type MiniAppSendTransactionV2Payload as av, type MiniAppSendTransactionPayload as aw, type MiniKitSendTransactionV1Options as ax, type MiniKitSendTransactionV2Options as ay, type SendTransactionV1Result as az, type ShareContactsResult as b, type MiniKitShareContactsOptions as c, type MiniAppSignMessageSuccessPayload as d, type MiniKitSignMessageOptions as e, type MiniAppSignTypedDataPayload as f, type MiniKitSignTypedDataOptions as g, type MiniAppSignTypedDataSuccessPayload as h, type MiniAppChatPayload as i, type MiniKitChatOptions as j, type MiniAppChatSuccessPayload as k, type MiniAppSharePayload as l, type MiniKitShareOptions as m, type MiniAppShareSuccessPayload as n, type MiniAppGetPermissionsPayload as o, type MiniKitGetPermissionsOptions as p, type MiniAppGetPermissionsSuccessPayload as q, type MiniAppRequestPermissionPayload as r, type MiniKitRequestPermissionOptions as s, type MiniAppRequestPermissionSuccessPayload as t, type MiniAppSendHapticFeedbackPayload as u, type MiniKitSendHapticFeedbackOptions as v, type MiniAppSendHapticFeedbackSuccessPayload as w, type MiniAppAttestationSuccessPayload as x, type MiniKitAttestationOptions as y, type MiniKitCloseMiniAppOptions as z };