Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/app/server/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const env = createEnv({
CDP_API_KEY_ID: z.string().optional(),
CDP_API_KEY_SECRET: z.string().optional(),
CDP_WALLET_SECRET: z.string().optional(),
DISABLE_CDP_ERROR_REPORTING: z.coerce.boolean().default(true),

// Facilitator URLs
PROXY_FACILITATOR_URL: z.string().url().optional(),
Expand Down
5 changes: 3 additions & 2 deletions templates/echo-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
},
"scripts": {
"start": "tsx src/index.ts",
"dev": "tsx src/index.ts",
"build": "tsc",
"dev": "tsx --env-file=.env.local src/index.ts",
"build": "node scripts/build.js",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit"
},
Expand All @@ -36,6 +36,7 @@
"cli-table3": "^0.6.5",
"commander": "^14.0.2",
"conf": "^15.0.2",
"dotenv": "^16.4.7",
"ink": "^6.4.0",
"keytar": "^7.9.0",
"open": "^10.2.0",
Expand Down
45 changes: 45 additions & 0 deletions templates/echo-cli/scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { execSync } from 'child_process';
import dotenv from 'dotenv';
import { readFileSync, writeFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const rootDir = join(__dirname, '..');

// Load environment variables from .env.local
dotenv.config({ path: join(rootDir, '.env.local') });

const ECHO_APP_ID = process.env.ECHO_APP_ID;

if (!ECHO_APP_ID) {
console.error('Error: ECHO_APP_ID not found in .env.local');
process.exit(1);
}

const constantsPath = join(rootDir, 'src', 'constants.ts');

// Read the original file
const originalContent = readFileSync(constantsPath, 'utf8');

// Replace process.env.ECHO_APP_ID with the actual value
const modifiedContent = originalContent.replace(
/export const ECHO_APP_ID = process\.env\.ECHO_APP_ID!;/,
`export const ECHO_APP_ID = '${ECHO_APP_ID}';`
);

try {
// Write modified content
writeFileSync(constantsPath, modifiedContent, 'utf8');
console.log('Building with ECHO_APP_ID:', ECHO_APP_ID);

// Run TypeScript compiler
execSync('tsc', { stdio: 'inherit', cwd: rootDir });

console.log('Build completed successfully!');
} finally {
// Always restore the original file
writeFileSync(constantsPath, originalContent, 'utf8');
console.log('Restored original constants.ts');
}
43 changes: 26 additions & 17 deletions templates/echo-cli/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import { MODELS } from '@/config/models'
import { MODELS } from '@/config/models';

export { ECHODEX_ASCII_ART } from '@/config/ascii'
export { MODELS, DEFAULT_MODEL } from '@/config/models'
export { MESSAGE_MODES, THINKING_MESSAGES, THINKING_INTERVAL, THINKING_COLORS } from '@/config/messages'
export { WALLET_CHAINS, WALLET_OPTIONAL_METHODS, AUTH_OPTIONS } from '@/config/wallet'
export { ECHODEX_ASCII_ART } from '@/config/ascii';
export {
MESSAGE_MODES,
THINKING_COLORS,
THINKING_INTERVAL,
THINKING_MESSAGES,
} from '@/config/messages';
export { DEFAULT_MODEL, MODELS } from '@/config/models';
export {
AUTH_OPTIONS,
WALLET_CHAINS,
WALLET_OPTIONAL_METHODS,
} from '@/config/wallet';

const ECHO_URL = 'https://echo.merit.systems'
const ECHO_API_URL = 'https://api.echo.merit.systems/v1'
const ECHO_ROUTER_URL = 'https://echo.router.merit.systems'
const ECHO_URL = 'https://echo.merit.systems';
const ECHO_API_URL = 'https://api.echo.merit.systems/v1';
const ECHO_ROUTER_URL = 'https://echo.router.merit.systems';

export const AGENT_NAME = 'echodex' as const
export const AVAILABLE_MODELS = MODELS
export const AGENT_NAME = 'echodex' as const;
export const AVAILABLE_MODELS = MODELS;

export const ECHO_APP_ID = 'dbfe663c-b54d-4a64-bcc1-1cb24f4da32f'
export const WALLETCONNECT_PROJECT_ID = '592e3344e57cbc26ad91d191e82a4185'
export const ECHO_KEYS_URL = `${ECHO_URL}/app/${ECHO_APP_ID}/keys`
export const ECHO_APP_ID = process.env.ECHO_APP_ID!;
export const WALLETCONNECT_PROJECT_ID = '592e3344e57cbc26ad91d191e82a4185';
export const ECHO_KEYS_URL = `${ECHO_URL}/app/${ECHO_APP_ID}/keys`;

export const APP = {
name: 'Echodex',
Expand All @@ -25,12 +34,12 @@ export const APP = {
echoKeysUrl: `${ECHO_URL}/app/${ECHO_APP_ID}/keys`,
echoUrl: ECHO_URL,
echoApiUrl: ECHO_API_URL,
echoRouterUrl: ECHO_ROUTER_URL
} as const
echoRouterUrl: ECHO_ROUTER_URL,
} as const;

export const APP_METADATA = {
name: APP.name,
description: APP.description,
url: APP.echoUrl,
icons: [`${APP.echoUrl}/favicon.ico`]
}
icons: [`${APP.echoUrl}/favicon.ico`],
};
4 changes: 2 additions & 2 deletions templates/echo-cli/src/core/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function showEchoProfile(): Promise<void> {
label('Email:', chalk.white(user.email))
label('Balance:', chalk.green(`$${balance.balance.toFixed(4)}`))
label('Total Spent:', chalk.yellow(`$${balance.totalSpent.toFixed(4)}`))
label('Created:', chalk.white(new Date(user.createdAt).toLocaleDateString()))
label('Created:', chalk.white(new Date(user.createdAt as string).toLocaleDateString()))
blankLine()
} catch (err) {
displayAppError(createError({
Expand Down Expand Up @@ -89,7 +89,7 @@ async function showLocalWalletProfile(): Promise<void> {
}

try {
const balance = await getUSDCBalance(session.address, session.chainId)
const balance = await getUSDCBalance(session.address as `0x${string}`, session.chainId)

blankLine()
header('=== Local Wallet Profile ===')
Expand Down
Loading