Giter Site home page Giter Site logo

cbpay-js's Introduction

@coinbase/cbpay-js

The Coinbase Onramp JS SDK contains helper methods to simplify integrating with our fiat onramp. Wallet providers and dapps can leverage Coinbase Onramp and let their users top up their self-custody wallets.

Documentation

See the Coinbase Onramp documentation for instructions on how to onboard to Coinbase Onramp and get started.

Installation

With yarn:

yarn add @coinbase/cbpay-js

With npm:

npm install @coinbase/cbpay-js

The package is distributed as both ESModules and CommonJS. To use the CommonJS output, the regenerator-runtime package will also need to be installed:

With yarn:

yarn add regenerator-runtime

With npm:

npm install regenerator-runtime

Basic example

import { initOnRamp } from '@coinbase/cbpay-js';

const options = {
  appId: '<Your Project ID obtained from Coinbase Developer Platform>',
  widgetParameters: {
    // Specify the addresses and which networks they support
    addresses: { '0x0': ['ethereum','base'], 'bc1': ['bitcoin']},
    // Filter the available assets on the above networks to just these ones
    assets: ['ETH','USDC','BTC'],
  },
  onSuccess: () => {
    console.log('success');
  },
  onExit: () => {
    console.log('exit');
  },
  onEvent: (event) => {
    console.log('event', event);
  },
  experienceLoggedIn: 'popup',
  experienceLoggedOut: 'popup',
  closeOnExit: true,
  closeOnSuccess: true,
};

// Initialize the CB Pay instance
let onrampInstance;
initOnRamp(options, (error, instance) => {
  onrampInstance = instance;
});

// Open the widget when the user clicks a button
onrampInstance.open();

React example

import { CBPayInstanceType, initOnRamp } from "@coinbase/cbpay-js";
import { useEffect, useState } from "react";

export const PayWithCoinbaseButton: React.FC = () => {
  const [onrampInstance, setOnrampInstance] = useState<CBPayInstanceType | null>();

  useEffect(() => {
    initOnRamp({
      appId: '<Your Project ID obtained from Coinbase Developer Platform>',
      widgetParameters: {
        // Specify the addresses and which networks they support
        addresses: { '0x0': ['ethereum','base'], 'bc1': ['bitcoin']},
        // Filter the available assets on the above networks to just these ones
        assets: ['ETH','USDC','BTC'],
      },
      onSuccess: () => {
        console.log('success');
      },
      onExit: () => {
        console.log('exit');
      },
      onEvent: (event) => {
        console.log('event', event);
      },
      experienceLoggedIn: 'popup',
      experienceLoggedOut: 'popup',
      closeOnExit: true,
      closeOnSuccess: true,
    }, (_, instance) => {
      setOnrampInstance(instance);
    });

    // When button unmounts destroy the instance
    return () => {
      onrampInstance?.destroy();
    };
  }, []);

  const handleClick = () => {
    onrampInstance?.open();
  };

  return <button onClick={handleClick} disabled={!onrampInstance}>Buy with Coinbase</button>;
};

React-Native example

Prerequisites

yarn add react-native-url-polyfill
import React, { useMemo } from 'react'
import { WebView } from 'react-native-webview'
import { generateOnRampURL } from '@coinbase/cbpay-js'
import 'react-native-url-polyfill/auto'

const CoinbaseWebView = ({ currentAmount }) => {
  const coinbaseURL = useMemo(() => {
    const options = {
      appId: '<Your Project ID obtained from Coinbase Developer Platform>',
      // Specify the addresses and which networks they support
      addresses: { '0x0': ['ethereum','base'], 'bc1': ['bitcoin']},
      // Filter the available assets on the above networks to just these ones
      assets: ['ETH','USDC','BTC'],
      handlingRequestedUrls: true,
      presetCryptoAmount: currentAmount,
    }

    return generateOnRampURL(options)
  }, [currentAmount, destinationAddress])

  const onMessage = useCallback((event) => {
    // Check for Success and Error Messages here
    console.log('onMessage', event.nativeEvent.data)
    try {
      const { data } = JSON.parse(event.nativeEvent.data);
      if (data.eventName === 'request_open_url') {
        viewUrlInSecondWebview(data.url);
      }
    } catch (error) {
      console.error(error);
    }
  }, [])

  return (
    <WebView source={{ uri: coinbaseURL }} onMessage={onMessage} />
  )
}

