Skip to content

Commit

Permalink
Remove .strict() from walletSchemas to allow extra fields for operati…
Browse files Browse the repository at this point in the history
…ons wallets
  • Loading branch information
vponline committed Oct 3, 2022
1 parent 01dcc54 commit e3add55
Showing 1 changed file with 29 additions and 39 deletions.
68 changes: 29 additions & 39 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,49 +43,39 @@ export const walletTypeSchema = z.union([
z.literal('Airseeker'),
]);

const providerWalletSchema = z
.object({
walletType: z.literal('Provider'),
address: config.evmAddressSchema,
providerXpub: z.string(),
apiName: z.string().optional(),
})
.strict();
const providerWalletSchema = z.object({
walletType: z.literal('Provider'),
address: config.evmAddressSchema,
providerXpub: z.string(),
apiName: z.string().optional(),
});

const api3WalletSchema = z
.object({
walletType: z.literal('API3'),
address: config.evmAddressSchema,
apiName: z.string().optional(),
})
.strict();
const api3WalletSchema = z.object({
walletType: z.literal('API3'),
address: config.evmAddressSchema,
apiName: z.string().optional(),
});

const providerSponsorWalletSchema = z
.object({
walletType: z.literal('Provider-Sponsor'),
sponsor: config.evmAddressSchema,
providerXpub: z.string(),
apiName: z.string().optional(),
})
.strict();
const providerSponsorWalletSchema = z.object({
walletType: z.literal('Provider-Sponsor'),
sponsor: config.evmAddressSchema,
providerXpub: z.string(),
apiName: z.string().optional(),
});

const api3SponsorWalletSchema = z
.object({
walletType: z.literal('API3-Sponsor'),
sponsor: config.evmAddressSchema,
providerXpub: z.string(),
apiName: z.string().optional(),
})
.strict();
const api3SponsorWalletSchema = z.object({
walletType: z.literal('API3-Sponsor'),
sponsor: config.evmAddressSchema,
providerXpub: z.string(),
apiName: z.string().optional(),
});

const airseekerSponsorWalletSchema = z
.object({
walletType: z.literal('Airseeker'),
sponsor: config.evmAddressSchema,
providerXpub: z.string(),
apiName: z.string().optional(),
})
.strict();
const airseekerSponsorWalletSchema = z.object({
walletType: z.literal('Airseeker'),
sponsor: config.evmAddressSchema,
providerXpub: z.string(),
apiName: z.string().optional(),
});

export const walletSchema = z.discriminatedUnion('walletType', [
providerWalletSchema,
Expand Down

0 comments on commit e3add55

Please sign in to comment.