@haven-fi/solauto-sdk 1.0.104 → 1.0.106
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAOnB,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;AAKvD,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,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,8BAAsB,aAAc,SAAQ,SAAS;IAmC1C,SAAS,CAAC,EAAE,OAAO;IAlCrB,eAAe,EAAG,eAAe,CAAC;IAElC,SAAS,EAAG,SAAS,CAAC;IACtB,MAAM,EAAG,MAAM,CAAC;IAEh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AAQ,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"}
|
@@ -127,7 +127,6 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
127
127
|
const lookupTable = this.authorityLutAddress
|
128
128
|
? await this.connection.getAddressLookupTable(this.authorityLutAddress)
|
129
129
|
: null;
|
130
|
-
console.log(lookupTable?.value);
|
131
130
|
if (!lookupTable || lookupTable?.value === null) {
|
132
131
|
this.authorityLutAddress = undefined;
|
133
132
|
}
|
package/package.json
CHANGED
@@ -265,7 +265,6 @@ export abstract class SolautoClient extends TxHandler {
|
|
265
265
|
const lookupTable = this.authorityLutAddress
|
266
266
|
? await this.connection.getAddressLookupTable(this.authorityLutAddress)
|
267
267
|
: null;
|
268
|
-
console.log(lookupTable?.value);
|
269
268
|
if (!lookupTable || lookupTable?.value === null) {
|
270
269
|
this.authorityLutAddress = undefined;
|
271
270
|
}
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -290,7 +290,6 @@ export async function sendSingleOptimizedTransaction(
|
|
290
290
|
const feeEstimate = await getComputeUnitPriceEstimate(umi, tx, prioritySetting);
|
291
291
|
console.log("Compute unit price: ", feeEstimate);
|
292
292
|
|
293
|
-
console.log(tx.getInstructions());
|
294
293
|
const simulationResult = await retryWithExponentialBackoff(
|
295
294
|
async () =>
|
296
295
|
await simulateTransaction(
|
@@ -21,13 +21,15 @@ import { USDC_MINT } from "../../src/constants";
|
|
21
21
|
|
22
22
|
describe("Solauto Marginfi tests", async () => {
|
23
23
|
// const signer = setupTest();
|
24
|
-
const signer = setupTest("solauto-manager");
|
24
|
+
// const signer = setupTest("solauto-manager");
|
25
|
+
const signer = setupTest("newtest");
|
25
26
|
|
26
27
|
const payForTransactions = false;
|
27
28
|
const useJitoBundle = false;
|
28
|
-
const positionId =
|
29
|
+
const positionId = 1;
|
29
30
|
|
30
31
|
it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
|
32
|
+
|
31
33
|
const client = new SolautoMarginfiClient(process.env.HELIUS_API_KEY!, true);
|
32
34
|
|
33
35
|
const supply = NATIVE_MINT;
|
@@ -38,12 +40,12 @@ describe("Solauto Marginfi tests", async () => {
|
|
38
40
|
{
|
39
41
|
signer,
|
40
42
|
positionId,
|
41
|
-
authority: new PublicKey("AprYCPiVeKMCgjQ2ZufwChMzvQ5kFjJo2ekTLSkXsQDm")
|
43
|
+
// authority: new PublicKey("AprYCPiVeKMCgjQ2ZufwChMzvQ5kFjJo2ekTLSkXsQDm")
|
42
44
|
// marginfiAccount: new PublicKey(
|
43
45
|
// "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
|
44
46
|
// ),
|
45
|
-
|
46
|
-
|
47
|
+
supplyMint: NATIVE_MINT,
|
48
|
+
debtMint: new PublicKey(USDC_MINT),
|
47
49
|
}
|
48
50
|
);
|
49
51
|
|
@@ -58,13 +60,13 @@ describe("Solauto Marginfi tests", async () => {
|
|
58
60
|
};
|
59
61
|
|
60
62
|
// if (client.solautoPositionData === null) {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
transactionItems.push(
|
64
|
+
new TransactionItem(async () => {
|
65
|
+
return {
|
66
|
+
tx: client.openPosition(settingParams),
|
67
|
+
};
|
68
|
+
}, "open position")
|
69
|
+
);
|
68
70
|
|
69
71
|
// const initialSupplyUsd = 150;
|
70
72
|
// transactionItems.push(
|
@@ -105,19 +107,19 @@ describe("Solauto Marginfi tests", async () => {
|
|
105
107
|
// )
|
106
108
|
// );
|
107
109
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
110
|
+
const initialSupplyUsd = 50;
|
111
|
+
transactionItems.push(
|
112
|
+
new TransactionItem(async () => {
|
113
|
+
const [supplyPrice] = await getTokenPrices([supply]);
|
114
|
+
return {
|
115
|
+
tx: client.protocolInteraction(
|
116
|
+
solautoAction("Deposit", [
|
117
|
+
toBaseUnit(initialSupplyUsd / supplyPrice, supplyDecimals),
|
118
|
+
])
|
119
|
+
),
|
120
|
+
};
|
121
|
+
}, "deposit")
|
122
|
+
);
|
121
123
|
|
122
124
|
transactionItems.push(
|
123
125
|
new TransactionItem(
|
@@ -154,11 +156,12 @@ describe("Solauto Marginfi tests", async () => {
|
|
154
156
|
// )
|
155
157
|
// );
|
156
158
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
await new TransactionsManager(
|
160
|
+
client,
|
161
|
+
undefined,
|
162
|
+
!payForTransactions,
|
163
|
+
useJitoBundle
|
164
|
+
).clientSend(transactionItems);
|
165
|
+
|
163
166
|
});
|
164
167
|
});
|