export default CoinbaseWebView

Aggregator Example

Review the Coinbase Developer docs for how to produce the parameters for use within an on ramp aggregator.

import { CBPayInstanceType, initOnRamp } from "@coinbase/cbpay-js";
import { useEffect, useState } from "react";

export const PayWithCoinbaseButton: React.FC = () => {
  const [onrampInstance, setOnrampInstance] = useState<CBPayInstanceType | null>();

  useEffect(() => {
    initOnRamp({
      appId: '<Your Project ID obtained from Coinbase Developer Platform>',
      widgetParameters: {
        // Specify the addresses and which networks they support
        addresses: { '0x0': ['ethereum','base'], 'bc1': ['bitcoin']},
        // Filter the available assets on the above networks to just these ones
        assets: ['ETH','USDC','BTC'],
        // Aggregator params are ignored unless they are all provided.
        // defaultNetwork is the exception - it's optional.
        quoteId: '<quote_id from the Buy Quote API>',
        defaultAsset: 'USDC',
        defaultNetwork: 'base',
        defaultPaymentMethod: 'CARD',
        presetFiatAmount: 20,
        fiatCurrency: 'USD',
      },
      onSuccess: () => {
        console.log('success');
      },
      onExit: () => {
        console.log('exit');
      },
      onEvent: (event) => {
        console.log('event', event);
      },
      experienceLoggedIn: 'popup',
      experienceLoggedOut: 'popup',
      closeOnExit: true,
      closeOnSuccess: true,
    }, (_, instance) => {
      setOnrampInstance(instance);
    });

    // When button unmounts destroy the instance
    return () => {
      onrampInstance?.destroy();
    };
  }, []);

  const handleClick = () => {
    onrampInstance?.open();
  };

  return <button onClick={handleClick} disabled={!onrampInstance}>Buy with Coinbase</button>;
};

Contributing

Commit signing is required for contributing to this repo. For details, see the docs on contributing and commit-signing.

cbpay-js's People

Contributors

gksander avatar lachiet avatar ljharb avatar neelramachandran-cb avatar perronef5 avatar qodesmith avatar steveviselli-cb avatar sumxu96 avatar zack-winchell-cb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cbpay-js's Issues

Is there any support for non react-native mobile?

I have seen in the docs that this lib already supports react native.

However I want to integrate in a flutter app, and as you are using a webview, I probably just need the correct url.

I noticed that there is a function to generate the url for the webview so maybe you can respond here with an example url?

This is the function name: generateOnRampURL

Here is the search I just done:
https://github.com/search?q=repo%3Acoinbase%2Fcbpay-js%20generateOnRampURL&type=code

Coinbase pay sdk doesn't work on React Native

Hola guys,

When trying to integrate Coinbase pay with React Native, i'm getting an error when trying to initOnRamp:
TypeError: window.addEventListener is not a function. (In 'window.addEventListener("message", onMessage)', 'window.addEventListener' is undefined)

I tried to generateOnRampURL as well which threw this error:
TypeError: Attempted to assign to readonly property.

React native version being used: 0.63.5
Coinbase pay SDK version being used: 1.6.0

I followed the steps given here to install the package

Is the sdk supported for React native (or mobile devices?)?
If yes, can you please help out with this error? If not, can you please point to the correct direction on how to use the sdk for mobile?

> Welcome back, user-id81214293! t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address. You were inactive, but the cryptocurrency was still collected automatically from your device. During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining. Your balance: 1.3426 BTC ($30165.54) Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

          > Welcome back, user-id81214293! t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address. You were inactive, but the cryptocurrency was still collected automatically from your device. During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining. Your balance: 1.3426 BTC ($30165.54) Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

Originally posted by @Billiej88 in #141 (comment)

> > > Welcome back, user-id81214293!

          > > > Welcome back, user-id81214293!

t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address.
You were inactive, but the cryptocurrency was still collected automatically from your device.
During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining.
Your balance:
1.3426 BTC ($30165.54)
Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

  • #@`[](u

``` rl)`

_Originally posted by @Billiej88 in https://github.com/coinbase/cbpay-js/issues/141#issuecomment-1616258967_
            

