@worldcoin/minikit-js 2.0.0-dev.0 → 2.0.0-dev.1
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/README.md +4 -1
- package/build/chunk-2UPJKPQ6.js +272 -0
- package/build/{chunk-OTAA7OOI.js → chunk-EHBM7OXH.js} +30 -269
- package/build/chunk-TGXD24YD.js +279 -0
- package/build/{chunk-DIACPBCB.js → chunk-Z2UGRZJ2.js} +241 -298
- package/build/command-exports.cjs +232 -295
- package/build/command-exports.d.cts +14 -11
- package/build/command-exports.d.ts +14 -11
- package/build/command-exports.js +9 -1
- package/build/connector/index.cjs +333 -120
- package/build/connector/index.js +8 -4
- package/build/index.cjs +244 -307
- package/build/index.d.cts +16 -7
- package/build/index.d.ts +16 -7
- package/build/index.js +5 -3
- package/build/minikit-provider.cjs +312 -123
- package/build/minikit-provider.js +9 -2040
- package/build/siwe-exports.d.cts +1 -1
- package/build/siwe-exports.d.ts +1 -1
- package/build/{types-DO2UGrgp.d.cts → types-CC2x79HX.d.ts} +125 -38
- package/build/{types-CKn5C-Ro.d.ts → types-CSyzFDPt.d.cts} +4 -1
- package/build/{types-CKn5C-Ro.d.cts → types-CSyzFDPt.d.ts} +4 -1
- package/build/{types-CGVVuGiN.d.ts → types-_jfLbcJW.d.cts} +125 -38
- package/package.json +12 -13
package/build/siwe-exports.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
|
-
import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-
|
|
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<{
|
package/build/siwe-exports.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
|
-
import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-
|
|
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,6 +1,35 @@
|
|
|
1
|
-
import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-
|
|
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
|
|
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
|
|
205
|
-
type
|
|
206
|
-
|
|
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
|
|
211
|
-
type
|
|
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
|
-
|
|
290
|
+
/** @deprecated sendTransaction v1 success payload */
|
|
291
|
+
type MiniAppSendTransactionV1SuccessPayload = MiniAppBaseSuccessPayload & {
|
|
229
292
|
transaction_status: 'submitted';
|
|
230
|
-
transaction_id
|
|
293
|
+
transaction_id?: string;
|
|
231
294
|
reference?: string;
|
|
232
|
-
from
|
|
295
|
+
from?: string;
|
|
233
296
|
chain: Network;
|
|
234
|
-
timestamp
|
|
297
|
+
timestamp?: string;
|
|
235
298
|
userOpHash?: string;
|
|
236
299
|
mini_app_id?: string;
|
|
237
300
|
};
|
|
238
|
-
|
|
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
|
-
|
|
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
|
-
|
|
246
|
-
/**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
258
|
-
|
|
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
|
|
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-
|
|
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
|
|
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
|
|
205
|
-
type
|
|
206
|
-
|
|
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
|
|
211
|
-
type
|
|
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
|
-
|
|
290
|
+
/** @deprecated sendTransaction v1 success payload */
|
|
291
|
+
type MiniAppSendTransactionV1SuccessPayload = MiniAppBaseSuccessPayload & {
|
|
229
292
|
transaction_status: 'submitted';
|
|
230
|
-
transaction_id
|
|
293
|
+
transaction_id?: string;
|
|
231
294
|
reference?: string;
|
|
232
|
-
from
|
|
295
|
+
from?: string;
|
|
233
296
|
chain: Network;
|
|
234
|
-
timestamp
|
|
297
|
+
timestamp?: string;
|
|
235
298
|
userOpHash?: string;
|
|
236
299
|
mini_app_id?: string;
|
|
237
300
|
};
|
|
238
|
-
|
|
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
|
-
|
|
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
|
-
|
|
246
|
-
/**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
258
|
-
|
|
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
|
|
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 };
|
package/package.json
CHANGED
|
@@ -119,25 +119,17 @@
|
|
|
119
119
|
"wagmi": "^3.0.0"
|
|
120
120
|
},
|
|
121
121
|
"peerDependenciesMeta": {
|
|
122
|
-
"
|
|
122
|
+
"siwe": {
|
|
123
123
|
"optional": true
|
|
124
124
|
},
|
|
125
|
-
"
|
|
125
|
+
"viem": {
|
|
126
126
|
"optional": true
|
|
127
127
|
},
|
|
128
|
-
"
|
|
128
|
+
"wagmi": {
|
|
129
129
|
"optional": true
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
"private": false,
|
|
133
|
-
"scripts": {
|
|
134
|
-
"build": "tsup",
|
|
135
|
-
"dev": "tsup --watch",
|
|
136
|
-
"lint": "prettier --check . --ignore-path ../../.prettierignore",
|
|
137
|
-
"prepublishOnly": "npm run build",
|
|
138
|
-
"test": "jest",
|
|
139
|
-
"type-check": "tsc --noEmit"
|
|
140
|
-
},
|
|
141
133
|
"type": "module",
|
|
142
134
|
"types": "./build/index.d.ts",
|
|
143
135
|
"typesVersions": {
|
|
@@ -148,5 +140,12 @@
|
|
|
148
140
|
]
|
|
149
141
|
}
|
|
150
142
|
},
|
|
151
|
-
"version": "2.0.0-dev.
|
|
152
|
-
|
|
143
|
+
"version": "2.0.0-dev.1",
|
|
144
|
+
"scripts": {
|
|
145
|
+
"build": "tsup",
|
|
146
|
+
"dev": "tsup --watch",
|
|
147
|
+
"lint": "prettier --check . --ignore-path ../../.prettierignore",
|
|
148
|
+
"test": "jest",
|
|
149
|
+
"type-check": "tsc --noEmit"
|
|
150
|
+
}
|
|
151
|
+
}
|