Giter VIP home page Giter VIP logo

dai.js's Introduction

DEPRECATED

Active maintenance of this library has been discontinued. Please visit https://chat.makerdao.com for support.

No Maintenance Intended

Dai.js SDK monorepo

Build Status Coverage Status

Uses Lerna. Automatically lints and prettifies code on commit.

Documentation

Please view README.md for each individual package (e.g. packages/dai) and/or docs.makerdao.com.

Getting started

yarn
curl https://dapp.tools/install | sh // Installs dapptools
yarn lerna bootstrap // Installs dependencies & links all local dependencies together
yarn build // builds each plugin for local use

Running the testchain

yarn testchain
yarn test:logs // get testchain logs

Running tests

yarn test
yarn test:integration
yarn test:build

Run yarn coverage to generate a test coverage report.

Creating a UMD build

See packages/dai/README.md for instructions.

Adding a package as dependency of another

 npx lerna add @makerdao/services-core packages/dai-plugin-mcd

Releasing a version

From the root of the project:

npx lerna version prerelease
npx lerna publish from-package

This will create a new version for all the packages and publish automatically, prerelease is for alpha versions.

If you want a release or another kind please check lerna version documentation.

dai.js's People

Contributors

abylaw avatar adamgoth avatar adrianleb avatar aquigorka avatar b-pmcg avatar dependabot[bot] avatar ecmendenhall avatar ethanbennett avatar ferni avatar godsflaw avatar howleysv avatar jluccisano avatar jparklev avatar kentonprescott avatar konstantinzolotarev avatar levity avatar michaelelliot avatar padraic-o-mhuiris avatar rafinskipg avatar ryepdx avatar savil avatar seanwbren avatar shkfnly avatar tyler17 avatar wkampmann 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

Watchers

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

dai.js's Issues

5000 requests on Infura by hour

I'm using dai.js with infura and i discover that i used my quota everyday (free account limited to 100k requests by day). After investigation, i removed this part and joy:

  gMakerTool = await Maker.create('http', {
    url: `https://mainnet.infura.io/v3/${config.infura.mainnet}`,
    web3: { statusTimerDelay: 15000 },
    log: false
  })
  await gMakerTool.authenticate()
  gCDPService = gMakerTool.service('cdp')
  gPriceService = gMakerTool.service('price')

Is it normal to use so many requests ?

Best regards

Edit: with the flag NODE_DEBUG=request, you can see all the requests.

It will show many requests like: eth_getBlockByNumber. The rate seems to be 1 per s! In this debug, it's like 4 four times the same query.
https://gist.github.com/ellis2323/85f2ee96fd83fe6144a96fff193bbdea

Don't have a hard dependency on `selectedAddress`.

function getSelectedAddress() {
return typeof window.ethereum !== 'undefined'
? window.ethereum.selectedAddress
: window.web3.eth.defaultAccount;
}

I don't believe selectedAddress isn't a standardized property on window.ethereum. While it may exist in MetaMask, there is no guarantee that it exists on any other wallet. Recommend having a fallback to the result of wallet_requestAccounts or eth_coinbase or eth_accounts. Currently, if the connect wallet doesn't have a selectedAddress property on window.ethereum the console gets spammed with Uncaught (in promise) TypeError: Cannot read property 'toLowerCase' of undefined because this function always returns undefined.

Typescript error when using @makerdao/[email protected] "Cannot find name 'BigNumber'"

When trying to import McdPlugin from '@makerdao/dai-plugin-mcd'; getting errors

ERROR in ../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:98:25 - error TS2304: Cannot find name 'BigNumber'.

98     liquidationPenalty: BigNumber;
                           ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:108:16 - error TS2304: Cannot find name 'BigNumber'.

108     debtFloor: BigNumber;
                   ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:135:25 - error TS2304: Cannot find name 'BigNumber'.

135     liquidationPenalty: BigNumber;
                            ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:140:28 - error TS2304: Cannot find name 'BigNumber'.

140     priceWithSafetyMargin: BigNumber;
                               ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:145:16 - error TS2304: Cannot find name 'BigNumber'.

145     debtFloor: BigNumber;
                   ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:157:52 - error TS2304: Cannot find name 'BigNumber'.

