Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Priority fees as optional flag #43

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function deployCommand() {
.addOption(COMMON_OPTIONS.keypair)
.addOption(COMMON_OPTIONS.config)
.addOption(COMMON_OPTIONS.outputOnly)
.addOption(COMMON_OPTIONS.priorityFees)
.action(async (options, { args: passThroughArgs }) => {
if (!options.outputOnly) {
titleMessage("Deploy a Solana program");
Expand Down Expand Up @@ -268,6 +269,7 @@ export function deployCommand() {
programId: programIdPath || programId,
url: options.url,
keypair: options.keypair,
priorityFees: options.priorityFees,
});

// todo: if options.url is localhost, verify the test validator is running
Expand Down
7 changes: 7 additions & 0 deletions src/const/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,11 @@ export const COMMON_OPTIONS = {
"--manifest-path <PATH>",
"path to Cargo.toml",
).default(join(process.cwd(), "Cargo.toml")),
/**
* priority fees in microlamports to add to transactions
*/
priorityFees: new Option(
"--priority-fees <MICROLAMPORTS>",
"priority fees in microlamports to add to transactions",
arrayappy marked this conversation as resolved.
Show resolved Hide resolved
),
};
7 changes: 7 additions & 0 deletions src/lib/shell/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type DeployProgramCommandInput = {
upgradeAuthority?: string;
keypair?: string;
url?: SolanaCluster | string;
priorityFees?: string;
arrayappy marked this conversation as resolved.
Show resolved Hide resolved
};

export function buildDeployProgramCommand({
Expand All @@ -24,6 +25,7 @@ export function buildDeployProgramCommand({
url,
keypair,
upgradeAuthority,
priorityFees,
arrayappy marked this conversation as resolved.
Show resolved Hide resolved
}: DeployProgramCommandInput) {
const command: string[] = ["solana program deploy"];

Expand Down Expand Up @@ -53,6 +55,11 @@ export function buildDeployProgramCommand({
command.push(`--program-id ${programId}`);
}

// Add priority fees if specified
if (priorityFees) {
command.push(`--with-compute-unit-price ${priorityFees}`);
}
arrayappy marked this conversation as resolved.
Show resolved Hide resolved

// todo: validate the `programPath` file exists
command.push(programPath);

Expand Down
Loading