22 lines
576 B
TypeScript
22 lines
576 B
TypeScript
import { httpClient } from "./httpClient";
|
|
|
|
export interface BalanceInfo {
|
|
balance: string;
|
|
}
|
|
|
|
export interface TransactionInfo {
|
|
id: string;
|
|
type: string;
|
|
amount: string;
|
|
balance_after: string;
|
|
reference_id: string;
|
|
created_at: string;
|
|
}
|
|
|
|
export const walletService = {
|
|
getBalance: () => httpClient.get<BalanceInfo>("/wallet/balance"),
|
|
redeem: (code: string) => httpClient.post<TransactionInfo>("/wallet/redeem", { code }),
|
|
transactions: (page = 1, size = 20) =>
|
|
httpClient.get<TransactionInfo[]>(`/wallet/transactions?page=${page}&size=${size}`),
|
|
};
|