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

seaport.getAssetBalance() throws: Unable to get current owner from smart contract

Open swarlezbarkley opened this issue 5 years ago • 12 comments

I am trying to use seaport.getAssetBalance(). It is throwing an error of: Unable to get current owner from smart contract.

This is an example of my code following the documentation.

const balances = await seaport.getAssetBalance({
  accountAddress: '0x06e98b5030E4A4b43cF284af02EEb4dEBD5a52Aa',
  asset: {
    tokenAddress: addresses.ARTWORK_COLLECTION,
    tokenId: assets[0].tokenId,
    schemaName: 'ERC1155',
   },
})

Please let me know if this issue is common with you.

swarlezbarkley avatar Apr 03 '21 05:04 swarlezbarkley

Same over here. Don't understand a thing.

Wutklumpen avatar Apr 12 '21 00:04 Wutklumpen

Ok, I switched to a different asset which is now ERC721, and getAssetBalance does work now. Before I also tried with an ERC1155. Question is now, how can we get balance for ERC1155 tokens?

Wutklumpen avatar Apr 12 '21 07:04 Wutklumpen

any updates on this? it looks opensea bydefault mint to ERC1155 so this is currently an issue

kingsframe avatar Jun 03 '21 22:06 kingsframe

I believe the issue comes from the fact that the ERC1155 schemas are basically all hosted on a single OpenSea contract (most likely always 0x495f947276749Ce646f68AC8c248420045cb7b5e). Seems to be really specific to when you used the OpenSea contract.

Somehow, the SDK doesn't seem to support this specific schema (which is their own contract, bad SDK).

The workaround I've found was to use the API directly and fetch all the user's tokens (via https://api.opensea.io/api/v1/assets?options) and then filter the asset.collection.name to match my collection. Unfortunately, the SDK is also useless here because it doesn't even have the getAssets method implemented (again, bad SDK).

This is a workaround but it was the best way I found to fetch the items.

So basically, the SDK should first and foremost handle the case where getAssetBalance is used on an OpenSea contract, probably allowing a collectionName would make sense here to filter the proper collection. It should also have an implementation of getAssets, just cause it's in the API.

GabrielCartier avatar Oct 18 '21 23:10 GabrielCartier

same when using rinkeby chain

ruskid avatar Feb 16 '22 15:02 ruskid

Hello, is everyone still getting this error? Is it still only with ERC1155 or just with rinkeby chain?

esteban-OpenSea avatar Mar 24 '22 17:03 esteban-OpenSea

Checking in again, is this still an issue?

esteban-OpenSea avatar Apr 19 '22 17:04 esteban-OpenSea

This is occurring for me, for an 1155 asset. Same error on both Rinkeby and Main.

nishilshah17 avatar Apr 26 '22 21:04 nishilshah17

the same to me. how to solve it?

ahjohnwon avatar Jul 05 '22 16:07 ahjohnwon

再次检查,这仍然是一个问题吗?

yes,pls have a test.Im using windows 10,and nodejs version is 16.5.1 and [email protected]

DEPRECATED: Please use providerUtils.standardizeOrThrow() instead d:\OS\OpenseaAPI\node_modules\opensea-js\lib\sdk.js:2149 throw new Error("Unable to get current owner from smart contract"); ^

Error: Unable to get current owner from smart contract at OpenSeaSDK. (d:\OS\OpenseaAPI\node_modules\opensea-js\lib\sdk.js:2149:31) at step (d:\OS\OpenseaAPI\node_modules\opensea-js\lib\sdk.js:63:23) at Object.throw (d:\OS\OpenseaAPI\node_modules\opensea-js\lib\sdk.js:44:53) at rejected (d:\OS\OpenseaAPI\node_modules\opensea-js\lib\sdk.js:36:65)

[Done] exited with code=1 in 28.134 seconds

ahjohnwon avatar Jul 05 '22 17:07 ahjohnwon

This is my code: try { const offer = await seaport.createBuyOrder({ asset: { tokenAddress:tokenAddress,       tokenId:tokenId, schemaName:'ERC721' }, accountAddress:walletAddress, // Value of the offer, in units of the payment token (or wrapped ETH if none is specified): startAmount: 0.1, }) console.log(offer); } catch(err) { console.log(err); }

ahjohnwon avatar Jul 05 '22 17:07 ahjohnwon

Has anyone figured the solution?

nehaannvinu avatar Jan 05 '23 08:01 nehaannvinu