Giter Club home page Giter Club logo

staking-ui's Introduction

e# Staking UI

This repository hosts the UI inteface that powers https://stake.host.so for staking NFTs on Solana.

Use this repo to create and deploy stake pools with built-in reward distribution, or build your own custom interface with our underlying staking protocol.

For questions or technical help, join our Discord.


Create a Stake Pool

To create a stake pool, navigate to the admin page located at https://stake.host.so/admin. This page hosts a form to create a stake pool with various configurations.

Note: All configurations in the admin page are optional. Also, filters in the stake pool configuration are union-based, if any one of the conditions is met, then the NFT will be allowed to stake in the pool.

After creating your stake pool, you will receive a Stake Pool Id. View your stake pool at https://stake.host.so/[stakePoolId]

Pools by default will have no metadata. View the section titled "Customizing your Stake Pool" to learn about adding images, colors and custom pool name.

Pool Creation Parameters:

export type StakePoolParams {
    allowedCollections?: PublicKey[];
    allowedCreators?: PublicKey[];
    requiresAuthorization?: boolean;
    overlayText?: string;
    imageUri?: string;
    resetOnStake?: boolean;
  }

Reward Distribution Parameters

export type RewardDistributionParams {
    stakePoolId: PublicKey;
    rewardMintId: PublicKey;
    rewardAmount?: BN;
    rewardDurationSeconds?: BN;
    kind?: RewardDistributorKind;
    maxSupply?: BN;
    supply?: BN;
  }

There are two types of reward distribution (RewardDistributionKind) with Staking.

  1. Mint - give mint authority of your reward token to the stake pool so the pool can mint on demand
  2. Treasury - transfer reward tokens from your wallet to the stake pool, top-up the stake pool treasury balance whenever needed.

Environments

The program and related UIs are deployed on Solana mainnet-beta and devnet. By default the UI will point to mainnet. You can ovverride this by using ?cluster=devnet in the URL or navigating to https://dev-stake.host.so. All configuration is scoped to that environment, and no data including pools, reward distributors, tokens, NFTs or sol will be carried over from mainnet to devnet and vice-versa.

Customizing your Stake Pool

In order to easily access your stake pool, airdrop NFTs on devnet for your specific collection and get a stake.host.so/[projectName] url, you'll need to create a Stake Pool metadata object. NOTE if you specified a verified creator in a devnet pool, airdropped NFTs will not be allowed into that pool because your creator will not be verified.

export type StakePoolMetadata = {
  // Name of this stake pool used as an id. Should be in lower-case kebab-case since it is used in the URL as /{name}
  // https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Why-you-should-make-kebab-case-a-URL-naming-convention-best-practice
  name: string
  // Display name to be displayed in the header. Often the same as name but with capital letters and spaces
  displayName: string
  // Publickey for this stake pool
  stakePoolAddress: PublicKey
  // Default receipt type. Setting this will remove the option for the user to choose which receipt type to use
  receiptType?: ReceiptType
  // Default empty. Setting this will tell the UI to only show tokens of that standard. Supports fungible or non-fungible
  tokenStandard?: TokenStandard
  // Optional config to hide this pool from the main page
  hidden?: boolean
  // Optional config to disable finding this pool
  notFound?: boolean
  // Optional hostname to remap -- SEE NOTE BELOW
  hostname?: string
  // Optional config to link redirect to page when you click on this pool
  redirect?: string
  // Hide allowed tokens style
  hideAllowedTokens?: boolean
  // styles to apply to the whole stake pool
  styles?: CSSProperties
  // Colors object to style the stake page
  colors?: {
    primary: string
    secondary: string
    accent?: string
    fontColor?: string
    fontColorSecondary?: string
    backgroundSecondary?: string
  }
  // Disallow regions based on IP address
  disallowRegions?: { code: string; subdivision?: string }[]
  // Image url to be used as the icon in the pool selector and the header
  imageUrl?: string
  // Background banner image for pool
  backgroundBannerImageUrl?: string
  // Website url if specified will be navigated to when the image in the header is clicked
  websiteUrl?: string
  // Max staked is used to compute percentage of total staked
  maxStaked?: number
  // Links to show at the top right of the page
  links?: { text: string; value: string }[]
  // On devnet when you click the airdrop button on this page it will clone NFTs with this metadata and airdrop to the user. These will not contain verified creators
  airdrops?: AirdropMetadata[]
  // Analytics to show at the top of stake pool. supports trait based analytics and overall tokens data
  analytics?: Analytic[]
}

