Skip to content

Commit

Permalink
Changed set writer input interface
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoAD committed Jan 12, 2022
1 parent 3bf7806 commit 261f095
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,28 @@ import { getRDD } from '../../../lib/rdd'

type Input = {
transmissions: string
store: string
}

export default class SetWriter extends SolanaCommand {
static id = 'store:set_writer'
static category = CONTRACT_LIST.STORE

static examples = [
'yarn gauntlet store:set_writer --network=devnet --state=EPRYwrb1Dwi8VT5SutS4vYNdF8HqvE7QwvqeCCwHdVLC',
'yarn gauntlet store:set_writer --network=devnet --state=EPRYwrb1Dwi8VT5SutS4vYNdF8HqvE7QwvqeCCwHdVLC --ocrState=EPRYwrb1Dwi8VT5SutS4vYNdF8HqvE7QwvqeCCwHdVLC',
]

constructor(flags, args) {
super(flags, args)

this.require(!!this.flags.state, 'Please provide flags with "state"')
this.require(!!this.flags.ocrState, 'Please provide flags with "ocrState"')
}

makeInput = (userInput): Input => {
if (userInput) return userInput as Input
const rdd = getRDD(this.flags.rdd)
const agg = rdd[this.flags.state]
const agg = rdd[this.flags.ocrState]
return {
store: agg.storeAccount,
transmissions: agg.transmissionsAccount,
}
}
Expand All @@ -45,9 +44,9 @@ export default class SetWriter extends SolanaCommand {
const input = this.makeInput(this.flags.input)
const owner = this.wallet.payer

const ocr2State = new PublicKey(this.flags.state)
const storeState = new PublicKey(this.flags.state)
const ocr2State = new PublicKey(this.flags.ocrState)
const feedState = new PublicKey(input.transmissions)
const storeState = new PublicKey(input.store)

const [storeAuthority, _storeNonce] = await PublicKey.findProgramAddress(
[Buffer.from(utils.bytes.utf8.encode('store')), ocr2State.toBuffer()],
Expand Down

0 comments on commit 261f095

Please sign in to comment.