@hnipps/connect-wallet
v2.1.4
Published
## Usage
Downloads
4
Readme
Connect Wallet
Usage
Connect Wallet
import { connectWallet } from "@hnipps/connect-wallet";
const result = await connectWallet();
console.log(result); // { success: true, address: "0x1234"}
Get $ALPHA Balance
import { getAlphaBalance } from "@hnipps/connect-wallet";
const result = await getAlphaBalance();
console.log(result); // 1000
Subscribe to AlphaSquare
import {
connectWallet,
approveAlpha,
subscribe,
isSubscriptionValid,
} from "@hnipps/connect-wallet";
await connectWallet();
await approveAlpha(10);
await subscribe(USER_ID); // USER_ID should be the AlphaSquare user ID not the wallet address
const result = await isSubscriptionValid(USER_ID);
console.log(result); // true
Verify Wallet Ownership
To be used when you need to confirm if the current users owns the wallet they say they do, e.g. before creating an Alpha NFT.
This function is already built into the connect wallet flow.
import { verifyOwnership } from "@hnipps/connect-wallet";
const result = await verifyOwnership("Some string to display in wallet");
console.log(result); // true