React-implemented HashUp store example app.
Uses npm @hashup-it/hashup-react-sdk package to get HashUp Store functionality, paired alongside with HashUp API to fetch any Store's game & analytics data.
User's-point-of-view flow:
Fetch licences (https://open-api.hashup.it:3000/v1/tokens) --> display licenses --> purchase a licence.
Example use:
import { useHashup } from '@hashup-it/hashup-react-sdk'
function App() {
const { buyGame } = useHashup()
/** Address of license you wish to buy.
Fetched from https://open-api.hashup.it/ OpenAPI. */
const licenseAddress = '0x123…abc'
/** Amount of licenses you wish to buy. */
const licenseAmount = 2
function handleLicenseBuy() {
buyGame(licenseAddress, licenseAmount)
}
return (
<div className="App">
<button onClick={handleLicenseBuy}>Buy 2 copies of game</button>
</div>
);
}
HashUp Foundation | 2023