four-flap-meme-sdk
Version:
SDK for Flap bonding curve and four.meme TokenManager
17 lines (16 loc) • 617 B
JavaScript
const MESSAGES = {
GW: 'Amount precision is not aligned to GWEI',
ZA: "The 'to' address should not be address(0)",
TO: 'The to address should not be set to the PancakePair address',
Slippage: 'Slippage exceeded limit',
'More BNB': 'Insufficient BNB sent in msg.value',
FR: 'Fee rate exceeds 5%',
SO: 'Order amount is too small',
};
export function parseFourError(err) {
const raw = String(err?.message ?? err);
const found = Object.keys(MESSAGES).find((k) => raw.includes(k));
if (found)
return { code: found, message: MESSAGES[found] };
return { message: raw };
}