@drift-labs/sdk 2.65.0-beta.2 → 2.65.0-beta.4

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.65.0-beta.2
1
+ 2.65.0-beta.4
@@ -54,8 +54,11 @@ class JupiterClient {
54
54
  onlyDirectRoutes: onlyDirectRoutes.toString(),
55
55
  maxAccounts: maxAccounts.toString(),
56
56
  ...(excludeDexes && { excludeDexes: excludeDexes.join(',') }),
57
- }).toString();
58
- const quote = await (await (0, node_fetch_1.default)(`${this.url}/v6/quote?${params}`)).json();
57
+ });
58
+ if (swapMode === 'ExactOut') {
59
+ params.delete('maxAccounts');
60
+ }
61
+ const quote = await (await (0, node_fetch_1.default)(`${this.url}/v6/quote?${params.toString()}`)).json();
59
62
  return quote;
60
63
  }
61
64
  /**
@@ -9,6 +9,7 @@ export interface UserMapInterface {
9
9
  get(key: string): User | undefined;
10
10
  getWithSlot(key: string): DataAndSlot<User> | undefined;
11
11
  mustGet(key: string): Promise<User>;
12
+ mustGetWithSlot(key: string): Promise<DataAndSlot<User>>;
12
13
  getUserAuthority(key: string): PublicKey | undefined;
13
14
  updateWithOrderRecord(record: OrderRecord): Promise<void>;
14
15
  values(): IterableIterator<User>;
@@ -50,6 +51,7 @@ export declare class UserMap implements UserMapInterface {
50
51
  * @returns User
51
52
  */
52
53
  mustGet(key: string, accountSubscription?: UserSubscriptionConfig): Promise<User>;
54
+ mustGetWithSlot(key: string, accountSubscription?: UserSubscriptionConfig): Promise<DataAndSlot<User>>;
53
55
  /**
54
56
  * gets the Authority for a particular userAccountPublicKey, if no User exists, undefined is returned
55
57
  * @param key userAccountPublicKey to get User for
@@ -113,6 +113,12 @@ class UserMap {
113
113
  }
114
114
  return this.userMap.get(key).data;
115
115
  }
116
+ async mustGetWithSlot(key, accountSubscription) {
117
+ if (!this.has(key)) {
118
+ await this.addPubkey(new web3_js_1.PublicKey(key), undefined, undefined, accountSubscription);
119
+ }
120
+ return this.userMap.get(key);
121
+ }
116
122
  /**
117
123
  * gets the Authority for a particular userAccountPublicKey, if no User exists, undefined is returned
118
124
  * @param key userAccountPublicKey to get User for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.65.0-beta.2",
3
+ "version": "2.65.0-beta.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -305,9 +305,14 @@ export class JupiterClient {
305
305
  onlyDirectRoutes: onlyDirectRoutes.toString(),
306
306
  maxAccounts: maxAccounts.toString(),
307
307
  ...(excludeDexes && { excludeDexes: excludeDexes.join(',') }),
308
- }).toString();
309
- const quote = await (await fetch(`${this.url}/v6/quote?${params}`)).json();
310
- return quote;
308
+ });
309
+ if (swapMode === 'ExactOut') {
310
+ params.delete('maxAccounts');
311
+ }
312
+ const quote = await (
313
+ await fetch(`${this.url}/v6/quote?${params.toString()}`)
314
+ ).json();
315
+ return quote as QuoteResponse;
311
316
  }
312
317
 
313
318
  /**
@@ -43,6 +43,7 @@ export interface UserMapInterface {
43
43
  get(key: string): User | undefined;
44
44
  getWithSlot(key: string): DataAndSlot<User> | undefined;
45
45
  mustGet(key: string): Promise<User>;
46
+ mustGetWithSlot(key: string): Promise<DataAndSlot<User>>;
46
47
  getUserAuthority(key: string): PublicKey | undefined;
47
48
  updateWithOrderRecord(record: OrderRecord): Promise<void>;
48
49
  values(): IterableIterator<User>;
@@ -196,6 +197,20 @@ export class UserMap implements UserMapInterface {
196
197
  }
197
198
  return this.userMap.get(key).data;
198
199
  }
200
+ public async mustGetWithSlot(
201
+ key: string,
202
+ accountSubscription?: UserSubscriptionConfig
203
+ ): Promise<DataAndSlot<User>> {
204
+ if (!this.has(key)) {
205
+ await this.addPubkey(
206
+ new PublicKey(key),
207
+ undefined,
208
+ undefined,
209
+ accountSubscription
210
+ );
211
+ }
212
+ return this.userMap.get(key);
213
+ }
199
214
 
200
215
  /**
201
216
  * gets the Authority for a particular userAccountPublicKey, if no User exists, undefined is returned