@drift-labs/sdk 2.13.0-beta.0 → 2.13.0-beta.2
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/constants/numericConstants.d.ts +2 -0
- package/lib/constants/numericConstants.js +3 -1
- package/lib/driftClient.d.ts +9 -0
- package/lib/driftClient.js +49 -0
- package/lib/idl/drift.json +1 -1
- package/lib/math/margin.d.ts +1 -1
- package/lib/math/margin.js +7 -7
- package/lib/math/market.d.ts +5 -0
- package/lib/math/market.js +18 -1
- package/lib/math/oracles.d.ts +2 -2
- package/lib/math/oracles.js +17 -8
- package/lib/math/orders.js +1 -1
- package/lib/math/spotBalance.d.ts +5 -0
- package/lib/math/spotBalance.js +30 -3
- package/lib/math/trade.js +8 -2
- package/lib/math/utils.js +3 -0
- package/lib/user.d.ts +15 -8
- package/lib/user.js +146 -88
- package/package.json +1 -1
- package/src/constants/numericConstants.ts +2 -0
- package/src/driftClient.ts +64 -0
- package/src/idl/drift.json +1 -1
- package/src/math/margin.ts +9 -7
- package/src/math/market.ts +51 -0
- package/src/math/oracles.ts +27 -16
- package/src/math/orders.ts +2 -2
- package/src/math/spotBalance.ts +51 -3
- package/src/math/trade.ts +10 -2
- package/src/math/utils.ts +5 -1
- package/src/user.ts +321 -153
- package/tests/amm/test.ts +3 -2
package/tests/amm/test.ts
CHANGED
|
@@ -206,9 +206,10 @@ describe('AMM Tests', () => {
|
|
|
206
206
|
mockAmm.historicalOracleData.lastOraclePriceTwapTs = now.sub(new BN(11));
|
|
207
207
|
|
|
208
208
|
const liveOracleTwap = calculateLiveOracleTwap(
|
|
209
|
-
mockAmm,
|
|
209
|
+
mockAmm.historicalOracleData,
|
|
210
210
|
oraclePriceData,
|
|
211
|
-
now
|
|
211
|
+
now,
|
|
212
|
+
mockAmm.fundingPeriod
|
|
212
213
|
);
|
|
213
214
|
console.log('liveOracleTwap:', liveOracleTwap.toNumber());
|
|
214
215
|
assert(liveOracleTwap.eq(new BN(13539488)));
|