-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xc_admin): implement set trusted signer instruction proposal for…
… lazer (#2253) * export lazer program id * bump * export storage id * add set-trusted-signer proposal instruction * add script to check trusted signer * fix constants * use anchor * precommit
- xc-admin-v0.6.13
- xc-admin-v0.6.12
- xc-admin-v0.6.11
- rust-pyth-lazer-solana-contract-v0.3.0
- rust-pyth-lazer-protocol-v0.6.2
- rust-pyth-lazer-protocol-v0.6.1
- rust-pyth-lazer-protocol-v0.6.0
- rust-pyth-lazer-protocol-v0.5.1
- rust-pyth-lazer-protocol-v0.5.0
- rust-pyth-lazer-protocol-v0.4.2
- rust-pyth-lazer-protocol-v0.4.1
- rust-pyth-lazer-protocol-v0.4.0
- rust-pyth-lazer-protocol-v0.3.3
- rust-pyth-lazer-protocol-v0.3.2
- rust-pyth-lazer-protocol-v0.3.1
- rust-pyth-lazer-client-v0.1.2
- rust-pyth-lazer-client-v0.1.1
- pyth-price-pusher-v9.1.0
- pyth-price-pusher-v9.0.1
- pyth-price-pusher-v9.0.0
- pyth-price-pusher-v8.3.3
- pyth-price-pusher-v8.3.2
- pyth-js-v117
- pyth-js-v116
- pyth-js-v115
- pyth-js-v114
- pyth-js-v113
- pyth-js-v112
- pyth-js-v111
- pyth-js-v110
- pyth-js-v109
- pyth-js-v108
- hermes-v0.8.2
- fortuna-v7.4.4
- fortuna-v7.4.1
- fortuna-v7.4.0
- fortuna-v7.3.0
Showing
9 changed files
with
130 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import * as anchor from "@coral-xyz/anchor"; | ||
import { PythLazerSolanaContract } from "../target/types/pyth_lazer_solana_contract"; | ||
import * as pythLazerSolanaContractIdl from "../target/idl/pyth_lazer_solana_contract.json"; | ||
import yargs from "yargs/yargs"; | ||
import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet"; | ||
|
||
const parser = yargs(process.argv.slice(2)).options({ | ||
url: { | ||
type: "string", | ||
demandOption: true, | ||
desc: "RPC URL to use", | ||
}, | ||
"storage-id": { | ||
type: "string", | ||
demandOption: true, | ||
desc: "Storage account ID to check", | ||
}, | ||
}); | ||
|
||
async function main() { | ||
const argv = await parser.argv; | ||
|
||
// Setup anchor provider | ||
const connection = new anchor.web3.Connection(argv.url); | ||
const provider = new anchor.AnchorProvider( | ||
connection, | ||
new NodeWallet(anchor.web3.Keypair.generate()), // Dummy wallet since we're only reading | ||
{ commitment: "confirmed" } | ||
); | ||
anchor.setProvider(provider); | ||
|
||
const program: anchor.Program<PythLazerSolanaContract> = new anchor.Program( | ||
pythLazerSolanaContractIdl as PythLazerSolanaContract, | ||
provider | ||
); | ||
|
||
// Fetch and decode storage account | ||
const storageId = new anchor.web3.PublicKey(argv["storage-id"]); | ||
const storage = await program.account.storage.fetch(storageId); | ||
|
||
// Print storage info | ||
console.log("Storage Account Info:"); | ||
console.log("--------------------"); | ||
console.log("Top Authority:", storage.topAuthority.toBase58()); | ||
console.log("Treasury:", storage.treasury.toBase58()); | ||
console.log("\nTrusted Signers:"); | ||
console.log("----------------"); | ||
|
||
for (const signer of storage.trustedSigners) { | ||
if (signer.pubkey.equals(anchor.web3.PublicKey.default)) continue; | ||
console.log(`\nPublic Key: ${signer.pubkey.toBase58()}`); | ||
console.log( | ||
`Expires At: ${new Date( | ||
signer.expiresAt.toNumber() * 1000 | ||
).toISOString()}` | ||
); | ||
console.log( | ||
`Active: ${ | ||
signer.expiresAt.toNumber() > Date.now() / 1000 ? "Yes" : "No" | ||
}` | ||
); | ||
} | ||
} | ||
|
||
main().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.