@drift-labs/sdk 0.1.27 → 0.1.29-master.1

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 (43) hide show
  1. package/lib/accounts/bulkAccountLoader.js +13 -3
  2. package/lib/clearingHouse.d.ts +2 -0
  3. package/lib/clearingHouse.js +24 -0
  4. package/lib/constants/markets.js +12 -1
  5. package/lib/idl/clearing_house.json +66 -2
  6. package/lib/math/amm.d.ts +0 -18
  7. package/lib/math/amm.js +1 -88
  8. package/lib/math/repeg.d.ts +32 -0
  9. package/lib/math/repeg.js +178 -0
  10. package/lib/types.d.ts +3 -0
  11. package/lib/types.js +1 -0
  12. package/package.json +1 -1
  13. package/src/accounts/bulkAccountLoader.ts +14 -4
  14. package/src/clearingHouse.ts +40 -0
  15. package/src/constants/markets.ts +12 -1
  16. package/src/idl/clearing_house.json +66 -2
  17. package/src/math/amm.ts +2 -127
  18. package/src/math/repeg.ts +253 -0
  19. package/src/types.ts +1 -0
  20. package/src/accounts/bulkAccountLoader.js +0 -180
  21. package/src/accounts/bulkAccountLoader.js.map +0 -1
  22. package/src/addresses.js +0 -59
  23. package/src/addresses.js.map +0 -1
  24. package/src/admin.js +0 -443
  25. package/src/admin.js.map +0 -1
  26. package/src/clearingHouse.js +0 -769
  27. package/src/clearingHouse.js.map +0 -1
  28. package/src/clearingHouseUser.js +0 -581
  29. package/src/clearingHouseUser.js.map +0 -1
  30. package/src/config.js +0 -37
  31. package/src/config.js.map +0 -1
  32. package/src/index.js +0 -56
  33. package/src/index.js.map +0 -1
  34. package/src/mockUSDCFaucet.js +0 -143
  35. package/src/mockUSDCFaucet.js.map +0 -1
  36. package/src/orderParams.js +0 -109
  37. package/src/orderParams.js.map +0 -1
  38. package/src/orders.js +0 -172
  39. package/src/orders.js.map +0 -1
  40. package/src/types.js +0 -61
  41. package/src/types.js.map +0 -1
  42. package/src/wallet.js +0 -23
  43. package/src/wallet.js.map +0 -1
