flash-swaps
v1.0.0
Published
Flash Swaps is a JavaScript package that provides functionalities for executing flash swaps on blockchain networks using Web3.
Downloads
1
Readme
Flash Swaps
Flash Swaps is a JavaScript package that provides functionalities for executing flash swaps on blockchain networks using Web3.
Installation
To install Flash Swaps, simply run:
npm install flash-swaps
Usage
const FlashSwaps = require('flash-swaps');
// Initialize Flash Swaps with provider URL
const flashSwaps = new FlashSwaps('YOUR_PROVIDER_URL');
// Execute flash swap
const tokenIn = 'TOKEN_ADDRESS';
const amountIn = 100;
const tokenOut = 'TOKEN_ADDRESS';
const amountOut = 200;
const recipient = 'RECIPIENT_ADDRESS';
flashSwaps.executeFlashSwap(tokenIn, amountIn, tokenOut, amountOut, recipient, (error, result) => {
if (error) {
console.error('Error executing flash swap:', error);
} else {
console.log('Flash swap executed successfully:', result);
}
});
API
FlashSwaps(providerUrl)
Constructor function for initializing the Flash Swaps instance with the specified Web3 provider URL.
executeFlashSwap(tokenIn, amountIn, tokenOut, amountOut, recipient, callback)
Method for executing a flash swap with the specified parameters. The callback
function is called with the result of the flash swap operation.
License
This project is licensed under the MIT License - see the LICENSE file for details.