Skip to content

Commit

Permalink
chore(utils): add zkAppAccount to presentation request
Browse files Browse the repository at this point in the history
  • Loading branch information
martonmoro committed Dec 3, 2024
1 parent dd75fec commit de77460
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/providers/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
TransactionReceiptSchema,
TypedSendableSchema,
ZkAppCommandPayload,
zkAppAccountSchema,
} from "@mina-js/utils";
import { z } from "zod";

Expand Down Expand Up @@ -100,7 +101,12 @@ export const StorePrivateCredentialRequestParamsSchema =
}).strict();
export const PresentationRequestParamsSchema = RequestWithContext.extend({
method: z.literal("mina_requestPresentation"),
params: z.array(PresentationRequestSchema),
params: z.array(
z.object({
presentationRequest: PresentationRequestSchema,
zkAppAccount: zkAppAccountSchema.optional(),
}).strict(),
),
}).strict();

// Returns
Expand Down
8 changes: 8 additions & 0 deletions packages/utils/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const NetworkId = z.string().regex(networkPattern);

export const KlesiaNetwork = z.enum(["devnet", "mainnet", "zeko_devnet"]);

export const MinaScanNetwork = z.enum(["devnet", "mainnet"]);

export const FeePayerSchema = z
.object({
feePayer: PublicKeySchema,
Expand Down Expand Up @@ -742,6 +744,12 @@ export const PresentationRequestSchema = z
})
.strict();

export const zkAppAccountSchema = z.object({
address: PublicKeySchema,
tokenId: z.string(),
network: MinaScanNetwork,
});

// Private Credentials: Witness Schemas

const SimpleWitnessSchema = z
Expand Down

0 comments on commit de77460

Please sign in to comment.