@drift-labs/sdk 2.24.0 → 2.25.0-beta.0

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.
Files changed (122) hide show
  1. package/README.md +1 -1
  2. package/lib/accounts/fetch.d.ts +1 -1
  3. package/lib/accounts/pollingDriftClientAccountSubscriber.d.ts +1 -1
  4. package/lib/accounts/pollingOracleAccountSubscriber.d.ts +1 -1
  5. package/lib/accounts/pollingTokenAccountSubscriber.d.ts +1 -1
  6. package/lib/accounts/pollingUserAccountSubscriber.d.ts +1 -1
  7. package/lib/accounts/pollingUserStatsAccountSubscriber.d.ts +1 -1
  8. package/lib/accounts/webSocketAccountSubscriber.d.ts +1 -1
  9. package/lib/accounts/webSocketDriftClientAccountSubscriber.d.ts +1 -1
  10. package/lib/accounts/webSocketUserAccountSubscriber.d.ts +1 -1
  11. package/lib/accounts/webSocketUserStatsAccountSubsriber.d.ts +1 -1
  12. package/lib/addresses/pda.d.ts +1 -2
  13. package/lib/addresses/pda.js +1 -1
  14. package/lib/adminClient.d.ts +1 -2
  15. package/lib/adminClient.js +2 -2
  16. package/lib/constants/numericConstants.d.ts +59 -61
  17. package/lib/constants/spotMarkets.d.ts +0 -1
  18. package/lib/dlob/DLOB.d.ts +0 -1
  19. package/lib/dlob/DLOBNode.d.ts +0 -1
  20. package/lib/dlob/DLOBOrders.d.ts +1 -1
  21. package/lib/dlob/DLOBOrders.js +1 -1
  22. package/lib/dlob/NodeList.d.ts +0 -1
  23. package/lib/driftClient.d.ts +38 -23
  24. package/lib/driftClient.js +85 -131
  25. package/lib/events/eventSubscriber.d.ts +1 -1
  26. package/lib/events/eventSubscriber.js +3 -2
  27. package/lib/events/fetchLogs.d.ts +1 -1
  28. package/lib/events/fetchLogs.js +3 -2
  29. package/lib/examples/loadDlob.js +1 -1
  30. package/lib/examples/makeTradeExample.js +1 -1
  31. package/lib/factory/bigNum.d.ts +8 -9
  32. package/lib/factory/bigNum.js +1 -1
  33. package/lib/factory/oracleClient.js +1 -1
  34. package/lib/idl/drift.json +181 -14
  35. package/lib/index.d.ts +1 -1
  36. package/lib/index.js +1 -1
  37. package/lib/math/amm.d.ts +2 -3
  38. package/lib/math/amm.js +1 -1
  39. package/lib/math/auction.d.ts +0 -1
  40. package/lib/math/conversion.d.ts +1 -2
  41. package/lib/math/funding.d.ts +1 -2
  42. package/lib/math/funding.js +1 -1
  43. package/lib/math/insurance.d.ts +1 -1
  44. package/lib/math/insurance.js +17 -1
  45. package/lib/math/margin.d.ts +1 -2
  46. package/lib/math/margin.js +1 -1
  47. package/lib/math/market.d.ts +1 -2
  48. package/lib/math/market.js +1 -1
  49. package/lib/math/oracles.d.ts +0 -1
  50. package/lib/math/oracles.js +2 -3
  51. package/lib/math/orders.d.ts +1 -2
  52. package/lib/math/orders.js +1 -1
  53. package/lib/math/position.d.ts +0 -1
  54. package/lib/math/repeg.d.ts +1 -2
  55. package/lib/math/repeg.js +1 -1
  56. package/lib/math/spotBalance.d.ts +1 -2
  57. package/lib/math/spotBalance.js +1 -1
  58. package/lib/math/spotMarket.d.ts +1 -2
  59. package/lib/math/spotMarket.js +1 -1
  60. package/lib/math/spotPosition.d.ts +1 -2
  61. package/lib/math/trade.d.ts +1 -2
  62. package/lib/math/trade.js +1 -1
  63. package/lib/math/utils.d.ts +0 -1
  64. package/lib/oracles/pythClient.d.ts +2 -3
  65. package/lib/oracles/pythClient.js +1 -1
  66. package/lib/oracles/quoteAssetOracleClient.js +1 -1
  67. package/lib/oracles/types.d.ts +1 -2
  68. package/lib/orderParams.d.ts +1 -2
  69. package/lib/serum/serumSubscriber.d.ts +1 -2
  70. package/lib/serum/serumSubscriber.js +1 -1
  71. package/lib/tokenFaucet.d.ts +2 -3
  72. package/lib/tokenFaucet.js +2 -2
  73. package/lib/tx/retryTxSender.d.ts +1 -1
  74. package/lib/tx/types.d.ts +1 -1
  75. package/lib/types.d.ts +8 -3
  76. package/lib/types.js +2 -1
  77. package/lib/user.d.ts +0 -1
  78. package/package.json +2 -2
  79. package/src/accounts/fetch.ts +1 -1
  80. package/src/accounts/pollingDriftClientAccountSubscriber.ts +1 -1
  81. package/src/accounts/pollingOracleAccountSubscriber.ts +1 -1
  82. package/src/accounts/pollingTokenAccountSubscriber.ts +1 -1
  83. package/src/accounts/pollingUserAccountSubscriber.ts +1 -1
  84. package/src/accounts/pollingUserStatsAccountSubscriber.ts +1 -1
  85. package/src/accounts/webSocketAccountSubscriber.ts +1 -1
  86. package/src/accounts/webSocketDriftClientAccountSubscriber.ts +1 -1
  87. package/src/accounts/webSocketUserAccountSubscriber.ts +1 -1
  88. package/src/accounts/webSocketUserStatsAccountSubsriber.ts +1 -1
  89. package/src/addresses/pda.ts +2 -2
  90. package/src/adminClient.ts +2 -2
  91. package/src/dlob/DLOBOrders.ts +2 -2
  92. package/src/driftClient.ts +136 -153
  93. package/src/events/eventSubscriber.ts +7 -3
  94. package/src/events/fetchLogs.ts +7 -3
  95. package/src/examples/loadDlob.ts +1 -1
  96. package/src/examples/makeTradeExample.ts +1 -1
  97. package/src/factory/bigNum.ts +1 -1
  98. package/src/factory/oracleClient.ts +1 -1
  99. package/src/idl/drift.json +181 -14
  100. package/src/index.ts +1 -1
  101. package/src/math/amm.ts +1 -1
  102. package/src/math/funding.ts +1 -1
  103. package/src/math/insurance.ts +29 -0
  104. package/src/math/margin.ts +1 -1
  105. package/src/math/market.ts +1 -1
  106. package/src/math/oracles.ts +2 -3
  107. package/src/math/orders.ts +1 -1
  108. package/src/math/repeg.ts +1 -1
  109. package/src/math/spotBalance.ts +1 -1
  110. package/src/math/spotMarket.ts +1 -1
  111. package/src/math/spotPosition.ts +1 -1
  112. package/src/math/trade.ts +1 -1
  113. package/src/oracles/pythClient.ts +1 -1
  114. package/src/oracles/quoteAssetOracleClient.ts +1 -1
  115. package/src/oracles/types.ts +1 -1
  116. package/src/orderParams.ts +1 -1
  117. package/src/serum/serumSubscriber.ts +1 -1
  118. package/src/tokenFaucet.ts +2 -2
  119. package/src/tx/retryTxSender.ts +1 -1
  120. package/src/tx/types.ts +1 -1
  121. package/src/types.ts +6 -1
  122. package/src/userMap/userStatsMap.ts +1 -1
