Created
October 26, 2021 07:30
-
-
Save dtmrc/e8d7259d85b286b04e60c17f4232be3d to your computer and use it in GitHub Desktop.
Generates a transaction to modify metadata on an exiled ape (clone a known mythic)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from solana.account import Account | |
from solana.rpc.api import Client | |
from solana.transaction import Transaction | |
from metaplex.transactions import update_metadata_instruction | |
from metaplex.metadata import ( | |
get_metadata, | |
update_metadata_instruction_data | |
) | |
# legit Degen Ape #7468 of the 10k (rank: 1) | |
known_mythic = '5fzi7TauBFdac94hvm8DcTVN7jrCwYmf6PLuT2TJA7oe' | |
# exiled ape Degen Ape #2909 | |
exiled_tok_addr = 'j77yZnHjoUudxcpgteMvPQk84GiqQUPTc8Ekear8ct9' | |
# https://api.mainnet-beta.solana.com | |
NODE_URI = 'https://solana-api.projectserum.com' | |
client = Client(NODE_URI) | |
metadata = get_metadata(client, known_mythic) | |
cloned_metadata = update_metadata_instruction_data( | |
metadata['data']['name'], | |
metadata['data']['symbol'], | |
metadata['data']['uri'], | |
metadata['data']['creators'], | |
metadata['data']['verified'], | |
metadata['data']['share'], | |
) | |
# 64 byte privkey for account that minted an exiled, has update authority | |
# generate this with: solana-keygen recover -o /tmp/minted_exiled.json | |
# (paste in seed phrase at the prompt) | |
fp = open('/tmp/minted_exiled.json') | |
privkey = json.load(fp) | |
fp.close() | |
mint_account = Account(privkey[:32]) | |
update_metadata_ix = update_metadata_instruction( | |
cloned_metadata, | |
mint_account.public_key(), | |
exiled_tok_addr, | |
) | |
tx = Transaction() | |
tx.add(update_metadata_ix) | |
client.send_transaction(tx, mint_account) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment