@drift-labs/sdk-browser 2.109.0-beta.7 → 2.109.0-beta.9

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.109.0-beta.7
1
+ 2.109.0-beta.9
@@ -228,7 +228,8 @@ function decodeUser(buffer) {
228
228
  offset += 1;
229
229
  const auctionDuration = buffer.readUInt8(offset);
230
230
  offset += 1;
231
- offset += 3; // padding
231
+ const postedSlotTail = buffer.readUint8(offset);
232
+ offset += 2; // padding
232
233
  orders.push({
233
234
  slot,
234
235
  price,
@@ -254,6 +255,7 @@ function decodeUser(buffer) {
254
255
  immediateOrCancel,
255
256
  triggerCondition,
256
257
  auctionDuration,
258
+ postedSlotTail,
257
259
  });
258
260
  }
259
261
  const lastAddPerpLpSharesTs = readSignedBigInt64LE(buffer, offset);
@@ -57,6 +57,9 @@ function getOracleClient(oracleSource, connection, program) {
57
57
  if ((0, types_1.isVariant)(oracleSource, 'pythLazer1M')) {
58
58
  return new pythLazerClient_1.PythLazerClient(connection, new anchor_1.BN(1000000));
59
59
  }
60
+ if ((0, types_1.isVariant)(oracleSource, 'pythLazerStableCoin')) {
61
+ return new pythLazerClient_1.PythLazerClient(connection, undefined, true);
62
+ }
60
63
  throw new Error(`Unknown oracle source ${oracleSource}`);
61
64
  }
62
65
  exports.getOracleClient = getOracleClient;
@@ -10875,12 +10875,19 @@
10875
10875
  ],
10876
10876
  "type": "u8"
10877
10877
  },
10878
+ {
10879
+ "name": "postedSlotTail",
10880
+ "docs": [
10881
+ "Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
10882
+ ],
10883
+ "type": "u8"
10884
+ },
10878
10885
  {
10879
10886
  "name": "padding",
10880
10887
  "type": {
10881
10888
  "array": [
10882
10889
  "u8",
10883
- 3
10890
+ 2
10884
10891
  ]
10885
10892
  }
10886
10893
  }
@@ -11463,6 +11470,9 @@
11463
11470
  },
11464
11471
  {
11465
11472
  "name": "PythLazer1M"
11473
+ },
11474
+ {
11475
+ "name": "PythLazerStableCoin"
11466
11476
  }
11467
11477
  ]
11468
11478
  }
@@ -33,6 +33,8 @@ function getOracleSourceNum(source) {
33
33
  return types_1.OracleSourceNum.PYTH_LAZER_1K;
34
34
  if ('pythLazer1M' in source)
35
35
  return types_1.OracleSourceNum.PYTH_LAZER_1M;
36
+ if ('pythLazerStableCoin' in source)
37
+ return types_1.OracleSourceNum.PYTH_LAZER_STABLE_COIN;
36
38
  throw new Error('Invalid oracle source');
37
39
  }
38
40
  exports.getOracleSourceNum = getOracleSourceNum;
@@ -207,6 +207,9 @@ export declare class OracleSource {
207
207
  static readonly PYTH_LAZER_1M: {
208
208
  pythLazer1M: {};
209
209
  };
210
+ static readonly PYTH_LAZER_STABLE_COIN: {
211
+ pythLazerStableCoin: {};
212
+ };
210
213
  }
