@worldcoin/minikit-js 0.0.29-internal-alpha → 0.0.31-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 +57 -13
- package/build/index.d.cts +5 -4
- package/build/index.d.ts +5 -4
- package/build/index.js +57 -13
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -477,8 +477,20 @@ var _MiniKit = class _MiniKit {
|
|
|
477
477
|
this.listeners[event](payload);
|
|
478
478
|
}
|
|
479
479
|
static commandsValid(input) {
|
|
480
|
-
return
|
|
481
|
-
(
|
|
480
|
+
return Object.entries(this.commandVersion).every(
|
|
481
|
+
([commandName, version]) => {
|
|
482
|
+
const commandInput = input.find(
|
|
483
|
+
(command) => command.name === commandName
|
|
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
|
+
}
|
|
492
|
+
return commandInput ? commandInput.supported_versions.includes(version) : false;
|
|
493
|
+
}
|
|
482
494
|
);
|
|
483
495
|
}
|
|
484
496
|
static install() {
|
|
@@ -496,13 +508,6 @@ var _MiniKit = class _MiniKit {
|
|
|
496
508
|
errorMessage: MiniKitInstallErrorMessage["outside_of_worldapp" /* OutsideOfWorldApp */]
|
|
497
509
|
};
|
|
498
510
|
}
|
|
499
|
-
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
500
|
-
return {
|
|
501
|
-
success: false,
|
|
502
|
-
errorCode: "app_out_of_date" /* AppOutOfDate */,
|
|
503
|
-
errorMessage: MiniKitInstallErrorMessage["app_out_of_date" /* AppOutOfDate */]
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
511
|
try {
|
|
507
512
|
window.MiniKit = _MiniKit;
|
|
508
513
|
this.sendInit();
|
|
@@ -517,6 +522,13 @@ var _MiniKit = class _MiniKit {
|
|
|
517
522
|
errorMessage: MiniKitInstallErrorMessage["unknown" /* Unknown */]
|
|
518
523
|
};
|
|
519
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
|
+
}
|
|
520
532
|
return { success: true };
|
|
521
533
|
}
|
|
522
534
|
static isInstalled(debug) {
|
|
@@ -533,6 +545,14 @@ _MiniKit.commandVersion = {
|
|
|
533
545
|
["sign-message" /* SignMessage */]: 1,
|
|
534
546
|
["sign-typed-data" /* SignTypedData */]: 1
|
|
535
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
|
+
};
|
|
536
556
|
_MiniKit.listeners = {
|
|
537
557
|
["miniapp-verify-action" /* MiniAppVerifyAction */]: () => {
|
|
538
558
|
},
|
|
@@ -550,6 +570,12 @@ _MiniKit.listeners = {
|
|
|
550
570
|
_MiniKit.walletAddress = null;
|
|
551
571
|
_MiniKit.commands = {
|
|
552
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
|
+
}
|
|
553
579
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
554
580
|
const eventPayload = {
|
|
555
581
|
...payload,
|
|
@@ -565,9 +591,9 @@ _MiniKit.commands = {
|
|
|
565
591
|
return eventPayload;
|
|
566
592
|
},
|
|
567
593
|
pay: (payload) => {
|
|
568
|
-
if (typeof window === "undefined") {
|
|
594
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["pay" /* Pay */]) {
|
|
569
595
|
console.error(
|
|
570
|
-
"'pay'
|
|
596
|
+
"'pay' command is unavailable. Check MiniKit.install() or update the app version"
|
|
571
597
|
);
|
|
572
598
|
return null;
|
|
573
599
|
}
|
|
@@ -587,9 +613,9 @@ _MiniKit.commands = {
|
|
|
587
613
|
return eventPayload;
|
|
588
614
|
},
|
|
589
615
|
walletAuth: (payload) => {
|
|
590
|
-
if (typeof window === "undefined") {
|
|
616
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["wallet-auth" /* WalletAuth */]) {
|
|
591
617
|
console.error(
|
|
592
|
-
"'walletAuth'
|
|
618
|
+
"'walletAuth' command is unavailable. Check MiniKit.install() or update the app version"
|
|
593
619
|
);
|
|
594
620
|
return null;
|
|
595
621
|
}
|
|
@@ -631,6 +657,12 @@ _MiniKit.commands = {
|
|
|
631
657
|
return walletAuthPayload;
|
|
632
658
|
},
|
|
633
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
|
+
}
|
|
634
666
|
sendMiniKitEvent({
|
|
635
667
|
command: "send-transaction" /* SendTransaction */,
|
|
636
668
|
version: 1,
|
|
@@ -639,6 +671,12 @@ _MiniKit.commands = {
|
|
|
639
671
|
return payload;
|
|
640
672
|
},
|
|
641
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
|
+
}
|
|
642
680
|
sendMiniKitEvent({
|
|
643
681
|
command: "sign-message" /* SignMessage */,
|
|
644
682
|
version: 1,
|
|
@@ -647,6 +685,12 @@ _MiniKit.commands = {
|
|
|
647
685
|
return payload;
|
|
648
686
|
},
|
|
649
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
|
+
}
|
|
650
694
|
sendMiniKitEvent({
|
|
651
695
|
command: "sign-typed-data" /* SignTypedData */,
|
|
652
696
|
version: 1,
|
package/build/index.d.cts
CHANGED
|
@@ -317,6 +317,7 @@ type SiweMessage = {
|
|
|
317
317
|
declare class MiniKit {
|
|
318
318
|
private static readonly MINIKIT_VERSION;
|
|
319
319
|
private static readonly commandVersion;
|
|
320
|
+
private static isCommandAvailable;
|
|
320
321
|
private static listeners;
|
|
321
322
|
static walletAddress: string | null;
|
|
322
323
|
private static sendInit;
|
|
@@ -327,12 +328,12 @@ declare class MiniKit {
|
|
|
327
328
|
static install(): MiniKitInstallReturnType;
|
|
328
329
|
static isInstalled(debug?: boolean): boolean;
|
|
329
330
|
static commands: {
|
|
330
|
-
verify: (payload: VerifyCommandInput) => VerifyCommandPayload;
|
|
331
|
+
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
331
332
|
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
332
333
|
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
333
|
-
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload;
|
|
334
|
-
signMessage: (payload: SignMessageInput) => SignMessagePayload;
|
|
335
|
-
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload;
|
|
334
|
+
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
335
|
+
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
336
|
+
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
336
337
|
};
|
|
337
338
|
}
|
|
338
339
|
|
package/build/index.d.ts
CHANGED
|
@@ -317,6 +317,7 @@ type SiweMessage = {
|
|
|
317
317
|
declare class MiniKit {
|
|
318
318
|
private static readonly MINIKIT_VERSION;
|
|
319
319
|
private static readonly commandVersion;
|
|
320
|
+
private static isCommandAvailable;
|
|
320
321
|
private static listeners;
|
|
321
322
|
static walletAddress: string | null;
|
|
322
323
|
private static sendInit;
|
|
@@ -327,12 +328,12 @@ declare class MiniKit {
|
|
|
327
328
|
static install(): MiniKitInstallReturnType;
|
|
328
329
|
static isInstalled(debug?: boolean): boolean;
|
|
329
330
|
static commands: {
|
|
330
|
-
verify: (payload: VerifyCommandInput) => VerifyCommandPayload;
|
|
331
|
+
verify: (payload: VerifyCommandInput) => VerifyCommandPayload | null;
|
|
331
332
|
pay: (payload: PayCommandInput) => PayCommandPayload | null;
|
|
332
333
|
walletAuth: (payload: WalletAuthInput) => WalletAuthPayload | null;
|
|
333
|
-
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload;
|
|
334
|
-
signMessage: (payload: SignMessageInput) => SignMessagePayload;
|
|
335
|
-
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload;
|
|
334
|
+
sendTransaction: (payload: SendTransactionInput) => SendTransactionPayload | null;
|
|
335
|
+
signMessage: (payload: SignMessageInput) => SignMessagePayload | null;
|
|
336
|
+
signTypedData: (payload: SignTypedDataInput) => SignTypedDataPayload | null;
|
|
336
337
|
};
|
|
337
338
|
}
|
|
338
339
|
|
package/build/index.js
CHANGED
|
@@ -430,8 +430,20 @@ var _MiniKit = class _MiniKit {
|
|
|
430
430
|
this.listeners[event](payload);
|
|
431
431
|
}
|
|
432
432
|
static commandsValid(input) {
|
|
433
|
-
return
|
|
434
|
-
(
|
|
433
|
+
return Object.entries(this.commandVersion).every(
|
|
434
|
+
([commandName, version]) => {
|
|
435
|
+
const commandInput = input.find(
|
|
436
|
+
(command) => command.name === commandName
|
|
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
|
+
}
|
|
445
|
+
return commandInput ? commandInput.supported_versions.includes(version) : false;
|
|
446
|
+
}
|
|
435
447
|
);
|
|
436
448
|
}
|
|
437
449
|
static install() {
|
|
@@ -449,13 +461,6 @@ var _MiniKit = class _MiniKit {
|
|
|
449
461
|
errorMessage: MiniKitInstallErrorMessage["outside_of_worldapp" /* OutsideOfWorldApp */]
|
|
450
462
|
};
|
|
451
463
|
}
|
|
452
|
-
if (!this.commandsValid(window.WorldApp.supported_commands)) {
|
|
453
|
-
return {
|
|
454
|
-
success: false,
|
|
455
|
-
errorCode: "app_out_of_date" /* AppOutOfDate */,
|
|
456
|
-
errorMessage: MiniKitInstallErrorMessage["app_out_of_date" /* AppOutOfDate */]
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
464
|
try {
|
|
460
465
|
window.MiniKit = _MiniKit;
|
|
461
466
|
this.sendInit();
|
|
@@ -470,6 +475,13 @@ var _MiniKit = class _MiniKit {
|
|
|
470
475
|
errorMessage: MiniKitInstallErrorMessage["unknown" /* Unknown */]
|
|
471
476
|
};
|
|
472
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
|
+
}
|
|
473
485
|
return { success: true };
|
|
474
486
|
}
|
|
475
487
|
static isInstalled(debug) {
|
|
@@ -486,6 +498,14 @@ _MiniKit.commandVersion = {
|
|
|
486
498
|
["sign-message" /* SignMessage */]: 1,
|
|
487
499
|
["sign-typed-data" /* SignTypedData */]: 1
|
|
488
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
|
+
};
|
|
489
509
|
_MiniKit.listeners = {
|
|
490
510
|
["miniapp-verify-action" /* MiniAppVerifyAction */]: () => {
|
|
491
511
|
},
|
|
@@ -503,6 +523,12 @@ _MiniKit.listeners = {
|
|
|
503
523
|
_MiniKit.walletAddress = null;
|
|
504
524
|
_MiniKit.commands = {
|
|
505
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
|
+
}
|
|
506
532
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
507
533
|
const eventPayload = {
|
|
508
534
|
...payload,
|
|
@@ -518,9 +544,9 @@ _MiniKit.commands = {
|
|
|
518
544
|
return eventPayload;
|
|
519
545
|
},
|
|
520
546
|
pay: (payload) => {
|
|
521
|
-
if (typeof window === "undefined") {
|
|
547
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["pay" /* Pay */]) {
|
|
522
548
|
console.error(
|
|
523
|
-
"'pay'
|
|
549
|
+
"'pay' command is unavailable. Check MiniKit.install() or update the app version"
|
|
524
550
|
);
|
|
525
551
|
return null;
|
|
526
552
|
}
|
|
@@ -540,9 +566,9 @@ _MiniKit.commands = {
|
|
|
540
566
|
return eventPayload;
|
|
541
567
|
},
|
|
542
568
|
walletAuth: (payload) => {
|
|
543
|
-
if (typeof window === "undefined") {
|
|
569
|
+
if (typeof window === "undefined" || !_MiniKit.isCommandAvailable["wallet-auth" /* WalletAuth */]) {
|
|
544
570
|
console.error(
|
|
545
|
-
"'walletAuth'
|
|
571
|
+
"'walletAuth' command is unavailable. Check MiniKit.install() or update the app version"
|
|
546
572
|
);
|
|
547
573
|
return null;
|
|
548
574
|
}
|
|
@@ -584,6 +610,12 @@ _MiniKit.commands = {
|
|
|
584
610
|
return walletAuthPayload;
|
|
585
611
|
},
|
|
586
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
|
+
}
|
|
587
619
|
sendMiniKitEvent({
|
|
588
620
|
command: "send-transaction" /* SendTransaction */,
|
|
589
621
|
version: 1,
|
|
@@ -592,6 +624,12 @@ _MiniKit.commands = {
|
|
|
592
624
|
return payload;
|
|
593
625
|
},
|
|
594
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
|
+
}
|
|
595
633
|
sendMiniKitEvent({
|
|
596
634
|
command: "sign-message" /* SignMessage */,
|
|
597
635
|
version: 1,
|
|
@@ -600,6 +638,12 @@ _MiniKit.commands = {
|
|
|
600
638
|
return payload;
|
|
601
639
|
},
|
|
602
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
|
+
}
|
|
603
647
|
sendMiniKitEvent({
|
|
604
648
|
command: "sign-typed-data" /* SignTypedData */,
|
|
605
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.31-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",
|