@haven-fi/solauto-sdk 1.0.314 → 1.0.316
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.
- package/dist/utils/jitoUtils.d.ts.map +1 -1
- package/dist/utils/jitoUtils.js +10 -5
- package/package.json +1 -1
- package/src/utils/jitoUtils.ts +18 -12
@@ -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;
|
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,CA2C/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -49,11 +49,14 @@ async function getTipInstruction(signer, tipLamports) {
|
|
49
49
|
// }
|
50
50
|
// );
|
51
51
|
// }
|
52
|
-
async function umiToVersionedTransactions(umi, signer, txs, feeEstimates, computeUnitLimits) {
|
53
|
-
|
54
|
-
|
55
|
-
return versionedTx;
|
52
|
+
async function umiToVersionedTransactions(umi, signer, txs, sign, feeEstimates, computeUnitLimits) {
|
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);
|
56
55
|
}));
|
56
|
+
if (sign) {
|
57
|
+
await signer.signAllTransactions(builtTxs);
|
58
|
+
}
|
59
|
+
return builtTxs.map((x) => (0, umi_web3js_adapters_1.toWeb3JsTransaction)(x));
|
57
60
|
}
|
58
61
|
async function getBundleStatus(bundleId) {
|
59
62
|
const res = await axios_1.default.post(`${solautoConstants_1.JITO_BLOCK_ENGINE}/api/v1/bundles`, {
|
@@ -99,12 +102,14 @@ async function sendJitoBundledTransactions(umi, signer, txs, simulateOnly, prior
|
|
99
102
|
txs[0] = txs[0].prepend(await getTipInstruction(signer, 150000));
|
100
103
|
const feeEstimates = await Promise.all(txs.map(async (x) => (await (0, solanaUtils_1.getComputeUnitPriceEstimate)(umi, x, priorityFeeSetting)) ??
|
101
104
|
1000000));
|
102
|
-
let builtTxs = await umiToVersionedTransactions(umi, signer, txs,
|
105
|
+
let builtTxs = await umiToVersionedTransactions(umi, signer, txs, true, // false if simulating first and rebuilding later
|
106
|
+
feeEstimates);
|
103
107
|
// const simulationResults = await simulateJitoBundle(umi, builtTxs);
|
104
108
|
if (!simulateOnly) {
|
105
109
|
// let builtTxs = await umiToVersionedTransactions(
|
106
110
|
// client.signer,
|
107
111
|
// txs,
|
112
|
+
// true,
|
108
113
|
// feeEstimates,
|
109
114
|
// simulationResults.map((x) => x.unitsConsumed! * 1.15)
|
110
115
|
// );
|
package/package.json
CHANGED
package/src/utils/jitoUtils.ts
CHANGED
@@ -69,24 +69,28 @@ async function umiToVersionedTransactions(
|
|
69
69
|
umi: Umi,
|
70
70
|
signer: Signer,
|
71
71
|
txs: TransactionBuilder[],
|
72
|
+
sign: boolean,
|
72
73
|
feeEstimates: number[],
|
73
74
|
computeUnitLimits?: number[]
|
74
75
|
): Promise<VersionedTransaction[]> {
|
75
|
-
|
76
|
+
const builtTxs = await Promise.all(
|
76
77
|
txs.map(async (tx, i) => {
|
77
|
-
|
78
|
-
await (
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
).buildAndSign(umi)
|
86
|
-
);
|
87
|
-
return versionedTx;
|
78
|
+
return (
|
79
|
+
await assembleFinalTransaction(
|
80
|
+
signer,
|
81
|
+
tx,
|
82
|
+
feeEstimates[i],
|
83
|
+
computeUnitLimits ? computeUnitLimits[i] : undefined
|
84
|
+
).setLatestBlockhash(umi)
|
85
|
+
).build(umi);
|
88
86
|
})
|
89
87
|
);
|
88
|
+
|
89
|
+
if (sign) {
|
90
|
+
await signer.signAllTransactions(builtTxs);
|
91
|
+
}
|
92
|
+
|
93
|
+
return builtTxs.map((x) => toWeb3JsTransaction(x));
|
90
94
|
}
|
91
95
|
|
92
96
|
async function getBundleStatus(bundleId: string) {
|
@@ -165,6 +169,7 @@ export async function sendJitoBundledTransactions(
|
|
165
169
|
umi,
|
166
170
|
signer,
|
167
171
|
txs,
|
172
|
+
true, // false if simulating first and rebuilding later
|
168
173
|
feeEstimates
|
169
174
|
);
|
170
175
|
|
@@ -174,6 +179,7 @@ export async function sendJitoBundledTransactions(
|
|
174
179
|
// let builtTxs = await umiToVersionedTransactions(
|
175
180
|
// client.signer,
|
176
181
|
// txs,
|
182
|
+
// true,
|
177
183
|
// feeEstimates,
|
178
184
|
// simulationResults.map((x) => x.unitsConsumed! * 1.15)
|
179
185
|
// );
|