211
214
  export declare class OracleSourceNum {
212
215
  static readonly PYTH = 0;
@@ -222,8 +225,9 @@ export declare class OracleSourceNum {
222
225
  static readonly PRELAUNCH = 10;
223
226
  static readonly SWITCHBOARD_ON_DEMAND = 11;
224
227
  static readonly PYTH_LAZER = 12;
225
- static readonly PYTH_LAZER_1K = 12;
226
- static readonly PYTH_LAZER_1M = 12;
228
+ static readonly PYTH_LAZER_1K = 13;
229
+ static readonly PYTH_LAZER_1M = 14;
230
+ static readonly PYTH_LAZER_STABLE_COIN = 15;
227
231
  }
228
232
  export declare class OrderType {
229
233
  static readonly LIMIT: {
@@ -1096,6 +1100,7 @@ export type Order = {
1096
1100
  auctionStartPrice: BN;
1097
1101
  auctionEndPrice: BN;
1098
1102
  maxTs: BN;
1103
+ postedSlotTail: number;
1099
1104
  };
1100
1105
  export type OrderParams = {
1101
1106
  orderType: OrderType;
@@ -126,6 +126,7 @@ OracleSource.SWITCHBOARD_ON_DEMAND = { switchboardOnDemand: {} };
126
126
  OracleSource.PYTH_LAZER = { pythLazer: {} };
127
127
  OracleSource.PYTH_LAZER_1K = { pythLazer1K: {} };
128
128
  OracleSource.PYTH_LAZER_1M = { pythLazer1M: {} };
129
+ OracleSource.PYTH_LAZER_STABLE_COIN = { pythLazerStableCoin: {} };
129
130
  class OracleSourceNum {
130
131
  }
131
132
  exports.OracleSourceNum = OracleSourceNum;
@@ -142,8 +143,9 @@ OracleSourceNum.PYTH_STABLE_COIN_PULL = 9;
142
143
  OracleSourceNum.PRELAUNCH = 10;
143
144
  OracleSourceNum.SWITCHBOARD_ON_DEMAND = 11;
144
145
  OracleSourceNum.PYTH_LAZER = 12;
145
- OracleSourceNum.PYTH_LAZER_1K = 12;
146
- OracleSourceNum.PYTH_LAZER_1M = 12;
146
+ OracleSourceNum.PYTH_LAZER_1K = 13;
147
+ OracleSourceNum.PYTH_LAZER_1M = 14;
148
+ OracleSourceNum.PYTH_LAZER_STABLE_COIN = 15;
147
149
  class OrderType {
148
150
  }
149
151
  exports.OrderType = OrderType;
@@ -228,7 +228,8 @@ function decodeUser(buffer) {
228
228
  offset += 1;
229
229
  const auctionDuration = buffer.readUInt8(offset);
230
230
  offset += 1;
231
- offset += 3; // padding
231
+ const postedSlotTail = buffer.readUint8(offset);
232
+ offset += 2; // padding
232
233
  orders.push({
233
234
  slot,
234
235
  price,
@@ -254,6 +255,7 @@ function decodeUser(buffer) {
254
255
  immediateOrCancel,
255
256
  triggerCondition,
256
257
  auctionDuration,
258
+ postedSlotTail,
257
259
  });
258
260
  }
259
261
  const lastAddPerpLpSharesTs = readSignedBigInt64LE(buffer, offset);
@@ -57,6 +57,9 @@ function getOracleClient(oracleSource, connection, program) {
57
57
  if ((0, types_1.isVariant)(oracleSource, 'pythLazer1M')) {
58
58
  return new pythLazerClient_1.PythLazerClient(connection, new anchor_1.BN(1000000));
59
59
  }
60
+ if ((0, types_1.isVariant)(oracleSource, 'pythLazerStableCoin')) {
61
+ return new pythLazerClient_1.PythLazerClient(connection, undefined, true);
62
+ }
60
63
  throw new Error(`Unknown oracle source ${oracleSource}`);
61
64
  }
62
65
  exports.getOracleClient = getOracleClient;
@@ -10875,12 +10875,19 @@
10875
10875
  ],
10876
10876
  "type": "u8"
10877
10877
  },
10878
+ {
10879
+ "name": "postedSlotTail",
10880
+ "docs": [
10881
+ "Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
10882
+ ],
10883
+ "type": "u8"
10884
+ },
10878
10885
  {
10879
10886
  "name": "padding",
10880
10887
  "type": {
10881
10888
  "array": [
10882
10889
  "u8",
10883
- 3
10890
+ 2
10884
10891
  ]
10885
10892
  }
10886
10893
  }
@@ -11463,6 +11470,9 @@
11463
11470
  },
11464
11471
  {
11465
11472
  "name": "PythLazer1M"
11473
+ },
11474
+ {
11475
+ "name": "PythLazerStableCoin"
11466
11476
  }
11467
11477
  ]
11468
11478
  }
