{"_id":"@deliquifiedlabs/uniswapx-sdk","_rev":"1-0a584407a199a596fc23c9872be40b6b","name":"@deliquifiedlabs/uniswapx-sdk","description":"SDK for the UniswapX protocol","dist-tags":{"latest":"5.1.5"},"versions":{"5.1.4":{"name":"@deliquifiedlabs/uniswapx-sdk","version":"5.1.4","keywords":["zia","lukso"],"author":{"name":"Uniswap"},"license":"MIT","_id":"@deliquifiedlabs/uniswapx-sdk@5.1.4","maintainers":[{"name":"deliquified","email":"deliquifiedlabs@outlook.com"}],"homepage":"https://github.com/Deliquified/sdks#readme","bugs":{"url":"https://github.com/Deliquified/sdks/issues"},"dist":{"shasum":"e91b23769577a5e600d35c37ef73175db0c35058","tarball":"https://registry.npmjs.org/@deliquifiedlabs/uniswapx-sdk/-/uniswapx-sdk-5.1.4.tgz","fileCount":3,"integrity":"sha512-mNZUfWjww98/gavEjuP7+PGuJrVOdBuhxsXKsljqC6n3WlI4TG8MQxO54mDvEdbYDA/9mk5TNnL65+vzAF8FZA==","signatures":[{"sig":"MEQCIGO58myKxSyc72/Vf5XXHCF/IsFXlTBZsaMyWqNUbB4/AiAeRSnYzW8+kVaWfuKMZa8mfnuWKDGZd3FeV/j1kJWVxg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6899},"main":"dist/src/index.js","husky":{"hooks":{"pre-commit":"yarn fix"}},"module":"dist/uniswapx-sdk.esm.js","engines":{"node":">=10"},"gitHead":"a7aa9dc89935610375c3e543e6befba43328dc94","release":{"extends":"semantic-release-monorepo","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",{"execCwd":"../..","failCmd":"git restore yarn.lock && yarn","successCmd":"git restore yarn.lock && yarn"}]],"branches":[{"name":"still-in-alpha","prerelease":false},{"name":"beta","prerelease":true}]},"scripts":{"lint":"eslint src --ext .ts","test":"run-s build test:unit test:integration","build":"yarn run typechain && tsc -p tsconfig.json","release":"semantic-release","lint:fix":"eslint src --ext .ts --fix","prettier":"prettier \"src/**/*.ts\" --list-different","test:unit":"jest --testPathPattern src --detectOpenHandles --forceExit --testPathIgnorePatterns dist","typechain":"typechain --target=ethers-v5 --out-dir src/contracts --glob ./abis/**/*.json","test:integration":"yarn build && cd integration && yarn && yarn test"},"typings":"dist/src/index.d.ts","_npmUser":{"name":"deliquified","email":"deliquifiedlabs@outlook.com"},"repository":{"url":"git+https://github.com/Deliquified/sdks.git","type":"git"},"_npmVersion":"10.8.1","description":"SDK for the UniswapX protocol","directories":{},"_nodeVersion":"22.3.0","dependencies":{"ethers":"^5.7.0","@ethersproject/bytes":"^5.7.0","@uniswap/permit2-sdk":"^1.2.1","@ethersproject/providers":"^5.7.0","@deliquifiedlabs/sdk-core":"4.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"25.5.0","husky":"^8.0.3","eslint":"^7.8.0","ts-jest":"25.5.0","ts-node":"^10.9.1","prettier":"^2.4.1","typechain":"^8.1.0","typescript":"^4.3.3","@types/jest":"^24.0.25","@types/node":"^18.7.16","npm-run-all":"^4.1.5","@typechain/ethers-v5":"^10.1.0","eslint-plugin-import":"^2.22.0","jest-environment-node":"25.5.0","eslint-config-prettier":"^6.11.0","eslint-plugin-functional":"^3.0.2","@typescript-eslint/parser":"^5.62","eslint-plugin-eslint-comments":"^3.2.0","@typescript-eslint/eslint-plugin":"^5.62"},"_npmOperationalInternal":{"tmp":"tmp/uniswapx-sdk_5.1.4_1718297748860_0.6714104423807101","host":"s3://npm-registry-packages"}},"5.1.5":{"name":"@deliquifiedlabs/uniswapx-sdk","version":"5.1.5","author":{"name":"Uniswap"},"repository":{"type":"git","url":"git+https://github.com/Deliquified/sdks.git"},"keywords":["zia","lukso"],"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":{"@deliquifiedlabs/sdk-core":"4.2.1","@ethersproject/bytes":"^5.7.0","@ethersproject/providers":"^5.7.0","@uniswap/permit2-sdk":"^1.2.1","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":"@deliquifiedlabs/uniswapx-sdk@5.1.5","gitHead":"a7aa9dc89935610375c3e543e6befba43328dc94","description":"SDK for the UniswapX protocol","bugs":{"url":"https://github.com/Deliquified/sdks/issues"},"homepage":"https://github.com/Deliquified/sdks#readme","_nodeVersion":"22.3.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-lHUwqNIPW99p7MhiBKUeK4X86c+bMQjqEnsw6t1l+fKTQuLQNJWGyvHJ6GcCLvRwn7TXJ1dhUx+Qp8VLEEhc3A==","shasum":"9e62ac0fd977b1333503fa1f3aab38f7966f1018","tarball":"https://registry.npmjs.org/@deliquifiedlabs/uniswapx-sdk/-/uniswapx-sdk-5.1.5.tgz","fileCount":210,"unpackedSize":1395963,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCGNwI52eP5phevNc+SjCif5vKqMDScbYR5TsSwuq6gcwIgK+66URdXYcL3NVwgPzfoxc2jlrPtDIOXxJoEFzkZwFU="}]},"_npmUser":{"name":"deliquified","email":"deliquifiedlabs@outlook.com"},"directories":{},"maintainers":[{"name":"deliquified","email":"deliquifiedlabs@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uniswapx-sdk_5.1.5_1718298739138_0.023800646870161923"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-13T16:55:48.727Z","modified":"2024-06-13T17:12:19.700Z","5.1.4":"2024-06-13T16:55:49.021Z","5.1.5":"2024-06-13T17:12:19.490Z"},"maintainers":[{"name":"deliquified","email":"deliquifiedlabs@outlook.com"}],"author":{"name":"Uniswap"},"repository":{"type":"git","url":"git+https://github.com/Deliquified/sdks.git"},"keywords":["zia","lukso"],"license":"MIT","homepage":"https://github.com/Deliquified/sdks#readme","bugs":{"url":"https://github.com/Deliquified/sdks/issues"},"readme":"# uniswapx-sdk\r\n\r\nSDK for the UniswapX protocol\r\n\r\n## Usage\r\n\r\nThe SDK contains bindings for two main flows: parsing serialized orders & building new orders.\r\n\r\n### Building & Signing Orders\r\n\r\n```ts\r\nimport { DutchOrder, NonceManager } from '@uniswap/uniswapx-sdk';\r\nimport { ethers } from 'ethers';\r\n\r\nconst provider = new ethers.providers.JsonRpcProvider(RPC_URL);\r\nconst account = await provider.getSigner().getAddress(); \r\nconst nonceMgr = new NonceManager(provider, 1); \r\nconst nonce = await nonceMgr.useNonce(account); \r\n\r\nconst chainId = 1;\r\nconst builder = new DutchOrderBuilder(chainId);\r\nconst order = builder\r\n  .deadline(deadline)\r\n  .decayEndTime(deadline)\r\n  .decayStartTime(deadline - 100)\r\n  .nonce(nonce)\r\n  .input({\r\n    token: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\r\n    amount: BigNumber.from('1000000'),\r\n  })\r\n  .output({\r\n    token: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\r\n    startAmount: BigNumber.from('1000000000000000000'),\r\n    endAmount: BigNumber.from('900000000000000000'),\r\n    recipient: '0x0000000000000000000000000000000000000000',\r\n  })\r\n  .build();\r\n \r\n// Sign the built order \r\nconst { domain, types, values } = order.permitData();\r\nconst signature = wallet._signTypedData(domain, types, values);\r\n\r\nconst serializedOrder = order.serialize();\r\n// submit serializedOrder and signature to order pool\r\n```\r\n\r\n### Parsing Orders\r\n```ts\r\nimport { DutchOrder, Order } from '@uniswap/uniswapx-sdk';\r\n\r\nconst serializedOrder = '0x1111222233334444555500000000234300234...';\r\nconst chainId = 1; \r\n\r\nconst order: Order = DutchOrder.parse(serializedOrder, chainId);\r\n\r\nconst orderData = order.info;\r\nconst orderHash = order.hash();\r\n```\r\n### Validating Orders \r\n```ts\r\nimport { ethers } from 'ethers';\r\nimport { OrderValidator } from 'uniswapx-sdk';\r\n\r\nconst provider = new ethers.providers.JsonRpcProvider(RPC_URL);\r\nconst validator = new OrderValidator(provider, CHAIN_ID); \r\nconst orders: SignedOrder[] = [\r\n  {\r\n    order: order1, \r\n    signature: signature1\r\n  }, \r\n  {\r\n    order: order2, \r\n    signature: signature2\r\n  }\r\n]; \r\n\r\ntry {\r\n  const statusList: OrderValidation[] = await validator.validateBatch(orders); \r\n  // Do something with list of statuses \r\n}\r\ncatch(e) {\r\n  // Handle error\r\n}\r\n\r\n```\r\n\r\n### Order Object\r\n\r\n**serialize()**\r\n\r\nReturns an abi-encoded serialization of the order. This serialized format is passed into the corresponding reactor contract for execution.\r\n\r\n\r\n**getSigner(signature)**\r\n\r\nRecovers the address which created the given signature over the order. Used to determine the order maker.\r\n\r\n\r\n**permitData()**\r\n\r\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.\r\n\r\n\r\n**hash()**\r\n\r\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.\r\n\r\n","readmeFilename":"README.md"}