From 6c71e45ae41b0cdb884a0ffff4628e4c2cc92cc7 Mon Sep 17 00:00:00 2001 From: samsiegart Date: Mon, 28 Oct 2024 23:38:25 -0700 Subject: [PATCH] feat(fast-usdc): stub transfer cli command --- packages/fast-usdc/src/cli.js | 23 +++++++++++++++++- .../fast-usdc/test/snapshots/cli.test.ts.md | 12 +++++---- .../fast-usdc/test/snapshots/cli.test.ts.snap | Bin 330 -> 384 bytes 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/fast-usdc/src/cli.js b/packages/fast-usdc/src/cli.js index 24846841cb7f..a278a25ba0ea 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 { 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 7fb4649fe87e9fd1505e4d5dac5209a001aefcdb..564532c019c354b29551754fb5d8b98e179fa68d 100644 GIT binary patch literal 384 zcmV-`0e}8MRzV9%vEp^JeJbSsvs14&?-`TNH^IgxXG-U zNo$XNl=_-pB)e^q+JoOIFnqt+mh%dWciMbuwp{7Yt9-HEPD72j9fbR9AA{HZL*2E~F57`)FL1u8}MslL25{mO6kW(oCsRvOkIs zO+6Ll>M#9uf7vON0o`d04$@Qd8c2uH^AH9~6AuBN_m^h7M&X`~4m!G<(QOKqBRM2k eTG@;&PV_h+i3n)-IQ-bZ7W)CjAYdC=0ssIf0H`zo literal 330 zcmV-Q0k!@?RzV;Vb4KFb|ic_8ly$O6#jg6IqOwi%&yK}ixumgouk$)WoA=hO;J1r-e6r(+v;F8 zO7)3C@Ih?Sl?+L^(=1p$-Y(Gi_w0?AJt9$~)N*`cu7L9C24(qS6MG5(C`-%&aTe1s zn_jB;8G> c=jnd()rs1_ode9z*Zc$d4aVxI9Jm1h0P91Z+W-In