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

feat(fast-usdc): stub transfer cli command #10360

Closed
wants to merge 1 commit into from
Closed
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
19 changes: 19 additions & 0 deletions packages/fast-usdc/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,23 @@ program
// TODO: Implement withdraw logic
});

program
.command('transfer')
.description('Transfer USDC from Ethereum/L2 to Cosmos via Fast USDC')
.argument('amount', 'Amount to transfer denominated in uusdc')
.argument('dest', 'Destination address in Cosmos')
.action((/** @type {string} */ amount, /** @type {string} */ destination) => {
const start = Date.now();
console.error(
`TODO actually kick off USDC transfer. Amount: ${amount}uusdc Destination: ${destination}`,
);
console.info(`Finished in ${Date.now() - start}ms`);
// 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
// 5. Sign and broadcast CCTP transfer to noble forwarding address
});

program.parse();
17 changes: 17 additions & 0 deletions packages/fast-usdc/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,20 @@ test('CLI shows help when run without arguments', async t => {

t.snapshot(output);
});

test('CLI shows help for transfer command', async t => {
const output = await new Promise(resolve => {
const child = spawn('node', [CLI_PATH, 'transfer', '-h']);
let stdout = '';

child.stdout.on('data', data => {
stdout += data.toString();
});

child.on('close', () => {
resolve(stdout);
});
});

t.snapshot(output);
});
28 changes: 23 additions & 5 deletions packages/fast-usdc/test/snapshots/cli.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,29 @@ Generated by [AVA](https://avajs.dev).
CLI to interact with Fast USDC liquidity pool␊
Options:␊
-V, --version output the version number␊
-h, --help display help for command␊
-V, --version output the version number␊
-h, --help display help for command␊
Commands:␊
deposit Offer assets to the liquidity pool␊
withdraw Withdraw assets from the liquidity pool␊
help [command] display help for command␊
deposit Offer assets to the liquidity pool␊
withdraw Withdraw assets from the liquidity pool␊
transfer <amount> <dest> Transfer USDC from Ethereum/L2 to Cosmos via Fast␊
USDC␊
help [command] display help for command␊
`

## CLI shows help for transfer command

> Snapshot 1

`Usage: fast-usdc transfer [options] <amount> <dest>␊
Transfer USDC from Ethereum/L2 to Cosmos via Fast USDC␊
Arguments:␊
amount Amount to transfer denominated in uusdc␊
dest Destination address in Cosmos␊
Options:␊
-h, --help display help for command␊
`
Binary file modified packages/fast-usdc/test/snapshots/cli.test.ts.snap
Binary file not shown.
Loading