Skip to content

Commit

Permalink
[doc] updating cli with documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tavakyan committed Jul 30, 2024
1 parent b371de6 commit 9645ded
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
private-key.txt
38 changes: 13 additions & 25 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/usr/bin/env node

/**
* Script to deposit funds to the Eclipse rollup.
*
* Usage:
* node deposit.js [Solana Address] [EtherBridge Address] [Amount in Gwei] [Private Key] [JSON RPC URL]
*
* Example on Anvil devnode:
* node deposit.js EAjFK3iWqYdRbCAuDhfCNHo2EMj3S7eg5QrU7DMcNEXD 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 1500000 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 http://localhost:8545
*
* Example on EtherBridge (0x11b8db6bb77ad8cb9af09d0867bb6b92477dd68e) on Sepolia test network:
* node deposit.js 6g8wB6cJbodeYaEb5aD9QYqhdxiS8igfcHpz36oHY7p8 0x11b8db6bb77ad8cb9af09d0867bb6b92477dd68e 1500000 <use-your-sepolia-private-key> https://rpc2.sepolia.org
* Transaction hash: 0x335c067c7280aa3bd2d688cd4c8695c86b3f7fe785be5379c5d98731db0269cf
*/
import { Command } from 'commander';
import { runDeposit } from '../src/lib.js'; // Note the `.js` extension

Expand Down Expand Up @@ -37,30 +50,5 @@ program
keyFile: options.keyFile
});
});
// destination, amount, chain_name, keyFile,
// Defaults to 'deposit' subcommand if no other subcommand is provided
// program
// .arguments('[args...]')
// .action((args, cmdObj) => {
// let chainName = '';
// if (cmdObj.opts().mainnet) {
// chainName = 'mainnet'
// } else if (cmdObj.opts().sepolia) {
// chainName = 'sepolia'
// } else {
// throw new Error("Invalid chain name");
// }
// if (cmdObj.opts().destination || cmdObj.opts().amount || cmdObj.opts().keyFile ) {
// runDeposit({
// destination: cmdObj.opts().destination,
// amount: cmdObj.opts().amount,
// chainName: chainName,
// keyFile: cmdObj.opts().keyFile
// });
// } else {
// console.error('Error: Missing arguments for deposit.');
// program.outputHelp();
// }
// });

program.parse(process.argv);
3 changes: 2 additions & 1 deletion src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function validateSolanaAddress(address) {
if (decoded.length !== 32) {
throw new Error('Invalid length for a Solana address.');
}
//

// TODO: finish validation for solana addres
// // Convert the decoded address to a PublicKey object
// const publicKey = new PublicKey(decoded);
//
Expand Down

0 comments on commit 9645ded

Please sign in to comment.