Skip to content

Commit

Permalink
feat: scaffold operator commands
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Nov 26, 2024
1 parent 4787cca commit 36375fd
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/fast-usdc/src/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
writeFile as writeAsync,
} from 'node:fs/promises';
import { addConfigCommands } from './config-commands.js';
import { addOperatorCommands } from './operator-commands.js';
import * as configLib from './config.js';
import transferLib from './transfer.js';
import { makeFile } from '../util/file.js';
Expand Down Expand Up @@ -55,6 +56,7 @@ export const initProgram = (
};

addConfigCommands(program, configHelpers, makeConfigFile);
addOperatorCommands(program);

/** @param {string} value */
const parseDecimal = value => {
Expand Down
34 changes: 34 additions & 0 deletions packages/fast-usdc/src/cli/operator-commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @import {Command} from 'commander';
*/

/**
* @param {Command} program
*/
export const addOperatorCommands = program => {
const operator = program
.command('operator')
.description('Oracle operator commands');

operator
.command('accept')
.description('Accept invitation to be an operator')
.action(async options => {
const { requestId } = options;
console.error('TODO: Implement accept logic for request:', requestId);
});

operator
.command('attest')
.description('Attest to an observed Fast USDC transfer')
.requiredOption('--previousOfferId <string>', 'Offer id', String)
.action(async options => {
const { previousOfferId } = options;
console.error(
'TODO: Implement attest logic for request:',
previousOfferId,
);
});

return operator;
};
1 change: 1 addition & 0 deletions packages/fast-usdc/test/cli/snapshots/cli.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Generated by [AVA](https://avajs.dev).
Commands:␊
config Manage config␊
operator Oracle operator commands␊
deposit [options] <give> Offer assets to the liquidity pool␊
withdraw [options] <want> Withdraw assets from the liquidity pool␊
transfer <amount> <dest> Transfer USDC from Ethereum/L2 to Cosmos via Fast␊
Expand Down
Binary file modified packages/fast-usdc/test/cli/snapshots/cli.test.ts.snap
Binary file not shown.

0 comments on commit 36375fd

Please sign in to comment.