Skip to content

Commit 300a596

Browse files
committed
fix: faucet request fixed
1 parent 54b42ed commit 300a596

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/app/sandbox/faucet/PageClient.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@
33
import { NextPage } from 'next';
44
import React from 'react';
55

6-
import { Badge } from '../../../common/components/Badge';
7-
import { DropIcon } from '../../../common/components/icons/drop';
86
import { useFaucet } from '../../../common/queries/useFaucet';
9-
import { Box } from '../../../ui/Box';
107
import { Button } from '../../../ui/Button';
11-
import { Flex } from '../../../ui/Flex';
12-
import { Grid } from '../../../ui/Grid';
138
import { HStack } from '../../../ui/HStack';
149
import { Icon } from '../../../ui/Icon';
1510
import { Stack } from '../../../ui/Stack';
@@ -44,7 +39,7 @@ const Faucet: NextPage = () => {
4439
if (stackingIndex <= 3) {
4540
setIndex(i => ++i);
4641
if (stackingIndex === 3 && !!stxAddress) {
47-
void runFaucetStx({ address: stxAddress, staking: true });
42+
void runFaucetStx({ address: stxAddress, stacking: true });
4843
}
4944
}
5045
};

src/common/queries/useFaucet.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ import { useApiClient } from '../../api/useApiClient';
66
export function useFaucet() {
77
const apiClient = useApiClient();
88
return useMutation({
9-
mutationFn: async ({ address, staking }: { address: string; staking?: boolean }) => {
9+
mutationFn: async ({ address, stacking }: { address: string; stacking?: boolean }) => {
1010
if (!address) return undefined;
11-
const { data, error } = await apiClient.POST('/extended/v1/faucets/stx', {
12-
body: { address, ...(staking ? { staking: true } : {}) },
11+
const { data, error } = await apiClient.POST(`/extended/v1/faucets/stx`, {
12+
params: {
13+
query: {
14+
address,
15+
stacking,
16+
},
17+
},
18+
body: {
19+
// @ts-expect-error
20+
content: 'application/json',
21+
},
1322
});
23+
1424
if (error) {
1525
throw new Error(getErrorMessage(error));
1626
}

0 commit comments

Comments
 (0)