0.0.21 • Published 1 year ago

ape-stats-goerli v0.0.21

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

ape-stats-goerli

Three React components and a hook that display Bored Ape related data.

1) ApeStatBar

Displays staked ApeCoin amount, max pool amount, unclaimed amount, and daily rate for the ApeCoin pool, BAYC pool, MAYC pool, and BAKC pool.

2) useStakedAmount

Returns the staked ApeCoin amount for the ApeCoin pool, BAYC pool, MAYC pool, and BAKC pool.

3) ApeUnusedSerums

Given a Bored Ape tokenId, the unused serums to create a Mutant Ape are displayed.

4) ApeMatchedItems

Given a collectionId and tokenId, if they exist, the accompanying BAYC, MAYC, BAKC, and/or OTHR tokens are displayed.

ethereum-multicall is used with a public RPC to retreive the on-chain data.

Installation

Installed with npm or yarn.

If ethers is not in your project, install with ethers as well.

  npm install ape-stats-goerli ethers

or

  yarn add ape-stats-goerli ethers

Usage

ApeStatBar 📊

Currently only Goërli is supported. Mainnet support will be added when the staking contract address is made available.

The stakersAddress is required if poolId is 0. Otherwise the stakersAddress is inferred from the ownerOf the tokenId supplied. \ \ The tokenId is required if poolId is NOT 0. The stakersAddress prop will be ignored in this case.\ \ If poolId is left undefined it will default to 0 ie. the ApeCoin staking pool.

Pool IDDescription
0ApeCoin Pool
1BAYC Pool
2MAYC Pool
3BAKC Pool

The code snippet below will render the stats for tokenId 1 of the BAYC collection used on Goërli.

import { ApeStatBar } from "ape-stats-goerli";

export default function Page() {
  return <ApeStatBar tokenId={"1"} poolId={"1"} isTestnet={true} />;
}

useStakedAmount 📊

Currently only Goërli is supported. Mainnet support will be added when the staking contract address is made available.

The params go as follows: isTestnet: boolean, poolId: string, tokenId: string, stakersAddress: string \ \ Just like ApeStatBar , stakersAddress is required if poolId is 0. \ And tokenId is required if poolId is 1, 2 or 3 \ \ Refer to table above for poolId reference. \ \ The code snippet below will return the amount of staked ApeCoin for stakersAddress 0x9B6cEd7dc2F47Ae3e30E6162193BD9CE78643A63 on Goërli. \ Enter tokenId as empty string if poolId is 0.

import { useStakedAmount } from "ape-stats-goerli";

export default function Page() {
  const { stakedAmount } = useStakedAmount(true, "0", "", "0x9B6cEd7dc2F47Ae3e30E6162193BD9CE78643A63");

  return <div>{stakedAmount}</div>;
}

The code snippet below will return the amount of staked ApeCoin for the BAYC pool for tokenId 10 on Goërli. \ Omit stakersAddress if poolId is 1, 2, or 3.

import { useStakedAmount } from "ape-stats-goerli";

export default function Page() {
  const { stakedAmount } = useStakedAmount(true, "1", "10");

  return <div>{stakedAmount}</div>;
}

UnusedSerums 🧪

The tokenId and baseUrl are required.

The code snippet below will render the unused serums for tokenId 1 of the BAYC collection used on Ethereum Mainnet.

import { UnusedSerums } from "ape-stats-goerli";

export default function Page() {
  return <UnusedSerums baseUrl="bayc.snag-render.com" tokenId={"1"} />;
}

MatchedItems 🖇️

Colletion IDDescription
0MAYC Token
1OTHR Token
2BAKC Token
3BAYC TOken

The collectionId, tokenId, and baseUrl are required.\ The given tokenId must exist.

The code snippet below will render the accompanying MAYC, BAKC, and BAYC tokens for tokenId 1290 of the OTHR collection used on Ethereum Mainnet.

import { MatchedItems } from "ape-stats-goerli";