157     debtScalingFactor(collateralTypeName: string): BigNumber;
                                                       ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:162:56 - error TS2304: Cannot find name 'BigNumber'.

162     priceWithSafetyMargin(collateralTypeName: string): BigNumber;
                                                           ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:172:44 - error TS2304: Cannot find name 'BigNumber'.

172     debtFloor(collateralTypeName: string): BigNumber;
                                               ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:192:8 - error TS2304: Cannot find name 'BigNumber'.

192     ): BigNumber;
           ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:201:8 - error TS2304: Cannot find name 'BigNumber'.

201     ): BigNumber;
           ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:210:8 - error TS2304: Cannot find name 'BigNumber'.

210     ): BigNumber;
           ~~~~~~~~~
../node_modules/@makerdao/dai-plugin-mcd/typings/multicall.d.ts:235:52 - error TS2304: Cannot find name 'BigNumber'.

235     maxAuctionLotSize(collateralTypeName: string): BigNumber;

`transactionManager` doesn't track a transaction

Hello there! I am trying to use maker.service('transactionManager') according to the docs, by passing a transaction promise, but for some reason, it doesn't track anything at all or throw any error.

Sample code, that doesn't log anything in the console and never resolve the promise:

const collateralType = 'AAVE-A';
const auctionId = 2;
const walletAddress = 'your_wallet_address';

const clipperContract = maker.service('liquidation')._clipperContractByIlk(collateralType);
const transaction = clipperContract.redo(auctionId, walletAddress);

const transactionManager = maker.service('transactionManager');
await new Promise((resolve, reject): void => {
    transactionManager.listen(transaction, {
         pending: (tx: any) => {
            console.log('pending', tx);
        },
        mined: (tx: any) => {
            console.log('mined', tx);
        },
        confirmed: (tx: any) => {
            console.log('confirmed', tx);
            resolve(tx);
        },
        error: (tx: any) => {
            console.error('error', tx);
            const errorMessage = tx?.error?.message || 'unknown';
            reject(new Error(errorMessage));
        },
    });
    transactionManager.confirm(transaction);
});

Does transactionManager only track certain types of transactions? Or do I miss something?

Update the web3 dependency

Currently when one add the latest version of @makerdao/dai in react application, the following warning appears:

./node_modules/web3-eth-accounts/src/scrypt.js
Critical dependency: the request of a dependency is an expression

The reason could be found here:
web3/web3.js#3018

The current web3 version is 1.2.1 and the issue was fixed in 1.2.2 and the latest web3 version is 1.2.6

Failed to wipeDai or wipeAll dai to pay off debet

I want to pay off a debet with dai.js. Most function is ok except "wipe" and "wipeAll".

environment: fork from the mainnet with ganche.

        const maker = await Maker.create('http', {
            plugins: [McdPlugin],
            url: HashQuark,
            privateKey: myPrivateKey
        });
        await maker.authenticate();

        const mgr = maker.service('mcd:cdpManager');
        const proxyAddress = await maker.service('proxy').currentProxy();
        const data = await mgr.getCdpIds(proxyAddress);
        const { id, ilk } = data[0]; // // e.g. id = 5, ilk = 'ETH-A'
        console.log(`vaultId: ${id}`);
        console.log(`currentAddress: ${maker.currentAddress()}`);

        const vault = await mgr.getCdp(id);
        console.log(`collateralAmount: ${vault.collateralAmount}`);
        console.log(`collateralValue: ${vault.collateralValue}`);
        console.log(`debtValue: ${vault.debtValue}`);
        console.log(`liquidationPrice: ${vault.liquidationPrice}`);
        console.log(`isSafe: ${vault.isSafe}`);

        const wipeDaiResult = await vault.wipeDai(DAI(3000));
        console.log(`wipeDaiResult: ${(wipeDaiResult)}`);

        // wipAllResult = await vault.wipeAll();
        // console.log(`wipAllResult: ${wipAllResult}`);

        return wipeDaiResult
    }

error result:
 