@@ -33,6 +33,8 @@ function getOracleSourceNum(source) {
33
33
  return types_1.OracleSourceNum.PYTH_LAZER_1K;
34
34
  if ('pythLazer1M' in source)
35
35
  return types_1.OracleSourceNum.PYTH_LAZER_1M;
36
+ if ('pythLazerStableCoin' in source)
37
+ return types_1.OracleSourceNum.PYTH_LAZER_STABLE_COIN;
36
38
  throw new Error('Invalid oracle source');
37
39
  }
38
40
  exports.getOracleSourceNum = getOracleSourceNum;
@@ -207,6 +207,9 @@ export declare class OracleSource {
207
207
  static readonly PYTH_LAZER_1M: {
208
208
  pythLazer1M: {};
209
209
  };
210
+ static readonly PYTH_LAZER_STABLE_COIN: {
211
+ pythLazerStableCoin: {};
212
+ };
210
213
  }
211
214
  export declare class OracleSourceNum {
212
215
  static readonly PYTH = 0;
@@ -222,8 +225,9 @@ export declare class OracleSourceNum {
222
225
  static readonly PRELAUNCH = 10;
223
226
  static readonly SWITCHBOARD_ON_DEMAND = 11;
224
227
  static readonly PYTH_LAZER = 12;
225
- static readonly PYTH_LAZER_1K = 12;
226
- static readonly PYTH_LAZER_1M = 12;
228
+ static readonly PYTH_LAZER_1K = 13;
229
+ static readonly PYTH_LAZER_1M = 14;
230
+ static readonly PYTH_LAZER_STABLE_COIN = 15;
227
231
  }
228
232
  export declare class OrderType {
229
233
  static readonly LIMIT: {
@@ -1096,6 +1100,7 @@ export type Order = {
1096
1100
  auctionStartPrice: BN;
1097
1101
  auctionEndPrice: BN;
1098
1102
  maxTs: BN;
1103
+ postedSlotTail: number;
1099
1104
  };
1100
1105
  export type OrderParams = {
1101
1106
  orderType: OrderType;
package/lib/node/types.js CHANGED
@@ -126,6 +126,7 @@ OracleSource.SWITCHBOARD_ON_DEMAND = { switchboardOnDemand: {} };
126
126
  OracleSource.PYTH_LAZER = { pythLazer: {} };
127
127
  OracleSource.PYTH_LAZER_1K = { pythLazer1K: {} };
128
128
  OracleSource.PYTH_LAZER_1M = { pythLazer1M: {} };
129
+ OracleSource.PYTH_LAZER_STABLE_COIN = { pythLazerStableCoin: {} };
129
130
  class OracleSourceNum {
130
131
  }
131
132
  exports.OracleSourceNum = OracleSourceNum;
@@ -142,8 +143,9 @@ OracleSourceNum.PYTH_STABLE_COIN_PULL = 9;
142
143
  OracleSourceNum.PRELAUNCH = 10;
143
144
  OracleSourceNum.SWITCHBOARD_ON_DEMAND = 11;
144
145
  OracleSourceNum.PYTH_LAZER = 12;
145
- OracleSourceNum.PYTH_LAZER_1K = 12;
146
- OracleSourceNum.PYTH_LAZER_1M = 12;
146
+ OracleSourceNum.PYTH_LAZER_1K = 13;
147
+ OracleSourceNum.PYTH_LAZER_1M = 14;
148
+ OracleSourceNum.PYTH_LAZER_STABLE_COIN = 15;
147
149
  class OrderType {
148
150
  }
149
151
  exports.OrderType = OrderType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk-browser",
3
- "version": "2.109.0-beta.7",
3
+ "version": "2.109.0-beta.9",
4
4
  "main": "lib/node/index.js",
5
5
  "types": "lib/node/index.d.ts",
6
6
  "browser": "./lib/browser/index.js",
@@ -237,7 +237,8 @@ export function decodeUser(buffer: Buffer): UserAccount {
237
237
  offset += 1;
238
238
  const auctionDuration = buffer.readUInt8(offset);
239
239
  offset += 1;
240
- offset += 3; // padding
240
+ const postedSlotTail = buffer.readUint8(offset);
241
+ offset += 2; // padding
241
242
  orders.push({
242
243
  slot,
243
244
  price,
@@ -263,6 +264,7 @@ export function decodeUser(buffer: Buffer): UserAccount {
263
264
  immediateOrCancel,
264
265
  triggerCondition,
265
266
  auctionDuration,
267
+ postedSlotTail,
266
268
  });
267
269
  }
268
270
 
@@ -76,5 +76,9 @@ export function getOracleClient(
76
76
  return new PythLazerClient(connection, new BN(1000000));
77
77
  }
78
78
 
79
+ if (isVariant(oracleSource, 'pythLazerStableCoin')) {
80
+ return new PythLazerClient(connection, undefined, true);
81
+ }
82
+
79
83
  throw new Error(`Unknown oracle source ${oracleSource}`);
80
84
  }
@@ -10875,12 +10875,19 @@
10875
10875
  ],
10876
10876
  "type": "u8"
10877
10877
  },
10878
+ {
10879
+ "name": "postedSlotTail",
10880
+ "docs": [
10881
+ "Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
10882
+ ],
10883
+ "type": "u8"
10884
+ },
10878
10885
  {
10879
10886
  "name": "padding",
10880
10887
  "type": {
10881
10888
  "array": [
10882
10889
  "u8",
10883
- 3
10890
+ 2
10884
10891
  ]
10885
10892
  }
10886
10893
  }
@@ -11463,6 +11470,9 @@
11463
11470
  },
11464
11471
  {
11465
11472
  "name": "PythLazer1M"
11473
+ },
11474
+ {
11475
+ "name": "PythLazerStableCoin"
11466
11476
  }
11467
11477
  ]
