@haven-fi/solauto-sdk 1.0.25 → 1.0.26
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 +83 -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.js +8 -8
- 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/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 +88 -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 +8 -8
- package/src/transactions/transactionsManager.ts +8 -6
- package/src/types/solauto.ts +14 -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 +28 -25
- package/tests/unit/lookupTables.ts +4 -3
@@ -30,11 +30,11 @@ export declare abstract class SolautoClient {
|
|
30
30
|
solautoPositionData: SolautoPosition | null;
|
31
31
|
solautoPositionState: PositionState | undefined;
|
32
32
|
supplyMint: PublicKey;
|
33
|
-
|
34
|
-
|
33
|
+
positionSupplyTa: PublicKey;
|
34
|
+
signerSupplyTa: PublicKey;
|
35
35
|
debtMint: PublicKey;
|
36
|
-
|
37
|
-
|
36
|
+
positionDebtTa: PublicKey;
|
37
|
+
signerDebtTa: PublicKey;
|
38
38
|
authorityReferralState: PublicKey;
|
39
39
|
authorityReferralStateData: ReferralState | null;
|
40
40
|
authorityReferralFeesDestMint: PublicKey;
|
@@ -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;AAGlC,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;AAInE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B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C,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"}
|
@@ -46,13 +46,13 @@ class SolautoClient {
|
|
46
46
|
this.supplyMint =
|
47
47
|
args.supplyMint ??
|
48
48
|
(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.supplyMint);
|
49
|
-
this.
|
50
|
-
this.
|
49
|
+
this.positionSupplyTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.supplyMint);
|
50
|
+
this.signerSupplyTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.supplyMint);
|
51
51
|
this.debtMint =
|
52
52
|
args.debtMint ??
|
53
53
|
(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.debtMint);
|
54
|
-
this.
|
55
|
-
this.
|
54
|
+
this.positionDebtTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.debtMint);
|
55
|
+
this.signerDebtTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.debtMint);
|
56
56
|
this.authorityReferralState = await (0, accountUtils_1.getReferralState)(this.authority);
|
57
57
|
this.authorityReferralStateData = await (0, generated_1.safeFetchReferralState)(this.umi, (0, umi_1.publicKey)(this.authorityReferralState));
|
58
58
|
this.authorityReferralFeesDestMint = args.referralFeesDestMint
|
@@ -123,14 +123,14 @@ class SolautoClient {
|
|
123
123
|
return [
|
124
124
|
this.authority,
|
125
125
|
...(this.signer.publicKey.toString() === this.authority.toString()
|
126
|
-
? [this.
|
126
|
+
? [this.signerSupplyTa]
|
127
127
|
: []),
|
128
128
|
...(this.signer.publicKey.toString() === this.authority.toString()
|
129
|
-
? [this.
|
129
|
+
? [this.signerDebtTa]
|
130
130
|
: []),
|
131
131
|
this.solautoPosition,
|
132
|
-
this.
|
133
|
-
this.
|
132
|
+
this.positionSupplyTa,
|
133
|
+
this.positionDebtTa,
|
134
134
|
this.authorityReferralState,
|
135
135
|
...(this.referredBySupplyTa ? [this.referredBySupplyTa] : []),
|
136
136
|
];
|
@@ -151,7 +151,6 @@ class SolautoClient {
|
|
151
151
|
.includes(element.toString().toLowerCase()))) {
|
152
152
|
return undefined;
|
153
153
|
}
|
154
|
-
this.log("Updating authority lookup table...");
|
155
154
|
let tx = (0, umi_1.transactionBuilder)();
|
156
155
|
if (this.authorityLutAddress === undefined) {
|
157
156
|
const [createLookupTableInst, lookupTableAddress] = web3_js_1.AddressLookupTableProgram.createLookupTable({
|
@@ -174,9 +173,12 @@ class SolautoClient {
|
|
174
173
|
addresses: accountsToAdd,
|
175
174
|
})));
|
176
175
|
}
|
177
|
-
const addingReferredBy = accountsToAdd.length === 1
|
178
|
-
|
179
|
-
|
176
|
+
const addingReferredBy = accountsToAdd.length === 1;
|
177
|
+
// && accountsToAdd[0].toString().toLowerCase() ===
|
178
|
+
// this.referredBySupplyTa?.toString().toLowerCase();
|
179
|
+
if (tx.getInstructions().length > 0) {
|
180
|
+
this.log("Updating authority lookup table...");
|
181
|
+
}
|
180
182
|
return { updateLutTx: tx, needsToBeIsolated: !addingReferredBy };
|
181
183
|
}
|
182
184
|
solautoPositionSettings() {
|
@@ -243,8 +245,8 @@ class SolautoClient {
|
|
243
245
|
let signerDebtTa = undefined;
|
244
246
|
if ((0, umi_1.isOption)(args.dca) && (0, umi_1.isSome)(args.dca)) {
|
245
247
|
debtMint = (0, umi_1.publicKey)(this.debtMint);
|
246
|
-
positionDebtTa = (0, umi_1.publicKey)(this.
|
247
|
-
signerDebtTa = (0, umi_1.publicKey)(this.
|
248
|
+
positionDebtTa = (0, umi_1.publicKey)(this.positionDebtTa);
|
249
|
+
signerDebtTa = (0, umi_1.publicKey)(this.signerDebtTa);
|
248
250
|
let addingToPos = false;
|
249
251
|
if ((0, umi_1.isOption)(args.dca) &&
|
250
252
|
(0, umi_1.isSome)(args.dca) &&
|
@@ -289,10 +291,10 @@ class SolautoClient {
|
|
289
291
|
return (0, generated_1.closePosition)(this.umi, {
|
290
292
|
signer: this.signer,
|
291
293
|
solautoPosition: (0, umi_1.publicKey)(this.solautoPosition),
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
294
|
+
signerSupplyTa: (0, umi_1.publicKey)(this.signerSupplyTa),
|
295
|
+
positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
|
296
|
+
positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
|
297
|
+
signerDebtTa: (0, umi_1.publicKey)(this.signerDebtTa),
|
296
298
|
});
|
297
299
|
}
|
298
300
|
cancelDCAIx() {
|
@@ -303,8 +305,8 @@ class SolautoClient {
|
|
303
305
|
const positionData = this.solautoPositionData.position;
|
304
306
|
if (positionData.dca.debtToAddBaseUnit) {
|
305
307
|
debtMint = (0, umi_1.publicKey)(this.debtMint);
|
306
|
-
positionDebtTa = (0, umi_1.publicKey)(this.
|
307
|
-
signerDebtTa = (0, umi_1.publicKey)(this.
|
308
|
+
positionDebtTa = (0, umi_1.publicKey)(this.positionDebtTa);
|
309
|
+
signerDebtTa = (0, umi_1.publicKey)(this.signerDebtTa);
|
308
310
|
this.livePositionUpdates.new({
|
309
311
|
type: "debtDcaIn",
|
310
312
|
value: positionData.dca.debtToAddBaseUnit * BigInt(-1),
|
@@ -323,14 +325,14 @@ class SolautoClient {
|
|
323
325
|
let tx = (0, umi_1.transactionBuilder)();
|
324
326
|
if (!this.selfManaged) {
|
325
327
|
if (args.__kind === "Deposit") {
|
326
|
-
tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.
|
328
|
+
tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerSupplyTa, this.positionSupplyTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(args.fields[0])));
|
327
329
|
}
|
328
330
|
else if (args.__kind === "Repay") {
|
329
331
|
if (args.fields[0].__kind === "Some") {
|
330
|
-
tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.
|
332
|
+
tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtTa, this.positionDebtTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(args.fields[0].fields[0])));
|
331
333
|
}
|
332
334
|
else {
|
333
|
-
tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.
|
335
|
+
tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtTa, this.positionDebtTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(Math.round(Number(this.solautoPositionState.debt.amountUsed.baseUnit) *
|
334
336
|
1.01))));
|
335
337
|
}
|
336
338
|
}
|
@@ -32,6 +32,7 @@ export declare class SolautoMarginfiClient extends SolautoClient {
|
|
32
32
|
refresh(): TransactionBuilder;
|
33
33
|
protocolInteraction(args: SolautoActionArgs): TransactionBuilder;
|
34
34
|
private marginfiProtocolInteractionIx;
|
35
|
+
private marginfiSolautoProtocolInteractionIx;
|
35
36
|
rebalance(rebalanceStep: "A" | "B", swapDetails: JupSwapDetails, rebalanceType: SolautoRebalanceTypeArgs, targetLiqUtilizationRateBps?: number, limitGapBps?: number): TransactionBuilder;
|
36
37
|
flashBorrow(flashLoanDetails: FlashLoanDetails, destinationTokenAccount: PublicKey): TransactionBuilder;
|
37
38
|
flashRepay(flashLoanDetails: FlashLoanDetails): TransactionBuilder;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,MAAM,EACN,kBAAkB,
|
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;AAElC,OAAO,EAGL,SAAS,EAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAK1D,OAAO,EACL,kBAAkB,EAElB,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAKjC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,eAAe,EAUhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAOnE,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,eAAe,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,EACnB,mBAAmB,CAAC,EAAE,SAAS,GAC9B,yBAAyB,CAe3B;AAED,qBAAa,qBAAsB,SAAQ,a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ient = exports.newSolautoMarginfiPositionArgs = void 0;
|
4
4
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
5
5
|
const umi_1 = require("@metaplex-foundation/umi");
|
6
|
+
const umi_bundle_defaults_1 = require("@metaplex-foundation/umi-bundle-defaults");
|
6
7
|
const web3_js_1 = require("@solana/web3.js");
|
7
8
|
const solautoClient_1 = require("./solautoClient");
|
8
9
|
const marginfiAccounts_1 = require("../constants/marginfiAccounts");
|
@@ -13,12 +14,13 @@ const marginfi_sdk_1 = require("../marginfi-sdk");
|
|
13
14
|
const marginfiUtils_1 = require("../utils/marginfiUtils");
|
14
15
|
const numberUtils_1 = require("../utils/numberUtils");
|
15
16
|
function newSolautoMarginfiPositionArgs(positionId, signer, wallet, supplyMint, debtMint, referredByAuthority) {
|
17
|
+
const umi = (0, umi_bundle_defaults_1.createUmi)((0, web3_js_1.clusterApiUrl)("mainnet-beta"));
|
16
18
|
return {
|
17
19
|
positionId,
|
18
20
|
signer,
|
19
21
|
wallet,
|
20
22
|
marginfiAccount: positionId === 0
|
21
|
-
? (0, umi_1.createSignerFromKeypair)(
|
23
|
+
? (0, umi_1.createSignerFromKeypair)(umi, umi.eddsa.generateKeypair())
|
22
24
|
: undefined,
|
23
25
|
marginfiAccountSeedIdx: positionId > 0 ? (0, generalUtils_1.generateRandomU64)() : undefined,
|
24
26
|
supplyMint: supplyMint,
|
@@ -54,13 +56,13 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
54
56
|
mint: this.debtMint.toString(),
|
55
57
|
});
|
56
58
|
const existingMarginfiAccounts = await (0, marginfiUtils_1.getAllMarginfiAccountsByAuthority)(this.umi, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), false);
|
57
|
-
const emptyMarginfiAccounts = (await (0, marginfi_sdk_1.safeFetchAllMarginfiAccount)(this.umi, existingMarginfiAccounts.map((x) => (0, umi_1.publicKey)(x)))).filter((x) => x.lendingAccount.balances.find((y) => y.bankPk.toString() !== web3_js_1.PublicKey.default.toString() &&
|
59
|
+
const emptyMarginfiAccounts = (await (0, marginfi_sdk_1.safeFetchAllMarginfiAccount)(this.umi, existingMarginfiAccounts.map((x) => (0, umi_1.publicKey)(x.marginfiAccount)))).filter((x) => x.lendingAccount.balances.find((y) => y.bankPk.toString() !== web3_js_1.PublicKey.default.toString() &&
|
58
60
|
(Math.round((0, numberUtils_1.bytesToI80F48)(y.assetShares.value)) != 0 ||
|
59
61
|
Math.round((0, numberUtils_1.bytesToI80F48)(y.liabilityShares.value)) != 0)) === undefined);
|
60
62
|
this.intermediaryMarginfiAccountSigner =
|
61
63
|
emptyMarginfiAccounts.length > 0
|
62
64
|
? undefined
|
63
|
-
: (0, umi_1.createSignerFromKeypair)(this.umi,
|
65
|
+
: (0, umi_1.createSignerFromKeypair)(this.umi, this.umi.eddsa.generateKeypair());
|
64
66
|
this.intermediaryMarginfiAccountPk =
|
65
67
|
emptyMarginfiAccounts.length > 0
|
66
68
|
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(emptyMarginfiAccounts[0].publicKey)
|
@@ -84,9 +86,9 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
84
86
|
.add(this.marginfiOpenPositionIx(settingParams, dca));
|
85
87
|
}
|
86
88
|
marginfiOpenPositionIx(settingParams, dca) {
|
87
|
-
let
|
89
|
+
let signerDebtTa = undefined;
|
88
90
|
if (dca) {
|
89
|
-
|
91
|
+
signerDebtTa = (0, umi_1.publicKey)(this.signerDebtTa);
|
90
92
|
}
|
91
93
|
return (0, generated_1.marginfiOpenPosition)(this.umi, {
|
92
94
|
signer: this.signer,
|
@@ -107,11 +109,11 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
107
109
|
: this.marginfiAccount,
|
108
110
|
supplyMint: (0, umi_1.publicKey)(this.supplyMint),
|
109
111
|
supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
|
110
|
-
positionSupplyTa: (0, umi_1.publicKey)(this.
|
112
|
+
positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
|
111
113
|
debtMint: (0, umi_1.publicKey)(this.debtMint),
|
112
114
|
debtBank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
|
113
|
-
positionDebtTa: (0, umi_1.publicKey)(this.
|
114
|
-
signerDebtTa:
|
115
|
+
positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
|
116
|
+
signerDebtTa: signerDebtTa,
|
115
117
|
positionData: {
|
116
118
|
positionId: this.positionId,
|
117
119
|
settingParams: settingParams ?? null,
|
@@ -134,28 +136,84 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
134
136
|
});
|
135
137
|
}
|
136
138
|
protocolInteraction(args) {
|
137
|
-
|
138
|
-
|
139
|
-
.add(this.marginfiProtocolInteractionIx(args));
|
139
|
+
let tx = super.protocolInteraction(args);
|
140
|
+
if (this.selfManaged) {
|
141
|
+
return tx.add(this.marginfiProtocolInteractionIx(args));
|
142
|
+
}
|
143
|
+
else {
|
144
|
+
return tx.add(this.marginfiSolautoProtocolInteractionIx(args));
|
145
|
+
}
|
140
146
|
}
|
141
147
|
marginfiProtocolInteractionIx(args) {
|
142
|
-
|
148
|
+
switch (args.__kind) {
|
149
|
+
case "Deposit": {
|
150
|
+
return (0, marginfi_sdk_1.lendingAccountDeposit)(this.umi, {
|
151
|
+
amount: args.fields[0],
|
152
|
+
signer: this.signer,
|
153
|
+
signerTokenAccount: (0, umi_1.publicKey)(this.signerSupplyTa),
|
154
|
+
marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
|
155
|
+
marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
|
156
|
+
bank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
|
157
|
+
bankLiquidityVault: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.liquidityVault),
|
158
|
+
});
|
159
|
+
}
|
160
|
+
case "Borrow": {
|
161
|
+
return (0, marginfi_sdk_1.lendingAccountBorrow)(this.umi, {
|
162
|
+
amount: args.fields[0],
|
163
|
+
signer: this.signer,
|
164
|
+
destinationTokenAccount: (0, umi_1.publicKey)(this.signerDebtTa),
|
165
|
+
marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
|
166
|
+
marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
|
167
|
+
bank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
|
168
|
+
bankLiquidityVault: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.liquidityVault),
|
169
|
+
bankLiquidityVaultAuthority: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.vaultAuthority),
|
170
|
+
});
|
171
|
+
}
|
172
|
+
case "Repay": {
|
173
|
+
return (0, marginfi_sdk_1.lendingAccountRepay)(this.umi, {
|
174
|
+
amount: args.fields[0].__kind === "Some" ? args.fields[0].fields[0] : 0,
|
175
|
+
repayAll: args.fields[0].__kind === "All" ? true : false,
|
176
|
+
signer: this.signer,
|
177
|
+
signerTokenAccount: (0, umi_1.publicKey)(this.signerDebtTa),
|
178
|
+
marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
|
179
|
+
marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
|
180
|
+
bank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
|
181
|
+
bankLiquidityVault: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.liquidityVault),
|
182
|
+
});
|
183
|
+
}
|
184
|
+
case "Withdraw": {
|
185
|
+
return (0, marginfi_sdk_1.lendingAccountWithdraw)(this.umi, {
|
186
|
+
amount: args.fields[0].__kind === "Some" ? args.fields[0].fields[0] : 0,
|
187
|
+
withdrawAll: args.fields[0].__kind === "All" ? true : false,
|
188
|
+
signer: this.signer,
|
189
|
+
destinationTokenAccount: (0, umi_1.publicKey)(this.signerSupplyTa),
|
190
|
+
marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
|
191
|
+
marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
|
192
|
+
bank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
|
193
|
+
bankLiquidityVault: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.liquidityVault),
|
194
|
+
bankLiquidityVaultAuthority: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.vaultAuthority),
|
195
|
+
});
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
marginfiSolautoProtocolInteractionIx(args) {
|
200
|
+
let positionSupplyTa = undefined;
|
143
201
|
let vaultSupplyTa = undefined;
|
144
202
|
let supplyVaultAuthority = undefined;
|
145
203
|
if (args.__kind === "Deposit" || args.__kind === "Withdraw") {
|
146
|
-
|
147
|
-
? this.
|
148
|
-
: this.
|
204
|
+
positionSupplyTa = (0, umi_1.publicKey)(args.__kind === "Withdraw" || this.selfManaged
|
205
|
+
? this.signerSupplyTa
|
206
|
+
: this.positionSupplyTa);
|
149
207
|
vaultSupplyTa = (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.liquidityVault);
|
150
208
|
supplyVaultAuthority = (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.vaultAuthority);
|
151
209
|
}
|
152
|
-
let
|
210
|
+
let positionDebtTa = undefined;
|
153
211
|
let vaultDebtTa = undefined;
|
154
212
|
let debtVaultAuthority = undefined;
|
155
213
|
if (args.__kind === "Borrow" || args.__kind === "Repay") {
|
156
|
-
|
157
|
-
? this.
|
158
|
-
: this.
|
214
|
+
positionDebtTa = (0, umi_1.publicKey)(args.__kind === "Borrow" || this.selfManaged
|
215
|
+
? this.signerDebtTa
|
216
|
+
: this.positionDebtTa);
|
159
217
|
vaultDebtTa = (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.liquidityVault);
|
160
218
|
debtVaultAuthority = (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.vaultAuthority);
|
161
219
|
}
|
@@ -173,12 +231,12 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
173
231
|
marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
|
174
232
|
supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
|
175
233
|
supplyPriceOracle,
|
176
|
-
|
234
|
+
positionSupplyTa,
|
177
235
|
vaultSupplyTa,
|
178
236
|
supplyVaultAuthority,
|
179
237
|
debtBank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
|
180
238
|
debtPriceOracle,
|
181
|
-
|
239
|
+
positionDebtTa,
|
182
240
|
vaultDebtTa,
|
183
241
|
debtVaultAuthority,
|
184
242
|
solautoAction: args,
|
@@ -202,12 +260,14 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
202
260
|
intermediaryTa: (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), swapDetails.inputMint)),
|
203
261
|
supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
|
204
262
|
supplyPriceOracle: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.priceOracle),
|
205
|
-
positionSupplyTa: (0, umi_1.publicKey)(this.
|
263
|
+
positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
|
264
|
+
signerSupplyTa: this.selfManaged ? (0, umi_1.publicKey)(this.signerSupplyTa) : undefined,
|
206
265
|
vaultSupplyTa: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.liquidityVault),
|
207
266
|
supplyVaultAuthority: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.vaultAuthority),
|
208
267
|
debtBank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
|
209
268
|
debtPriceOracle: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.priceOracle),
|
210
|
-
positionDebtTa: (0, umi_1.publicKey)(this.
|
269
|
+
positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
|
270
|
+
signerDebtTa: this.selfManaged ? (0, umi_1.publicKey)(this.signerDebtTa) : undefined,
|
211
271
|
vaultDebtTa: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.liquidityVault),
|
212
272
|
debtVaultAuthority: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.vaultAuthority),
|
213
273
|
rebalanceType,
|
@@ -13,11 +13,11 @@ export type ClosePositionInstructionAccounts = {
|
|
13
13
|
tokenProgram?: PublicKey | Pda;
|
14
14
|
ataProgram?: PublicKey | Pda;
|
15
15
|
solautoPosition: PublicKey | Pda;
|
16
|
-
|
17
|
-
|
16
|
+
signerSupplyTa: PublicKey | Pda;
|
17
|
+
positionSupplyTa: PublicKey | Pda;
|
18
18
|
positionSupplyCollateralTa?: PublicKey | Pda;
|
19
|
-
|
20
|
-
|
19
|
+
positionDebtTa: PublicKey | Pda;
|
20
|
+
signerDebtTa: PublicKey | Pda;
|
21
21
|
};
|
22
22
|
export type ClosePositionInstructionData = {
|
23
23
|
discriminator: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"closePosition.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/closePosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAQ9C,MAAM,MAAM,gCAAgC,GAAG;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7B,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,
|
1
|
+
{"version":3,"file":"closePosition.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/closePosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAQ9C,MAAM,MAAM,gCAAgC,GAAG;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7B,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,cAAc,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,gBAAgB,EAAE,SAAS,GAAG,GAAG,CAAC;IAClC,0BAA0B,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7C,cAAc,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,EAAE,SAAS,GAAG,GAAG,CAAC;CAC/B,CAAC;AAGF,MAAM,MAAM,4BAA4B,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAElD,wBAAgB,yCAAyC,IAAI,UAAU,CACrE,gCAAgC,EAChC,4BAA4B,CAC7B,CAcA;AAGD,wBAAgB,aAAa,CAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,gCAAgC,GACtC,kBAAkB,CAyGpB"}
|
@@ -48,30 +48,30 @@ function closePosition(context, input) {
|
|
48
48
|
isWritable: true,
|
49
49
|
value: input.solautoPosition ?? null,
|
50
50
|
},
|
51
|
-
|
51
|
+
signerSupplyTa: {
|
52
52
|
index: 5,
|
53
53
|
isWritable: true,
|
54
|
-
value: input.
|
54
|
+
value: input.signerSupplyTa ?? null,
|
55
55
|
},
|
56
|
-
|
56
|
+
positionSupplyTa: {
|
57
57
|
index: 6,
|
58
58
|
isWritable: true,
|
59
|
-
value: input.
|
59
|
+
value: input.positionSupplyTa ?? null,
|
60
60
|
},
|
61
61
|
positionSupplyCollateralTa: {
|
62
62
|
index: 7,
|
63
63
|
isWritable: true,
|
64
64
|
value: input.positionSupplyCollateralTa ?? null,
|
65
65
|
},
|
66
|
-
|
66
|
+
positionDebtTa: {
|
67
67
|
index: 8,
|
68
68
|
isWritable: true,
|
69
|
-
value: input.
|
69
|
+
value: input.positionDebtTa ?? null,
|
70
70
|
},
|
71
|
-
|
71
|
+
signerDebtTa: {
|
72
72
|
index: 9,
|
73
73
|
isWritable: true,
|
74
|
-
value: input.
|
74
|
+
value: input.signerDebtTa ?? null,
|
75
75
|
},
|
76
76
|
};
|
77
77
|
// Default values.
|
@@ -20,12 +20,12 @@ export type MarginfiProtocolInteractionInstructionAccounts = {
|
|
20
20
|
marginfiAccount: PublicKey | Pda;
|
21
21
|
supplyBank: PublicKey | Pda;
|
22
22
|
supplyPriceOracle?: PublicKey | Pda;
|
23
|
-
|
23
|
+
positionSupplyTa?: PublicKey | Pda;
|
24
24
|
vaultSupplyTa?: PublicKey | Pda;
|
25
25
|
supplyVaultAuthority?: PublicKey | Pda;
|
26
26
|
debtBank: PublicKey | Pda;
|
27
27
|
debtPriceOracle?: PublicKey | Pda;
|
28
|
-
|
28
|
+
positionDebtTa?: PublicKey | Pda;
|
29
29
|
vaultDebtTa?: PublicKey | Pda;
|
30
30
|
debtVaultAuthority?: PublicKey | Pda;
|
31
31
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiProtocolInteraction.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiProtocolInteraction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,aAAa,EACb,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,8CAA8C,GAAG;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7B,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvB,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,UAAU,EAAE,SAAS,GAAG,GAAG,CAAC;IAC5B,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,
|
1
|
+
{"version":3,"file":"marginfiProtocolInteraction.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiProtocolInteraction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,aAAa,EACb,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,8CAA8C,GAAG;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7B,IAAI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
|
-
|
79
|
+
positionSupplyTa: {
|
80
80
|
index: 11,
|
81
81
|
isWritable: true,
|
82
|
-
value: input.
|
82
|
+
value: input.positionSupplyTa ?? null,
|
83
83
|
},
|
84
84
|
vaultSupplyTa: {
|
85
85
|
index: 12,
|
@@ -101,10 +101,10 @@ function marginfiProtocolInteraction(context, input) {
|
|
101
101
|
isWritable: false,
|
102
102
|
value: input.debtPriceOracle ?? null,
|
103
103
|
},
|
104
|
-
|
104
|
+
positionDebtTa: {
|
105
105
|
index: 16,
|
106
106
|
isWritable: true,
|
107
|
-
value: input.
|
107
|
+
value: input.positionDebtTa ?? null,
|
108
108
|
},
|
109
109
|
vaultDebtTa: {
|
110
110
|
index: 17,
|
@@ -24,11 +24,13 @@ export type MarginfiRebalanceInstructionAccounts = {
|
|
24
24
|
supplyBank: PublicKey | Pda;
|
25
25
|
supplyPriceOracle?: PublicKey | Pda;
|
26
26
|
positionSupplyTa: PublicKey | Pda;
|
27
|
+
signerSupplyTa?: PublicKey | Pda;
|
27
28
|
vaultSupplyTa?: PublicKey | Pda;
|
28
29
|
supplyVaultAuthority?: PublicKey | Pda;
|
29
30
|
debtBank: PublicKey | Pda;
|
30
31
|
debtPriceOracle?: PublicKey | Pda;
|
31
32
|
positionDebtTa: PublicKey | Pda;
|
33
|
+
signerDebtTa?: PublicKey | Pda;
|
32
34
|
vaultDebtTa?: PublicKey | Pda;
|
33
35
|
debtVaultAuthority?: PublicKey | Pda;
|
34
36
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiRebalance.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiRebalance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,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CAAC,MAAM,CAAC,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,aAAa,EAAE,wBAAwB,CAAC;IACxC,2BAA2B,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACvC,CAAC;AAEF,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAoBA;AAGD,MAAM,MAAM,gCAAgC,GAC1C,oCAAoC,CAAC;AAGvC,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAAG,gCAAgC,GAC7E,kBAAkB,
|
1
|
+
{"version":3,"file":"marginfiRebalance.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiRebalance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;IAC3B,mBAAmB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,sBAAsB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACz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E,oCAAoC,EACpC,gCAAgC,CACjC,CAoBA;AAGD,MAAM,MAAM,gCAAgC,GAC1C,oCAAoC,CAAC;AAGvC,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAAG,gCAAgC,GAC7E,kBAAkB,CA6KpB"}
|
@@ -102,38 +102,48 @@ function marginfiRebalance(context, input) {
|
|
102
102
|
isWritable: true,
|
103
103
|
value: input.positionSupplyTa ?? null,
|
104
104
|
},
|
105
|
-
|
105
|
+
signerSupplyTa: {
|
106
106
|
index: 15,
|
107
107
|
isWritable: true,
|
108
|
+
value: input.signerSupplyTa ?? null,
|
109
|
+
},
|
110
|
+
vaultSupplyTa: {
|
111
|
+
index: 16,
|
112
|
+
isWritable: true,
|
108
113
|
value: input.vaultSupplyTa ?? null,
|
109
114
|
},
|
110
115
|
supplyVaultAuthority: {
|
111
|
-
index:
|
116
|
+
index: 17,
|
112
117
|
isWritable: true,
|
113
118
|
value: input.supplyVaultAuthority ?? null,
|
114
119
|
},
|
115
120
|
debtBank: {
|
116
|
-
index:
|
121
|
+
index: 18,
|
117
122
|
isWritable: true,
|
118
123
|
value: input.debtBank ?? null,
|
119
124
|
},
|
120
125
|
debtPriceOracle: {
|
121
|
-
index:
|
126
|
+
index: 19,
|
122
127
|
isWritable: false,
|
123
128
|
value: input.debtPriceOracle ?? null,
|
124
129
|
},
|
125
130
|
positionDebtTa: {
|
126
|
-
index:
|
131
|
+
index: 20,
|
127
132
|
isWritable: true,
|
128
133
|
value: input.positionDebtTa ?? null,
|
129
134
|
},
|
135
|
+
signerDebtTa: {
|
136
|
+
index: 21,
|
137
|
+
isWritable: true,
|
138
|
+
value: input.signerDebtTa ?? null,
|
139
|
+
},
|
130
140
|
vaultDebtTa: {
|
131
|
-
index:
|
141
|
+
index: 22,
|
132
142
|
isWritable: true,
|
133
143
|
value: input.vaultDebtTa ?? null,
|
134
144
|
},
|
135
145
|
debtVaultAuthority: {
|
136
|
-
index:
|
146
|
+
index: 23,
|
137
147
|
isWritable: true,
|
138
148
|
value: input.debtVaultAuthority ?? null,
|
139
149
|
},
|
@@ -26,13 +26,13 @@ function getWSolUsage(client, solautoActions, initiatingDcaIn, cancellingDcaIn)
|
|
26
26
|
cancellingDcaIn);
|
27
27
|
if (supplyIsWsol && usingSupplyTaAction) {
|
28
28
|
return {
|
29
|
-
wSolTokenAccount: client.
|
29
|
+
wSolTokenAccount: client.signerSupplyTa,
|
30
30
|
solautoAction: usingSupplyTaAction,
|
31
31
|
};
|
32
32
|
}
|
33
33
|
else if (debtIsWsol && usingDebtTaAction) {
|
34
34
|
return {
|
35
|
-
wSolTokenAccount: client.
|
35
|
+
wSolTokenAccount: client.signerDebtTa,
|
36
36
|
solautoAction: usingDebtTaAction,
|
37
37
|
};
|
38
38
|
}
|
@@ -57,21 +57,21 @@ async function transactionChoresBefore(client, solautoActions, initiatingDcaIn)
|
|
57
57
|
}
|
58
58
|
const wSolUsage = getWSolUsage(client, solautoActions, initiatingDcaIn, undefined);
|
59
59
|
if (wSolUsage !== undefined) {
|
60
|
-
if (
|
60
|
+
if (await (0, generalUtils_1.getSolanaAccountCreated)(client.umi, wSolUsage.wSolTokenAccount)) {
|
61
61
|
client.log(`Closing signer wSol TA`);
|
62
62
|
chores = chores.add((0, solanaUtils_1.closeTokenAccountUmiIx)(client.signer, wSolUsage.wSolTokenAccount, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey)));
|
63
63
|
}
|
64
64
|
let amountToTransfer = BigInt(0);
|
65
65
|
if ((0, generated_1.isSolautoAction)("Deposit", wSolUsage.solautoAction)) {
|
66
|
-
amountToTransfer
|
66
|
+
amountToTransfer = BigInt(wSolUsage.solautoAction.fields[0]);
|
67
67
|
}
|
68
68
|
else if ((0, generated_1.isSolautoAction)("Repay", wSolUsage.solautoAction) &&
|
69
69
|
wSolUsage.solautoAction.fields[0].__kind === "Some") {
|
70
|
-
amountToTransfer
|
70
|
+
amountToTransfer = BigInt(wSolUsage.solautoAction.fields[0].fields[0]);
|
71
71
|
}
|
72
72
|
else if (initiatingDcaIn &&
|
73
73
|
client.debtMint.toString() === spl_token_1.NATIVE_MINT.toString()) {
|
74
|
-
amountToTransfer
|
74
|
+
amountToTransfer = initiatingDcaIn;
|
75
75
|
}
|
76
76
|
if (amountToTransfer > 0) {
|
77
77
|
const amount = amountToTransfer +
|
@@ -89,8 +89,8 @@ async function transactionChoresBefore(client, solautoActions, initiatingDcaIn)
|
|
89
89
|
continue;
|
90
90
|
}
|
91
91
|
const tokenAccount = (0, generated_1.isSolautoAction)("Withdraw", solautoAction)
|
92
|
-
? client.
|
93
|
-
: client.
|
92
|
+
? client.signerSupplyTa
|
93
|
+
: client.signerDebtTa;
|
94
94
|
if (accountsGettingCreated.includes(tokenAccount.toString())) {
|
95
95
|
continue;
|
96
96
|
}
|
@@ -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,EA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