blub-sdk
Version:
A modular SDK for interacting with the BLUB ecosystem on the Sui blockchain.
26 lines (25 loc) • 936 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useUserBlubNftPoints = useUserBlubNftPoints;
const swr_1 = __importDefault(require("swr"));
const points_1 = require("./points");
/**
* React hook to fetch and cache the user's BLUB NFT points.
*
* Internally fetches wallet and staked balances and applies a 1.6x multiplier to staked tokens.
*
* @param address - The wallet address of the user.
* @returns { points, isLoading, error }
*/
function useUserBlubNftPoints(address) {
const shouldFetch = !!address;
const { data, error, isLoading } = (0, swr_1.default)(shouldFetch ? ["userBlubNftPoints", address] : null, () => (0, points_1.getUserBlubNftPoints)(address));
return {
points: data,
isLoading,
error,
};
}