-
Notifications
You must be signed in to change notification settings - Fork 87
None type error when trying to api.mint #8
Comments
is that address the mint account public key? in other words the program ID? the data is in this case is metadata of the NFT (the metaplex metadata json schema) |
No it is blank if you look at ['result']['value']['data'][0] in the structure its null: 'result': {'context': {'slot': 93025204}, 'value': {'data': ['', 'base64'] |
Looks like this account has yet to be initialized/populated with data |
Where does that get done I dont see that in any of the documentation? I've also queried Dagen Apes on Mainnet - the Update Authority account and its the same blank? print(client.get_account_info("DC2mkgwhy56w3viNtHDjJQmc7SGu2QX785bS4aexojwX")) |
I think the update authority is supposed to be empty. Check the protocol source code. What exactly are you trying to do? |
Just trying to use the mint function but it keeps breaking/eroding at that
particular point.
Also it would be handy just having a function to update metadata on an
existing token -
…On Thu, 9 Sep 2021 at 02:17, Jarry Xiao ***@***.***> wrote:
I think the update authority is supposed to be empty. Check the protocol
source code. What exactly are you trying to do?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALJESKGKEPQD3ZGJ4M3ST53UBADKNANCNFSM5DTMIE6A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
You are more than welcome to make a PR with the update_metadata fix. I did push some changes a few days ago. Is your branch up to date? |
Not sure I've got the skills yet. Yeah its the latest pull I've got. |
Can give it a go.. its just the transmission onto the Solana network I need help with. |
Did you find any resolution, I am getting same issue
|
+1
|
Something is wrong on testnet and devnet, things are working fine on mainnet-beta. This looks to be aproblem at the solana API end where it's not returning the metadata |
Same error on devnet, is there anyone who made it work on mainnet? |
Faced the same problem today. is this issue because of devnet have some troubles these days? |
run the test_api.py, if it works then your code is missing something. |
I found the same issue and fixed it by editing In the function get_metadata, I added
before base64 decoding then it worked (but I don't know why). The new function will look like:
|
@batprem In my experience it was the raw metadata being returned from the API which was sometimes empty, therefore I think you may have just got lucky when you retried. Just a thought. |
@rhamnett It's hards to say but I tried uploading with my modified function and original function by more than 10 times for each. The modified one significantly made all successful attempts whereas the original one made all fail. In my guess, it would be about |
Hello, can you solve this problem? I tried your method and will get some improvement, but sometimes I still make the mistake of agreeing. |
I think it might be a timing issue with the deployment of the Program not propagating everywhere by the time the mint is called (on devnet anyway). So for example doing like:
seems to work 100% of the time for me. Without that sleep, it's super inconsistent (tests included). Also, the 30 seconds there might be overkill I just picked a huge number for testing the theory. |
I think a generally good idea for this API is to change the default confirmation status to |
make sure that when you deploy it (before even calling the mint), the contract name and contract symbol fields match the name and symbol fields in your metadata json. as soon as I changed this, the mint worked. |
@jarry-xiao is their any solution for this issue I am facing the same since many days and cannot find the solution . |
see if sleeping for 30 seconds after you deploy then mint would work. this just makes sure that the data has been propagated into the blockchain. the cleaner way is to "await" for 31 confirmations for the deploy transaction. |
@crypt0miester sleeping works sometimes but not all the time we need to be sure that its robust and works . I also have another question say I want to create say 10 NFT with different metadata do I have to call deploy and mint 10 times or only call deploy 1 and mint 10 times is this correct |
are you on devnet or main? always be ready for deployment failure. solana might be lagging and transactions might fail. but each nft has its own contract I believe. so 10 deployments and 10 mints. that's why there is a supply in deploy function. |
@crypt0miester thanks i am working on devnet do you know what @jarry-xiao is talking about to set default status to confirmed for deploy i dont understand how to implement it |
yes. here is a hint https://github.com/metaplex-foundation/python-api/blob/main/utils/execution_engine.py I'm on vacation. cant help you more. |
@crypt0miester can you tell me {'code': -32002, 'message': 'Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.', 'data': {'accounts': None, 'err': 'AccountNotFound', 'logs': []}} why this error occurred . |
check if you have solanas in the wallet address. secondly change skip_confirmation=False or it will not check if the txn is confirmed or not to begin with. True will just skip the checking. and please open a new issue. |
I actually think this issues is fixed by preserving the order of signers, without skipping confirmation or preflight. I will submit PR with the update that has been consistently fixing the issue on my side. |
Expanding on @FFEvan's comment, it comes down to this line: https://github.com/metaplex-foundation/python-api/blob/main/utils/execution_engine.py#L8 Converting the list of signers into a Set removes duplicates but doesn't guarantee order preservation. In addition, we tracked down some issues in solana-py surrounding how they were initialzing their Keypair class. It was rather unoptimized, which was causing situations here in execution_engine.py where the Keypair was being used before it had finished computing its public_key property. This is what causes the AccountNotFound error, the Keypair doesn't have a public_key yet at the time it's used so of course the account cannot be found. @FFEvan should have the PR up soon. These changes have completely resolved the issues for us. Hundreds of mints over the course of multiple days and multiple machines. |
hi @DevVarunn reading Solana documentation, I think I know what is the issue with the code. steps are explained in this blog: the idea is that you need to Create an account to handle the tokens. by definition in the Solana documentation: https://docs.solana.com/developing/programming-model/accounts At least this is the lead I have right now reading the code. |
thanks @DevVarunn I merged the fix from Evan which is in nuthsell: but the code still throws the same error. are you sure you fix works? |
@mdergueche yes this solved the issue for me have made 100s of deploy/mint after that didn't get the error again, you can try to set the skipPreflight ,skipconfirmation flags to false the might help also I want to find a way to calculate cost of minting i.e. transaction cost + account rent before mint if any one know ho to do that then please comment |
@nurav97 I'm trying all combination here. so I followed again the read me file and created this code, does this work for your end or am I doing something wrong: import base58 def test(): |
Is the solved? I am still getting the error. I have made the changes in metplex/metadata.py - def get_metadata(client, mint_key): But I am still getting the TypeError: 'NoneType' object is not subscriptable Thanks In Advance for any help or suggestion |
hi, sorry I've been on vacation. try this dirty workaround. (use at own risk)
|
Traceback (most recent call last):
File "/Users/xxx/PycharmProjects/Solana/test/test_api.py", line 95, in
test()
File "/Users/xxx/PycharmProjects/Solana/test/test_api.py", line 68, in test
mint_to_response = api.mint(api_endpoint, "xxx", "xxx", "https://testing.com")
File "/Users/xxx/PycharmProjects/Solana/api/metaplex_api.py", line 77, in mint
tx, signers = mint(api_endpoint, self.account, contract_key, dest_key, link, supply=supply)
File "/Users/xxx/PycharmProjects/Solana/metaplex/transactions.py", line 164, in mint
metadata = get_metadata(client, mint_account)
File "/Users/xxx/PycharmProjects/Solana/metaplex/metadata.py", line 180, in get_metadata
data = base64.b64decode(client.get_account_info(metadata_account)['result']['value']['data'][0])
TypeError: 'NoneType' object is not subscriptable
When I did some digging infact its true based on the value is none your looking for in the line - what are you looking for here? The JSON is providing a null field.
print(client.get_account_info("D3EjGmwj33jVS5ZqYPr4njJMVBGR682rwYCTRAKswD1p"))
{'jsonrpc': '2.0', 'result': {'context': {'slot': 93025204}, 'value': {'data': ['', 'base64'], 'executable': False, 'lamports': 1000000000, 'owner': '11111111111111111111111111111111', 'rentEpoch': 227}}, 'id': 1}
print(client.get_account_info("
")['result']['value']['data'][0])''
The text was updated successfully, but these errors were encountered: