@drift-labs/sdk 2.87.0-beta.0 → 2.87.0-beta.10

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 (54) hide show
  1. package/VERSION +1 -1
  2. package/lib/addresses/pda.d.ts +2 -0
  3. package/lib/addresses/pda.js +9 -1
  4. package/lib/adminClient.d.ts +2 -0
  5. package/lib/adminClient.js +27 -4
  6. package/lib/bankrun/bankrunConnection.js +1 -1
  7. package/lib/config.d.ts +1 -0
  8. package/lib/config.js +2 -0
  9. package/lib/constants/perpMarkets.js +12 -12
  10. package/lib/constants/spotMarkets.d.ts +1 -0
  11. package/lib/constants/spotMarkets.js +13 -3
  12. package/lib/dlob/orderBookLevels.d.ts +1 -1
  13. package/lib/driftClient.d.ts +15 -5
  14. package/lib/driftClient.js +155 -41
  15. package/lib/events/types.d.ts +3 -2
  16. package/lib/events/types.js +1 -0
  17. package/lib/factory/oracleClient.js +4 -0
  18. package/lib/idl/drift.json +147 -5
  19. package/lib/idl/openbook.json +3854 -0
  20. package/lib/idl/switchboard_on_demand_30.json +4383 -0
  21. package/lib/index.d.ts +2 -0
  22. package/lib/index.js +2 -0
  23. package/lib/math/spotMarket.d.ts +6 -0
  24. package/lib/math/spotMarket.js +16 -1
  25. package/lib/math/superStake.d.ts +3 -2
  26. package/lib/openbook/openbookV2FulfillmentConfigMap.d.ts +10 -0
  27. package/lib/openbook/openbookV2FulfillmentConfigMap.js +17 -0
  28. package/lib/openbook/openbookV2Subscriber.d.ts +36 -0
  29. package/lib/openbook/openbookV2Subscriber.js +102 -0
  30. package/lib/oracles/switchboardOnDemandClient.d.ts +11 -0
  31. package/lib/oracles/switchboardOnDemandClient.js +32 -0
  32. package/lib/types.d.ts +13 -0
  33. package/lib/types.js +1 -0
  34. package/package.json +6 -2
  35. package/src/addresses/pda.ts +10 -0
  36. package/src/adminClient.ts +47 -4
  37. package/src/bankrun/bankrunConnection.ts +2 -2
  38. package/src/config.ts +3 -0
  39. package/src/constants/perpMarkets.ts +12 -12
  40. package/src/constants/spotMarkets.ts +15 -3
  41. package/src/dlob/orderBookLevels.ts +1 -1
  42. package/src/driftClient.ts +229 -52
  43. package/src/events/types.ts +5 -1
  44. package/src/factory/oracleClient.ts +5 -0
  45. package/src/idl/drift.json +147 -5
  46. package/src/idl/switchboard_on_demand_30.json +4383 -0
  47. package/src/index.ts +2 -0
  48. package/src/math/spotMarket.ts +28 -2
  49. package/src/openbook/openbookV2FulfillmentConfigMap.ts +29 -0
  50. package/src/openbook/openbookV2Subscriber.ts +165 -0
  51. package/src/oracles/switchboardOnDemandClient.ts +56 -0
  52. package/src/types.ts +13 -0
  53. package/tests/ci/verifyConstants.ts +3 -6
  54. package/tests/subscriber/openbook.ts +58 -0
@@ -1675,6 +1675,47 @@
1675
1675
  }
1676
1676
  ]
1677
1677
  },
