{"_id":"@makerdao/dai-plugin-eth2dai-direct","_rev":"37-09590dfea587d740e45ab7aa3e41a9dd","name":"@makerdao/dai-plugin-eth2dai-direct","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@makerdao/dai-plugin-eth2dai-direct","version":"0.1.0","license":"MIT","_id":"@makerdao/dai-plugin-eth2dai-direct@0.1.0","maintainers":[{"name":"sirromdev","email":"sirromdev@gmail.com"},{"name":"adrianleb","email":"adrian@adrians.info"},{"name":"b-pmcg","email":"bain.pmcg@gmail.com"},{"name":"dzzy","email":"george.niculae79@gmail.com"},{"name":"ferni","email":"fertiberti@gmail.com"},{"name":"asymmetric","email":"geograpy@mailbox.org"},{"name":"wkampmann","email":"wouter@ksdc.be"},{"name":"kentonprescott","email":"kenton@makerdao.com"},{"name":"tyler17","email":"tyler@makerdao.com"},{"name":"nanexcool","email":"nanexcool@gmail.com"},{"name":"vkr12","email":"hi@vamsiraju.com"},{"name":"michaelelliot","email":"michael@digital.com.au"},{"name":"abylaw","email":"me@andrealaw.co"},{"name":"jparklevine","email":"joshua@makerdao.com"},{"name":"ethanbennett","email":"ethan@ethanbennett.co"},{"name":"levity","email":"l@lw.io"},{"name":"seanwbren","email":"seanwbren@gmail.com"}],"homepage":"https://github.com/makerdao/dai-plugin-eth2dai-direct#readme","bugs":{"url":"https://github.com/makerdao/dai-plugin-eth2dai-direct/issues"},"dist":{"shasum":"62a38e5f22b4dfc624348523eafc2c7c48a245f8","tarball":"https://registry.npmjs.org/@makerdao/dai-plugin-eth2dai-direct/-/dai-plugin-eth2dai-direct-0.1.0.tgz","fileCount":2994,"integrity":"sha512-+p30I9LxIOPrw5LNQggg51wX4dpCVbKb1d1qeZKFZPmh1dMoMFNtyYv7OfDEIAE9qtC+jvs6YjBel0lhTBYWrg==","signatures":[{"sig":"MEYCIQDv7ES5T3R7+orlVfzmN7gqMo/8VLGeNmU3aiJcRylywgIhAIm642PxZTr/2UTUCcJ1twx0j/IRv5f9/0npBxTrerC8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":27125076,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcv8TMCRA9TVsSAnZWagAA41MP/0GHxKxV3bo25z7CLrCQ\neoKroAB3UbjF6nI0teqfK5p/BYGXVbh9u84N2UN+CqvRlTxx3b+eBlOqLqXs\nvpTXckvYiDGZph12fc8P+BCgmH+/uk/NdvVQl51G5AUS5Fncxn5pa8c4CmG/\n14NPa2DSrvwxC45a+RXAESlDEQwQr+dqZDuExYfiQy3HXHoK/by5UjFX1quB\nROE0CbSUxWcg8hNhlBQoPUHMtz/wU3ILa0rWP+xaVKQPe04CT0EHhcqIMF85\nOorof5cwx13a2Afxj1MFeOns9Yk0vZxhfVRY512NWlLtxO1OZ1ij1YN2aPyJ\n4hHDWAZg0thTPnuBrzbzMVkF4X56PrHVElbAg/bPV8ikgq3Jdq3zKnXGvHuB\nd3TgiJFk9bhZ7IO+CKPPWhYsykybkep6fAmhU3KAAFZOmTOQAk6PJ10gPxpL\npzy2bwbA5awxhfUKCiLuRXrWyvlsZx6Y0uMPx9rInZAzWbvw344f0xCcezL4\nBamJJDC11AzPATFqvEyn+rFZaBItw2jODeph2GvbyfaQDItUJaDD4dCNUNcP\nG+SxrAygfeoupJlwuM2BxsBQyqi1HOg8bDZkgc7Mw0kzNLf12hNXT0w3ro2u\ntAGNWOSYZWNDBtUHhj6TjMasM4mpj8WsafWCKPMIzFXP1cXg9vJ6ce6tQiv1\nqfJD\r\n=UeJZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/src/index.js","gitHead":"2150dd3b6a91dea4eff58410e6087d0d06b64936","scripts":{"test":"./scripts/build.sh && ./scripts/run-testchain.sh --ci jest --runInBand --config ./test/config/jestDefaultConfig.json","build":"./scripts/build.sh","test:net":"./scripts/run-testchain.sh"},"_npmUser":{"name":"ethanbennett","email":"ethan@ethanbennett.co"},"repository":{"url":"git+https://github.com/makerdao/dai-plugin-eth2dai-direct.git","type":"git"},"_npmVersion":"6.7.0","description":"A dai.js plugin for atomic trading on maker otc","directories":{},"lint-staged":{"*.{js,json}":["prettier --write --single-quote","git add"]},"_nodeVersion":"11.11.0","dependencies":{"lodash.values":"^4.3.0","@makerdao/currency":"^0.9.3","@makerdao/services-core":"^0.9.5"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.7.1","assert":"^1.4.1","ethers":"^3.0.15","prettier":"^1.17.0","copyfiles":"^2.1.0","@babel/cli":"^7.4.3","babel-jest":"^24.7.1","@babel/core":"^7.4.3","@babel/node":"^7.2.2","lint-staged":"^8.1.5","babel-eslint":"^10.0.1","babel-loader":"^8.0.5","@makerdao/dai":"^0.15.1-kovan.1","@babel/runtime":"^7.4.3","isomorphic-fetch":"^2.2.1","@babel/preset-env":"^7.4.3","babel-plugin-module-resolver":"^3.2.0","@babel/plugin-transform-runtime":"^7.4.3"},"_npmOperationalInternal":{"tmp":"tmp/dai-plugin-eth2dai-direct_0.1.0_1556071627780_0.7258213317074282","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-04-24T02:07:07.779Z","modified":"2025-07-23T15:10:50.982Z","0.1.0":"2019-04-24T02:07:08.300Z"},"bugs":{"url":"https://github.com/makerdao/dai-plugin-eth2dai-direct/issues"},"license":"MIT","homepage":"https://github.com/makerdao/dai-plugin-eth2dai-direct#readme","repository":{"url":"git+https://github.com/makerdao/dai-plugin-eth2dai-direct.git","type":"git"},"description":"A dai.js plugin for atomic trading on maker otc","maintainers":[{"email":"adamgoth@gmail.com","name":"adamgoth"},{"email":"bain.pmcg@gmail.com","name":"b-pmcg"},{"email":"chris@kaczor.io","name":"krzkaczor"},{"email":"tylerya@gmail.com","name":"tyler17"},{"email":"engineering@techops.services","name":"infosec_makerdao"}],"readme":"<h1 align=\"center\">\nEth2Dai Direct Plugin\n</h1>\n\nThis plugin can be injected into [dai.js](https://github.com/makerdao/dai.js) to execute atomic trades on [Eth2Dai](https://eth2dai.com/). It uses the contract FKA [Oasis Direct Proxy](https://github.com/makerdao/oasis-direct-proxy) to interact with the underlying [Maker OTC](https://github.com/makerdao/maker-otc) contract.\n\n[![NPM][npm]][npm-url]\n[![Build Status][build]][build-url]\n[![GitHub License][license]][license-url]\n\n___\n### Usage\n\nTo configure the [SDK](https://www.npmjs.com/package/@makerdao/dai) with this plugin:\n```\n$ yarn add @makerdao/dai\n$ yarn add @makerdao/dai-plugin-eth2dai-direct\n```\n```js\nimport Maker from '@makerdao/dai';\nimport Eth2DaiDirect from '@makerdao/dai-plugin-eth2dai-direct';\n\nconst maker = await Maker.create('browser', {\n  plugins: [Eth2DaiDirect]\n});\nawait maker.authenticate();\nawait maker.service('exchange').sell('ETH', 'DAI', '0.5');\n```\n\nNote that the `'browser'` preset above is only an example, not a specific requirement of the Eth2Dai Direct plugin. For more information about available presets, configuration options, and additional plugins, check the [dai.js docs](https://github.com/makerdao/dai.js/wiki).\n\n___\n\nThe `Eth2DaiDirectService` normalizes the syntax across different types of trades, so the main functionality is represented simply by `sell` and `buy`. The difference between these two functions is the value defined explicitly as a parameter; for example, a user might want to `sell` one hundred Dai for however much ETH that Dai can buy.\n\n**The valid token symbols for either side of any trade are `'ETH'`, `'WETH'`, `'PETH'`, and `'DAI'`.**\n\n___\n\n* `sell` takes three parameters: the `sellToken` (string), the `buyToken` (string), and the `amount` (string or number)\n\n```js\nmaker.service('exchange').sell('ETH', 'DAI', '1');\n```\n\n* `buy` takes three parameters: the `buyToken` (string), the `sellToken` (string), and the `amount` (string or number)\n\n```js\nmaker.service('exchange').buy('DAI', 'ETH', 150);\n```\n\n____\n\nThe service can also query the OTC contract for the buy amount for a supplied pay amount and the pay amount for a supplied buy amount. If the price of the exchange deviates from this estimate by more than a configurable `slippage limit`, the trade will be reverted.\n\n___\n\n* `getBuyAmount` takes three parameters: `buyToken` (string), `sellToken` (string), and `sellAmount` (string or number)\n\n```js\nconst amount = await maker.service('exchange').getBuyAmount('DAI', 'ETH', 150);\n```\n\n* `getPayAmount` takes three paramaters: `sellToken` (string), `buyToken` (string), and `buyAmount` (string or number)\n\n```js\nconst amount = await maker.service('exchange').getPayAmount('ETH', 'DAI', '1');\n```\n\n* `setSlippageLimit` takes one parameter: `limit` (float). **The default slippage limit is 0.02, or 2%**.\n\n```js\nmaker.service('exchange').setSlippageLimit(0.05);\n```\n___\n\n### Development\n\n```\n$ git clone https://github.com/makerdao/dai-plugin-eth2dai-direct.git\n$ cd dai-plugin-eth2dai-direct/\n$ yarn\n$ git submodule update --init --recursive\n```\n\n* Run tests with `yarn test`\n* Run testnet with `yarn test:net`. This will run by default with `yarn test`, but can also run independently\n* Build for publication with `yarn build`\n\n[license]: https://img.shields.io/badge/license-MIT-blue.svg\n[license-url]: https://github.com/makerdao/dai-plugin-eth2dai-direct/blob/master/LICENSE\n[build]: https://travis-ci.com/makerdao/dai-plugin-eth2dai-direct.svg?branch=master\n[build-url]: https://travis-ci.com/makerdao/dai-plugin-eth2dai-direct\n[npm]: https://img.shields.io/npm/v/@makerdao/dai-plugin-eth2dai-direct.svg?style=flat\n[npm-url]: https://www.npmjs.com/package/@makerdao/dai-plugin-eth2dai-direct","readmeFilename":"README.md"}