@carrot-protocol/boost-http-client 0.4.3 → 0.4.4-handoff-dev-e67b717

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/dist/index.d.ts CHANGED
@@ -79,6 +79,7 @@ export declare class Client extends ApiClient {
79
79
  * @returns Withdraw emissions operation result
80
80
  */
81
81
  withdrawEmissions(clendAccount: web3.PublicKey): Promise<string>;
82
+ handoffDepositLeverage(): Promise<string>;
82
83
  getPerformanceChartingExtension(clendAccount: web3.PublicKey): Promise<PositionChartingExtension>;
83
84
  getGroupChartingExtension(group: web3.PublicKey): Promise<GroupChartingExtension>;
84
85
  getWalletChartingExtension(address?: web3.PublicKey): Promise<WalletChartingExtension>;
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ class Client extends api_1.ApiClient {
72
72
  return this.provider.wallet.publicKey;
73
73
  }
74
74
  // sign and send tx to api for sending to network
75
- async send(unsignedBase64Tx, userRequestId) {
75
+ async send(unsignedBase64Tx, userRequestId, useJito) {
76
76
  if (this.dryRun) {
77
77
  // for debugging purposes only
78
78
  console.log("unsigedBase64Tx", unsignedBase64Tx);
@@ -91,6 +91,7 @@ class Client extends api_1.ApiClient {
91
91
  const sendRequest = {
92
92
  userRequestId,
93
93
  txns: [encodedAndSignedTx],
94
+ useJito,
94
95
  };
95
96
  // send to api
96
97
  await this.handleApiCall(() => this.http.post(`send`, sendRequest));
@@ -336,7 +337,7 @@ class Client extends api_1.ApiClient {
336
337
  };
337
338
  const body = await this.handleApiCall(() => this.http.post("deposit", JSON.stringify(req)));
338
339
  const depositResponse = JSON.parse(body);
339
- const txSig = await this.send(depositResponse.unsignedBase64Tx, depositResponse.userRequestId);
340
+ const txSig = await this.send(depositResponse.unsignedBase64Tx, depositResponse.userRequestId, false);
340
341
  return txSig;
341
342
  }
342
343
  async withdraw(clendAccount, outputTokenMint, uiAmount, withdrawAll) {
@@ -348,7 +349,7 @@ class Client extends api_1.ApiClient {
348
349
  };
349
350
  const body = await this.handleApiCall(() => this.http.post("withdraw", JSON.stringify(req)));
350
351
  const withdrawResponse = JSON.parse(body);
351
- const txSig = await this.send(withdrawResponse.unsignedBase64Tx, withdrawResponse.userRequestId);
352
+ const txSig = await this.send(withdrawResponse.unsignedBase64Tx, withdrawResponse.userRequestId, false);
352
353
  return txSig;
353
354
  }
354
355
  /**
@@ -370,7 +371,7 @@ class Client extends api_1.ApiClient {
370
371
  };
371
372
  const body = await this.handleApiCall(() => this.http.post("leverage/deposit", JSON.stringify(req)));
372
373
  const depositLeverageResponse = JSON.parse(body);
373
- const txSig = await this.send(depositLeverageResponse.unsignedBase64Tx, depositLeverageResponse.userRequestId);
374
+ const txSig = await this.send(depositLeverageResponse.unsignedBase64Tx, depositLeverageResponse.userRequestId, false);
374
375
  return txSig;
375
376
  }
376
377
  /**
@@ -388,7 +389,7 @@ class Client extends api_1.ApiClient {
388
389
  };
389
390
  const body = await this.handleApiCall(() => this.http.post("leverage/adjust", JSON.stringify(req)));
390
391
  const adjustLeverageResponse = JSON.parse(body);
391
- const txSig = await this.send(adjustLeverageResponse.unsignedBase64Tx, adjustLeverageResponse.userRequestId);
392
+ const txSig = await this.send(adjustLeverageResponse.unsignedBase64Tx, adjustLeverageResponse.userRequestId, false);
392
393
  return txSig;
393
394
  }
394
395
  /**
@@ -408,7 +409,7 @@ class Client extends api_1.ApiClient {
408
409
  };
409
410
  const body = await this.handleApiCall(() => this.http.post("leverage/withdraw", JSON.stringify(req)));
410
411
  const withdrawLeverageResponse = JSON.parse(body);
411
- const txSig = await this.send(withdrawLeverageResponse.unsignedBase64Tx, withdrawLeverageResponse.userRequestId);
412
+ const txSig = await this.send(withdrawLeverageResponse.unsignedBase64Tx, withdrawLeverageResponse.userRequestId, false);
412
413
  return txSig;
413
414
  }
414
415
  /**
@@ -421,9 +422,12 @@ class Client extends api_1.ApiClient {
421
422
  };
422
423
  const body = await this.handleApiCall(() => this.http.post("emissions/withdraw", JSON.stringify(req)));
423
424
  const withdrawEmissionsResponse = JSON.parse(body);
424
- const txSig = await this.send(withdrawEmissionsResponse.unsignedBase64Tx, withdrawEmissionsResponse.userRequestId);
425
+ const txSig = await this.send(withdrawEmissionsResponse.unsignedBase64Tx, withdrawEmissionsResponse.userRequestId, false);
425
426
  return txSig;
426
427
  }
428
+ async handoffDepositLeverage() {
429
+ return "";
430
+ }
427
431
  async getPerformanceChartingExtension(clendAccount) {
428
432
  return new position_1.PositionChartingExtension(this.baseUrl, clendAccount);
429
433
  }
package/dist/types.d.ts CHANGED
@@ -6,6 +6,7 @@ import { GroupChartingExtension } from "./charting/group";
6
6
  export interface SendRequest {
7
7
  userRequestId: string;
8
8
  txns: string[];
9
+ useJito: boolean;
9
10
  }
10
11
  /**
11
12
  * Request to deposit collateral
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/boost-http-client",
3
- "version": "0.4.3",
3
+ "version": "0.4.4-handoff-dev-e67b717",
4
4
  "description": "HTTP client for Carrot Boost",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,4 +28,4 @@
28
28
  "@carrot-protocol/clend-common": "^0.1.0",
29
29
  "@coral-xyz/anchor": "^0.29.0"
30
30
  }
31
- }
31
+ }
package/src/index.ts CHANGED
@@ -75,6 +75,7 @@ export class Client extends ApiClient {
75
75
  private async send(
76
76
  unsignedBase64Tx: string,
77
77
  userRequestId: string,
78
+ useJito: boolean,
78
79
  ): Promise<string> {
79
80
  if (this.dryRun) {
80
81
  // for debugging purposes only
@@ -100,6 +101,7 @@ export class Client extends ApiClient {
100
101
  const sendRequest: SendRequest = {
101
102
  userRequestId,
102
103
  txns: [encodedAndSignedTx],
104
+ useJito,
103
105
  };
104
106
 
105
107
  // send to api
@@ -429,6 +431,7 @@ export class Client extends ApiClient {
429
431
  const txSig = await this.send(
430
432
  depositResponse.unsignedBase64Tx,
431
433
  depositResponse.userRequestId,
434
+ false,
432
435
  );
433
436
 
434
437
  return txSig;
@@ -456,6 +459,7 @@ export class Client extends ApiClient {
456
459
  const txSig = await this.send(
457
460
  withdrawResponse.unsignedBase64Tx,
458
461
  withdrawResponse.userRequestId,
462
+ false,
459
463
  );
460
464
 
461
465
  return txSig;
@@ -496,6 +500,7 @@ export class Client extends ApiClient {
496
500
  const txSig = await this.send(
497
501
  depositLeverageResponse.unsignedBase64Tx,
498
502
  depositLeverageResponse.userRequestId,
503
+ false,
499
504
  );
500
505
 
501
506
  return txSig;
@@ -529,6 +534,7 @@ export class Client extends ApiClient {
529
534
  const txSig = await this.send(
530
535
  adjustLeverageResponse.unsignedBase64Tx,
531
536
  adjustLeverageResponse.userRequestId,
537
+ false,
532
538
  );
533
539
 
534
540
  return txSig;
@@ -566,6 +572,7 @@ export class Client extends ApiClient {
566
572
  const txSig = await this.send(
567
573
  withdrawLeverageResponse.unsignedBase64Tx,
568
574
  withdrawLeverageResponse.userRequestId,
575
+ false,
569
576
  );
570
577
 
571
578
  return txSig;
@@ -590,11 +597,16 @@ export class Client extends ApiClient {
590
597
  const txSig = await this.send(
591
598
  withdrawEmissionsResponse.unsignedBase64Tx,
592
599
  withdrawEmissionsResponse.userRequestId,
600
+ false,
593
601
  );
594
602
 
595
603
  return txSig;
596
604
  }
597
605
 
606
+ async handoffDepositLeverage(): Promise<string> {
607
+ return "";
608
+ }
609
+
598
610
  public async getPerformanceChartingExtension(
599
611
  clendAccount: web3.PublicKey,
600
612
  ): Promise<PositionChartingExtension> {
package/src/types.ts CHANGED
@@ -8,6 +8,7 @@ import { GroupChartingExtension } from "./charting/group";
8
8
  export interface SendRequest {
9
9
  userRequestId: string;
10
10
  txns: string[];
11
+ useJito: boolean;
11
12
  }
12
13
 
13
14
  /**