@haven-fi/solauto-sdk 1.0.715 → 1.0.717
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../../src/services/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAIL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA4BjE,OAAO,EAAE,qBAAqB,EAAyB,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../../src/services/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAIL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA4BjE,OAAO,EAAE,qBAAqB,EAAyB,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAgM/F,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAyF7B;AA+LD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,gCAAgC,CACpD,eAAe,EAAE,oBAAoB,EACrC,YAAY,EAAE,SAAS,EACvB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAuC5C;AAED,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,kBAAkB,EAAE,EACzB,KAAK,EAAE,KAAK,EACZ,oBAAoB,CAAC,EAAE,OAAO,EAC9B,kBAAkB,CAAC,EAAE,kBAAkB;;;;EAuHxC;AAED,wBAAgB,cAAc,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,8JAErE"}
|
@@ -92,6 +92,8 @@ async function transactionChoresBefore(client, accountsGettingCreated, solautoAc
|
|
92
92
|
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), spl_token_1.NATIVE_MINT));
|
93
93
|
accountsGettingCreated.push(wSolUsage.wSolTokenAccount.toString());
|
94
94
|
}
|
95
|
+
console.log(solautoActions);
|
96
|
+
console.log(accountsGettingCreated);
|
95
97
|
for (const solautoAction of solautoActions ?? []) {
|
96
98
|
if (!(0, generated_1.isSolautoAction)("Withdraw", solautoAction) &&
|
97
99
|
!(0, generated_1.isSolautoAction)("Borrow", solautoAction)) {
|
@@ -100,9 +102,13 @@ async function transactionChoresBefore(client, accountsGettingCreated, solautoAc
|
|
100
102
|
const tokenAccount = (0, generated_1.isSolautoAction)("Withdraw", solautoAction)
|
101
103
|
? client.signerSupplyTa
|
102
104
|
: client.signerDebtTa;
|
105
|
+
console.log("withdraw", (0, generated_1.isSolautoAction)("Withdraw", solautoAction));
|
106
|
+
console.log(tokenAccount);
|
107
|
+
console.log("already getting created", accountsGettingCreated.includes(tokenAccount.toString()));
|
103
108
|
if (accountsGettingCreated.includes(tokenAccount.toString())) {
|
104
109
|
continue;
|
105
110
|
}
|
111
|
+
console.log("exists", (0, utils_1.getSolanaAccountCreated)(client.umi, tokenAccount));
|
106
112
|
if (!(0, utils_1.getSolanaAccountCreated)(client.umi, tokenAccount)) {
|
107
113
|
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), (0, generated_1.isSolautoAction)("Withdraw", solautoAction)
|
108
114
|
? client.pos.supplyMint
|
@@ -110,6 +116,7 @@ async function transactionChoresBefore(client, accountsGettingCreated, solautoAc
|
|
110
116
|
accountsGettingCreated.push(tokenAccount.toString());
|
111
117
|
}
|
112
118
|
}
|
119
|
+
console.log(chores.getInstructions().length);
|
113
120
|
return chores;
|
114
121
|
}
|
115
122
|
async function rebalanceChoresBefore(client, tx, accountsGettingCreated) {
|
package/local/txSandbox.ts
CHANGED
@@ -22,7 +22,7 @@ import {
|
|
22
22
|
} from "../src";
|
23
23
|
import { getSecretKey } from "./shared";
|
24
24
|
|
25
|
-
const payForTransaction =
|
25
|
+
const payForTransaction = false;
|
26
26
|
const testProgram = false;
|
27
27
|
const lpEnv: ProgramEnv = "Prod";
|
28
28
|
|
@@ -47,27 +47,23 @@ export async function main() {
|
|
47
47
|
});
|
48
48
|
|
49
49
|
await client.initializeExistingSolautoPosition({
|
50
|
-
positionId:
|
51
|
-
authority: new PublicKey("
|
50
|
+
positionId: 2,
|
51
|
+
authority: new PublicKey("EBhRj7jbF2EVE21i19JSuCX1BAbnZFYhoKW64HnaZ3kf"),
|
52
52
|
// lpUserAccount: new PublicKey(
|
53
53
|
// "GEokw9jqbh6d1xUNA3qaeYFFetbSR5Y1nt7C3chwwgSz"
|
54
54
|
// ),
|
55
55
|
});
|
56
56
|
|
57
|
-
|
57
|
+
const transactionItems = [rebalance(client)];
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
// retryConfig: { totalRetries: 2 },
|
68
|
-
// });
|
69
|
-
// const statuses = await txManager.send(transactionItems);
|
70
|
-
// consoleLog(statuses);
|
59
|
+
const txManager = new ClientTransactionsManager({
|
60
|
+
txHandler: client,
|
61
|
+
txRunType: payForTransaction ? "normal" : "only-simulate",
|
62
|
+
priorityFeeSetting: PriorityFeeSetting.Default,
|
63
|
+
retryConfig: { totalRetries: 2 },
|
64
|
+
});
|
65
|
+
const statuses = await txManager.send(transactionItems);
|
66
|
+
consoleLog(statuses);
|
71
67
|
}
|
72
68
|
|
73
69
|
async function refreshAll() {
|
package/package.json
CHANGED
@@ -208,6 +208,8 @@ async function transactionChoresBefore(
|
|
208
208
|
accountsGettingCreated.push(wSolUsage.wSolTokenAccount.toString());
|
209
209
|
}
|
210
210
|
|
211
|
+
console.log(solautoActions);
|
212
|
+
console.log(accountsGettingCreated);
|
211
213
|
for (const solautoAction of solautoActions ?? []) {
|
212
214
|
if (
|
213
215
|
!isSolautoAction("Withdraw", solautoAction) &&
|
@@ -219,10 +221,15 @@ async function transactionChoresBefore(
|
|
219
221
|
const tokenAccount = isSolautoAction("Withdraw", solautoAction)
|
220
222
|
? client.signerSupplyTa
|
221
223
|
: client.signerDebtTa;
|
224
|
+
|
225
|
+
console.log("withdraw", isSolautoAction("Withdraw", solautoAction));
|
226
|
+
console.log(tokenAccount);
|
227
|
+
console.log("already getting created", accountsGettingCreated.includes(tokenAccount.toString()))
|
222
228
|
if (accountsGettingCreated.includes(tokenAccount.toString())) {
|
223
229
|
continue;
|
224
230
|
}
|
225
231
|
|
232
|
+
console.log("exists", getSolanaAccountCreated(client.umi, tokenAccount))
|
226
233
|
if (!getSolanaAccountCreated(client.umi, tokenAccount)) {
|
227
234
|
chores = chores.add(
|
228
235
|
createAssociatedTokenAccountUmiIx(
|
@@ -237,6 +244,7 @@ async function transactionChoresBefore(
|
|
237
244
|
}
|
238
245
|
}
|
239
246
|
|
247
|
+
console.log(chores.getInstructions().length);
|
240
248
|
return chores;
|
241
249
|
}
|
242
250
|
|