@pooflabs/core 0.0.40 → 0.0.41
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/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/utils/sol/sol-utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2977,7 +2977,7 @@ function convertRemainingAccounts(remainingAccounts) {
|
|
|
2977
2977
|
// ─────────────────────────────────────────────────────────────
|
|
2978
2978
|
// Updated Transaction Builder: It now accepts a PublicKey for the payer
|
|
2979
2979
|
// ─────────────────────────────────────────────────────────────
|
|
2980
|
-
async function buildSetDocumentsTransaction(connection, idl, anchorProvider, payerPublicKey, args, remainingAccounts, lutKey, preInstructions, simulate) {
|
|
2980
|
+
async function buildSetDocumentsTransaction(connection, idl, anchorProvider, payerPublicKey, args, remainingAccounts, lutKey, preInstructions, simulate, additionalLutAddresses) {
|
|
2981
2981
|
const computeBudgetIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
2982
2982
|
units: 1400000,
|
|
2983
2983
|
});
|
|
@@ -3018,8 +3018,25 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
3018
3018
|
tx.feePayer = payerPublicKey;
|
|
3019
3019
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
3020
3020
|
tx.recentBlockhash = blockhash;
|
|
3021
|
-
|
|
3022
|
-
|
|
3021
|
+
// Resolve LUTs: additionalLutAddresses (when present) is the authoritative set.
|
|
3022
|
+
// Falls back to lutKey alone for backwards compatibility.
|
|
3023
|
+
const lookupTables = [];
|
|
3024
|
+
const isSurfnet = anchorProvider.connection.rpcEndpoint == "https://surfpool.fly.dev";
|
|
3025
|
+
if (additionalLutAddresses && additionalLutAddresses.length > 0) {
|
|
3026
|
+
const results = await Promise.all(additionalLutAddresses.map(addr => connection.getAddressLookupTable(new web3_js.PublicKey(addr)).catch(() => null)));
|
|
3027
|
+
for (const result of results) {
|
|
3028
|
+
if (result === null || result === void 0 ? void 0 : result.value) {
|
|
3029
|
+
lookupTables.push(result.value);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
else if (lutKey != null) {
|
|
3034
|
+
const { value: table } = await connection.getAddressLookupTable(new web3_js.PublicKey(lutKey));
|
|
3035
|
+
if (!table)
|
|
3036
|
+
throw new Error('LUT not found after creation/extend');
|
|
3037
|
+
lookupTables.push(table);
|
|
3038
|
+
}
|
|
3039
|
+
if (lookupTables.length === 0) {
|
|
3023
3040
|
const computeUnits = isSurfnet ? 1400000 : await getSimulationComputeUnits(connection, tx.instructions, payerPublicKey, []);
|
|
3024
3041
|
const computeBudgetIxOptimized = web3_js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
3025
3042
|
units: computeUnits ? computeUnits * 1.2 : 1400000,
|
|
@@ -3027,11 +3044,7 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
3027
3044
|
tx.instructions[0] = computeBudgetIxOptimized;
|
|
3028
3045
|
return { tx, blockhash, lastValidBlockHeight };
|
|
3029
3046
|
}
|
|
3030
|
-
const
|
|
3031
|
-
if (!table)
|
|
3032
|
-
throw new Error('LUT not found after creation/extend');
|
|
3033
|
-
const isSurfnet = anchorProvider.connection.rpcEndpoint == "https://surfpool.fly.dev";
|
|
3034
|
-
const computeUnits = isSurfnet ? 1400000 : await getSimulationComputeUnits(connection, tx.instructions, payerPublicKey, [table]);
|
|
3047
|
+
const computeUnits = isSurfnet ? 1400000 : await getSimulationComputeUnits(connection, tx.instructions, payerPublicKey, lookupTables);
|
|
3035
3048
|
const computeBudgetIxOptimized = web3_js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
3036
3049
|
units: computeUnits ? computeUnits * 1.2 : 1400000,
|
|
3037
3050
|
}); // 20% buffer
|
|
@@ -3040,7 +3053,7 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
3040
3053
|
payerKey: payerPublicKey,
|
|
3041
3054
|
recentBlockhash: blockhash,
|
|
3042
3055
|
instructions: tx.instructions,
|
|
3043
|
-
}).compileToV0Message(
|
|
3056
|
+
}).compileToV0Message(lookupTables);
|
|
3044
3057
|
const vTx = new anchor__namespace.web3.VersionedTransaction(msgV0);
|
|
3045
3058
|
return { tx: vTx, blockhash, lastValidBlockHeight };
|
|
3046
3059
|
}
|
|
@@ -3924,6 +3937,7 @@ async function setMany(many, options) {
|
|
|
3924
3937
|
appId: config.appId,
|
|
3925
3938
|
txArgs: [solTransactionData],
|
|
3926
3939
|
lutKey: (_c = tx.lutAddress) !== null && _c !== void 0 ? _c : null,
|
|
3940
|
+
additionalLutAddresses: tx.additionalLutAddresses,
|
|
3927
3941
|
network: tx.network,
|
|
3928
3942
|
preInstructions: (_e = (_d = tx.preInstructions) === null || _d === void 0 ? void 0 : _d.map((ix) => {
|
|
3929
3943
|
var _a;
|