# @liquigate/sdk

> liquigate sdk

Latest version **0.1.0** (published 2022-11-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install @liquigate/sdk
pnpm add @liquigate/sdk
yarn add @liquigate/sdk
bun add @liquigate/sdk
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2022-11-21 |
| First published | 2022-11-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 86.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | alonbl92456 |
| Maintainers | alonbl12 |

## Links

- npm: https://www.npmjs.com/package/@liquigate/sdk
- Repository: https://github.com/liquigate-finance/liquigate-sdk
- Homepage: https://github.com/liquigate-finance/liquigate-sdk#readme
- Issues: https://github.com/liquigate-finance/liquigate-sdk/issues
- npm.io page: https://npm.io/package/@liquigate/sdk

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^1.1.3
- [ethers](https://npm.io/package/ethers.md) ^5.6.2
- [ethereum-abi-types-generator](https://npm.io/package/ethereum-abi-types-generator.md) ^1.3.2

## Recent versions

- 0.1.0 (latest) — 2022-11-21

## README

# LiquigateSDK

LiquigateSDK is the official library for using liquigate product API

## Installation

Use the package manager [npm](https://pip.pypa.io/en/stable/) to install foobar.

```bash
npm install liquigate-sdk
```

## Usage

### Setup

#### Using ethers objects

```typescript
import { Liquigate } from 'liquigate-sdk';

const liquigate = new Liquigate(provider, wallet);
await liquigate.init();
```

#### Using rpc url and a private key

```typescript
import { Liquigate } from 'liquigate-sdk';

const PRIVATE_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX';
const NODE_URL = 'http://localhost:8545';

const liquigate = new Liquigate.fromKeyAndNode(PRIVATE_KEY, NODE_URL);
await liquigate.init();
```

### Get chain supported tokens

```typescript
const tokens = await liquigate.getSupportedTokens(1);
```

### Approve to liquigate contract

```typescript
const TOKEN_ADDRESS = 'XXXXXXXXXXXXXXXXXX';
const amount = 5.1; // Amount should be with no decimals conversion;
await liquigate.approveTokenSpending(TOKEN_ADDRESS, amount);
```

#### Create Trade

```typescript
const tokenList = await liquigate.getSupportedTokens(1);
const walletAddress = 'XXXXXXXXXXXXXXXXXXX';
const tokenList = await liquigate.getSupportedTokens(1);
const makerAmount = 5.1; // Amount should be with no decimals conversion;
const takerAmount = 2;
const makerToken = tokenList[0];
const takerToken = tokenList[1];
await liquigate.approveTokenSpending(makerToken.address, amount);
const order = new LimitOrder({
  address: walletAddress,
  chainId,
  maker: {
    asset: makerToken,
    amount: makerAmount,
  },
  taker: {
    asset: takerToken,
    amount: takerAmount,
  },
  expiry: Date.now() + 999999999,
});
await liquigate.swapTokens(order);
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

[MIT](https://choosealicense.com/licenses/mit/)

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