How to use the web3-eth-contract.setProvider function in web3-eth-contract

To help you get started, we’ve selected a few web3-eth-contract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github floating / frame / test / radSpecWithValue.js View on Github external
const main = async () => {
  try {
    const ethereum = provider()
    const accounts = await ethereum.send('eth_accounts')
    console.log({ accounts })
    Web3EthContract.setProvider(ethereum)

    const antContract = new Web3EthContract(
      abi,
      '0x960b236A07cf122663c4303350609A66A7B288C0'
    )

    const result = await antContract.methods.transfer(
      '0xfD85b83369E72512A34E23fc575b96761a11F9fD', '100000000'
    ).send({
      from: accounts[0],
      gasPrice: 1000000,
      gas: 8000000,
      value: '1000000000000000'
    })

    console.log(result)
github floating / frame / test / radSpec.js View on Github external
const main = async () => {
  try {
    const ethereum = provider()
    const accounts = await ethereum.send('eth_accounts')
    console.log({ accounts })
    Web3EthContract.setProvider(ethereum)

    const antContract = new Web3EthContract(
      abi,
      '0x960b236A07cf122663c4303350609A66A7B288C0'
    )

    const result = await antContract.methods.transfer(
      '0xfD85b83369E72512A34E23fc575b96761a11F9fD', '100000000'
    ).send({
      from: accounts[0],
      gasPrice: 1000000,
      gas: 8000000
    })

    console.log(result)
  } catch (e) {
github MainframeHQ / onyx / src / components / NodeConnectionView.js View on Github external
resolveEns = async () => {
    const { ethNetwork } = this.props
    const contracts = createContracts(ethNetwork)
    try {
      const [requiredStake, stakeAddress, tokenAddress] = await Promise.all([
        contracts.getRequiredStake(),
        contracts.ens.resolveName(ENS_NAMES.stake[ethNetwork]),
        contracts.ens.resolveName(ENS_NAMES.token[ethNetwork]),
      ])
      Web3Contract.setProvider(WEB3_URLS[ethNetwork])
      const tokenContract = new Web3Contract(TOKEN_ABI, tokenAddress)
      this.setState({
        requiredStake,
        tokenAddress,
        stakeAddress,
        ensError: null,
        tokenContract,
        contracts,
      })
    } catch (err) {
      console.warn('err: ', err)
      this.setState({
        ensError: err,
      })
    }
  }
github statesauce / redux-saga-web3 / packages / web3-erc721 / src / erc721 / saga.js View on Github external
export default (provider, options = {}) => {
  Web3EthContract.setProvider(provider);
  const contract = new Web3EthContract(abi, options.at);
  return createSaga(CONTRACT_NAME, contract);
};
github statesauce / redux-saga-web3 / packages / redux-saga-web3-erc20 / src / erc20 / saga.js View on Github external
export default (provider, options = {}) => {
  Web3EthContract.setProvider(provider);
  const contract = new Web3EthContract(abi, options.at);
  return createSaga("ERC20", contract);
};

web3-eth-contract

Web3 module to interact with Ethereum smart contracts.

LGPL-3.0
Latest version published 11 days ago

Package Health Score

79 / 100
Full package analysis

Similar packages