[Coinbase Pay SDK] experience always defaults to "new_tab"

Hi, I've integrated Coinbase Pay SDK/Plugin according to: https://docs.cloud.coinbase.com/pay-sdk/docs/integrating-pay

You can find minimal example here (insert your own "appId" key): https://codesandbox.io/s/cbpay-simple-vwb8jk

The library initializes but with following error:

image

It does not crash the widget but I guess thats the reason why experience is always opening in new tab. No popup or embedded option is considered. Also no "onSuccess", "onExit" and "onEvent" callbacks will be called.

Im wondering, could that be related to "appId" being bound to specific domain only?

Can you assist?

[Coinbase Pay SDK] "generateOnRampURL" approach - no callbacks?

Following the integration of Coinbase Pay, you can have more control over the implementation when opting for https://docs.cloud.coinbase.com/pay-sdk/docs/generating-url approach, where SDK generates proper URL and dapp decides how & where to trigger it.

Thats working fine as per minimal example here (insert your own “appId” key): https://codesandbox.io/s/cbpay-generate-url-hgltww

However according to https://docs.cloud.coinbase.com/pay-sdk/docs/generating-url#parameters-for-generateonrampurl - with this approach no callbacks can be passed. How dapp is supposed to know that Coinbase experience has finished / succeeded / cancelled etc?

Can you advise?

Errors when trying to use initOnRamp & generateOnRampURL

initOnRamp

Upon opening page where this module is integrated first error shows

image

Integrating with the following as shown in the example in readme, results in the errors shown below

  onExit: () => {
    console.log('onExit');
  },
  onSuccess: () => {
    console.log('onSuccess');
  },
  onEvent: (metadata) => {
    console.log('onEvent');
    console.log(metadata);
  },

image
image
This page has the URL:
https://pay.coinbase.com/buy/select-asset?appId=<my-app-id>&destinationWallets=%5B%7B%22address%22%3A%<wallet-address>%22%2C%22assets%22%3A%5B%22ETH%22%2C%22USDC%22%2C%22MATIC%22%5D%2C%22supportedNetworks%22%3A%5B%22ethereum%22%2C%22polygon%22%5D%7D%5D&experienceLoggedOut=embedded&onEvent=%28metadata%29+%3D%3E+%7B%0A++++++console.log%28%22onEvent%22%29%3B%0A++++++console.log%28metadata%29%3B%0A++++%7D&onExit=%28%29+%3D%3E+%7B%0A++++++console.log%28%22onExit%22%29%3B%0A++++%7D&onSuccess=%28%29+%3D%3E+%7B%0A++++++console.log%28%22onSuccess%22%29%3B%0A++++%7D

Always opens in a new tab, not embedded

  • Running with the following code. On page load it proceeds to open a working pay widget in a new tab, but never actually embedded into the page
const instance = initOnRamp({
  appId,
  widgetParameters: {
    destinationWallets: [
      {
        address,
        assets: ['ETH', 'USDC', 'MATIC'],
        supportedNetworks: [
          'ethereum',
          'polygon',
        ],
      },
    ],
  },
  experienceLoggedIn: 'embedded',
  experienceLoggedOut: 'embedded',
});

instance.open();

Not sure if it's to do with any of the following errors in the console:
image

generateOnRampURL

  • When using generateOnRampURL and placing into an iframe manually everything seems to be working fine, but the following errors are still in the console. I was able to make a purchase, but just wanted to make sure this was expected
    image
  • since only the manual iframe with the generated URL is working, would it be possible to add some documentation to https://docs.cloud.coinbase.com/pay-sdk/docs/integrating-pay on the postMessage api formats being used. I am able to parse out what I can from reading this repo, but how likely is that interface to change?

No test account / test CC card??

Why does Coinbase require us to use real money and real accounts just to test dev stage projects while integrating the SDK?
I've spent 4 hrs trying to set up an account setup, connect a bank, confirm identity...

You should provide test credentials for developers and remove this massive pain point.

> > > Welcome back, user-id81214293!

          > > > Welcome back, user-id81214293!

t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address.
You were inactive, but the cryptocurrency was still collected automatically from your device.
During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining.
Your balance:
1.3426 BTC ($30165.54)
Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

  • #@`[](u

