Skip to content

Commit

Permalink
Merge pull request #8663 from Agoric/cth-cli-help-text
Browse files Browse the repository at this point in the history
docs: improve hints about cli commands that don't submit offers
  • Loading branch information
mergify[bot] authored Dec 18, 2023
2 parents 1b6f03b + d80d451 commit 7d63ca3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions packages/agoric-cli/src/commands/oracle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
makeWalletUtils,
outputAction,
sendAction,
sendHint,
} from '../lib/wallet.js';
import { bigintReplacer } from '../lib/format.js';

Expand Down Expand Up @@ -128,7 +129,7 @@ export const makeOracleCommand = (logger, io = {}) => {
offer,
});

console.warn('Now execute the prepared offer');
console.warn(sendHint);
});

oracle
Expand Down Expand Up @@ -163,7 +164,7 @@ export const makeOracleCommand = (logger, io = {}) => {
offer,
});

console.warn('Now execute the prepared offer');
console.warn(sendHint);
});

const findOracleCap = async (instance, from, readLatestHead) => {
Expand Down
4 changes: 0 additions & 4 deletions packages/agoric-cli/src/commands/psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ export const makePsmCommand = logger => {
};

outputExecuteOfferAction(offer);

console.warn('Now execute the prepared offer');
});

psm
Expand Down Expand Up @@ -272,8 +270,6 @@ export const makePsmCommand = logger => {
};

outputExecuteOfferAction(offer);

console.warn('Now execute the prepared offer');
});

return psm;
Expand Down
6 changes: 3 additions & 3 deletions packages/agoric-cli/src/commands/vaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const makeVaultsCommand = logger => {

vaults
.command('open')
.description('open a new vault')
.description('Prepare an offer to open a new vault')
.requiredOption('--giveCollateral <number>', 'Collateral to give', Number)
.requiredOption('--wantMinted <number>', 'Minted wants', Number)
.option('--offerId <string>', 'Offer id', String, `openVault-${Date.now()}`)
Expand All @@ -76,7 +76,7 @@ export const makeVaultsCommand = logger => {

vaults
.command('adjust')
.description('adjust an existing vault')
.description('Prepare an offer to adjust an existing vault')
.requiredOption(
'--from <address>',
'wallet address literal or name',
Expand Down Expand Up @@ -121,7 +121,7 @@ export const makeVaultsCommand = logger => {

vaults
.command('close')
.description('close an existing vault')
.description('Prepare an offer to close an existing vault')
.requiredOption(
'--from <address>',
'wallet address literal or name',
Expand Down
10 changes: 8 additions & 2 deletions packages/agoric-cli/src/lib/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const outputAction = (bridgeAction, stdout = process.stdout) => {
stdout.write('\n');
};

const sendHint =
export const sendHint =
'Now use `agoric wallet send ...` to sign and broadcast the offer.\n';

/**
Expand All @@ -93,14 +93,20 @@ export const outputActionAndHint = (bridgeAction, { stdout, stderr }) => {
/**
* @param {import('@agoric/smart-wallet/src/offers.js').OfferSpec} offer
* @param {Pick<import('stream').Writable,'write'>} [stdout]
* @param {Pick<import('stream').Writable,'write'>} [stderr]
*/
export const outputExecuteOfferAction = (offer, stdout = process.stdout) => {
export const outputExecuteOfferAction = (
offer,
stdout = process.stdout,
stderr = process.stderr,
) => {
/** @type {import('@agoric/smart-wallet/src/smartWallet').BridgeAction} */
const spendAction = {
method: 'executeOffer',
offer,
};
outputAction(spendAction, stdout);
stderr.write(sendHint);
};

/**
Expand Down

0 comments on commit 7d63ca3

Please sign in to comment.