Fix rewards claim

This commit is contained in:
Reckless_Satoshi 2024-01-29 20:05:20 +00:00
parent 61d6406e0a
commit 042fbdca2a
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 5 additions and 2 deletions

View File

@ -92,11 +92,13 @@ const RobotInfo: React.FC<Props> = ({ coordinator, onClose }: Props) => {
if (robot != null && slot?.token != null && robot.encPrivKey != null) {
void signCleartextMessage(rewardInvoice, robot.encPrivKey, slot?.token).then(
(signedInvoice) => {
console.log('Signed message:', signedInvoice);
void coordinator.fetchReward(signedInvoice, garage, slot?.token).then((data) => {
console.log(data);
setBadInvoice(data.bad_invoice ?? '');
setShowRewardsSpinner(false);
setWithdrawn(data.successful_withdrawal);
setOpenClaimRewards(!(data.successful_withdrawal !== undefined));
setOpenClaimRewards(!data.successful_withdrawal);
});
},
);
@ -307,6 +309,7 @@ const RobotInfo: React.FC<Props> = ({ coordinator, onClose }: Props) => {
<Grid item alignItems='stretch' style={{ display: 'flex', maxWidth: 80 }}>
<Button
sx={{ maxHeight: 38 }}
disabled={rewardInvoice === ''}
onClick={(e) => {
handleSubmitInvoiceClicked(e, rewardInvoice);
}}

View File

@ -372,7 +372,7 @@ export class Coordinator {
const data = await apiClient.post(
this.url,
`${this.basePath}`,
`${this.basePath}/api/reward/`,
{
invoice: signedInvoice,
},