package/README.md CHANGED
@@ -76,7 +76,7 @@ convertToNumber(new BN(10500), new BN(1000)); // = 10.5
76
76
  ### Setting up an account and making a trade
77
77
 
78
78
  ```typescript
79
- import { AnchorProvider, BN } from '@project-serum/anchor';
79
+ import { AnchorProvider, BN } from '@coral-xyz/anchor';
80
80
  import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';
81
81
  import { Connection, Keypair, PublicKey } from '@solana/web3.js';
82
82
  import {
@@ -1,6 +1,6 @@
1
1
  import { Connection, PublicKey } from '@solana/web3.js';
2
2
  import { UserAccount, UserStatsAccount } from '../types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  export declare function fetchUserAccounts(connection: Connection, program: Program, authority: PublicKey, limit?: number): Promise<(UserAccount | undefined)[]>;
5
5
  export declare function fetchUserAccountsUsingKeys(connection: Connection, program: Program, userAccountPublicKeys: PublicKey[]): Promise<(UserAccount | undefined)[]>;
6
6
  export declare function fetchUserStatsAccount(connection: Connection, program: Program, authority: PublicKey): Promise<UserStatsAccount | undefined>;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DataAndSlot, AccountToPoll, DriftClientAccountEvents, DriftClientAccountSubscriber, OraclesToPoll } from './types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  import StrictEventEmitter from 'strict-event-emitter-types';
5
5
  import { EventEmitter } from 'events';
6
6
  import { SpotMarketAccount, PerpMarketAccount, StateAccount, UserAccount } from '../types';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DataAndSlot, OracleEvents, OracleAccountSubscriber } from './types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  import StrictEventEmitter from 'strict-event-emitter-types';
5
5
  import { EventEmitter } from 'events';
6
6
  import { PublicKey } from '@solana/web3.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DataAndSlot, TokenAccountEvents, TokenAccountSubscriber } from './types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  import StrictEventEmitter from 'strict-event-emitter-types';
5
5
  import { EventEmitter } from 'events';
6
6
  import { PublicKey } from '@solana/web3.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DataAndSlot, AccountToPoll, UserAccountEvents, UserAccountSubscriber } from './types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  import StrictEventEmitter from 'strict-event-emitter-types';
5
5
  import { EventEmitter } from 'events';
6
6
  import { PublicKey } from '@solana/web3.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DataAndSlot, AccountToPoll, UserStatsAccountSubscriber, UserStatsAccountEvents } from './types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  import StrictEventEmitter from 'strict-event-emitter-types';
5
5
  import { EventEmitter } from 'events';
6
6
  import { PublicKey } from '@solana/web3.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DataAndSlot, BufferAndSlot, AccountSubscriber } from './types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  import { AccountInfo, Context, PublicKey } from '@solana/web3.js';
5
5
  export declare class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
6
6
  dataAndSlot?: DataAndSlot<T>;
@@ -2,7 +2,7 @@
2
2
  import { DriftClientAccountSubscriber, DriftClientAccountEvents, DataAndSlot } from './types';
3
3
  import { AccountSubscriber } from './types';
4
4
  import { SpotMarketAccount, PerpMarketAccount, StateAccount } from '../types';
5
- import { Program } from '@project-serum/anchor';
5
+ import { Program } from '@coral-xyz/anchor';
6
6
  import StrictEventEmitter from 'strict-event-emitter-types';
7
7
  import { EventEmitter } from 'events';
8
8
  import { PublicKey } from '@solana/web3.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DataAndSlot, AccountSubscriber, UserAccountEvents, UserAccountSubscriber } from './types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  import StrictEventEmitter from 'strict-event-emitter-types';
5
5
  import { EventEmitter } from 'events';
6
6
  import { PublicKey } from '@solana/web3.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DataAndSlot, AccountSubscriber, UserStatsAccountSubscriber, UserStatsAccountEvents } from './types';
3
- import { Program } from '@project-serum/anchor';
3
+ import { Program } from '@coral-xyz/anchor';
4
4
  import StrictEventEmitter from 'strict-event-emitter-types';
5
5
  import { EventEmitter } from 'events';
6
6
  import { PublicKey } from '@solana/web3.js';
@@ -1,6 +1,5 @@
1
- /// <reference types="bn.js" />
2
1
  import { PublicKey } from '@solana/web3.js';
3
- import { BN } from '@project-serum/anchor';
2
+ import { BN } from '@coral-xyz/anchor';
4
3
  export declare function getDriftStateAccountPublicKeyAndNonce(programId: PublicKey): Promise<[PublicKey, number]>;
5
4
  export declare function getDriftStateAccountPublicKey(programId: PublicKey): Promise<PublicKey>;
6
5
  export declare function getUserAccountPublicKeyAndNonce(programId: PublicKey, authority: PublicKey, subAccountId?: number): Promise<[PublicKey, number]>;
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getReferrerNamePublicKeySync = exports.getSerumFulfillmentConfigPublicKey = exports.getSerumSignerPublicKey = exports.getSerumOpenOrdersPublicKey = exports.getDriftSignerPublicKey = exports.getInsuranceFundStakeAccountPublicKey = exports.getInsuranceFundVaultPublicKey = exports.getSpotMarketVaultPublicKey = exports.getSpotMarketPublicKey = exports.getPerpMarketPublicKey = exports.getUserStatsAccountPublicKey = exports.getUserAccountPublicKeySync = exports.getUserAccountPublicKey = exports.getUserAccountPublicKeyAndNonce = exports.getDriftStateAccountPublicKey = exports.getDriftStateAccountPublicKeyAndNonce = void 0;
27
27
  const web3_js_1 = require("@solana/web3.js");
28
- const anchor = __importStar(require("@project-serum/anchor"));
28
+ const anchor = __importStar(require("@coral-xyz/anchor"));
29
29
  async function getDriftStateAccountPublicKeyAndNonce(programId) {
30
30
  return web3_js_1.PublicKey.findProgramAddress([Buffer.from(anchor.utils.bytes.utf8.encode('drift_state'))], programId);
31
31
  }
@@ -1,7 +1,6 @@
1
- /// <reference types="bn.js" />
2
1
  import { PublicKey, TransactionSignature } from '@solana/web3.js';
3
2
  import { FeeStructure, OracleGuardRails, OracleSource, ExchangeStatus, MarketStatus, ContractTier, AssetTier, SpotFulfillmentConfigStatus } from './types';
4
- import { BN } from '@project-serum/anchor';
3
+ import { BN } from '@coral-xyz/anchor';
5
4
  import { DriftClient } from './driftClient';
6
5
  export declare class AdminClient extends DriftClient {
7
6
  initialize(usdcMint: PublicKey, _adminControlsPrices: boolean): Promise<[TransactionSignature]>;
@@ -27,8 +27,8 @@ exports.AdminClient = void 0;
27
27
  const web3_js_1 = require("@solana/web3.js");
28
28
  const types_1 = require("./types");
29
29
  const userName_1 = require("./userName");
30
- const anchor_1 = require("@project-serum/anchor");
31
- const anchor = __importStar(require("@project-serum/anchor"));
30
+ const anchor_1 = require("@coral-xyz/anchor");
31
+ const anchor = __importStar(require("@coral-xyz/anchor"));
32
32
  const pda_1 = require("./addresses/pda");
33
33
  const utils_1 = require("./math/utils");
34
34
  const spl_token_1 = require("@solana/spl-token");
@@ -1,62 +1,60 @@
1
- /// <reference types="bn.js" />
2
- import { BN } from '../';
3
- export declare const ZERO: BN;
4
- export declare const ONE: BN;
5
- export declare const TWO: BN;
6
- export declare const THREE: BN;
7
- export declare const FOUR: BN;
8
- export declare const FIVE: BN;
9
- export declare const SIX: BN;
10
- export declare const SEVEN: BN;
11
- export declare const EIGHT: BN;
12
- export declare const NINE: BN;
13
- export declare const TEN: BN;
14
- export declare const TEN_THOUSAND: BN;
15
- export declare const BN_MAX: BN;
16
- export declare const TEN_MILLION: BN;
17
- export declare const MAX_LEVERAGE: BN;
18
- export declare const MAX_LEVERAGE_ORDER_SIZE: BN;
19
- export declare const PERCENTAGE_PRECISION_EXP: BN;
20
- export declare const PERCENTAGE_PRECISION: BN;
21
- export declare const CONCENTRATION_PRECISION: BN;
22
- export declare const QUOTE_PRECISION_EXP: BN;
23
- export declare const FUNDING_RATE_BUFFER_PRECISION_EXP: BN;
24
- export declare const PRICE_PRECISION_EXP: BN;
25
- export declare const FUNDING_RATE_PRECISION_EXP: BN;
26
- export declare const PEG_PRECISION_EXP: BN;
27
- export declare const AMM_RESERVE_PRECISION_EXP: BN;
28
- export declare const SPOT_MARKET_RATE_PRECISION_EXP: BN;
29
- export declare const SPOT_MARKET_RATE_PRECISION: BN;
30
- export declare const SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP: BN;
31
- export declare const SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION: BN;
32
- export declare const SPOT_MARKET_UTILIZATION_PRECISION_EXP: BN;
33
- export declare const SPOT_MARKET_UTILIZATION_PRECISION: BN;
34
- export declare const SPOT_MARKET_WEIGHT_PRECISION: BN;
35
- export declare const SPOT_MARKET_BALANCE_PRECISION_EXP: BN;
36
- export declare const SPOT_MARKET_BALANCE_PRECISION: BN;
37
- export declare const SPOT_MARKET_IMF_PRECISION_EXP: BN;
38
- export declare const SPOT_MARKET_IMF_PRECISION: BN;
39
- export declare const LIQUIDATION_FEE_PRECISION: BN;
40
- export declare const QUOTE_PRECISION: BN;
41
- export declare const PRICE_PRECISION: BN;
42
- export declare const FUNDING_RATE_PRECISION: BN;
43
- export declare const FUNDING_RATE_BUFFER_PRECISION: BN;
44
- export declare const PEG_PRECISION: BN;
45
- export declare const AMM_RESERVE_PRECISION: BN;
46
- export declare const BASE_PRECISION: BN;
47
- export declare const BASE_PRECISION_EXP: BN;
48
- export declare const AMM_TO_QUOTE_PRECISION_RATIO: BN;
49
- export declare const PRICE_DIV_PEG: BN;
50
- export declare const PRICE_TO_QUOTE_PRECISION: BN;
51
- export declare const AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO: BN;
52
- export declare const MARGIN_PRECISION: BN;
53
- export declare const BID_ASK_SPREAD_PRECISION: BN;
54
- export declare const LIQUIDATION_PCT_PRECISION: BN;
55
- export declare const FIVE_MINUTE: BN;
56
- export declare const ONE_HOUR: BN;
57
- export declare const ONE_YEAR: BN;
1
+ export declare const ZERO: any;
2
+ export declare const ONE: any;
3
+ export declare const TWO: any;
4
+ export declare const THREE: any;
5
+ export declare const FOUR: any;
6
+ export declare const FIVE: any;
7
+ export declare const SIX: any;
8
+ export declare const SEVEN: any;
9
+ export declare const EIGHT: any;
10
+ export declare const NINE: any;
11
+ export declare const TEN: any;
12
+ export declare const TEN_THOUSAND: any;
13
+ export declare const BN_MAX: any;
14
+ export declare const TEN_MILLION: any;
15
+ export declare const MAX_LEVERAGE: any;
16
+ export declare const MAX_LEVERAGE_ORDER_SIZE: any;
17
+ export declare const PERCENTAGE_PRECISION_EXP: any;
18
+ export declare const PERCENTAGE_PRECISION: any;
19
+ export declare const CONCENTRATION_PRECISION: any;
20
+ export declare const QUOTE_PRECISION_EXP: any;
21
+ export declare const FUNDING_RATE_BUFFER_PRECISION_EXP: any;
22
+ export declare const PRICE_PRECISION_EXP: any;
23
+ export declare const FUNDING_RATE_PRECISION_EXP: any;
24
+ export declare const PEG_PRECISION_EXP: any;
25
+ export declare const AMM_RESERVE_PRECISION_EXP: any;
26
+ export declare const SPOT_MARKET_RATE_PRECISION_EXP: any;
27
+ export declare const SPOT_MARKET_RATE_PRECISION: any;
28
+ export declare const SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP: any;
29
+ export declare const SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION: any;
30
+ export declare const SPOT_MARKET_UTILIZATION_PRECISION_EXP: any;
31
+ export declare const SPOT_MARKET_UTILIZATION_PRECISION: any;
32
+ export declare const SPOT_MARKET_WEIGHT_PRECISION: any;
33
+ export declare const SPOT_MARKET_BALANCE_PRECISION_EXP: any;
34
+ export declare const SPOT_MARKET_BALANCE_PRECISION: any;
35
+ export declare const SPOT_MARKET_IMF_PRECISION_EXP: any;
36
+ export declare const SPOT_MARKET_IMF_PRECISION: any;
37
+ export declare const LIQUIDATION_FEE_PRECISION: any;
38
+ export declare const QUOTE_PRECISION: any;
39
+ export declare const PRICE_PRECISION: any;
40
+ export declare const FUNDING_RATE_PRECISION: any;
41
+ export declare const FUNDING_RATE_BUFFER_PRECISION: any;
42
+ export declare const PEG_PRECISION: any;
43
+ export declare const AMM_RESERVE_PRECISION: any;
44
+ export declare const BASE_PRECISION: any;
45
+ export declare const BASE_PRECISION_EXP: any;
46
+ export declare const AMM_TO_QUOTE_PRECISION_RATIO: any;
47
+ export declare const PRICE_DIV_PEG: any;
48
+ export declare const PRICE_TO_QUOTE_PRECISION: any;
49
+ export declare const AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO: any;
50
+ export declare const MARGIN_PRECISION: any;
51
+ export declare const BID_ASK_SPREAD_PRECISION: any;
52
+ export declare const LIQUIDATION_PCT_PRECISION: any;
53
+ export declare const FIVE_MINUTE: any;
54
+ export declare const ONE_HOUR: any;
55
+ export declare const ONE_YEAR: any;
58
56
  export declare const QUOTE_SPOT_MARKET_INDEX = 0;
59
- export declare const LAMPORTS_PRECISION: BN;
60
- export declare const LAMPORTS_EXP: BN;
61
- export declare const OPEN_ORDER_MARGIN_REQUIREMENT: BN;
62
- export declare const DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT: BN;
57
+ export declare const LAMPORTS_PRECISION: any;
58
+ export declare const LAMPORTS_EXP: any;
59
+ export declare const OPEN_ORDER_MARGIN_REQUIREMENT: any;
60
+ export declare const DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { PublicKey } from '@solana/web3.js';
3
2
  import { BN, DriftEnv, OracleSource } from '../';
4
3
  export type SpotMarketConfig = {
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { NodeList } from './NodeList';
3
2
  import { MarketType, BN, DriftClient, Order, SpotMarketAccount, PerpMarketAccount, OraclePriceData, SlotSubscriber, MarketTypeStr, StateAccount, UserMap, OrderRecord, OrderActionRecord } from '..';
4
3
  import { PublicKey } from '@solana/web3.js';
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN, OraclePriceData, Order } from '..';
3
2
  import { PublicKey } from '@solana/web3.js';
4
3
  export interface DLOBNode {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { PublicKey } from '@solana/web3.js';
3
- import { Idl } from '@project-serum/anchor';
3
+ import { Idl } from '@coral-xyz/anchor';
4
4
  import { Order } from '../types';
5
5
  export type DLOBOrder = {
6
6
  user: PublicKey;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DLOBOrdersCoder = void 0;
7
- const idl_1 = require("@project-serum/anchor/dist/cjs/coder/borsh/idl");
7
+ const idl_1 = require("@coral-xyz/anchor/dist/cjs/coder/borsh/idl");
8
8
  const dlobIdl_json_1 = __importDefault(require("./dlobIdl.json"));
9
9
  class DLOBOrdersCoder {
10
10
  constructor(idl) {
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN, MarketTypeStr, Order } from '..';
3
2
  import { PublicKey } from '@solana/web3.js';
4
3
  import { DLOBNode, DLOBNodeMap } from './DLOBNode';
@@ -1,8 +1,7 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="bn.js" />
3
- import { AnchorProvider, BN, Program, ProgramAccount } from '@project-serum/anchor';
4
- import { StateAccount, IWallet, PositionDirection, UserAccount, PerpMarketAccount, OrderParams, Order, SpotMarketAccount, SpotPosition, MakerInfo, TakerInfo, OptionalOrderParams, OrderType, ReferrerInfo, MarketType, TxParams, SerumV3FulfillmentConfigAccount, ReferrerNameAccount, OrderTriggerCondition, PerpMarketExtendedInfo, UserStatsAccount } from './types';
5
- import * as anchor from '@project-serum/anchor';
2
+ import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
3
+ import { StateAccount, IWallet, PositionDirection, UserAccount, PerpMarketAccount, OrderParams, Order, SpotMarketAccount, SpotPosition, MakerInfo, TakerInfo, OptionalOrderParams, ReferrerInfo, MarketType, TxParams, SerumV3FulfillmentConfigAccount, ReferrerNameAccount, OrderTriggerCondition, PerpMarketExtendedInfo, UserStatsAccount, ModifyOrderParams } from './types';
4
+ import * as anchor from '@coral-xyz/anchor';
6
5
  import { Connection, PublicKey, TransactionSignature, ConfirmOptions, Transaction, TransactionInstruction, AccountMeta, Signer, AddressLookupTableAccount } from '@solana/web3.js';
7
6
  import { TokenFaucet } from './tokenFaucet';
8
7
  import { EventEmitter } from 'events';
@@ -247,57 +246,73 @@ export declare class DriftClient {
247
246
  /**
248
247
  * Modifies an open order (spot or perp) by closing it and replacing it with a new order.
249
248
  * @param orderId: The open order to modify
250
- * @param newBaseAmount: The new base amount for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
251
- * @param newLimitPice: The new limit price for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
252
- * @param newOraclePriceOffset: The new oracle price offset for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
253
- * @param newOrderType: Optional - New order type for the order.
249
+ * @param newDirection: The new direction for the order
250
+ * @param newBaseAmount: The new base amount for the order
251
+ * @param newLimitPice: The new limit price for the order
252
+ * @param newOraclePriceOffset: The new oracle price offset for the order
254
253
  * @param newTriggerPrice: Optional - Thew new trigger price for the order.
255
- * @param isSpot: Optional - Set to true if the order is a spot order
256
- * @param auctionDuration: Only required if order type changed to market from something else
257
- * @param auctionStartPrice: Only required if order type changed to market from something else
258
- * @param auctionEndPrice: Only required if order type changed to market from something else
254
+ * @param auctionDuration:
255
+ * @param auctionStartPrice:
256
+ * @param auctionEndPrice:
257
+ * @param reduceOnly:
258
+ * @param postOnly:
259
+ * @param immediateOrCancel:
260
+ * @param maxTs:
259
261
  * @returns
260
262
  */
261
- modifyOrder({ orderId, newBaseAmount, newLimitPrice, newOraclePriceOffset, newOrderType, newTriggerPrice, newTriggerCondition, isSpot, auctionDuration, auctionStartPrice, auctionEndPrice, }: {
263
+ modifyOrder({ orderId, newDirection, newBaseAmount, newLimitPrice, newOraclePriceOffset, newTriggerPrice, newTriggerCondition, auctionDuration, auctionStartPrice, auctionEndPrice, reduceOnly, postOnly, immediateOrCancel, maxTs, txParams, }: {
262
264
  orderId: number;
265
+ newDirection?: PositionDirection;
263
266
  newBaseAmount?: BN;
264
267
  newLimitPrice?: BN;
265
268
  newOraclePriceOffset?: number;
266
- newOrderType?: OrderType;
267
269
  newTriggerPrice?: BN;
268
270
  newTriggerCondition?: OrderTriggerCondition;
269
- isSpot?: boolean;
270
271
  auctionDuration?: number;
271
272
  auctionStartPrice?: BN;
272
273
  auctionEndPrice?: BN;
274
+ reduceOnly?: boolean;
275
+ postOnly?: boolean;
276
+ immediateOrCancel?: boolean;
277
+ maxTs?: BN;
278
+ txParams?: TxParams;
273
279
  }): Promise<TransactionSignature>;
280
+ getModifyOrderIx(orderId: number, orderParams: ModifyOrderParams): Promise<TransactionInstruction>;
274
281
  /**
275
282
  * Modifies an open order by closing it and replacing it with a new order.
276
283
  * @param userOrderId: The open order to modify
277
- * @param newBaseAmount: The new base amount for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
278
- * @param newLimitPice: The new limit price for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
279
- * @param newOraclePriceOffset: The new oracle price offset for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
280
- * @param newOrderType: Optional - New order type for the order.
284
+ * @param newDirection: The new direction for the order
285
+ * @param newBaseAmount: The new base amount for the order
286
+ * @param newLimitPice: The new limit price for the order
287
+ * @param newOraclePriceOffset: The new oracle price offset for the order
281
288
  * @param newTriggerPrice: Optional - Thew new trigger price for the order.
282
- * @param isSpot: Set to true if the order is a spot order
283
289
  * @param auctionDuration: Only required if order type changed to market from something else
284
290
  * @param auctionStartPrice: Only required if order type changed to market from something else
285
291
  * @param auctionEndPrice: Only required if order type changed to market from something else
292
+ * @param reduceOnly:
293
+ * @param postOnly:
294
+ * @param immediateOrCancel:
295
+ * @param maxTs:
286
296
  * @returns
287
297
  */
288
- modifyOrderByUserOrderId({ userOrderId, newBaseAmount, newLimitPrice, newOraclePriceOffset, newOrderType, newTriggerPrice, newTriggerCondition, isSpot, auctionDuration, auctionStartPrice, auctionEndPrice, }: {
298
+ modifyOrderByUserOrderId({ userOrderId, newDirection, newBaseAmount, newLimitPrice, newOraclePriceOffset, newTriggerPrice, newTriggerCondition, auctionDuration, auctionStartPrice, auctionEndPrice, reduceOnly, postOnly, immediateOrCancel, maxTs, txParams, }: {
289
299
  userOrderId: number;
300
+ newDirection?: PositionDirection;
290
301
  newBaseAmount?: BN;
291
302
  newLimitPrice?: BN;
292
303
  newOraclePriceOffset?: number;
293
- newOrderType?: OrderType;
294
304
  newTriggerPrice?: BN;
295
305
  newTriggerCondition?: OrderTriggerCondition;
296
- isSpot?: boolean;
297
306
  auctionDuration?: number;
298
307
  auctionStartPrice?: BN;
299
308
  auctionEndPrice?: BN;
309
+ reduceOnly?: boolean;
310
+ postOnly?: boolean;
311
+ immediateOrCancel?: boolean;
312
+ maxTs?: BN;
313
+ txParams?: TxParams;
300
314
  }): Promise<TransactionSignature>;
315
+ getModifyOrderByUserIdIx(userOrderId: number, orderParams: ModifyOrderParams): Promise<TransactionInstruction>;
301
316
  settlePNLs(users: {
302
317
  settleeUserAccountPublicKey: PublicKey;
303
318
  settleeUserAccount: UserAccount;