michaelhly / solana-py

Solana Python SDK

Home Page:https://michaelhly.github.io/solana-py

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set higher fee for transactions

Tongoko opened this issue · comments

Hello!
Is it possile to set custom fees for transactions? All of the transactions seem to be using the default fee of 0.000005 SOL, but how could I change it to a higher amount?
Thanks

No need to port it, Solders already has it.

>>> from solders.compute_budget import set_compute_unit_limit
>>> set_compute_unit_limit(1_000_000)
Instruction(
    Instruction {
        program_id: ComputeBudget111111111111111111111111111111,
        accounts: [],
        data: [
            2,
            64,
            66,
            15,
            0,
        ],
    },
)

So just include a compute budget instruction in your transaction message

No need to port it, Solders already has it.

>>> from solders.compute_budget import set_compute_unit_limit
>>> set_compute_unit_limit(1_000_000)
Instruction(
    Instruction {
        program_id: ComputeBudget111111111111111111111111111111,
        accounts: [],
        data: [
            2,
            64,
            66,
            15,
            0,
        ],
    },
)

So just include a compute budget instruction in your transaction message

If i want to do token transfer, how can i add this to the code?

result = usdc_token.transfer(sender_token_address, receiver_token_address, sender, balance)