# @xenon_so/flash-loan-sdk

> Package for creating xenon compatible solana flash loan instructions

Latest version **1.0.4** (published 2022-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xenon_so/flash-loan-sdk
pnpm add @xenon_so/flash-loan-sdk
yarn add @xenon_so/flash-loan-sdk
bun add @xenon_so/flash-loan-sdk
```

## 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.0.4 |
| Published | 2022-12-19 |
| First published | 2022-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 9 |
| Unpacked size | 108.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | devpsycho |

## Links

- npm: https://www.npmjs.com/package/@xenon_so/flash-loan-sdk
- Repository: https://github.com/xenon-so/flash-loan-sdk
- Homepage: https://github.com/xenon-so/flash-loan-sdk#readme
- Issues: https://github.com/xenon-so/flash-loan-sdk/issues
- npm.io page: https://npm.io/package/@xenon_so/flash-loan-sdk

## Dependencies (9)

- [bs58](https://npm.io/package/bs58.md) ^5.0.0
- [bn.js](https://npm.io/package/bn.js.md) ^5.2.1
- [dotenv](https://npm.io/package/dotenv.md) ^16.0.3
- [@types/bn.js](https://npm.io/package/@types/bn.js.md) ^5.1.1
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.1.1
- [buffer-layout](https://npm.io/package/buffer-layout.md) ^1.2.2
- [@solana/web3.js](https://npm.io/package/@solana/web3.js.md) ^1.69.0
- [@solana/spl-token](https://npm.io/package/@solana/spl-token.md) ^0.3.6
- [@project-serum/borsh](https://npm.io/package/@project-serum/borsh.md) ^0.2.5

## Recent versions

- 1.0.4 (latest) — 2022-12-19
- 1.0.3 — 2022-12-16
- 1.0.2 — 2022-12-16
- 1.0.1 — 2022-12-16

## README

# Flash-loans

Javascript/Typescript package for creating xenon compatible solana flash loan instructions

## Installation

### Yarn
```
yarn add @xenon/flash-loan
```
### npm
```
npm install @xenon/flash-loan
```

## Basic usage

```js
import { XenonFlashLoanClient } from '@xenon/flash-loan'

...
const xenonFlashLoanClient = new XenonFlashLoanClient(connection)

const transaction = new Transaction();

transaction.add(do_whatever_you_want_instruction)
transaction.add(repay_loan_instruction)

// this modifies your transaction and makes it xenon compatible
await client.initiateFlashLoan(fee, quantity, transaction mintAddress, owner);

sendTransaction(transaction)
```

## Bot usage
```js
import { Instructions } from '@xenon/flash-loan'

...

const transaction = new Transaction();
transaction.add(do_whatever_you_want_instruction)
transaction.add(repay_loan_instruction)

transaction.add(
    Instructions.makeLoanInstruction(
        flashPoolAddress,
        recieverTokenAccount,
        vaultAccount,
        quantity)
)

transaction.add(
    Instructions.makeGuardInstruction(flashPoolAddress, vaultAccount)
)

sendTransaction(transaction)
```

***Checkout [test-sdk.ts](https://github.com/xenon-so/flash-loan-sdk/blob/main/src/test-sdk.ts) for an example.***

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