@haven-fi/solauto-sdk 1.0.25 → 1.0.27
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/solautoClient.d.ts +4 -4
- package/dist/clients/solautoClient.d.ts.map +1 -1
- package/dist/clients/solautoClient.js +25 -23
- package/dist/clients/solautoMarginfiClient.d.ts +1 -0
- package/dist/clients/solautoMarginfiClient.d.ts.map +1 -1
- package/dist/clients/solautoMarginfiClient.js +84 -23
- package/dist/generated/instructions/closePosition.d.ts +4 -4
- package/dist/generated/instructions/closePosition.d.ts.map +1 -1
- package/dist/generated/instructions/closePosition.js +8 -8
- package/dist/generated/instructions/marginfiProtocolInteraction.d.ts +2 -2
- package/dist/generated/instructions/marginfiProtocolInteraction.d.ts.map +1 -1
- package/dist/generated/instructions/marginfiProtocolInteraction.js +4 -4
- package/dist/generated/instructions/marginfiRebalance.d.ts +2 -0
- package/dist/generated/instructions/marginfiRebalance.d.ts.map +1 -1
- package/dist/generated/instructions/marginfiRebalance.js +17 -7
- package/dist/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/transactions/transactionUtils.js +111 -21
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +6 -2
- package/dist/types/solauto.d.ts +13 -0
- package/dist/types/solauto.d.ts.map +1 -0
- package/dist/types/solauto.js +2 -0
- package/dist/utils/jupiterUtils.d.ts.map +1 -1
- package/dist/utils/jupiterUtils.js +1 -0
- package/dist/utils/marginfiUtils.d.ts +5 -1
- package/dist/utils/marginfiUtils.d.ts.map +1 -1
- package/dist/utils/marginfiUtils.js +8 -2
- package/dist/utils/solauto/generalUtils.d.ts +1 -5
- package/dist/utils/solauto/generalUtils.d.ts.map +1 -1
- package/dist/utils/solauto/generalUtils.js +6 -2
- package/dist/utils/solauto/rebalanceUtils.js +2 -1
- package/package.json +1 -1
- package/src/clients/solautoClient.ts +33 -31
- package/src/clients/solautoMarginfiClient.ts +89 -31
- package/src/generated/instructions/closePosition.ts +12 -12
- package/src/generated/instructions/marginfiProtocolInteraction.ts +6 -6
- package/src/generated/instructions/marginfiRebalance.ts +19 -7
- package/src/transactions/transactionUtils.ts +140 -36
- package/src/transactions/transactionsManager.ts +8 -6
- package/src/types/solauto.ts +14 -0
- package/src/utils/jupiterUtils.ts +1 -0
- package/src/utils/marginfiUtils.ts +11 -3
- package/src/utils/solauto/generalUtils.ts +21 -12
- package/src/utils/solauto/rebalanceUtils.ts +2 -2
- package/tests/transactions/solautoMarginfi.ts +44 -25
- package/tests/unit/lookupTables.ts +4 -3
@@ -13,6 +13,7 @@ const generalUtils_1 = require("../utils/generalUtils");
|
|
13
13
|
const numberUtils_1 = require("../utils/numberUtils");
|
14
14
|
const generalUtils_2 = require("../utils/solauto/generalUtils");
|
15
15
|
const accountUtils_1 = require("../utils/accountUtils");
|
16
|
+
const marginfi_sdk_1 = require("../marginfi-sdk");
|
16
17
|
function getWSolUsage(client, solautoActions, initiatingDcaIn, cancellingDcaIn) {
|
17
18
|
const supplyIsWsol = client.supplyMint.equals(spl_token_1.NATIVE_MINT);
|
18
19
|
const debtIsWsol = client.debtMint.equals(spl_token_1.NATIVE_MINT);
|
@@ -26,13 +27,13 @@ function getWSolUsage(client, solautoActions, initiatingDcaIn, cancellingDcaIn)
|
|
26
27
|
cancellingDcaIn);
|
27
28
|
if (supplyIsWsol && usingSupplyTaAction) {
|
28
29
|
return {
|
29
|
-
wSolTokenAccount: client.
|
30
|
+
wSolTokenAccount: client.signerSupplyTa,
|
30
31
|
solautoAction: usingSupplyTaAction,
|
31
32
|
};
|
32
33
|
}
|
33
34
|
else if (debtIsWsol && usingDebtTaAction) {
|
34
35
|
return {
|
35
|
-
wSolTokenAccount: client.
|
36
|
+
wSolTokenAccount: client.signerDebtTa,
|
36
37
|
solautoAction: usingDebtTaAction,
|
37
38
|
};
|
38
39
|
}
|
@@ -57,21 +58,21 @@ async function transactionChoresBefore(client, solautoActions, initiatingDcaIn)
|
|
57
58
|
}
|
58
59
|
const wSolUsage = getWSolUsage(client, solautoActions, initiatingDcaIn, undefined);
|
59
60
|
if (wSolUsage !== undefined) {
|
60
|
-
if (
|
61
|
+
if (await (0, generalUtils_1.getSolanaAccountCreated)(client.umi, wSolUsage.wSolTokenAccount)) {
|
61
62
|
client.log(`Closing signer wSol TA`);
|
62
63
|
chores = chores.add((0, solanaUtils_1.closeTokenAccountUmiIx)(client.signer, wSolUsage.wSolTokenAccount, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey)));
|
63
64
|
}
|
64
65
|
let amountToTransfer = BigInt(0);
|
65
66
|
if ((0, generated_1.isSolautoAction)("Deposit", wSolUsage.solautoAction)) {
|
66
|
-
amountToTransfer
|
67
|
+
amountToTransfer = BigInt(wSolUsage.solautoAction.fields[0]);
|
67
68
|
}
|
68
69
|
else if ((0, generated_1.isSolautoAction)("Repay", wSolUsage.solautoAction) &&
|
69
70
|
wSolUsage.solautoAction.fields[0].__kind === "Some") {
|
70
|
-
amountToTransfer
|
71
|
+
amountToTransfer = BigInt(wSolUsage.solautoAction.fields[0].fields[0]);
|
71
72
|
}
|
72
73
|
else if (initiatingDcaIn &&
|
73
74
|
client.debtMint.toString() === spl_token_1.NATIVE_MINT.toString()) {
|
74
|
-
amountToTransfer
|
75
|
+
amountToTransfer = initiatingDcaIn;
|
75
76
|
}
|
76
77
|
if (amountToTransfer > 0) {
|
77
78
|
const amount = amountToTransfer +
|
@@ -89,8 +90,8 @@ async function transactionChoresBefore(client, solautoActions, initiatingDcaIn)
|
|
89
90
|
continue;
|
90
91
|
}
|
91
92
|
const tokenAccount = (0, generated_1.isSolautoAction)("Withdraw", solautoAction)
|
92
|
-
? client.
|
93
|
-
: client.
|
93
|
+
? client.signerSupplyTa
|
94
|
+
: client.signerDebtTa;
|
94
95
|
if (accountsGettingCreated.includes(tokenAccount.toString())) {
|
95
96
|
continue;
|
96
97
|
}
|
@@ -148,22 +149,111 @@ function transactionChoresAfter(client, solautoActions, cancellingDcaIn) {
|
|
148
149
|
function getSolautoActions(tx) {
|
149
150
|
let solautoActions = [];
|
150
151
|
tx.getInstructions().forEach((x) => {
|
151
|
-
if (x.programId
|
152
|
-
|
152
|
+
if (x.programId === generated_1.SOLAUTO_PROGRAM_ID) {
|
153
|
+
try {
|
154
|
+
const serializer = (0, generated_1.getMarginfiProtocolInteractionInstructionDataSerializer)();
|
155
|
+
const discriminator = serializer
|
156
|
+
.serialize({
|
157
|
+
solautoAction: (0, generated_1.solautoAction)("Deposit", [BigInt(0)]),
|
158
|
+
})
|
159
|
+
.slice(0, 1)[0];
|
160
|
+
const [data, _] = serializer.deserialize(x.data);
|
161
|
+
if (data.discriminator === discriminator) {
|
162
|
+
solautoActions?.push(data.solautoAction);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
catch { }
|
153
166
|
}
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
.
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
167
|
+
if (x.programId === marginfi_sdk_1.MARGINFI_PROGRAM_ID) {
|
168
|
+
try {
|
169
|
+
const serializer = (0, marginfi_sdk_1.getLendingAccountDepositInstructionDataSerializer)();
|
170
|
+
const discriminator = (0, numberUtils_1.uint8ArrayToBigInt)(serializer
|
171
|
+
.serialize({
|
172
|
+
amount: 0,
|
173
|
+
})
|
174
|
+
.slice(0, 8));
|
175
|
+
const [data, _] = serializer.deserialize(x.data);
|
176
|
+
if ((0, numberUtils_1.uint8ArrayToBigInt)(new Uint8Array(data.discriminator)) ===
|
177
|
+
discriminator) {
|
178
|
+
solautoActions?.push({
|
179
|
+
__kind: "Deposit",
|
180
|
+
fields: [data.amount],
|
181
|
+
});
|
182
|
+
}
|
183
|
+
}
|
184
|
+
catch { }
|
185
|
+
try {
|
186
|
+
const serializer = (0, marginfi_sdk_1.getLendingAccountBorrowInstructionDataSerializer)();
|
187
|
+
const discriminator = (0, numberUtils_1.uint8ArrayToBigInt)(serializer
|
188
|
+
.serialize({
|
189
|
+
amount: 0,
|
190
|
+
})
|
191
|
+
.slice(0, 8));
|
192
|
+
const [data, _] = serializer.deserialize(x.data);
|
193
|
+
if ((0, numberUtils_1.uint8ArrayToBigInt)(new Uint8Array(data.discriminator)) ===
|
194
|
+
discriminator) {
|
195
|
+
solautoActions?.push({
|
196
|
+
__kind: "Borrow",
|
197
|
+
fields: [data.amount],
|
198
|
+
});
|
199
|
+
}
|
200
|
+
}
|
201
|
+
catch { }
|
202
|
+
try {
|
203
|
+
const serializer = (0, marginfi_sdk_1.getLendingAccountWithdrawInstructionDataSerializer)();
|
204
|
+
const discriminator = (0, numberUtils_1.uint8ArrayToBigInt)(serializer
|
205
|
+
.serialize({
|
206
|
+
amount: 0,
|
207
|
+
withdrawAll: false,
|
208
|
+
})
|
209
|
+
.slice(0, 8));
|
210
|
+
const [data, _] = serializer.deserialize(x.data);
|
211
|
+
if ((0, numberUtils_1.uint8ArrayToBigInt)(new Uint8Array(data.discriminator)) ===
|
212
|
+
discriminator) {
|
213
|
+
solautoActions?.push({
|
214
|
+
__kind: "Withdraw",
|
215
|
+
fields: [
|
216
|
+
data.withdrawAll
|
217
|
+
? {
|
218
|
+
__kind: "All",
|
219
|
+
}
|
220
|
+
: {
|
221
|
+
__kind: "Some",
|
222
|
+
fields: [data.amount],
|
223
|
+
},
|
224
|
+
],
|
225
|
+
});
|
226
|
+
}
|
227
|
+
}
|
228
|
+
catch { }
|
229
|
+
try {
|
230
|
+
const serializer = (0, marginfi_sdk_1.getLendingAccountRepayInstructionDataSerializer)();
|
231
|
+
const discriminator = (0, numberUtils_1.uint8ArrayToBigInt)(serializer
|
232
|
+
.serialize({
|
233
|
+
amount: 0,
|
234
|
+
repayAll: false,
|
235
|
+
})
|
236
|
+
.slice(0, 8));
|
237
|
+
const [data, _] = serializer.deserialize(x.data);
|
238
|
+
if ((0, numberUtils_1.uint8ArrayToBigInt)(new Uint8Array(data.discriminator)) ===
|
239
|
+
discriminator) {
|
240
|
+
solautoActions?.push({
|
241
|
+
__kind: "Repay",
|
242
|
+
fields: [
|
243
|
+
data.repayAll
|
244
|
+
? {
|
245
|
+
__kind: "All",
|
246
|
+
}
|
247
|
+
: {
|
248
|
+
__kind: "Some",
|
249
|
+
fields: [data.amount],
|
250
|
+
},
|
251
|
+
],
|
252
|
+
});
|
253
|
+
}
|
164
254
|
}
|
255
|
+
catch { }
|
165
256
|
}
|
166
|
-
catch { }
|
167
257
|
// TODO support other platforms
|
168
258
|
});
|
169
259
|
return solautoActions;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAqC/B,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC;IATd,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE,EACM,IAAI,CAAC,oBAAQ;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IATxB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EAAE,EACxB,cAAc,CAAC,6CAA4C,IAAI,aAAA,EAC/D,YAAY,CAAC,qBAAS,EACtB,YAAY,CAAC,qBAAS,EACtB,aAAa,CAAC,2BAAe;YAKzB,uBAAuB;IAsCrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM;IAgB9D,IAAI;
|
1
|
+
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAqC/B,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC;IATd,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE,EACM,IAAI,CAAC,oBAAQ;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IATxB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EAAE,EACxB,cAAc,CAAC,6CAA4C,IAAI,aAAA,EAC/D,YAAY,CAAC,qBAAS,EACtB,YAAY,CAAC,qBAAS,EACtB,aAAa,CAAC,2BAAe;YAKzB,uBAAuB;IAsCrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM;IAgB9D,IAAI;CAgJX"}
|
@@ -193,11 +193,15 @@ class TransactionsManager {
|
|
193
193
|
choresBefore.prepend(updateLookupTable.updateLutTx);
|
194
194
|
}
|
195
195
|
if (choresBefore.getInstructions().length > 0) {
|
196
|
-
|
196
|
+
const chore = new TransactionItem(async () => ({ tx: choresBefore }), "create account(s)");
|
197
|
+
await chore.initialize();
|
198
|
+
this.items.unshift(chore);
|
197
199
|
this.client.log("Chores before: ", choresBefore.getInstructions().length);
|
198
200
|
}
|
199
201
|
if (choresAfter.getInstructions().length > 0) {
|
200
|
-
|
202
|
+
const chore = new TransactionItem(async () => ({ tx: choresAfter }));
|
203
|
+
await chore.initialize();
|
204
|
+
this.items.push(chore);
|
201
205
|
this.client.log("Chores after: ", choresAfter.getInstructions().length);
|
202
206
|
}
|
203
207
|
const itemSets = await this.assembleTransactionSets(this.items);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
2
|
+
import { LendingPlatform } from "../generated";
|
3
|
+
export interface SolautoPositionDetails {
|
4
|
+
positionId: number;
|
5
|
+
selfManaged: boolean;
|
6
|
+
lendingPlatform: LendingPlatform;
|
7
|
+
}
|
8
|
+
export interface SelfManagedPositionDetails extends SolautoPositionDetails {
|
9
|
+
protocolAccount: PublicKey;
|
10
|
+
supplyMint: PublicKey;
|
11
|
+
debtMint: PublicKey;
|
12
|
+
}
|
13
|
+
//# sourceMappingURL=solauto.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"solauto.d.ts","sourceRoot":"","sources":["../../src/types/solauto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,eAAe,CAAC;CACpC;AAED,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACtE,eAAe,EAAE,SAAS,CAAC;IAC3B,UAAU,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACvB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jupiterUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jupiterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAA0B,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAGL,aAAa,EACd,MAAM,aAAa,CAAC;AAKrB,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,iBAAiB,EAAE,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAgBD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,aAAa,CAAC;IACxB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,aAAa,EAAE,kBAAkB,CAAC;IAClC,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,cAAc,GAC1B,OAAO,CAAC,kBAAkB,CAAC,
|
1
|
+
{"version":3,"file":"jupiterUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jupiterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAA0B,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAGL,aAAa,EACd,MAAM,aAAa,CAAC;AAKrB,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,iBAAiB,EAAE,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAgBD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,aAAa,CAAC;IACxB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,aAAa,EAAE,kBAAkB,CAAC;IAClC,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,cAAc,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAkE7B"}
|
@@ -30,6 +30,7 @@ async function getJupSwapTransaction(signer, swapDetails) {
|
|
30
30
|
: swapDetails.exactIn
|
31
31
|
? "ExactIn"
|
32
32
|
: undefined,
|
33
|
+
slippageBps: 10
|
33
34
|
});
|
34
35
|
const finalPriceSlippageBps = Math.round(Math.max(quoteResponse.slippageBps ?? 10, Math.round((0, numberUtils_1.toBps)(parseFloat(quoteResponse.priceImpactPct)))) *
|
35
36
|
(1 + (swapDetails.slippageBpsIncFactor ?? 0)));
|
@@ -9,7 +9,11 @@ export declare function findMarginfiBankAccounts({ mint, bank, }: {
|
|
9
9
|
bank?: string;
|
10
10
|
}): MarginfiTokenAccounts;
|
11
11
|
export declare function getMaxLtvAndLiqThreshold(supplyBank: Bank, debtBank: Bank, supplyPrice?: number): Promise<[number, number]>;
|
12
|
-
export declare function getAllMarginfiAccountsByAuthority(umi: Umi, authority: PublicKey, compatibleWithSolauto?: boolean): Promise<
|
12
|
+
export declare function getAllMarginfiAccountsByAuthority(umi: Umi, authority: PublicKey, compatibleWithSolauto?: boolean): Promise<{
|
13
|
+
marginfiAccount: PublicKey;
|
14
|
+
supplyMint?: PublicKey;
|
15
|
+
debtMint?: PublicKey;
|
16
|
+
}[]>;
|
13
17
|
export declare function getMarginfiAccountPositionState(umi: Umi, marginfiAccountPk: PublicKey, supplyMint?: PublicKey, debtMint?: PublicKey, livePositionUpdates?: LivePositionUpdates): Promise<PositionState | undefined>;
|
14
18
|
export declare function getUpToDateShareValues(umi: Umi, bank: Bank): Promise<[number, number]>;
|
15
19
|
//# sourceMappingURL=marginfiUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marginfiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,IAAI,EAOL,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,IAAI,GACL,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,qBAAqB,CAWxB;AAED,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,IAAI,EACd,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkC3B;AAED,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,
|
1
|
+
{"version":3,"file":"marginfiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marginfiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,IAAI,EAOL,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,IAAI,GACL,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,qBAAqB,CAWxB;AAED,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,IAAI,EACd,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkC3B;AAED,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CACR;IAAE,eAAe,EAAE,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,EAAE,CAC/E,CA6CA;AAoDD,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,GAAG,EACR,iBAAiB,EAAE,SAAS,EAC5B,UAAU,CAAC,EAAE,SAAS,EACtB,QAAQ,CAAC,EAAE,SAAS,EACpB,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA4IpC;AA+DD,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA0B3B"}
|
@@ -70,10 +70,16 @@ async function getAllMarginfiAccountsByAuthority(umi, authority, compatibleWithS
|
|
70
70
|
})));
|
71
71
|
return positionStates
|
72
72
|
.filter((x) => x.state !== undefined)
|
73
|
-
.map((x) => (
|
73
|
+
.map((x) => ({
|
74
|
+
marginfiAccount: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.publicKey),
|
75
|
+
supplyMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.state.supply.mint),
|
76
|
+
debtMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.state.debt.mint),
|
77
|
+
}));
|
74
78
|
}
|
75
79
|
else {
|
76
|
-
return marginfiAccounts.map((x) => (
|
80
|
+
return marginfiAccounts.map((x) => ({
|
81
|
+
marginfiAccount: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.publicKey),
|
82
|
+
}));
|
77
83
|
}
|
78
84
|
}
|
79
85
|
exports.getAllMarginfiAccountsByAuthority = getAllMarginfiAccountsByAuthority;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
2
|
import { Umi } from "@metaplex-foundation/umi";
|
3
3
|
import { AutomationSettings, DCASettings, DCASettingsInpArgs, FeeType, LendingPlatform, PositionState, SolautoSettingsParameters, SolautoSettingsParametersInpArgs } from "../../generated";
|
4
|
+
import { SolautoPositionDetails } from "../../types/solauto";
|
4
5
|
export declare function nextAutomationPeriodTimestamp(automation: AutomationSettings): number;
|
5
6
|
export declare function eligibleForNextAutomationPeriod(automation: AutomationSettings): boolean;
|
6
7
|
export declare function getUpdatedValueFromAutomation(currValue: number, targetValue: number, automation: AutomationSettings, currentUnixTimestamp: number): number;
|
@@ -19,11 +20,6 @@ export declare function getSolautoManagedPositions(umi: Umi, authority?: PublicK
|
|
19
20
|
}[]>;
|
20
21
|
export declare function getAllReferralStates(umi: Umi): Promise<PublicKey[]>;
|
21
22
|
export declare function getReferralsByUser(umi: Umi, user: PublicKey): Promise<PublicKey[]>;
|
22
|
-
export interface SolautoPositionDetails {
|
23
|
-
positionId: number;
|
24
|
-
lendingPlatform: LendingPlatform;
|
25
|
-
protocolAccount?: PublicKey;
|
26
|
-
}
|
27
23
|
export declare function getAllPositionsByAuthority(umi: Umi, user: PublicKey): Promise<SolautoPositionDetails[]>;
|
28
24
|
type PositionAdjustment = {
|
29
25
|
type: "supply";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAoB,GAAG,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,aAAa,EAEb,yBAAyB,EACzB,gCAAgC,EAIjC,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAoB,GAAG,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,aAAa,EAEb,yBAAyB,EACzB,gCAAgC,EAIjC,MAAM,iBAAiB,CAAC;AAczB,OAAO,EAEL,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAgB7B,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,kBAAkB,GAC7B,MAAM,CAKR;AAED,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,kBAAkB,GAC7B,OAAO,CAET;AAED,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,EAC9B,oBAAoB,EAAE,MAAM,UAY7B;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,yBAAyB,EACnC,kBAAkB,EAAE,MAAM,GACzB,yBAAyB,CAgB3B;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,OAAO,GACf;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAYA;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,yBAAyB,EAC3C,WAAW,EAAE,WAAW,GACvB,OAAO,CA+BT;AAED,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,yBAAyB,GAC1C,OAAO,CAST;AAED,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,GAAG,EACR,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CACR;IACE,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;CAClC,EAAE,CACJ,CAkDA;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAezE;AAED,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,SAAS,EAAE,CAAC,CA2BtB;AAED,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAkCnC;AA4DD,KAAK,kBAAkB,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,gCAAgC,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAE/C,qBAAa,mBAAmB;IACvB,gBAAgB,EAAE,MAAM,CAAa;IACrC,cAAc,EAAE,MAAM,CAAa;IACnC,uBAAuB,EAAE,MAAM,CAAa;IAC5C,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAa;IAC5D,SAAS,EAAE,WAAW,GAAG,SAAS,CAAa;IAEtD,GAAG,CAAC,MAAM,EAAE,kBAAkB;IAyD9B,KAAK;IAQL,UAAU,IAAI,OAAO;CAQtB"}
|
@@ -186,12 +186,16 @@ async function getAllPositionsByAuthority(umi, user) {
|
|
186
186
|
allPositions.push(...solautoManagedPositions.map((x) => ({
|
187
187
|
positionId: x.positionId,
|
188
188
|
lendingPlatform: x.lendingPlatform,
|
189
|
+
selfManaged: false,
|
189
190
|
})));
|
190
191
|
const marginfiPositions = await (0, marginfiUtils_1.getAllMarginfiAccountsByAuthority)(umi, user, true);
|
191
|
-
allPositions.push(...marginfiPositions.map((
|
192
|
+
allPositions.push(...marginfiPositions.map((x) => ({
|
192
193
|
positionId: 0,
|
194
|
+
selfManaged: true,
|
193
195
|
lendingPlatform: generated_1.LendingPlatform.Marginfi,
|
194
|
-
protocolAccount:
|
196
|
+
protocolAccount: x.marginfiAccount,
|
197
|
+
supplyMint: x.supplyMint,
|
198
|
+
debtMint: x.debtMint,
|
195
199
|
})));
|
196
200
|
// TODO support other platforms
|
197
201
|
return allPositions;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getJupSwapRebalanceDetails = exports.getFlashLoanDetails = exports.getRebalanceValues = void 0;
|
4
|
+
const generated_1 = require("../../generated");
|
4
5
|
const generalUtils_1 = require("./generalUtils");
|
5
6
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
6
7
|
const generalUtils_2 = require("../generalUtils");
|
@@ -98,7 +99,7 @@ function getRebalanceValues(client, targetLiqUtilizationRateBps, limitGapBps) {
|
|
98
99
|
client.solautoPositionState.liqUtilizationRateBps < targetRateBps;
|
99
100
|
let adjustmentFeeBps = 0;
|
100
101
|
if (increasingLeverage) {
|
101
|
-
adjustmentFeeBps = (0, generalUtils_1.getSolautoFeesBps)(client.referredByState !== undefined, client.solautoPositionData.
|
102
|
+
adjustmentFeeBps = (0, generalUtils_1.getSolautoFeesBps)(client.referredByState !== undefined, client.solautoPositionData?.feeType ?? generated_1.FeeType.Small).total;
|
102
103
|
}
|
103
104
|
const supplyUsd = (0, numberUtils_1.fromBaseUnit)(client.solautoPositionState.supply.amountUsed.baseAmountUsdValue, generalAccounts_1.USD_DECIMALS) + amountUsdToDcaIn;
|
104
105
|
const debtUsd = (0, numberUtils_1.fromBaseUnit)(client.solautoPositionState.debt.amountUsed.baseAmountUsdValue, generalAccounts_1.USD_DECIMALS);
|
package/package.json
CHANGED
@@ -88,12 +88,12 @@ export abstract class SolautoClient {
|
|
88
88
|
public solautoPositionState!: PositionState | undefined;
|
89
89
|
|
90
90
|
public supplyMint!: PublicKey;
|
91
|
-
public
|
92
|
-
public
|
91
|
+
public positionSupplyTa!: PublicKey;
|
92
|
+
public signerSupplyTa!: PublicKey;
|
93
93
|
|
94
94
|
public debtMint!: PublicKey;
|
95
|
-
public
|
96
|
-
public
|
95
|
+
public positionDebtTa!: PublicKey;
|
96
|
+
public signerDebtTa!: PublicKey;
|
97
97
|
|
98
98
|
public authorityReferralState!: PublicKey;
|
99
99
|
public authorityReferralStateData!: ReferralState | null;
|
@@ -157,11 +157,11 @@ export abstract class SolautoClient {
|
|
157
157
|
this.supplyMint =
|
158
158
|
args.supplyMint ??
|
159
159
|
toWeb3JsPublicKey(this.solautoPositionData!.position.supplyMint);
|
160
|
-
this.
|
160
|
+
this.positionSupplyTa = getTokenAccount(
|
161
161
|
this.solautoPosition,
|
162
162
|
this.supplyMint
|
163
163
|
);
|
164
|
-
this.
|
164
|
+
this.signerSupplyTa = getTokenAccount(
|
165
165
|
toWeb3JsPublicKey(this.signer.publicKey),
|
166
166
|
this.supplyMint
|
167
167
|
);
|
@@ -169,11 +169,11 @@ export abstract class SolautoClient {
|
|
169
169
|
this.debtMint =
|
170
170
|
args.debtMint ??
|
171
171
|
toWeb3JsPublicKey(this.solautoPositionData!.position.debtMint);
|
172
|
-
this.
|
172
|
+
this.positionDebtTa = getTokenAccount(
|
173
173
|
this.solautoPosition,
|
174
174
|
this.debtMint
|
175
175
|
);
|
176
|
-
this.
|
176
|
+
this.signerDebtTa = getTokenAccount(
|
177
177
|
toWeb3JsPublicKey(this.signer.publicKey),
|
178
178
|
this.debtMint
|
179
179
|
);
|
@@ -280,14 +280,14 @@ export abstract class SolautoClient {
|
|
280
280
|
return [
|
281
281
|
this.authority,
|
282
282
|
...(this.signer.publicKey.toString() === this.authority.toString()
|
283
|
-
? [this.
|
283
|
+
? [this.signerSupplyTa]
|
284
284
|
: []),
|
285
285
|
...(this.signer.publicKey.toString() === this.authority.toString()
|
286
|
-
? [this.
|
286
|
+
? [this.signerDebtTa]
|
287
287
|
: []),
|
288
288
|
this.solautoPosition,
|
289
|
-
this.
|
290
|
-
this.
|
289
|
+
this.positionSupplyTa,
|
290
|
+
this.positionDebtTa,
|
291
291
|
this.authorityReferralState,
|
292
292
|
...(this.referredBySupplyTa ? [this.referredBySupplyTa] : []),
|
293
293
|
];
|
@@ -317,7 +317,6 @@ export abstract class SolautoClient {
|
|
317
317
|
return undefined;
|
318
318
|
}
|
319
319
|
|
320
|
-
this.log("Updating authority lookup table...");
|
321
320
|
let tx = transactionBuilder();
|
322
321
|
|
323
322
|
if (this.authorityLutAddress === undefined) {
|
@@ -353,10 +352,13 @@ export abstract class SolautoClient {
|
|
353
352
|
);
|
354
353
|
}
|
355
354
|
|
356
|
-
const addingReferredBy =
|
357
|
-
|
358
|
-
|
359
|
-
|
355
|
+
const addingReferredBy = accountsToAdd.length === 1
|
356
|
+
// && accountsToAdd[0].toString().toLowerCase() ===
|
357
|
+
// this.referredBySupplyTa?.toString().toLowerCase();
|
358
|
+
|
359
|
+
if (tx.getInstructions().length > 0) {
|
360
|
+
this.log("Updating authority lookup table...");
|
361
|
+
}
|
360
362
|
|
361
363
|
return { updateLutTx: tx, needsToBeIsolated: !addingReferredBy };
|
362
364
|
}
|
@@ -443,8 +445,8 @@ export abstract class SolautoClient {
|
|
443
445
|
let signerDebtTa: UmiPublicKey | undefined = undefined;
|
444
446
|
if (isOption(args.dca) && isSome(args.dca)) {
|
445
447
|
debtMint = publicKey(this.debtMint);
|
446
|
-
positionDebtTa = publicKey(this.
|
447
|
-
signerDebtTa = publicKey(this.
|
448
|
+
positionDebtTa = publicKey(this.positionDebtTa);
|
449
|
+
signerDebtTa = publicKey(this.signerDebtTa);
|
448
450
|
|
449
451
|
let addingToPos = false;
|
450
452
|
if (
|
@@ -500,10 +502,10 @@ export abstract class SolautoClient {
|
|
500
502
|
return closePosition(this.umi, {
|
501
503
|
signer: this.signer,
|
502
504
|
solautoPosition: publicKey(this.solautoPosition),
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
505
|
+
signerSupplyTa: publicKey(this.signerSupplyTa),
|
506
|
+
positionSupplyTa: publicKey(this.positionSupplyTa),
|
507
|
+
positionDebtTa: publicKey(this.positionDebtTa),
|
508
|
+
signerDebtTa: publicKey(this.signerDebtTa),
|
507
509
|
});
|
508
510
|
}
|
509
511
|
|
@@ -516,8 +518,8 @@ export abstract class SolautoClient {
|
|
516
518
|
const positionData = this.solautoPositionData!.position;
|
517
519
|
if (positionData.dca.debtToAddBaseUnit) {
|
518
520
|
debtMint = publicKey(this.debtMint);
|
519
|
-
positionDebtTa = publicKey(this.
|
520
|
-
signerDebtTa = publicKey(this.
|
521
|
+
positionDebtTa = publicKey(this.positionDebtTa);
|
522
|
+
signerDebtTa = publicKey(this.signerDebtTa);
|
521
523
|
|
522
524
|
this.livePositionUpdates.new({
|
523
525
|
type: "debtDcaIn",
|
@@ -545,8 +547,8 @@ export abstract class SolautoClient {
|
|
545
547
|
tx = tx.add(
|
546
548
|
splTokenTransferUmiIx(
|
547
549
|
this.signer,
|
548
|
-
this.
|
549
|
-
this.
|
550
|
+
this.signerSupplyTa,
|
551
|
+
this.positionSupplyTa,
|
550
552
|
toWeb3JsPublicKey(this.signer.publicKey),
|
551
553
|
BigInt(args.fields[0])
|
552
554
|
)
|
@@ -556,8 +558,8 @@ export abstract class SolautoClient {
|
|
556
558
|
tx = tx.add(
|
557
559
|
splTokenTransferUmiIx(
|
558
560
|
this.signer,
|
559
|
-
this.
|
560
|
-
this.
|
561
|
+
this.signerDebtTa,
|
562
|
+
this.positionDebtTa,
|
561
563
|
toWeb3JsPublicKey(this.signer.publicKey),
|
562
564
|
BigInt(args.fields[0].fields[0])
|
563
565
|
)
|
@@ -566,8 +568,8 @@ export abstract class SolautoClient {
|
|
566
568
|
tx = tx.add(
|
567
569
|
splTokenTransferUmiIx(
|
568
570
|
this.signer,
|
569
|
-
this.
|
570
|
-
this.
|
571
|
+
this.signerDebtTa,
|
572
|
+
this.positionDebtTa,
|
571
573
|
toWeb3JsPublicKey(this.signer.publicKey),
|
572
574
|
BigInt(
|
573
575
|
Math.round(
|