{"_id":"@ape.swap/zap-tx-builder","_rev":"11-f3cea6f66af252698381007b98a88c01","name":"@ape.swap/zap-tx-builder","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@ape.swap/zap-tx-builder","version":"0.0.1","author":{"name":"Doublo"},"license":"ISC","_id":"@ape.swap/zap-tx-builder@0.0.1","maintainers":[{"name":"apefede","email":"apefede09@gmail.com"},{"name":"efedaniels","email":"dev.efedaniels@gmail.com"},{"name":"nombrealeatorio","email":"n0mbr3al3at0r10@gmail.com"},{"name":"doublo54","email":"doublo54@gmail.com"},{"name":"defifofum","email":"DeFiFoFum0@gmail.com"},{"name":"ixm-759","email":"759ixm@gmail.com"},{"name":"obiedobo","email":"obiedobo@gmail.com"}],"homepage":"https://github.com/ApeSwapFinance/zap-tx-builder#readme","bugs":{"url":"https://github.com/ApeSwapFinance/zap-tx-builder/issues"},"dist":{"shasum":"1b41f519c3e8bdb8f94808c347bb7bda572bb409","tarball":"https://registry.npmjs.org/@ape.swap/zap-tx-builder/-/zap-tx-builder-0.0.1.tgz","fileCount":38,"integrity":"sha512-D576QAc9dzoqrY73UDPVRa31F1VcjzslivRc/6K8WrdCMbUJNmoGrIW6aReCneSrfZEeubIQwPt2SUN0Tcd+Qw==","signatures":[{"sig":"MEQCIEILkSM2U1tzVw0E907gcGzaVT8fVI0bxrTqoFleJeatAiB49Awvs6//NfthXnqeh0wV9J9iTPWuVR8l2ra1RnQ0hA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":329399},"main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"tsc && mocha 'test/**/*.ts'","build":"tsc"},"_npmUser":{"name":"doublo54","email":"doublo54@gmail.com"},"repository":{"url":"git+https://github.com/ApeSwapFinance/zap-tx-builder.git","type":"git"},"description":"Zap Tx Builder is a utility tool that helps in creating encoded data for zap.","directories":{},"dependencies":{"chai":"^4.3.7","axios":"^1.4.0","ethers":"5.7.2","@types/chai":"^4.3.5","@types/mocha":"^10.0.1","@ethersproject/contracts":"^5.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.2.0","ts-node":"^10.9.1","typescript":"^5.1.3","@types/node":"^20.2.5"},"_npmOperationalInternal":{"tmp":"tmp/zap-tx-builder_0.0.1_1687252190282_0.25635041086905574","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@ape.swap/zap-tx-builder","version":"0.0.2","author":{"name":"Doublo"},"license":"ISC","_id":"@ape.swap/zap-tx-builder@0.0.2","maintainers":[{"name":"apefede","email":"apefede09@gmail.com"},{"name":"efedaniels","email":"dev.efedaniels@gmail.com"},{"name":"nombrealeatorio","email":"n0mbr3al3at0r10@gmail.com"},{"name":"doublo54","email":"doublo54@gmail.com"},{"name":"defifofum","email":"DeFiFoFum0@gmail.com"},{"name":"ixm-759","email":"759ixm@gmail.com"},{"name":"obiedobo","email":"obiedobo@gmail.com"}],"homepage":"https://github.com/ApeSwapFinance/zap-tx-builder#readme","bugs":{"url":"https://github.com/ApeSwapFinance/zap-tx-builder/issues"},"dist":{"shasum":"e0314aa00f3a3e572aad5326cb329e7a9d1764f3","tarball":"https://registry.npmjs.org/@ape.swap/zap-tx-builder/-/zap-tx-builder-0.0.2.tgz","fileCount":38,"integrity":"sha512-IQLS77BdZkDKN2UVYhq+kD6L1vvZcCHk0nm5IyNOKsUbVIPcMg8NkU67jeEe4FeWN7fYykSFf7yYDrYTznY5fw==","signatures":[{"sig":"MEUCIQDP+yiFbS/7fFsqkS2btGrMGKAt3iKQLSDlMb4iKa4rfAIgG8CfL8a7zTdXepYW71C59aypJQWNhIooyZHXzxFasfU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":328595},"main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"tsc && mocha 'test/**/*.ts'","build":"tsc"},"_npmUser":{"name":"doublo54","email":"doublo54@gmail.com"},"repository":{"url":"git+https://github.com/ApeSwapFinance/zap-tx-builder.git","type":"git"},"description":"Zap Tx Builder is a utility tool that helps in creating encoded data for zap.","directories":{},"dependencies":{"chai":"^4.3.7","axios":"^1.4.0","ethers":"5.7.2","@types/chai":"^4.3.5","@types/mocha":"^10.0.1","@ethersproject/contracts":"^5.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.2.0","ts-node":"^10.9.1","typescript":"^5.1.3","@types/node":"^20.2.5"},"_npmOperationalInternal":{"tmp":"tmp/zap-tx-builder_0.0.2_1687252728162_0.03345091400172295","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-06-20T09:09:50.206Z","modified":"2025-02-07T18:33:36.724Z","0.0.1":"2023-06-20T09:09:50.458Z","0.0.2":"2023-06-20T09:18:48.317Z"},"bugs":{"url":"https://github.com/ApeSwapFinance/zap-tx-builder/issues"},"author":{"name":"Doublo"},"license":"ISC","homepage":"https://github.com/ApeSwapFinance/zap-tx-builder#readme","repository":{"url":"git+https://github.com/ApeSwapFinance/zap-tx-builder.git","type":"git"},"description":"Zap Tx Builder is a utility tool that helps in creating encoded data for zap.","maintainers":[{"email":"dev.efedaniels@gmail.com","name":"efedaniels"},{"email":"apefede09@gmail.com","name":"apefede"},{"email":"hello@apeguru.dev","name":"apeguru"},{"email":"DeFiFoFum0@gmail.com","name":"defifofum"},{"email":"n0mbr3al3at0r10@gmail.com","name":"nombrealeatorio"},{"email":"pathakshivam983@gmail.com","name":"shivammp"},{"email":"doublo54@gmail.com","name":"doublo54"},{"email":"759ixm@gmail.com","name":"ixm-759"}],"readme":"# Zap Tx Builder\n\nZap Tx Builder is a utility tool that helps in creating encoded data for zap.\n\n## Contracts\n\nZap Contracts:\nhttps://github.com/ApeSwapFinance/apeswap-hardhat-zap\n\nRouter Contracts:\nhttps://github.com/ApeSwapFinance/swap-router-contracts\n\n## Usage\n\n```\nnpm i @ape.swap/zapTxBuilder\n\nyarn add @ape.swap/zapTxBuilder\n```\n\n### **ZapBuilderFrom0xPath**\n\n**!! CHECK `test/zapTxBuilder.spec.tx` FOR MORE EXAMPLES !!**\n\nExample zapping WMATIC to ApeV2 BANANA-BUSD LP\n\nWith swap routing best path found by 0x API (https://0x.org/docs/0x-swap-api/api-references/overview)\n\n```typescript\nimport { ZapBuilderFrom0xPath } from \"@ape.swap/zapTxBuilder\";\n\nconst provider: providers.Provider = new providers.JsonRpcProvider(\n  \"https://polygon.llamarpc.com\"\n);\n\nconst zapBuilder = new ZapBuilderFrom0xPath(provider, 137);\nconst zapLP = await zapBuilder.toLP(\n  WMATIC, //InputToken\n  AMOUNT, //Amount tof inputToken to zap\n  BANANA, //First token of LP\n  BUSD, //Second token of LP\n  APEV2, //LP router/factory\n  ADDRESS_THIS //Recipient (default: MSG_SENDER)\n);\nreturn zapLP.populatedTx; //Encoded data to zap into LP\n```\n\n### **ZapBuilder**\n\n**!! CHECK `test/zapTxBuilder.spec.tx` FOR MORE EXAMPLES !!**\n\nExample zapping WMATIC to ApeV2 BANANA-BUSD LP\n\nWith swap routing:\n\n- WMATIC --UniV3--> ETH --ApeV2--> BANANA\n- WMATIC --PcsV2--> BUSD\n\n```typescript\nimport { ZapBuilder } from \"@ape.swap/zapTxBuilder\";\n\nconst provider: providers.Provider = new providers.JsonRpcProvider(\n  \"https://polygon.llamarpc.com\"\n);\n\nconst swapPath00: Path = {\n  swapRouter: UNIV3Factory,\n  swapType: SwapType.V3,\n  path: [WMATIC, ETH],\n  uniV3PoolFees: [500],\n};\n\nconst swapPath01: Path = {\n  swapRouter: APEV2Router,\n  swapType: SwapType.V2,\n  path: [ETH, BANANA],\n  uniV3PoolFees: [],\n};\n\nconst swapPath10: Path = {\n  swapRouter: PCSV2Router,\n  swapType: SwapType.V2,\n  path: [WMATIC, BUSD],\n  uniV3PoolFees: [],\n};\n\nconst liquidityPath: LiquidityPath = {\n  lpRouter: APEV2Router,\n  liquidityType: LPType.V2,\n  tickLower: 0,\n  tickUpper: 0,\n  uniV3PoolLPFee: 0,\n  arrakisFactory: ZERO_ADDRESS,\n};\n\nconst swapReturnsParams: SwapReturnsParams = {\n  inputAmount: ether(\"0.01\").toString(),\n  path0: [swapPath00, swapPath01],\n  path1: [swapPath1],\n  liquidityPath: liquidityPath,\n};\n\nconst zapBuilder = new ZapBuilder(provider, 137);\nconst zapLP = await zapBuilder.toLPFromPath(swapReturnsParams);\nreturn zapLP.populatedTx; //Encoded data to zap into LP\n```\n\n### **Extra extensions**\n\n```typescript\nconst zapBill = await zapLP.toBill({\n  bill: USDCWOMBATBOND,\n  inputAmount: 0,\n  maxPrice: \"23382705930\",\n  recipient: \"0x5c7C7246bD8a18DF5f6Ee422f9F8CCDF716A6aD2\",\n});\nreturn zapBill.populatedTx; //Encoded data to zap into Bill\n\nconst zapPool = await zapLP.toPool({\n  inputAmount: 0,\n  pool: \"0xA3c3A929Ae19Bfc56E2A9B0f23e99bae8Bf6F11A\",\n  recipient: MSG_SENDER,\n});\nreturn zapPool.populatedTx; //Encoded data to zap into Pool\n\nconst zapVault = await zapLP.toVault({\n  inputAmount: 0,\n  maximizerVaultApe: KEEPER_MAXIMIZER_VAULT_APE,\n  vaultPid: 0,\n  recipient: MSG_SENDER,\n});\nreturn zapVault.populatedTx; //Encoded data to zap into Vault\n\nconst zapMiniApe = await zapLP.toMiniApe({\n  inputAmount: 0,\n  miniApe: MINI_APE_V2,\n  pid: 0,\n  recipient: MSG_SENDER,\n});\nreturn zapMiniApe.populatedTx; //Encoded data to zap into Mini Ape\n```\n","readmeFilename":"README.md"}