diff --git a/dist/bin.js b/dist/bin.js index 6fcd0f5..8dbd980 100755 --- a/dist/bin.js +++ b/dist/bin.js @@ -8756,6 +8756,7 @@ async function sendTx(program, options) { let network = options.network; let data = options.data; let to = options.to; + let value = options.value; if (!privateKey) { privateKey = await password({ message: 'Enter the private key for the wallet that holds the tokens', @@ -8796,7 +8797,8 @@ async function sendTx(program, options) { const provider = new ethers.JsonRpcProvider(nodeUrl); const wallet = new ethers.Wallet(privateKey, provider); try { - const res = await wallet.sendTransaction({ data: data, to: to }); + const tx = { data: data, to: to, value: value }; + const res = await wallet.sendTransaction(tx); console.log("Transaction hash", res.hash); } catch (e) { @@ -8818,6 +8820,7 @@ function makeCommandWallet(program) { .option("--to ", "Target address") .option("-n, --network ", "Network to be used (mainnet, polygon, etc.)") .option("--marketplace-version ", "Marketplace version", "v2") + .option("-v, --value ", "Tx value", "0") .action((options) => { sendTx(program, options); }); diff --git a/src/wallet/send_tx.ts b/src/wallet/send_tx.ts index 3f422ef..4d03d44 100644 --- a/src/wallet/send_tx.ts +++ b/src/wallet/send_tx.ts @@ -9,6 +9,7 @@ export async function sendTx(program: Command, options: any) { let network = options.network; let data = options.data let to = options.to + let value = options.value if (!privateKey) { privateKey = await password({ @@ -69,7 +70,9 @@ export async function sendTx(program: Command, options: any) { const wallet = new ethers.Wallet(privateKey, provider); try { - const res = await wallet.sendTransaction({data: data, to: to}) + const tx = {data: data, to: to, value: value}; + + const res = await wallet.sendTransaction(tx) console.log("Transaction hash", res.hash) } catch (e) { console.error(e) diff --git a/src/wallet/wallet.ts b/src/wallet/wallet.ts index b64a87e..c06c60c 100644 --- a/src/wallet/wallet.ts +++ b/src/wallet/wallet.ts @@ -35,6 +35,11 @@ export function makeCommandWallet(program: Command) { "Marketplace version", "v2" ) + .option( + "-v, --value ", + "Tx value", + "0" + ) .action((options) => { sendTx(program, options); });