Created
June 1, 2023 17:14
-
-
Save ImHukam/a0c67c625740350ebf67cf416990dd49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ethers } = require('ethers'); | |
async function transferUSDT() { | |
// Provider and Signer | |
const provider = new ethers.providers.JsonRpcProvider('https://polygon-rpc.com'); | |
const privateKey = 'YOUR_PRIVATE_KEY_HERE'; // Replace with your private key | |
const signer = new ethers.Wallet(privateKey, provider); | |
// USDT Contract | |
const usdtContractAddress = 'USDT_CONTRACT_ADDRESS'; // Replace with the actual USDT contract address | |
const usdtContractABI = [ | |
// USDT contract ABI (ERC20 standard) | |
// ... Include the relevant ABI here ... | |
]; | |
const usdtContract = new ethers.Contract(usdtContractAddress, usdtContractABI, signer); | |
// Transfer Parameters | |
const recipientAddress = 'RECIPIENT_ADDRESS'; // Replace with the recipient's address | |
const amount = ethers.utils.parseUnits('100', 6); // Replace with the desired amount and decimal (in USDT) | |
// Perform Transfer | |
try { | |
const tx = await usdtContract.transfer(recipientAddress, amount); | |
console.log('Transfer TX Hash:', tx.hash); | |
await tx.wait(); | |
console.log('Transfer completed successfully.'); | |
} catch (error) { | |
console.error('Transfer failed:', error); | |
} | |
} | |
transferUSDT(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment