Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Review #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion ethos/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@
["ClassName \\=([^;]*);", "'([^']*)'"],
["ClassName \\=([^;]*);", "\"([^\"]*)\""],
["ClassName \\=([^;]*);", "\\`([^\\`]*)\\`"],
["classNames=\\{([^}]*)\\}", "['\"`]([^'\"`]*)['\"`]"]
["classNames=\\{([^}]*)\\}", "['\"`]([^'\"`]*)['\"`]"],
["[a-zA-Z]+ClassName=\"([^\"]*)\""],
["[a-zA-Z]+ClassName='([^']*)'"],
["[a-zA-Z]+ClassName={['\"`]([^'\"`]*)['\"`]}"]
],
"tailwindCSS.classAttributes": [
"class",
Expand Down
13 changes: 13 additions & 0 deletions ethos/.vscode/settings.json.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff a/ethos/.vscode/settings.json b/ethos/.vscode/settings.json (rejected hunks)
@@ -69,7 +69,10 @@
["ClassName \\=([^;]*);", "'([^']*)'"],
["ClassName \\=([^;]*);", "\"([^\"]*)\""],
["ClassName \\=([^;]*);", "\\`([^\\`]*)\\`"],
- ["classNames=\\{([^}]*)\\}", "['\"`]([^'\"`]*)['\"`]"]
+ ["classNames=\\{([^}]*)\\}", "['\"`]([^'\"`]*)['\"`]"],
+ ["[a-zA-Z]+ClassName=\"([^\"]*)\""],
+ ["[a-zA-Z]+ClassName='([^']*)'"],
+ ["[a-zA-Z]+ClassName={['\"`]([^'\"`]*)['\"`]}"]
],
"tailwindCSS.classAttributes": [
"class",
3,301 changes: 2,419 additions & 882 deletions ethos/package-lock.json

Large diffs are not rendered by default.

5,016 changes: 5,016 additions & 0 deletions ethos/package-lock.json.rej

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions ethos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,37 @@
"author": "Ethos Network Inc.",
"license": "UNLICENSED",
"devDependencies": {
"@dotenvx/dotenvx": "^1.26.1",
"@next/eslint-plugin-next": "^15.1.2",
"@stylistic/eslint-plugin-js": "^2.11.0",
"@tanstack/eslint-plugin-query": "^5.62.1",
"@dotenvx/dotenvx": "^1.32.0",
"@next/eslint-plugin-next": "^15.1.3",
"@stylistic/eslint-plugin-js": "^2.12.1",
"@tanstack/eslint-plugin-query": "^5.62.16",
"@types/inquirer": "^9.0.7",
"@types/node": "^22.10.1",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitest/coverage-v8": "^2.1.8",
"concurrently": "^9.1.0",
"concurrently": "^9.1.1",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-love": "^44.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^6.6.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-unicorn": "^56.0.1",
"eslint-plugin-vitest": "^0.4.1",
"glob": "^11.0.0",
"husky": "^9.1.7",
"inquirer": "^8.2.6",
"knip": "^5.39.0",
"knip": "^5.41.1",
"open-cli": "^8.0.0",
"patch-package": "^8.0.0",
"picocolors": "^1.1.1",
"prettier": "3.4.1",
"prettier": "3.4.2",
"serve": "^14.2.4",
"ts-node": "^10.9.2",
"tsx": "^4.19.1",
Expand Down
50 changes: 50 additions & 0 deletions ethos/package.json.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
diff a/ethos/package.json b/ethos/package.json (rejected hunks)
@@ -46,37 +46,37 @@
"author": "Ethos Network Inc.",
"license": "UNLICENSED",
"devDependencies": {
- "@dotenvx/dotenvx": "^1.26.1",
- "@next/eslint-plugin-next": "^15.1.2",
- "@stylistic/eslint-plugin-js": "^2.11.0",
- "@tanstack/eslint-plugin-query": "^5.62.1",
+ "@dotenvx/dotenvx": "^1.32.0",
+ "@next/eslint-plugin-next": "^15.1.3",
+ "@stylistic/eslint-plugin-js": "^2.12.1",
+ "@tanstack/eslint-plugin-query": "^5.62.16",
"@types/inquirer": "^9.0.7",
- "@types/node": "^22.10.1",
+ "@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitest/coverage-v8": "^2.1.8",
- "concurrently": "^9.1.0",
+ "concurrently": "^9.1.1",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-love": "^44.0.0",
"eslint-config-prettier": "^9.1.0",
- "eslint-import-resolver-typescript": "^3.6.3",
+ "eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^6.6.0",
- "eslint-plugin-react": "^7.37.2",
- "eslint-plugin-react-hooks": "^5.0.0",
+ "eslint-plugin-react": "^7.37.3",
+ "eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-unicorn": "^56.0.1",
"eslint-plugin-vitest": "^0.4.1",
"glob": "^11.0.0",
"husky": "^9.1.7",
"inquirer": "^8.2.6",
- "knip": "^5.39.0",
+ "knip": "^5.41.1",
"open-cli": "^8.0.0",
"patch-package": "^8.0.0",
"picocolors": "^1.1.1",
- "prettier": "3.4.1",
+ "prettier": "3.4.2",
"serve": "^14.2.4",
"ts-node": "^10.9.2",
"tsx": "^4.19.1",
21 changes: 21 additions & 0 deletions ethos/packages/analytics/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@ethos/analytics",
"version": "1.0.0",
"description": "Wrapper for Amplitude analytics",
"main": "dist/index.js",
"type": "module",
"author": "Ethos Network Inc.",
"license": "UNLICENSED",
"scripts": {
"build": "tsc -b",
"watch": "tsc -w"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.11.11",
"@amplitude/analytics-node": "^1.3.6",
"@amplitude/plugin-session-replay-browser": "^1.12.0"
},
"devDependencies": {
"@amplitude/analytics-types": "^2.8.0"
}
}
1 change: 1 addition & 0 deletions ethos/packages/analytics/src/analytics.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Attributes = Record<string, string | number | boolean>;
102 changes: 102 additions & 0 deletions ethos/packages/analytics/src/browser-analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import * as amplitude from '@amplitude/analytics-browser';
import { type BrowserOptions } from '@amplitude/analytics-types';
import { sessionReplayPlugin } from '@amplitude/plugin-session-replay-browser';
import { type Attributes } from './analytics.type.js';

type SessionReplayOptions = Parameters<typeof sessionReplayPlugin>[0];

export class BrowserAnalyticsClient {
private globalEventProperties: Attributes = {};

constructor(
apiKey: string,
options?: {
amplitudeOptions?: BrowserOptions;
enableSessionReplay?: boolean;
sessionReplayOptions?: SessionReplayOptions;
},
) {
if (options?.enableSessionReplay) {
const sessionReplayTracking = sessionReplayPlugin(options.sessionReplayOptions);

amplitude.add(sessionReplayTracking);
}

amplitude.init(apiKey, {
useBatch: true,
...options?.amplitudeOptions,
});
}

setGlobalEventProperties(properties: Attributes): void {
this.globalEventProperties = properties;
}

setUserId(userId: string): void {
amplitude.setUserId(userId);
}

setUserProperties(properties: Attributes): void {
const identity = new amplitude.Identify();

for (const [key, value] of Object.entries(properties)) {
identity.set(key, value);
}

amplitude.identify(identity);
}

/**
* Sends an event about screen being viewed. It can be used to track page views
* or views of specific components like modal, banner, etc.
*/
sendScreenEvent(screenName: string, attributes?: Attributes): void {
const eventProperties = {
...this.globalEventProperties,
...attributes,
};

amplitude.track(`viewed ${screenName}`, eventProperties);
}

/**
* Sends an event about the result of user interaction with the app. For
* example, user signed in, file uploaded, form submitted, etc.
* @param actionSubject E.g., 'user', 'file', 'form'
* @param action E.g., 'signedIn', 'uploaded', 'submitted'
*/
sendTrackEvent(
actionSubject: string,
action: string,
attributes?: Record<string, string | number | boolean>,
): void {
const eventProperties = {
...this.globalEventProperties,
...attributes,
};

amplitude.track(`${actionSubject} ${action}`, eventProperties);
}

/**
* Sends an event about user interaction with the UI. For example, button click,
* link click, dropdown opened, etc.
* @param actionSubject E.g., 'button', 'link', 'dropdown'
* @param action E.g., 'click', 'hover', 'open'
* @param actionSubjectId Identifier of the UI element that was interacted with
*/
sendUIEvent(
actionSubject: string,
action: string,
actionSubjectId: string,
attributes?: Record<string, string | number | boolean>,
): void {
const eventProperties = {
...this.globalEventProperties,
...attributes,
actionSubjectId,
};

amplitude.track(`${actionSubject} ${action}`, eventProperties);
}
}
4 changes: 4 additions & 0 deletions ethos/packages/analytics/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { BrowserAnalyticsClient } from './browser-analytics.js';
export { ServerAnalyticsClient } from './server-analytics.js';

export { type NodeOptions, LogLevel } from '@amplitude/analytics-types';
30 changes: 30 additions & 0 deletions ethos/packages/analytics/src/server-analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { init, track } from '@amplitude/analytics-node';
import { type NodeOptions } from '@amplitude/analytics-types';
import { type Attributes } from './analytics.type.js';

export class ServerAnalyticsClient {
private globalEventProperties: Attributes = {};

constructor(apiKey: string, options?: NodeOptions) {
init(apiKey, {
useBatch: true,
serverUrl: 'https://api2.amplitude.com/batch',
...options,
});
}

setGlobalEventProperties(properties: Attributes): void {
this.globalEventProperties = properties;
}

sendTrackEvent(event: string, properties?: Record<string, any>): void {
track(
event,
{
...this.globalEventProperties,
...properties,
},
{ user_id: 'server' },
);
}
}
6 changes: 6 additions & 0 deletions ethos/packages/analytics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
}
}
24 changes: 24 additions & 0 deletions ethos/packages/blockchain-manager/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@ethos/blockchain-manager",
"version": "1.0.0",
"description": "Encapsulates the blockchain interaction logic with Ethos contracts",
"main": "dist/index.js",
"type": "module",
"author": "Ethos Network Inc.",
"license": "UNLICENSED",
"scripts": {
"build": "tsc -b",
"watch": "tsc -w"
},
"dependencies": {
"@ethos/contracts": "^1.0.0",
"@ethos/env": "^1.0.0",
"@ethos/helpers": "^1.0.0",
"async-retry": "^1.3.3",
"ethers": "^6.13.4",
"viem": "^2.21.51"
},
"devDependencies": {
"@types/async-retry": "^1.4.9"
}
}
Loading