
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Alex-SDK is an easy-to-use library that exposes the swap functionality from [alexlab.co](https://app.alexlab.co/swap) to be integrated into any app or wallet. It enables users to perform swaps with a wide variety of supported currencies.
Alex-SDK is an easy-to-use library that exposes the swap functionality from alexlab.co to be integrated into any app or wallet. It enables users to perform swaps with a wide variety of supported currencies.
You can install Alex-SDK using npm:
npm install alex-sdk
For detailed API documentation, including a full list of available methods and their usage, please refer to:
import { AlexSDK, Currency } from 'alex-sdk';
const alex = new AlexSDK();
(async () => {
// Get swap fee between STX and ALEX
const feeRate = await alex.getFeeRate(Currency.STX, Currency.ALEX);
console.log('Swap fee:', feeRate);
// Get the router path for swapping STX to ALEX
const router = await alex.getRoute(Currency.STX, Currency.ALEX);
console.log('Router path:', router);
// Get the amount of USDA that will be received when swapping 100 ALEX
const amountTo = await alex.getAmountTo(
Currency.STX,
BigInt(100 * 1e8), // all decimals are multiplied by 1e8
Currency.ALEX
);
console.log('Amount to receive:', Number(amountTo) / 1e8);
// To get the transaction to broadcast
const tx = await alex.runSwap(
stxAddress,
Currency.STX,
Currency.ALEX,
BigInt(Number(amount) * 1e8),
BigInt(0)
);
// Then broadcast the transaction yourself
await openContractCall(tx);
// Get the latest prices for all supported currencies
const latestPrices = await alex.getLatestPrices();
console.log('Latest prices:', latestPrices);
// Get balances for a specific STX address
const stxAddress = 'SM2MARAVW6BEJCD13YV2RHGYHQWT7TDDNMNRB1MVT';
const balances = await alex.getBalances(stxAddress);
console.log('Balances:', balances);
// Fetch information about all swappable currencies
const swappableCurrencies = await alex.fetchSwappableCurrency();
console.log('Swappable currencies:', swappableCurrencies);
// Get all possible routes for swapping currencies
const allRoutes = await alex.getAllPossibleRoutes(Currency.STX, Currency.ALEX);
console.log('All possible routes:', allRoutes);
// Get way points
const someRoute: AMMRoute = [x1, x2];
const wayPoints = await sdk.getWayPoints(someRoute);
console.log('Way points for the route:', wayPoints);
})();
There is a fully working example in the alex-sdk-example.
Contributions to the project are welcome. Please fork the repository, make your changes, and submit a pull request. Ensure your changes follow the code style and conventions used.
FAQs
Alex-SDK is an easy-to-use library that exposes the swap functionality from [alexlab.co](https://app.alexlab.co/swap) to be integrated into any app or wallet. It enables users to perform swaps with a wide variety of supported currencies.
The npm package alex-sdk receives a total of 354 weekly downloads. As such, alex-sdk popularity was classified as not popular.
We found that alex-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.