Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #41

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions demo/with-next/components/ClientContent/VerifyAction/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { IDKitConfig, VerificationLevel } from "@worldcoin/idkit-core";
import {
MiniKit,
ResponseEvent,
VerificationErrorCodes,
VerifyCommandInput,
VerificationLevel,
ISuccessResult,
} from "@worldcoin/minikit-js";
import { useCallback, useEffect, useState } from "react";
import * as yup from "yup";
Expand Down Expand Up @@ -53,9 +54,9 @@ export const VerifyAction = () => {
any
> | null>(null);

const [lastUsedAppId, setLastUsedAppId] = useState<
IDKitConfig["app_id"] | null
>(null);
const [lastUsedAppId, setLastUsedAppId] = useState<`app_${string}` | null>(
null
);

const [lastUsedAction, setLastUsedAction] = useState<string | null>(null);

Expand Down Expand Up @@ -101,12 +102,7 @@ export const VerifyAction = () => {
}

const verifyResponse = await verifyProof({
payload: {
proof: payload.proof,
merkle_root: payload.merkle_root,
nullifier_hash: payload.nullifier_hash,
verification_level: payload.verification_level,
},
payload: payload as ISuccessResult,
app_id: lastUsedAppId,
action: lastUsedAction,
});
Expand All @@ -121,7 +117,7 @@ export const VerifyAction = () => {

const verifyAction = useCallback(
(params: {
app_id: IDKitConfig["app_id"];
app_id: `app_${string}`;
action: string;
verification_level?: VerificationLevel;
}) => {
Expand All @@ -148,9 +144,7 @@ export const VerifyAction = () => {
const onProdVerifyClick = useCallback(
(verification_level: VerificationLevel) => {
verifyAction({
app_id: process.env
.NEXT_PUBLIC_PROD_VERIFY_APP_ID as IDKitConfig["app_id"],

app_id: process.env.NEXT_PUBLIC_PROD_VERIFY_APP_ID as `app_${string}`,
action: process.env.NEXT_PUBLIC_PROD_VERIFY_ACTION as string,
verification_level,
});
Expand All @@ -162,8 +156,7 @@ export const VerifyAction = () => {
(verification_level: VerificationLevel) => {
verifyAction({
app_id: process.env
.NEXT_PUBLIC_STAGING_VERIFY_APP_ID as IDKitConfig["app_id"],

.NEXT_PUBLIC_STAGING_VERIFY_APP_ID as `app_${string}`,
action: process.env.NEXT_PUBLIC_STAGING_VERIFY_ACTION as string,
verification_level,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"use server";

import { IDKitConfig, ISuccessResult } from "@worldcoin/idkit-core";

import {
ISuccessResult,
IVerifyResponse,
verifyCloudProof,
} from "@worldcoin/idkit-core/backend";
} from "@worldcoin/minikit-js";

export const verifyProof = async (params: {
app_id: IDKitConfig["app_id"];
app_id: `app_${string}`;
action: string;
payload: ISuccessResult;
}) => {
Expand Down
1 change: 0 additions & 1 deletion demo/with-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"typecheck": "tsc"
},
"dependencies": {
"@worldcoin/idkit-core": "^1.2.0",
"@worldcoin/minikit-js": "workspace:*",
"clsx": "^2.1.1",
"next": "14.2.1",
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ export {

export { Tokens, Network, TokenDecimals } from "./types/payment";
export { tokenToDecimals } from "helpers/payment/client";
export { VerificationLevel } from "@worldcoin/idkit-core";

export { VerificationLevel, ISuccessResult } from "@worldcoin/idkit-core";
export {
verifyCloudProof,
IVerifyResponse,
} from "@worldcoin/idkit-core/backend";
3 changes: 0 additions & 3 deletions src/types/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,12 @@ export enum PaymentErrorMessage {
}

export enum WalletAuthErrorCodes {
InvalidAddress = "invalid_address",
MalformedRequest = "malformed_request",
UserRejected = "user_rejected",
GenericError = "generic_error",
}

export const WalletAuthErrorMessage = {
[WalletAuthErrorCodes.InvalidAddress]:
"The specified address is not valid for the connected wallet.",
[WalletAuthErrorCodes.MalformedRequest]:
"Provided parameters in the request are invalid.",
[WalletAuthErrorCodes.UserRejected]: "User rejected the request.",
Expand Down
Loading