From d6df88df3d2d8c77716b8eaf9ef5cae63850b5f4 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 21 Jul 2024 04:05:20 +0000 Subject: [PATCH] style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf This commit fixes the style issues introduced in f709bb0 according to the output from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf. Details: None --- sidra_chain_integration/script.js | 54 ++++++++++++++++++------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/sidra_chain_integration/script.js b/sidra_chain_integration/script.js index bbbad3e06..f1f4a294e 100644 --- a/sidra_chain_integration/script.js +++ b/sidra_chain_integration/script.js @@ -4,32 +4,40 @@ const repayButton = document.getElementById('repay-button'); const loanStatusDiv = document.getElementById('loan-status'); applyButton.addEventListener('click', async (e) => { - //... (same as before) + // ... (same as before) }); repayButton.addEventListener('click', async (e) => { - e.preventDefault(); - const repaymentAmount = document.getElementById('repayment-amount').value; + e.preventDefault(); + const repaymentAmount = document.getElementById('repayment-amount').value; - // Call the smart contract's repayLoan function - const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR_PROJECT_ID')); - const contract = new web3.eth.Contract(LendingContract.abi, LendingContract.address); - const txCount = await web3.eth.getTransactionCount(YOUR_ACCOUNT_ADDRESS); - const tx = { - from: YOUR_ACCOUNT_ADDRESS, - to: LendingContract.address, - value: '0', - gas: '200000', - gasPrice: '20', - nonce: txCount, - data: contract.methods.repayLoan(repaymentAmount).encodeABI() - }; + // Call the smart contract's repayLoan function + const web3 = new Web3( + new Web3.providers.HttpProvider( + 'https://mainnet.infura.io/v3/YOUR_PROJECT_ID', + ), + ); + const contract = new web3.eth.Contract( + LendingContract.abi, + LendingContract.address, + ); + const txCount = await web3.eth.getTransactionCount(YOUR_ACCOUNT_ADDRESS); + const tx = { + from: YOUR_ACCOUNT_ADDRESS, + to: LendingContract.address, + value: '0', + gas: '200000', + gasPrice: '20', + nonce: txCount, + data: contract.methods.repayLoan(repaymentAmount).encodeABI(), + }; - web3.eth.accounts.signTransaction(tx, YOUR_PRIVATE_KEY) - .then(signedTx => web3.eth.sendSignedTransaction(signedTx.rawTransaction)) - .on('transactionHash', hash => console.log(`Transaction hash: ${hash}`)) - .on('confirmation', (confirmationNumber, receipt) => { - console.log(`Confirmation number: ${confirmationNumber}`); - loanStatusDiv.innerHTML = `Loan repayment successful!`; - }); + web3.eth.accounts + .signTransaction(tx, YOUR_PRIVATE_KEY) + .then((signedTx) => web3.eth.sendSignedTransaction(signedTx.rawTransaction)) + .on('transactionHash', (hash) => console.log(`Transaction hash: ${hash}`)) + .on('confirmation', (confirmationNumber, receipt) => { + console.log(`Confirmation number: ${confirmationNumber}`); + loanStatusDiv.innerHTML = 'Loan repayment successful!'; + }); });