mirror of
https://github.com/RoboSats/robosats.git
synced 2025-02-07 05:49:04 +00:00
Fix rewards claim
This commit is contained in:
parent
61d6406e0a
commit
042fbdca2a
@ -92,11 +92,13 @@ const RobotInfo: React.FC<Props> = ({ coordinator, onClose }: Props) => {
|
|||||||
if (robot != null && slot?.token != null && robot.encPrivKey != null) {
|
if (robot != null && slot?.token != null && robot.encPrivKey != null) {
|
||||||
void signCleartextMessage(rewardInvoice, robot.encPrivKey, slot?.token).then(
|
void signCleartextMessage(rewardInvoice, robot.encPrivKey, slot?.token).then(
|
||||||
(signedInvoice) => {
|
(signedInvoice) => {
|
||||||
|
console.log('Signed message:', signedInvoice);
|
||||||
void coordinator.fetchReward(signedInvoice, garage, slot?.token).then((data) => {
|
void coordinator.fetchReward(signedInvoice, garage, slot?.token).then((data) => {
|
||||||
|
console.log(data);
|
||||||
setBadInvoice(data.bad_invoice ?? '');
|
setBadInvoice(data.bad_invoice ?? '');
|
||||||
setShowRewardsSpinner(false);
|
setShowRewardsSpinner(false);
|
||||||
setWithdrawn(data.successful_withdrawal);
|
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 }}>
|
<Grid item alignItems='stretch' style={{ display: 'flex', maxWidth: 80 }}>
|
||||||
<Button
|
<Button
|
||||||
sx={{ maxHeight: 38 }}
|
sx={{ maxHeight: 38 }}
|
||||||
|
disabled={rewardInvoice === ''}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
handleSubmitInvoiceClicked(e, rewardInvoice);
|
handleSubmitInvoiceClicked(e, rewardInvoice);
|
||||||
}}
|
}}
|
||||||
|
@ -372,7 +372,7 @@ export class Coordinator {
|
|||||||
|
|
||||||
const data = await apiClient.post(
|
const data = await apiClient.post(
|
||||||
this.url,
|
this.url,
|
||||||
`${this.basePath}`,
|
`${this.basePath}/api/reward/`,
|
||||||
{
|
{
|
||||||
invoice: signedInvoice,
|
invoice: signedInvoice,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user