-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multisig command export and execute options (#155)
* multisig command export and execute options * option to provide different signer than default * comments and improvements * proposal check and inspection command * fixes and improvements * Fixed execution signer. Improvements * Local and Ledger wallet support (#167) * added local and ledger wallet support * Commands inherits multiig wallet * refactor and improvements * More IDL wrappings and improvements * Improved logging information * Small improvements on msig commands * updated serum version * Fix object equal comparison * improved size on msig creation * recent blockhash from confirmed block * naming on multisig commands Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>
- Loading branch information
1 parent
d4f1ffa
commit 827c07e
Showing
35 changed files
with
951 additions
and
302 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
44 changes: 44 additions & 0 deletions
44
gauntlet/packages/gauntlet-serum-multisig/src/commands/inspect.ts
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,44 @@ | ||
import { Result } from '@chainlink/gauntlet-core' | ||
import { logger } from '@chainlink/gauntlet-core/dist/utils' | ||
import { SolanaCommand, TransactionResponse } from '@chainlink/gauntlet-solana' | ||
import { PublicKey } from '@solana/web3.js' | ||
import { CONTRACT_LIST, getContract } from '@chainlink/gauntlet-solana-contracts' | ||
|
||
export default class MultisigInspect extends SolanaCommand { | ||
static id = 'multisig:inspect' | ||
static category = CONTRACT_LIST.MULTISIG | ||
|
||
static examples = ['yarn gauntlet-serum-multisig multisig:inspect --network=local --state=MULTISIG_ACCOUNT'] | ||
|
||
constructor(flags, args) { | ||
super(flags, args) | ||
this.requireFlag('state', 'Please provide multisig state address') | ||
} | ||
|
||
execute = async () => { | ||
const multisig = getContract(CONTRACT_LIST.MULTISIG, '') | ||
const program = this.loadProgram(multisig.idl, multisig.programId.toString()) | ||
|
||
const state = new PublicKey(this.flags.state) | ||
const multisigState = await program.account.multisig.fetch(state) | ||
const [multisigSigner] = await PublicKey.findProgramAddress([state.toBuffer()], program.programId) | ||
const threshold = multisigState.threshold | ||
const owners = multisigState.owners | ||
|
||
logger.info(`Multisig Info: | ||
- ProgramID: ${program.programId.toString()} | ||
- Address: ${state.toString()} | ||
- Signer: ${multisigSigner.toString()} | ||
- Threshold: ${threshold.toString()} | ||
- Owners: ${owners}`) | ||
|
||
return { | ||
responses: [ | ||
{ | ||
tx: this.wrapResponse('', state.toString()), | ||
contract: state.toString(), | ||
}, | ||
], | ||
} as Result<TransactionResponse> | ||
} | ||
} |
Oops, something went wrong.