Skip to content

Commit

Permalink
Sync main with dev (#36)
Browse files Browse the repository at this point in the history
* trigger deploy

* feat: add versions (#33)

* update app payloads (#35)
  • Loading branch information
igorosip0v authored May 28, 2024
1 parent 85e005b commit 72aa8ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/minikit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down Expand Up @@ -109,6 +113,7 @@ export class MiniKit {

sendMiniKitEvent<WebViewBasePayload>({
command: Command.Pay,
version: 1,
payload: eventPayload,
});

Expand Down Expand Up @@ -163,6 +168,7 @@ export class MiniKit {

sendMiniKitEvent<WebViewBasePayload>({
command: Command.WalletAuth,
version: 1,
payload: walletAuthPayload,
});

Expand Down
1 change: 1 addition & 0 deletions src/types/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum Command {

export type WebViewBasePayload = {
command: Command;
version: number;
payload: Record<string, any>;
};

Expand Down
6 changes: 6 additions & 0 deletions src/types/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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 =
Expand All @@ -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<T extends ResponseEvent = ResponseEvent> =
Expand Down

0 comments on commit 72aa8ef

Please sign in to comment.