Skip to content

React SDK

The React SDK includes the TypeScript client surface plus React Query helper hooks for application data loading and mutations.

Package

FieldValue
Package@f-wallet/react
Version0.1.0
Repositoryf-wallet/fwallet-js
Peer dependency@tanstack/react-query
Terminal window
npm install @f-wallet/react @tanstack/react-query

Client setup

import { Configuration, WalletsApi, useFWalletQuery } from "@f-wallet/react";
const config = new Configuration({
basePath: "https://api.fwallet.co.ug",
apiKey: "fwk_live_...",
});
const wallets = new WalletsApi(config);
export function WalletList() {
const query = useFWalletQuery("wallets.list", wallets.walletsGetWallets.bind(wallets), {});
if (query.isLoading) return null;
return query.data?.data.map((wallet) => <div key={wallet.id}>{wallet.ownerId}</div>);
}

Hook helpers

HelperPurpose
fwalletQueryKey(scope, params)Builds a stable React Query key.
useFWalletQuery(scope, apiCall, params, options)Runs a generated SDK API method as a query.
useFWalletMutation(apiCall)Runs a generated SDK API method as a mutation.

Resource clients

ResourceClass
AdminAdminApi
AuthAuthApi
DepositsDepositsApi
DeveloperDeveloperApi
HealthHealthApi
JournalJournalApi
PayoutsPayoutsApi
SystemSystemApi
TeamTeamApi
TenantsTenantsApi
TransfersTransfersApi
WalletsWalletsApi

Operation methods

The React SDK uses the same generated method names as the TypeScript SDK. See the TypeScript operation reference.