Skip to content

Commit

Permalink
fix up cli
Browse files Browse the repository at this point in the history
  • Loading branch information
geoknee committed Oct 12, 2023
1 parent ab07765 commit f8b003b
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions packages/nitro-rpc-client/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ yargs(hideBin(process.argv))
yargs.counterparty,
yargs.amount
);
const { Id } = dfObjective;
const { Id, ChannelId } = dfObjective;

console.log(`Objective started ${Id}`);
await rpcClient.WaitForObjective(Id);
console.log(`Objective complete ${Id}`);
await rpcClient.WaitForLedgerChannelToHaveStatus(ChannelId, "Open");
console.log(`Channel Open ${ChannelId}`);
await rpcClient.Close();
process.exit(0);
}
Expand All @@ -154,8 +154,11 @@ yargs(hideBin(process.argv))

const id = await rpcClient.CloseLedgerChannel(yargs.channelId);
console.log(`Objective started ${id}`);
await rpcClient.WaitForObjective(id);
console.log(`Objective complete ${id}`);
await rpcClient.WaitForPaymentChannelToHaveStatus(
yargs.channelId,
"Complete"
);
console.log(`Channel Complete ${yargs.channelId}`);
await rpcClient.Close();
process.exit(0);
}
Expand Down Expand Up @@ -200,10 +203,10 @@ yargs(hideBin(process.argv))
yargs.amount
);

const { Id } = vfObjective;
const { ChannelId, Id } = vfObjective;
console.log(`Objective started ${Id}`);
await rpcClient.WaitForObjective(Id);
console.log(`Objective complete ${Id}`);
await rpcClient.WaitForPaymentChannelToHaveStatus(ChannelId, "Open");
console.log(`Channel Open ${ChannelId}`);
await rpcClient.Close();
process.exit(0);
}
Expand All @@ -230,8 +233,11 @@ yargs(hideBin(process.argv))
const id = await rpcClient.ClosePaymentChannel(yargs.channelId);

console.log(`Objective started ${id}`);
await rpcClient.WaitForObjective(id);
console.log(`Objective complete ${id}`);
await rpcClient.WaitForPaymentChannelToHaveStatus(
yargs.channelId,
"Complete"
);
console.log(`Channel complete ${yargs.channelId}`);
await rpcClient.Close();
process.exit(0);
}
Expand Down

0 comments on commit f8b003b

Please sign in to comment.