@haven-fi/solauto-sdk 1.0.321 → 1.0.322
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":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AA8GD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,kBAAkB,EAAE,EACzB,YAAY,CAAC,EAAE,OAAO,EACtB,kBAAkB,GAAE,kBAA2C,GAC9D,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,
|
1
|
+
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AA8GD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,kBAAkB,EAAE,EACzB,YAAY,CAAC,EAAE,OAAO,EACtB,kBAAkB,GAAE,kBAA2C,GAC9D,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CA8C/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -51,7 +51,7 @@ async function getTipInstruction(signer, tipLamports) {
|
|
51
51
|
// }
|
52
52
|
async function umiToVersionedTransactions(umi, signer, txs, sign, feeEstimates, computeUnitLimits) {
|
53
53
|
const builtTxs = await Promise.all(txs.map(async (tx, i) => {
|
54
|
-
return (await (0, solanaUtils_1.assembleFinalTransaction)(signer, tx, feeEstimates[i], computeUnitLimits ? computeUnitLimits[i] : undefined).setLatestBlockhash(umi)).build(umi);
|
54
|
+
return (await (0, solanaUtils_1.assembleFinalTransaction)(signer, tx, feeEstimates ? feeEstimates[i] : undefined, computeUnitLimits ? computeUnitLimits[i] : undefined).setLatestBlockhash(umi)).build(umi);
|
55
55
|
}));
|
56
56
|
if (sign) {
|
57
57
|
await signer.signAllTransactions(builtTxs);
|
@@ -100,8 +100,10 @@ async function sendJitoBundledTransactions(umi, signer, txs, simulateOnly, prior
|
|
100
100
|
(0, generalUtils_1.consoleLog)("Transactions: ", txs.length);
|
101
101
|
(0, generalUtils_1.consoleLog)("Transaction sizes: ", txs.map((x) => x.getTransactionSize(umi)));
|
102
102
|
txs[0] = txs[0].prepend(await getTipInstruction(signer, 150000));
|
103
|
-
const feeEstimates =
|
104
|
-
|
103
|
+
const feeEstimates = priorityFeeSetting !== types_1.PriorityFeeSetting.None
|
104
|
+
? await Promise.all(txs.map(async (x) => (await (0, solanaUtils_1.getComputeUnitPriceEstimate)(umi, x, priorityFeeSetting)) ??
|
105
|
+
1000000))
|
106
|
+
: undefined;
|
105
107
|
let builtTxs = await umiToVersionedTransactions(umi, signer, txs, true, // false if simulating first and rebuilding later
|
106
108
|
feeEstimates);
|
107
109
|
// const simulationResults = await simulateJitoBundle(umi, builtTxs);
|
package/package.json
CHANGED
package/src/utils/jitoUtils.ts
CHANGED
@@ -70,7 +70,7 @@ async function umiToVersionedTransactions(
|
|
70
70
|
signer: Signer,
|
71
71
|
txs: TransactionBuilder[],
|
72
72
|
sign: boolean,
|
73
|
-
feeEstimates
|
73
|
+
feeEstimates?: number[],
|
74
74
|
computeUnitLimits?: number[]
|
75
75
|
): Promise<VersionedTransaction[]> {
|
76
76
|
const builtTxs = await Promise.all(
|
@@ -79,7 +79,7 @@ async function umiToVersionedTransactions(
|
|
79
79
|
await assembleFinalTransaction(
|
80
80
|
signer,
|
81
81
|
tx,
|
82
|
-
feeEstimates[i],
|
82
|
+
feeEstimates ? feeEstimates[i] : undefined,
|
83
83
|
computeUnitLimits ? computeUnitLimits[i] : undefined
|
84
84
|
).setLatestBlockhash(umi)
|
85
85
|
).build(umi);
|
@@ -157,13 +157,16 @@ export async function sendJitoBundledTransactions(
|
|
157
157
|
);
|
158
158
|
|
159
159
|
txs[0] = txs[0].prepend(await getTipInstruction(signer, 150_000));
|
160
|
-
const feeEstimates =
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
160
|
+
const feeEstimates =
|
161
|
+
priorityFeeSetting !== PriorityFeeSetting.None
|
162
|
+
? await Promise.all(
|
163
|
+
txs.map(
|
164
|
+
async (x) =>
|
165
|
+
(await getComputeUnitPriceEstimate(umi, x, priorityFeeSetting)) ??
|
166
|
+
1000000
|
167
|
+
)
|
168
|
+
)
|
169
|
+
: undefined;
|
167
170
|
|
168
171
|
let builtTxs = await umiToVersionedTransactions(
|
169
172
|
umi,
|