@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.
- package/README.md +1 -1
- package/lib/accounts/fetch.d.ts +1 -1
- package/lib/accounts/pollingDriftClientAccountSubscriber.d.ts +1 -1
- package/lib/accounts/pollingOracleAccountSubscriber.d.ts +1 -1
- package/lib/accounts/pollingTokenAccountSubscriber.d.ts +1 -1
- package/lib/accounts/pollingUserAccountSubscriber.d.ts +1 -1
- package/lib/accounts/pollingUserStatsAccountSubscriber.d.ts +1 -1
- package/lib/accounts/webSocketAccountSubscriber.d.ts +1 -1
- package/lib/accounts/webSocketDriftClientAccountSubscriber.d.ts +1 -1
- package/lib/accounts/webSocketUserAccountSubscriber.d.ts +1 -1
- package/lib/accounts/webSocketUserStatsAccountSubsriber.d.ts +1 -1
- package/lib/addresses/pda.d.ts +1 -2
- package/lib/addresses/pda.js +1 -1
- package/lib/adminClient.d.ts +1 -2
- package/lib/adminClient.js +2 -2
- package/lib/constants/numericConstants.d.ts +59 -61
- package/lib/constants/spotMarkets.d.ts +0 -1
- package/lib/dlob/DLOB.d.ts +0 -1
- package/lib/dlob/DLOBNode.d.ts +0 -1
- package/lib/dlob/DLOBOrders.d.ts +1 -1
- package/lib/dlob/DLOBOrders.js +1 -1
- package/lib/dlob/NodeList.d.ts +0 -1
- package/lib/driftClient.d.ts +38 -23
- package/lib/driftClient.js +85 -131
- package/lib/events/eventSubscriber.d.ts +1 -1
- package/lib/events/eventSubscriber.js +3 -2
- package/lib/events/fetchLogs.d.ts +1 -1
- package/lib/events/fetchLogs.js +3 -2
- package/lib/examples/loadDlob.js +1 -1
- package/lib/examples/makeTradeExample.js +1 -1
- package/lib/factory/bigNum.d.ts +8 -9
- package/lib/factory/bigNum.js +1 -1
- package/lib/factory/oracleClient.js +1 -1
- package/lib/idl/drift.json +181 -14
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/math/amm.d.ts +2 -3
- package/lib/math/amm.js +1 -1
- package/lib/math/auction.d.ts +0 -1
- package/lib/math/conversion.d.ts +1 -2
- package/lib/math/funding.d.ts +1 -2
- package/lib/math/funding.js +1 -1
- package/lib/math/insurance.d.ts +1 -1
- package/lib/math/insurance.js +17 -1
- package/lib/math/margin.d.ts +1 -2
- package/lib/math/margin.js +1 -1
- package/lib/math/market.d.ts +1 -2
- package/lib/math/market.js +1 -1
- package/lib/math/oracles.d.ts +0 -1
- package/lib/math/oracles.js +2 -3
- package/lib/math/orders.d.ts +1 -2
- package/lib/math/orders.js +1 -1
- package/lib/math/position.d.ts +0 -1
- package/lib/math/repeg.d.ts +1 -2
- package/lib/math/repeg.js +1 -1
- package/lib/math/spotBalance.d.ts +1 -2
- package/lib/math/spotBalance.js +1 -1
- package/lib/math/spotMarket.d.ts +1 -2
- package/lib/math/spotMarket.js +1 -1
- package/lib/math/spotPosition.d.ts +1 -2
- package/lib/math/trade.d.ts +1 -2
- package/lib/math/trade.js +1 -1
- package/lib/math/utils.d.ts +0 -1
- package/lib/oracles/pythClient.d.ts +2 -3
- package/lib/oracles/pythClient.js +1 -1
- package/lib/oracles/quoteAssetOracleClient.js +1 -1
- package/lib/oracles/types.d.ts +1 -2
- package/lib/orderParams.d.ts +1 -2
- package/lib/serum/serumSubscriber.d.ts +1 -2
- package/lib/serum/serumSubscriber.js +1 -1
- package/lib/tokenFaucet.d.ts +2 -3
- package/lib/tokenFaucet.js +2 -2
- package/lib/tx/retryTxSender.d.ts +1 -1
- package/lib/tx/types.d.ts +1 -1
- package/lib/types.d.ts +8 -3
- package/lib/types.js +2 -1
- package/lib/user.d.ts +0 -1
- package/package.json +2 -2
- package/src/accounts/fetch.ts +1 -1
- package/src/accounts/pollingDriftClientAccountSubscriber.ts +1 -1
- package/src/accounts/pollingOracleAccountSubscriber.ts +1 -1
- package/src/accounts/pollingTokenAccountSubscriber.ts +1 -1
- package/src/accounts/pollingUserAccountSubscriber.ts +1 -1
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketDriftClientAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketUserAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +1 -1
- package/src/addresses/pda.ts +2 -2
- package/src/adminClient.ts +2 -2
- package/src/dlob/DLOBOrders.ts +2 -2
- package/src/driftClient.ts +136 -153
- package/src/events/eventSubscriber.ts +7 -3
- package/src/events/fetchLogs.ts +7 -3
- package/src/examples/loadDlob.ts +1 -1
- package/src/examples/makeTradeExample.ts +1 -1
- package/src/factory/bigNum.ts +1 -1
- package/src/factory/oracleClient.ts +1 -1
- package/src/idl/drift.json +181 -14
- package/src/index.ts +1 -1
- package/src/math/amm.ts +1 -1
- package/src/math/funding.ts +1 -1
- package/src/math/insurance.ts +29 -0
- package/src/math/margin.ts +1 -1
- package/src/math/market.ts +1 -1
- package/src/math/oracles.ts +2 -3
- package/src/math/orders.ts +1 -1
- package/src/math/repeg.ts +1 -1
- package/src/math/spotBalance.ts +1 -1
- package/src/math/spotMarket.ts +1 -1
- package/src/math/spotPosition.ts +1 -1
- package/src/math/trade.ts +1 -1
- package/src/oracles/pythClient.ts +1 -1
- package/src/oracles/quoteAssetOracleClient.ts +1 -1
- package/src/oracles/types.ts +1 -1
- package/src/orderParams.ts +1 -1
- package/src/serum/serumSubscriber.ts +1 -1
- package/src/tokenFaucet.ts +2 -2
- package/src/tx/retryTxSender.ts +1 -1
- package/src/tx/types.ts +1 -1
- package/src/types.ts +6 -1
- 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 '@
|
|
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 {
|
package/lib/accounts/fetch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { UserAccount, UserStatsAccount } from '../types';
|
|
3
|
-
import { Program } from '@
|
|
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 '@
|
|
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 '@
|
|
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 '@
|
|
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 '@
|
|
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 '@
|
|
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 '@
|
|
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 '@
|
|
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 '@
|
|
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 '@
|
|
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';
|
package/lib/addresses/pda.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
1
|
import { PublicKey } from '@solana/web3.js';
|
|
3
|
-
import { BN } from '@
|
|
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]>;
|
package/lib/addresses/pda.js
CHANGED
|
@@ -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("@
|
|
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
|
}
|
package/lib/adminClient.d.ts
CHANGED
|
@@ -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 '@
|
|
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]>;
|
package/lib/adminClient.js
CHANGED
|
@@ -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("@
|
|
31
|
-
const anchor = __importStar(require("@
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
33
|
-
export declare const
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const
|
|
37
|
-
export declare const
|
|
38
|
-
export declare const
|
|
39
|
-
export declare const
|
|
40
|
-
export declare const
|
|
41
|
-
export declare const
|
|
42
|
-
export declare const
|
|
43
|
-
export declare const
|
|
44
|
-
export declare const
|
|
45
|
-
export declare const
|
|
46
|
-
export declare const
|
|
47
|
-
export declare const
|
|
48
|
-
export declare const
|
|
49
|
-
export declare const
|
|
50
|
-
export declare const
|
|
51
|
-
export declare const
|
|
52
|
-
export declare const
|
|
53
|
-
export declare const
|
|
54
|
-
export declare const
|
|
55
|
-
export declare const
|
|
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:
|
|
60
|
-
export declare const LAMPORTS_EXP:
|
|
61
|
-
export declare const OPEN_ORDER_MARGIN_REQUIREMENT:
|
|
62
|
-
export declare const DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT:
|
|
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;
|
package/lib/dlob/DLOB.d.ts
CHANGED
|
@@ -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';
|
package/lib/dlob/DLOBNode.d.ts
CHANGED
package/lib/dlob/DLOBOrders.d.ts
CHANGED
package/lib/dlob/DLOBOrders.js
CHANGED
|
@@ -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("@
|
|
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) {
|
package/lib/dlob/NodeList.d.ts
CHANGED
package/lib/driftClient.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
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
|
|
251
|
-
* @param
|
|
252
|
-
* @param
|
|
253
|
-
* @param
|
|
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
|
|
256
|
-
* @param
|
|
257
|
-
* @param
|
|
258
|
-
* @param
|
|
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,
|
|
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
|
|
278
|
-
* @param
|
|
279
|
-
* @param
|
|
280
|
-
* @param
|
|
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,
|
|
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;
|