feat(wallet): add balance mutation clients

This commit is contained in:
zetaloop
2026-04-25 14:22:37 +08:00
parent 2661cfcd8a
commit e4a57b54ca
2 changed files with 26 additions and 1 deletions
+6 -1
View File
@@ -15,7 +15,12 @@ export { getPostById, listPosts, listPostsByAuthor, togglePostLike } from "./pos
export { listReviews, listReviewsByOrder, listReviewsByTargetUser } from "./reviews"
export { getServiceById, listServices, listServicesByPlayer } from "./services"
export { getShopById, getShopByOwnerId, listShops } from "./shops"
export { getWalletBalance, listWalletTransactions } from "./transactions"
export {
getWalletBalance,
listWalletTransactions,
topUpWallet,
withdrawWallet,
} from "./transactions"
export {
applyCurrentUserVerification,
getCurrentUserForLogin,
+20
View File
@@ -59,3 +59,23 @@ export async function listWalletTransactions(
)
return res.items
}
export async function topUpWallet(input: { amount: number; method?: string }): Promise<void> {
await httpJson<unknown>("/api/v1/wallet/topup", {
method: "POST",
json: {
amount: String(input.amount),
method: input.method ?? "dev",
},
})
}
export async function withdrawWallet(input: { amount: number; method?: string }): Promise<void> {
await httpJson<unknown>("/api/v1/wallet/withdraw", {
method: "POST",
json: {
amount: String(input.amount),
method: input.method ?? "dev",
},
})
}