MCPcopy Index your code
hub / github.com/NoteProtocol/NoteWallet / processCommand

Method processCommand

src/command-line.ts:59–387  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

57 }
58
59 private async processCommand(line: string) {
60 const args = line.match(/(?:[^\s"]+|"[^"]*")+/g) || [];
61
62 return await yargs(args)
63 .command(
64 "use [symbol]",
65 "select a wallet",
66 (yargs) => {
67 yargs.positional("symbol", {
68 describe: "BTC or RXD or BSV",
69 type: "string",
70 });
71 },
72 (argv) => {
73 if (argv.symbol) {
74 this.currentWallet =
75 this.wallets[argv.symbol as keyof typeof this.wallets];
76 console.log(`using ${argv.symbol as string} wallet`);
77
78 this.setPrompt();
79
80 console.log(Object.keys(this.wallets));
81 }
82 }
83 )
84 .command(
85 "switch [index]",
86 "switch account of wallet",
87 () => {},
88 async (argv) => {
89 if (argv.index !== undefined) {
90 if (!this.currentWallet) {
91 console.log("No wallet selected");
92 return;
93 }
94 const result = this.currentWallet.switchAccount(
95 argv.index as number
96 );
97 console.log("current account", result);
98
99 this.setPrompt();
100 }
101 }
102 )
103 .command(
104 "balance",
105 "Get the balance",
106 () => {},
107 async () => {
108 if (!this.currentWallet) {
109 console.log("No wallet selected");
110 return;
111 }
112 console.log("Balance:", await this.currentWallet.fetchWalletBalace());
113 }
114 )
115 .command(
116 "send [to] [amount]",

Callers 1

startReplMethod · 0.95

Calls 13

setPromptMethod · 0.95
interpolateFunction · 0.90
publishSmartContractFunction · 0.90
sendMethod · 0.80
infoMethod · 0.80
fetchMethod · 0.80
allTokensMethod · 0.80
tokenInfoMethod · 0.80
upN20Method · 0.80
refreshMethod · 0.45
tokenListMethod · 0.45
deployMethod · 0.45

Tested by

no test coverage detected