How to use web3-providers-http - 5 common examples

To help you get started, we’ve selected a few web3-providers-http 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 joincivil / Civil / packages / components / src / Tokens / TokensAccount.stories.tsx View on Github external
import { storiesOf } from "@storybook/react";
import StoryRouter from "storybook-react-router";
import * as React from "react";
import Web3HttpProvider from "web3-providers-http";

import apolloStorybookDecorator from "apollo-storybook-react";
import { UserTokenAccountSignup } from "./TokensAccountSignup";
import { UserTokenAccountVerify } from "./TokensAccountVerify";
import { UserTokenAccountBuy } from "./TokensAccountBuy";
import { CivilContext, buildCivilContext } from "../context";
import Web3 from "web3";

const web3Provider = new Web3HttpProvider("http://localhost:8045");
const web3 = new Web3(web3Provider);
const civilContext = buildCivilContext({ web3, featureFlags: ["uniswap"], config: { DEFAULT_ETHEREUM_NETWORK: 4 } });

const onClickFunc = () => {
  console.log("clicked!");
};

const typeDefs = `
  type Query {
    storefrontEthPrice: Float
    storefrontCvlPrice: Float
    storefrontCvlQuoteUsd(usdToSpend: Float!): Float
  }

  schema {
    query: Query
github joincivil / Civil / packages / components / src / NavBar / NavBar.stories.tsx View on Github external
import { NavBar } from "./NavBar";
import { NavErrorBar } from "./NavErrorBar";
import { CivilContext, buildCivilContext } from "../context";

import Web3 from "web3";
import Web3HttpProvider from "web3-providers-http";

const balance = "100,203";
const votingBalance = "1,200";
const userAccount = "0xd26114cd6ee289accf82350c8d8487fedb8a0c07";
const userRevealVotesCount = 10;
const userClaimRewardsCount = 4;
const userChallengesStartedCount = 2;
const userChallengesVotedOnCount = 15;

const web3Provider = new Web3HttpProvider("http://localhost:8045");
const web3 = new Web3(web3Provider);
const civilContext = buildCivilContext({ web3, featureFlags: ["uniswap"], config: { DEFAULT_ETHEREUM_NETWORK: 4 } });

storiesOf("Common / Nav / Nav Bar", module)
  .addDecorator(StoryRouter())
  .add("Global Nav", () => {
    return (
github joincivil / Civil / packages / components / src / Tokens / sell / TokensTabSell.stories.tsx View on Github external
Query: () => {
    return {
      storefrontEthPrice: () => {
        return 137.23;
      },
      storefrontCvlPrice: () => {
        return 0.2;
      },
      storefrontCvlQuoteUsd: () => {
        return 500.48635;
      },
    };
  },
};

const web3Provider = new Web3HttpProvider("http://localhost:8045");
const web3 = new Web3(web3Provider);
const civilContext = buildCivilContext({ web3, featureFlags: ["uniswap"], config: { DEFAULT_ETHEREUM_NETWORK: 4 } });
const civilContextNoUniswap = buildCivilContext({ web3, featureFlags: [], config: { DEFAULT_ETHEREUM_NETWORK: 4 } });

storiesOf("Storefront / Sell Tab", module)
  .addDecorator(
    apolloStorybookDecorator({
      typeDefs,
      mocks,
    }),
  )
  .addDecorator(StoryRouter())
  .add("Sell Tab", () => {
    return (
github joincivil / Civil / packages / components / src / Tokens / buy / TokensTabBuy.stories.tsx View on Github external
const mocks = {
  Query: () => {
    return {
      storefrontEthPrice: () => {
        return 102.98;
      },
      storefrontCvlPrice: () => {
        return 0.2;
      },
      storefrontCvlQuoteUsd: () => {
        return 500.48635;
      },
    };
  },
};
const web3Provider = new Web3HttpProvider("http://localhost:8045");
const web3 = new Web3(web3Provider);
const civilContext = buildCivilContext({ web3, featureFlags: ["uniswap"], config: { DEFAULT_ETHEREUM_NETWORK: 4 } });

const foundationAddress = "hello!";

storiesOf("Storefront / Buy Tab", module)
  .addDecorator(
    apolloStorybookDecorator({
      typeDefs,
      mocks,
    }),
  )
  .addDecorator(StoryRouter())
  .add("Buy Tab", () => {
    return (

web3-providers-http

HTTP provider for Web3 4.x.x

LGPL-3.0
Latest version published 3 months ago

Package Health Score

94 / 100
Full package analysis

Popular web3-providers-http functions

Similar packages