Skip to content

Commit

Permalink
Support cors
Browse files Browse the repository at this point in the history
  • Loading branch information
makoto committed Dec 1, 2023
1 parent be7eee5 commit b49dc6f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion arb-gateway/src/worker.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Server } from '@ensdomains/ccip-read-cf-worker';
import { createCors } from 'itty-router';
import type { Router } from '@ensdomains/evm-gateway';

interface Env {
L1_PROVIDER_URL: string;
L2_PROVIDER_URL: string;
L2_ROLLUP: string;
}

const {corsify} = createCors()
let app: Router;
async function fetch(request: Request, env: Env) {
// Loading libraries dynamically as a temp work around.
Expand All @@ -31,7 +34,7 @@ async function fetch(request: Request, env: Env) {
gateway.add(server);
app = server.makeApp('/');
}
return app.handle(request);
return app.handle(request).then(corsify);
}

export default {
Expand Down
3 changes: 2 additions & 1 deletion arb-verifier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@arbitrum/nitro-contracts": "^1.1.0",
"@ensdomains/evm-verifier": "^0.1.0",
"@arbitrum/nitro-contracts": "^1.1.0"
"itty-router": "^4.0.23"
}
}
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion evm-gateway/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface Router {
handle: (request: Request) => void;
handle: (request: Request) => Promise<any>;
}

0 comments on commit b49dc6f

Please sign in to comment.