fix devnet program loading (#1697)

This commit is contained in:
Adrian Brzeziński 2023-06-27 19:23:25 +02:00 committed by GitHub
parent fd326aa166
commit 27bbc97336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 20 deletions

View File

@ -26,6 +26,7 @@ const InstructionProgram = ({
const programAccount = (
await fetchParsedAccountInfoByPubkey(connection.current, programId)
).result
const programInfo = (
await fetchParsedAccountInfoByPubkey(
connection.current,

View File

@ -1070,26 +1070,28 @@ const getHardcodedDevnetPrograms = async (
new PublicKey(id)
)
).result
const programInfo = (
await fetchParsedAccountInfoByPubkey(
connection.current,
new PublicKey(programAccount?.data['parsed']?.info?.programData)
)
).result
const info = programInfo?.data['parsed']?.info
const authority = info.authority
console.log(id, authority)
if (
governancesArray.find(
(x) =>
x.nativeTreasuryAddress.toBase58() === authority ||
x.pubkey.toBase58() === authority
)
) {
accounts.push({
owner: new PublicKey(authority),
programId: new PublicKey(id),
})
const programDataPk = programAccount?.data['parsed']?.info?.programData
if (programDataPk) {
const programInfo = (
await fetchParsedAccountInfoByPubkey(
connection.current,
new PublicKey(programDataPk)
)
).result
const info = programInfo?.data['parsed']?.info
const authority = info.authority
if (
governancesArray.find(
(x) =>
x.nativeTreasuryAddress.toBase58() === authority ||
x.pubkey.toBase58() === authority
)
) {
accounts.push({
owner: new PublicKey(authority),
programId: new PublicKey(id),
})
}
}
}
}