diff --git a/packages/fast-usdc/src/cli.js b/packages/fast-usdc/src/cli.js index 24846841cb7f..dd48051bbfcd 100755 --- a/packages/fast-usdc/src/cli.js +++ b/packages/fast-usdc/src/cli.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -import { Command } from 'commander'; +import { Argument, Command, createArgument } from 'commander'; import { readFileSync } from 'fs'; import { fileURLToPath } from 'url'; import { dirname, resolve } from 'path'; @@ -35,4 +35,25 @@ program // TODO: Implement withdraw logic }); +program + .command('transfer') + .description('Transfer USDC from Ethereum/L2 to Cosmos via Fast USDC') + .addArgument( + createArgument('amount', 'Amount to transfer denominated in uusdc'), + ) + .addArgument(createArgument('dest', 'Destination address')) + .action((amount, 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(); diff --git a/packages/fast-usdc/test/snapshots/cli.test.ts.md b/packages/fast-usdc/test/snapshots/cli.test.ts.md index f99a1fe5746d..487bc56eef92 100644 --- a/packages/fast-usdc/test/snapshots/cli.test.ts.md +++ b/packages/fast-usdc/test/snapshots/cli.test.ts.md @@ -13,11 +13,13 @@ 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 Transfer USDC from Ethereum/L2 to Cosmos via Fast␊ + USDC␊ + help [command] display help for command␊ ` diff --git a/packages/fast-usdc/test/snapshots/cli.test.ts.snap b/packages/fast-usdc/test/snapshots/cli.test.ts.snap index 7fb4649fe87e..564532c019c3 100644 Binary files a/packages/fast-usdc/test/snapshots/cli.test.ts.snap and b/packages/fast-usdc/test/snapshots/cli.test.ts.snap differ