package/src/types.js DELETED
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TradeSide = exports.isVariant = exports.OrderTriggerCondition = exports.OrderAction = exports.OrderDiscountTier = exports.OrderStatus = exports.OrderType = exports.OracleSource = exports.PositionDirection = exports.SwapDirection = void 0;
4
- // # Utility Types / Enums / Constants
5
- class SwapDirection {
6
- }
7
- exports.SwapDirection = SwapDirection;
8
- SwapDirection.ADD = { add: {} };
9
- SwapDirection.REMOVE = { remove: {} };
10
- class PositionDirection {
11
- }
12
- exports.PositionDirection = PositionDirection;
13
- PositionDirection.LONG = { long: {} };
14
- PositionDirection.SHORT = { short: {} };
15
- class OracleSource {
16
- }
17
- exports.OracleSource = OracleSource;
18
- OracleSource.PYTH = { pyth: {} };
19
- OracleSource.SWITCHBOARD = { switchboard: {} };
20
- class OrderType {
21
- }
22
- exports.OrderType = OrderType;
23
- OrderType.LIMIT = { limit: {} };
24
- OrderType.TRIGGER_MARKET = { triggerMarket: {} };
25
- OrderType.TRIGGER_LIMIT = { triggerLimit: {} };
26
- OrderType.MARKET = { market: {} };
27
- class OrderStatus {
28
- }
29
- exports.OrderStatus = OrderStatus;
30
- OrderStatus.INIT = { init: {} };
31
- OrderStatus.OPEN = { open: {} };
32
- class OrderDiscountTier {
33
- }
34
- exports.OrderDiscountTier = OrderDiscountTier;
35
- OrderDiscountTier.NONE = { none: {} };
36
- OrderDiscountTier.FIRST = { first: {} };
37
- OrderDiscountTier.SECOND = { second: {} };
38
- OrderDiscountTier.THIRD = { third: {} };
39
- OrderDiscountTier.FOURTH = { fourth: {} };
40
- class OrderAction {
41
- }
42
- exports.OrderAction = OrderAction;
43
- OrderAction.PLACE = { place: {} };
44
- OrderAction.CANCEL = { cancel: {} };
45
- OrderAction.FILL = { fill: {} };
46
- class OrderTriggerCondition {
47
- }
48
- exports.OrderTriggerCondition = OrderTriggerCondition;
49
- OrderTriggerCondition.ABOVE = { above: {} };
50
- OrderTriggerCondition.BELOW = { below: {} };
51
- function isVariant(object, type) {
52
- return object.hasOwnProperty(type);
53
- }
54
- exports.isVariant = isVariant;
55
- var TradeSide;
56
- (function (TradeSide) {
57
- TradeSide[TradeSide["None"] = 0] = "None";
58
- TradeSide[TradeSide["Buy"] = 1] = "Buy";
59
- TradeSide[TradeSide["Sell"] = 2] = "Sell";
60
- })(TradeSide = exports.TradeSide || (exports.TradeSide = {}));
61
- //# sourceMappingURL=types.js.map
package/src/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAGA,sCAAsC;AACtC,MAAa,aAAa;;AAA1B,sCAGC;AAFgB,iBAAG,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAClB,oBAAM,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAGzC,MAAa,iBAAiB;;AAA9B,8CAGC;AAFgB,sBAAI,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACpB,uBAAK,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAGvC,MAAa,YAAY;;AAAzB,oCAGC;AAFgB,iBAAI,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACpB,wBAAW,GAAG,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AAGnD,MAAa,SAAS;;AAAtB,8BAKC;AAJgB,eAAK,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AACtB,wBAAc,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;AACvC,uBAAa,GAAG,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;AACrC,gBAAM,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAGzC,MAAa,WAAW;;AAAxB,kCAGC;AAFgB,gBAAI,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACpB,gBAAI,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAGrC,MAAa,iBAAiB;;AAA9B,8CAMC;AALgB,sBAAI,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACpB,uBAAK,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AACtB,wBAAM,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AACxB,uBAAK,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AACtB,wBAAM,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAGzC,MAAa,WAAW;;AAAxB,kCAIC;AAHgB,iBAAK,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AACtB,kBAAM,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AACxB,gBAAI,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAGrC,MAAa,qBAAqB;;AAAlC,sDAGC;AAFgB,2BAAK,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AACtB,2BAAK,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAGvC,SAAgB,SAAS,CAAC,MAAe,EAAE,IAAY;IACtD,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAFD,8BAEC;AAED,IAAY,SAIX;AAJD,WAAY,SAAS;IACpB,yCAAQ,CAAA;IACR,uCAAO,CAAA;IACP,yCAAQ,CAAA;AACT,CAAC,EAJW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIpB"}
package/src/wallet.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Wallet = void 0;
4
- class Wallet {
5
- constructor(payer) {
6
- this.payer = payer;
7
- }
8
- async signTransaction(tx) {
9
- tx.partialSign(this.payer);
10
- return tx;
11
- }
12
- async signAllTransactions(txs) {
13
- return txs.map((t) => {
14
- t.partialSign(this.payer);
15
- return t;
16
- });
17
- }
18
- get publicKey() {
19
- return this.payer.publicKey;
20
- }
21
- }
22
- exports.Wallet = Wallet;
23
- //# sourceMappingURL=wallet.js.map
package/src/wallet.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"wallet.js","sourceRoot":"","sources":["wallet.ts"],"names":[],"mappings":";;;AAGA,MAAa,MAAM;IAClB,YAAqB,KAAc;QAAd,UAAK,GAAL,KAAK,CAAS;IAAG,CAAC;IAEvC,KAAK,CAAC,eAAe,CAAC,EAAe;QACpC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,EAAE,CAAC;IACX,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,GAAkB;QAC3C,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACpB,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1B,OAAO,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,SAAS;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC7B,CAAC;CACD;AAlBD,wBAkBC"}