@carrot-protocol/boost-http-client 0.4.0-stub-position-endpoints-dev-666335f → 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";
@@ -79,5 +79,8 @@ export declare class Client extends ApiClient {
79
79
  * @returns Withdraw emissions operation result
80
80
  */
81
81
  withdrawEmissions(clendAccount: web3.PublicKey): Promise<string>;
82
- getExtension(extension: ExtensionKey): Promise<((clendAccount: web3.PublicKey) => PositionChartingExtension) | ((group: web3.PublicKey) => GroupChartingExtension) | ((address?: web3.PublicKey) => WalletChartingExtension) | ((bank: web3.PublicKey) => BankChartingExtension)>;
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
@@ -428,19 +428,17 @@ class Client extends api_1.ApiClient {
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/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-666335f",
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
@@ -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