@drift-labs/sdk 2.86.0-beta.3 → 2.86.0-beta.31
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/VERSION +1 -1
- package/lib/addresses/pda.d.ts +1 -0
- package/lib/addresses/pda.js +8 -1
- package/lib/adminClient.d.ts +8 -0
- package/lib/adminClient.js +79 -0
- package/lib/bankrun/bankrunConnection.d.ts +1 -0
- package/lib/bankrun/bankrunConnection.js +6 -0
- package/lib/constants/numericConstants.d.ts +3 -0
- package/lib/constants/numericConstants.js +4 -1
- package/lib/constants/perpMarkets.js +142 -118
- package/lib/constants/spotMarkets.js +50 -38
- package/lib/driftClient.d.ts +12 -14
- package/lib/driftClient.js +144 -9
- package/lib/idl/drift.json +551 -4
- package/lib/idl/pyth_solana_receiver.json +628 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/math/fuel.d.ts +6 -0
- package/lib/math/fuel.js +55 -0
- package/lib/types.d.ts +35 -2
- package/lib/types.js +3 -2
- package/lib/user.d.ts +8 -0
- package/lib/user.js +64 -0
- package/package.json +1 -1
- package/src/addresses/pda.ts +15 -0
- package/src/adminClient.ts +208 -0
- package/src/bankrun/bankrunConnection.ts +13 -0
- package/src/constants/numericConstants.ts +4 -0
- package/src/constants/perpMarkets.ts +146 -118
- package/src/constants/spotMarkets.ts +52 -38
- package/src/driftClient.ts +197 -16
- package/src/idl/drift.json +551 -4
- package/src/idl/openbook.json +3854 -0
- package/src/idl/pyth_solana_receiver.json +628 -0
- package/src/index.ts +1 -0
- package/src/math/fuel.ts +70 -0
- package/src/types.ts +42 -2
- package/src/user.ts +177 -0
- package/tests/ci/verifyConstants.ts +214 -0
- package/tests/dlob/helpers.ts +30 -0
- package/tests/user/helpers.ts +1 -0
- package/tests/user/test.ts +2 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.86.0-beta.
|
|
1
|
+
2.86.0-beta.31
|
package/lib/addresses/pda.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare function getSerumOpenOrdersPublicKey(programId: PublicKey, market
|
|
|
17
17
|
export declare function getSerumSignerPublicKey(programId: PublicKey, market: PublicKey, nonce: BN): PublicKey;
|
|
18
18
|
export declare function getSerumFulfillmentConfigPublicKey(programId: PublicKey, market: PublicKey): PublicKey;
|
|
19
19
|
export declare function getPhoenixFulfillmentConfigPublicKey(programId: PublicKey, market: PublicKey): PublicKey;
|
|
20
|
+
export declare function getOpenbookV2FulfillmentConfigPublicKey(programId: PublicKey, market: PublicKey): PublicKey;
|
|
20
21
|
export declare function getReferrerNamePublicKeySync(programId: PublicKey, nameBuffer: number[]): PublicKey;
|
|
21
22
|
export declare function getProtocolIfSharesTransferConfigPublicKey(programId: PublicKey): PublicKey;
|
|
22
23
|
export declare function getPrelaunchOraclePublicKey(programId: PublicKey, marketIndex: number): PublicKey;
|
package/lib/addresses/pda.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getPythPullOraclePublicKey = exports.getPrelaunchOraclePublicKey = exports.getProtocolIfSharesTransferConfigPublicKey = exports.getReferrerNamePublicKeySync = exports.getPhoenixFulfillmentConfigPublicKey = 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;
|
|
26
|
+
exports.getPythPullOraclePublicKey = exports.getPrelaunchOraclePublicKey = exports.getProtocolIfSharesTransferConfigPublicKey = exports.getReferrerNamePublicKeySync = exports.getOpenbookV2FulfillmentConfigPublicKey = exports.getPhoenixFulfillmentConfigPublicKey = 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
28
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
29
29
|
async function getDriftStateAccountPublicKeyAndNonce(programId) {
|
|
@@ -126,6 +126,13 @@ function getPhoenixFulfillmentConfigPublicKey(programId, market) {
|
|
|
126
126
|
], programId)[0];
|
|
127
127
|
}
|
|
128
128
|
exports.getPhoenixFulfillmentConfigPublicKey = getPhoenixFulfillmentConfigPublicKey;
|
|
129
|
+
function getOpenbookV2FulfillmentConfigPublicKey(programId, market) {
|
|
130
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
131
|
+
Buffer.from(anchor.utils.bytes.utf8.encode('openbook_v2_fulfillment_config')),
|
|
132
|
+
market.toBuffer(),
|
|
133
|
+
], programId)[0];
|
|
134
|
+
}
|
|
135
|
+
exports.getOpenbookV2FulfillmentConfigPublicKey = getOpenbookV2FulfillmentConfigPublicKey;
|
|
129
136
|
function getReferrerNamePublicKeySync(programId, nameBuffer) {
|
|
130
137
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
131
138
|
Buffer.from(anchor.utils.bytes.utf8.encode('referrer_name')),
|
package/lib/adminClient.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare class AdminClient extends DriftClient {
|
|
|
17
17
|
getInitializeSerumFulfillmentConfigIx(marketIndex: number, serumMarket: PublicKey, serumProgram: PublicKey): Promise<TransactionInstruction>;
|
|
18
18
|
initializePhoenixFulfillmentConfig(marketIndex: number, phoenixMarket: PublicKey): Promise<TransactionSignature>;
|
|
19
19
|
getInitializePhoenixFulfillmentConfigIx(marketIndex: number, phoenixMarket: PublicKey): Promise<TransactionInstruction>;
|
|
20
|
+
initializeOpenbookV2FulfillmentConfig(marketIndex: number, openbookMarket: PublicKey): Promise<TransactionSignature>;
|
|
21
|
+
getInitializeOpenbookV2FulfillmentConfigIx(marketIndex: number, openbookMarket: PublicKey): Promise<TransactionInstruction>;
|
|
20
22
|
initializePerpMarket(marketIndex: number, priceOracle: PublicKey, baseAssetReserve: BN, quoteAssetReserve: BN, periodicity: BN, pegMultiplier?: BN, oracleSource?: OracleSource, contractTier?: ContractTier, marginRatioInitial?: number, marginRatioMaintenance?: number, liquidatorFee?: number, ifLiquidatorFee?: number, imfFactor?: number, activeStatus?: boolean, baseSpread?: number, maxSpread?: number, maxOpenInterest?: BN, maxRevenueWithdrawPerPeriod?: BN, quoteMaxInsurance?: BN, orderStepSize?: BN, orderTickSize?: BN, minOrderSize?: BN, concentrationCoefScale?: BN, curveUpdateIntensity?: number, ammJitIntensity?: number, name?: string): Promise<TransactionSignature>;
|
|
21
23
|
getInitializePerpMarketIx(marketIndex: number, priceOracle: PublicKey, baseAssetReserve: BN, quoteAssetReserve: BN, periodicity: BN, pegMultiplier?: BN, oracleSource?: OracleSource, contractTier?: ContractTier, marginRatioInitial?: number, marginRatioMaintenance?: number, liquidatorFee?: number, ifLiquidatorFee?: number, imfFactor?: number, activeStatus?: boolean, baseSpread?: number, maxSpread?: number, maxOpenInterest?: BN, maxRevenueWithdrawPerPeriod?: BN, quoteMaxInsurance?: BN, orderStepSize?: BN, orderTickSize?: BN, minOrderSize?: BN, concentrationCoefScale?: BN, curveUpdateIntensity?: number, ammJitIntensity?: number, name?: string): Promise<TransactionInstruction>;
|
|
22
24
|
deleteInitializedPerpMarket(marketIndex: number): Promise<TransactionSignature>;
|
|
@@ -179,6 +181,12 @@ export declare class AdminClient extends DriftClient {
|
|
|
179
181
|
getUpdatePrelaunchOracleParamsIx(perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionInstruction>;
|
|
180
182
|
deletePrelaunchOracle(perpMarketIndex: number): Promise<TransactionSignature>;
|
|
181
183
|
getDeletePrelaunchOracleIx(perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionInstruction>;
|
|
184
|
+
updateSpotMarketFuel(spotMarketIndex: number, fuelBoostDeposits?: number, fuelBoostBorrows?: number, fuelBoostTaker?: number, fuelBoostMaker?: number, fuelBoostInsurance?: number): Promise<TransactionSignature>;
|
|
185
|
+
getUpdateSpotMarketFuelIx(spotMarketIndex: number, fuelBoostDeposits?: number, fuelBoostBorrows?: number, fuelBoostTaker?: number, fuelBoostMaker?: number, fuelBoostInsurance?: number): Promise<TransactionInstruction>;
|
|
186
|
+
updatePerpMarketFuel(perpMarketIndex: number, fuelBoostTaker?: number, fuelBoostMaker?: number, fuelBoostPosition?: number): Promise<TransactionSignature>;
|
|
187
|
+
getUpdatePerpMarketFuelIx(perpMarketIndex: number, fuelBoostTaker?: number, fuelBoostMaker?: number, fuelBoostPosition?: number): Promise<TransactionInstruction>;
|
|
188
|
+
initUserFuel(user: PublicKey, authority: PublicKey, fuelBonusDeposits?: number, fuelBonusBorrows?: number, fuelBonusTaker?: number, fuelBonusMaker?: number, fuelBonusInsurance?: number): Promise<TransactionSignature>;
|
|
189
|
+
getInitUserFuelIx(user: PublicKey, authority: PublicKey, fuelBonusDeposits?: number, fuelBonusBorrows?: number, fuelBonusTaker?: number, fuelBonusMaker?: number, fuelBonusInsurance?: number): Promise<TransactionInstruction>;
|
|
182
190
|
initializePythPullOracle(feedId: string): Promise<TransactionSignature>;
|
|
183
191
|
getInitializePythPullOracleIx(feedId: string): Promise<TransactionInstruction>;
|
|
184
192
|
}
|
package/lib/adminClient.js
CHANGED
|
@@ -39,6 +39,7 @@ const amm_1 = require("./math/amm");
|
|
|
39
39
|
const phoenix_sdk_1 = require("@ellipsis-labs/phoenix-sdk");
|
|
40
40
|
const config_1 = require("./config");
|
|
41
41
|
const pythPullOracleUtils_1 = require("./util/pythPullOracleUtils");
|
|
42
|
+
const OPENBOOK_PROGRAM_ID = new web3_js_1.PublicKey('opnb2LAfJYbRMAHHvqjCwQxanZn7ReEHp1k81EohpZb');
|
|
42
43
|
class AdminClient extends driftClient_1.DriftClient {
|
|
43
44
|
async initialize(usdcMint, _adminControlsPrices) {
|
|
44
45
|
const stateAccountRPCResponse = await this.connection.getParsedAccountInfo(await this.getStatePublicKey());
|
|
@@ -177,6 +178,31 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
177
178
|
},
|
|
178
179
|
});
|
|
179
180
|
}
|
|
181
|
+
async initializeOpenbookV2FulfillmentConfig(marketIndex, openbookMarket) {
|
|
182
|
+
const initializeIx = await this.getInitializeOpenbookV2FulfillmentConfigIx(marketIndex, openbookMarket);
|
|
183
|
+
const tx = await this.buildTransaction(initializeIx);
|
|
184
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
185
|
+
return txSig;
|
|
186
|
+
}
|
|
187
|
+
async getInitializeOpenbookV2FulfillmentConfigIx(marketIndex, openbookMarket) {
|
|
188
|
+
const openbookFulfillmentConfig = (0, pda_1.getOpenbookV2FulfillmentConfigPublicKey)(this.program.programId, openbookMarket);
|
|
189
|
+
return this.program.instruction.initializeOpenbookV2FulfillmentConfig(marketIndex, {
|
|
190
|
+
accounts: {
|
|
191
|
+
baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
|
|
192
|
+
quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
|
|
193
|
+
state: await this.getStatePublicKey(),
|
|
194
|
+
openbookV2Program: OPENBOOK_PROGRAM_ID,
|
|
195
|
+
openbookV2Market: openbookMarket,
|
|
196
|
+
driftSigner: this.getSignerPublicKey(),
|
|
197
|
+
openbookV2FulfillmentConfig: openbookFulfillmentConfig,
|
|
198
|
+
admin: this.isSubscribed
|
|
199
|
+
? this.getStateAccount().admin
|
|
200
|
+
: this.wallet.publicKey,
|
|
201
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
202
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
}
|
|
180
206
|
async initializePerpMarket(marketIndex, priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, contractTier = types_1.ContractTier.SPECULATIVE, marginRatioInitial = 2000, marginRatioMaintenance = 500, liquidatorFee = 0, ifLiquidatorFee = 10000, imfFactor = 0, activeStatus = true, baseSpread = 0, maxSpread = 142500, maxOpenInterest = numericConstants_1.ZERO, maxRevenueWithdrawPerPeriod = numericConstants_1.ZERO, quoteMaxInsurance = numericConstants_1.ZERO, orderStepSize = numericConstants_1.BASE_PRECISION.divn(10000), orderTickSize = numericConstants_1.PRICE_PRECISION.divn(100000), minOrderSize = numericConstants_1.BASE_PRECISION.divn(10000), concentrationCoefScale = numericConstants_1.ONE, curveUpdateIntensity = 0, ammJitIntensity = 0, name = userName_1.DEFAULT_MARKET_NAME) {
|
|
181
207
|
const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
|
|
182
208
|
const initializeMarketIx = await this.getInitializePerpMarketIx(marketIndex, priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, contractTier, marginRatioInitial, marginRatioMaintenance, liquidatorFee, ifLiquidatorFee, imfFactor, activeStatus, baseSpread, maxSpread, maxOpenInterest, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, orderStepSize, orderTickSize, minOrderSize, concentrationCoefScale, curveUpdateIntensity, ammJitIntensity, name);
|
|
@@ -1631,6 +1657,59 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1631
1657
|
},
|
|
1632
1658
|
});
|
|
1633
1659
|
}
|
|
1660
|
+
async updateSpotMarketFuel(spotMarketIndex, fuelBoostDeposits, fuelBoostBorrows, fuelBoostTaker, fuelBoostMaker, fuelBoostInsurance) {
|
|
1661
|
+
const updateSpotMarketFuelIx = await this.getUpdateSpotMarketFuelIx(spotMarketIndex, fuelBoostDeposits || null, fuelBoostBorrows || null, fuelBoostTaker || null, fuelBoostMaker || null, fuelBoostInsurance || null);
|
|
1662
|
+
const tx = await this.buildTransaction(updateSpotMarketFuelIx);
|
|
1663
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1664
|
+
return txSig;
|
|
1665
|
+
}
|
|
1666
|
+
async getUpdateSpotMarketFuelIx(spotMarketIndex, fuelBoostDeposits, fuelBoostBorrows, fuelBoostTaker, fuelBoostMaker, fuelBoostInsurance) {
|
|
1667
|
+
const spotMarketPublicKey = await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex);
|
|
1668
|
+
return await this.program.instruction.updateSpotMarketFuel(fuelBoostDeposits || null, fuelBoostBorrows || null, fuelBoostTaker || null, fuelBoostMaker || null, fuelBoostInsurance || null, {
|
|
1669
|
+
accounts: {
|
|
1670
|
+
admin: this.isSubscribed
|
|
1671
|
+
? this.getStateAccount().admin
|
|
1672
|
+
: this.wallet.publicKey,
|
|
1673
|
+
state: await this.getStatePublicKey(),
|
|
1674
|
+
spotMarket: spotMarketPublicKey,
|
|
1675
|
+
},
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
async updatePerpMarketFuel(perpMarketIndex, fuelBoostTaker, fuelBoostMaker, fuelBoostPosition) {
|
|
1679
|
+
const updatePerpMarketFuelIx = await this.getUpdatePerpMarketFuelIx(perpMarketIndex, fuelBoostTaker || null, fuelBoostMaker || null, fuelBoostPosition || null);
|
|
1680
|
+
const tx = await this.buildTransaction(updatePerpMarketFuelIx);
|
|
1681
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1682
|
+
return txSig;
|
|
1683
|
+
}
|
|
1684
|
+
async getUpdatePerpMarketFuelIx(perpMarketIndex, fuelBoostTaker, fuelBoostMaker, fuelBoostPosition) {
|
|
1685
|
+
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
1686
|
+
return await this.program.instruction.updatePerpMarketFuel(fuelBoostTaker || null, fuelBoostMaker || null, fuelBoostPosition || null, {
|
|
1687
|
+
accounts: {
|
|
1688
|
+
admin: this.isSubscribed
|
|
1689
|
+
? this.getStateAccount().admin
|
|
1690
|
+
: this.wallet.publicKey,
|
|
1691
|
+
state: await this.getStatePublicKey(),
|
|
1692
|
+
perpMarket: perpMarketPublicKey,
|
|
1693
|
+
},
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
async initUserFuel(user, authority, fuelBonusDeposits, fuelBonusBorrows, fuelBonusTaker, fuelBonusMaker, fuelBonusInsurance) {
|
|
1697
|
+
const updatePerpMarketFuelIx = await this.getInitUserFuelIx(user, authority, fuelBonusDeposits, fuelBonusBorrows, fuelBonusTaker, fuelBonusMaker, fuelBonusInsurance);
|
|
1698
|
+
const tx = await this.buildTransaction(updatePerpMarketFuelIx);
|
|
1699
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1700
|
+
return txSig;
|
|
1701
|
+
}
|
|
1702
|
+
async getInitUserFuelIx(user, authority, fuelBonusDeposits, fuelBonusBorrows, fuelBonusTaker, fuelBonusMaker, fuelBonusInsurance) {
|
|
1703
|
+
const userStats = await (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, authority);
|
|
1704
|
+
return await this.program.instruction.initUserFuel(fuelBonusDeposits || null, fuelBonusBorrows || null, fuelBonusTaker || null, fuelBonusMaker || null, fuelBonusInsurance || null, {
|
|
1705
|
+
accounts: {
|
|
1706
|
+
admin: this.wallet.publicKey,
|
|
1707
|
+
state: await this.getStatePublicKey(),
|
|
1708
|
+
user,
|
|
1709
|
+
userStats,
|
|
1710
|
+
},
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1634
1713
|
async initializePythPullOracle(feedId) {
|
|
1635
1714
|
const initializePythPullOracleIx = await this.getInitializePythPullOracleIx(feedId);
|
|
1636
1715
|
const tx = await this.buildTransaction(initializePythPullOracleIx);
|
|
@@ -26,6 +26,7 @@ export declare class BankrunContextWrapper {
|
|
|
26
26
|
getLatestBlockhash(): Promise<Blockhash>;
|
|
27
27
|
printTxLogs(signature: string): void;
|
|
28
28
|
moveTimeForward(increment: number): Promise<void>;
|
|
29
|
+
setTimestamp(unix_timestamp: number): Promise<void>;
|
|
29
30
|
}
|
|
30
31
|
export declare class BankrunConnection {
|
|
31
32
|
private readonly _banksClient;
|
|
@@ -53,6 +53,12 @@ class BankrunContextWrapper {
|
|
|
53
53
|
const newClock = new solana_bankrun_1.Clock(currentClock.slot, currentClock.epochStartTimestamp, currentClock.epoch, currentClock.leaderScheduleEpoch, newUnixTimestamp);
|
|
54
54
|
await this.context.setClock(newClock);
|
|
55
55
|
}
|
|
56
|
+
async setTimestamp(unix_timestamp) {
|
|
57
|
+
const currentClock = await this.context.banksClient.getClock();
|
|
58
|
+
const newUnixTimestamp = BigInt(unix_timestamp);
|
|
59
|
+
const newClock = new solana_bankrun_1.Clock(currentClock.slot, currentClock.epochStartTimestamp, currentClock.epoch, currentClock.leaderScheduleEpoch, newUnixTimestamp);
|
|
60
|
+
await this.context.setClock(newClock);
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
exports.BankrunContextWrapper = BankrunContextWrapper;
|
|
58
64
|
class BankrunConnection {
|
|
@@ -57,6 +57,7 @@ export declare const FIVE_MINUTE: BN;
|
|
|
57
57
|
export declare const ONE_HOUR: BN;
|
|
58
58
|
export declare const ONE_YEAR: BN;
|
|
59
59
|
export declare const QUOTE_SPOT_MARKET_INDEX = 0;
|
|
60
|
+
export declare const GOV_SPOT_MARKET_INDEX = 15;
|
|
60
61
|
export declare const LAMPORTS_PRECISION: BN;
|
|
61
62
|
export declare const LAMPORTS_EXP: BN;
|
|
62
63
|
export declare const OPEN_ORDER_MARGIN_REQUIREMENT: BN;
|
|
@@ -65,3 +66,5 @@ export declare const ACCOUNT_AGE_DELETION_CUTOFF_SECONDS: number;
|
|
|
65
66
|
export declare const IDLE_TIME_SLOTS = 9000;
|
|
66
67
|
export declare const SLOT_TIME_ESTIMATE_MS = 400;
|
|
67
68
|
export declare const DUST_POSITION_SIZE: BN;
|
|
69
|
+
export declare const FUEL_WINDOW: BN;
|
|
70
|
+
export declare const FUEL_START_TS: BN;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MARGIN_PRECISION = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.PRICE_TO_QUOTE_PRECISION = exports.PRICE_DIV_PEG = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.BASE_PRECISION_EXP = exports.BASE_PRECISION = exports.AMM_RESERVE_PRECISION = exports.PEG_PRECISION = exports.FUNDING_RATE_BUFFER_PRECISION = exports.FUNDING_RATE_PRECISION = exports.PRICE_PRECISION = exports.QUOTE_PRECISION = exports.LIQUIDATION_FEE_PRECISION = exports.SPOT_MARKET_IMF_PRECISION = exports.SPOT_MARKET_IMF_PRECISION_EXP = exports.SPOT_MARKET_BALANCE_PRECISION = exports.SPOT_MARKET_BALANCE_PRECISION_EXP = exports.SPOT_MARKET_WEIGHT_PRECISION = exports.SPOT_MARKET_UTILIZATION_PRECISION = exports.SPOT_MARKET_UTILIZATION_PRECISION_EXP = exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION = exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP = exports.SPOT_MARKET_RATE_PRECISION = exports.SPOT_MARKET_RATE_PRECISION_EXP = exports.AMM_RESERVE_PRECISION_EXP = exports.PEG_PRECISION_EXP = exports.FUNDING_RATE_PRECISION_EXP = exports.PRICE_PRECISION_EXP = exports.FUNDING_RATE_BUFFER_PRECISION_EXP = exports.QUOTE_PRECISION_EXP = exports.CONCENTRATION_PRECISION = exports.PERCENTAGE_PRECISION = exports.PERCENTAGE_PRECISION_EXP = exports.MAX_LEVERAGE_ORDER_SIZE = exports.MAX_LEVERAGE = exports.TEN_MILLION = exports.BN_MAX = exports.TEN_THOUSAND = exports.TEN = exports.NINE = exports.EIGHT = exports.SEVEN = exports.SIX = exports.FIVE = exports.FOUR = exports.THREE = exports.TWO = exports.ONE = exports.ZERO = void 0;
|
|
4
|
-
exports.DUST_POSITION_SIZE = exports.SLOT_TIME_ESTIMATE_MS = exports.IDLE_TIME_SLOTS = exports.ACCOUNT_AGE_DELETION_CUTOFF_SECONDS = exports.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT = exports.OPEN_ORDER_MARGIN_REQUIREMENT = exports.LAMPORTS_EXP = exports.LAMPORTS_PRECISION = exports.QUOTE_SPOT_MARKET_INDEX = exports.ONE_YEAR = exports.ONE_HOUR = exports.FIVE_MINUTE = exports.FUNDING_RATE_OFFSET_DENOMINATOR = exports.LIQUIDATION_PCT_PRECISION = exports.BID_ASK_SPREAD_PRECISION = void 0;
|
|
4
|
+
exports.FUEL_START_TS = exports.FUEL_WINDOW = exports.DUST_POSITION_SIZE = exports.SLOT_TIME_ESTIMATE_MS = exports.IDLE_TIME_SLOTS = exports.ACCOUNT_AGE_DELETION_CUTOFF_SECONDS = exports.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT = exports.OPEN_ORDER_MARGIN_REQUIREMENT = exports.LAMPORTS_EXP = exports.LAMPORTS_PRECISION = exports.GOV_SPOT_MARKET_INDEX = exports.QUOTE_SPOT_MARKET_INDEX = exports.ONE_YEAR = exports.ONE_HOUR = exports.FIVE_MINUTE = exports.FUNDING_RATE_OFFSET_DENOMINATOR = exports.LIQUIDATION_PCT_PRECISION = exports.BID_ASK_SPREAD_PRECISION = void 0;
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const __1 = require("../");
|
|
7
7
|
exports.ZERO = new __1.BN(0);
|
|
@@ -61,6 +61,7 @@ exports.FIVE_MINUTE = new __1.BN(60 * 5);
|
|
|
61
61
|
exports.ONE_HOUR = new __1.BN(60 * 60);
|
|
62
62
|
exports.ONE_YEAR = new __1.BN(31536000);
|
|
63
63
|
exports.QUOTE_SPOT_MARKET_INDEX = 0;
|
|
64
|
+
exports.GOV_SPOT_MARKET_INDEX = 15;
|
|
64
65
|
exports.LAMPORTS_PRECISION = new __1.BN(web3_js_1.LAMPORTS_PER_SOL);
|
|
65
66
|
exports.LAMPORTS_EXP = new __1.BN(Math.log10(web3_js_1.LAMPORTS_PER_SOL));
|
|
66
67
|
exports.OPEN_ORDER_MARGIN_REQUIREMENT = exports.QUOTE_PRECISION.div(new __1.BN(100));
|
|
@@ -69,3 +70,5 @@ exports.ACCOUNT_AGE_DELETION_CUTOFF_SECONDS = 60 * 60 * 24 * 13; // 13 days
|
|
|
69
70
|
exports.IDLE_TIME_SLOTS = 9000;
|
|
70
71
|
exports.SLOT_TIME_ESTIMATE_MS = 400;
|
|
71
72
|
exports.DUST_POSITION_SIZE = exports.QUOTE_PRECISION.divn(100); // Dust position is any position smaller than 1c
|
|
73
|
+
exports.FUEL_WINDOW = new __1.BN(60 * 60 * 24 * 28); // 28 days
|
|
74
|
+
exports.FUEL_START_TS = new __1.BN(1722384000); // unix timestamp
|