@drift-labs/sdk-browser 2.155.0-beta.2 → 2.155.0-beta.3

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 (61) hide show
  1. package/VERSION +1 -1
  2. package/lib/browser/accounts/grpcAccountSubscriber.d.ts +0 -1
  3. package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +0 -1
  4. package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +0 -1
  5. package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +0 -1
  6. package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +0 -1
  7. package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.d.ts +0 -1
  8. package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +0 -1
  9. package/lib/browser/driftClient.d.ts +1 -2
  10. package/lib/browser/driftClient.js +5 -6
  11. package/lib/browser/oracles/pythPullClient.d.ts +2 -2
  12. package/lib/browser/oracles/pythPullClient.js +5 -2
  13. package/lib/browser/pyth/constants.d.ts +3 -0
  14. package/lib/browser/pyth/constants.js +6 -0
  15. package/lib/browser/pyth/index.d.ts +3 -0
  16. package/lib/browser/pyth/index.js +10 -0
  17. package/lib/browser/pyth/types.d.ts +2226 -0
  18. package/lib/browser/pyth/types.js +2224 -0
  19. package/lib/browser/pyth/utils.d.ts +2 -0
  20. package/lib/browser/pyth/utils.js +10 -0
  21. package/lib/node/accounts/grpcAccountSubscriber.d.ts +0 -1
  22. package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
  23. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +0 -1
  24. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
  25. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +0 -1
  26. package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
  27. package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +0 -1
  28. package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
  29. package/lib/node/accounts/webSocketAccountSubscriber.d.ts +0 -1
  30. package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
  31. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts +0 -1
  32. package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts.map +1 -1
  33. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +0 -1
  34. package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
  35. package/lib/node/driftClient.d.ts +1 -2
  36. package/lib/node/driftClient.d.ts.map +1 -1
  37. package/lib/node/driftClient.js +5 -6
  38. package/lib/node/oracles/pythPullClient.d.ts +2 -2
  39. package/lib/node/oracles/pythPullClient.d.ts.map +1 -1
  40. package/lib/node/oracles/pythPullClient.js +5 -2
  41. package/lib/node/pyth/constants.d.ts +4 -0
  42. package/lib/node/pyth/constants.d.ts.map +1 -0
  43. package/lib/node/pyth/constants.js +6 -0
  44. package/lib/node/pyth/index.d.ts +4 -0
  45. package/lib/node/pyth/index.d.ts.map +1 -0
  46. package/lib/node/pyth/index.js +10 -0
  47. package/lib/node/pyth/types.d.ts +2227 -0
  48. package/lib/node/pyth/types.d.ts.map +1 -0
  49. package/lib/node/pyth/types.js +2224 -0
  50. package/lib/node/pyth/utils.d.ts +3 -0
  51. package/lib/node/pyth/utils.d.ts.map +1 -0
  52. package/lib/node/pyth/utils.js +10 -0
  53. package/package.json +3 -4
  54. package/src/driftClient.ts +9 -11
  55. package/src/oracles/pythPullClient.ts +4 -5
  56. package/src/pyth/constants.ts +9 -0
  57. package/src/pyth/index.ts +11 -0
  58. package/src/pyth/types.ts +4453 -0
  59. package/src/pyth/utils.ts +13 -0
  60. package/tests/decode/test.ts +2 -1
  61. package/tests/dlob/helpers.ts +0 -1
@@ -0,0 +1,13 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+
3
+ export const getGuardianSetPda = (
4
+ guardianSetIndex: number,
5
+ wormholeProgramId: PublicKey
6
+ ) => {
7
+ const guardianSetIndexBuf = Buffer.alloc(4);
8
+ guardianSetIndexBuf.writeUInt32BE(guardianSetIndex, 0);
9
+ return PublicKey.findProgramAddressSync(
10
+ [Buffer.from('GuardianSet'), guardianSetIndexBuf],
11
+ wormholeProgramId
12
+ )[0];
13
+ };
@@ -187,10 +187,11 @@ function testPerpPosition(anchor: PerpPosition, custom: PerpPosition) {
187
187
  assert(anchor.openAsks.eq(custom.openAsks));
188
188
  assert(anchor.settledPnl.eq(custom.settledPnl));
189
189
  assert(anchor.lpShares.eq(custom.lpShares));
190
- assert(anchor.lastBaseAssetAmountPerLp.eq(custom.lastBaseAssetAmountPerLp));
191
190
  assert(anchor.lastQuoteAssetAmountPerLp.eq(custom.lastQuoteAssetAmountPerLp));
192
191
  assert(anchor.openOrders === custom.openOrders);
193
192
  assert(anchor.perLpBase === custom.perLpBase);
193
+ assert(anchor.isolatedPositionScaledBalance.eq(custom.isolatedPositionScaledBalance));
194
+ assert(anchor.positionFlag === custom.positionFlag);
194
195
  }
195
196
 
196
197
  function* getOrders(orders: Order[]) {
@@ -41,7 +41,6 @@ export const mockPerpPosition: PerpPosition = {
41
41
  settledPnl: new BN(0),
42
42
  lpShares: new BN(0),
43
43
  remainderBaseAssetAmount: 0,
44
- lastBaseAssetAmountPerLp: new BN(0),
45
44
  lastQuoteAssetAmountPerLp: new BN(0),
46
45
  perLpBase: 0,
47
46
  maxMarginRatio: 1,