Created
          February 26, 2019 09:16 
        
      - 
      
- 
        Save loredanacirstea/6b2d2a9176ed992d2dd8e0f46bc55e74 to your computer and use it in GitHub Desktop. 
  
    
      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 baseUrl = 'http://192.168.1.141:5000/api/v1'; | |
| const httpClient = axios; | |
| // const web3 = undefined; | |
| let i__to_0 = null; | |
| let i__value_0 = null; | |
| let i__owner_1 = "0xbB5AEb01acF5b75bc36eC01f5137Dd2728FbE983"; | |
| // Metamask | |
| const provider = new ethers.providers.Web3Provider(web3.currentProvider); | |
| // There is only ever up to one account in MetaMask exposed | |
| const signer = provider.getSigner(); | |
| const abi = [{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]; | |
| const contractAddress = "0xC071Ba53fC099CC2050821d1f2215BDc3a216645"; | |
| const contract = new ethers.Contract(contractAddress, abi, signer); | |
| const transfer_0 = async function(to, value) { | |
| const tx = await contract.transfer(to, value); | |
| const receipt = await tx.wait(2) | |
| return {tx, receipt}; | |
| }; | |
| const balanceOf_1 = async function(owner) { | |
| console.log('contract', contract); | |
| const unnamed = await contract.balanceOf(owner); | |
| return {unnamed}; | |
| }; | |
| (async function PipedFunction0(i__to_0, i__value_0, i__owner_1) { | |
| let result; | |
| result = await transfer_0(i__to_0,i__value_0); | |
| const o__0 = result.unnamed; | |
| result = await balanceOf_1(i__owner_1); | |
| const o__1 = result.unnamed; | |
| console.log('o__1', o__1, result); | |
| return {o__0, o__1}; | |
| })(i__to_0, i__value_0, i__owner_1); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment