Blockquote
I would like to revoke all Wormhole token delegation permissions. I configured ChatGP and Python code as shown below, but it does not run. Transactions with existing permissions are as follows. Please help quickly.(https://solscan.io/tx/2uUX6Qr32XAfuD6Qm6ZJvBAJGqJmACgGyHoc99XMVU1i9qUB6nhAoucs8ApXVzagLUYVZcD1iGUu6Ab38YrB2eKY)
Blockquote
from solana.rpc.api import Client
from spl.token.client import Token
from solana.transaction import Transaction
from solana.rpc.types import TxOpts
from solders.pubkey import Pubkey
from solders.keypair import Keypair
from solana.rpc.core import RPCException
def revoke_authority(token_client: Token, mint_address: str, account_address: str, key_pair: Keypair):
try:
# 트랜잭션 구성
tx = Transaction()
tx.add(spl_client.transfer(source=account_address, dest=account_address, owner_account=key_pair.public_key(), amount=0)
)
# 트랜잭션 서명
tx.recent_blockhash = token_client.get_recent_blockhash()
tx.sign(key_pair)
# 트랜잭션 전송
result = token_client.conn.send_transaction(tx, opts=TxOpts(skip_confirmation=False, preflight_commitment=None))
print(f"Authority revoked successfully. Transaction ID: {result}")
except RPCException as rpc_error:
print(f"Revoking authority failed: {rpc_error}")
exit(1) # 실패 시 스크립트 종료
# 위의 코드에서 필요한 모든 설정을 수행한 후에 아래와 같이 함수를 호출할 수 있습니다.
mint_address = "ddd"
account_address = "ddd"
privkey = 'ddd'
solana_client = Client("https://api.mainnet-beta.solana.com")
spl_client = Token(conn=solana_client, pubkey=Pubkey.from_string(mint_address),
program_id=Pubkey.from_string("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
payer=Keypair.from_base58_string(privkey))
key_pair = Keypair.from_base58_string(privkey)
revoke_authority(spl_client, mint_address, account_address, key_pair)