{"_id":"@airdao/universal-router-sdk","_rev":"2-5ebaa24fa661a4acada1a4c21c164547","name":"@airdao/universal-router-sdk","description":"sdk for integrating with the Universal Router contracts","dist-tags":{"latest":"1.5.8-airdao.1"},"versions":{"1.9.0":{"name":"@airdao/universal-router-sdk","version":"1.9.0","author":{"name":"@Uniswap"},"_id":"@airdao/universal-router-sdk@1.9.0","maintainers":[{"name":"november-pain","email":"m.chikita@inc4.net"},{"name":"tech_airdao","email":"support@airdao.io"}],"homepage":"https://github.com/Uniswap/universal-router-sdk#readme","bugs":{"url":"https://github.com/Uniswap/universal-router-sdk/issues"},"dist":{"shasum":"f7af3a3e8cc341c7818d5ef8607a4961dcda5f9e","tarball":"https://registry.npmjs.org/@airdao/universal-router-sdk/-/universal-router-sdk-1.9.0.tgz","fileCount":51,"integrity":"sha512-I7Ol6WBJgpZuZ+s74d7OnAirKm895ojLmaTzkW5lIr42pQ0e8JaxUOfbxjkNKTDT04ylE0te1gtQNr3ShJEpBw==","signatures":[{"sig":"MEQCIAjm8xgJxfcrc/8B05lpEq1vajey141zm3shCb8REIH+AiAUfTLdmcGiFwDIB/tCCf96lLqn0Z5tA1fWuDFdjR+1ww==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":969467},"main":"dist/index.js","engines":{"node":">=14"},"scripts":{"docs":"typedoc","build":"tsdx build","lint:fix":"yarn prettier:fix && yarn forge:fix","prettier":"prettier --check '**/*.ts' && prettier --check '**/*.json'","test:all":"yarn test:hardhat && yarn test:forge","forge:fix":"forge fmt","install:ur":"cd node_modules/@uniswap/universal-router && forge install","test:forge":"forge test","prettier:fix":"prettier --write '**/*.ts' && prettier --write '**/*.json'","test:hardhat":"env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' hardhat test"},"typings":"dist/index.d.ts","_npmUser":{"name":"tech_airdao","email":"support@airdao.io"},"prettier":{"semi":false,"printWidth":120,"singleQuote":true,"trailingComma":"es5"},"repository":{"url":"git+https://github.com/Uniswap/universal-router-sdk.git","type":"git"},"description":"sdk for integrating with the Universal Router contracts","directories":{},"dependencies":{"ethers":"^5.3.1","bignumber.js":"^9.0.2","@uniswap/v2-sdk":"^4.3.0","@uniswap/v3-sdk":"^3.11.0","@uniswap/sdk-core":"^4.2.0","@uniswap/router-sdk":"^1.9.0","@uniswap/permit2-sdk":"^1.2.0","@uniswap/universal-router":"1.6.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","tsdx":"^0.14.1","tslib":"^2.3.0","dotenv":"^16.0.3","hardhat":"^2.6.8","ts-node":"^10.0.0","typedoc":"^0.21.2","prettier":"^2.3.1","typescript":"^4.3.3","@types/chai":"^4.2.18","@types/node":"^15.12.2","@types/mocha":"^8.2.2","@types/node-fetch":"^2.6.2","eslint-plugin-prettier":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/universal-router-sdk_1.9.0_1717093182218_0.7968587048241556","host":"s3://npm-registry-packages"}},"1.5.8-airdao.0":{"name":"@airdao/universal-router-sdk","version":"1.5.8-airdao.0","author":{"name":"@Uniswap"},"_id":"@airdao/universal-router-sdk@1.5.8-airdao.0","maintainers":[{"name":"november-pain","email":"m.chikita@inc4.net"},{"name":"tech_airdao","email":"support@airdao.io"}],"homepage":"https://github.com/Uniswap/universal-router-sdk#readme","bugs":{"url":"https://github.com/Uniswap/universal-router-sdk/issues"},"dist":{"shasum":"2f14438213dda7ce305443365a9325604c6b464a","tarball":"https://registry.npmjs.org/@airdao/universal-router-sdk/-/universal-router-sdk-1.5.8-airdao.0.tgz","fileCount":50,"integrity":"sha512-uU03fRVid541RtiwwD9ZTlr1kO2MY8zvApjY+3/AZCgUffRGvEJgkCNOEySU7AuAUMOx8F0XaY5IgGpP7IqhjA==","signatures":[{"sig":"MEQCICASkhJDaeWekuXC+v9XHrhNo85287dW+W9652J6bQGCAiBNfYJQXHsiSg5MvOA9A1ZgAAldDrxb+fgPfhF5QLkDzw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":914947},"main":"dist/index.js","engines":{"node":">=14"},"scripts":{"docs":"typedoc","build":"tsdx build","lint:fix":"yarn prettier:fix && yarn forge:fix","prettier":"prettier --check '**/*.ts' && prettier --check '**/*.json'","test:all":"yarn test:hardhat && yarn test:forge","forge:fix":"forge fmt","install:ur":"cd node_modules/@uniswap/universal-router && forge install","test:forge":"forge test","prettier:fix":"prettier --write '**/*.ts' && prettier --write '**/*.json'","test:hardhat":"env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' hardhat test"},"typings":"dist/index.d.ts","_npmUser":{"name":"tech_airdao","email":"support@airdao.io"},"prettier":{"semi":false,"printWidth":120,"singleQuote":true,"trailingComma":"es5"},"repository":{"url":"git+https://github.com/Uniswap/universal-router-sdk.git","type":"git"},"description":"sdk for integrating with the Universal Router contracts","directories":{},"dependencies":{"ethers":"^5.3.1","bignumber.js":"^9.0.2","@airdao/v2-sdk":"3.2.3-airdao.0","@airdao/v3-sdk":"3.10.0-airdao.0","@airdao/sdk-core":"4.0.7-airdao.0","@airdao/router-sdk":"1.6.0-airdao.0","@uniswap/permit2-sdk":"^1.2.0","@uniswap/universal-router":"1.4.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","tsdx":"^0.14.1","tslib":"^2.3.0","dotenv":"^16.0.3","hardhat":"^2.6.8","ts-node":"^10.0.0","typedoc":"^0.21.2","prettier":"^2.3.1","typescript":"^4.3.3","@types/chai":"^4.2.18","@types/node":"^15.12.2","@types/mocha":"^8.2.2","@types/node-fetch":"^2.6.2","eslint-plugin-prettier":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/universal-router-sdk_1.5.8-airdao.0_1717147676523_0.17610797569421788","host":"s3://npm-registry-packages"}},"1.5.8-airdao.1":{"name":"@airdao/universal-router-sdk","version":"1.5.8-airdao.1","description":"sdk for integrating with the Universal Router contracts","main":"dist/index.js","typings":"dist/index.d.ts","engines":{"node":">=14"},"publishConfig":{"access":"public"},"scripts":{"test:all":"yarn test:hardhat && yarn test:forge","test:hardhat":"env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' hardhat test","test:forge":"forge test","install:ur":"cd node_modules/@uniswap/universal-router && forge install","build":"tsdx build","prettier:fix":"prettier --write '**/*.ts' && prettier --write '**/*.json'","forge:fix":"forge fmt","lint:fix":"yarn prettier:fix && yarn forge:fix","prettier":"prettier --check '**/*.ts' && prettier --check '**/*.json'","docs":"typedoc"},"author":{"name":"@Uniswap"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"devDependencies":{"@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/node":"^15.12.2","@types/node-fetch":"^2.6.2","chai":"^4.3.4","dotenv":"^16.0.3","eslint-plugin-prettier":"^3.4.0","hardhat":"^2.6.8","prettier":"^2.3.1","ts-node":"^10.0.0","tsdx":"^0.14.1","tslib":"^2.3.0","typedoc":"^0.21.2","typescript":"^4.3.3"},"dependencies":{"@uniswap/permit2-sdk":"^1.2.0","@airdao/router-sdk":"1.6.0-airdao.1","@airdao/sdk-core":"4.0.7-airdao.0","@uniswap/universal-router":"1.4.3","@airdao/v2-sdk":"3.2.3-airdao.1","@airdao/v3-sdk":"3.10.0-airdao.0","bignumber.js":"^9.0.2","ethers":"^5.3.1"},"repository":{"type":"git","url":"git+https://github.com/Uniswap/universal-router-sdk.git"},"bugs":{"url":"https://github.com/Uniswap/universal-router-sdk/issues"},"homepage":"https://github.com/Uniswap/universal-router-sdk#readme","_id":"@airdao/universal-router-sdk@1.5.8-airdao.1","dist":{"shasum":"165c8a43e8fc1417b22178ac63b60e23301a1ee2","integrity":"sha512-nGNdx6xg5IrZwRP/w2ZCQQEMHcNWpLIMFaJlO+JQsyDAHMxhEgvH86wmML35gKnWTSJFOAmcLb+n0sUN9N3Pog==","tarball":"https://registry.npmjs.org/@airdao/universal-router-sdk/-/universal-router-sdk-1.5.8-airdao.1.tgz","fileCount":50,"unpackedSize":914959,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF6nv5cdXdKhVUMn/Qh5a4FGbFvZ0pTqqwLEHGX/PIktAiEAuG8yk5sb8y7QtN0/hljIEkcRa5Ai+uiX2G0Oa62701o="}]},"_npmUser":{"name":"tech_airdao","email":"support@airdao.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/universal-router-sdk_1.5.8-airdao.1_1718950170015_0.6656312481430986"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-30T18:19:42.124Z","modified":"2024-06-21T06:09:30.461Z","1.9.0":"2024-05-30T18:19:42.497Z","1.5.8-airdao.0":"2024-05-31T09:27:56.707Z","1.5.8-airdao.1":"2024-06-21T06:09:30.270Z"},"maintainers":[{"name":"november-pain","email":"m.chikita@inc4.net"},{"name":"tech_airdao","email":"support@airdao.io"}],"author":{"name":"@Uniswap"},"repository":{"type":"git","url":"git+https://github.com/Uniswap/universal-router-sdk.git"},"homepage":"https://github.com/Uniswap/universal-router-sdk#readme","bugs":{"url":"https://github.com/Uniswap/universal-router-sdk/issues"},"readme":"# universal-router-sdk\nThis SDK facilitates interactions with the contracts in [Universal Router](https://github.com/Uniswap/universal-router)\n\n## Usage\nInstall latest version of universal-router-sdk. Then import the corresponding Trade class and Data object for each protocol you'd like to interact with.\n\n### Trading NFTs\nwarning: `swapNFTCallParameters()` to be deprecated in favor of `swapCallParameters()`\n```typescript\nimport {\n  LooksRareTrade,\n  LooksRareData,\n  SeaportTrade,\n  SeaportData\n} from \"@uniswap/universal-router-sdk\";\n\n// Each protocol data object contains 1 call to that protocol. Some protocols can fit\n// many NFT purchase within 1 call, like seaport. Others require multiple calls per NFT (like LooksRare).\nconst looksRareTrades = new LooksRareTrade([looksrareData1, looksrareData2])\nconst seaportTrades = new SeaportTrade([seaportData1])\n\n// Use the raw calldata and value returned to call into Universal Swap Router contracts\n// Trades will happen in the order that they are handed in\nconst { calldata, value } = SwapRouter.swapCallParameters([looksRareTrades, seaportTrades])\n```\n\n### Trading ERC20s on Uniswap\nwarning: `swapERC20CallParameters()` to be deprecated in favor of `swapCallParameters()`\n```typescript\nimport { TradeType } from '@airdao/sdk-core'\nimport { Trade as V2TradeSDK } from '@airdao/v2-sdk'\nimport { Trade as V3TradeSDK } from '@airdao/v3-sdk'\nimport { MixedRouteTrade, MixedRouteSDK, Trade as RouterTrade } from '@airdao/router-sdk'\n\nconst options = { slippageTolerance, recipient }\nconst routerTrade = new UniswapTrade(\n  new RouterTrade({ v2Routes, v3Routes, mixedRoutes, tradeType: TradeType.EXACT_INPUT },\n  options\n)\n// Use the raw calldata and value returned to call into Universal Swap Router contracts\nconst { calldata, value } = SwapRouter.swapCallParameters(routerTrade)\n```\n\n### Using Uniswap for ERC20 NFT Trades\nSend ETH to the router by trading an ERC20 for ETH with a Uniswap Trade and encoding the swap recipient as `ROUTER_AS_RECIPIENT` in the trade. Then subsequently list the NFT trades to use the ETH output to buy NFTs. Trades happen in the order they are listed.\n\nUse `trade_type: TradeType.EXACT_OUTPUT` to cover the entire NFT price, alternatively the transaction will send supplemental ETH to fulfill the entire price if the swap does not cover it in full. Keep in mind that `TradeType.EXACT_INPUT` trades are subject to slippage on output, and ETH will be sent to cover potential slippage and any remaining ETH will be returned to sender.\n```typescript\nimport { TradeType } from '@airdao/sdk-core'\nimport { Trade as V2TradeSDK } from '@airdao/v2-sdk'\nimport { Trade as V3TradeSDK } from '@airdao/v3-sdk'\nimport { MixedRouteTrade, MixedRouteSDK, Trade as RouterTrade } from '@airdao/router-sdk'\nimport {\n  ROUTER_AS_RECIPIENT,\n  UniswapTrade,\n  LooksRareTrade,\n  LooksRareData,\n  SeaportTrade,\n  SeaportData\n} from \"@uniswap/universal-router-sdk\";\n\nconst looksRareTrades = new LooksRareTrade([looksrareData1, looksrareData2])\nconst seaportTrades = new SeaportTrade([seaportData1])\n// WARNING: never send funds to ROUTER_AS_RECIPIENT unless it is ETH that will be used in NFT trades, otherwise funds are lost.\nconst uniswapTrade = new UniswapTrade(\n  new RouterTrade({ v2Routes, v3Routes, mixedRoutes, tradeType: TradeType.EXACT_OUTPUT }),\n  { slippageTolerance, recipient:  ROUTER_AS_RECIPIENT}\n)\n// Use the raw calldata and value returned to call into Universal Swap Router contracts\nconst { calldata, value } = SwapRouter.swapCallParameters([uniswapTrade, seaportTrades, looksRareTrades])\n```\n\n### Using WETH for NFT Trades\nThe current router purchases all NFTs with ETH, but you can send WETH to the router to be unwrapped for ETH right before the NFT commands. Similar to ERC20 Uniswap Trades for NFTs, supplemental ETH will be sent in the transaction if the WETH amount will not cover the NFT buys. You can also use ERC20s and WETH to cover the transaction by including both commands before the NFT purchase.\n\n```typescript\nimport {\n  ROUTER_AS_RECIPIENT,\n  UniswapTrade,\n  LooksRareTrade,\n  LooksRareData,\n  SeaportTrade,\n  SeaportData\n} from \"@uniswap/universal-router-sdk\";\n\nconst looksRareTrades = new LooksRareTrade([looksrareData1, looksrareData2])\nconst seaportTrades = new SeaportTrade([seaportData1])\n// if no Permit needed, omit the third var of type Permit2Permit\nconst unwrapWETH = new UnwrapWETH(amountWETH, chainId, optionalPermit2Params)\n\n// Use the raw calldata and value returned to call into Universal Swap Router contracts\nconst { calldata, value } = SwapRouter.swapCallParameters([unwrapWETH, seaportTrades, looksRareTrades])\n```\n\n\n## Running this package\nMake sure you are running `node v16`\nInstall dependencies and run typescript unit tests\n```bash\nyarn install\nyarn test:hardhat\n```\n\nRun forge integration tests\n```bash\nyarn symlink # must install git submodules\nforge install\nyarn test:forge\n```\n","readmeFilename":"README.md"}