From e4a57b54ca1615fe13e1188709c3d190da941135 Mon Sep 17 00:00:00 2001 From: zetaloop Date: Sat, 25 Apr 2026 14:22:37 +0800 Subject: [PATCH] feat(wallet): add balance mutation clients --- lib/api/index.ts | 7 ++++++- lib/api/transactions.ts | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/api/index.ts b/lib/api/index.ts index 4a3ebc2..de565d9 100644 --- a/lib/api/index.ts +++ b/lib/api/index.ts @@ -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, diff --git a/lib/api/transactions.ts b/lib/api/transactions.ts index d1a3d94..bafe9d9 100644 --- a/lib/api/transactions.ts +++ b/lib/api/transactions.ts @@ -59,3 +59,23 @@ export async function listWalletTransactions( ) return res.items } + +export async function topUpWallet(input: { amount: number; method?: string }): Promise { + await httpJson("/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 { + await httpJson("/api/v1/wallet/withdraw", { + method: "POST", + json: { + amount: String(input.amount), + method: input.method ?? "dev", + }, + }) +}