currentAddress: 0x90f79bf6eb2c4f870365e785982e1f101e93b906
  vaultId: 20015
  collateralAmount: 65.00 ETH
  collateralValue: 73945.95 USD
  debtValue: 1522.02 DAI
  liquidationPrice: 35.12 USD/ETH
  isSafe: true
  2021-02-20 17:45:54,663 ERROR 29330 [-/127.0.0.1/-/3888ms GET /api/makerdao/createVault] nodejs.Error: Transaction reverted without a reason
      at Object.app.context.onerror (/Users/feng/code/solidity/compound-monitor/node_modules/koa-onerror/index.js:39:24)
      at onerror (/Users/feng/code/solidity/compound-monitor/node_modules/koa/lib/application.js:165:32)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
  
  pid: 29330

Add support for xDAI side chain

dai.js does not seem to know the address of the xDAI sidechain contract.

While building a hackathon project we tried to use the switch statement to access the xDAI sidechain, but it did not connect. We were accessessing our dApp through the Status mobile browser.

@makerdao/dai-plugin-mcd 1.0.6 typescript issues

Version 1.0.5 of the plugin works fine with my typescript setup but changes in version 1.0.6 have completely broken down with missing typescript definitions to 'BigNumber' and a host of other problems:

Screen Shot 2020-02-17 at 11 51 52 AM

Downgrading to 1.0.5 works but I'd like to support beyond this.

UMD build not present in npm package

The documentation states that you can use this as an UMD build, however, no UMD build is provided in the published npm repo.

In order to get the UMD build, you would have to clone the repo, and then manually build it, which defeats the purpose of using npm in the first place.

I was wondering if you guys could include that in the npm package for convenience purposes?

Typescript definitions

Are we planning on providing the Typescript definition files for the library?

This would be required if we want let Angular users to use the lib.

'amount cannot be negative' on daiAvailable for underwater cdp

cdp.daiAvailable for an undercollaterized CDP generates the following error:

 Error: amount cannot be negative
           at amountToBigNumber (C:\Users\madumas\WebstormProjects\testrunner\node_modules\@makerdao\currency\dist\Currency.js:49:26)
           at CurrencyX.Currency (C:\Users\madumas\WebstormProjects\testrunner\node_modules\@makerdao\currency\dist\Currency.js:62:73)
           at new MDAI (C:\Users\madumas\WebstormProjects\testrunner\node_modules\@makerdao\currency\dist\index.js:50:132)
           at bigNumberFnResult (C:\Users\madumas\WebstormProjects\testrunner\node_modules\@makerdao\currency\dist\Currency.js:181:12)
           at CurrencyX.minus (C:\Users\madumas\WebstormProjects\testrunner\node_modules\@makerdao\currency\dist\Currency.js:194:32)
           at Object.daiAvailable (C:\Users\madumas\WebstormProjects\testrunner\node_modules\@makerdao\dai-plugin-mcd\dist\math.js:105:51)
           at ManagedCdp.get (C:\Users\madumas\WebstormProjects\testrunner\node_modules\@makerdao\dai-plugin-mcd\dist\ManagedCdp.js:286:19)
           at daiAvailable (C:\Users\madumas\WebstormProjects\testrunner\src\actions\cdpDrawMax.js:12:21)

Cannot use with Angular, but can with Vue

It's odd - when I

import Maker from "@makerdao/dai"

in Vue, everything works fine in the browser. When I do so with Angular 11, I get a whole host of unresolved module errors. The list includes crypto, os, stream, and so forth.

Error: ./node_modules/web3-eth-accounts/src/index.js
Module not found: Error: Can't resolve 'crypto' in . . . 

Is the dai.js module not packaged in a way that Angular's compiler can read it?

CDP 60387 has different state when querying via @makerdao/dai versus graphql

For CDP 60387, when i print info about it from the @makerdao/dai nodejs APIs, I get:

printing info for cdp.id 60387 :
debt: 0.06 DAI
gov fee: 0.00 MKR
collateralization ratio: 17.372915698915207
liquidation price: 14.95 USD/ETH USD per ETH
collateral value: 0.01 ETH
is safe: true

code for printing this is straightforward: https://gist.github.com/savil/1367a1b210df0de960a4115f5da1d870

but when i access it via graphiql https://sai-mainnet.makerfoundation.com/v1/console

