Skip to content

Commit

Permalink
Provider -> AnchorProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jul 27, 2022
1 parent 6c2b1f4 commit 61d0677
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import {
} from '@solana/web3.js'
import { withProvider, withWallet, withNetwork } from '../middlewares'
import { TransactionResponse } from '../types'
import { ProgramError, parseIdlErrors, Idl, Program, Provider } from '@project-serum/anchor'
import { ProgramError, parseIdlErrors, Idl, Program, AnchorProvider } from '@project-serum/anchor'
import { SolanaWallet } from '../wallet'
import { logger } from '@chainlink/gauntlet-core/dist/utils'
import { makeTx } from '../../lib/utils'

export default abstract class SolanaCommand extends WriteCommand<TransactionResponse> {
wallet: SolanaWallet
provider: Provider
provider: AnchorProvider
program: Program

abstract execute: () => Promise<Result<TransactionResponse>>
Expand Down Expand Up @@ -139,7 +139,7 @@ export default abstract class SolanaCommand extends WriteCommand<TransactionResp

sendTx = async (tx: Transaction, signers: Keypair[], idl: Idl): Promise<TransactionSignature> => {
try {
return await this.provider.send(tx, signers)
return await this.provider.sendAndConfirm(tx, signers)
} catch (err) {
// Translate IDL error
const idlErrors = parseIdlErrors(idl)
Expand Down
4 changes: 2 additions & 2 deletions gauntlet/packages/gauntlet-solana/src/commands/middlewares.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Middleware, Next } from '@chainlink/gauntlet-core'
import { boolean } from '@chainlink/gauntlet-core/dist/lib/args'
import { assertions, logger } from '@chainlink/gauntlet-core/dist/utils'
import { Provider } from '@project-serum/anchor'
import { AnchorProvider } from '@project-serum/anchor'
import { Connection, Keypair } from '@solana/web3.js'
import { DEFAULT_DERIVATION_PATH } from '../lib/constants'
import SolanaCommand from './internal/solana'
Expand All @@ -18,7 +18,7 @@ export const withProvider: Middleware = (c: SolanaCommand, next: Next) => {
`Invalid NODE_URL (${nodeURL}), please add an http:// or https:// prefix`,
)

c.provider = new Provider(new Connection(nodeURL), c.wallet, {})
c.provider = new AnchorProvider(new Connection(nodeURL), c.wallet, {})
return next()
}

Expand Down
4 changes: 3 additions & 1 deletion gauntlet/packages/gauntlet-solana/src/lib/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const parseTxLog = (parser: EventParser, tx: ParsedTransactionWithMeta | null):
const addToList = (event: Event) => eventList.push(event)

if (tx?.meta?.logMessages) {
parser.parseLogs(tx.meta.logMessages, addToList)
for (const event of parser.parseLogs(tx.meta.logMessages)) {
addToList(event)
}
}

return eventList
Expand Down

0 comments on commit 61d0677

Please sign in to comment.