-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move propsDecoder * Add Request as type * Update workers-types * Fix lint error
- Loading branch information
Showing
6 changed files
with
27 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { EVMGateway, StorageLayout } from './EVMGateway.js'; | ||
export { EVMProofHelper, type StateProof } from './EVMProofHelper.js'; | ||
export type { IProofService, ProvableBlock } from './IProofService.js'; | ||
export type { Router } from './utils.js'; | ||
export { propsDecoder, type Router } from './utils.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
import { Request as CFWRequest } from '@cloudflare/workers-types'; | ||
|
||
import { type Request as CFWRequest } from '@cloudflare/workers-types'; | ||
import { type PropsDecoder } from '@ensdomains/server-analytics'; | ||
export interface Router { | ||
handle: (request: CFWRequest) => Promise<Response>; | ||
} | ||
|
||
export 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/ | ||
); | ||
if (trackingData) { | ||
return { | ||
sender: trackingData[0].slice(1, 42), | ||
calldata: trackingData[0].slice(44).replace('.json', ''), | ||
}; | ||
} else { | ||
return {}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters