# niftyconnect-js

> The JavaScript SDK/Sample to interact with Niftyconnect contracts. It includes the following three methods.

Latest version **1.3.1** (published 2022-06-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install niftyconnect-js
pnpm add niftyconnect-js
yarn add niftyconnect-js
bun add niftyconnect-js
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2022-06-03 |
| First published | 2022-05-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 5 |
| Unpacked size | 705.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | redefiine628 |
| Maintainers | mintverse |

## Links

- npm: https://www.npmjs.com/package/niftyconnect-js
- npm.io page: https://npm.io/package/niftyconnect-js

## Dependencies (5)

- [ethers](https://npm.io/package/ethers.md) ^5.6.5
- [moment](https://npm.io/package/moment.md) ^2.29.3
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.0.2
- [secure-random](https://npm.io/package/secure-random.md) ^1.1.2
- [@types/secure-random](https://npm.io/package/@types/secure-random.md) ^1.1.0

## Recent versions

- 1.3.1 (latest) — 2022-06-03
- 1.3.0 — 2022-05-21
- 1.2.2 — 2022-05-12
- 1.2.1 — 2022-05-09
- 1.2.0 — 2022-05-09
- 1.1.3 — 2022-05-09
- 1.1.2 — 2022-05-06
- 1.1.1 — 2022-05-06
- 1.1.0 — 2022-05-06
- 1.0.0 — 2022-05-06

## README

The JavaScript SDK/Sample to interact
with Niftyconnect contracts. It includes the following three methods.

- **makeOrder** - Approve an order and optionally mark it for orderbook inclusion
- **cancelOrder** - Cancel an order, preventing it from being matched
- **takeOrder** - Atomically match two orders, ensuring validity of the match, and execute all associated state transitions
- **setRoyalty** - Set percentage-based royalty fee by collection owner

You can find more detailed documentation in our
[Documentation](https://github.com/NiftyConnect/document)
pages.

## Installation

```bash
$ npm i niftyconnect-js
# Or:
$ yarn add niftyconnect-js
```

### Getting Started

> It uses ethersjs and ethereum provider(provided by metamask) by default

Make fixed price order

```JavaScript
  import { makeOrder } from 'niftyconnect-js'
  import moment from 'moment'

  const params = {
    nftAddress: 'xxxx', //The asset's contract address
    paymentToken:'xxxx', //payment token contract address
    listPrice:2,//
    listTime:moment(),
    expireTime:moment('xxxx'),
    tokenId: 1111,
    amount: 1,
    chainId:1,
    side: 1, // sell=1, buy=0
    saleKind: 0, //FixedPrice=0, TimedAuction = 1
    tokenStandard: 1, // erc1155=1, erc721=0
    orderType: 'Normal', //'Normal' | 'Collection' | 'Trait'
  }

  const tx = await makeOrder(params)
```

## Contributing

Contributions to the Niftyconnect JavaScript SDK are welcome.

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