Skip to content

Commit

Permalink
fix(agoric): convey tx opts to agoric wallet and subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Jun 21, 2024
1 parent 01a1123 commit c7f85c6
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions packages/agoric-cli/src/commands/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,25 @@ const SLEEP_SECONDS = 3;
* @returns {Promise<import('commander').Command>}
*/
export const makeWalletCommand = async command => {
const wallet = command('wallet')
.description('wallet commands')
.option('--home <dir>', 'agd application home directory')
.option(
'--keyring-backend <os|file|test>',
'keyring\'s backend (os|file|test) (default "os")',
);
/**
* @param {import('commander').Command} baseCmd
*/
const withSharedTxOptions = baseCmd =>
baseCmd
.option('--home <dir>', 'agd application home directory')
.option(
'--keyring-backend <os|file|test>',
'keyring\'s backend (os|file|test) (default "os")',
);

const wallet = withSharedTxOptions(
command('wallet').description('wallet commands'),
);

const normalizeAddress = literalOrName =>
normalizeAddressWithOptions(literalOrName, wallet.opts());

wallet
.command('provision')
withSharedTxOptions(wallet.command('provision'))
.description('provision a Smart Wallet')
.requiredOption(
'--account [address]',
Expand Down Expand Up @@ -110,8 +116,7 @@ export const makeWalletCommand = async command => {
console.log(offerObj.offer.id);
});

wallet
.command('send')
withSharedTxOptions(wallet.command('send'))
.description('send a prepared offer')
.requiredOption(
'--from [address]',
Expand Down

0 comments on commit c7f85c6

Please sign in to comment.