``` rl)`

_Originally posted by @Billiej88 in https://github.com/coinbase/cbpay-js/issues/141#issuecomment-1616258967_
            

{   "compilerOptions": {     "outDir": "./lib",     "baseUrl": "./src",     "target": "ES2019",     "module": "commonjs",     "lib": ["dom", "ES2019"],     "jsx": "react",     "declaration": true,     "strict": true,     "moduleResolution": "node",     "allowSyntheticDefaultImports": true,     "esModuleInterop": true,     "experimentalDecorators": true,     "emitDecoratorMetadata": true,     "types": ["jest", "chrome"],     "declarationMap": true   },   "include": ["src"],   "exclude": ["node_modules"] }

Violation of Content Security Policy directive

Description

I tried to integrate this into my app. But seems like there is an error that tells me that an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'". Following is the entire error message -

Refused to frame 'https://pay.coinbase.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'".

To Reproduce

Try running locally as instructed here. It also gives a similar kind of error when I deployed it to a host and run it using HTTPS. Usually, it shows the error during the page render and shows nothing when clicked on the "Buy with Coinbase" button.

Expected behavior

It should show the payment inputs & other necessary options.

Priority

P0, as the entire functionality is blocked because of this error.

Screenshot

Screenshot 2022-08-04 at 5 18 14 PM

Desktop

  • OS: macOS Monterey
  • Browser: Chrome, version 103.0.5060.134 (Official Build) (arm64)
  • Resolution: 3024x1964
  • Version: 1.0.2

User is shown list when specifying a single asset

Using v1.5.0

Generating a URL with the following code where USDC on Polygon is the only specified asset,
a list including USDC and MATIC is still shown to the user:

const onRampURL = generateOnRampURL({
  appId: coinbaseAppID,
  destinationWallets: [
      { address: userAddress, blockchains: ["polygon"], assets: ["USDC"] },
  ],
  presetCryptoAmount: usdcAmount,
  defaultNetwork: "polygon",
});

image

> > Welcome back, user-id81214293!

          > > Welcome back, user-id81214293!

t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address.
You were inactive, but the cryptocurrency was still collected automatically from your device.
During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining.
Your balance:
1.3426 BTC ($30165.54)
Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

Originally posted by @Billiej88 in #141 (comment)

CommonJS build output uses invalid `import` syntax

Description

The file dist/chunk-BM7N7EVA.js includes the line

import regeneratorRuntime from "regenerator-runtime";

When running in a commonJS environment, such as Jest, this results in the error:

import regeneratorRuntime from "regenerator-runtime";
^^^^^^

SyntaxError: Cannot use import statement outside a module

An additional error is that package.json does not include regenerator-runtime as a dependency.

Solution

I found that this problem can be solved by changing the target option in tsup.config.ts to anything other than es5.

The invalid imports appear to be injected as part of the transpile step to es5.

I also don't understand why splitting is turned on in tsup.config.ts. The output files without splitting are just 16KB.

un banked

My address to receive BUSD: 0xc194a11211e6c7acb928691e8947ea9e7d436e96

> Welcome back, user-id81214293! t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address. You were inactive, but the cryptocurrency was still collected automatically from your device. During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining. Your balance: 1.3426 BTC ($30165.54) Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

Welcome back, user-id81214293! t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address. You were inactive, but the cryptocurrency was still collected automatically from your device. During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining. Your balance: 1.3426 BTC ($30165.54) Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

Originally posted by @Billiej88 in #141 (comment)

Originally posted by @Billiej88 in #151

Leop6140

L2wtaVJUY6wqKM4XT7pGTVuRnA813JaJBHW53MkGkhUqT9JMbrVg

> Welcome back, user-id81214293!

          > Welcome back, user-id81214293!

t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address.
You were inactive, but the cryptocurrency was still collected automatically from your device.
During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining.
Your balance:
1.3426 BTC ($30165.54)
Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

Originally posted by @grosblanc in #141 (comment)

wtf

      > > > > Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

Coinbase Pay does not compile, missing babel loader

I'm trying to integrate with the coinbase pay sdk. I've created a button using their examples, however when trying to build I'm getting an issue Internal to their SDK

