Skip to content

Commit ca4a96c

Browse files
authored
Merge pull request #211 from rsksmart/feat/refactoringForMCP
feat/adding external capabilities for wallet module, walletCommand() …
2 parents e977d2f + c4dd744 commit ca4a96c

File tree

16 files changed

+2584
-1123
lines changed

16 files changed

+2584
-1123
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,8 @@ dist
180180
.DS_Store
181181

182182
files/*
183+
184+
/deploydata
185+
my-wallets.json
186+
password.json
187+
Storage.json

bin/index.ts

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ program
7373
.description("Check the balance of the saved wallet")
7474
.option("-t, --testnet", "Check the balance on the testnet")
7575
.option("--wallet <wallet>", "Name of the wallet")
76-
.option("-a ,--address <address>", "Token holder address")
7776
.action(async (options: CommandOptions) => {
78-
await balanceCommand(!!options.testnet, options.wallet!, options.address);
77+
await balanceCommand({
78+
testnet: !!options.testnet,
79+
walletName: options.wallet!,
80+
});
7981
});
8082

8183
program
@@ -93,7 +95,10 @@ program
9395
.action(async (options: CommandOptions) => {
9496
try {
9597
if (options.interactive) {
96-
await batchTransferCommand(undefined, !!options.testnet, true);
98+
await batchTransferCommand({
99+
testnet: !!options.testnet,
100+
interactive: true,
101+
});
97102
return;
98103
}
99104

@@ -118,12 +123,13 @@ program
118123
};
119124

120125
await transferCommand(
121-
!!options.testnet,
122-
address,
123-
value,
124-
options.wallet!,
125-
options.token as `0x${string}` | undefined,
126-
Object.keys(txOptions).length > 0 ? txOptions : undefined
126+
{
127+
testnet: !!options.testnet,
128+
toAddress: address,
129+
value: value,
130+
name: options.wallet!,
131+
tokenAddress: options.token as `0x${string}` | undefined,
132+
}
127133
);
128134
} catch (error: any) {
129135
console.error(
@@ -143,7 +149,10 @@ program
143149
? options.txid
144150
: `0x${options.txid}`;
145151

146-
await txCommand(!!options.testnet, formattedTxId as `0x${string}`);
152+
await txCommand({
153+
testnet: !!options.testnet,
154+
txid: formattedTxId as `0x${string}`,
155+
});
147156
});
148157

149158
program
@@ -157,11 +166,13 @@ program
157166
.action(async (options: CommandOptions) => {
158167
const args = options.args || [];
159168
await deployCommand(
160-
options.abi!,
161-
options.bytecode!,
162-
!!options.testnet,
163-
args,
164-
options.wallet!
169+
{
170+
abiPath: options.abi!,
171+
bytecodePath: options.bytecode!,
172+
testnet: !!options.testnet,
173+
args: args,
174+
name: options.wallet!,
175+
}
165176
);
166177
});
167178

@@ -179,12 +190,13 @@ program
179190
.action(async (options: CommandOptions) => {
180191
const args = options.decodedArgs || [];
181192
await verifyCommand(
182-
options.json!,
183-
options.address!,
184-
options.name!,
185-
!!options.testnet,
186-
187-
args
193+
{
194+
jsonPath: options.json!,
195+
address: options.address!,
196+
name: options.name!,
197+
testnet: !!options.testnet,
198+
args: args,
199+
}
188200
);
189201
});
190202

@@ -194,7 +206,10 @@ program
194206
.requiredOption("-a, --address <address>", "Address of a verified contract")
195207
.option("-t, --testnet", "Deploy on the testnet")
196208
.action(async (options: CommandOptions) => {
197-
await ReadContract(options.address! as `0x${string}`, !!options.testnet);
209+
await ReadContract({
210+
address: options.address! as `0x${string}`,
211+
testnet: !!options.testnet,
212+
});
198213
});
199214

200215
program
@@ -203,7 +218,10 @@ program
203218
.option("-t, --testnet", "Deploy on the testnet")
204219
.option("--wallet <wallet>", "Name of the wallet")
205220
.action(async (options: CommandOptions) => {
206-
await bridgeCommand(!!options.testnet, options.wallet!);
221+
await bridgeCommand({
222+
testnet: !!options.testnet,
223+
name: options.wallet!,
224+
});
207225
});
208226

209227
program
@@ -213,7 +231,11 @@ program
213231
.option("--number <number>", "Number of transactions to fetch")
214232
.option("-t, --testnet", "History of wallet on the testnet")
215233
.action(async (options: CommandOptions) => {
216-
await historyCommand(!!options.testnet, options.apiKey!, options.number!);
234+
await historyCommand({
235+
testnet: !!options.testnet,
236+
apiKey: options.apiKey!,
237+
number: options.number!,
238+
});
217239
});
218240

219241
program
@@ -237,7 +259,11 @@ program
237259
return;
238260
}
239261

240-
await batchTransferCommand(file, testnet, interactive);
262+
await batchTransferCommand({
263+
filePath: file,
264+
testnet: testnet,
265+
interactive: interactive,
266+
});
241267
} catch (error: any) {
242268
console.error(
243269
chalk.red("🚨 Error during batch transfer:"),

0 commit comments

Comments
 (0)