raash-flash-loans
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

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

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 for an example.

Readme

Keywords

none

Package Sidebar

Install

npm i raash-flash-loans

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

130 kB

Total Files

31

Last publish

Collaborators

  • raashidjunaid1