Skip to content

Commit

Permalink
bump server-analytics version, update types and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtanrikulu committed Apr 25, 2024
1 parent cd3cb98 commit ffd3fca
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions arb-gateway/package.json
Expand Up @@ -57,9 +57,9 @@
},
"dependencies": {
"@chainlink/ccip-read-server": "^0.2.1",
"@cloudflare/workers-types": "^4.20240117.0",
"@cloudflare/workers-types": "^4.20240423.0",
"@ensdomains/evm-gateway": "0.1.0-beta.2",
"@ensdomains/server-analytics": "0.0.1-alpha.3",
"@ensdomains/server-analytics": "0.0.1-alpha.5",
"@ethereumjs/block": "^5.0.0",
"@nomicfoundation/ethereumjs-block": "^5.0.2",
"commander": "^11.0.0",
Expand Down
9 changes: 6 additions & 3 deletions arb-gateway/src/worker.ts
Expand Up @@ -2,7 +2,7 @@ import { Request as CFWRequest } from '@cloudflare/workers-types';
import { Server } from '@ensdomains/ccip-read-cf-worker';
import type { Router } from '@ensdomains/evm-gateway';
import { InMemoryBlockCache } from './blockCache/InMemoryBlockCache.js';
import { Tracker } from '@ensdomains/server-analytics';
import { Tracker, type PropsDecoder } from '@ensdomains/server-analytics';
interface Env {
L1_PROVIDER_URL: string;
L2_PROVIDER_URL: string;
Expand All @@ -13,7 +13,10 @@ interface Env {

let app: Router;

const propsDecoder = (request: CFWRequest) => {
const propsDecoder: PropsDecoder<CFWRequest> = (request?: CFWRequest) => {
if(!request || !request.url) {
return {}
}
const trackingData = request.url.match(
/\/0x[a-fA-F0-9]{40}\/0x[a-fA-F0-9]{1,}\.json/
);
Expand Down Expand Up @@ -76,7 +79,7 @@ async function fetch(request: CFWRequest, env: Env) {
);
return app
.handle(request)
.then(tracker.logResult.bind(null, request, propsDecoder));
.then(tracker.logResult.bind(null, propsDecoder, request));
}

export default {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion op-gateway/package.json
Expand Up @@ -57,9 +57,10 @@
},
"dependencies": {
"@chainlink/ccip-read-server": "^0.2.1",
"@cloudflare/workers-types": "^4.20240423.0",
"@commander-js/extra-typings": "^11.0.0",
"@ensdomains/evm-gateway": "0.1.0-beta.2",
"@ensdomains/server-analytics": "0.0.1-alpha.3",
"@ensdomains/server-analytics": "0.0.1-alpha.5",
"@ethereumjs/block": "^5.0.0",
"@nomicfoundation/ethereumjs-block": "^5.0.2",
"commander": "^11.0.0",
Expand Down
9 changes: 6 additions & 3 deletions op-gateway/src/worker.ts
@@ -1,7 +1,7 @@
import { Request as CFWRequest } from '@cloudflare/workers-types';
import { Server } from '@ensdomains/ccip-read-cf-worker';
import type { Router } from '@ensdomains/evm-gateway';
import { Tracker } from '@ensdomains/server-analytics';
import { Tracker, type PropsDecoder } from '@ensdomains/server-analytics';

interface Env {
L1_PROVIDER_URL: string;
Expand All @@ -14,7 +14,10 @@ interface Env {

let app: Router;

const propsDecoder = (request: CFWRequest) => {
const propsDecoder: PropsDecoder<CFWRequest> = (request?: CFWRequest) => {
if(!request || !request.url) {
return {}
}
const trackingData = request.url.match(
/\/0x[a-fA-F0-9]{40}\/0x[a-fA-F0-9]{1,}\.json/
);
Expand Down Expand Up @@ -77,7 +80,7 @@ async function fetch(request: CFWRequest, env: Env) {

return app
.handle(request)
.then(tracker.logResult.bind(null, request, propsDecoder));
.then(tracker.logResult.bind(null, propsDecoder, request));
}

export default {
Expand Down

0 comments on commit ffd3fca

Please sign in to comment.