export default function Page() {
  return <MatchedItems baseUrl="bayc.snag-render.com" tokenId={"1290"} collectionId="1" />;
}

The code snippet below will render the accompanying OTHR, BAKC, and BAYC tokens for tokenId 30006 of the MAYC collection used on Ethereum Mainnet.

import { MatchedItems } from "ape-stats-goerli";

export default function Page() {
  return <MatchedItems baseUrl="bayc.snag-render.com" tokenId={"30006"} collectionId="0" />;
}

Theming

A theme object can be added as a prop to ApeStatBar, UnusedSerums, and MatchedItems for custom styling. \ \ Treat this object as you would inline css styling. \ \ If any of the default styling given to certain parts of the component is undesired, the tables below will aid in custom styling.

Exceptions for ApeStatBar

Theme KeyDescriptionDefault
subTitleFontSizeFont size describing which pool the data is from.60%
skeletonBackgroundColorColor of the loading placeholder.#DDDBDD
statColorFont color of the stats.limegreen
rateFontSizeFont size of the 24hr rate..6rem
linkFontSizeFont size of the external link.60%

Exceptions for UnusedSerums

Theme KeyDescriptionDefault
dividerColorColor of dividing line.rgb(55, 59, 66)
skeletonBackgroundColorColor of the loading placeholder.#DDDBDD
buyButtonColorFont and border color of the buy button.rgb(85, 189, 82)

Exceptions for MatchedItems

Theme KeyDescriptionDefault
dividerColorColor of dividing line.rgb(55, 59, 66)
skeletonBackgroundColorColor of the loading placeholder.#DDDBDD
ownedByColorFont color of the text that says "Owned by".rgb(140, 149, 156)
listingPriceColorFont color of the listing price.rgb(140, 149, 156)
listingPriceFontSizeFont size of the listing price.80%
listingPriceFontWeightFont weight of the listing price.300
listingPricePaddingTopTop padding of the listing price..25rem
import { ApeStatBar } from 'ape-stats-goerli'

export default function Page() {
  return(
    <ApeStatBar
        tokenId={"10"}
        poolId={"1"}
        theme={{
            borderRadius: "10px",
            backgroundColor: "#000000",
            border: "1px solid #45494D",
            color: "white",
            padding: "1.5rem"
            skeletonBackgroundColor: "pink"
        }}
    />
  )
}

Props for ApeStatBar

ParameterTypeDescriptionDefault
stakersAddressstringRequired if poolId is 0. Valid wallet address.undefined
tokenIdstringRequired if poolId is NOT 0. Valid tokenId for NFT.undefined
poolIdstringPool ID to determine which staking pool to retrieve data from.'0'
themeobjectInline CSS styling object.undefined
isTestnetbooleanBoolean used for choose which chain to get staking data from.false

Props for UnusedSerums

ParameterTypeDescriptionDefault
tokenIdstringRequired. Valid tokenId for BAYC token.undefined
baseUrlstringRequired. Base URL for external link.undefined
themeobjectInline CSS styling object.undefined

Props for MatchedItems

ParameterTypeDescriptionDefault
tokenIdstringRequired. Valid tokenId for BAYC token.undefined
baseUrlstringRequired. Base URL for external link.undefined
collectionIdstringRequired. Reference to determine what collection the given tokenId is from.undefined
themeobjectInline CSS styling object.undefined
0.0.21

1 year ago

0.0.19

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.9

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

0.0.43-beta

2 years ago

0.0.40-beta

2 years ago

0.0.39-beta

2 years ago

0.0.28-beta

2 years ago

0.0.27-beta

2 years ago

0.0.26-beta

2 years ago

0.0.25-beta

2 years ago

0.0.22-beta

2 years ago

0.0.6-beta

2 years ago

0.0.5-beta

2 years ago

0.0.4-beta

2 years ago

0.0.3-beta

2 years ago

0.0.2-beta

2 years ago

0.0.1-beta

2 years ago