@haven-fi/solauto-sdk 1.0.241 → 1.0.242
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/referralStateManager.d.ts.map +1 -1
- package/dist/clients/referralStateManager.js +6 -2
- package/dist/clients/solautoClient.d.ts.map +1 -1
- package/dist/clients/solautoClient.js +2 -3
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +3 -1
- package/package.json +1 -1
- package/src/clients/referralStateManager.ts +6 -2
- package/src/clients/solautoClient.ts +7 -6
- package/src/transactions/transactionsManager.ts +3 -1
- package/tests/transactions/solautoMarginfi.ts +11 -11
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"referralStateManager.d.ts","sourceRoot":"","sources":["../../src/clients/referralStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,MAAM,EAEN,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAEL,aAAa,EAGd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IAC1C,GAAG,EAAG,GAAG,CAAC;IACV,MAAM,EAAG,MAAM,CAAC;IAEhB,aAAa,EAAG,SAAS,CAAC;IAC1B,iBAAiB,EAAG,aAAa,GAAG,IAAI,CAAC;IACzC,SAAS,EAAG,SAAS,CAAC;IAEtB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,eAAe,CAAC,EA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,EAAE,SAAS,EACxB,WAAW,CAAC,EAAE,SAAS,GACtB,kBAAkB;IAerB,mBAAmB,IAAI,kBAAkB;IA+BnC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC3D"}
|
@@ -54,8 +54,12 @@ class ReferralStateManager extends txHandler_1.TxHandler {
|
|
54
54
|
signer: this.signer,
|
55
55
|
signerReferralState: (0, umi_1.publicKey)(this.referralState),
|
56
56
|
referralFeesDestMint: destFeesMint ? (0, umi_1.publicKey)(destFeesMint) : null,
|
57
|
-
referredByState:
|
58
|
-
|
57
|
+
referredByState: this.referredByState
|
58
|
+
? (0, umi_1.publicKey)(this.referredByState)
|
59
|
+
: undefined,
|
60
|
+
referredByAuthority: this.referredBy
|
61
|
+
? (0, umi_1.publicKey)(this.referredBy)
|
62
|
+
: undefined,
|
59
63
|
addressLookupTable: lookupTable ? (0, umi_1.publicKey)(lookupTable) : null,
|
60
64
|
});
|
61
65
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,MAAM,EACN,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAEhC,sBAAsB,EAKvB,MAAM,cAAc,CAAC;AAUtB,OAAO,
|
1
|
+
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,MAAM,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CAChB,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,wBAAwB,EACvC,eAAe,EAAE,eAAe,EAChC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,GACnC,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
|
@@ -110,6 +110,7 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
110
110
|
this.positionDebtTa,
|
111
111
|
this.referralState,
|
112
112
|
...(this.referredBySupplyTa() ? [this.referredBySupplyTa()] : []),
|
113
|
+
...(this.referredByDebtTa() ? [this.referredByDebtTa()] : []),
|
113
114
|
];
|
114
115
|
}
|
115
116
|
async fetchExistingAuthorityLutAccounts() {
|
@@ -149,9 +150,7 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
149
150
|
addresses: accountsToAdd,
|
150
151
|
})));
|
151
152
|
}
|
152
|
-
const addingReferredBy = accountsToAdd.length
|
153
|
-
accountsToAdd[0].toString().toLowerCase() ===
|
154
|
-
this.referredBySupplyTa()?.toString().toLowerCase();
|
153
|
+
const addingReferredBy = accountsToAdd.length <= 2;
|
155
154
|
if (tx.getInstructions().length > 0) {
|
156
155
|
this.log("Updating authority lookup table...");
|
157
156
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC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AiDrB,cAAc;YAqBd,eAAe;CAkD9B"}
|
@@ -250,14 +250,16 @@ class TransactionsManager {
|
|
250
250
|
for (const item of items) {
|
251
251
|
await item.initialize();
|
252
252
|
}
|
253
|
+
let choresBeforeName;
|
253
254
|
const [choresBefore, choresAfter] = await (0, transactionUtils_1.getTransactionChores)(client, (0, umi_1.transactionBuilder)().add(items
|
254
255
|
.filter((x) => x.tx && x.tx.getInstructions().length > 0)
|
255
256
|
.map((x) => x.tx)));
|
256
257
|
if (updateLookupTable && !updateLookupTable.needsToBeIsolated) {
|
257
258
|
choresBefore.prepend(updateLookupTable.updateLutTx);
|
259
|
+
choresBeforeName = "update lookup table";
|
258
260
|
}
|
259
261
|
if (choresBefore.getInstructions().length > 0) {
|
260
|
-
const chore = new TransactionItem(async () => ({ tx: choresBefore }));
|
262
|
+
const chore = new TransactionItem(async () => ({ tx: choresBefore, }), choresBeforeName);
|
261
263
|
await chore.initialize();
|
262
264
|
items.unshift(chore);
|
263
265
|
this.txHandler.log("Chores before: ", choresBefore.getInstructions().length);
|
package/package.json
CHANGED
@@ -106,8 +106,12 @@ export class ReferralStateManager extends TxHandler {
|
|
106
106
|
signer: this.signer,
|
107
107
|
signerReferralState: publicKey(this.referralState),
|
108
108
|
referralFeesDestMint: destFeesMint ? publicKey(destFeesMint) : null,
|
109
|
-
referredByState:
|
110
|
-
|
109
|
+
referredByState: this.referredByState
|
110
|
+
? publicKey(this.referredByState)
|
111
|
+
: undefined,
|
112
|
+
referredByAuthority: this.referredBy
|
113
|
+
? publicKey(this.referredBy)
|
114
|
+
: undefined,
|
111
115
|
addressLookupTable: lookupTable ? publicKey(lookupTable) : null,
|
112
116
|
});
|
113
117
|
}
|
@@ -36,7 +36,10 @@ import {
|
|
36
36
|
getWrappedInstruction,
|
37
37
|
splTokenTransferUmiIx,
|
38
38
|
} from "../utils/solanaUtils";
|
39
|
-
import {
|
39
|
+
import {
|
40
|
+
FlashLoanDetails,
|
41
|
+
RebalanceValues,
|
42
|
+
} from "../utils/solauto/rebalanceUtils";
|
40
43
|
import {
|
41
44
|
MIN_POSITION_STATE_FRESHNESS_SECS,
|
42
45
|
SOLAUTO_LUT,
|
@@ -170,7 +173,7 @@ export abstract class SolautoClient extends ReferralStateManager {
|
|
170
173
|
}
|
171
174
|
return undefined;
|
172
175
|
}
|
173
|
-
|
176
|
+
|
174
177
|
referredByDebtTa(): PublicKey | undefined {
|
175
178
|
if (this.referredByState !== undefined) {
|
176
179
|
return getTokenAccount(this.referredByState, this.debtMint);
|
@@ -226,6 +229,7 @@ export abstract class SolautoClient extends ReferralStateManager {
|
|
226
229
|
this.positionDebtTa,
|
227
230
|
this.referralState,
|
228
231
|
...(this.referredBySupplyTa() ? [this.referredBySupplyTa()!] : []),
|
232
|
+
...(this.referredByDebtTa() ? [this.referredByDebtTa()!] : []),
|
229
233
|
];
|
230
234
|
}
|
231
235
|
|
@@ -286,10 +290,7 @@ export abstract class SolautoClient extends ReferralStateManager {
|
|
286
290
|
);
|
287
291
|
}
|
288
292
|
|
289
|
-
const addingReferredBy =
|
290
|
-
accountsToAdd.length === 1 &&
|
291
|
-
accountsToAdd[0].toString().toLowerCase() ===
|
292
|
-
this.referredBySupplyTa()?.toString().toLowerCase();
|
293
|
+
const addingReferredBy = accountsToAdd.length <= 2;
|
293
294
|
|
294
295
|
if (tx.getInstructions().length > 0) {
|
295
296
|
this.log("Updating authority lookup table...");
|
@@ -372,6 +372,7 @@ export class TransactionsManager {
|
|
372
372
|
await item.initialize();
|
373
373
|
}
|
374
374
|
|
375
|
+
let choresBeforeName: string | undefined;
|
375
376
|
const [choresBefore, choresAfter] = await getTransactionChores(
|
376
377
|
client,
|
377
378
|
transactionBuilder().add(
|
@@ -382,9 +383,10 @@ export class TransactionsManager {
|
|
382
383
|
);
|
383
384
|
if (updateLookupTable && !updateLookupTable.needsToBeIsolated) {
|
384
385
|
choresBefore.prepend(updateLookupTable.updateLutTx);
|
386
|
+
choresBeforeName = "update lookup table";
|
385
387
|
}
|
386
388
|
if (choresBefore.getInstructions().length > 0) {
|
387
|
-
const chore = new TransactionItem(async () => ({ tx: choresBefore }));
|
389
|
+
const chore = new TransactionItem(async () => ({ tx: choresBefore, }), choresBeforeName);
|
388
390
|
await chore.initialize();
|
389
391
|
items.unshift(chore);
|
390
392
|
this.txHandler.log(
|
@@ -30,7 +30,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
30
30
|
// const signer = setupTest("solauto-manager");
|
31
31
|
|
32
32
|
const payForTransactions = false;
|
33
|
-
const positionId =
|
33
|
+
const positionId = 1;
|
34
34
|
|
35
35
|
it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
|
36
36
|
const client = new SolautoMarginfiClient(
|
@@ -73,16 +73,16 @@ describe("Solauto Marginfi tests", async () => {
|
|
73
73
|
// );
|
74
74
|
|
75
75
|
// // const initialSupplyUsd = 150;
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
76
|
+
// transactionItems.push(
|
77
|
+
// new TransactionItem(async () => {
|
78
|
+
// // const [supplyPrice] = await fetchTokenPrices([supply]);
|
79
|
+
// return {
|
80
|
+
// tx: client.protocolInteraction(
|
81
|
+
// solautoAction("Deposit", [toBaseUnit(0.5, supplyDecimals)])
|
82
|
+
// ),
|
83
|
+
// };
|
84
|
+
// }, "deposit")
|
85
|
+
// );
|
86
86
|
// }
|
87
87
|
|
88
88
|
// const maxLtvBps = client.solautoPositionState!.maxLtvBps;
|