-
Notifications
You must be signed in to change notification settings - Fork 308
feat(xc_admin): implement set trusted signer instruction proposal for lazer #2253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6c9a24d
export lazer program id
cctdaniel 230f73c
bump
cctdaniel 9d08d79
export storage id
cctdaniel 5e08204
add set-trusted-signer proposal instruction
cctdaniel 288268a
add script to check trusted signer
cctdaniel 5a1231b
Merge branch 'main' into trusted-signer
cctdaniel 71de85d
fix constants
cctdaniel 6edb6b6
use anchor
cctdaniel 9aabfa2
precommit
cctdaniel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
cctdaniel marked this conversation as resolved.
Show resolved
Hide resolved
|
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
| 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); | ||
| }); |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { PublicKey } from "@solana/web3.js"; | ||
|
|
||
| export const LAZER_PROGRAM_ID = new PublicKey( | ||
| "pytd2yyk641x7ak7mkaasSJVXh6YYZnC7wTmtgAyxPt" | ||
| ); | ||
| export const STORAGE_ID = new PublicKey( | ||
| "3rdJbqfnagQ4yx9HXJViD4zc4xpiSqmFsKpPuSCQVyQL" | ||
| ); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export * from "./client.js"; | ||
| export * from "./protocol.js"; | ||
| export * from "./ed25519.js"; | ||
| export * from "./constants.js"; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.