Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 2 additions & 3 deletions scripts/src/commands/sol/base-relayer/initialize.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ export async function handleInitialize(args: Args): Promise<void> {
try {
logger.info("--- Initialize base-relayer script ---");

const rpcUrl = devnet(args.rpcUrl);
logger.info(`RPC URL: ${rpcUrl}`);
logger.info(`RPC URL: ${args.rpcUrl}`);
logger.info(`Program ID: ${args.programId}`);

const payer = await resolvePayerKeypair(args.payerKp);
Expand Down Expand Up @@ -127,7 +126,7 @@ export async function handleInitialize(args: Args): Promise<void> {
logger.success(`Signature: ${signature}`);

await assertInitialized(
createSolanaRpc(rpcUrl),
createSolanaRpc(args.rpcUrl),
cfgAddress,
guardianAddress,
eip1559Config,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Command } from "commander";

import {
getInteractiveSelect,
getInteractiveConfirm,
getOrPromptHash,
getOrPromptFilePath,
getOrPromptDeployEnv,
validateAndExecute,
} from "@internal/utils/cli";
import { logger } from "@internal/logger";
Expand All @@ -24,14 +24,7 @@ async function collectInteractiveOptions(
let opts = { ...options };

if (!opts.deployEnv) {
opts.deployEnv = await getInteractiveSelect({
message: "Select target deploy environment:",
options: [
{ value: "testnet-alpha", label: "Testnet Alpha" },
{ value: "testnet-prod", label: "Testnet Prod" },
],
initialValue: "testnet-alpha",
});
opts.deployEnv = await getOrPromptDeployEnv();
}

opts.transactionHash = await getOrPromptHash(
Expand Down Expand Up @@ -60,7 +53,7 @@ export const proveMessageCommand = new Command("prove-message")
.description("Prove a message from Base transaction on Solana")
.option(
"--deploy-env <deployEnv>",
"Target deploy environment (testnet-alpha | testnet-prod)"
"Target deploy environment (testnet-alpha | testnet-prod | mainnet)"
)
.option("--transaction-hash <hash>", "Base transaction hash to prove (0x...)")
.option(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export const argsSchema = z.object({
deployEnv: z
.enum(DEPLOY_ENVS, {
message:
"Deploy environment must be either 'testnet-alpha' or 'testnet-prod'",
"Deploy environment must be 'testnet-alpha', 'testnet-prod', or 'mainnet'",
})
.default("testnet-alpha"),
.default("testnet-prod"),
transactionHash: z
.string()
.regex(/^0x[a-fA-F0-9]{64}$/, {
Expand All @@ -59,9 +59,8 @@ export async function handleProveMessage(args: Args) {
logger.info("--- Prove message script ---");

const config = CONFIGS[args.deployEnv];
const rpcUrl = devnet(config.solana.rpcUrl);
const rpc = createSolanaRpc(rpcUrl);
logger.info(`RPC URL: ${rpcUrl}`);
const rpc = createSolanaRpc(config.solana.rpcUrl);
logger.info(`RPC URL: ${config.solana.rpcUrl}`);

const payer = await resolvePayerKeypair(args.payerKp);
logger.info(`Payer: ${payer.address}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Command } from "commander";

import {
getInteractiveSelect,
getOrPromptHash,
getOrPromptFilePath,
getOrPromptDeployEnv,
validateAndExecute,
} from "@internal/utils/cli";
import { argsSchema, handleRelayMessage } from "./relay-message.handler";
Expand All @@ -20,14 +20,7 @@ async function collectInteractiveOptions(
let opts = { ...options };

if (!opts.deployEnv) {
opts.deployEnv = await getInteractiveSelect({
message: "Select target deploy environment:",
options: [
{ value: "testnet-alpha", label: "Testnet Alpha" },
{ value: "testnet-prod", label: "Testnet Prod" },
],
initialValue: "testnet-alpha",
});
opts.deployEnv = await getOrPromptDeployEnv();
}

opts.messageHash = await getOrPromptHash(
Expand All @@ -48,7 +41,7 @@ export const relayMessageCommand = new Command("relay-message")
.description("Relay a message from Base to Solana")
.option(
"--deploy-env <deployEnv>",
"Target deploy environment (testnet-alpha | testnet-prod)"
"Target deploy environment (testnet-alpha | testnet-prod | mainnet)"
)
.option("--message-hash <hash>", "Message hash to relay (0x...)")
.option(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export const argsSchema = z.object({
deployEnv: z
.enum(DEPLOY_ENVS, {
message:
"Deploy environment must be either 'testnet-alpha' or 'testnet-prod'",
"Deploy environment must be 'testnet-alpha', 'testnet-prod', or 'mainnet'",
})
.default("testnet-alpha"),
.default("testnet-prod"),
messageHash: z
.string()
.regex(/^0x[a-fA-F0-9]{64}$/, {
Expand All @@ -64,9 +64,8 @@ export async function handleRelayMessage(args: Args): Promise<void> {
logger.info("--- Relay message script ---");

const config = CONFIGS[args.deployEnv];
const rpcUrl = devnet(config.solana.rpcUrl);
const rpc = createSolanaRpc(rpcUrl);
logger.info(`RPC URL: ${rpcUrl}`);
const rpc = createSolanaRpc(config.solana.rpcUrl);
logger.info(`RPC URL: ${config.solana.rpcUrl}`);

const payer = await resolvePayerKeypair(args.payerKp);
logger.info(`Payer: ${payer.address}`);
Expand Down
5 changes: 2 additions & 3 deletions scripts/src/commands/sol/bridge/initialize.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ export async function handleInitialize(args: InitializeArgs): Promise<void> {
try {
logger.info("--- Initialize bridge script ---");

const rpcUrl = devnet(args.rpcUrl);
logger.info(`RPC URL: ${rpcUrl}`);
logger.info(`RPC URL: ${args.rpcUrl}`);
logger.info(`Program ID: ${args.programId}`);

// Resolve payer keypair
Expand Down Expand Up @@ -215,7 +214,7 @@ export async function handleInitialize(args: InitializeArgs): Promise<void> {
logger.success(`Signature: ${signature}`);

await assertInitialized(
createSolanaRpc(rpcUrl),
createSolanaRpc(args.rpcUrl),
bridgeAccountAddress,
guardianAddress,
eip1559Config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
getOrPromptHex,
getOrPromptEvmAddress,
getOrPromptFilePath,
getOrPromptDeployEnv,
validateAndExecute,
} from "@internal/utils/cli";
import { argsSchema, handleBridgeCall } from "./bridge-call.handler";
Expand All @@ -26,14 +27,7 @@ async function collectInteractiveOptions(
let opts = { ...options };

if (!opts.deployEnv) {
opts.deployEnv = await getInteractiveSelect({
message: "Select target deploy environment:",
options: [
{ value: "testnet-alpha", label: "Testnet Alpha" },
{ value: "testnet-prod", label: "Testnet Prod" },
],
initialValue: "testnet-alpha",
});
opts.deployEnv = await getOrPromptDeployEnv();
}

opts.payerKp = await getOrPromptFilePath(
Expand Down Expand Up @@ -103,7 +97,7 @@ export const bridgeCallCommand = new Command("bridge-call")
.description("Execute a bridge call from Solana to Base")
.option(
"--deploy-env <deployEnv>",
"Target deploy environment (testnet-alpha | testnet-prod)"
"Target deploy environment (testnet-alpha | testnet-prod | mainnet)"
)
.option(
"--payer-kp <path>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { z } from "zod";
import {
getProgramDerivedAddress,
createSolanaRpc,
devnet,
type Instruction,
} from "@solana/kit";
import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
Expand Down Expand Up @@ -31,9 +30,9 @@ export const argsSchema = z.object({
deployEnv: z
.enum(DEPLOY_ENVS, {
message:
"Deploy environment must be either 'testnet-alpha' or 'testnet-prod'",
"Deploy environment must be 'testnet-alpha', 'testnet-prod', or 'mainnet'",
})
.default("testnet-alpha"),
.default("testnet-prod"),
payerKp: z
.union([z.literal("config"), z.string().brand<"payerKp">()])
.default("config"),
Expand Down Expand Up @@ -66,9 +65,8 @@ export async function handleBridgeCall(args: Args): Promise<void> {
logger.info("--- Bridge call script ---");

const config = CONFIGS[args.deployEnv];
const rpcUrl = devnet(config.solana.rpcUrl);
const rpc = createSolanaRpc(rpcUrl);
logger.info(`RPC URL: ${rpcUrl}`);
const rpc = createSolanaRpc(config.solana.rpcUrl);
logger.info(`RPC URL: ${config.solana.rpcUrl}`);

const payer = await resolvePayerKeypair(args.payerKp);
logger.info(`Payer: ${payer.address}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Command } from "commander";

import {
getInteractiveSelect,
getInteractiveConfirm,
getOrPromptEvmAddress,
getOrPromptDecimal,
getOrPromptFilePath,
getOrPromptDeployEnv,
validateAndExecute,
} from "@internal/utils/cli";
import { argsSchema, handleBridgeSol } from "./bridge-sol.handler";
Expand All @@ -24,14 +24,7 @@ async function collectInteractiveOptions(
let opts = { ...options };

if (!opts.deployEnv) {
opts.deployEnv = await getInteractiveSelect({
message: "Select target deploy environment:",
options: [
{ value: "testnet-alpha", label: "Testnet Alpha" },
{ value: "testnet-prod", label: "Testnet Prod" },
],
initialValue: "testnet-alpha",
});
opts.deployEnv = await getOrPromptDeployEnv();
}

opts.to = await getOrPromptEvmAddress(
Expand Down Expand Up @@ -65,7 +58,7 @@ export const bridgeSolCommand = new Command("bridge-sol")
.description("Bridge SOL from Solana to Base")
.option(
"--deploy-env <deployEnv>",
"Target deploy environment (testnet-alpha | testnet-prod)"
"Target deploy environment (testnet-alpha | testnet-prod | mainnet)"
)
.option("--to <address>", "Recipient address on Base")
.option("--amount <amount>", "Amount to bridge in SOL")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { z } from "zod";
import {
getProgramDerivedAddress,
devnet,
type Instruction,
createSolanaRpc,
} from "@solana/kit";
Expand All @@ -28,9 +27,9 @@ export const argsSchema = z.object({
deployEnv: z
.enum(DEPLOY_ENVS, {
message:
"Deploy environment must be either 'testnet-alpha' or 'testnet-prod'",
"Deploy environment must be 'testnet-alpha', 'testnet-prod', or 'mainnet'",
})
.default("testnet-alpha"),
.default("testnet-prod"),
to: z
.string()
.refine((value) => isEvmAddress(value), {
Expand All @@ -57,9 +56,8 @@ export async function handleBridgeSol(args: Args): Promise<void> {
logger.info("--- Bridge SOL script ---");

const config = CONFIGS[args.deployEnv];
const rpcUrl = devnet(config.solana.rpcUrl);
const rpc = createSolanaRpc(rpcUrl);
logger.info(`RPC URL: ${rpcUrl}`);
const rpc = createSolanaRpc(config.solana.rpcUrl);
logger.info(`RPC URL: ${config.solana.rpcUrl}`);

const payer = await resolvePayerKeypair(args.payerKp);
logger.info(`Payer: ${payer.address}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Command } from "commander";

import {
getInteractiveSelect,
getInteractiveConfirm,
getOrPromptEvmAddress,
getOrPromptSolanaAddress,
getOrPromptDecimal,
getOrPromptFilePath,
getOrPromptDeployEnv,
validateAndExecute,
} from "@internal/utils/cli";
import { argsSchema, handleBridgeSpl } from "./bridge-spl.handler";
Expand All @@ -28,14 +28,7 @@ async function collectInteractiveOptions(
let opts = { ...options };

if (!opts.deployEnv) {
opts.deployEnv = await getInteractiveSelect({
message: "Select target deploy environment:",
options: [
{ value: "testnet-alpha", label: "Testnet Alpha" },
{ value: "testnet-prod", label: "Testnet Prod" },
],
initialValue: "testnet-alpha",
});
opts.deployEnv = await getOrPromptDeployEnv();
}

if (!opts.mint) {
Expand Down Expand Up @@ -130,7 +123,7 @@ export const bridgeSplCommand = new Command("bridge-spl")
.description("Bridge SPL tokens from Solana to Base")
.option(
"--deploy-env <deployEnv>",
"Target deploy environment (testnet-alpha | testnet-prod)"
"Target deploy environment (testnet-alpha | testnet-prod | mainnet)"
)
.option(
"--mint <address>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { z } from "zod";
import {
getBase58Encoder,
getProgramDerivedAddress,
devnet,
address,
createSolanaRpc,
type Account,
Expand Down Expand Up @@ -40,9 +39,9 @@ export const argsSchema = z.object({
deployEnv: z
.enum(DEPLOY_ENVS, {
message:
"Deploy environment must be either 'testnet-alpha' or 'testnet-prod'",
"Deploy environment must be 'testnet-alpha', 'testnet-prod', or 'mainnet'",
})
.default("testnet-alpha"),
.default("testnet-prod"),
mint: z.union([z.literal("constant"), z.string().brand<"solanaAddress">()]),
remoteToken: z.union([
z.literal("constant"),
Expand Down Expand Up @@ -83,9 +82,8 @@ export async function handleBridgeSpl(args: Args): Promise<void> {
logger.info("--- Bridge SPL script ---");

const config = CONFIGS[args.deployEnv];
const rpcUrl = devnet(config.solana.rpcUrl);
const rpc = createSolanaRpc(rpcUrl);
logger.info(`RPC URL: ${rpcUrl}`);
const rpc = createSolanaRpc(config.solana.rpcUrl);
logger.info(`RPC URL: ${config.solana.rpcUrl}`);

const payer = await resolvePayerKeypair(args.payerKp);
logger.info(`Payer: ${payer.address}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
getOrPromptSolanaAddress,
getOrPromptDecimal,
getOrPromptFilePath,
getOrPromptDeployEnv,
validateAndExecute,
} from "@internal/utils/cli";
import {
Expand All @@ -30,14 +31,7 @@ async function collectInteractiveOptions(
let opts = { ...options };

if (!opts.deployEnv) {
opts.deployEnv = await getInteractiveSelect({
message: "Select target deploy environment:",
options: [
{ value: "testnet-alpha", label: "Testnet Alpha" },
{ value: "testnet-prod", label: "Testnet Prod" },
],
initialValue: "testnet-alpha",
});
opts.deployEnv = await getOrPromptDeployEnv();
}

if (!opts.mint) {
Expand Down Expand Up @@ -113,7 +107,7 @@ export const bridgeWrappedTokenCommand = new Command("bridge-wrapped-token")
.description("Bridge wrapped ERC20 tokens from Solana to Base")
.option(
"--deploy-env <deployEnv>",
"Target deploy environment (testnet-alpha | testnet-prod)"
"Target deploy environment (testnet-alpha | testnet-prod | mainnet)"
)
.option(
"--mint <address>",
Expand Down
Loading
Loading