GML An OpenSea.io REST API Function

JesterOC

Member
I just ported an OpenSea.io REST Function, bare with me...

( I HOPE YOU KNOW SOMETHING ABOUT BLOCKCHAIN )

It checks an ETH wallet address for an NFT asset (currently 1 per http call).

what the example shows (without changing anything):
the quantity of the checked asset "Orbiting an Epic Smile" in my own wallet and my opensea.io username of the wallet.

- FUNCTION:
osea_data_get_singleAsset( wallet_address ,token_id , asset_contract_address )

Just change out token_id and asset_contract_address to look for a different asset.

To look in a different wallet, change the first paramater to another wallet address.

For more info/download see:

...and the API reference for those interested:

and here's a screenshot of a successful NFT check (includes WAX NFTs in screenshot, but that is not included in this example).
 
Last edited:

JesterOC

Member
On an extra related side note, ive also done Atomic WAX NFTs API code for GM...
And some website codes to help implement both.. the way I have it setup it requires a backend database and login before wallet connect to connect logged in account with ETH/WAX wallets. But you could substitute the backend with your own if you wanna.

The Wallet connection uses wallet connect API.. of that i chose to use a metamask only approach.
 

MegaHogeMan

Member
Hey dude can I use this to say have a wallet login screen in my game and then only move to the next room if a certain NFT is in the wallet?
 

MegaHogeMan

Member
Really interested in talking with you on this, and a possible parttime paid employment for your help, dm for more details :)
 

JesterOC

Member
You should implement a web3 wallet api(Preferably Metamask). You can then dialog with the wallet via its basic api. Opensea is a centralised NFT market, what you need is something else
Nope, he can't use this ALONE... but with my web3 code for wallet link with metamask. It (The NFT) would work like a tradeable access token... As in whoever own the NFT u require can access the next room if they link wallet.
 
Nope, he can't use this ALONE... but with my web3 code for wallet link with metamask. It (The NFT) would work like a tradeable access token... As in whoever own the NFT u require can access the next room if they link wallet.
Do you have any tutorials for the web3 stuff, or documentation I could read? I've been looking into this, but getting stuck since I can't seem to import any libraries in my JS extensions. I was going through the metamask documentation, but am struggling to implement it in GM2
 
I'm interested about this too. Can someone please detail how this is achieved to make in-game collectables into NFT and make us gain some financial benefit? Maybe make a tutorial or YT video. The other question being is this possible to implement with games made for distribution via Google Play Store. I'm worried the roadblock might be with GPS as with Apple, they are sensitive about apps having their own means of making money with them cut off the loop. Of cause I can always opt to distribute my app via other market platform.
 

JesterOC

Member
Do you have any tutorials for the web3 stuff, or documentation I could read? I've been looking into this, but getting stuck since I can't seem to import any libraries in my JS extensions. I was going through the metamask documentation, but am struggling to implement it in GM2
I haven't used a JS extension but would love to see a web3 one, would make this easier for HTML5 games... But for every other platform you're gonna need the same functionality... I'd recommend making a login for your app to collect a users wallet address with web3 access... Via WalletConnect Api.

Then u can use this Opensea Rest Api to check a users wallet for quantity of NFTs..

I'm interested about this too. Can someone please detail how this is achieved to make in-game collectables into NFT and make us gain some financial benefit? Maybe make a tutorial or YT video. The other question being is this possible to implement with games made for distribution via Google Play Store. I'm worried the roadblock might be with GPS as with Apple, they are sensitive about apps having their own means of making money with them cut off the loop. Of cause I can always opt to distribute my app via other market platform.
It is possible on google play games... Afaik... Might wanna google it . Just to be safe, don't wanna have ur user-base left in the lurch sooner or later after product release.

But if they are against u making money... Simply don't use their platform..

Personally I'm in love with itch.io.

Made myself an Android app for itch using advancedWebview for android.
Might put it on itch.io for inception.
XD (jks)
 
@JesterOC Thanks for the reply! I guess I'm still a little unclear, are you doing this in two separate steps? Like, have something outside of GM collect the info, then pass it into GM? The wallet connect api looks like is JS? Or are you having the user manually enter their wallet? The reason I didn't want to go that way is that any user could enter a wallet address that does have the token, even if it's not theirs.

When I was trying to get a JS extension working, it seemed like it was having problems with importing external JS libraries, like the web3 provider, and it also seems like you can't do 'await' or async functions in the extension.
 

JesterOC

Member
having the user manually enter their wallet? The reason I didn't want to go that way is that any user could enter a wallet address that does have the token, even if it's not theirs.
Definitely not manual entry.. for that exact reason...

Yes, i am using my website with a login connected to backend database...
Once a user logs in, i can then have them call the wallet connect code via button.
All you need do to direct them to your website is use:

open_url("login_web_url");

Once the user logs in with their wallet, collect details and use js to communicate with ur backend to save the users wallet address
 
Definitely not manual entry.. for that exact reason...

Yes, i am using my website with a login connected to backend database...
Once a user logs in, i can then have them call the wallet connect code via button.
All you need do to direct them to your website is use:

open_url("login_web_url");

Once the user logs in with their wallet, collect details and use js to communicate with ur backend to save the users wallet address
Thanks for the reply! I actually ended up getting it working with JS extensions. The sticking point was that in order to include external JS libraries, you have to import them by editing the HTML5 doc, you can't add them in the JS doc. Once I figured that out, I could just follow some other JS examples to get it working. There's also a GM_API for JS that I guess isn't in the documentation. But it let's you send async messages back to GM.
 

JesterOC

Member
Lovely..
Thanks for the reply! I actually ended up getting it working with JS extensions. The sticking point was that in order to include external JS libraries, you have to import them by editing the HTML5 doc, you can't add them in the JS doc. Once I figured that out, I could just follow some other JS examples to get it working. There's also a GM_API for JS that I guess isn't in the documentation. But it let's you send async messages back to GM.
Glad to hear you got it working. 🙂
Mind telling me what you're planning on making?

At the moment I only have daily rewards set up for my own project..
I plan on adding some NFT's that grant features in-game... Such as "Gun Customizer" and maybe a really cheap novelty pass... Like a library card, where the game won't let you in unless you have one... Or a master key that can open any chest... (User can sell said NFT(s) to friends or whoever once they are finished with it) (AND U GET NFT ROYALTIES ON TRADES)

PS:
I'm thinking of uploading the WAX NFTs code.. and maybe the web code?
Like this post if you want Atomic Wax API and/or wallet login website codes.
 
Lovely..
Glad to hear you got it working. 🙂
Mind telling me what you're planning on making?

At the moment I only have daily rewards set up for my own project..
I plan on adding some NFT's that grant features in-game... Such as "Gun Customizer" and maybe a really cheap novelty pass... Like a library card, where the game won't let you in unless you have one... Or a master key that can open any chest... (User can sell said NFT(s) to friends or whoever once they are finished with it) (AND U GET NFT ROYALTIES ON TRADES)

PS:
I'm thinking of uploading the WAX NFTs code.. and maybe the web code?
Like this post if you want Atomic Wax API and/or wallet login website codes.
I'm working on something similar! The NFTs will be your character, but also the key to be able to play the game. People have talked about the utility of NFTs in games for a long time, but not that many people have done it yet. So I'm exploring this usage as a different form of monetization. In the future I will incorporate more NFTs into the game, most likely on polygon to get around the fees, and hopefully some kind of method to let other people make NFTs that can be pulled into the game as well. Huge project for sure haha, but it's a lot of fun figuring this stuff out.
 

JesterOC

Member
...some kind of method to let other people make NFTs that can be pulled into the game as well.
I have thought about doing this also, depending on NFT standard and api that u use, you can probably just have users copy paste the tokenID of the NFT they want to use in-game as character...
Check their wallet for that ID and then if all is successful, download the image and save it for use as a character...

Edit: Although.. you might wanna check size of the NFT image dimensions, so as not to load a giant/tiny image as character... and try lookout for NSFW images if multiplayer.
Also, u could maybe have a property [YOURGAME]_character that users can add to their NFT's that u can use to identify NFT's as character viable for ur game... That'll also help boost sales and gain popularity because it's then searchable ( people can then make assets for YOUR game (That they can even sell, no money in ur pocket, but u get plenty of free user-made assets) )
 
Last edited:
I have thought about doing this also, depending on NFT standard and api that u use
yeah that's basically what I was thinking. Except I would have 'approved' sellers. So they would be given a standard size template, and I would just include their contract address in my code. That way it wouldn't be a free for all with people uploading all kinds of bad stuff haha.
 

JesterOC

Member
Yeh? How would you approve them?
Manually? or via some code? Or a bit of both?

What about Opensea NFT's with the OPENSEA storefront contract address? They all use the same contract address if I'm not mistaken?

I was thinking i'd just use a "report" button as well as implementation of banning users from custom NFT use if reported by X amount of users or more in a month...

That's still way off for me tho..

5 years into my solo project, the multiplayer, NFT's, art-needs, story and itemcrafts have bundled into what looks like another 3-5 years work...
(First game, 😳 I hope people like it... Or thats a lot of time wasted)
 
Top