diff --git a/screencast/420-web3-in-2-mins/MyContract.sol b/screencast/420-web3-in-2-mins/MyContract.sol new file mode 100644 index 0000000000..f7e69c458b --- /dev/null +++ b/screencast/420-web3-in-2-mins/MyContract.sol @@ -0,0 +1,13 @@ +pragma solidity 0.8.0; + +contract MyContractol { + uint data; + + function read() external view returns(uint) { + return data; + } + + function write(uint _data) external { + data = _data; + } +} \ No newline at end of file diff --git a/screencast/420-web3-in-2-mins/script.js b/screencast/420-web3-in-2-mins/script.js new file mode 100644 index 0000000000..c8a326dc86 --- /dev/null +++ b/screencast/420-web3-in-2-mins/script.js @@ -0,0 +1,17 @@ +const Web3 = require('web3'); + +const web3 = new Web3('https://mainnet.infura.io/v3/ed18016b210c4a1baf828458bd16feb0'); + +web3.eth.accounts.wallet.add('0x55d0380decced82a2198582e541a129e8b86937c30a1c51bbb5327b9f00c6aa4'); + +web3.eth.getBalance('0xFA17F09e8464Bd0c592Daf09bf285B5cD72Bec3D') +.then(balance => console.log(balance)); + +const contract = new web3.eth.Contract(abi, '0x6E62c6e07019Bc3db5554a8d602390C6CC0B7846'); + +contract.methods.read().call() +.then(result => console.log(result)); + +web3.eth.sendTransaction({from: '0xFA17F09e8464Bd0c592Daf09bf285B5cD72Bec3D', value: 1000}) + +contract.methods.write().sendTransaction({from: '0xFA17F09e8464Bd0c592Daf09bf285B5cD72Bec3D'});