UNPKG

pumpdotfun-sdk-repumped

Version:

Pumpfun SDK — create, buy, sell tokens with support for Jito bundles and multiple relayer integrations. Rebuilt and fixed pumpdotfun-sdk.

1 lines 934 B
{"version":3,"file":"slippage.mjs","sources":["../../../src/slippage.ts"],"sourcesContent":["export const calculateWithSlippageBuy = (\r\n amount: bigint,\r\n basisPoints: bigint\r\n) => {\r\n return amount + (amount * basisPoints) / 10000n;\r\n};\r\n\r\nexport function calculateWithSlippageSell(\r\n amount: bigint,\r\n slippageBasisPoints: bigint = 500n\r\n): bigint {\r\n // Actually use the slippage basis points for calculation\r\n const reduction = Math.max(\r\n 1,\r\n Number((amount * slippageBasisPoints) / 10000n)\r\n );\r\n return amount - BigInt(reduction);\r\n}\r\n"],"names":[],"mappings":"MAAa,wBAAwB,GAAG,CACtC,MAAc,EACd,WAAmB,KACjB;IACF,OAAO,MAAM,GAAG,CAAC,MAAM,GAAG,WAAW,IAAI,MAAM;AACjD;SAEgB,yBAAyB,CACvC,MAAc,EACd,sBAA8B,IAAI,EAAA;;AAGlC,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CACxB,CAAC,EACD,MAAM,CAAC,CAAC,MAAM,GAAG,mBAAmB,IAAI,MAAM,CAAC,CAChD;AACD,IAAA,OAAO,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;AACnC;;;;"}