@drift-labs/sdk 0.1.36-master.3 → 0.1.36-master.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/admin.js CHANGED
@@ -45,7 +45,7 @@ const trade_1 = require("./math/trade");
45
45
  const amm_1 = require("./math/amm");
46
46
  const clearingHouse_2 = require("./factory/clearingHouse");
47
47
  class Admin extends clearingHouse_1.ClearingHouse {
48
- static from(connection, wallet, clearingHouseProgramId, opts = anchor_1.Provider.defaultOptions()) {
48
+ static from(connection, wallet, clearingHouseProgramId, opts = anchor_1.AnchorProvider.defaultOptions()) {
49
49
  const config = (0, clearingHouse_2.getWebSocketClearingHouseConfig)(connection, wallet, clearingHouseProgramId, opts);
50
50
  return (0, clearingHouse_2.getAdmin)(config);
51
51
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="bn.js" />
3
- import { BN, Program, Provider } from '@project-serum/anchor';
3
+ import { AnchorProvider, BN, Program } from '@project-serum/anchor';
4
4
  import { MarketsAccount, StateAccount, DepositHistoryAccount, FundingPaymentHistoryAccount, FundingRateHistoryAccount, IWallet, LiquidationHistoryAccount, PositionDirection, TradeHistoryAccount, UserAccount, Market, OrderHistoryAccount, OrderStateAccount, OrderParams, Order, ExtendedCurveHistoryAccount, UserPositionsAccount } from './types';
5
5
  import { Connection, PublicKey, TransactionSignature, Keypair, ConfirmOptions, TransactionInstruction } from '@solana/web3.js';
6
6
  import { MockUSDCFaucet } from './mockUSDCFaucet';
@@ -19,7 +19,7 @@ export declare class ClearingHouse {
19
19
  connection: Connection;
20
20
  wallet: IWallet;
21
21
  program: Program;
22
- provider: Provider;
22
+ provider: AnchorProvider;
23
23
  opts?: ConfirmOptions;
24
24
  accountSubscriber: ClearingHouseAccountSubscriber;
25
25
  eventEmitter: StrictEventEmitter<EventEmitter, ClearingHouseAccountEvents>;
@@ -77,7 +77,7 @@ class ClearingHouse {
77
77
  * @param opts
78
78
  * @returns
79
79
  */
80
- static from(connection, wallet, clearingHouseProgramId, opts = anchor_1.Provider.defaultOptions()) {
80
+ static from(connection, wallet, clearingHouseProgramId, opts = anchor_1.AnchorProvider.defaultOptions()) {
81
81
  const config = (0, clearingHouse_1.getWebSocketClearingHouseConfig)(connection, wallet, clearingHouseProgramId, opts);
82
82
  return (0, clearingHouse_1.getClearingHouse)(config);
83
83
  }
@@ -185,7 +185,7 @@ class ClearingHouse {
185
185
  * @param newWallet
186
186
  */
187
187
  updateWallet(newWallet) {
188
- const newProvider = new anchor_1.Provider(this.connection, newWallet, this.opts);
188
+ const newProvider = new anchor_1.AnchorProvider(this.connection, newWallet, this.opts);
189
189
  const newProgram = new anchor_1.Program(clearing_house_json_1.default, this.program.programId, newProvider);
190
190
  // Update provider for txSender with new wallet details
191
191
  this.txSender.provider = newProvider;
@@ -352,7 +352,7 @@ class ClearingHouse {
352
352
  .add(initializeUserAccountIx)
353
353
  .add(initializeUserOrdersAccountIx)
354
354
  .add(depositCollateralIx);
355
- const txSig = yield this.program.provider.send(tx, [userPositionsAccount]);
355
+ const txSig = yield this.txSender.send(tx, [userPositionsAccount]);
356
356
  return [txSig, userAccountPublicKey];
357
357
  });
358
358
  }
@@ -367,7 +367,9 @@ class ClearingHouse {
367
367
  .add(initializeUserAccountIx)
368
368
  .add(initializeUserOrdersAccountIx)
369
369
  .add(depositCollateralIx);
370
- const txSig = yield this.program.provider.send(tx, [userPositionsAccount]);
370
+ const txSig = yield this.program.provider.sendAndConfirm(tx, [
371
+ userPositionsAccount,
372
+ ]);
371
373
  return [txSig, userAccountPublicKey];
372
374
  });
373
375
  }
@@ -30,7 +30,7 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
30
30
  const rpcAddress = process.env.RPC_ADDRESS; // can use: https://api.devnet.solana.com for devnet; https://api.mainnet-beta.solana.com for mainnet;
31
31
  const connection = new web3_js_1.Connection(rpcAddress);
32
32
  // Set up the Provider
33
- const provider = new anchor_1.Provider(connection, wallet, anchor_1.Provider.defaultOptions());
33
+ const provider = new anchor_1.AnchorProvider(connection, wallet, anchor_1.AnchorProvider.defaultOptions());
34
34
  // Check SOL Balance
35
35
  const lamportsBalance = yield connection.getBalance(wallet.publicKey);
36
36
  console.log('SOL balance:', lamportsBalance / Math.pow(10, 9));
@@ -12,7 +12,7 @@ const defaultTxSender_1 = require("../tx/defaultTxSender");
12
12
  const pollingClearingHouseAccountSubscriber_1 = require("../accounts/pollingClearingHouseAccountSubscriber");
13
13
  const admin_1 = require("../admin");
14
14
  const retryTxSender_1 = require("../tx/retryTxSender");
15
- function getWebSocketClearingHouseConfig(connection, wallet, programID, opts = anchor_1.Provider.defaultOptions(), txSenderConfig) {
15
+ function getWebSocketClearingHouseConfig(connection, wallet, programID, opts = anchor_1.AnchorProvider.defaultOptions(), txSenderConfig) {
16
16
  return {
17
17
  type: 'websocket',
18
18
  connection,
@@ -23,7 +23,7 @@ function getWebSocketClearingHouseConfig(connection, wallet, programID, opts = a
23
23
  };
24
24
  }
25
25
  exports.getWebSocketClearingHouseConfig = getWebSocketClearingHouseConfig;
26
- function getPollingClearingHouseConfig(connection, wallet, programID, accountLoader, opts = anchor_1.Provider.defaultOptions(), txSenderConfig) {
26
+ function getPollingClearingHouseConfig(connection, wallet, programID, accountLoader, opts = anchor_1.AnchorProvider.defaultOptions(), txSenderConfig) {
27
27
  return {
28
28
  type: 'polling',
29
29
  connection,
@@ -37,7 +37,7 @@ function getPollingClearingHouseConfig(connection, wallet, programID, accountLoa
37
37
  exports.getPollingClearingHouseConfig = getPollingClearingHouseConfig;
38
38
  function getClearingHouse(config) {
39
39
  var _a;
40
- const provider = new anchor_1.Provider(config.connection, config.wallet, config.opts);
40
+ const provider = new anchor_1.AnchorProvider(config.connection, config.wallet, config.opts);
41
41
  const program = new anchor_1.Program(clearing_house_json_1.default, config.programID, provider);
42
42
  let accountSubscriber;
43
43
  if (config.type === 'websocket') {
@@ -59,7 +59,7 @@ function getClearingHouse(config) {
59
59
  exports.getClearingHouse = getClearingHouse;
60
60
  function getAdmin(config) {
61
61
  var _a;
62
- const provider = new anchor_1.Provider(config.connection, config.wallet, config.opts);
62
+ const provider = new anchor_1.AnchorProvider(config.connection, config.wallet, config.opts);
63
63
  const program = new anchor_1.Program(clearing_house_json_1.default, config.programID, provider);
64
64
  let accountSubscriber;
65
65
  if (config.type === 'websocket') {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="bn.js" />
2
2
  import * as anchor from '@project-serum/anchor';
3
- import { Program, Provider } from '@project-serum/anchor';
3
+ import { AnchorProvider, Program } from '@project-serum/anchor';
4
4
  import { AccountInfo } from '@solana/spl-token';
5
5
  import { ConfirmOptions, Connection, PublicKey, TransactionInstruction, TransactionSignature } from '@solana/web3.js';
6
6
  import { BN } from '.';
@@ -9,7 +9,7 @@ export declare class MockUSDCFaucet {
9
9
  connection: Connection;
10
10
  wallet: IWallet;
11
11
  program: Program;
12
- provider: Provider;
12
+ provider: AnchorProvider;
13
13
  opts?: ConfirmOptions;
14
14
  constructor(connection: Connection, wallet: IWallet, programId: PublicKey, opts?: ConfirmOptions);
15
15
  getMockUSDCFaucetStatePublicKeyAndNonce(): Promise<[
@@ -45,8 +45,8 @@ class MockUSDCFaucet {
45
45
  constructor(connection, wallet, programId, opts) {
46
46
  this.connection = connection;
47
47
  this.wallet = wallet;
48
- this.opts = opts || anchor_1.Provider.defaultOptions();
49
- const provider = new anchor_1.Provider(connection, wallet, this.opts);
48
+ this.opts = opts || anchor_1.AnchorProvider.defaultOptions();
49
+ const provider = new anchor_1.AnchorProvider(connection, wallet, this.opts);
50
50
  this.provider = provider;
51
51
  this.program = new anchor_1.Program(mock_usdc_faucet_json_1.default, programId, provider);
52
52
  }
@@ -117,7 +117,7 @@ class MockUSDCFaucet {
117
117
  return __awaiter(this, void 0, void 0, function* () {
118
118
  const [associatedTokenPublicKey, createAssociatedAccountIx, mintToTx] = yield this.createAssociatedTokenAccountAndMintToInstructions(userPublicKey, amount);
119
119
  const tx = new web3_js_1.Transaction().add(createAssociatedAccountIx).add(mintToTx);
120
- const txSig = yield this.program.provider.send(tx, [], this.opts);
120
+ const txSig = yield this.program.provider.sendAndConfirm(tx, [], this.opts);
121
121
  return [associatedTokenPublicKey, txSig];
122
122
  });
123
123
  }
@@ -64,7 +64,7 @@ function getSwitchboardProgram(env, connection) {
64
64
  const DEFAULT_KEYPAIR = web3_js_1.Keypair.fromSeed(new Uint8Array(32).fill(1));
65
65
  const programId = (0, switchboard_v2_1.getSwitchboardPid)(env);
66
66
  const wallet = new wallet_1.Wallet(DEFAULT_KEYPAIR);
67
- const provider = new anchor_1.Provider(connection, wallet, {});
67
+ const provider = new anchor_1.AnchorProvider(connection, wallet, {});
68
68
  return new anchor_1.Program(switchboard_v2_json_1.default, programId, provider);
69
69
  });
70
70
  }
@@ -1,8 +1,8 @@
1
1
  import { TxSender } from './types';
2
2
  import { ConfirmOptions, Signer, Transaction, TransactionSignature } from '@solana/web3.js';
3
- import { Provider } from '@project-serum/anchor';
3
+ import { AnchorProvider } from '@project-serum/anchor';
4
4
  export declare class DefaultTxSender implements TxSender {
5
- provider: Provider;
6
- constructor(provider: Provider);
5
+ provider: AnchorProvider;
6
+ constructor(provider: AnchorProvider);
7
7
  send(tx: Transaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions): Promise<TransactionSignature>;
8
8
  }
@@ -6,7 +6,7 @@ class DefaultTxSender {
6
6
  this.provider = provider;
7
7
  }
8
8
  send(tx, additionalSigners, opts) {
9
- return this.provider.send(tx, additionalSigners, opts);
9
+ return this.provider.sendAndConfirm(tx, additionalSigners, opts);
10
10
  }
11
11
  }
12
12
  exports.DefaultTxSender = DefaultTxSender;
@@ -1,16 +1,16 @@
1
1
  /// <reference types="node" />
2
2
  import { TxSender } from './types';
3
3
  import { Commitment, ConfirmOptions, RpcResponseAndContext, Signer, SignatureResult, Transaction, TransactionSignature, Connection } from '@solana/web3.js';
4
- import { Provider } from '@project-serum/anchor';
4
+ import { AnchorProvider } from '@project-serum/anchor';
5
5
  declare type ResolveReference = {
6
6
  resolve?: () => void;
7
7
  };
8
8
  export declare class RetryTxSender implements TxSender {
9
- provider: Provider;
9
+ provider: AnchorProvider;
10
10
  timeout: number;
11
11
  retrySleep: number;
12
12
  additionalConnections: Connection[];
13
- constructor(provider: Provider, timeout?: number, retrySleep?: number, additionalConnections?: Connection[]);
13
+ constructor(provider: AnchorProvider, timeout?: number, retrySleep?: number, additionalConnections?: Connection[]);
14
14
  send(tx: Transaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions): Promise<TransactionSignature>;
15
15
  prepareTx(tx: Transaction, additionalSigners: Array<Signer>, opts: ConfirmOptions): Promise<Transaction>;
16
16
  confirmTransaction(signature: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "0.1.36-master.3",
3
+ "version": "0.1.36-master.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@project-serum/anchor": "0.19.1-beta.1",
31
+ "@project-serum/anchor": "0.24.2",
32
32
  "@pythnetwork/client": "^2.5.1",
33
33
  "@solana/spl-token": "^0.1.6",
34
34
  "@solana/web3.js": "^1.22.0",
@@ -1,5 +1,5 @@
1
1
  import { AccountData, AccountSubscriber } from './types';
2
- import { Program } from '@project-serum/anchor';
2
+ import { AnchorProvider, Program } from '@project-serum/anchor';
3
3
  import { AccountInfo, Context, PublicKey } from '@solana/web3.js';
4
4
  import { capitalize } from './utils';
5
5
  import * as Buffer from 'buffer';
@@ -36,7 +36,7 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
36
36
  (accountInfo, context) => {
37
37
  this.handleRpcResponse(context, accountInfo);
38
38
  },
39
- this.program.provider.opts.commitment
39
+ (this.program.provider as AnchorProvider).opts.commitment
40
40
  );
41
41
  }
42
42
 
@@ -44,7 +44,7 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
44
44
  const rpcResponse =
45
45
  await this.program.provider.connection.getAccountInfoAndContext(
46
46
  this.accountPublicKey,
47
- this.program.provider.opts.commitment
47
+ (this.program.provider as AnchorProvider).opts.commitment
48
48
  );
49
49
  this.handleRpcResponse(rpcResponse.context, rpcResponse?.value);
50
50
  }
package/src/admin.ts CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  OracleSource,
13
13
  OrderFillerRewardStructure,
14
14
  } from './types';
15
- import { BN, Provider } from '@project-serum/anchor';
15
+ import { BN, AnchorProvider } from '@project-serum/anchor';
16
16
  import * as anchor from '@project-serum/anchor';
17
17
  import {
18
18
  getClearingHouseStateAccountPublicKey,
@@ -34,7 +34,7 @@ export class Admin extends ClearingHouse {
34
34
  connection: Connection,
35
35
  wallet: IWallet,
36
36
  clearingHouseProgramId: PublicKey,
37
- opts: ConfirmOptions = Provider.defaultOptions()
37
+ opts: ConfirmOptions = AnchorProvider.defaultOptions()
38
38
  ): Admin {
39
39
  const config = getWebSocketClearingHouseConfig(
40
40
  connection,
@@ -1,4 +1,4 @@
1
- import { BN, Idl, Program, Provider } from '@project-serum/anchor';
1
+ import { AnchorProvider, BN, Idl, Program } from '@project-serum/anchor';
2
2
  import {
3
3
  ASSOCIATED_TOKEN_PROGRAM_ID,
4
4
  Token,
@@ -71,7 +71,7 @@ export class ClearingHouse {
71
71
  connection: Connection;
72
72
  wallet: IWallet;
73
73
  public program: Program;
74
- provider: Provider;
74
+ provider: AnchorProvider;
75
75
  opts?: ConfirmOptions;
76
76
  accountSubscriber: ClearingHouseAccountSubscriber;
77
77
  eventEmitter: StrictEventEmitter<EventEmitter, ClearingHouseAccountEvents>;
@@ -98,7 +98,7 @@ export class ClearingHouse {
98
98
  connection: Connection,
99
99
  wallet: IWallet,
100
100
  clearingHouseProgramId: PublicKey,
101
- opts: ConfirmOptions = Provider.defaultOptions()
101
+ opts: ConfirmOptions = AnchorProvider.defaultOptions()
102
102
  ): ClearingHouse {
103
103
  const config = getWebSocketClearingHouseConfig(
104
104
  connection,
@@ -245,7 +245,11 @@ export class ClearingHouse {
245
245
  * @param newWallet
246
246
  */
247
247
  public updateWallet(newWallet: IWallet): void {
248
- const newProvider = new Provider(this.connection, newWallet, this.opts);
248
+ const newProvider = new AnchorProvider(
249
+ this.connection,
250
+ newWallet,
251
+ this.opts
252
+ );
249
253
  const newProgram = new Program(
250
254
  clearingHouseIDL as Idl,
251
255
  this.program.programId,
@@ -503,7 +507,7 @@ export class ClearingHouse {
503
507
  .add(initializeUserOrdersAccountIx)
504
508
  .add(depositCollateralIx);
505
509
 
506
- const txSig = await this.program.provider.send(tx, [userPositionsAccount]);
510
+ const txSig = await this.txSender.send(tx, [userPositionsAccount]);
507
511
 
508
512
  return [txSig, userAccountPublicKey];
509
513
  }
@@ -538,7 +542,9 @@ export class ClearingHouse {
538
542
  .add(initializeUserOrdersAccountIx)
539
543
  .add(depositCollateralIx);
540
544
 
541
- const txSig = await this.program.provider.send(tx, [userPositionsAccount]);
545
+ const txSig = await this.program.provider.sendAndConfirm(tx, [
546
+ userPositionsAccount,
547
+ ]);
542
548
 
543
549
  return [txSig, userAccountPublicKey];
544
550
  }
@@ -1,4 +1,4 @@
1
- import { BN, Provider } from '@project-serum/anchor';
1
+ import { AnchorProvider, BN } from '@project-serum/anchor';
2
2
  import { Wallet } from '..';
3
3
  import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';
4
4
  import { Connection, Keypair, PublicKey } from '@solana/web3.js';
@@ -43,7 +43,11 @@ const main = async () => {
43
43
  const connection = new Connection(rpcAddress);
44
44
 
45
45
  // Set up the Provider
46
- const provider = new Provider(connection, wallet, Provider.defaultOptions());
46
+ const provider = new AnchorProvider(
47
+ connection,
48
+ wallet,
49
+ AnchorProvider.defaultOptions()
50
+ );
47
51
 
48
52
  // Check SOL Balance
49
53
  const lamportsBalance = await connection.getBalance(wallet.publicKey);
@@ -2,7 +2,7 @@ import { ConfirmOptions, Connection, PublicKey } from '@solana/web3.js';
2
2
  import { IWallet } from '../types';
3
3
  import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
4
4
  import { TxSender } from '../tx/types';
5
- import { Idl, Program, Provider } from '@project-serum/anchor';
5
+ import { AnchorProvider, Idl, Program } from '@project-serum/anchor';
6
6
  import { ClearingHouse } from '../clearingHouse';
7
7
  import clearingHouseIDL from '../idl/clearing_house.json';
8
8
  import { WebSocketClearingHouseAccountSubscriber } from '../accounts/webSocketClearingHouseAccountSubscriber';
@@ -53,7 +53,7 @@ export function getWebSocketClearingHouseConfig(
53
53
  connection: Connection,
54
54
  wallet: IWallet,
55
55
  programID: PublicKey,
56
- opts: ConfirmOptions = Provider.defaultOptions(),
56
+ opts: ConfirmOptions = AnchorProvider.defaultOptions(),
57
57
  txSenderConfig?: TxSenderConfig
58
58
  ): WebSocketClearingHouseConfiguration {
59
59
  return {
@@ -71,7 +71,7 @@ export function getPollingClearingHouseConfig(
71
71
  wallet: IWallet,
72
72
  programID: PublicKey,
73
73
  accountLoader: BulkAccountLoader,
74
- opts: ConfirmOptions = Provider.defaultOptions(),
74
+ opts: ConfirmOptions = AnchorProvider.defaultOptions(),
75
75
  txSenderConfig?: TxSenderConfig
76
76
  ): PollingClearingHouseConfiguration {
77
77
  return {
@@ -86,7 +86,11 @@ export function getPollingClearingHouseConfig(
86
86
  }
87
87
 
88
88
  export function getClearingHouse(config: ClearingHouseConfig): ClearingHouse {
89
- const provider = new Provider(config.connection, config.wallet, config.opts);
89
+ const provider = new AnchorProvider(
90
+ config.connection,
91
+ config.wallet,
92
+ config.opts
93
+ );
90
94
  const program = new Program(
91
95
  clearingHouseIDL as Idl,
92
96
  config.programID,
@@ -126,7 +130,11 @@ export function getClearingHouse(config: ClearingHouseConfig): ClearingHouse {
126
130
  }
127
131
 
128
132
  export function getAdmin(config: ClearingHouseConfig): Admin {
129
- const provider = new Provider(config.connection, config.wallet, config.opts);
133
+ const provider = new AnchorProvider(
134
+ config.connection,
135
+ config.wallet,
136
+ config.opts
137
+ );
130
138
  const program = new Program(
131
139
  clearingHouseIDL as Idl,
132
140
  config.programID,
@@ -1,5 +1,5 @@
1
1
  import * as anchor from '@project-serum/anchor';
2
- import { Idl, Program, Provider } from '@project-serum/anchor';
2
+ import { AnchorProvider, Idl, Program } from '@project-serum/anchor';
3
3
  import {
4
4
  AccountInfo,
5
5
  ASSOCIATED_TOKEN_PROGRAM_ID,
@@ -25,7 +25,7 @@ export class MockUSDCFaucet {
25
25
  connection: Connection;
26
26
  wallet: IWallet;
27
27
  public program: Program;
28
- provider: Provider;
28
+ provider: AnchorProvider;
29
29
  opts?: ConfirmOptions;
30
30
 
31
31
  public constructor(
@@ -36,8 +36,8 @@ export class MockUSDCFaucet {
36
36
  ) {
37
37
  this.connection = connection;
38
38
  this.wallet = wallet;
39
- this.opts = opts || Provider.defaultOptions();
40
- const provider = new Provider(connection, wallet, this.opts);
39
+ this.opts = opts || AnchorProvider.defaultOptions();
40
+ const provider = new AnchorProvider(connection, wallet, this.opts);
41
41
  this.provider = provider;
42
42
  this.program = new Program(mockUSDCFaucetIDL as Idl, programId, provider);
43
43
  }
@@ -140,7 +140,7 @@ export class MockUSDCFaucet {
140
140
  amount
141
141
  );
142
142
  const tx = new Transaction().add(createAssociatedAccountIx).add(mintToTx);
143
- const txSig = await this.program.provider.send(tx, [], this.opts);
143
+ const txSig = await this.program.provider.sendAndConfirm(tx, [], this.opts);
144
144
  return [associatedTokenPublicKey, txSig];
145
145
  }
146
146
 
@@ -4,7 +4,7 @@ import {
4
4
  } from '@switchboard-xyz/switchboard-v2';
5
5
  import { Connection, Keypair, PublicKey } from '@solana/web3.js';
6
6
  import { DriftEnv } from '../config';
7
- import { BN, Provider, Program, Idl } from '@project-serum/anchor';
7
+ import { BN, Program, Idl, AnchorProvider } from '@project-serum/anchor';
8
8
  import { MARK_PRICE_PRECISION, TEN } from '../constants/numericConstants';
9
9
  import { OracleClient, OraclePriceData } from './types';
10
10
  import { Wallet } from '../wallet';
@@ -74,7 +74,7 @@ async function getSwitchboardProgram(
74
74
  const DEFAULT_KEYPAIR = Keypair.fromSeed(new Uint8Array(32).fill(1));
75
75
  const programId = getSwitchboardPid(env);
76
76
  const wallet = new Wallet(DEFAULT_KEYPAIR);
77
- const provider = new Provider(connection, wallet, {});
77
+ const provider = new AnchorProvider(connection, wallet, {});
78
78
 
79
79
  return new Program(switchboardV2Idl as Idl, programId, provider);
80
80
  }
@@ -5,12 +5,12 @@ import {
5
5
  Transaction,
6
6
  TransactionSignature,
7
7
  } from '@solana/web3.js';
8
- import { Provider } from '@project-serum/anchor';
8
+ import { AnchorProvider } from '@project-serum/anchor';
9
9
 
10
10
  export class DefaultTxSender implements TxSender {
11
- provider: Provider;
11
+ provider: AnchorProvider;
12
12
 
13
- public constructor(provider: Provider) {
13
+ public constructor(provider: AnchorProvider) {
14
14
  this.provider = provider;
15
15
  }
16
16
 
@@ -19,6 +19,6 @@ export class DefaultTxSender implements TxSender {
19
19
  additionalSigners?: Array<Signer>,
20
20
  opts?: ConfirmOptions
21
21
  ): Promise<TransactionSignature> {
22
- return this.provider.send(tx, additionalSigners, opts);
22
+ return this.provider.sendAndConfirm(tx, additionalSigners, opts);
23
23
  }
24
24
  }
@@ -10,7 +10,7 @@ import {
10
10
  TransactionSignature,
11
11
  Connection,
12
12
  } from '@solana/web3.js';
13
- import { Provider } from '@project-serum/anchor';
13
+ import { AnchorProvider } from '@project-serum/anchor';
14
14
  import assert from 'assert';
15
15
  import bs58 from 'bs58';
16
16
 
@@ -22,13 +22,13 @@ type ResolveReference = {
22
22
  };
23
23
 
24
24
  export class RetryTxSender implements TxSender {
25
- provider: Provider;
25
+ provider: AnchorProvider;
26
26
  timeout: number;
27
27
  retrySleep: number;
28
28
  additionalConnections: Connection[];
29
29
 
30
30
  public constructor(
31
- provider: Provider,
31
+ provider: AnchorProvider,
32
32
  timeout?: number,
33
33
  retrySleep?: number,
34
34
  additionalConnections = new Array<Connection>()