# defizapjs

> API for interacting with DeFiZap smart contracts

Latest version **1.3.0** (published 2019-12-13) · LGPLV2.1 license · 0 weekly downloads

## Install

```sh
npm install defizapjs
pnpm add defizapjs
yarn add defizapjs
bun add defizapjs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2019-12-13 |
| First published | 2019-12-03 |
| Weekly downloads | 0 |
| License | LGPLV2.1 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 95.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | suhailgme |

## Links

- npm: https://www.npmjs.com/package/defizapjs
- Repository: https://github.com/DeFiStrategies/defizapJS_API
- npm.io page: https://npm.io/package/defizapjs

## Dependencies (2)

- [ethers](https://npm.io/package/ethers.md) ^4.0.40
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0

## Recent versions

- 1.3.0 (latest) — 2019-12-13
- 1.2.0 — 2019-12-07
- 1.1.0 — 2019-12-06
- 1.0.0 — 2019-12-03

## README

# DefiZap.js

**DefiZap.js** is a JavaScript library that allows easy access to [DefiZap's](https://defizap.com//) smart contracts. This library can be used to directly interact with all of the Zaps available on DefiZap's platform.

## Usage
Use npm or yarn to install the library:
```
npm i defizapjs
// or:
yarn add defizapjs
```
Include it in your app:
```
import DefiZap from 'defizapjs'
// or:
const DefiZap = require('defizapjs')
```

Example of using the Lender contract in browser (React):
```
import React, { Component } from 'React'
import DefiZap from 'defizapjs'

class LenderZap extends Component {

  componentDidMount() {
    (if window.ethereum)
    window.ethereum.enable() // Ask user permission to access metamask
    const defiZap = new DefiZap(window.web3)
    const lenderZap = defiZap.zap('Lender')
  }
  
  // !!! Initiates the sending of Ether !!!
  Zap = async (valueToSend) => {
    const gasPrice = await defiZap.getGasPrice() // Return an object containing fast, average, slow, gas prices in gwei
    let tx = await lender.invest(valueToSend, gasPrice.high) // gasPrice argument is optional
    console.log(tx)
  }
}
```

Example of using DefiZap in NodeJS
```
const DefiZap = require('defizapjs')

(async () => {
  const defiZap = new DefiZap() // No argument uses default infura/etherscan provider for read-only access
  const lenderZap = defiZap.zap('Lender')
  const lenderAddress = lenderZap.address
  console.log(lenderAddress)
})()
```

### Supported Zaps
* [Lender Zap](https://defizap.com/zaps/lender)
* [Eth Maximalist Zap](https://defizap.com/zaps/ETHMaximalist)
* [Moderate Bull Zap](https://defizap.com/zaps/moderatebull)
* [Double Bull Zap](https://defizap.com/zaps/doublebull)
* [Super Saver Zap](https://defizap.com/zaps/supersaver)

Instantiating supported zaps:
```
const lenderZap = defiZap.zap('Lender')
const ethMaximalistZap = defiZap.zap('EthMaximalist')
const moderateBullZap = defiZap.zap('ModerateBull')
const doubleBullZap = defiZap.zap('DoubleBull')
const superSaverZap = defiZap.zap('SuperSaver')
```

Sending Ether to the Zaps:
```
/*
.useFallback(string:valueInEtherToSend)
Returns a promise with the transaction details (object)
*/ 

const tx = await doubleBullZap.useFallback(valueToSend) 
```

---
_Source: https://npm.io/package/defizapjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
