Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/scan/src/lib/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const registerResource = async (

const mappedAccepts = x402Options
.map(opt => ({
scheme: (opt.scheme ?? 'exact') as 'exact',
scheme: (opt.scheme ?? 'exact') as 'exact' | 'escrow',
network: normalizeChainId(opt.network).replace(
'-',
'_'
Expand Down
2 changes: 1 addition & 1 deletion apps/scan/src/lib/x402/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type InputSchema = OutputSchema['input'];
* the database in a common format for v1 and v2.
*/
export const normalizedAcceptSchema = z3.object({
scheme: z3.literal('exact'),
scheme: z3.enum(['exact', 'escrow']),
network: z3.string(),
maxAmountRequired: z3.string(),
payTo: z3.string(),
Expand Down
2 changes: 1 addition & 1 deletion apps/scan/src/services/db/resources/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const upsertResourceSchema = z.object({
metadata: z.record(z.string(), z.any()).optional(),
accepts: z.array(
z.object({
scheme: z.enum(['exact']),
scheme: z.enum(['exact', 'escrow']),
network: z.union([
z.enum([
'base_sepolia',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "AcceptsScheme" ADD VALUE 'escrow';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ALTER TYPE "AcceptsScheme" ADD VALUE 'escrow';
DO $ BEGIN
ALTER TYPE "AcceptsScheme" ADD VALUE 'escrow';
EXCEPTION WHEN duplicate_object THEN null;
END $;

Migration fails with PostgreSQL error 42710 because the 'escrow' enum value already exists in the production database

Fix on Vercel

1 change: 1 addition & 0 deletions packages/internal/databases/scan/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ model Resources {

enum AcceptsScheme {
exact
escrow
}

enum AcceptsNetwork {
Expand Down
Loading