@drift-labs/sdk 0.1.17 → 0.1.18-master.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/lib/accounts/defaultClearingHouseAccountSubscriber.d.ts +3 -3
- package/lib/accounts/defaultClearingHouseAccountSubscriber.d.ts.map +1 -1
- package/lib/accounts/defaultClearingHouseAccountSubscriber.js +2 -2
- package/lib/accounts/defaultUserAccountSubscriber.js +1 -1
- package/lib/accounts/types.d.ts +3 -3
- package/lib/accounts/types.d.ts.map +1 -1
- package/lib/admin.d.ts +1 -0
- package/lib/admin.d.ts.map +1 -1
- package/lib/admin.js +27 -5
- package/lib/clearingHouse.d.ts +2 -2
- package/lib/clearingHouse.d.ts.map +1 -1
- package/lib/clearingHouse.js +9 -9
- package/lib/clearingHouseUser.js +13 -13
- package/lib/examples/makeTradeExample.js +6 -6
- package/lib/idl/clearing_house.json +143 -9
- package/lib/math/amm.js +7 -7
- package/lib/math/conversion.js +1 -1
- package/lib/math/funding.js +1 -1
- package/lib/math/market.js +1 -1
- package/lib/math/position.js +1 -1
- package/lib/math/trade.js +16 -16
- package/lib/pythClient.js +1 -1
- package/lib/types.d.ts +5 -3
- package/lib/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accounts/defaultClearingHouseAccountSubscriber.ts +5 -5
- package/src/accounts/types.ts +3 -3
- package/src/admin.ts +27 -2
- package/src/clearingHouse.ts +2 -2
- package/src/idl/clearing_house.json +143 -9
- package/src/types.ts +5 -3
|
@@ -939,6 +939,11 @@
|
|
|
939
939
|
"isMut": true,
|
|
940
940
|
"isSigner": false
|
|
941
941
|
},
|
|
942
|
+
{
|
|
943
|
+
"name": "oracle",
|
|
944
|
+
"isMut": false,
|
|
945
|
+
"isSigner": false
|
|
946
|
+
},
|
|
942
947
|
{
|
|
943
948
|
"name": "curveHistory",
|
|
944
949
|
"isMut": true,
|
|
@@ -956,6 +961,32 @@
|
|
|
956
961
|
}
|
|
957
962
|
]
|
|
958
963
|
},
|
|
964
|
+
{
|
|
965
|
+
"name": "updateCurveHistory",
|
|
966
|
+
"accounts": [
|
|
967
|
+
{
|
|
968
|
+
"name": "admin",
|
|
969
|
+
"isMut": false,
|
|
970
|
+
"isSigner": true
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
"name": "state",
|
|
974
|
+
"isMut": true,
|
|
975
|
+
"isSigner": false
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
"name": "extendedCurveHistory",
|
|
979
|
+
"isMut": true,
|
|
980
|
+
"isSigner": false
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
"name": "curveHistory",
|
|
984
|
+
"isMut": false,
|
|
985
|
+
"isSigner": false
|
|
986
|
+
}
|
|
987
|
+
],
|
|
988
|
+
"args": []
|
|
989
|
+
},
|
|
959
990
|
{
|
|
960
991
|
"name": "updateMarginRatio",
|
|
961
992
|
"accounts": [
|
|
@@ -1368,7 +1399,7 @@
|
|
|
1368
1399
|
"type": "u64"
|
|
1369
1400
|
},
|
|
1370
1401
|
{
|
|
1371
|
-
"name": "
|
|
1402
|
+
"name": "curveRecords",
|
|
1372
1403
|
"type": {
|
|
1373
1404
|
"array": [
|
|
1374
1405
|
{
|
|
@@ -1381,6 +1412,29 @@
|
|
|
1381
1412
|
]
|
|
1382
1413
|
}
|
|
1383
1414
|
},
|
|
1415
|
+
{
|
|
1416
|
+
"name": "ExtendedCurveHistory",
|
|
1417
|
+
"type": {
|
|
1418
|
+
"kind": "struct",
|
|
1419
|
+
"fields": [
|
|
1420
|
+
{
|
|
1421
|
+
"name": "head",
|
|
1422
|
+
"type": "u64"
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
"name": "curveRecords",
|
|
1426
|
+
"type": {
|
|
1427
|
+
"array": [
|
|
1428
|
+
{
|
|
1429
|
+
"defined": "ExtendedCurveRecord"
|
|
1430
|
+
},
|
|
1431
|
+
1024
|
|
1432
|
+
]
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
]
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1384
1438
|
{
|
|
1385
1439
|
"name": "DepositHistory",
|
|
1386
1440
|
"type": {
|
|
@@ -1637,6 +1691,10 @@
|
|
|
1637
1691
|
"name": "maxDeposit",
|
|
1638
1692
|
"type": "u128"
|
|
1639
1693
|
},
|
|
1694
|
+
{
|
|
1695
|
+
"name": "extendedCurveHistory",
|
|
1696
|
+
"type": "publicKey"
|
|
1697
|
+
},
|
|
1640
1698
|
{
|
|
1641
1699
|
"name": "padding0",
|
|
1642
1700
|
"type": "u128"
|
|
@@ -1660,14 +1718,6 @@
|
|
|
1660
1718
|
{
|
|
1661
1719
|
"name": "padding5",
|
|
1662
1720
|
"type": "u128"
|
|
1663
|
-
},
|
|
1664
|
-
{
|
|
1665
|
-
"name": "padding6",
|
|
1666
|
-
"type": "u128"
|
|
1667
|
-
},
|
|
1668
|
-
{
|
|
1669
|
-
"name": "padding7",
|
|
1670
|
-
"type": "u128"
|
|
1671
1721
|
}
|
|
1672
1722
|
]
|
|
1673
1723
|
}
|
|
@@ -1884,6 +1934,90 @@
|
|
|
1884
1934
|
]
|
|
1885
1935
|
}
|
|
1886
1936
|
},
|
|
1937
|
+
{
|
|
1938
|
+
"name": "ExtendedCurveRecord",
|
|
1939
|
+
"type": {
|
|
1940
|
+
"kind": "struct",
|
|
1941
|
+
"fields": [
|
|
1942
|
+
{
|
|
1943
|
+
"name": "ts",
|
|
1944
|
+
"type": "i64"
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
"name": "recordId",
|
|
1948
|
+
"type": "u128"
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
"name": "marketIndex",
|
|
1952
|
+
"type": "u64"
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
"name": "pegMultiplierBefore",
|
|
1956
|
+
"type": "u128"
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
"name": "baseAssetReserveBefore",
|
|
1960
|
+
"type": "u128"
|
|
1961
|
+
},
|
|
1962
|
+
{
|
|
1963
|
+
"name": "quoteAssetReserveBefore",
|
|
1964
|
+
"type": "u128"
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
"name": "sqrtKBefore",
|
|
1968
|
+
"type": "u128"
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
"name": "pegMultiplierAfter",
|
|
1972
|
+
"type": "u128"
|
|
1973
|
+
},
|
|
1974
|
+
{
|
|
1975
|
+
"name": "baseAssetReserveAfter",
|
|
1976
|
+
"type": "u128"
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
"name": "quoteAssetReserveAfter",
|
|
1980
|
+
"type": "u128"
|
|
1981
|
+
},
|
|
1982
|
+
{
|
|
1983
|
+
"name": "sqrtKAfter",
|
|
1984
|
+
"type": "u128"
|
|
1985
|
+
},
|
|
1986
|
+
{
|
|
1987
|
+
"name": "baseAssetAmountLong",
|
|
1988
|
+
"type": "u128"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"name": "baseAssetAmountShort",
|
|
1992
|
+
"type": "u128"
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
"name": "baseAssetAmount",
|
|
1996
|
+
"type": "i128"
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
"name": "openInterest",
|
|
2000
|
+
"type": "u128"
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
"name": "totalFee",
|
|
2004
|
+
"type": "u128"
|
|
2005
|
+
},
|
|
2006
|
+
{
|
|
2007
|
+
"name": "totalFeeMinusDistributions",
|
|
2008
|
+
"type": "u128"
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
"name": "adjustmentCost",
|
|
2012
|
+
"type": "i128"
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
"name": "oraclePrice",
|
|
2016
|
+
"type": "i128"
|
|
2017
|
+
}
|
|
2018
|
+
]
|
|
2019
|
+
}
|
|
2020
|
+
},
|
|
1887
2021
|
{
|
|
1888
2022
|
"name": "DepositRecord",
|
|
1889
2023
|
"type": {
|
package/src/types.ts
CHANGED
|
@@ -43,9 +43,9 @@ export type DepositHistoryAccount = {
|
|
|
43
43
|
depositRecords: DepositRecord[];
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
export type
|
|
46
|
+
export type ExtendedCurveHistoryAccount = {
|
|
47
47
|
head: BN;
|
|
48
|
-
curveRecords:
|
|
48
|
+
curveRecords: ExtendedCurveRecord[];
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export type FundingRateHistoryAccount = {
|
|
@@ -77,7 +77,7 @@ export type DepositRecord = {
|
|
|
77
77
|
amount: BN;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
export type
|
|
80
|
+
export type ExtendedCurveRecord = {
|
|
81
81
|
ts: BN;
|
|
82
82
|
recordId: BN;
|
|
83
83
|
marketIndex: BN;
|
|
@@ -93,6 +93,7 @@ export type CurveRecord = {
|
|
|
93
93
|
baseAssetAmountShort: BN;
|
|
94
94
|
baseAssetAmount: BN;
|
|
95
95
|
openInterest: BN;
|
|
96
|
+
oraclePrice: BN;
|
|
96
97
|
};
|
|
97
98
|
|
|
98
99
|
export type TradeRecord = {
|
|
@@ -197,6 +198,7 @@ export type StateAccount = {
|
|
|
197
198
|
discountMint: PublicKey;
|
|
198
199
|
oracleGuardRails: OracleGuardRails;
|
|
199
200
|
maxDeposit: BN;
|
|
201
|
+
extendedCurveHistory: PublicKey;
|
|
200
202
|
};
|
|
201
203
|
|
|
202
204
|
export type MarketsAccount = {
|