{
  "data": {
    "getCup": {
      "lad": "0xBAf2258F1Ea98f460015abDf7F11dde10B74988c",
      "art": "0.935",
      "ratio": "111.4839510090815358389702105825624538000",
      "time": "2019-08-06T09:20:22+00:00",
      "ink": "0.005751994277790881",
      "deleted": false
    }
  }
}

This matches what i see on MKR tools: https://mkr.tools/cdp/60387

The art (debt) and ratio seem pretty different.

Any idea why this discrepancy?

wipe dai with dai as stability fee

The wipe dai function of this library by default uses MKR as a stability fee by default, but I want to use DAI as a stability fee, so can someone help me with this?

cdp.wipeDai doesn't throw when tx fails

It's pretty common that cdp.wipeDai fails b/c you lack MKR tokens. Currently, there is NO information that it happens. Promise resolves correctly even that on etherscan you can see that it failed. This is an obvious bug.

Example:

await cdp.wipeDai("10", Maker.DAI); // this doesnt throw (at least in the case when user lacks MKRs).

Metamask update not supported yet?

After the latest Metamask update, the connection seems to be broken:

image

The way we create the maker instance is:

export const createMaker = async () => {
  return await Maker.create('browser', {
    plugins: [McdPlugin], // Add plugins, Mcd to support DAI (Multi collateral dai)
    multicall: true,
    web3: {
      pollingInterval: null,
    },
  });
};

Versions:

    "@makerdao/dai": "0.31.7",
    "@makerdao/dai-plugin-mcd": "1.5.12",

'Error: amount "NaN" is not a number' when using cdp.getLiquidationPrice()

This code:

const liquidationPrice = await cdp.getLiquidationPrice();

throws:

