@drift-labs/sdk 2.31.1-beta.2 → 2.31.1-beta.20

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 (51) hide show
  1. package/VERSION +1 -1
  2. package/lib/accounts/mockUserAccountSubscriber.d.ts +23 -0
  3. package/lib/accounts/mockUserAccountSubscriber.js +31 -0
  4. package/lib/constants/perpMarkets.js +20 -0
  5. package/lib/dlob/orderBookLevels.js +2 -2
  6. package/lib/driftClient.d.ts +57 -4
  7. package/lib/driftClient.js +244 -205
  8. package/lib/driftClientConfig.d.ts +2 -1
  9. package/lib/idl/drift.json +31 -1
  10. package/lib/index.d.ts +2 -0
  11. package/lib/index.js +2 -0
  12. package/lib/marinade/index.d.ts +11 -0
  13. package/lib/marinade/index.js +36 -0
  14. package/lib/marinade/types.d.ts +1963 -0
  15. package/lib/marinade/types.js +1965 -0
  16. package/lib/math/spotBalance.d.ts +9 -2
  17. package/lib/math/spotBalance.js +54 -6
  18. package/lib/math/superStake.d.ts +21 -0
  19. package/lib/math/superStake.js +100 -0
  20. package/lib/math/tiers.d.ts +4 -0
  21. package/lib/math/tiers.js +52 -0
  22. package/lib/tx/retryTxSender.d.ts +12 -3
  23. package/lib/tx/retryTxSender.js +22 -22
  24. package/lib/tx/types.d.ts +2 -2
  25. package/lib/user.d.ts +10 -1
  26. package/lib/user.js +39 -8
  27. package/lib/userConfig.d.ts +4 -0
  28. package/lib/userStats.js +4 -1
  29. package/lib/userStatsConfig.d.ts +2 -0
  30. package/package.json +1 -1
  31. package/src/accounts/mockUserAccountSubscriber.ts +53 -0
  32. package/src/config.ts +2 -2
  33. package/src/constants/perpMarkets.ts +20 -0
  34. package/src/dlob/orderBookLevels.ts +3 -2
  35. package/src/driftClient.ts +440 -224
  36. package/src/driftClientConfig.ts +2 -1
  37. package/src/idl/drift.json +31 -1
  38. package/src/index.ts +2 -0
  39. package/src/marinade/idl/idl.json +1962 -0
  40. package/src/marinade/index.ts +64 -0
  41. package/src/marinade/types.ts +3925 -0
  42. package/src/math/spotBalance.ts +83 -5
  43. package/src/math/superStake.ts +133 -0
  44. package/src/math/tiers.ts +44 -0
  45. package/src/tx/retryTxSender.ts +39 -35
  46. package/src/tx/types.ts +2 -2
  47. package/src/user.ts +63 -12
  48. package/src/userConfig.ts +5 -0
  49. package/src/userStats.ts +4 -0
  50. package/src/userStatsConfig.ts +3 -0
  51. package/tests/spot/test.ts +156 -0
@@ -4,7 +4,7 @@ import {
4
4
  PublicKey,
5
5
  TransactionVersion,
6
6
  } from '@solana/web3.js';
7
- import { IWallet } from './types';
7
+ import { IWallet, TxParams } from './types';
8
8
  import { OracleInfo } from './oracles/types';
9
9
  import { BulkAccountLoader } from './accounts/bulkAccountLoader';
10
10
  import { DriftEnv } from './config';
@@ -30,6 +30,7 @@ export type DriftClientConfig = {
30
30
  authoritySubAccountMap?: Map<string, number[]>; // if passed this will override subAccountIds and includeDelegates
31
31
  skipLoadUsers?: boolean; // if passed to constructor, no user accounts will be loaded. they will load if updateWallet is called afterwards.
32
32
  txVersion?: TransactionVersion; // which tx version to use
33
+ txParams?: TxParams; // default tx params to use
33
34
  };
34
35
 
35
36
  export type DriftClientSubscriptionConfig =
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.31.1-beta.2",
2
+ "version": "2.31.1-beta.20",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -710,6 +710,36 @@
710
710
  }
711
711
  ]
712
712
  },
713
+ {
714
+ "name": "placeOrders",
715
+ "accounts": [
716
+ {
717
+ "name": "state",
718
+ "isMut": false,
719
+ "isSigner": false
720
+ },
721
+ {
722
+ "name": "user",
723
+ "isMut": true,
724
+ "isSigner": false
725
+ },
726
+ {
727
+ "name": "authority",
728
+ "isMut": false,
729
+ "isSigner": true
730
+ }
731
+ ],
732
+ "args": [
733
+ {
734
+ "name": "params",
735
+ "type": {
736
+ "vec": {
737
+ "defined": "OrderParams"
738
+ }
739
+ }
740
+ }
741
+ ]
742
+ },
713
743
  {
714
744
  "name": "beginSwap",
715
745
  "accounts": [
package/src/index.ts CHANGED
@@ -46,6 +46,8 @@ export * from './math/orders';
46
46
  export * from './math/repeg';
47
47
  export * from './math/margin';
48
48
  export * from './math/insurance';
49
+ export * from './math/superStake';
50
+ export * from './marinade';
49
51
  export * from './orderParams';
50
52
  export * from './slot/SlotSubscriber';
51
53
  export * from './wallet';