This file contains hidden or 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
| import subprocess | |
| # subprocess.run(["networksetup", "-help"]) | |
| # subprocess.run(["networksetup", "-listallhardwareports"]) | |
| # subprocess.run(["networksetup", "-listpreferredwirelessnetworks", "en0"]) | |
| subprocess.run(["airport", "en0", "--scan"]) |
This file contains hidden or 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
| function callContract(contractAddress) { | |
| return new Promise((resolve) => { | |
| console.log(`Calling Contract with Address ${contractAddress}`) | |
| setTimeout(() => { | |
| resolve({ | |
| contractAddress: contractAddress, | |
| balance: '10 ETH' | |
| }); | |
| }, 1000); | |
| }) |
This file contains hidden or 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
| function callContract(contractAddress) { | |
| return new Promise((resolve) => { | |
| console.log(`Calling Contract with Address ${contractAddress}`) | |
| setTimeout(() => { | |
| resolve({ | |
| contractAddress: contractAddress, | |
| balance: '10 ETH' | |
| }); | |
| }, 1000); | |
| }) |
This file contains hidden or 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
| function callContract(contractAddress) { | |
| return new Promise((resolve) => { | |
| console.log(`Calling Contract with Address ${contractAddress}`) | |
| setTimeout(() => { | |
| resolve({ | |
| contractAddress: contractAddress, | |
| balance: '10 ETH' | |
| }); | |
| }, 1000); | |
| }) |
This file contains hidden or 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
| // NO chaining: | |
| const EVM_OPERATION_01 = new Promise((resolve) => { | |
| setTimeout(() => { | |
| resolve('Done with Operation 01'); | |
| }, 600); // timeout of 600ms to simulate the operation | |
| }); | |
| const EVM_OPERATION_02 = new Promise((resolve) => { |
This file contains hidden or 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 main() { | |
| // Configure the ITX provider using your Infura credentials | |
| const itx = new ethers.providers.InfuraProvider( | |
| process.env.ETHEREUM_NETWORK, | |
| process.env.INFURA_PROJECT_ID | |
| ); | |
| // Create a signer instance based on your private key |
This file contains hidden or 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
| async function deposit(signer) { | |
| const tx = await signer.sendTransaction({ | |
| // ITX deposit contract (same address for all public Ethereum networks) | |
| to: '0x015C7C7A7D65bbdb117C573007219107BD7486f9', | |
| // Choose how much ether you want to deposit to your ITX gas tank | |
| value: ethers.utils.parseUnits('0.1', 'ether') | |
| }) | |
| // Waiting for the transaction to be mined | |
| await tx.wait() | |
| } |
This file contains hidden or 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
| async function main() { | |
| // We get the contract to deploy | |
| const Greeter = await ethers.getContractFactory("Greeter"); | |
| const greeter = await Greeter.deploy("Hello, Hardhat!"); | |
| await greeter.deployed(); | |
| console.log("Greeter deployed to:", greeter.address); | |
| } | |
This file contains hidden or 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
| function EVM_OPERATION() { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve('Done with Operation'); | |
| // uncomment this and comment the resolve to test the catch block | |
| // reject('Something went wrong'); | |
| }, 600); | |
| }); | |
| } | |
This file contains hidden or 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
| params: [ | |
| { | |
| from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', | |
| to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567', | |
| gas: '0x76c0', // 30400 | |
| gasPrice: '0x9184e72a000', // 10000000000000 | |
| value: '0x9184e72a', // 2441406250 | |
| data: | |
| '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675', | |
| }, |