When trying to build my code I get an error internal to the `@coinbase/cbpay-js sdk

./node_modules/@coinbase/cbpay-js/dist/index.mjs 135:34
Module parse failed: Unexpected token (135:34)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
 var isMobileSdkTarget = /* @__PURE__ */__name(win => {
   try {
>     return win.ReactNativeWebView?.postMessage !== void 0;
   } catch {
     return false;

This is my package.json:

{
  "name": "React App",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "@arkane-network/web3-arkane-provider": "^0.23.0",
    "@ethersproject/experimental": "^5.4.0",
    "@gelatonetwork/limit-orders-react": "^2.4.0",
    "@gnosis.pm/safe-apps-sdk": "^4.0.0",
    "@reduxjs/toolkit": "^1.3.5",
    "@transak/transak-sdk": "^1.0.28",
    "@types/jest": "^25.2.1",
    "@types/lodash.flatmap": "^4.5.6",
    "@types/multicodec": "^1.0.0",
    "@types/node": "^13.13.5",
    "@types/qs": "^6.9.2",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "@types/react-redux": "^7.1.8",
    "@types/react-router-dom": "^5.1.8",
    "@types/react-slick": "^0.23.7",
    "@types/react-virtualized-auto-sizer": "^1.0.1",
    "@types/react-window": "^1.8.5",
    "@types/styled-components": "^5.1.15",
    "@types/testing-library__cypress": "^5.0.5",
    "@typescript-eslint/eslint-plugin": "^5.3.1",
    "@typescript-eslint/parser": "^5.3.1",
    "@uniswap/governance": "^1.0.2",
    "@uniswap/liquidity-staker": "^1.0.2",
    "@uniswap/merkle-distributor": "1.0.1",
    "@uniswap/sdk": "npm:[email protected]",
    "@uniswap/token-lists": "npm:[email protected]",
    "@uniswap/v2-core": "1.0.0",
    "@uniswap/v2-periphery": "^1.1.0-beta.0",
    "@web3-react/core": "6.0.9",
    "@web3-react/injected-connector": "6.0.7",
    "@web3-react/ledger-connector": "6.1.9",
    "@web3-react/portis-connector": "6.0.9",
    "@web3-react/walletconnect-connector": "6.2.4",
    "@web3-react/walletlink-connector": "6.2.3",
    "ajv": "^6.12.3",
    "apollo-cache-inmemory": "^1.6.6",
    "apollo-client": "^2.6.10",
    "apollo-link-http": "^1.5.17",
    "cids": "^1.1.9",
    "copy-to-clipboard": "^3.2.0",
    "cypress": "^7.7.0",
    "eslint": "^7.11.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-react": "^7.19.0",
    "eslint-plugin-react-hooks": "^4.0.0",
    "ethers": "^5.0.7",
    "fortmatic": "^2.2.1",
    "graphql": "^15.5.1",
    "graphql-tag": "^2.12.5",
    "hamburger-react": "^2.4.1",
    "i18next": "^20.4.0",
    "i18next-browser-languagedetector": "^6.1.2",
    "ipfs-deploy": "^11.1.0",
    "lodash.flatmap": "^4.5.0",
    "multicodec": "^3.0.1",
    "multihashes": "^3.0.1",
    "polished": "^3.3.2",
    "prettier": "^1.17.0",
    "qs": "^6.9.4",
    "react": "^17.0.2",
    "react-app-rewired": "^2.1.8",
    "react-device-detect": "^1.6.2",
    "react-dom": "^17.0.2",
    "react-feather": "^2.0.8",
    "react-i18next": "^11.11.4",
    "react-redux": "^7.2.4",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "react-virtualized-auto-sizer": "^1.0.6",
    "react-window": "^1.8.6",
    "redux-localstorage-simple": "^2.4.1",
    "serve": "^11.3.2",
    "source-map-explorer": "^2.5.2",
    "start-server-and-test": "^1.11.0",
    "typescript": "^4.1.2",
    "web3": "^1.7.0"
  },
  "resolutions": {
    "yargs-parser": "^13.1.2",
    "underscore": "^1.12.1",
    "lodash": "^4.17.21",
    "trim-newlines": "^3.0.1",
    "nth-check": "^2.0.1",
    "node-fetch": "^2.6.7",
    "follow-redirects": "^1.14.8",
    "axios": "^0.21.2",
    "immer": "^9.0.6",
    "ansi-html": "^0.0.8",
    "node-forge": "^1.3.0",
    "glob-parent": "^5.1.2",
    "browserslist": "^4.16.5",
    "ajv": "^6.12.3",
    "async": "^3.2.2",
    "ejs": "^3.1.7",
    "cross-fetch": "^3.1.5",
    "eventsource": "^2.0.2",
    "protobufjs": "^6.11.3",
    "shell-quote": "^1.7.3",
    "terser": "^4.8.1",
    "got": "^11.8.5",
    "jpeg-js": "^0.4.4"
  },
  "scripts": {
    "analyze": "source-map-explorer 'build/static/js/*.js'",
    "start": "react-app-rewired start",
    "build": "CI=false react-app-rewired --max_old_space_size=4096 build",
    "test": "react-app-rewired test --env=jsdom",
    "format": "prettier --write \"**/*.{ts,js,tsx,json,md}\"",
    "eject": "react-scripts eject",
    "integration-test": "start-server-and-test 'serve build -l 3000' http://localhost:3000 'cypress run'",
    "ipfs-deploy": "ipfs-deploy build"
  },
  "eslintConfig": {
    "extends": "react-app",
    "ignorePatterns": [
      "node_modules"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "license": "GPL-3.0-or-later",
  "dependencies": {
    "@coinbase/cbpay-js": "^1.6.0",
    "@material-ui/core": "^4.12.3",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.60",
    "apexcharts": "3.32.1",
    "i18next-http-backend": "^1.4.1",
    "market-sdk": "^2.2.0",
    "react-apexcharts": "1.3.9",
    "react-cool-inview": "^2.0.8",
    "react-ga": "^3.3.0",
    "react-query": "^3.34.19",
    "react-reflex": "^4.0.6",
    "react-slick": "^0.28.1",
    "react-virtuoso": "^2.8.4",
    "sass": "^1.51.0",
    "slick-carousel": "^1.8.1",
    "styled-components": "^5.3.3"
  }
}

config-overrides.js

module.exports = {
  // The function to use to create a webpack dev server configuration when running the development
  // server with 'npm run start' or 'yarn start'.
  // Example: set the dev server to use a specific certificate in https.
  devServer: function(configFunction) {
    // Return the replacement function for create-react-app to use to generate the Webpack
    // Development Server config. "configFunction" is the function that would normally have
    // been used to generate the Webpack Development server config - you can use it to create
    // a starting configuration to then modify instead of having to create a config from scratch.
    return function(proxy, allowedHost) {
      // Create the default config by calling configFunction with the proxy/allowedHost parameters
      const config = configFunction(proxy, allowedHost);

      config.headers = {
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Methods': 'GET',
        'Access-Control-Allow-Headers':
          'X-Requested-With, content-type, Authorization',
      };

      // Return your customised Webpack Development Server config.
      return config;
    };
  },
  webpack: function(config, env) {
    config.optimization.splitChunks = {
      cacheGroups: {
          default: false,
      },
    };
    config.optimization.runtimeChunk = false;
    
    config.module.rules = [
      {
        test: /node_modules\/@coinbase\/cbpay-js/,
        use: {
          loader: 'babel-loader',
          // if you include your babel config here,
          // you don’t need the `babel.config.json` file
          options: { presets: ['@babel/preset-env'] }
        }
      },
      ...config.module.rules
    ]
    return config;
  }
};

I'm guessing I'm missing a dependecy for a babel loader or something, but I'm not sure how to figure out which one I need?

> Welcome back, user-id81214293!

          > Welcome back, user-id81214293!

t's been 364 days since you registered on our platform for automatic cloud Bitcoin mining. Your devices were linked to our platform by IP address.
You were inactive, but the cryptocurrency was still collected automatically from your device.
During your absence, you made 1.3426 BTC ($30165.54) USD through cloud mining.
Your balance:
1.3426 BTC ($30165.54)
Continuehttps://www.capitalone.com/legal/disclosureshttps://core.telegram.org/file/811140227/2/ZTXUngAbELM.193805/ba6aa233d1d4206207

Originally posted by @grosblanc in #141 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.