In your pool's admin portal (eg. https://stake.host.so/admin/[poolId]), create your own config on-chain under the Config tab. You'll now be able to access your project at https://stake.host.so/[name].

Stake Pool Fees

https://www.notion.so/-labs/-Staking-Fees-14e66a64fb2d4615892937c5dbaa91cc

Custom hostname

For a custom hostname...

  1. Add your hostname to your pool config in api/mapping.ts
  2. Open a PR to this repo with that change
  3. Set the following record on your DNS provider to continue:
Type NAME CNAME
CNAME {your subdomain} cname.vercel-dns.com

Deployment and Beyond

Now that you've made and deployed your stake pool, you can either stick with 's UX for the stake pool experience or build your own.

Simply modify pages/[stakePoolId]/index.tsx with your own react styling, and host the stake pool on your own domain.

Development

To get started, clone the repo and run:

yarn install

Next, run the development server:

yarn run dev

Open http://localhost:3000 with your browser to see the staking interface running locally.

Set your Cluster

To access different clusters in the scaffold, set the cluster query parameter in the URL:

The default cluster set is mainnet. It's recommended to ensure you have ?cluster=devnet while testing out functionality.

Have questions?

Join our Discord to get technical support as you build on .


staking-ui's People

Contributors

arxgoutam avatar bobomunteanu avatar busbusbus69 avatar chambaz avatar db0706 avatar eagtf avatar gbrads avatar hamzasaleem2 avatar jpbogle avatar loadev avatar mantistc avatar mdstevens044 avatar metacreed avatar monstadao avatar nmccarthy82 avatar numpynewb33 avatar plesh4kov avatar porfisol avatar ramondreynold avatar shunitou avatar simon-lavery avatar srust32 avatar statikdev avatar thecurryman avatar therabbitknows avatar tribixbite avatar triiq avatar vmlabss avatar warlyware avatar zeroq4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

staking-ui's Issues

Show staked NFTS country wise

My NFT collection has the following metadata
Name: Jango #1
Background: Blue:
Country: Atlanta
Position: Horizontal.

The collection is about 5000.
Out of these
1000 NFTs belong to country Atlanta,
1000 NFTs Georgia
1000 NFTs Tennsse
1000 NFTs California

My requirement is to show on the Cardinal UI, the percentage staked by countries and also hyperlink the country name ( to redirect to a third-party website ) I have shared with you a screenshot of what exactly I'm looking for. To make this happens pls let me know how to implement this on your code.

White with Pink Hearts Doodle Girlfriend Valentines Card

Unstaking fee

It would be cool if it was possible to add an unstaking fee you can set and the sol then goes to a specific wallet. I have seen this from gemfarm where you can set a unstaking fee in lamports in the config, like it is possible to do in our admin config. In gemfarm tho it spares the lamports and you can claim it in the admin config. Doesnt really matter, but what is possible to make.

Add One Click Stake All NFTs

Hi Team
This is a simple feature that allows the holder to stake all their Allowed NFTs into a live pool.
Some benefit of "One Click Stake NFTs" is saving holders time, especially hold more than 20 NFTs
unknown

Hostname mapping does not support mapping `/`

See PR for more details #106

Unfortunately it has 2 shortcomings which is the domain HAS to add your pools name on the path, it will not allow for rewriting / so there is both a rewrite and redirect rule added. In addition nextJS support for importing a ESM module into next.config.js does not work so right now you have to take 1 extra step to define the hostname mapping. Eventually we will figure out a way to have all pool config in one place

This issue is to track support mapping from / without a name in the path as well as consolidating the config objects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.