celoswap-mini-sdk
v0.1.1
Published
Standalone SDK for integrating swaps, quotes, token metadata, and MiniPay flows from CeloSwap Mini.
Maintainers
Readme
CeloSwap Mini SDK
Standalone SDK derived from the celoswap-mini app for working with the CeloSwap contract, token lists, quote math, and MiniPay swap requests.
Install
npm install celoswap-mini-sdk viemUse
import {
CONTRACT_ABI,
DEFAULT_MINIPAY_FEE_CURRENCY,
buildMiniPaySwapTransaction,
buildSwapQuoteFromNet,
createCeloSwapConfig,
tokenList,
} from 'celoswap-mini-sdk';
const config = createCeloSwapConfig({
contractAddress: '0x1234567890123456789012345678901234567890',
});
const quote = buildSwapQuoteFromNet(1_500_000_000_000_000_000n, {
slippageBps: 75,
});
const tx = buildMiniPaySwapTransaction({
from: '0x1111111111111111111111111111111111111111',
contractAddress: config.contractAddress,
tokenIn: tokenList[0].address,
tokenOut: tokenList[1].address,
amountIn: 1_000_000_000_000_000_000n,
minAmountOut: quote.minimumReceived,
feeCurrency: DEFAULT_MINIPAY_FEE_CURRENCY,
});
console.log(CONTRACT_ABI.length);
console.log(tx.feeCurrency);Local Build
npm install
npm test
npm run build