Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show staked NFTS country wise #91

Closed
johgear opened this issue Jul 3, 2022 · 20 comments
Closed

Show staked NFTS country wise #91

johgear opened this issue Jul 3, 2022 · 20 comments
Assignees

Comments

@johgear
Copy link

johgear commented Jul 3, 2022

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

@triiq
Copy link
Contributor

triiq commented Jul 6, 2022

hey! if you still need help with this I'm happy to help make it happen :) @johnvv90

@johgear
Copy link
Author

johgear commented Jul 13, 2022

yes needed @triiq

@triiq
Copy link
Contributor

triiq commented Jul 14, 2022

Awesome @johgear add me on discord triiq#0001 or Twitter @triiq_

@johgear
Copy link
Author

johgear commented Jul 15, 2022

Demo NFTs uploaded
On devnet
Pool ID FMTG6KBy4xMPRZZ6vD611oEKCdqqrW7z5VuebBusuRzt
Collection address DSW8CMHrCxXUo3b4uvJEZtMtVTjJ5VSV5Hk8ZKVbeReB

@gchatz22
Copy link
Member

gchatz22 commented Jul 15, 2022

Hey, added logic 468e83a with which you can specify what analytics you want to display in your stake pool in the mapping file, and are displayed at the top of the pool. Currently the one supported is metadata analytics for staked tokens in which you can specify what metadata key you want to show analytics for aka Screen Shot 2022-07-15 at 2 02 12 PM

Let me know thoughts on this!

@johgear
Copy link
Author

johgear commented Jul 15, 2022

worked well. great serr. Thank you.
I put down how i have mentioned in the api mapping to get the desired result. Just check pls
Just one more thing

  1. Anyway these can be hyperlinked? Countries should be clickable which redirects to another website, for which i'll provide the url there.

{
name: 'animals',
displayName: 'Animals',
stakePoolAddress: new PublicKey(
'FMTG6KBy4xMPRZZ6vD611oEKCdqqrW7z5VuebBusuRzt'
),
imageUrl: '/logo-colored.png',
colors: {
primary: 'rgb(10,50,38,0.9)',
secondary: 'rgb(157,120,138, 0.6)',
},
analytics: [
{
metadata: {key: 'Country' , type:'staked'}
}
],
},

@gchatz22
Copy link
Member

Okay I see, are the hyperlinks you envision on the same format aka say https://some-domain.com/{countryName} or different for each country

@johgear
Copy link
Author

johgear commented Jul 16, 2022

different for each country.

@johgear
Copy link
Author

johgear commented Jul 16, 2022

Also, the math has to be adjusted it seems. Ideally, if 100% staked then all country's values should also be 100% staked.
In this collection total Atlanta, California, Georgia, and Tennesse are 3,4,8,5.

Now % staked showing as as below
Screenshot 2022-07-16 at 10 13 14 AM

@jpbogle
Copy link
Member

jpbogle commented Jul 20, 2022

are you saying the percentage is not out of the total - but instead out of the total just for that attribute / grouping

@johgear
Copy link
Author

johgear commented Jul 21, 2022

out of the total just fot that attribute/grouping.
You can refer https://suteki.stakooor.app/ staking platform. thay have a similar one what we are thinking

@johgear
Copy link
Author

johgear commented Jul 23, 2022

yes. percentage shown is not out of the total. Atlanta should be 100% since all the NFTS in that collection are staked. Not just Atlanta but california, Tennesse, Georgia also. Hope you are able to understand. Wish we could discuss over a call or so to explain furthur. Thanks.

@gchatz22
Copy link
Member

Okay I believe we can support the latter piece, the out of the total per country, and not total of all NFTs. The different hyperlinks I believe would be a bit too hard to generalize in a broad rule specified for metadata stats though. I don't think we would support that. Most definitely though with a fork of our UI adding your customizations to support the hyperlinks, it would work.

@johgear
Copy link
Author

johgear commented Jul 26, 2022

wokay hyperlink part is a bit tricky. let's just do the math part. that should do.

@gchatz22
Copy link
Member

gchatz22 commented Aug 2, 2022

Hey made this feature possible in our UI, by defining an analytics object in the mapping file such that

analytics: [
      {
        metadata: {
          key: 'Country',
          type: 'staked',
          totals: [
            {
              key: 'Atlanta',
              value: 1000, // eg. total number of Atlanta tokens
            },
            {
              key: 'California',
              value: 900, // eg. total number of California tokens
            },
            {
              key: 'Tennessee',
              value: 800, // eg. total number of Tennessee tokens
            },
            {
              key: 'Georgia',
              value: 700, // eg. total number of Georgia tokens
            },
          ],
        },
      },
    ],

Let me us know what you think and if there is any confusion with it

@johgear
Copy link
Author

johgear commented Aug 3, 2022

analytics: [
{
metadata: {
key: 'Country',
type: 'staked',
totals: [
{
key: 'Atlanta',
value: 3,
},
{
key: 'California',
value: 4,
},
{
key: 'Tennessee',
value: 8,
},
{
key: 'Georgia',
value: 5,
},
],
},
},
],
maxStaked: 20,
},

So I added the as per your instructions but I'm getting a different percentage value. here's the screenshot. Do I have to update anything?
Screenshot 2022-08-03 at 1 22 01 PM

@gchatz22
Copy link
Member

gchatz22 commented Aug 3, 2022

There was a division on the UI side that would still divide by the maxStaked number configured. f5b321e#diff-997911902d972e73aac70e0bdc4d1b7bd38a7c5ff790f08e8af3357a94a2bfaeR813.

Also for what is worth in your config above^^, seems like in the metadata of the mints, Tennessee is misspelled to Tennesse haha. Also seems like Georgia value should be 8 and Tennessee value should be 5.

@johgear
Copy link
Author

johgear commented Aug 4, 2022

Ayoo. I mispelt Tennessee. thanks for pointing it out. I adjusted the values. Removed maxstaked. But still math is not doing right. Check the screenshot.
Screenshot 2022-08-04 at 1 02 13 PM

@jpbogle
Copy link
Member

jpbogle commented Aug 18, 2022

@johgear looks like @gchatz22 addressed this mostly with 468e83a

and then a few follow-ups on discord and finally this to ensure it reloads without refreshing the page 1c0e33a

Thanks for suggesting this feature and glad we could work through it with you! Closing issue now

@jpbogle jpbogle closed this as completed Aug 18, 2022
@johgear
Copy link
Author

johgear commented Aug 20, 2022

Thank you Cardinal labs and @gchatz22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants