@carrot-protocol/boost-http-client 0.4.0-stub-position-endpoints-dev-2ccd3c3 → 0.4.0-stub-position-endpoints-dev-be5af0a

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
@@ -1,5 +1,5 @@
1
1
  import { AnchorProvider, web3 } from "@coral-xyz/anchor";
2
- import { GetBankResponse, GetUserResponse, GetGroupResponse, GetUserRequest, GetGroupsResponse, GetAccountResponse, GetAccountRequest, ExtensionKey } from "./types";
2
+ import { GetBankResponse, GetUserResponse, GetGroupResponse, GetUserRequest, GetGroupsResponse, GetAccountResponse, GetAccountRequest } from "./types";
3
3
  import { ApiClient } from "./api";
4
4
  import { PositionChartingExtension } from "./charting/position";
5
5
  import { BankChartingExtension } from "./charting/bank";
@@ -78,6 +78,9 @@ export declare class Client extends ApiClient {
78
78
  * Withdraw emissions from a bank
79
79
  * @returns Withdraw emissions operation result
80
80
  */
81
- withdrawEmissions(): Promise<string>;
82
- getExtension(extension: ExtensionKey): Promise<((clendAccount: web3.PublicKey) => PositionChartingExtension) | ((group: web3.PublicKey) => GroupChartingExtension) | ((address?: web3.PublicKey) => WalletChartingExtension) | ((bank: web3.PublicKey) => BankChartingExtension)>;
81
+ withdrawEmissions(clendAccount: web3.PublicKey): Promise<string>;
82
+ getPerformanceChartingExtension(clendAccount: web3.PublicKey): Promise<PositionChartingExtension>;
83
+ getGroupChartingExtension(group: web3.PublicKey): Promise<GroupChartingExtension>;
84
+ getWalletChartingExtension(address?: web3.PublicKey): Promise<WalletChartingExtension>;
85
+ getBankChartingExtension(bank: web3.PublicKey): Promise<BankChartingExtension>;
83
86
  }
package/dist/index.js CHANGED
@@ -419,28 +419,26 @@ class Client extends api_1.ApiClient {
419
419
  * Withdraw emissions from a bank
420
420
  * @returns Withdraw emissions operation result
421
421
  */
422
- async withdrawEmissions() {
422
+ async withdrawEmissions(clendAccount) {
423
423
  const req = {
424
- owner: this.address(),
424
+ clendAccount,
425
425
  };
426
426
  const body = await this.handleApiCall(() => this.http.post("emissions/withdraw", JSON.stringify(req)));
427
427
  const withdrawEmissionsResponse = JSON.parse(body);
428
428
  const txSig = await this.send(withdrawEmissionsResponse.unsignedBase64Tx, withdrawEmissionsResponse.userRequestId);
429
429
  return txSig;
430
430
  }
431
- async getExtension(extension) {
432
- switch (extension) {
433
- case "positionCharting":
434
- return (clendAccount) => new position_1.PositionChartingExtension(this.baseUrl, clendAccount);
435
- case "groupCharting":
436
- return (group) => new group_1.GroupChartingExtension(this.baseUrl, group);
437
- case "walletCharting":
438
- return (address) => new wallet_1.WalletChartingExtension(this.baseUrl, address ?? this.address());
439
- case "bankCharting":
440
- return (bank) => new bank_1.BankChartingExtension(this.baseUrl, bank);
441
- default:
442
- throw new Error(`Unknown extension: ${extension}`);
443
- }
431
+ async getPerformanceChartingExtension(clendAccount) {
432
+ return new position_1.PositionChartingExtension(this.baseUrl, clendAccount);
433
+ }
434
+ async getGroupChartingExtension(group) {
435
+ return new group_1.GroupChartingExtension(this.baseUrl, group);
436
+ }
437
+ async getWalletChartingExtension(address) {
438
+ return new wallet_1.WalletChartingExtension(this.baseUrl, address ?? this.address());
439
+ }
440
+ async getBankChartingExtension(bank) {
441
+ return new bank_1.BankChartingExtension(this.baseUrl, bank);
444
442
  }
445
443
  }
446
444
  exports.Client = Client;
package/dist/types.d.ts CHANGED
@@ -95,7 +95,7 @@ export interface WithdrawLeverageResponse {
95
95
  * Request to withdraw emissions from a bank
96
96
  */
97
97
  export interface WithdrawEmissionsRequest {
98
- owner: web3.PublicKey;
98
+ clendAccount: web3.PublicKey;
99
99
  }
100
100
  /**
101
101
  * Response for withdraw emissions operation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/boost-http-client",
3
- "version": "0.4.0-stub-position-endpoints-dev-2ccd3c3",
3
+ "version": "0.4.0-stub-position-endpoints-dev-be5af0a",
4
4
  "description": "HTTP client for Carrot Boost",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -586,9 +586,9 @@ export class Client extends ApiClient {
586
586
  * Withdraw emissions from a bank
587
587
  * @returns Withdraw emissions operation result
588
588
  */
589
- async withdrawEmissions(): Promise<string> {
589
+ async withdrawEmissions(clendAccount: web3.PublicKey): Promise<string> {
590
590
  const req: WithdrawEmissionsRequest = {
591
- owner: this.address(),
591
+ clendAccount,
592
592
  };
593
593
 
594
594
  const body = await this.handleApiCall(() =>
@@ -606,23 +606,28 @@ export class Client extends ApiClient {
606
606
  return txSig;
607
607
  }
608
608
 
609
- public async getExtension(extension: ExtensionKey) {
610
- switch (extension) {
611
- case "positionCharting":
612
- return (clendAccount: web3.PublicKey) =>
613
- new PositionChartingExtension(this.baseUrl, clendAccount);
614
- case "groupCharting":
615
- return (group: web3.PublicKey) =>
616
- new GroupChartingExtension(this.baseUrl, group);
617
- case "walletCharting":
618
- return (address?: web3.PublicKey) =>
619
- new WalletChartingExtension(this.baseUrl, address ?? this.address());
620
- case "bankCharting":
621
- return (bank: web3.PublicKey) =>
622
- new BankChartingExtension(this.baseUrl, bank);
623
- default:
624
- throw new Error(`Unknown extension: ${extension}`);
625
- }
609
+ public async getPerformanceChartingExtension(
610
+ clendAccount: web3.PublicKey,
611
+ ): Promise<PositionChartingExtension> {
612
+ return new PositionChartingExtension(this.baseUrl, clendAccount);
613
+ }
614
+
615
+ public async getGroupChartingExtension(
616
+ group: web3.PublicKey,
617
+ ): Promise<GroupChartingExtension> {
618
+ return new GroupChartingExtension(this.baseUrl, group);
619
+ }
620
+
621
+ public async getWalletChartingExtension(
622
+ address?: web3.PublicKey,
623
+ ): Promise<WalletChartingExtension> {
624
+ return new WalletChartingExtension(this.baseUrl, address ?? this.address());
625
+ }
626
+
627
+ public async getBankChartingExtension(
628
+ bank: web3.PublicKey,
629
+ ): Promise<BankChartingExtension> {
630
+ return new BankChartingExtension(this.baseUrl, bank);
626
631
  }
627
632
  }
628
633
 
package/src/types.ts CHANGED
@@ -108,7 +108,7 @@ export interface WithdrawLeverageResponse {
108
108
  * Request to withdraw emissions from a bank
109
109
  */
110
110
  export interface WithdrawEmissionsRequest {
111
- owner: web3.PublicKey;
111
+ clendAccount: web3.PublicKey;
112
112
  }
113
113
 
114
114
  /**