Closed abukhalid-abdurrahman closed 3 years ago
Check out the Solnet.Metaplex examples, the GetMetadata example shows you how you should get the accounts and the CreateMetadata example shows you how you should derive de public key of the metadata account.
Unfortunately this project is still under development so it is not available on NuGet.
Getting account HyzkFkW3daaAy6HuRKNJFbrAzwuois6N5cHDeg5TPG2Z Owner: metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s
Is there a way to get the real owner of the nft? For instance for the NFT above: https://explorer.solana.com/address/HyzkFkW3daaAy6HuRKNJFbrAzwuois6N5cHDeg5TPG2Z/largest?cluster=devnet
The real owner is not metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s, but Ek9Qw7tAYKyhrxCCrZDwWDTsT3aCCYAqcntsGp5eqDLz if you check under distribution:
It has to do something with program derived account, and I am on it, but just in case you know?
If you have the NFT mint account, then you can call the getTokenLargestAccounts
method for a given mint. This will return the largest holders from said mint. In the case of a 1/1 NFT, it will return the token account of the current holder, and then you can get the Owner
of that token account from there.
Hm, this is strange?
But when you check on explorer it shows correct owner: https://explorer.solana.com/address/8g3nahwRZwtQqVcdZyTS3weZ2732SHLPV2htJaYMGdcS?cluster=devnet
I think I have to find program derived address?
That info is correct. Token accounts are owned by the token program, but have the actual in the account data.
I'll have to create an extension method like I did for the susbcriptions.
For know, you have to manually decode the owner address from the token account data.
According to the token program source the owner is the second item in the account, so it should be at the offset 32.
In order to help decode, you should add a dependency to the Solnet.Program library. Then:
using Solnet.Programs.Utilities;
--------
var bytes = Convert.FromBase64String(result2.Result.Value.Data[0]);
var pk = bytes.GetPubKey(32);
And now pk
should be the owner account.
thanks. will you also able to add the encoding type for getAccountInfo
so we can pass jsonParsed
which could simplify this bit?
I will try and do something like that for future proofing. But don't expect such change in the next week. Me and @murlokito are a bit full with the hackathon project.
@faha-berdiev @nukec Can we close this? It is more of a discussion per se than an actual issue.
yes
"accounts": [ { "publicKey": "FMR1zwHNJQUSTZ6MQXFaUdz2QfUqUvjidCyAcG6dh5CD", "owner": "GsguXojeGATpZGW8VNfW8qQCBVodbW2qGS8bUEbdGZfv", "isAssociatedTokenAccount": true, "lamports": 2039280, "accountCount": 1, "tokenMint": "8vfMHx8sxoqYs5V11e6LbdVFBUFwgEgXL292r3vpSBTT", "symbol": "", "tokenName": "Unknown 8vfMHx8sxoqYs5V11e6LbdVFBUFwgEgXL292r3vpSBTT", "decimalPlaces": 0, "quantityDecimal": 1, "quantityRaw": 1 } ], "count": 1
That is a response that we geting, and how to get NFT description and properties from metadata?