Error: amount "NaN" is not a number
    at amountToBigNumber (/home/aw/dev/maker/app/node_modules/@makerdao/dai/src/eth/Currency.js:65:28)
    at CurrencyRatio.Currency (/home/aw/dev/maker/app/node_modules/@makerdao/dai/src/eth/Currency.js:76:73)
    at new CurrencyRatio (/home/aw/dev/maker/app/node_modules/@makerdao/dai/src/eth/Currency.js:332:139)
    at result (/home/aw/dev/maker/app/node_modules/@makerdao/dai/src/eth/Currency.js:173:10)
    at CurrencyX.<anonymous> (/home/aw/dev/maker/app/node_modules/@makerdao/dai/src/eth/Currency.js:183:32)
    at EthereumCdpService._callee13$ (/home/aw/dev/maker/app/node_modules/@makerdao/dai/src/eth/EthereumCdpService.js:644:73)
    at tryCatch (/home/aw/dev/maker/app/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/home/aw/dev/maker/app/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/home/aw/dev/maker/app/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/home/aw/dev/maker/app/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

when cdp does not have a liquidation price yet.

VM Exception when calling join() (Dai Savings Rate)

Hello everyone,
I'm testing my code on a local fork (http://localhost:2000) of the Ethereum mainnet using infura.
I simply want to deposit an amount of Dai to the Dai Savings Rate contract.
Here's my code:

const privateKey = process.env.LOCAL_GANACHE_PRIVATE_KEY;
web3.eth.accounts.wallet.add('0x'` + privateKey);
const testAddress = web3.eth.accounts.wallet[0].address;

const maker = await Maker.create('http', {
        plugins: [McdPlugin],
        url: 'http://127.0.0.1:2000',
        privateKey: '0x' + privateKey,
        web3: {
            transactionSettings:{
                gasLimit: 6721975,
                gasPrice: 20000000000
            }
        },
        log: true
    });
const dsrService = maker.service('mcd:savings');
const proxyAddress = maker.service('proxy').getProxyAddress(testAddress);
await dsrService.join(DAI(amount));

This is the error that i get:

 Error: VM Exception while processing transaction: revert
{
  "0xe45980fa1349afedc5912a519854bb5095071d4044ea61d7545758a27bc869b3": {
    "error": "revert",
    "program_counter": 948,
    "return": "0x"
  }

I made sure that maker is using the right address and I minted some Dai to the address before calling the join().
Any help would be appreciated.

Creating a Maker instance on Ganache node

I got an error trying to create a Maker instance on my local Ganache node. I can't find an example online anywhere. What seems to be the problem here?

const maker = await Maker.create("test", {
privateKey: PRIVATE_KEY,
url: "http://127.0.0.1:7545"
});

Error: No network with ID 5777 found
at getNetworkName (.....)
...

Thanks!

ethereumjs-util not specified in dependencies

I might not be assessing this correctly, but I see require('ethereumjs-util') in src/eth/accounts/factories.js, but ethereumjs-util is not specified in the package dependencies. Our app is resolving to a different version of ethereumjs-util that we have installed.

How to build and get dai.js umd file?

I want to get a umd version of dai.js and use it like <script src="./dai.js" />
But can't find a file I want after execute

yarn
yarn lerna bootstrap
yarn build

mcd plugin

when tryin to create an maker instance with the mcd plugin, i get an:

assertion error, message: Missing address for DGD on mainnet

yarn lerna bootstrap can not be run

Hi Guys,
I want to install dai.js on an ubuntu system, I run the relative query for Yarn and add the relative packages.
but now i faced with below error.
Anyone has an idea?

------- yarn lerna bootstrap
yarn run v1.21.1
$ /home/sara/node_modules/.bin/lerna bootstrap
lerna notice cli v3.20.2
lerna ERR! ENOLERNA lerna.json does not exist, have you run lerna init?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

MCD Plugin is not a plugin.

Having a problem using the mcd plugin. Using the example from the wiki gives the following error.

○ → node .
error in main:
 AssertionError [ERR_ASSERTION]: plugins[0] does not seem to be a plugin
    at /Users/andy/workspace/dai/node_modules/@makerdao/dai/dist/src/Maker.js:350:28
    at Array.map (<anonymous>)

https://gist.github.com/tamccall/fd2486bd13031de0d8cf46fe1089e6bb

 2020-02-06 20:22:30 ⌚  Andys-MBP in ~/workspace/dai
○ → node -v
v13.8.0

missing script: start

Following the readme, I tried npm start, which failed with the following errors

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: start
4 verbose stack     at run (/usr/local/lib/node_modules/npm/lib/run-script.js:151:19)
4 verbose stack     at /usr/local/lib/node_modules/npm/lib/run-script.js:61:5
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:115:5
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:418:5
4 verbose stack     at checkBinReferences_ (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:373:45)
4 verbose stack     at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:416:3)
4 verbose stack     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:160:5)
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:364:12
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16
4 verbose stack     at tryToString (fs.js:512:3)
5 verbose cwd /Users/marc-andre/WebstormProjects/dai.js
6 verbose Darwin 16.7.0
7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
8 verbose node v8.1.3
9 verbose npm  v6.1.0
10 error missing script: start
11 verbose exit [ 1, true ]

yarn test is not running

Anybody can help me with the below error?

yarn test
yarn run v1.21.1
$ yarn testchain --ci yarn lerna run --concurrency 1 test
$ ./scripts/run-testchain.sh --ci yarn lerna run --concurrency 1 test
Setting ethers.js polling interval to 50 ms.
Loading snapshots/default.
Skipping git submodule update.
Starting Ganache...
Launched testchain in 24 seconds.
$ /home/sara/dai.js/node_modules/.bin/lerna run --concurrency 1 test
lerna notice cli v3.15.0
lerna info versioning independent
lerna info Executing command in 6 packages: "yarn run test"
lerna info run Ran npm script 'test' in '@makerdao/services-core' in 16.7s:
$ jest
lerna info run Ran npm script 'test' in '@makerdao/test-helpers' in 7.1s:
$ jest
lerna ERR! yarn run test exited 1 in '@makerdao/dai-plugin-governance'
lerna ERR! yarn run test stdout:
$ yarn testchain --ci jest --runInBand --config ./test/config/jestTestchainConfigOriginal.json
$ ../../scripts/run-testchain.sh --ci jest --runInBand --config ./test/config/jestTestchainConfigOriginal.json
Setting ethers.js polling interval to 50 ms.
Testchain is already running on port 2000.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

lerna ERR! yarn run test stderr:
FAIL test/GovPollingService.test.js
● Test suite failed to run

Cannot find module 'ramda' from 'index.js'

However, Jest was able to find:
	'../../src/index.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

> 1 | import { map, prop } from 'ramda';
    | ^
  2 | import {
  3 |   VOTE_PROXY_FACTORY,
  4 |   CHIEF,

  at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:259:17)
  at Object.<anonymous> (src/index.js:1:1)

FAIL test/VoteProxyService.test.js
● Test suite failed to run

Cannot find module 'ramda' from 'index.js'

However, Jest was able to find:
	'../../src/index.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

> 1 | import { map, prop } from 'ramda';
    | ^
  2 | import {
  3 |   VOTE_PROXY_FACTORY,
  4 |   CHIEF,

  at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:259:17)
  at Object.<anonymous> (src/index.js:1:1)

FAIL test/ChiefService.test.js
● Test suite failed to run

Cannot find module 'ramda' from 'index.js'

However, Jest was able to find:
	'../../src/index.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

> 1 | import { map, prop } from 'ramda';
    | ^
  2 | import {
  3 |   VOTE_PROXY_FACTORY,
  4 |   CHIEF,

  at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:259:17)
  at Object.<anonymous> (src/index.js:1:1)

FAIL test/VoteProxyFactoryService.test.js
● Test suite failed to run

Cannot find module 'ramda' from 'index.js'

However, Jest was able to find:
	'../../src/index.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

> 1 | import { map, prop } from 'ramda';
    | ^
  2 | import {
  3 |   VOTE_PROXY_FACTORY,
  4 |   CHIEF,

  at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:259:17)
  at Object.<anonymous> (src/index.js:1:1)

FAIL test/EsmService.test.js
● Test suite failed to run

Cannot find module 'ramda' from 'index.js'

However, Jest was able to find:
	'../../src/index.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

> 1 | import { map, prop } from 'ramda';
    | ^
  2 | import {
  3 |   VOTE_PROXY_FACTORY,
  4 |   CHIEF,

  at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:259:17)
  at Object.<anonymous> (src/index.js:1:1)

FAIL test/VoteProxy.test.js
● Test suite failed to run

Cannot find module 'ramda' from 'index.js'

However, Jest was able to find:
	'../../src/index.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

> 1 | import { map, prop } from 'ramda';
    | ^
  2 | import {
  3 |   VOTE_PROXY_FACTORY,
  4 |   CHIEF,

  at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:259:17)
  at Object.<anonymous> (src/index.js:1:1)

Test Suites: 6 failed, 6 total
Tests: 0 total
Snapshots: 0 total
Time: 18.095s, estimated 57s
Ran all test suites.
error Command failed with exit code 1.
error Command failed with exit code 1.

lerna ERR! yarn run test exited 1 in '@makerdao/dai-plugin-governance'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
sara@sara-VirtualBox:/dai.js$ yarn test:watch
yarn run v1.21.1
error Command "test:watch" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
sara@sara-VirtualBox:
/dai.js$ yarn test:net
yarn run v1.21.1
error Command "test:net" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@makerdao/dai-plugin-mcd latest version doesn't work with typescript

Hi,
I am trying to use the latest mcd plugin version on typescript, I am on Mac OS
Node Version -> v12.6.0
NPM version -> 6.9.0

When I do npm install with the latest version 1.5.17 I get the following error:
File node_modules/@makerdao/dai-plugin-mcd/typings/index.d.ts' is not a module.

I am importing like this => import McdPlugin from '@makerdao/dai-plugin-mcd';

Please look into or let me know how can I help?

can not use exchange service

I would like to use exchange service using the code below

await maker.authenticate()
const exchange = maker.service('exchange');

However, It throws errors directly. By the way, I did call maker.authenticate() before using maker.service('exchange'), Anyone could help me? Thanks a lot

error Error: Service with name 'exchange' cannot be found in this container.
    at new ServiceNotFoundError (node_modules/@makerdao/services-core/dist/Container.js:80:147)
    at Container.service (node_modules/@makerdao/services-core/dist/Container.js:165:15)
    at Maker.service (node_modules/@makerdao/dai/src/Maker.js:146:30)

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.