{"_id":"@0xkkkkkkkkkkkkkkk/uniswapx-sdk","name":"@0xkkkkkkkkkkkkkkk/uniswapx-sdk","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@0xkkkkkkkkkkkkkkk/uniswapx-sdk","version":"0.2.0","author":{"name":"Uniswap"},"repository":{"type":"git","url":"git+https://github.com/Uniswap/sdks.git"},"keywords":["uniswap","ethereum"],"license":"MIT","main":"dist/src/index.js","typings":"dist/src/index.d.ts","module":"dist/uniswapx-sdk.esm.js","engines":{"node":">=10"},"scripts":{"build":"yarn run typechain && tsc -p tsconfig.json","lint":"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix","prettier":"prettier \"src/**/*.ts\" --list-different","release":"semantic-release","test":"run-s build test:unit test:integration","test:unit":"jest --testPathPattern src --detectOpenHandles --forceExit --testPathIgnorePatterns dist","test:integration":"yarn build && cd integration && yarn && yarn test","typechain":"typechain --target=ethers-v5 --out-dir src/contracts --glob ./abis/**/*.json"},"dependencies":{"@ethersproject/bytes":"^5.7.0","@ethersproject/providers":"^5.7.0","@uniswap/permit2-sdk":"^1.2.1","@uniswap/sdk-core":"^5.0.0","ethers":"^5.7.0"},"devDependencies":{"@typechain/ethers-v5":"^10.1.0","@types/jest":"^24.0.25","@types/node":"^18.7.16","@typescript-eslint/eslint-plugin":"^5.62","@typescript-eslint/parser":"^5.62","eslint":"^7.8.0","eslint-config-prettier":"^6.11.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-functional":"^3.0.2","eslint-plugin-import":"^2.22.0","husky":"^8.0.3","jest":"25.5.0","jest-environment-node":"25.5.0","npm-run-all":"^4.1.5","prettier":"^2.4.1","ts-jest":"25.5.0","ts-node":"^10.9.1","typechain":"^8.1.0","typescript":"^4.3.3"},"husky":{"hooks":{"pre-commit":"yarn fix"}},"publishConfig":{"access":"public"},"release":{"extends":"semantic-release-monorepo","branches":[{"name":"still-in-alpha","prerelease":false},{"name":"beta","prerelease":true}],"plugins":[["@semantic-release/commit-analyzer",{"preset":"angular","releaseRules":"../../publishing/release-rules.cjs"}],"@semantic-release/release-notes-generator","@semantic-release/npm","@semantic-release/github",["@semantic-release/exec",{"successCmd":"git restore yarn.lock && yarn","failCmd":"git restore yarn.lock && yarn","execCwd":"../.."}]]},"_id":"@0xkkkkkkkkkkkkkkk/uniswapx-sdk@0.2.0","gitHead":"0ccd749684a13ec9e72db680609c9e8c694ac117","description":"SDK for the UniswapX protocol","bugs":{"url":"https://github.com/Uniswap/sdks/issues"},"homepage":"https://github.com/Uniswap/sdks#readme","_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-wLiv6dtM3i01q5I4V/XpKxUaKfrw9lWaD2afIadEQdtDDXCtLDKohoUKR6NAZs/tq0N9g0s9c6z+yW+N2KrAtA==","shasum":"7f8558b2bc543e8c9d43e876329d4bd102b92aa7","tarball":"https://registry.npmjs.org/@0xkkkkkkkkkkkkkkk/uniswapx-sdk/-/uniswapx-sdk-0.2.0.tgz","fileCount":3,"unpackedSize":6670,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD6RsPhZDFu89J8ger6zsRiRaZ60utn8j5tZwi5wfGSKAIgDPgUOIEf1/lKI9VXVhU45TgumbnfhmRzTxczmgTLGsI="}]},"_npmUser":{"name":"akiluya","email":"lucytump@dtx.trade"},"directories":{},"maintainers":[{"name":"akiluya","email":"lucytump@dtx.trade"},{"name":"defi_club","email":"kei@dtx.trade"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uniswapx-sdk_0.2.0_1718248296669_0.08467516212039672"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-13T03:11:36.587Z","0.2.0":"2024-06-13T03:11:36.809Z","modified":"2024-06-13T03:11:37.090Z"},"maintainers":[{"name":"akiluya","email":"lucytump@dtx.trade"},{"name":"defi_club","email":"kei@dtx.trade"}],"description":"SDK for the UniswapX protocol","homepage":"https://github.com/Uniswap/sdks#readme","keywords":["uniswap","ethereum"],"repository":{"type":"git","url":"git+https://github.com/Uniswap/sdks.git"},"author":{"name":"Uniswap"},"bugs":{"url":"https://github.com/Uniswap/sdks/issues"},"license":"MIT","readme":"# uniswapx-sdk\n\nSDK for the UniswapX protocol\n\n## Usage\n\nThe SDK contains bindings for two main flows: parsing serialized orders & building new orders.\n\n### Building & Signing Orders\n\n```ts\nimport { DutchOrder, NonceManager } from '@uniswap/uniswapx-sdk';\nimport { ethers } from 'ethers';\n\nconst provider = new ethers.providers.JsonRpcProvider(RPC_URL);\nconst account = await provider.getSigner().getAddress(); \nconst nonceMgr = new NonceManager(provider, 1); \nconst nonce = await nonceMgr.useNonce(account); \n\nconst chainId = 1;\nconst builder = new DutchOrderBuilder(chainId);\nconst order = builder\n  .deadline(deadline)\n  .decayEndTime(deadline)\n  .decayStartTime(deadline - 100)\n  .nonce(nonce)\n  .input({\n    token: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n    amount: BigNumber.from('1000000'),\n  })\n  .output({\n    token: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n    startAmount: BigNumber.from('1000000000000000000'),\n    endAmount: BigNumber.from('900000000000000000'),\n    recipient: '0x0000000000000000000000000000000000000000',\n  })\n  .build();\n \n// Sign the built order \nconst { domain, types, values } = order.permitData();\nconst signature = wallet._signTypedData(domain, types, values);\n\nconst serializedOrder = order.serialize();\n// submit serializedOrder and signature to order pool\n```\n\n### Parsing Orders\n```ts\nimport { DutchOrder, Order } from '@uniswap/uniswapx-sdk';\n\nconst serializedOrder = '0x1111222233334444555500000000234300234...';\nconst chainId = 1; \n\nconst order: Order = DutchOrder.parse(serializedOrder, chainId);\n\nconst orderData = order.info;\nconst orderHash = order.hash();\n```\n### Validating Orders \n```ts\nimport { ethers } from 'ethers';\nimport { OrderValidator } from 'uniswapx-sdk';\n\nconst provider = new ethers.providers.JsonRpcProvider(RPC_URL);\nconst validator = new OrderValidator(provider, CHAIN_ID); \nconst orders: SignedOrder[] = [\n  {\n    order: order1, \n    signature: signature1\n  }, \n  {\n    order: order2, \n    signature: signature2\n  }\n]; \n\ntry {\n  const statusList: OrderValidation[] = await validator.validateBatch(orders); \n  // Do something with list of statuses \n}\ncatch(e) {\n  // Handle error\n}\n\n```\n\n### Order Object\n\n**serialize()**\n\nReturns an abi-encoded serialization of the order. This serialized format is passed into the corresponding reactor contract for execution.\n\n\n**getSigner(signature)**\n\nRecovers the address which created the given signature over the order. Used to determine the order maker.\n\n\n**permitData()**\n\nReturns the domain, types, and values used to generate an EIP-712 signature over the order. Note that this signature both approves the release of the order's input tokens _and_ the execution of the order itself.\n\n\n**hash()**\n\nReturns the order hash. This is used as a key to track order fulfillment on-chain. It may also be useful as a unique order identifier for off-chain purposes.\n\n","readmeFilename":"README.md"}