Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3b702ec
add token-transfer main logic
Nov 3, 2025
22e03a1
add new command into index
Nov 3, 2025
4a5f1a7
update error handling for duplicated flags
Nov 3, 2025
9908286
update readability
Nov 3, 2025
cfb34c3
add warning log for RPCs
Nov 3, 2025
8734b5a
add desciptive comments to functions
Nov 3, 2025
2df42bd
add dependency for token-transfer
Nov 3, 2025
ef3f1e9
Merge branch 'main' into cli-add-token-transfer
martin0995 Nov 4, 2025
c4bf625
Merge branch 'main' into cli-add-token-transfer
martin0995 Nov 4, 2025
83cbc3d
add deployment types
Nov 10, 2025
5ac335e
add error handling
Nov 10, 2025
9ebc966
import logic
Nov 10, 2025
ef5dad2
adapt to ntt transfers
Nov 10, 2025
68ca8dd
update script
Nov 10, 2025
7ff37fa
add error handling
Nov 10, 2025
afb1ced
update error handling
Nov 10, 2025
0b4449e
catch errors
Nov 10, 2025
caa7d5f
removed any types
Nov 10, 2025
cde8296
update clone
Nov 10, 2025
a895eab
add comments
Nov 10, 2025
e7a5a0c
Merge branch 'main' into cli-add-token-transfer
Nov 10, 2025
a142bb9
Merge branch 'main' into cli-add-token-transfer
martin0995 Nov 11, 2025
de87d36
add link to readme
Nov 12, 2025
d4aa7a6
update function naming
Nov 12, 2025
d970a07
validate executor quote fields
Nov 12, 2025
12449c0
update comment
Nov 12, 2025
37ac96e
mainnet confirmation prompt
Nov 12, 2025
cd6f12c
update spinner
Nov 12, 2025
5e800bf
Merge branch 'main' into cli-add-token-transfer
martin0995 Nov 13, 2025
e48845f
consolidate rpc handling
Nov 13, 2025
dbb3347
update dependencies
Nov 13, 2025
dd8bb81
update error
Nov 14, 2025
d466447
update error
Nov 17, 2025
2973bac
Merge branch 'main' into cli-add-token-transfer
martin0995 Nov 17, 2025
643405a
Merge branch 'main' into cli-add-token-transfer
martin0995 Nov 19, 2025
504753f
Merge branch 'main' into cli-add-token-transfer
evgeniko Nov 19, 2025
f6cafd4
Merge branch 'main' into cli-add-token-transfer
martin0995 Nov 25, 2025
3e98eec
Merge branch 'main' into cli-add-token-transfer
evgeniko Dec 1, 2025
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
41 changes: 41 additions & 0 deletions cli/src/deployments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import type { Chain, Network } from "@wormhole-foundation/sdk";
import type { Ntt } from "@wormhole-foundation/sdk-definitions-ntt";
import fs from "fs";

export type ChainConfig = {
version: string;
mode: Ntt.Mode;
paused: boolean;
owner: string;
pauser?: string;
manager: string;
token: string;
transceivers: {
threshold: number;
wormhole: { address: string; pauser?: string; executor?: boolean };
};
limits: {
outbound: string;
inbound: Partial<{ [C in Chain]: string }>;
};
};

export type Config = {
network: Network;
chains: Partial<{
[C in Chain]: ChainConfig;
}>;
defaultLimits?: {
outbound: string;
};
};

export function loadConfig(path: string): Config {
if (!fs.existsSync(path)) {
console.error(`File not found: ${path}`);
console.error(`Create with 'ntt init' or specify another file with --path`);
process.exit(1);
}
const deployments: Config = JSON.parse(fs.readFileSync(path).toString());
return deployments;
}
14 changes: 14 additions & 0 deletions cli/src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,17 @@ export function handleDeploymentError(

handleGenericError(error);
}

export function handleRpcError(
error: any,
chain: Chain,
network: Network,
rpc?: string
): void {
if (rpc && handleRpcConnectionError(error, chain, network, rpc)) {
return;
}
const message = error instanceof Error ? error.message : String(error);
console.error(chalk.red(`RPC error for ${chain} on ${network}`));
console.error(message);
}
43 changes: 4 additions & 39 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ import { registerSolanaTransceiver } from "./solanaHelpers";
import { colorizeDiff, diffObjects } from "./diff";
import { forgeSignerArgs, getSigner, type SignerType } from "./getSigner";
import { handleDeploymentError } from "./error";
import { loadConfig, type ChainConfig, type Config } from "./deployments";
export type { ChainConfig, Config } from "./deployments";

// Configuration fields that should be excluded from diff operations
// These are local-only configurations that don't have on-chain representations
Expand Down Expand Up @@ -105,6 +107,7 @@ import type {
} from "@wormhole-foundation/sdk-evm";
import { getAvailableVersions, getGitTagName } from "./tag";
import * as configuration from "./configuration";
import { createTokenTransferCommand } from "./tokenTransfer";
import { AbiCoder, ethers, Interface } from "ethers";
import { newSignSendWaiter, signSendWaitWithOverride } from "./signSendWait.js";

Expand Down Expand Up @@ -262,35 +265,6 @@ export type SuiDeploymentResult<C extends Chain> = ChainAddress<C> & {
};
};

// TODO: rename
export type ChainConfig = {
version: string;
mode: Ntt.Mode;
paused: boolean;
owner: string;
pauser?: string;
manager: string;
token: string;
transceivers: {
threshold: number;
wormhole: { address: string; pauser?: string; executor?: boolean };
};
limits: {
outbound: string;
inbound: Partial<{ [C in Chain]: string }>;
};
};

export type Config = {
network: Network;
chains: Partial<{
[C in Chain]: ChainConfig;
}>;
defaultLimits?: {
outbound: string;
};
};

const options = {
network: {
alias: "n",
Expand Down Expand Up @@ -1903,6 +1877,7 @@ yargs(hideBin(process.argv))
}
}
)
.command(createTokenTransferCommand(overrides))
.command("solana", "Solana commands", (yargs) => {
yargs
.command(
Expand Down Expand Up @@ -5027,16 +5002,6 @@ function checkAnchorVersion(pwd: string) {
}
}

function loadConfig(path: string): Config {
if (!fs.existsSync(path)) {
console.error(`File not found: ${path}`);
console.error(`Create with 'ntt init' or specify another file with --path`);
process.exit(1);
}
const deployments: Config = JSON.parse(fs.readFileSync(path).toString());
return deployments;
}

function resolveVersion(
latest: boolean,
ver: string | undefined,
Expand Down
Loading
Loading