CirclesUBI / circles-mobile

Circles react-native mobile client
GNU Affero General Public License v3.0
7 stars 2 forks source link

Getting the token contract address #86

Open edzillion opened 5 years ago

edzillion commented 5 years ago

Ok so current setup is this

circles-contracts branch: feature/relayerPermissions

circles-api branch: ecs-deploy (with the bug/web3-connection-drop branch of metatx-server instead of the package)

circles-mobile branch: circlestoken-fixes

So I reverted some of my changes to the FE because I thought Ashoka's stuff might be more illuminating.

The current build with fail at the user reducer:

  case USER_TOKEN_CREATED:
      let logs = action.txReceipt.data.logs
      logs = logs.filter(log => log.address.toLowerCase() === HubContract.address.toLowerCase())
      let userAddress = '0x' + logs[0].topics[1].substr(-40)
      let tokenAddress = '0x' + logs[0].topics[2].substr(-40)
      return Object.assign({}, state, { token_address: tokenAddress })

because the metatx-server package returns just the tx hash, and not the receipt, but the receipt does not contain any logs anyway.

edzillion commented 5 years ago

I got events showing by using subscribe()

  web3.eth.subscribe('logs', {
    fromBlock: 0
  }, function(error, result){
      if (error) console.error(error)
      console.log(result);
  });

I went through the initial migrations and then the registration but only one entry is displayed:

{ logIndex: 0,
  transactionIndex: 0,
  transactionHash:
   '0x5ccfc6a61771084e6c8a1113c45b067eafbbd171fbaf5f8fe948dbc123496db5',
  blockHash:
   '0x330b88e08c11ea8d0f35148c09867eb16f0b0d55a75be5c34298c4fa980b41a6',
  blockNumber: 4,
  address: '0xa70E47D58b35dd03a1Fa5BA569410389Efe06234',
  data:
   '0x000000000000000000000000571707f398847bead4113d334780945e0bd2c72f',
  topics:
   [ '0x4a76d907701285bbb0db269edd3151cebf49ba1a4e58dd308a079a19664050a3',
     '0x0000000000000000000000006049bf8eafabfb369cee0248bdefe9b16d3e0ad2' ],
  type: 'mined',
  id:
   'log_0xfc538c716cd2da9b47580f52c558806f2d5f345a0d84e79696c679715ae87b40' }
edzillion commented 5 years ago

I tried the ganache GUI to see if that would show the logs.

It's showing the blocks, transactions etc all fine but no events are shown from any tx.