-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontract.js
More file actions
24 lines (21 loc) · 777 Bytes
/
contract.js
File metadata and controls
24 lines (21 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { ethers } from 'ethers';
import log from './logger.js'
const provider = new ethers.JsonRpcProvider('https://rpc-mainnet.taker.xyz/');
const contractAddress = '0xB3eFE5105b835E5Dd9D206445Dbd66DF24b912AB';
const contractABI = [
"function active() external"
];
async function activateMining(privateKey) {
const wallet = new ethers.Wallet(privateKey, provider);
const contract = new ethers.Contract(contractAddress, contractABI, wallet);
try {
const tx = await contract.active();
await tx.wait();
log.info(`Activate Mining Hash: https://explorer.taker.xyz/tx/${tx.hash}`);
return tx.hash;
} catch (error) {
log.error('Activate Mining Error:', error);
return null;
}
}
export default activateMining;