opensea-js icon indicating copy to clipboard operation
opensea-js copied to clipboard

Polygon assets access

Open dudendy opened this issue 5 years ago • 37 comments

Hey, I'm trying to get info about this item: https://opensea.io/assets/matic/0xa02d547512bb90002807499f05495fe9c4c3943f/0

My code: const data = await seaport.api.getAsset({ tokenAddress: '0xa02d547512bb90002807499f05495fe9c4c3943f', tokenId: 0 });

My request URL is: https://api.opensea.io/api/v1/asset/0xa02d547512bb90002807499f05495fe9c4c3943f/0/? which is not exist.

I believe the problem is that it doesn't have matic keyword in params, can someone tell me how can I specified it?

dudendy avatar Mar 20 '21 01:03 dudendy

hey @andkoval. Did you solve this issue? Could you share the solution?

krzysu avatar Jun 02 '21 15:06 krzysu

I found this on OpenSea discord:

we plan to build in API support for Matic, but it’s not currently available.

We don’t currently have a REST API for Matic assets/events. You might be hitting our GraphQL endpoints - which is what our app hits to get that information - most of those endpoints are not auth-gated so can be called by other apps/teams

krzysu avatar Jun 02 '21 15:06 krzysu

@krzysu any solution?

jack5parr0w avatar Nov 21 '21 02:11 jack5parr0w

I've heard that they are working on a new version of API that will also support polygon, but I don't know how is it going. I'm not aware of any way to access opensea polygon assets or orders right now. Unfortunately :(

krzysu avatar Nov 21 '21 12:11 krzysu

@krzysu Thanks for the reply. It seems there is no way to do it with opensea API but I'm using polygonscan API which is works but has a very limited amount of data it provides.

jack5parr0w avatar Nov 21 '21 12:11 jack5parr0w

Would love to have an update on this.

dustinkeeton avatar Dec 21 '21 06:12 dustinkeeton

Push OpenSea team to work intensively on this. https://support.opensea.io/hc/en-us/requests/new Let them know it's an important topic.

CombainerA19 avatar Dec 28 '21 01:12 CombainerA19

@krzysu Thanks for the reply. It seems there is no way to do it with opensea API but I'm using polygonscan API which is works but has a very limited amount of data it provides.

Could you by any chance give an example of how you do that? I have the same problem...

johndo31 avatar Dec 30 '21 08:12 johndo31

+1, I noticed that /events work with matic, but not /assets nor /asset

decentraliser avatar Jan 16 '22 19:01 decentraliser

+1 for this, refresh api not working with Polygon

raf202 avatar Jan 20 '22 18:01 raf202

@decentraliser can you give a bit of info how you got those events to work? I tried with a polygon contract address

  path: '/api/v1/events?asset_contract_address=0xa5f1ea7df861952863df2e8d1312f7305dabf215&offset=0&limit=10',

but get a 500 error back. replacing with any normal eth mainnet contract works fine. I also tried /v2 and adding /matic in the URL without luck, keen to know what route you found...

dcsan avatar Jan 22 '22 09:01 dcsan

@dscan it just worked out of the box for me, with the emblem-vault-matic contract

decentraliser avatar Jan 22 '22 10:01 decentraliser

@decentraliser

hmm doesn't work for me, maybe I'm calling the API in a different way? I had problems with their node SDK, so I'm just using a raw axios/REST call as below. I have an API key, vis:

collection: https://opensea.io/collection/emblem-vault-matic token: https://opensea.io/assets/matic/0x8b8407c6184f1f0fd1082e83d6a3b8349caced12/688217 contract: https://polygonscan.com/address/0x8b8407c6184f1f0fd1082e83d6a3b8349caced12

osapi GET URL:

/api/v1/events?asset_contract_address=0x8b8407c6184f1f0fd1082e83d6a3b8349caced12&offset=0&limit=10


const osApiKey = AppConfig.getenv('osApiKey')

const options = {
    headers: { Accept: 'application/json', 'X-API-KEY': osApiKey },
    params: {}
};

export class Listing {

    static async getListings(address?: string) {

        const baseUri = `https://api.opensea.io/api/v1/events`
        const asset_contract_address = '0x8b8407c6184f1f0fd1082e83d6a3b8349caced12' // emblem
        // const asset_contract_address = '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d' // bayc

        options.params = {
            asset_contract_address,
            // only_opensea: false,
            // order_direction: 'desc',
            offset: 0,
            limit: 10
        }

        const result: AxiosResponse | void = await axios.get(baseUri, options).catch(err => {
            console.log('axios err', err)
        })

        return result?.data

    }
}



the BAYC contract (eth) works fine, but nothing i've tried on polygon works... /events is actually the main API i'd like a response from

dcsan avatar Jan 22 '22 23:01 dcsan

@dcsan it works when using the collection slug in the request params, as opposed to the contract address

decentraliser avatar Jan 23 '22 08:01 decentraliser

Would love an update on this. Any news is appreciated :)

KenGuan666 avatar Mar 18 '22 06:03 KenGuan666

Is Matic Supported already ?

dennisbappert avatar May 06 '22 08:05 dennisbappert

Any updates?

stpoa avatar May 10 '22 06:05 stpoa

I hope OpenSea will update API support for polygon soon

TunaWho avatar May 18 '22 16:05 TunaWho

I hope OpenSea will update API support for polygon and mumbai soon as well.

magicsih avatar May 19 '22 06:05 magicsih

I hope OpenSea will update API support for polygon and mumbai soon as well.

stpoa avatar May 23 '22 10:05 stpoa