Skip to content

Commit

Permalink
Add --check-forwarder option in the aragonos forwarder command
Browse files Browse the repository at this point in the history
  • Loading branch information
sembrestels committed Dec 7, 2023
1 parent 0447d02 commit 9df4162
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/evmcrispr/src/modules/aragonos/commands/forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const forward: ICommand<AragonOS> = {
type: ComparisonType.Greater,
minValue: 2,
});
checkOpts(c, ['context']);
checkOpts(c, ['context', 'check-forwarder']);

const blockCommandsNode = c.args.pop()!;

Expand Down Expand Up @@ -54,12 +54,19 @@ export const forward: ICommand<AragonOS> = {
}

const context = await getOptValue(c, 'context', interpretNode);
const checkForwarder = await getOptValue(
c,
'check-forwarder',
interpretNode,
);
console.log(checkForwarder, 'checkForwarder');

return batchForwarderActions(
module,
blockActions as TransactionAction[],
forwarderAppAddresses.reverse(),
context,
checkForwarder,
);
},
buildCompletionItemsForArg(_, __, bindingsManager) {
Expand Down
3 changes: 2 additions & 1 deletion packages/evmcrispr/src/modules/aragonos/utils/forwarders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const batchForwarderActions = async (
forwarderActions: TransactionAction[],
forwarders: string[],
context?: string,
checkForwarder = true,
): Promise<Action[]> => {
let script: string;
let value: string | number = 0;
Expand All @@ -69,7 +70,7 @@ export const batchForwarderActions = async (
await module.getProvider(),
);

if (!(await isForwarder(forwarder))) {
if (checkForwarder && !(await isForwarder(forwarder))) {
throw new ErrorInvalid(`app ${forwarder.address} is not a forwarder`);
}

Expand Down

0 comments on commit 9df4162

Please sign in to comment.