Skip to content

Commit

Permalink
yarn formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sdrug committed Nov 13, 2023
1 parent 3ad94b8 commit 5934af8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@ import { PublicKey } from '@solana/web3.js'
import { CONTRACT_LIST, getContract } from '../../../lib/contracts'

type Input = {
transmitter: string
transmitter: string
}

type ContractInput = {
transmitter: string
proposedPayee: PublicKey
transmitter: string
proposedPayee: PublicKey
}

export default class AcceptPayeeship extends SolanaCommand {
static id = 'ocr2:accept_payeeship'
static category = CONTRACT_LIST.OCR_2
static examples = [
'yarn gauntlet ocr2:accept_payeeship --network=<NETWORK> --transmitter=<TRANSMITTER> <CONTRACT>',
]
static examples = ['yarn gauntlet ocr2:accept_payeeship --network=<NETWORK> --transmitter=<TRANSMITTER> <CONTRACT>']

input: Input
contractInput: ContractInput
Expand All @@ -27,11 +25,11 @@ export default class AcceptPayeeship extends SolanaCommand {
if (userInput) return userInput as Input

if (!this.flags.transmitter) {
throw Error('Please specify a valid transmitter (--transmitter))')
throw Error('Please specify a valid transmitter (--transmitter))')
}

return {
transmitter: this.flags.transmitter,
transmitter: this.flags.transmitter,
}
}

Expand All @@ -42,12 +40,12 @@ export default class AcceptPayeeship extends SolanaCommand {
const oracle = contractOracles.find(({ transmitter }) => transmitter.toString() == input.transmitter)

if (!oracle) {
throw Error(`No oracle found with the transmitter id ${input.transmitter}`)
throw Error(`No oracle found with the transmitter id ${input.transmitter}`)
}

return {
transmitter: input.transmitter,
proposedPayee: oracle.proposedPayee,
transmitter: input.transmitter,
proposedPayee: oracle.proposedPayee,
}
}

Expand All @@ -66,12 +64,12 @@ export default class AcceptPayeeship extends SolanaCommand {

makeRawTransaction = async (signer: PublicKey) => {
const data = this.program.instruction.acceptPayeeship({
accounts: {
state: new PublicKey(this.args[0]),
authority: signer,
transmitter: this.contractInput.transmitter,
proposedPayee: this.contractInput.proposedPayee,
},
accounts: {
state: new PublicKey(this.args[0]),
authority: signer,
transmitter: this.contractInput.transmitter,
proposedPayee: this.contractInput.proposedPayee,
},
})

return [data]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { PublicKey } from '@solana/web3.js'
import { CONTRACT_LIST, getContract } from '../../../lib/contracts'

type Input = {
transmitter: string
proposedPayee: string
transmitter: string
proposedPayee: string
}

type ContractInput = {
transmitter: string
payee: PublicKey
proposedPayee: PublicKey
transmitter: string
payee: PublicKey
proposedPayee: PublicKey
}

export default class TransferPayeeship extends SolanaCommand {
Expand All @@ -29,16 +29,16 @@ export default class TransferPayeeship extends SolanaCommand {
if (userInput) return userInput as Input

if (!this.flags.transmitter) {
throw Error('Please specify a valid transmitter (--transmitter))')
throw Error('Please specify a valid transmitter (--transmitter))')
}

if (!this.flags.proposedPayee) {
throw Error('Please specify a valid proposed payee (--proposedPayee)')
throw Error('Please specify a valid proposed payee (--proposedPayee)')
}

return {
transmitter: this.flags.transmitter,
proposedPayee: this.flags.proposedPayee,
transmitter: this.flags.transmitter,
proposedPayee: this.flags.proposedPayee,
}
}

Expand All @@ -49,13 +49,13 @@ export default class TransferPayeeship extends SolanaCommand {
const oracle = contractOracles.find(({ transmitter }) => transmitter.toString() == input.transmitter)

if (!oracle) {
throw Error(`No oracle found with the transmitter id ${input.transmitter}`)
throw Error(`No oracle found with the transmitter id ${input.transmitter}`)
}

return {
transmitter: input.transmitter,
payee: new PublicKey(oracle.payee),
proposedPayee: new PublicKey(input.proposedPayee),
transmitter: input.transmitter,
payee: new PublicKey(oracle.payee),
proposedPayee: new PublicKey(input.proposedPayee),
}
}

Expand All @@ -74,20 +74,22 @@ export default class TransferPayeeship extends SolanaCommand {

makeRawTransaction = async (signer: PublicKey) => {
const data = this.program.instruction.transferPayeeship({
accounts: {
state: new PublicKey(this.args[0]),
authority: signer,
transmitter: this.contractInput.transmitter,
payee: this.contractInput.payee,
proposedPayee: this.contractInput.proposedPayee,
},
accounts: {
state: new PublicKey(this.args[0]),
authority: signer,
transmitter: this.contractInput.transmitter,
payee: this.contractInput.payee,
proposedPayee: this.contractInput.proposedPayee,
},
})

return [data]
}

beforeExecute = async () => {
logger.loading(`Transferring payeeship for transmitter ${this.contractInput.transmitter}: ${this.contractInput.payee} -> ${this.contractInput.proposedPayee}`)
logger.loading(
`Transferring payeeship for transmitter ${this.contractInput.transmitter}: ${this.contractInput.payee} -> ${this.contractInput.proposedPayee}`,
)
await prompt(`Continue?`)
}

Expand Down

0 comments on commit 5934af8

Please sign in to comment.