1678
+ {
1679
+ "name": "liquidatePerpWithFill",
1680
+ "accounts": [
1681
+ {
1682
+ "name": "state",
1683
+ "isMut": false,
1684
+ "isSigner": false
1685
+ },
1686
+ {
1687
+ "name": "authority",
1688
+ "isMut": false,
1689
+ "isSigner": true
1690
+ },
1691
+ {
1692
+ "name": "liquidator",
1693
+ "isMut": true,
1694
+ "isSigner": false
1695
+ },
1696
+ {
1697
+ "name": "liquidatorStats",
1698
+ "isMut": true,
1699
+ "isSigner": false
1700
+ },
1701
+ {
1702
+ "name": "user",
1703
+ "isMut": true,
1704
+ "isSigner": false
1705
+ },
1706
+ {
1707
+ "name": "userStats",
1708
+ "isMut": true,
1709
+ "isSigner": false
1710
+ }
1711
+ ],
1712
+ "args": [
1713
+ {
1714
+ "name": "marketIndex",
1715
+ "type": "u16"
1716
+ }
1717
+ ]
1718
+ },
1678
1719
  {
1679
1720
  "name": "liquidateSpot",
1680
1721
  "accounts": [
@@ -2341,7 +2382,7 @@
2341
2382
  },
2342
2383
  {
2343
2384
  "name": "spotMarket",
2344
- "isMut": false,
2385
+ "isMut": true,
2345
2386
  "isSigner": false
2346
2387
  },
2347
2388
  {
@@ -2401,7 +2442,7 @@
2401
2442
  "accounts": [
2402
2443
  {
2403
2444
  "name": "spotMarket",
2404
- "isMut": false,
2445
+ "isMut": true,
2405
2446
  "isSigner": false
2406
2447
  },
2407
2448
  {
@@ -2441,7 +2482,7 @@
2441
2482
  "accounts": [
2442
2483
  {
2443
2484
  "name": "spotMarket",
2444
- "isMut": false,
2485
+ "isMut": true,
2445
2486
  "isSigner": false
2446
2487
  },
2447
2488
  {
@@ -2482,7 +2523,7 @@
2482
2523
  },
2483
2524
  {
2484
2525
  "name": "spotMarket",
2485
- "isMut": false,
2526
+ "isMut": true,
2486
2527
  "isSigner": false
2487
2528
  },
2488
2529
  {
@@ -3593,6 +3634,47 @@
3593
3634
  }
3594
3635
  ]
3595
3636
  },
3637
+ {
3638
+ "name": "depositIntoSpotMarketVault",
3639
+ "accounts": [
3640
+ {
3641
+ "name": "state",
3642
+ "isMut": false,
3643
+ "isSigner": false
3644
+ },
3645
+ {
3646
+ "name": "spotMarket",
3647
+ "isMut": true,
3648
+ "isSigner": false
3649
+ },
3650
+ {
3651
+ "name": "admin",
3652
+ "isMut": false,
3653
+ "isSigner": true
3654
+ },
3655
+ {
3656
+ "name": "sourceVault",
3657
+ "isMut": true,
3658
+ "isSigner": false
3659
+ },
3660
+ {
3661
+ "name": "spotMarketVault",
3662
+ "isMut": true,
3663
+ "isSigner": false
3664
+ },
3665
+ {
3666
+ "name": "tokenProgram",
3667
+ "isMut": false,
3668
+ "isSigner": false
3669
+ }
3670
+ ],
3671
+ "args": [
3672
+ {
3673
+ "name": "amount",
3674
+ "type": "u64"
3675
+ }
3676
+ ]
3677
+ },
3596
3678
  {
3597
3679
  "name": "depositIntoSpotMarketRevenuePool",
3598
3680
  "accounts": [
@@ -6835,12 +6917,16 @@
6835
6917
  ],
6836
6918
  "type": "u8"
6837
6919
  },
6920
+ {
6921
+ "name": "tokenProgram",
6922
+ "type": "u8"
6923
+ },
6838
6924
  {
6839
6925
  "name": "padding",
6840
6926
  "type": {
6841
6927
  "array": [
6842
6928
  "u8",
6843
- 42
6929
+ 41
6844
6930
  ]
6845
6931
  }
6846
6932
  }
@@ -9833,6 +9919,9 @@
9833
9919
  },
9834
9920
  {
9835
9921
  "name": "PlaceAndTake"
9922
+ },
9923
+ {
9924
+ "name": "Liquidation"
9836
9925
  }
9837
9926
  ]
9838
9927
  }
@@ -9945,6 +10034,9 @@
9945
10034
  },
9946
10035
  {
9947
10036
  "name": "PythStableCoinPull"
10037
+ },
10038
+ {
10039
+ "name": "SwitchboardOnDemand"
9948
10040
  }
9949
10041
  ]
9950
10042
  }
@@ -11349,6 +11441,46 @@
11349
11441
  "index": false
11350
11442
  }
11351
11443
  ]
11444
+ },
11445
+ {
11446
+ "name": "SpotMarketVaultDepositRecord",
11447
+ "fields": [
11448
+ {
11449
+ "name": "ts",
11450
+ "type": "i64",
11451
+ "index": false
11452
+ },
11453
+ {
11454
+ "name": "marketIndex",
11455
+ "type": "u16",
11456
+ "index": false
11457
+ },
11458
+ {
11459
+ "name": "depositBalance",
11460
+ "type": "u128",
11461
+ "index": false
11462
+ },
11463
+ {
11464
+ "name": "cumulativeDepositInterestBefore",
11465
+ "type": "u128",
11466
+ "index": false
11467
+ },
11468
+ {
11469
+ "name": "cumulativeDepositInterestAfter",
11470
+ "type": "u128",
11471
+ "index": false
11472
+ },
11473
+ {
11474
+ "name": "depositTokenAmountBefore",
11475
+ "type": "u64",
11476
+ "index": false
11477
+ },
11478
+ {
11479
+ "name": "amount",
11480
+ "type": "u64",
11481
+ "index": false
11482
+ }
11483
+ ]
11352
11484
  }
11353
11485
  ],
11354
11486
  "errors": [
@@ -12761,6 +12893,16 @@
12761
12893
  "code": 6281,
12762
12894
  "name": "InvalidOpenbookV2Market",
12763
12895
  "msg": "InvalidOpenbookV2Market"
12896
+ },
12897
+ {
12898
+ "code": 6282,
12899
+ "name": "NonZeroTransferFee",
12900
+ "msg": "Non zero transfer fee"
12901
+ },
12902
+ {
12903
+ "code": 6283,
12904
+ "name": "LiquidationOrderFailedToFill",
12905
+ "msg": "Liquidation order failed to fill"
12764
12906
  }
12765
12907
  ],
12766
12908
  "metadata": {