Skip to content

Commit

Permalink
feat(fast-usdc): stub config cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Nov 14, 2024
1 parent 1b64d82 commit 81e14b2
Showing 1 changed file with 55 additions and 3 deletions.
58 changes: 55 additions & 3 deletions packages/fast-usdc/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Command } from 'commander';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
import { homedir } from 'os';

const packageJson = JSON.parse(
readFileSync(
Expand All @@ -12,12 +13,64 @@ const packageJson = JSON.parse(
),
);

const homeDirectory = homedir();

const program = new Command();

program
.name('fast-usdc')
.description('CLI to interact with Fast USDC liquidity pool')
.version(packageJson.version);
.version(packageJson.version)
.option(
'--home <path>',
`Home directory to use for config`,
`${homeDirectory}/.fast-usdc`,
);

const config = program.command('config').description('Manage config');

config
.command('show')
.description('Show current config')
.action(() => {
// TODO: Read config from "--home" dir and output to console.
});

config
.command('init')
.description('Set initial config values')
.requiredOption(
'--noble-seed <seed>',
'Seed phrase for Noble account. CAUTION: Stored unencrypted in file system',
)
.requiredOption(
'--eth-seed <seed>',
'Seed phrase for Ethereum account. CAUTION: Stored unencrypted in file system',
)
.option('--agoric-api [url]', 'Agoric API endpoint', '127.0.0.1:1317')
.option('--noble-rpc [url]', 'Noble RPC endpoint', '127.0.0.1:26657')
.option('--eth-rpc [url]', 'Ethereum RPC Endpoint', '127.0.0.1:8545')
.action(() => {
// TODO: Write config to file in "--home" dir.
});

config
.command('update')
.description('Update config values')
.option(
'--noble-seed [string]',
'Seed phrase for Noble account. CAUTION: Stored unencrypted in file system',
)
.option(
'--eth-seed [string]',
'Seed phrase for Ethereum account. CAUTION: Stored unencrypted in file system',
)
.option('--agoric-api [url]', 'Agoric API endpoint', '127.0.0.1:1317')
.option('--noble-rpc [url]', 'Noble RPC endpoint', '127.0.0.1:26657')
.option('--eth-rpc [url]', 'Ethereum RPC Endpoint', '127.0.0.1:8545')
.action(() => {
// TODO: Write config to file in "--home" dir.
});

program
.command('deposit')
Expand Down Expand Up @@ -49,8 +102,7 @@ program
// TODO: Implement transfer logic
// 1. Look up agoric Fast USDC contract address
// 2. Append destination address to agoric address
// 3. Compute noble forwarding address from result
// 4. Tell watcher to watch for transfers to computer address
// 4. Register noble forwarding address for agoric address
// 5. Sign and broadcast CCTP transfer to noble forwarding address
});

Expand Down

0 comments on commit 81e14b2

Please sign in to comment.