@haven-fi/solauto-sdk 1.0.95 → 1.0.96
Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ import { ReferralStateManager } from "./referralStateManager";
|
|
10
10
|
import { TxHandler } from "./txHandler";
|
11
11
|
export interface SolautoClientArgs {
|
12
12
|
authority?: PublicKey;
|
13
|
-
positionId
|
13
|
+
positionId?: number;
|
14
14
|
signer?: Signer;
|
15
15
|
wallet?: WalletAdapter;
|
16
16
|
supplyMint?: PublicKey;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAGL,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAQnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EAMvB,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO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,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,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
|
@@ -35,7 +35,7 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
35
35
|
: (0, umi_signer_wallet_adapters_1.walletAdapterIdentity)(args.wallet, true));
|
36
36
|
this.signer = this.umi.identity;
|
37
37
|
this.authority = args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey);
|
38
|
-
this.positionId = args.positionId;
|
38
|
+
this.positionId = args.positionId ?? 0;
|
39
39
|
this.selfManaged = this.positionId === 0;
|
40
40
|
this.lendingPlatform = lendingPlatform;
|
41
41
|
this.solautoPosition = (0, accountUtils_1.getSolautoPositionAccount)(this.authority, this.positionId);
|
@@ -344,7 +344,8 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
344
344
|
return tx;
|
345
345
|
}
|
346
346
|
async getFreshPositionState() {
|
347
|
-
if (Boolean(this.
|
347
|
+
if (Boolean(this.solautoPositionData) &&
|
348
|
+
Boolean(this.solautoPositionState) &&
|
348
349
|
Number(this.solautoPositionState.lastUpdated) >
|
349
350
|
(0, generalUtils_1.currentUnixSeconds)() - solautoConstants_1.MIN_POSITION_STATE_FRESHNESS_SECS &&
|
350
351
|
!this.livePositionUpdates.hasUpdates()) {
|
package/package.json
CHANGED
@@ -63,7 +63,7 @@ import { TxHandler } from "./txHandler";
|
|
63
63
|
|
64
64
|
export interface SolautoClientArgs {
|
65
65
|
authority?: PublicKey;
|
66
|
-
positionId
|
66
|
+
positionId?: number;
|
67
67
|
signer?: Signer;
|
68
68
|
wallet?: WalletAdapter;
|
69
69
|
|
@@ -133,7 +133,7 @@ export abstract class SolautoClient extends TxHandler {
|
|
133
133
|
this.signer = this.umi.identity;
|
134
134
|
this.authority = args.authority ?? toWeb3JsPublicKey(this.signer.publicKey);
|
135
135
|
|
136
|
-
this.positionId = args.positionId;
|
136
|
+
this.positionId = args.positionId ?? 0;
|
137
137
|
this.selfManaged = this.positionId === 0;
|
138
138
|
this.lendingPlatform = lendingPlatform;
|
139
139
|
this.solautoPosition = getSolautoPositionAccount(
|
@@ -586,6 +586,7 @@ export abstract class SolautoClient extends TxHandler {
|
|
586
586
|
|
587
587
|
async getFreshPositionState(): Promise<PositionState | undefined> {
|
588
588
|
if (
|
589
|
+
Boolean(this.solautoPositionData) &&
|
589
590
|
Boolean(this.solautoPositionState) &&
|
590
591
|
Number(this.solautoPositionState!.lastUpdated) >
|
591
592
|
currentUnixSeconds() - MIN_POSITION_STATE_FRESHNESS_SECS &&
|