Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

add more methods to remix-sim; fix accounts #1160

Merged
merged 16 commits into from
May 16, 2019
Merged

Conversation

iurimatias
Copy link
Member

No description provided.

@iurimatias iurimatias requested a review from yann300 April 16, 2019 17:53
throw new Error(err)
}
var balance = '0x56BC75E2D63100000'
account.balance = balance || '0xf00000000000000001'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that enough for adding balance here?
I think we might need to do something like https://github.com/ethereum/remix-ide/blob/swap_it/src/universal-dapp.js#L127

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The api changed afak

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this call stateManager.putAccount is still needed no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out it's not needed anymore. getAccount will return the account object which can be modified. a way to verify this is to run a script like

const Web3 = require('web3')
const RemixSim = require('./')

provider = new RemixSim.Provider({})
web3 = new Web3(provider)

web3.eth.getAccounts((error, accounts) => {
  let account = accounts[0]

  web3.eth.getBalance(account).then((balance) => {
    console.dir("=============")
    console.dir(balance)
    console.dir("=============")
  })
});

balance will have the value of var balance = '0x56BC75E2D63100000' changing this will the balance returned above

@iurimatias iurimatias merged commit c7d84a0 into master May 16, 2019
@Aniket-Engg Aniket-Engg deleted the improve_remix_sim branch September 20, 2019 11:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants