-
Notifications
You must be signed in to change notification settings - Fork 153
-
Good afternoon
In connection with this event https://solana.com/news/block-optimization-on-the-solana-network it becomes almost impossible to use the library, since it is impossible to send a transaction without a priority commission!
it is impossible to use the services; It is recommended to add a priority fee to the transaction.
https://docs.helius.dev/solana-rpc-nodes/alpha-priority-fee-api
https://docs.chainstack.com/docs/solana-how-to-priority-fees-faster-transactions
ComputeBudgetProgram is missing (example of implementation in the Tupe script https://github.com/solana-labs/solana-web3.js/blob/3da6574/packages/library-legacy/src/programs/compute-budget.ts#L227), with with which you can specify in the transaction the size of the priority commission accepted by the node.
implementation that is not in SOLNET on wen web3.js
const AdvanceNonce = SystemProgram.nonceAdvance({
noncePubkey: nonceAccountPubkey,
authorizedPubkey: nonceAccountAuth.publicKey,
});
const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
units: 300,
});
const addPriorityFee = ComputeBudgetProgram.setComputeUnitPrice({
microlamports: 20000,
});
persistent transaction = new transaction()
.add(advanceNonce)
.add(modifyComputeUnits)
.add(addPriorityFee)
.add(
SystemProgram.transfer({
fromPubkey: payer.publicKey,
toPubkey: toAccount,
lamps: 10000000,
}),
);
is it possible to add this implementation to the library?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments
-
something like this is required
public class ComputeBudgetProgram
{
public static readonly PublicKey ProgramId = new PublicKey("ComputeBudget111111111111111111111111111111");
public struct RequestHeapFrameParams
{
public ulong Bytes;
}
public struct SetComputeUnitLimitParams
{
public ulong Units;
}
public struct SetComputeUnitPriceParams
{
public ulong MicroLamports;
}
public static TransactionInstruction RequestHeapFrame(RequestHeapFrameParams params)
{
var data = new byte[] { };
return new TransactionInstruction
{
Keys = new List<AccountMeta>(),
ProgramId = ProgramId,
Data = data
};
}
public static TransactionInstruction SetComputeUnitLimit(SetComputeUnitLimitParams params)
{
var data = new byte[] { };
return new TransactionInstruction
{
Keys = new List<AccountMeta>(),
ProgramId = ProgramId,
Data = data
};
}
public static TransactionInstruction SetComputeUnitPrice(SetComputeUnitPriceParams params)
{
var data = new byte[] { };
return new TransactionInstruction
{
Keys = new List<AccountMeta>(),
ProgramId = ProgramId,
Data = data
};
}
private static byte[] EncodeData<T>(T params)
{
// Here it is necessary to implement the logic for converting the parameter structure
// into an array of bytes that will be sent in transactions.
// This may include using BitConverter for numeric values
// and adding the required command bytes at the beginning of the array.
}
}
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks to all participants for the code.
Here is the implementation https://github.com/brunopedrazza/Solnet
Beta Was this translation helpful? Give feedback.