Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stockpilelabs/stockpile_react_sdk
SDK for Stockpile v1
https://github.com/stockpilelabs/stockpile_react_sdk
crowdfunding sdk solana
Last synced: 29 days ago
JSON representation
SDK for Stockpile v1
- Host: GitHub
- URL: https://github.com/stockpilelabs/stockpile_react_sdk
- Owner: StockpileLabs
- Created: 2023-04-14T05:45:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-24T03:49:58.000Z (over 1 year ago)
- Last Synced: 2024-11-14T06:38:33.563Z (3 months ago)
- Topics: crowdfunding, sdk, solana
- Language: TypeScript
- Homepage:
- Size: 44.6 MB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# StockPile React SDK
## Installation
```bash
npm install @stockpileprotocol/[email protected]
``````bash
Add a .npmrc file to root of folder with the following details:registry=https://registry.npmjs.org/
@stockpileprotocol:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=
```## Usage
The `useStockpile` hook provides the Stockpile SDK instance and the `useCreateUser` hook provides a function to create a new user.```tsx
import { useStockpile, useCreateUser } from "@stockpileprotocol/react_sdk";
import { AnchorWallet, useAnchorWallet } from "@solana/wallet-adapater-react";
import { Connection, PublicKey } from "@solana/web3.js";
import { useMemo } from "react";const App = () => {
const anchorWallet = useAnchorWallet() as AnchorWallet;
const connection = useMemo(
() => new Connection("https://api.devnet.solana.com", "confirmed"),
[]
);
const sdk = useStockpile(
anchorWallet,
connection,
{ preflightCommitment: "confirmed" },
"devnet"
);const { create, error, loading } = useCreateUser(sdk);
return (
{
create(anchorWallet?.publicKey as PublicKey);
}}
>
Create User
);
};export default App;
```