diff --git a/docs.md b/docs.md index da011a7..9163c36 100644 --- a/docs.md +++ b/docs.md @@ -37,7 +37,7 @@ Options: -o, --additional-owners Comma-separated list of additional owner addresses -n, --num-signatures-required Number of signatures required for execution -p, --profile Profile to use for the transaction - --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", "movement-mainnet", "movement-testnet", "custom") + --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", "movement-mainnet", "movement-testnet") -h, --help display help for command ``` @@ -52,7 +52,7 @@ Options: -n, --num-signatures-required New number of signatures required for execution -m, --multisig-address
multisig account address -p, --profile Profile to use for the transaction - --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", "movement-mainnet", "movement-testnet", "custom") + --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", "movement-mainnet", "movement-testnet") -h, --help display help for command ``` @@ -65,9 +65,8 @@ Options: -m, --multisig-address
multisig account address --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", - "movement-mainnet", "movement-testnet", - "custom") - --fullnode Fullnode URL for custom network + "movement-mainnet", "movement-testnet") + --fullnode Fullnode URL override -h, --help display help for command ``` @@ -80,8 +79,7 @@ Options: -m, --multisig-address
multisig account address --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", - "movement-mainnet", "movement-testnet", - "custom") + "movement-mainnet", "movement-testnet") -p, --profile Profile to use for the transaction --no-simulate skip tx simulation -h, --help display help for command @@ -139,8 +137,7 @@ Options: -m, --multisig-address
multisig account address --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", - "movement-mainnet", "movement-testnet", - "custom") + "movement-mainnet", "movement-testnet") -p, --profile profile name of voter -h, --help display help for command ``` @@ -157,8 +154,7 @@ Options: it --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", - "movement-mainnet", "movement-testnet", - "custom") + "movement-mainnet", "movement-testnet") -h, --help display help for command ``` @@ -171,9 +167,8 @@ Options: -m, --multisig-address
multisig account address --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", - "movement-mainnet", "movement-testnet", - "custom") - --fullnode Fullnode URL for custom network + "movement-mainnet", "movement-testnet") + --fullnode Fullnode URL override -s, --sequence-number fetch transaction with specific sequence number -h, --help display help for command @@ -188,9 +183,8 @@ Options: -m, --multisig-address
multisig account address --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", - "movement-mainnet", "movement-testnet", - "custom") - --fullnode Fullnode URL for custom network + "movement-mainnet", "movement-testnet") + --fullnode Fullnode URL override -s, --sequence-number fetch transaction with specific sequence number -h, --help display help for command @@ -206,8 +200,8 @@ Options: 0x) --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", "movement-mainnet", - "movement-testnet", "custom") - --fullnode Fullnode URL for custom network + "movement-testnet") + --fullnode Fullnode URL override -h, --help display help for command ``` @@ -221,8 +215,8 @@ Options: stdin) --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", "movement-mainnet", - "movement-testnet", "custom") - --fullnode Fullnode URL for custom network + "movement-testnet") + --fullnode Fullnode URL override -h, --help display help for command ``` @@ -302,7 +296,7 @@ Options: -m, --multisig
Multisig address -n, --network network to use (choices: "aptos-devnet", "aptos-testnet", "aptos-mainnet", - "movement-mainnet", "movement-testnet", "custom") + "movement-mainnet", "movement-testnet") -p, --profile Profile to use for transactions -h, --help display help for command ``` diff --git a/src/commands/account.ts b/src/commands/account.ts index 320aa4e..efb90a0 100644 --- a/src/commands/account.ts +++ b/src/commands/account.ts @@ -143,13 +143,7 @@ export const registerAccountCommand = (program: Command) => { .description('Show multisig summary') .option('-m, --multisig-address
', 'multisig account address', validateAddress) .addOption(new Option('--network ', 'network to use').choices(NETWORK_CHOICES)) - .addOption(new Option('--fullnode ', 'Fullnode URL for custom network')) - .hook('preAction', (thisCommand) => { - const options = thisCommand.opts(); - if (options.network === 'custom' && !options.fullnode) { - throw new Error('When using a "custom" network, you must provide a --fullnode URL.'); - } - }) + .addOption(new Option('--fullnode ', 'Fullnode URL override')) .action( async (options: { fullnode?: string; multisigAddress?: string; network?: NetworkChoice }) => { const network = await ensureNetworkExists(options.network); diff --git a/src/commands/decode.ts b/src/commands/decode.ts index 8d29faa..026a7d0 100644 --- a/src/commands/decode.ts +++ b/src/commands/decode.ts @@ -21,13 +21,7 @@ export function registerDecodeCommand(program: Command) { } ) .addOption(new Option('--network ', 'network to use').choices(NETWORK_CHOICES)) - .addOption(new Option('--fullnode ', 'Fullnode URL for custom network')) - .hook('preAction', (thisCommand) => { - const options = thisCommand.opts(); - if (options.network === 'custom' && !options.fullnode) { - throw new Error('When using a "custom" network, you must provide a --fullnode URL.'); - } - }) + .addOption(new Option('--fullnode ', 'Fullnode URL override')) .action(async (options: { bytes: string; network: NetworkChoice; fullnode: string }) => { const network = await ensureNetworkExists(options.network); const aptos = initAptos(network, options.fullnode); diff --git a/src/commands/encode.ts b/src/commands/encode.ts index 2ba5693..94d3889 100644 --- a/src/commands/encode.ts +++ b/src/commands/encode.ts @@ -14,26 +14,20 @@ export function registerEncodeCommand(program: Command) { 'Transaction payload (file path, JSON string, or - for stdin)' ) .addOption(new Option('--network ', 'network to use').choices(NETWORK_CHOICES)) - .addOption(new Option('--fullnode ', 'Fullnode URL for custom network')) + .addOption(new Option('--fullnode ', 'Fullnode URL override')) .addHelpText( 'after', ` Examples: # From file $ safely encode --payload payload.json --network aptos-testnet - + # Direct JSON string $ safely encode --payload '{"function_id":"0x1::coin::transfer","type_args":["0x1::aptos_coin::AptosCoin"],"args":["0x123",1000]}' --network aptos-testnet - + # From stdin $ echo '{"function_id":"0x1::coin::transfer","type_args":["0x1::aptos_coin::AptosCoin"],"args":["0x123",1000]}' | safely encode --payload - --network aptos-testnet` ) - .hook('preAction', (thisCommand) => { - const options = thisCommand.opts(); - if (options.network === 'custom' && !options.fullnode) { - throw new Error('When using a "custom" network, you must provide a --fullnode URL.'); - } - }) .action(async (options: { payload: string; network: NetworkChoice; fullnode: string }) => { const network = await ensureNetworkExists(options.network); const aptos = initAptos(network, options.fullnode); diff --git a/src/commands/proposal.ts b/src/commands/proposal.ts index cd851d5..ac92ca1 100644 --- a/src/commands/proposal.ts +++ b/src/commands/proposal.ts @@ -11,13 +11,7 @@ export const registerProposalCommand = (program: Command) => { .description('List proposals for a multisig') .option('-m, --multisig-address
', 'multisig account address', validateAddress) .addOption(new Option('--network ', 'network to use').choices(NETWORK_CHOICES)) - .addOption(new Option('--fullnode ', 'Fullnode URL for custom network')) - .hook('preAction', (thisCommand) => { - const options = thisCommand.opts(); - if (options.network === 'custom' && !options.fullnode) { - throw new Error('When using a "custom" network, you must provide a --fullnode URL.'); - } - }) + .addOption(new Option('--fullnode ', 'Fullnode URL override')) .option( '-s, --sequence-number ', 'fetch transaction with specific sequence number', diff --git a/src/commands/simulate.ts b/src/commands/simulate.ts index 3581918..c80da77 100644 --- a/src/commands/simulate.ts +++ b/src/commands/simulate.ts @@ -15,13 +15,7 @@ export const registerSimulateCommand = (program: Command) => { .description('Simulate multisig transaction') .option('-m, --multisig-address
', 'multisig account address', validateAddress) .addOption(new Option('--network ', 'network to use').choices(NETWORK_CHOICES)) - .addOption(new Option('--fullnode ', 'Fullnode URL for custom network')) - .hook('preAction', (thisCommand) => { - const options = thisCommand.opts(); - if (options.network === 'custom' && !options.fullnode) { - throw new Error('When using a "custom" network, you must provide a --fullnode URL.'); - } - }) + .addOption(new Option('--fullnode ', 'Fullnode URL override')) .requiredOption( '-s, --sequence-number ', 'fetch transaction with specific sequence number', diff --git a/src/constants.ts b/src/constants.ts index 42b2b40..73b90a1 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -4,7 +4,6 @@ export const NETWORK_CHOICES = [ 'aptos-mainnet', 'movement-mainnet', 'movement-testnet', - 'custom', ] as const; export type NetworkChoice = (typeof NETWORK_CHOICES)[number]; diff --git a/src/ui/HomeView.tsx b/src/ui/HomeView.tsx index 842609c..5cfea7e 100644 --- a/src/ui/HomeView.tsx +++ b/src/ui/HomeView.tsx @@ -137,7 +137,7 @@ const HomeView: React.FC = ({ onNavigate }) => { filteredProfiles.some(p => p.name === config.profile) ); - const networks = NETWORK_CHOICES.filter(n => n !== 'custom'); + const networks = NETWORK_CHOICES; // Menu actions const updateConfig = useCallback(async (updates: Partial) => { @@ -181,7 +181,7 @@ const HomeView: React.FC = ({ onNavigate }) => { const updates: Partial = { expandedItem: item }; if (item === 'network') { - const idx = config.network && config.network !== 'custom' + const idx = config.network ? networks.indexOf(config.network as any) : -1; updates.subIndex = Math.max(0, idx); diff --git a/src/utils.ts b/src/utils.ts index 7d260fa..2c10232 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -22,8 +22,6 @@ export function getFullnodeUrl(network: NetworkChoice): string { return 'https://rpc.sentio.xyz/movement/v1'; case 'movement-testnet': return 'https://full.testnet.movementinfra.xyz/v1'; - case 'custom': - throw new Error('Custom network requires an explicit fullnode URL'); default: throw new Error(`Unknown network: ${network}`); } @@ -58,7 +56,7 @@ export function getExplorerUrl(network: NetworkChoice, path: string): string { case 'movement-testnet': return 'testnet'; default: - return 'custom'; + throw new Error(`Unknown network: ${network}`); } })();