@worldcoin/minikit-js 0.0.30-internal-alpha → 0.0.32-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 +50 -11
- package/build/index.d.cts +8 -4
- package/build/index.d.ts +8 -4
- package/build/index.js +50 -11
- package/package.json +2 -2
package/build/index.cjs
CHANGED
|
@@ -482,6 +482,13 @@ var _MiniKit = class _MiniKit {
|
|
|
482
482
|
const commandInput = input.find(
|
|
483
483
|
(command) => command.name === commandName
|
|
484
484
|
);
|
|
485
|
+
if (!commandInput) {
|
|
486
|
+
console.error(
|
|
487
|
+
`Command ${commandName} is not supported by the app. Try updating the app version`
|
|
488
|
+
);
|
|
489
|
+
} else {
|
|
490
|
+
_MiniKit.isCommandAvailable[commandName] = true;
|
|
491
|
+
}
|
|
485
492
|
return commandInput ? commandInput.supported_versions.includes(version) : false;
|
|
486
493
|
}
|
|
487
494
|
);
|
|
@@ -501,13 +508,6 @@ var _MiniKit = class _MiniKit {
|
|
|
501
508
|
errorMessage: MiniKitInstallErrorMessage["outside_of_worldapp" /* OutsideOfWorldApp */]
|
|
502
509
|
};
|
|
503
510
|
}
|
|
504
|
-
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
505
|
-
return {
|
|
506
|
-
success: false,
|
|
507
|
-
errorCode: "app_out_of_date" /* AppOutOfDate */,
|
|
508
|
-
errorMessage: MiniKitInstallErrorMessage["app_out_of_date" /* AppOutOfDate */]
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
511
|
try {
|
|
512
512
|
window.MiniKit = _MiniKit;
|
|
513
513
|
this.sendInit();
|
|
@@ -522,6 +522,13 @@ var _MiniKit = class _MiniKit {
|
|
|
522
522
|
errorMessage: MiniKitInstallErrorMessage["unknown" /* Unknown */]
|
|
523
523
|
};
|
|
524
524
|
}
|
|
525
|
+
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
526
|
+
return {
|
|
527
|
+
success: false,
|
|
528
|
+
errorCode: "app_out_of_date" /* AppOutOfDate */,
|
|
529
|
+
errorMessage: MiniKitInstallErrorMessage["app_out_of_date" /* AppOutOfDate */]
|
|
530
|
+
};
|
|
531
|
+
}
|
|
525
532
|
return { success: true };
|
|
526
533
|
}
|
|
527
534
|
static isInstalled(debug) {
|
|
@@ -538,6 +545,14 @@ _MiniKit.commandVersion = {
|
|
|
538
545
|
["sign-message" /* SignMessage */]: 1,
|
|
539
546
|
["sign-typed-data" /* SignTypedData */]: 1
|
|
540
547
|
};
|
|
548
|
+
_MiniKit.isCommandAvailable = {
|
|
549
|
+
["verify" /* Verify */]: false,
|
|
550
|
+
["pay" /* Pay */]: false,
|
|
551
|
+
["wallet-auth" /* WalletAuth */]: false,
|
|
552
|
+
["send-transaction" /* SendTransaction */]: false,
|
|
553
|
+
["sign-message" /* SignMessage */]: false,
|
|
554
|
+
["sign-typed-data" /* SignTypedData */]: false
|
|
555
|
+
};
|
|
541
556
|
_MiniKit.listeners = {
|
|
542
557
|
["miniapp-verify-action" /* MiniAppVerifyAction */]: () => {
|
|
543
558
|
},
|
|
@@ -555,6 +570,12 @@ _MiniKit.listeners = {
|
|
|
555
570
|
_MiniKit.walletAddress = null;
|
|
556
571
|
_MiniKit.commands = {
|
|
557
572
|
verify: (payload) => {
|
|
573
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["verify" /* Verify */]) {
|
|
574
|
+
console.error(
|
|
575
|
+
"'verify' command is unavailable. Check MiniKit.install() or update the app version"
|
|
576
|
+
);
|
|
577
|
+
return null;
|
|
578
|
+
}
|
|
558
579
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
559
580
|
const eventPayload = {
|
|
560
581
|
...payload,
|
|
@@ -570,9 +591,9 @@ _MiniKit.commands = {
|
|
|
570
591
|
return eventPayload;
|
|
571
592
|
},
|
|
572
593
|
pay: (payload) => {
|
|
573
|
-
if (typeof window === "undefined") {
|
|
594
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["pay" /* Pay */]) {
|
|
574
595
|
console.error(
|
|
575
|
-
"'pay'
|
|
596
|
+
"'pay' command is unavailable. Check MiniKit.install() or update the app version"
|
|
576
597
|
);
|
|
577
598
|
return null;
|
|
578
599
|
}
|
|
@@ -592,9 +613,9 @@ _MiniKit.commands = {
|
|
|
592
613
|
return eventPayload;
|
|
593
614
|
},
|
|
594
615
|
walletAuth: (payload) => {
|
|
595
|
-
if (typeof window === "undefined") {
|
|
616
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["wallet-auth" /* WalletAuth */]) {
|
|
596
617
|
console.error(
|
|
597
|
-
"'walletAuth'
|
|
618
|
+
"'walletAuth' command is unavailable. Check MiniKit.install() or update the app version"
|
|
598
619
|
);
|
|
599
620
|
return null;
|
|
600
621
|
}
|
|
@@ -636,6 +657,12 @@ _MiniKit.commands = {
|
|
|
636
657
|
return walletAuthPayload;
|
|
637
658
|
},
|
|
638
659
|
sendTransaction: (payload) => {
|
|
660
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["send-transaction" /* SendTransaction */]) {
|
|
661
|
+
console.error(
|
|
662
|
+
"'sendTransaction' command is unavailable. Check MiniKit.install() or update the app version"
|
|
663
|
+
);
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
639
666
|
sendMiniKitEvent({
|
|
640
667
|
command: "send-transaction" /* SendTransaction */,
|
|
641
668
|
version: 1,
|
|
@@ -644,6 +671,12 @@ _MiniKit.commands = {
|
|
|
644
671
|
return payload;
|
|
645
672
|
},
|
|
646
673
|
signMessage: (payload) => {
|
|
674
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["sign-message" /* SignMessage */]) {
|
|
675
|
+
console.error(
|
|
676
|
+
"'signMessage' command is unavailable. Check MiniKit.install() or update the app version"
|
|
677
|
+
);
|
|
678
|
+
return null;
|
|
679
|
+
}
|
|
647
680
|
sendMiniKitEvent({
|
|
648
681
|
command: "sign-message" /* SignMessage */,
|
|
649
682
|
version: 1,
|
|
@@ -652,6 +685,12 @@ _MiniKit.commands = {
|
|
|
652
685
|
return payload;
|
|
653
686
|
},
|
|
654
687
|
signTypedData: (payload) => {
|
|
688
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["sign-typed-data" /* SignTypedData */]) {
|
|
689
|
+
console.error(
|
|
690
|
+
"'signTypedData' command is unavailable. Check MiniKit.install() or update the app version"
|
|
691
|
+
);
|
|
692
|
+
return null;
|
|
693
|
+
}
|
|
655
694
|
sendMiniKitEvent({
|
|
656
695
|
command: "sign-typed-data" /* SignTypedData */,
|
|
657
696
|
version: 1,
|
package/build/index.d.cts
CHANGED
|
@@ -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;
|
|
@@ -317,6 +320,7 @@ type SiweMessage = {
|
|
|
317
320
|
declare class MiniKit {
|
|
318
321
|
private static readonly MINIKIT_VERSION;
|
|
319
322
|
private static readonly commandVersion;
|
|
323
|
+
private static isCommandAvailable;
|
|
320
324
|
private static listeners;
|
|
321
325
|
static walletAddress: string | null;
|
|
322
326
|
private static sendInit;
|
|
@@ -327,12 +331,12 @@ declare class MiniKit {
|
|
|
327
331
|
static install(): MiniKitInstallReturnType;
|
|
328
332
|
static isInstalled(debug?: boolean): boolean;
|
|
329
333
|
static commands: {
|
|
330
|
-
verify: (payload: VerifyCommandInput) => VerifyCommandPayload;
|
|
334
|
+
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
331
335
|
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
332
336
|
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
333
|
-
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload;
|
|
334
|
-
signMessage: (payload: SignMessageInput) => SignMessagePayload;
|
|
335
|
-
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload;
|
|
337
|
+
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
338
|
+
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
339
|
+
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
336
340
|
};
|
|
337
341
|
}
|
|
338
342
|
|
package/build/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -317,6 +320,7 @@ type SiweMessage = {
|
|
|
317
320
|
declare class MiniKit {
|
|
318
321
|
private static readonly MINIKIT_VERSION;
|
|
319
322
|
private static readonly commandVersion;
|
|
323
|
+
private static isCommandAvailable;
|
|
320
324
|
private static listeners;
|
|
321
325
|
static walletAddress: string | null;
|
|
322
326
|
private static sendInit;
|
|
@@ -327,12 +331,12 @@ declare class MiniKit {
|
|
|
327
331
|
static install(): MiniKitInstallReturnType;
|
|
328
332
|
static isInstalled(debug?: boolean): boolean;
|
|
329
333
|
static commands: {
|
|
330
|
-
verify: (payload: VerifyCommandInput) => VerifyCommandPayload;
|
|
334
|
+
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
331
335
|
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
332
336
|
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
333
|
-
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload;
|
|
334
|
-
signMessage: (payload: SignMessageInput) => SignMessagePayload;
|
|
335
|
-
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload;
|
|
337
|
+
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
338
|
+
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
339
|
+
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
336
340
|
};
|
|
337
341
|
}
|
|
338
342
|
|
package/build/index.js
CHANGED
|
@@ -435,6 +435,13 @@ var _MiniKit = class _MiniKit {
|
|
|
435
435
|
const commandInput = input.find(
|
|
436
436
|
(command) => command.name === commandName
|
|
437
437
|
);
|
|
438
|
+
if (!commandInput) {
|
|
439
|
+
console.error(
|
|
440
|
+
`Command ${commandName} is not supported by the app. Try updating the app version`
|
|
441
|
+
);
|
|
442
|
+
} else {
|
|
443
|
+
_MiniKit.isCommandAvailable[commandName] = true;
|
|
444
|
+
}
|
|
438
445
|
return commandInput ? commandInput.supported_versions.includes(version) : false;
|
|
439
446
|
}
|
|
440
447
|
);
|
|
@@ -454,13 +461,6 @@ var _MiniKit = class _MiniKit {
|
|
|
454
461
|
errorMessage: MiniKitInstallErrorMessage["outside_of_worldapp" /* OutsideOfWorldApp */]
|
|
455
462
|
};
|
|
456
463
|
}
|
|
457
|
-
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
458
|
-
return {
|
|
459
|
-
success: false,
|
|
460
|
-
errorCode: "app_out_of_date" /* AppOutOfDate */,
|
|
461
|
-
errorMessage: MiniKitInstallErrorMessage["app_out_of_date" /* AppOutOfDate */]
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
464
|
try {
|
|
465
465
|
window.MiniKit = _MiniKit;
|
|
466
466
|
this.sendInit();
|
|
@@ -475,6 +475,13 @@ var _MiniKit = class _MiniKit {
|
|
|
475
475
|
errorMessage: MiniKitInstallErrorMessage["unknown" /* Unknown */]
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
|
+
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
479
|
+
return {
|
|
480
|
+
success: false,
|
|
481
|
+
errorCode: "app_out_of_date" /* AppOutOfDate */,
|
|
482
|
+
errorMessage: MiniKitInstallErrorMessage["app_out_of_date" /* AppOutOfDate */]
|
|
483
|
+
};
|
|
484
|
+
}
|
|
478
485
|
return { success: true };
|
|
479
486
|
}
|
|
480
487
|
static isInstalled(debug) {
|
|
@@ -491,6 +498,14 @@ _MiniKit.commandVersion = {
|
|
|
491
498
|
["sign-message" /* SignMessage */]: 1,
|
|
492
499
|
["sign-typed-data" /* SignTypedData */]: 1
|
|
493
500
|
};
|
|
501
|
+
_MiniKit.isCommandAvailable = {
|
|
502
|
+
["verify" /* Verify */]: false,
|
|
503
|
+
["pay" /* Pay */]: false,
|
|
504
|
+
["wallet-auth" /* WalletAuth */]: false,
|
|
505
|
+
["send-transaction" /* SendTransaction */]: false,
|
|
506
|
+
["sign-message" /* SignMessage */]: false,
|
|
507
|
+
["sign-typed-data" /* SignTypedData */]: false
|
|
508
|
+
};
|
|
494
509
|
_MiniKit.listeners = {
|
|
495
510
|
["miniapp-verify-action" /* MiniAppVerifyAction */]: () => {
|
|
496
511
|
},
|
|
@@ -508,6 +523,12 @@ _MiniKit.listeners = {
|
|
|
508
523
|
_MiniKit.walletAddress = null;
|
|
509
524
|
_MiniKit.commands = {
|
|
510
525
|
verify: (payload) => {
|
|
526
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["verify" /* Verify */]) {
|
|
527
|
+
console.error(
|
|
528
|
+
"'verify' command is unavailable. Check MiniKit.install() or update the app version"
|
|
529
|
+
);
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
511
532
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
512
533
|
const eventPayload = {
|
|
513
534
|
...payload,
|
|
@@ -523,9 +544,9 @@ _MiniKit.commands = {
|
|
|
523
544
|
return eventPayload;
|
|
524
545
|
},
|
|
525
546
|
pay: (payload) => {
|
|
526
|
-
if (typeof window === "undefined") {
|
|
547
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["pay" /* Pay */]) {
|
|
527
548
|
console.error(
|
|
528
|
-
"'pay'
|
|
549
|
+
"'pay' command is unavailable. Check MiniKit.install() or update the app version"
|
|
529
550
|
);
|
|
530
551
|
return null;
|
|
531
552
|
}
|
|
@@ -545,9 +566,9 @@ _MiniKit.commands = {
|
|
|
545
566
|
return eventPayload;
|
|
546
567
|
},
|
|
547
568
|
walletAuth: (payload) => {
|
|
548
|
-
if (typeof window === "undefined") {
|
|
569
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["wallet-auth" /* WalletAuth */]) {
|
|
549
570
|
console.error(
|
|
550
|
-
"'walletAuth'
|
|
571
|
+
"'walletAuth' command is unavailable. Check MiniKit.install() or update the app version"
|
|
551
572
|
);
|
|
552
573
|
return null;
|
|
553
574
|
}
|
|
@@ -589,6 +610,12 @@ _MiniKit.commands = {
|
|
|
589
610
|
return walletAuthPayload;
|
|
590
611
|
},
|
|
591
612
|
sendTransaction: (payload) => {
|
|
613
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["send-transaction" /* SendTransaction */]) {
|
|
614
|
+
console.error(
|
|
615
|
+
"'sendTransaction' command is unavailable. Check MiniKit.install() or update the app version"
|
|
616
|
+
);
|
|
617
|
+
return null;
|
|
618
|
+
}
|
|
592
619
|
sendMiniKitEvent({
|
|
593
620
|
command: "send-transaction" /* SendTransaction */,
|
|
594
621
|
version: 1,
|
|
@@ -597,6 +624,12 @@ _MiniKit.commands = {
|
|
|
597
624
|
return payload;
|
|
598
625
|
},
|
|
599
626
|
signMessage: (payload) => {
|
|
627
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["sign-message" /* SignMessage */]) {
|
|
628
|
+
console.error(
|
|
629
|
+
"'signMessage' command is unavailable. Check MiniKit.install() or update the app version"
|
|
630
|
+
);
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
600
633
|
sendMiniKitEvent({
|
|
601
634
|
command: "sign-message" /* SignMessage */,
|
|
602
635
|
version: 1,
|
|
@@ -605,6 +638,12 @@ _MiniKit.commands = {
|
|
|
605
638
|
return payload;
|
|
606
639
|
},
|
|
607
640
|
signTypedData: (payload) => {
|
|
641
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["sign-typed-data" /* SignTypedData */]) {
|
|
642
|
+
console.error(
|
|
643
|
+
"'signTypedData' command is unavailable. Check MiniKit.install() or update the app version"
|
|
644
|
+
);
|
|
645
|
+
return null;
|
|
646
|
+
}
|
|
608
647
|
sendMiniKitEvent({
|
|
609
648
|
command: "sign-typed-data" /* SignTypedData */,
|
|
610
649
|
version: 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worldcoin/minikit-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32-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,8 +8,8 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"import": "./build/index.js",
|
|
12
11
|
"types": "./build/index.d.ts",
|
|
12
|
+
"import": "./build/index.js",
|
|
13
13
|
"require": "./build/index.cjs"
|
|
14
14
|
}
|
|
15
15
|
},
|