python-api icon indicating copy to clipboard operation
python-api copied to clipboard

update the primary_sale_happened property

Open dusking opened this issue 3 years ago • 16 comments

The update_token_metadata function doesn't allow updating primary_sale_happened. Is there another way to do so?

dusking avatar Feb 28 '22 15:02 dusking

it is the byte before the last, in line 187. in metadata.py.

​    ​_data​ ​=​ ​bytes​([​1​]) ​+​ ​_get_data_buffer​(​name​, ​symbol​, ​uri​, ​fee​, ​creators​,  ​verified​, ​share​) ​+​ ​bytes​([​0​, ​0​])

value I believe is 1 if the primary sale has happened.

sorry, I am in mobile.

crypt0miester avatar Feb 28 '22 16:02 crypt0miester

Like this?

​_data​ ​=​ ​bytes​([​1​]) ​+​ ​_get_data_buffer​(​name​, ​symbol​, ​uri​, ​fee​, ​creators​,  ​verified​, ​share​) ​+​ ​bytes​([​1​, ​0​])

JeffryCA avatar Feb 28 '22 17:02 JeffryCA

The

Like this?

​_data​ ​=​ ​bytes​([​1​]) ​+​ ​_get_data_buffer​(​name​, ​symbol​, ​uri​, ​fee​, ​creators​,  ​verified​, ​share​) ​+​ ​bytes​([​1​, ​0​])

This sadly does not work. Can you elaborate further @crypt0miester ?

The error is: #3 Metaplex Token Metadata instruction

Program log: Error: BorshIoError Program Metaplex Token Metadata consumed 3816 of 200000 compute units Program returned error: Failed to serialize or deserialize account data: Unknown

JeffryCA avatar Mar 01 '22 09:03 JeffryCA

The

Like this?

​_data​ ​=​ ​bytes​([​1​]) ​+​ ​_get_data_buffer​(​name​, ​symbol​, ​uri​, ​fee​, ​creators​,  ​verified​, ​share​) ​+​ ​bytes​([​1​, ​0​])

This sadly does not work. Can you elaborate further @crypt0miester ?

The error is: #3 Metaplex Token Metadata instruction

Program log: Error: BorshIoError Program Metaplex Token Metadata consumed 3816 of 200000 compute units Program returned error: Failed to serialize or deserialize account data: Unknown

you only changed 0 to 1? have you made any other changes? I will have to test the code. currently AFK.

crypt0miester avatar Mar 01 '22 10:03 crypt0miester

The

Like this?

​_data​ ​=​ ​bytes​([​1​]) ​+​ ​_get_data_buffer​(​name​, ​symbol​, ​uri​, ​fee​, ​creators​,  ​verified​, ​share​) ​+​ ​bytes​([​1​, ​0​])

This sadly does not work. Can you elaborate further @crypt0miester ? The error is: #3 Metaplex Token Metadata instruction

Program log: Error: BorshIoError Program Metaplex Token Metadata consumed 3816 of 200000 compute units Program returned error: Failed to serialize or deserialize account data: Unknown

you only changed 0 to 1? have you made any other changes? I will have to test the code. currently AFK.

I only change 0 to 1. No other changes.

JeffryCA avatar Mar 01 '22 10:03 JeffryCA

The

Like this?

​_data​ ​=​ ​bytes​([​1​]) ​+​ ​_get_data_buffer​(​name​, ​symbol​, ​uri​, ​fee​, ​creators​,  ​verified​, ​share​) ​+​ ​bytes​([​1​, ​0​])

This sadly does not work. Can you elaborate further @crypt0miester ? The error is: #3 Metaplex Token Metadata instruction

Program log: Error: BorshIoError Program Metaplex Token Metadata consumed 3816 of 200000 compute units Program returned error: Failed to serialize or deserialize account data: Unknown

you only changed 0 to 1? have you made any other changes? I will have to test the code. currently AFK.

I only change 0 to 1. No other changes.

send me the transaction id

crypt0miester avatar Mar 01 '22 10:03 crypt0miester

The

Like this?

​_data​ ​=​ ​bytes​([​1​]) ​+​ ​_get_data_buffer​(​name​, ​symbol​, ​uri​, ​fee​, ​creators​,  ​verified​, ​share​) ​+​ ​bytes​([​1​, ​0​])

This sadly does not work. Can you elaborate further @crypt0miester ? The error is: #3 Metaplex Token Metadata instruction

Program log: Error: BorshIoError Program Metaplex Token Metadata consumed 3816 of 200000 compute units Program returned error: Failed to serialize or deserialize account data: Unknown

you only changed 0 to 1? have you made any other changes? I will have to test the code. currently AFK.

I only change 0 to 1. No other changes.

send me the transaction id

3HWEep4QApqbhb3kZpikEt9H1Gp58f4H4YVPM3BsqM9fDUEKc6GR8B1jt59UwpwKJ8iQxsBAHA7BW593evM5zf2H

JeffryCA avatar Mar 01 '22 10:03 JeffryCA

Any news @crypt0miester? Or any way you can point me to the right docs to try and change the code as well?

JeffryCA avatar Mar 09 '22 12:03 JeffryCA

contact me in discord CryptoMiester#1865

crypt0miester avatar Mar 10 '22 03:03 crypt0miester

https://github.com/crypt0miester/python-api/tree/v1.2

here you go, please test it.

crypt0miester avatar Mar 15 '22 04:03 crypt0miester

https://github.com/crypt0miester/python-api/tree/v1.2

here you go, please test it.

@crypt0miester I fixed some minor bugs to make the "update_primary_sale_happened" function work but the transaction failed.

#1 Metaplex Token Metadata instruction

Program log: Instruction: Update primary sale via token Program log: Error: InvalidAccountData Program Metaplex Token Metadata consumed 1568 of 200000 compute units Program returned error: invalid account data for instruction

https://solscan.io/tx/2aUVQ5zfStewbn1JhFfUDL48NF7U62ABeZi7gjRxxGiTHGr2ymF5EGGE4TZU9kqbsY99cQv6D1Nqvg57R9P7mKVi?cluster=devnet

JeffryCA avatar Apr 01 '22 07:04 JeffryCA

you probably have a wrong account data value in your code. double check

crypt0miester avatar Apr 01 '22 07:04 crypt0miester

I think I was trying to call this before minting but after the creation of the metadata. I now tried after the mint and it worked. I was wondering if I always need the private key of the owner to perform the update?

JeffryCA avatar Apr 01 '22 07:04 JeffryCA

try adding the instruction at the end of the minting.

crypt0miester avatar Apr 01 '22 08:04 crypt0miester

I tried that but I get:

#5 Metaplex Token Metadata instruction

Program log: Instruction: Update primary sale via token Program log: Owner does not match that on the account given Program Metaplex Token Metadata consumed 5831 of 200000 compute units Program returned error: custom program error: 0x2b

code looks like this:

...
create_master_edition_ix = create_master_edition_instruction(
        mint=mint_account,
        update_authority=source_account.public_key,
        mint_authority=source_account.public_key,
        payer=source_account.public_key,
        supply=supply,
)
tx = tx.add(create_master_edition_ix)

# update primary sale happened
update_primary_sale_happened_ix = update_primary_sale_happened_instruction(
    update_authority=source_account.public_key,
    mint_key=mint_account,
    token=associated_token_account,
)
tx = tx.add(update_primary_sale_happened_ix)

JeffryCA avatar Apr 01 '22 09:04 JeffryCA

guess it doesnt work. sorry can't help further.

crypt0miester avatar Apr 01 '22 09:04 crypt0miester