-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
797048a
commit 9869949
Showing
60 changed files
with
2,023 additions
and
2,035 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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "@casimir/events", | ||
"private": "true", | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"build": "echo '@casimir/events build not specified. Disregard this warning and any listed errors above if @casimir/events is not needed for the current project build.' && exit 0", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"dependencies": { | ||
"ethers": "^5.7.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^17.0.38" | ||
} | ||
} |
15 changes: 7 additions & 8 deletions
15
services/oracle/src/providers/events.ts → common/events/src/index.ts
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"strict": true, | ||
"preserveConstEnums": true, | ||
"noEmit": true, | ||
"sourceMap": false, | ||
"module": "CommonJS", | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true, | ||
"resolveJsonModule": true | ||
}, | ||
"include": [ | ||
"./src/*" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "@casimir/fetch", | ||
"private": true, | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"build": "echo '@casimir/fetch build not specified. Disregard this warning and any listed errors above if @casimir/fetch is not needed for the current project build.' && exit 0", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^17.0.38" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Retry a fetch request | ||
* @param {RequestInfo} info - URL string or request object | ||
* @param {RequestInit} [init] - Request init options | ||
* @param {number | undefined} retriesLeft - Number of retries left (default: 25) | ||
* @returns {Promise<Response>} Response | ||
* @example | ||
* const response = await fetchRetry('https://example.com') | ||
*/ | ||
export async function fetchRetry(info: RequestInfo, init?: RequestInit, retriesLeft: number | undefined = 25): Promise<Response> { | ||
if (retriesLeft === 0) { | ||
throw new Error('API request failed after maximum retries') | ||
} | ||
|
||
try { | ||
const response = await fetch(info, init) | ||
if (response.status !== 200) { | ||
await new Promise(resolve => setTimeout(resolve, 5000)) | ||
console.log('Retrying fetch request to', info, init) | ||
return await fetchRetry(info, init || {}, retriesLeft - 1) | ||
} | ||
return response | ||
} catch (error) { | ||
await new Promise(resolve => setTimeout(resolve, 5000)) | ||
console.log('Retrying fetch request to', info, init) | ||
return await fetchRetry(info, init || {}, retriesLeft - 1) | ||
} | ||
} |
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "@casimir/format", | ||
"private": true, | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"build": "echo '@casimir/format build not specified. Disregard this warning and any listed errors above if @casimir/format is not needed for the current project build.' && exit 0", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^17.0.38" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Convert any string to camelCase. | ||
* @param string - The input string | ||
* @returns A camelCase string from the input string | ||
*/ | ||
export function camelCase(string: string): string { | ||
const words = string.split(/[\s_-]+/).map(word => { | ||
return word.replace(/\w+/g, (word) => { | ||
return word[0].toUpperCase() + word.slice(1).toLowerCase() | ||
}) | ||
}) | ||
const result = words.join('') | ||
return result[0].toLowerCase() + result.slice(1) | ||
} | ||
|
||
/** | ||
* Convert any string to PascalCase | ||
* | ||
* @param string - The input string | ||
* @returns A PascalCase string from the input string | ||
* | ||
*/ | ||
export function pascalCase(string: string): string { | ||
const words = string.split(/[\s_-]+/).map(word => { | ||
return word.replace(/\w+/g, (word) => { | ||
return word[0].toUpperCase() + word.slice(1).toLowerCase() | ||
}) | ||
}) | ||
const result = words.join('') | ||
return result | ||
} | ||
|
||
/** | ||
* Convert any string to snake_case. | ||
* @param string - The input string | ||
* @returns A snake_case string from the input string | ||
*/ | ||
export function snakeCase(string: string): string { | ||
return string.replace(/\W+/g, ' ') | ||
.split(/ |\B(?=[A-Z])/) | ||
.map(word => word.toLowerCase()) | ||
.join('_') | ||
} | ||
|
||
/** | ||
* Convert any string to kebab-case. | ||
* @param string - The input string | ||
* @returns A kebab-case string from the input string | ||
*/ | ||
export function kebabCase(string: string): string { | ||
return string.replace(/\W+/g, ' ') | ||
.split(/ |\B(?=[A-Z])/) | ||
.map(word => word.toLowerCase()) | ||
.join('-') | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"strict": true, | ||
"preserveConstEnums": true, | ||
"noEmit": true, | ||
"sourceMap": false, | ||
"module": "CommonJS", | ||
"moduleResolution": "Node", | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
], | ||
"include": [ | ||
"./src/*" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.