@haven-fi/solauto-sdk 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,8 @@ export interface SolautoClientArgs {
17
17
  referredByAuthority?: PublicKey;
18
18
  }
19
19
  export declare abstract class SolautoClient {
20
- localTest: boolean;
20
+ private heliusApiKey;
21
+ localTest?: boolean | undefined;
21
22
  umi: Umi;
22
23
  connection: Connection;
23
24
  lendingPlatform: LendingPlatform;
@@ -46,8 +47,8 @@ export declare abstract class SolautoClient {
46
47
  authorityLutAddress?: PublicKey;
47
48
  upToDateLutAccounts: PublicKey[];
48
49
  livePositionUpdates: LivePositionUpdates;
49
- constructor(localTest?: boolean);
50
- baseInitialize(args: SolautoClientArgs, lendingPlatform: LendingPlatform, heliusApiKey: string): Promise<void>;
50
+ constructor(heliusApiKey: string, localTest?: boolean | undefined);
51
+ initialize(args: SolautoClientArgs, lendingPlatform: LendingPlatform): Promise<void>;
51
52
  log(...args: any[]): void;
52
53
  resetLivePositionUpdates(): Promise<void>;
53
54
  defaultLookupTables(): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,UAAU,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAQJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EASvB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AA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EAAE;IAK/B,gBAAgB,IAAI,SAAS,EAAE;IAiBzB,iCAAiC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAUzD,iBAAiB,IAAI,OAAO,CAChC;QAAE,WAAW,EAAE,kBAAkB,CAAC;QAAC,iBAAiB,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAC5E;IAwDD,uBAAuB,IAAI,yBAAyB,GAAG,SAAS;IAOhE,wBAAwB,IAAI,WAAW,GAAG,SAAS;IAOnD,sBAAsB,IAAI,kBAAkB;IAiB5C,mBAAmB,IAAI,kBAAkB;IAmBzC,YAAY,CACV,aAAa,CAAC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAuBrB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB;IA2DlE,eAAe,IAAI,kBAAkB;IAWrC,WAAW,IAAI,kBAAkB;IA4BjC,QAAQ,CAAC,OAAO,IAAI,kBAAkB;IAEtC,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAuFhE,QAAQ,CAAC,WAAW,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IAErB,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAE3E,QAAQ,CAAC,SAAS,CAChB,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAYlE"}
@@ -16,17 +16,18 @@ const generalUtils_1 = require("../utils/generalUtils");
16
16
  const generalUtils_2 = require("../utils/solauto/generalUtils");
17
17
  const umi_bundle_defaults_1 = require("@metaplex-foundation/umi-bundle-defaults");
18
18
  class SolautoClient {
19
- constructor(localTest) {
19
+ constructor(heliusApiKey, localTest) {
20
+ this.heliusApiKey = heliusApiKey;
21
+ this.localTest = localTest;
20
22
  this.livePositionUpdates = new generalUtils_2.LivePositionUpdates();
21
- this.localTest = Boolean(localTest);
22
- }
23
- async baseInitialize(args, lendingPlatform, heliusApiKey) {
24
- this.connection = new web3_js_1.Connection(`https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`, "finalized");
23
+ this.connection = new web3_js_1.Connection(`https://mainnet.helius-rpc.com/?api-key=${this.heliusApiKey}`, "finalized");
25
24
  this.umi = (0, umi_bundle_defaults_1.createUmi)(this.connection).use({
26
25
  install(umi) {
27
26
  umi.programs.add((0, generated_1.createSolautoProgram)(), false);
28
27
  },
29
28
  });
29
+ }
30
+ async initialize(args, lendingPlatform) {
30
31
  if (!args.signer && !args.wallet) {
31
32
  throw new Error("Signer or wallet must be provided");
32
33
  }
@@ -24,7 +24,7 @@ export declare class SolautoMarginfiClient extends SolautoClient {
24
24
  intermediaryMarginfiAccountSigner?: Signer;
25
25
  intermediaryMarginfiAccountPk: PublicKey;
26
26
  intermediaryMarginfiAccount?: MarginfiAccount;
27
- initialize(args: SolautoMarginfiClientArgs, heliusApiKey: string): Promise<void>;
27
+ initialize(args: SolautoMarginfiClientArgs): Promise<void>;
28
28
  defaultLookupTables(): string[];
29
29
  lutAccountsToAdd(): PublicKey[];
30
30
  openPosition(settingParams?: SolautoSettingsParametersInpArgs, dca?: DCASettingsInpArgs): TransactionBuilder;
@@ -1 +1 @@
1
- {"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,MAAM,EACN,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,SAAS,EAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAA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BAA6B;IA8DrC,SAAS,CACP,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IA4CrB,WAAW,CACT,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IA2BrB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IA8ElE,iCAAiC,IAAI,kBAAkB;IASjD,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAiBlE"}
@@ -25,11 +25,11 @@ function newMarginfiSolautoManagedPositionArgs(positionId, signer, wallet, suppl
25
25
  }
26
26
  exports.newMarginfiSolautoManagedPositionArgs = newMarginfiSolautoManagedPositionArgs;
27
27
  class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
28
- async initialize(args, heliusApiKey) {
28
+ async initialize(args) {
29
29
  if (args.marginfiAccount) {
30
30
  this.marginfiAccount = args.marginfiAccount;
31
31
  }
32
- await this.baseInitialize(args, generated_1.LendingPlatform.Marginfi, heliusApiKey);
32
+ await super.initialize(args, generated_1.LendingPlatform.Marginfi);
33
33
  this.marginfiAccountSeedIdx = args.marginfiAccountSeedIdx;
34
34
  this.marginfiAccount =
35
35
  this.marginfiAccountSeedIdx !== undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -74,8 +74,6 @@ export interface SolautoClientArgs {
74
74
  }
75
75
 
76
76
  export abstract class SolautoClient {
77
- public localTest: boolean;
78
-
79
77
  public umi!: Umi;
80
78
  public connection!: Connection;
81
79
  public lendingPlatform!: LendingPlatform;
@@ -114,17 +112,12 @@ export abstract class SolautoClient {
114
112
 
115
113
  public livePositionUpdates: LivePositionUpdates = new LivePositionUpdates();
116
114
 
117
- constructor(localTest?: boolean) {
118
- this.localTest = Boolean(localTest);
119
- }
120
-
121
- async baseInitialize(
122
- args: SolautoClientArgs,
123
- lendingPlatform: LendingPlatform,
124
- heliusApiKey: string
115
+ constructor(
116
+ private heliusApiKey: string,
117
+ public localTest?: boolean
125
118
  ) {
126
119
  this.connection = new Connection(
127
- `https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`,
120
+ `https://mainnet.helius-rpc.com/?api-key=${this.heliusApiKey}`,
128
121
  "finalized"
129
122
  );
130
123
  this.umi = createUmi(this.connection).use({
@@ -132,6 +125,12 @@ export abstract class SolautoClient {
132
125
  umi.programs.add(createSolautoProgram(), false);
133
126
  },
134
127
  });
128
+ }
129
+
130
+ async initialize(
131
+ args: SolautoClientArgs,
132
+ lendingPlatform: LendingPlatform,
133
+ ) {
135
134
  if (!args.signer && !args.wallet) {
136
135
  throw new Error("Signer or wallet must be provided");
137
136
  }
@@ -98,12 +98,12 @@ export class SolautoMarginfiClient extends SolautoClient {
98
98
  public intermediaryMarginfiAccountPk!: PublicKey;
99
99
  public intermediaryMarginfiAccount?: MarginfiAccount;
100
100
 
101
- async initialize(args: SolautoMarginfiClientArgs, heliusApiKey: string) {
101
+ async initialize(args: SolautoMarginfiClientArgs) {
102
102
  if (args.marginfiAccount) {
103
103
  this.marginfiAccount = args.marginfiAccount;
104
104
  }
105
105
 
106
- await this.baseInitialize(args, LendingPlatform.Marginfi, heliusApiKey);
106
+ await super.initialize(args, LendingPlatform.Marginfi);
107
107
 
108
108
  this.marginfiAccountSeedIdx = args.marginfiAccountSeedIdx;
109
109
  this.marginfiAccount =
@@ -26,7 +26,7 @@ describe("Solauto Marginfi tests", async () => {
26
26
  const positionId = 1;
27
27
 
28
28
  it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
29
- const client = new SolautoMarginfiClient(true);
29
+ const client = new SolautoMarginfiClient(process.env.HELIUS_API_KEY!, true);
30
30
 
31
31
  const supply = NATIVE_MINT;
32
32
  const supplyDecimals = 9;
@@ -43,8 +43,7 @@ describe("Solauto Marginfi tests", async () => {
43
43
  {
44
44
  signer,
45
45
  positionId,
46
- },
47
- process.env.HELIUS_API_KEY!
46
+ }
48
47
  );
49
48
 
50
49
  const transactionItems: TransactionItem[] = [];