11468
11478
  }
@@ -19,6 +19,8 @@ export function getOracleSourceNum(source: OracleSource): number {
19
19
  if ('pythLazer' in source) return OracleSourceNum.PYTH_LAZER;
20
20
  if ('pythLazer1K' in source) return OracleSourceNum.PYTH_LAZER_1K;
21
21
  if ('pythLazer1M' in source) return OracleSourceNum.PYTH_LAZER_1M;
22
+ if ('pythLazerStableCoin' in source)
23
+ return OracleSourceNum.PYTH_LAZER_STABLE_COIN;
22
24
  throw new Error('Invalid oracle source');
23
25
  }
24
26
 
package/src/types.ts CHANGED
@@ -134,6 +134,7 @@ export class OracleSource {
134
134
  static readonly PYTH_LAZER = { pythLazer: {} };
135
135
  static readonly PYTH_LAZER_1K = { pythLazer1K: {} };
136
136
  static readonly PYTH_LAZER_1M = { pythLazer1M: {} };
137
+ static readonly PYTH_LAZER_STABLE_COIN = { pythLazerStableCoin: {} };
137
138
  }
138
139
 
139
140
  export class OracleSourceNum {
@@ -150,8 +151,9 @@ export class OracleSourceNum {
150
151
  static readonly PRELAUNCH = 10;
151
152
  static readonly SWITCHBOARD_ON_DEMAND = 11;
152
153
  static readonly PYTH_LAZER = 12;
153
- static readonly PYTH_LAZER_1K = 12;
154
- static readonly PYTH_LAZER_1M = 12;
154
+ static readonly PYTH_LAZER_1K = 13;
155
+ static readonly PYTH_LAZER_1M = 14;
156
+ static readonly PYTH_LAZER_STABLE_COIN = 15;
155
157
  }
156
158
 
157
159
  export class OrderType {
@@ -1040,6 +1042,7 @@ export type Order = {
1040
1042
  auctionStartPrice: BN;
1041
1043
  auctionEndPrice: BN;
1042
1044
  maxTs: BN;
1045
+ postedSlotTail: number;
1043
1046
  };
1044
1047
 
1045
1048
  export type OrderParams = {
@@ -41,6 +41,7 @@ export const mockOrder: Order = {
41
41
  auctionStartPrice: ZERO,
42
42
  auctionEndPrice: ZERO,
43
43
  maxTs: ZERO,
44
+ postedSlotTail: 0,
44
45
  };
45
46
 
46
47
  export const mockSpotPosition: SpotPosition = {