generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
plugin-input.ts
30 lines (25 loc) · 1012 Bytes
/
plugin-input.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { EmitterWebhookEvent as WebhookEvent, EmitterWebhookEventName as WebhookEventName } from "@octokit/webhooks";
import { SupportedEvents } from "./context";
import { StaticDecode, Type as T } from "@sinclair/typebox";
export interface PluginInputs<T extends WebhookEventName = SupportedEvents> {
stateId: string;
eventName: T;
eventPayload: WebhookEvent<T>["payload"];
settings: PermitGenerationSettings;
authToken: string;
ref: string;
}
export const permitRequestSchema = T.Object({
type: T.Union([T.Literal("ERC20"), T.Literal("ERC721")]),
username: T.String(),
amount: T.Number(),
contributionType: T.String(),
tokenAddress: T.String(),
});
export type PermitRequest = StaticDecode<typeof permitRequestSchema>;
export const permitGenerationSettingsSchema = T.Object({
evmNetworkId: T.Number(),
evmPrivateEncrypted: T.String(),
permitRequests: T.Array(permitRequestSchema),
});
export type PermitGenerationSettings = StaticDecode<typeof permitGenerationSettingsSchema>;