From 72aa8ef1890072ad00a37d617cae3c99250ac1a8 Mon Sep 17 00:00:00 2001 From: Igor Osipov <89008845+igorosip0v@users.noreply.github.com> Date: Tue, 28 May 2024 14:18:15 +0200 Subject: [PATCH] Sync main with dev (#36) * trigger deploy * feat: add versions (#33) * update app payloads (#35) --- src/minikit.ts | 8 +++++++- src/types/commands.ts | 1 + src/types/responses.ts | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/minikit.ts b/src/minikit.ts index 09f3ff2..16196e6 100644 --- a/src/minikit.ts +++ b/src/minikit.ts @@ -81,7 +81,11 @@ export class MiniKit { verification_level: payload.verification_level || VerificationLevel.Orb, timestamp, }; - sendMiniKitEvent({ command: Command.Verify, payload: eventPayload }); + sendMiniKitEvent({ + command: Command.Verify, + version: 1, + payload: eventPayload, + }); return eventPayload; }, @@ -109,6 +113,7 @@ export class MiniKit { sendMiniKitEvent({ command: Command.Pay, + version: 1, payload: eventPayload, }); @@ -163,6 +168,7 @@ export class MiniKit { sendMiniKitEvent({ command: Command.WalletAuth, + version: 1, payload: walletAuthPayload, }); diff --git a/src/types/commands.ts b/src/types/commands.ts index 72f06eb..8ad2446 100644 --- a/src/types/commands.ts +++ b/src/types/commands.ts @@ -9,6 +9,7 @@ export enum Command { export type WebViewBasePayload = { command: Command; + version: number; payload: Record; }; diff --git a/src/types/responses.ts b/src/types/responses.ts index 6c2557f..8ebf0ed 100644 --- a/src/types/responses.ts +++ b/src/types/responses.ts @@ -19,11 +19,13 @@ export type MiniAppVerifyActionSuccessPayload = { merkle_root: string; nullifier_hash: string; verification_level: VerificationLevel; + version: number; }; export type MiniAppVerifyActionErrorPayload = { status: "error"; error_code: VerificationErrorCodes; + version: number; }; export type MiniAppVerifyActionPayload = @@ -38,11 +40,13 @@ export type MiniAppPaymentSuccessEventPayload = { from: string; chain: Network; timestamp: string; + version: number; }; export type MiniAppPaymentErrorPayload = { status: "error"; error_code: PaymentErrorCodes; + version: number; }; export type MiniAppPaymentPayload = @@ -54,12 +58,14 @@ export type MiniAppWalletAuthSuccessPayload = { message: string; signature: string; address: string; + version: number; }; export type MiniAppWalletAuthErrorPayload = { status: "error"; error_code: WalletAuthErrorCodes; details: (typeof WalletAuthErrorMessage)[WalletAuthErrorCodes]; + version: number; }; export type EventPayload =