Skip to content

Commit

Permalink
Use microLamports for setComputeUnitPrice (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva authored Sep 5, 2023
1 parent e118ea6 commit 47657c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions clients/js/src/generated/instructions/setComputeUnitPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

import {
Context,
SolAmount,
TransactionBuilder,
mapAmountSerializer,
transactionBuilder,
} from '@metaplex-foundation/umi';
import {
Expand All @@ -30,12 +28,12 @@ import {
export type SetComputeUnitPriceInstructionData = {
discriminator: number;
/** Transaction compute unit price used for prioritization fees. */
lamports: SolAmount;
microLamports: bigint;
};

export type SetComputeUnitPriceInstructionDataArgs = {
/** Transaction compute unit price used for prioritization fees. */
lamports: SolAmount;
microLamports: number | bigint;
};

export function getSetComputeUnitPriceInstructionDataSerializer(): Serializer<
Expand All @@ -50,7 +48,7 @@ export function getSetComputeUnitPriceInstructionDataSerializer(): Serializer<
struct<SetComputeUnitPriceInstructionData>(
[
['discriminator', u8()],
['lamports', mapAmountSerializer(u64(), 'SOL', 9)],
['microLamports', u64()],
],
{ description: 'SetComputeUnitPriceInstructionData' }
),
Expand Down
1 change: 0 additions & 1 deletion configs/kinobi.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ kinobi.update(
new k.SetNumberWrappersVisitor({
"splSystem.CreateAccount.lamports": { kind: "SolAmount" },
"splSystem.TransferSol.amount": { kind: "SolAmount" },
"splComputeBudget.SetComputeUnitPrice.lamports": { kind: "SolAmount" },
})
);

Expand Down
2 changes: 1 addition & 1 deletion idls/spl_compute_budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"discriminant": { "value": 3, "type": "u8" },
"args": [
{
"name": "lamports",
"name": "microLamports",
"type": "u64",
"docs": [
"Transaction compute unit price used for prioritization fees."
Expand Down

0 comments on commit 47657c7

Please sign in to comment.