{"_id":"@predictdotfun/sdk","_rev":"27-50b184fbebd2f5810c9fd67139bb2d8d","name":"@predictdotfun/sdk","dist-tags":{"latest":"1.3.8"},"versions":{"1.2.2":{"name":"@predictdotfun/sdk","version":"1.2.2","license":"MIT","_id":"@predictdotfun/sdk@1.2.2","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"eaee0fc37718a3101d3154023c7a5e95b0e13560","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.2.2.tgz","fileCount":115,"integrity":"sha512-i6rbsexnj/Bda5WxGVKfRhAImCYGKw2jvFQQjna5dssYEqXjRtf1XyjCbcdQzEgpRvacWgQLlAkUZ6DVqC3hYA==","signatures":[{"sig":"MEQCIH82scIoo8+Q6PXmzZyeBCXSLctUCcSNQ+0yrN8HuxEhAiAt5nJK6YCBxcoImx4DJ9dV/bboG/BZkYAKlZm7N0vtLg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1404945},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"440caec7a8c1e837ddfa3eec2c9a82a8ac12b87c","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"deprecated":"Version no longer supported","repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.2_1764075478405_0.3281574627581545","host":"s3://npm-registry-packages-npm-production"}},"1.2.3":{"name":"@predictdotfun/sdk","version":"1.2.3","license":"MIT","_id":"@predictdotfun/sdk@1.2.3","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"297c30f9ba1a495540f1cdbd8ef9d13a526225f3","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.2.3.tgz","fileCount":124,"integrity":"sha512-UbL9z1dJ7Dk+yMq6VaVGe55qY/PALxUKZMvTAy5KzVdrvFq1HWK9yl9AFRp9FjwAPhUAs87oJytdPVtHB1sp7A==","signatures":[{"sig":"MEUCIG+UOjHXPaDV7+k2Fi849BQ2Wg/xuUNwyeAxuYP0ZgEXAiEA/XzEZi5WuNc++hQcN1RKCa+5C0usqEI66w7484nZt1o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1709016},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"d7a9f7afaf49d9abc96120977420fa144e330d92","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"deprecated":"Version no longer supported","repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.3_1765214234267_0.48314697600955103","host":"s3://npm-registry-packages-npm-production"}},"1.2.4":{"name":"@predictdotfun/sdk","version":"1.2.4","license":"MIT","_id":"@predictdotfun/sdk@1.2.4","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"294fd68103b5580bc7e1f5c6c0c1866fd1c73f95","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.2.4.tgz","fileCount":124,"integrity":"sha512-qyHvvUJx7wHbNQWRk/qqdDx27NaopdSY4wbX9dz0hHoKrT1awmFdzkLESsXgp2VEo+2xnSvi/exR/izkgyioDw==","signatures":[{"sig":"MEUCIQDao1Ew5lPlhrMl02IYgm28mp7uNZmo9w242YPICw0wlAIgIhbgClue02i71YzLn1qtJPknr2Vrk56D87JZe2a/c28=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1717035},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"a6afa23aa5964d1deaa354e2aa68731861609391","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.4_1765302648983_0.08822267992119248","host":"s3://npm-registry-packages-npm-production"}},"1.2.5":{"name":"@predictdotfun/sdk","version":"1.2.5","license":"MIT","_id":"@predictdotfun/sdk@1.2.5","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"dd6008324557c4cc6f314e88400fa8d2a497cfcf","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.2.5.tgz","fileCount":124,"integrity":"sha512-mZV2Ik/dQU/Y4F+M2/ISugl3pV8a6T5TZyVCa75kMQRxalD3SwC58KNfxN7FwWUcWx5nN4ZkxMkL7x0oEjP8nA==","signatures":[{"sig":"MEQCIDPhKAlOYMq2DUCm1d+N1NHb5++kuZdjkgn6ZMTVOppiAiAD6LuyuyxHWN4PszPBZY3/in4Ye7UA3l1nDgB9hBvI6w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1719098},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"2cc088badba46131f6fa4bc480f2f89610bea57f","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.5_1767017077693_0.6250978917734378","host":"s3://npm-registry-packages-npm-production"}},"1.2.6":{"name":"@predictdotfun/sdk","version":"1.2.6","license":"MIT","_id":"@predictdotfun/sdk@1.2.6","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"b71b24d60bae9b238a837a19cee532d84d5b4aae","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.2.6.tgz","fileCount":124,"integrity":"sha512-yYlyYRHjrSavzULkMH7irLAdBwi5/Gh4ZBnZ15rwCe7ApXAZam51Ghv6GtppGyVBnXH0k5lQ8WwfN8Utdpprog==","signatures":[{"sig":"MEUCIQC2M8tl/hr6ZLjNWhiSM6mfmZSb9URFHPjxYv/TjS3xxQIgPPyEohM8FjaEKKJfdgvCM1qXpow7JuBYUwrKpiBJlQA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1725043},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"fe7aeceb0213b7e016e2239b5df5df47fcb9e983","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.6_1768572370292_0.03822748903310069","host":"s3://npm-registry-packages-npm-production"}},"1.2.8":{"name":"@predictdotfun/sdk","version":"1.2.8","license":"MIT","_id":"@predictdotfun/sdk@1.2.8","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"ec79e687cfbaaf168f1ffecb8d9a5c3fa3771499","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.2.8.tgz","fileCount":124,"integrity":"sha512-Ck0jH1Cc7Pd8Y/khI5WK/vi3wEt8Wj7Y419i7rxasV3wpMcBx/FLz6OJ1PuH+NYuQK9dFCP34+JCxAmAWbm1EA==","signatures":[{"sig":"MEUCIQDXiiyUwY9g2MRYPCTAWTFqm/Dp5QwHM2ZqVCSIkGnzRQIgBlSMqEeB57+3sYBrvHvypzguPMc7sLOJMHzLVvuouSI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1725429},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"4201ac4d1b56c4603ea1e65987adb7859b7d90da","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.8_1769734428568_0.17823785528233915","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@predictdotfun/sdk","version":"1.3.0","license":"MIT","_id":"@predictdotfun/sdk@1.3.0","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"e262bb7734f7105445b01d3e42a9b4a991cb7c3c","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.3.0.tgz","fileCount":124,"integrity":"sha512-PCwJFno9UZxq7wN3hoqaC6Yi40VICqqayWdWb20wicQ3x80TO0wQXYBYfz0RGZBLXjEzZ/YL0GL2BEDNec6cSA==","signatures":[{"sig":"MEUCIQCOI9ai+QJ7xKVk7rrE86e+UxC18pNaiAUW8vi3jSTb/QIgVqUdIe+3lFOjLWk0uYO8pzO4NS7iM7/Ht1+6ByB8Fbo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1729737},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"b86376331556351a9afa6a5da2d19cd408790da5","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.3.0_1771372952154_0.7393792299435078","host":"s3://npm-registry-packages-npm-production"}},"1.3.2":{"name":"@predictdotfun/sdk","version":"1.3.2","license":"MIT","_id":"@predictdotfun/sdk@1.3.2","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"fe2c4f981b15aac8dba2a526e589a1deb845bbc7","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.3.2.tgz","fileCount":124,"integrity":"sha512-0s9ZDs6KtBmFZkxjmrUwKz8UXKCZhTiJiHycdqd2GKKja+toiu+AsNXh0bEbqbYZgYPHhMbo8V+J2nW4Tq8sMg==","signatures":[{"sig":"MEQCIGVlXo8s7C2omZZ9P4HpoQLAzRjWjo5D1V1j1gu3y+XpAiB7YB5hrYFBUhRYbQPGR1J+oLpafvMnHcfFrc21Y0AMXw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1735672},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"40a63736a957314e257a3a2f63bb5ff5f9d785bd","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.3.2_1774908519738_0.26852250494101315","host":"s3://npm-registry-packages-npm-production"}},"1.3.5":{"name":"@predictdotfun/sdk","version":"1.3.5","license":"MIT","_id":"@predictdotfun/sdk@1.3.5","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"70c06508d2d4ee1eda1375a880f3f20e6b4990da","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.3.5.tgz","fileCount":124,"integrity":"sha512-+apkUOmqOVTEfThOd91Mz4MzJZLS095osPQlTeTcNY97kdeQYwb7gFRTeuvj1SCJtt2nQYEZRRty9PouJe6MMw==","signatures":[{"sig":"MEQCIFJ/gqfNoUyMmNA9pI8LRXJlYkSVUtNpXPiPic06kA4eAiBYCgRvOnIcWJvrJi4AfaLoe7RcNomRV6MEghQ24An42Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1736149},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"fe7ffb969cdf7e86cbaccf12696a61975989056e","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.3.5_1779112981789_0.5690132767023062","host":"s3://npm-registry-packages-npm-production"}},"1.3.6":{"name":"@predictdotfun/sdk","version":"1.3.6","license":"MIT","_id":"@predictdotfun/sdk@1.3.6","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"dist":{"shasum":"7c9f465cede9a42a8126ab9dd3e56796041bac1b","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.3.6.tgz","fileCount":124,"integrity":"sha512-kO8GP9TBu4UarVEjjGXIc4nR7Qk0D2zms+rOFX69k/MkiZTM8lB6ZZYQeOVENcOvBSZPCgMc382GYWoHuq923Q==","signatures":[{"sig":"MEUCIBhHFsOluAG/53hNV0rYezNcqscTOeLaXYWEum9slQ8lAiEA5kb4VWbcg8exm+16hQKTu17+wiIrkF5nntBLcE5B4EI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1780753},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"5dc169e0878bdfe65e75d69a70e8a8b955bff656","scripts":{"lint":"eslint \"**/*.{js,ts}\"","test":"yarn build:typechain && jest","build":"yarn build:typechain && yarn build:ts","prepare":"husky","release":"release-it --only-version","build:ts":"tsc --project tsconfig.build.json","prebuild":"rm -rf ./src/typechain ./dist","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","prepublishOnly":"yarn build","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json"},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"repository":{"url":"git+https://github.com/PredictDotFun/sdk.git","type":"git"},"_npmVersion":"11.6.1","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"_nodeVersion":"24.11.0","dependencies":{"ethers-multicall-provider":"6.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.39.1","ethers":"^6.15.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","typechain":"^8.3.2","@eslint/js":"^9.39.1","fast-check":"^4.3.0","release-it":"^19.0.6","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^24.10.0","lint-staged":"^16.2.6","@eslint/compat":"^1.4.1","eslint-plugin-jest":"^29.0.1","@typechain/ethers-v6":"^0.5.1","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.3","eslint-plugin-jest-formatting":"^3.1.0","@typescript-eslint/eslint-plugin":"^8.46.3","eslint-plugin-simple-import-sort":"^12.1.1","eslint-import-resolver-typescript":"^4.4.4"},"peerDependencies":{"ethers":"^6.15.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.3.6_1781296748831_0.02765353136644011","host":"s3://npm-registry-packages-npm-production"}},"1.3.8":{"name":"@predictdotfun/sdk","version":"1.3.8","license":"MIT","description":"A TypeScript SDK to help developers interface with the Predict's protocol.","homepage":"https://predict.fun/","bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"repository":{"type":"git","url":"git+https://github.com/PredictDotFun/sdk.git"},"main":"dist/index.js","types":"dist/index.d.ts","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"prepublishOnly":"yarn build","prebuild":"rm -rf ./src/typechain ./dist","build:ts":"tsc --project tsconfig.build.json","build:typechain":"typechain --target ethers-v6 --out-dir src/typechain src/abis/*.json","build":"yarn build:typechain && yarn build:ts","lint":"eslint \"**/*.{js,ts}\"","prepare":"husky","typecheck":"tsc --project tsconfig.build.json --noEmit","format:check":"prettier --check \"**/*.{js,ts,json,yaml,yml,md}\"","format:write":"prettier --write \"**/*.{js,ts,json,yaml,yml,md}\"","release":"release-it --only-version","test":"yarn build:typechain && jest"},"lint-staged":{"*.{js,jsx,ts,tsx,json,yaml,yml}":"yarn format:write"},"peerDependencies":{"ethers":"^6.15.0"},"dependencies":{"ethers-multicall-provider":"6.5.0"},"devDependencies":{"@eslint/compat":"^1.4.1","@eslint/js":"^9.39.1","@typechain/ethers-v6":"^0.5.1","@types/jest":"^30.0.0","@types/node":"^24.10.0","@typescript-eslint/eslint-plugin":"^8.46.3","@typescript-eslint/parser":"^8.46.3","eslint":"^9.39.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.0.1","eslint-plugin-jest-formatting":"^3.1.0","eslint-plugin-simple-import-sort":"^12.1.1","eslint-plugin-unicorn":"^62.0.0","ethers":"^6.15.0","fast-check":"^4.3.0","husky":"^9.1.7","jest":"^30.2.0","lint-staged":"^16.2.6","prettier":"^3.6.2","release-it":"^19.0.6","ts-jest":"^29.4.5","ts-node":"^10.9.2","typechain":"^8.3.2","typescript":"^5.9.3"},"engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0","yarn":">=1.22.11"},"gitHead":"5ff2b4a1c54cbbeb0fd661e17246cd12a9af8486","_id":"@predictdotfun/sdk@1.3.8","_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-8U5wn00jjth533O7899IhAQY12G+MPO6XYEQ3Az+FcwoNOiMnxLkEDRCuvCdHA9y0lZyUM76daRFY/kk09Uo/w==","shasum":"5ed99c288930181ccff0079f917f5047dbb4f43e","tarball":"https://registry.npmjs.org/@predictdotfun/sdk/-/sdk-1.3.8.tgz","fileCount":124,"unpackedSize":1788663,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDAH9zxcspanG816BAAKm7UN2fnbRJhWw5uh+4suuGqcAiEAqlOIzn+AVM3N+tKZOXipdbB5fOxbT5zMF2XyEXn/nXo="}]},"_npmUser":{"name":"hashpredict","email":"hash@predict.fun"},"directories":{},"maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.3.8_1785252715988_0.7873863691607981"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-25T12:57:58.254Z","modified":"2026-07-28T15:31:56.403Z","0.1.0":"2024-09-26T12:02:40.380Z","0.1.1":"2024-09-26T12:52:41.631Z","0.1.2":"2024-10-01T11:13:56.872Z","0.1.3":"2024-10-01T13:08:33.598Z","0.1.4":"2024-10-02T19:05:22.593Z","1.0.0":"2024-10-17T16:20:02.649Z","1.0.1":"2024-11-01T10:58:19.080Z","1.1.0":"2024-11-07T07:36:22.193Z","1.2.0":"2024-11-07T16:08:36.684Z","1.2.2":"2025-11-25T12:57:58.641Z","1.2.3":"2025-12-08T17:17:14.449Z","1.2.4":"2025-12-09T17:50:49.171Z","1.2.5":"2025-12-29T14:04:37.893Z","1.2.6":"2026-01-16T14:06:10.491Z","1.2.8":"2026-01-30T00:53:48.806Z","1.3.0":"2026-02-18T00:02:32.360Z","1.3.2":"2026-03-30T22:08:39.943Z","1.3.5":"2026-05-18T14:03:02.056Z","1.3.6":"2026-06-12T20:39:09.031Z","1.3.8":"2026-07-28T15:31:56.194Z"},"bugs":{"url":"https://github.com/PredictDotFun/sdk/issues"},"license":"MIT","homepage":"https://predict.fun/","repository":{"type":"git","url":"git+https://github.com/PredictDotFun/sdk.git"},"description":"A TypeScript SDK to help developers interface with the Predict's protocol.","maintainers":[{"name":"siddhidotfun","email":"siddhipredict@gmail.com"},{"name":"hashpredict","email":"hash@predict.fun"}],"readme":"A TypeScript SDK to help developers interface with the Predict's protocol.\n\n#### Sections:\n\n- [How to install the SDK](#how-to-install-the-sdk)\n- [How to set approvals](#how-to-set-approvals)\n- [How to set scoped approvals (per-operation)](#how-to-set-scoped-approvals-per-operation)\n- [How to use a Predict account](#how-to-use-a-predict-account)\n- [How to create a LIMIT order _(recommended)_](#how-to-create-a-limit-order-recommended)\n- [How to create a MARKET order](#how-to-create-a-market-order)\n- [How to apply slippage](#how-to-apply-slippage)\n- [How to redeem positions](#how-to-redeem-positions)\n- [How to merge positions](#how-to-merge-positions)\n- [How to convert positions](#how-to-convert-positions)\n- [How to check USDT balance](#how-to-check-usdt-balance)\n- [How to interface with contracts](#how-to-interface-with-contracts)\n- [How to cancel orders](#how-to-cancel-orders)\n- [License](#license)\n\n## How to install the SDK\n\nThis package has [ethers v6](https://docs.ethers.io/v6/) as a peer dependency.\n\n```bash\nyarn add @predictdotfun/sdk ethers\n```\n\n```bash\nnpm install @predictdotfun/sdk ethers\n```\n\nSee the [`OrderBuilder`](./src/OrderBuilder.ts) class for more in-depth details on each function.\n\n**Tip (faster confirmations):** ethers' default provider polling interval is `4000ms`, so every `tx.wait()` the SDK does internally (in `setApprovals`, `runApprovals`, `cancelOrders`, `redeemPositions`, etc.) can take up to ~4s to notice a mined transaction. On a fast chain like BNB, lower it to ~`300ms` so confirmations feel near-instant:\n\n```typescript\nimport { JsonRpcProvider, Wallet } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_PROVIDER_URL);\nprovider.pollingInterval = 300; // default is 4000ms\n\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY, provider);\n```\n\nThe interval lives on the provider, so set it on whatever provider you pass in, including a `BrowserProvider` (e.g. MetaMask): `provider.pollingInterval = 300`.\n\n## Predict Account\n\nPredict supports interacting with the protocol using either a traditional Externally Owned Account (EOA) or a Smart Wallet (\"Predict Account\"). If you use the web app, a Smart Wallet is automatically created for you. To interact with your Smart Wallet programmatically using the SDK, follow the example shown in [How to use a Predict account](#how-to-use-a-predict-account).\n\n## How to set approvals\n\nBefore trading, you need to set approvals for ERC-1155 (`ConditionalTokens`) and ERC-20 (`USDT`). This can be achieved by sending a transaction to the respective contracts (see the [Contracts](#contracts) section) and approving both the `CTF_EXCHANGE` and the `NEG_RISK_CTF_EXCHANGE` or via the SDK utils.\n\n**Contracts**: The current deployed contracts can be found either in the [`Constants.ts`](./src/Constants.ts#32) file or in the [Deployed Contracts](https://docs.predict.fun/developers/deployed-contracts) documentation.\n\nThe following example demonstrates how to set the necessary approvals using the SDK utils.\n\n```typescript\nimport { Wallet, MaxInt256 } from \"ethers\";\nimport { OrderBuilder, ChainId, Side } from \"@predictdotfun/sdk\";\n\n// Create a wallet to send the approvals transactions (must be the orders' `maker`)\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY);\n\n// The main function which initiates the OrderBuilder (only once per signer) and then provides it as dependency to other util functions\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  // Call an helper function to set the approvals and provide the OrderBuilder instance.\n  await setApprovals(orderBuilder);\n}\n\nasync function setApprovals(orderBuilder: OrderBuilder) {\n  // Set all the approval needed within the protocol\n  const result = await orderBuilder.setApprovals();\n\n  // Check if the approvals were set successfully\n  if (!result.success) {\n    throw new Error(\"Failed to set approvals.\");\n  }\n}\n```\n\n## How to set scoped approvals (per-operation)\n\n`setApprovals()` sets every approval for every market type in a single call. For most apps the scoped-approvals API is the better fit, and is the recommended approach whenever you build an approval UI. It returns only the approvals a given operation needs, as a list of plain, self-describing steps you can render as a checklist, pre-check, run with live progress, and gate on user confirmation.\n\nThe mental model is simple: **everything produces steps, and one runner runs steps.**\n\n1. Describe what the user is about to do with an `ApprovalScope` (`operation`, plus `isNegRisk` / `isYieldBearing`, and an optional `side` to narrow a `TRADE`).\n2. Turn it into an ordered `ApprovalStep[]` with `getApprovalSteps` (one operation) or `getAllApprovalSteps` (everything). Both are pure (no signer, no network access), so you can render the checklist before the wallet is connected.\n3. Run the steps with `runApprovals`, or drive them yourself with `checkApprovals` / `setApproval`.\n\n`isNegRisk` and `isYieldBearing` describe the market and can be fetched from the `GET /markets` (or `GET /categories`) endpoint.\n\n`getApprovalSteps` returns the minimal, ordered set for the operation. The labels below are the SDK's default copy (they match the Predict web app). Operations that need no approval return an empty array. |\n\nA `TRADE` scope covers both order directions by default. Pass `side: Side.BUY` for just the collateral allowance, or `side: Side.SELL` for just the ERC-1155 approval. `CONVERT` is neg-risk only and throws `InvalidApprovalOperationError` for a standard market.\n\n### The `ApprovalStep` shape\n\nEach step is plain data, safe to render and serialize:\n\n```typescript\n{\n  id: \"ERC1155_APPROVAL:CTF_EXCHANGE\", // stable identifier: `${type}:${spenderKey}`\n  type: \"ERC1155_APPROVAL\",            // or \"ERC20_ALLOWANCE\"\n  spender: \"0x8BC0...B689\",            // the contract being granted permission\n  token: \"0x22DA...d244\",              // the token contract (conditional tokens for ERC-1155, USDT for ERC-20)\n  label: \"Approve Exchange\",           // default copy\n  description: \"Allows you to interact with the exchange.\",\n}\n```\n\nThe `label`/`description` are sensible English defaults. For custom wording or i18n, key your own copy off the stable `id` and ignore them.\n\n### Build the steps\n\nYou'll typically build the steps from the same signer-backed `OrderBuilder` you use to check and run them.\n\n```typescript\nimport { OrderBuilder, ChainId, Side } from \"@predictdotfun/sdk\";\n\nconst builder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n// For a single operation on a market:\nconst steps = builder.getApprovalSteps({\n  operation: \"TRADE\",\n  isNegRisk: true,\n  isYieldBearing: false,\n  // side: Side.BUY, // optional TRADE narrowing\n});\n\n// For onboarding, every approval across both market types (and, by default, both tracks):\nconst allSteps = builder.getAllApprovalSteps(); // or { isYieldBearing: false } to limit to one track\n```\n\n`getApprovalSteps` and `getAllApprovalSteps` don't touch the chain, so you _can_ also call them on a signer-less builder (`OrderBuilder.make(ChainId.BnbMainnet)`) to render the checklist before the wallet is connected. You'll need a signer for everything after (`checkApprovals`, `setApproval`, `runApprovals`).\n\n### Run them with progress reporting\n\n`runApprovals(steps, opts)` runs the steps in order, deduplicating by `id` (so you can safely pass a union of scopes or a curated subset). Options:\n\n- `skipSatisfied` (default `true`): pre-check each step on-chain and skip the ones already in place.\n- `stopOnError` (default `true`): stop after the first failed step.\n- `onProgress`: a callback invoked as each step transitions, receiving `{ step, status, transaction? }`.\n\n```typescript\nconst builder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\nconst steps = builder.getApprovalSteps({ operation: \"TRADE\", isNegRisk: true, isYieldBearing: false });\n\nconst report = await builder.runApprovals(steps, {\n  skipSatisfied: true, // default\n  stopOnError: true, // default\n  onProgress: ({ step, status }) => updateUI(step.id, status),\n});\n```\n\n`onProgress` reports each step through this lifecycle:\n\n| Status       | Meaning                                                                    |\n| ------------ | -------------------------------------------------------------------------- |\n| `checking`   | reading on-chain whether it's already approved (only when `skipSatisfied`) |\n| `skipped`    | already in place, nothing sent                                             |\n| `submitting` | transaction sent, awaiting confirmation                                    |\n| `confirmed`  | the transaction succeeded                                                  |\n| `failed`     | the transaction reverted or failed                                         |\n\nThe returned report is `{ success, steps }`, where each entry is `{ step, status: \"skipped\" | \"confirmed\" | \"failed\", transaction? }` (the `transaction` carries the receipt for submitted steps):\n\n```typescript\nif (!report.success) {\n  const failed = report.steps.filter((s) => s.status === \"failed\");\n  throw new Error(`Approvals failed: ${failed.map((s) => s.step.id).join(\", \")}`);\n}\n```\n\n### Render a live checklist (the typical UI flow)\n\nThis is the flow behind an in-app \"Approvals\" modal: render the steps, mark the ones already done, then run the rest with live updates.\n\n```typescript\nconst builder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n// 1. Build the plan.\nconst steps = builder.getApprovalSteps({ operation: \"TRADE\", isNegRisk, isYieldBearing });\n\n// 2. Render the checklist, marking which are already satisfied (one batched multicall read).\nfor (const { step, satisfied } of await builder.checkApprovals(steps)) {\n  addRow(step.id, step.label, step.description, satisfied ? \"done\" : \"pending\");\n}\n\n// 3. Run the remaining steps, updating each row as it progresses.\nconst report = await builder.runApprovals(steps, {\n  onProgress: ({ step, status }) => setRowStatus(step.id, status),\n});\n```\n\nFor first-time onboarding, swap `getApprovalSteps(scope)` for `getAllApprovalSteps()` to approve everything the protocol could need in one pass. That is the per-step, progress-reportable equivalent of `setApprovals()` (and a slight superset, since it also includes the split allowances).\n\n### Or drive each step yourself\n\nFor full control (e.g. gating each step on a user confirmation), use the per-step primitives. `checkApprovals` batches the on-chain reads (via multicall) so you can render the initial state in one round-trip.\n\n```typescript\nconst builder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\nconst steps = builder.getApprovalSteps({ operation: \"SPLIT\", isNegRisk: false, isYieldBearing: false });\n\n// Batched pre-check to mark which steps are already done.\nconst checks = await builder.checkApprovals(steps);\n\nfor (const { step, satisfied } of checks) {\n  if (satisfied) continue; // already approved\n  // setApproval is a raw send: ERC-20 defaults to MaxUint256, ERC-1155 to `approved: true`.\n  // Pass `{ approved: false }` to revoke, or `{ amount }` to cap an allowance.\n  const result = await builder.setApproval(step);\n  if (!result.success) break; // you decide whether to continue\n}\n```\n\n### Notes\n\n- **Compose freely.** Union step lists to cover several operations at once, e.g. to make a market both trade-ready and splittable: `runApprovals([...tradeSteps, ...splitSteps])` (duplicates are removed automatically).\n- **Predict accounts** (smart wallets) are supported transparently: every step routes through `Kernel.execute` when a `predictAccount` is configured.\n- **Signer requirements.** `getApprovalSteps` and `getAllApprovalSteps` are pure and need no signer. `checkApproval` / `checkApprovals`, `setApproval`, and `runApprovals` require one and throw `MissingSignerError` otherwise.\n- **`setApprovals()` still exists** for the fire-and-forget \"approve everything\" case where you don't need per-step control or reporting.\n\n## How to use a Predict account\n\nHere's an example of how to use a Predict account to create/cancel orders and set approvals.\n\n1. **Initiate the Privy Wallet**: The wallet is needed to sign orders. Can be found in the [account settings](https://predict.fun/account/settings).\n2. **Ensure the Privy Wallet has funds**: You will need to add some ETH to be able to set approvals and cancel orders, if needed.\n3. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`.\n   - NOTE: Include the `predictAccount` address, which is also known as the deposit address.\n4. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](#set-approvals)).\n5. **Determine Order Amounts**: Use `getLimitOrderAmounts` to calculate order amounts.\n6. **Build Order**: Use `buildOrder` to generate a `LIMIT` strategy order.\n   - NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API\n   - NOTE: Set the `signer` and `maker` to the `predictAccount` address, **NOT** the signer/privy wallet address.\n7. **Generate Typed Data**: Call `buildTypedData` to generate typed data for the order.\n8. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`.\n9. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`.\n\n```typescript\nimport { Wallet } from \"ethers\";\nimport { OrderBuilder, ChainId, Side } from \"@predictdotfun/sdk\";\n\n// Create a wallet to send the approvals transactions (must be the orders' `maker`)\nconst signer = new Wallet(process.env.PRIVY_WALLET_PRIVATE_KEY);\n\n// The main function which initiates the OrderBuilder (only once per signer) and then provides it as dependency to other util functions\nasync function main() {\n  // Create a new instance of the OrderBuilder class with the predictAccount option\n  // Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer, {\n    predictAccount: \"PREDICT_ACCOUNT_ADDRESS\", // Your deposit address from account settings\n  });\n\n  // Call an helper function to create the order and provide the OrderBuilder instance\n  await createOrder(orderBuilder);\n}\n\nasync function createOrder(orderBuilder: OrderBuilder) {\n  // Step 1. Set approvals and define the order params as usual\n\n  // Step 2. Create the order (maker and signer are automatically set to the predictAccount)\n  const order = orderBuilder.buildOrder(\"LIMIT\", {\n    side: Side.BUY, // Equivalent to 0\n    tokenId: \"OUTCOME_ON_CHAIN_ID\", // This can be fetched via the API or on-chain\n    makerAmount, // 0.4 USDT * 10 shares (in wei)\n    takerAmount, // 10 shares (in wei)\n    nonce: 0n,\n    feeRateBps: 0, // Should be fetched via the `GET /markets` endpoint\n  });\n\n  // Step 3. Sign and submit the order as usual\n}\n```\n\nThis will allow you to perform operations via your Predict Account (via the smart wallet).\n\n## How to create a LIMIT order _(recommended)_\n\nHere's an example of how to use the OrderBuilder to create and sign a `LIMIT` strategy buy order:\n\n1. **Create Wallet**: The wallet is needed to sign orders.\n2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`.\n3. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](#set-approvals)).\n4. **Determine Order Amounts**: Use `getLimitOrderAmounts` to calculate order amounts.\n5. **Build Order**: Use `buildOrder` to generate a `LIMIT` strategy order.\n   - NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API\n6. **Generate Typed Data**: Call `buildTypedData` to generate typed data for the order.\n7. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`.\n8. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`.\n\n```typescript\nimport { Wallet } from \"ethers\";\nimport { OrderBuilder, ChainId, Side } from \"@predictdotfun/sdk\";\n\n// Create a wallet for signing orders\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY);\n\n// The main function which initiates the OrderBuilder (only once per signer) and then provides it as dependency to other util functions\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  // Call an helper function to create the order and provide the OrderBuilder instance\n  await createOrder(orderBuilder);\n}\n\nasync function createOrder(orderBuilder: OrderBuilder) {\n  /**\n   * NOTE: You can also call `setApprovals` once per wallet.\n   */\n\n  // Set all the approval needed within the protocol (if needed)\n  const result = await orderBuilder.setApprovals();\n\n  // Check if the approvals were set successfully\n  if (!result.success) {\n    throw new Error(\"Failed to set approvals.\");\n  }\n\n  // Simple helper function to calculate the amounts for a `LIMIT` order\n  const { lastPrice, pricePerShare, makerAmount, takerAmount } = orderBuilder.getLimitOrderAmounts({\n    side: Side.BUY,\n    pricePerShareWei: 400000000000000000n, // 0.4 USDT (in wei)\n    quantityWei: 10000000000000000000n, // 10 shares (in wei)\n  });\n\n  // Build a limit order (if you are using a Predict account replace `signer.address` with your deposit address)\n  const order = orderBuilder.buildOrder(\"LIMIT\", {\n    maker: signer.address,\n    signer: signer.address,\n    side: Side.BUY, // Equivalent to 0\n    tokenId: \"OUTCOME_ON_CHAIN_ID\", // This can be fetched via the API or on-chain\n    makerAmount, // 0.4 USDT * 10 shares (in wei)\n    takerAmount, // 10 shares (in wei)\n    nonce: 0n,\n    feeRateBps: 0, // Should be fetched via the `GET /markets` endpoint\n  });\n\n  // Build typed data for the order (isNegRisk and isYieldBearing can be fetched via the API)\n  const typedData = orderBuilder.buildTypedData(order, { isNegRisk: true, isYieldBearing: true });\n\n  // Sign the order by providing the typedData of the order\n  const signedOrder = await orderBuilder.signTypedDataOrder(typedData);\n\n  // Compute the order's hash\n  const hash = orderBuilder.buildTypedDataHash(typedData);\n\n  // Example structure required to create an order via Predict's API\n  const createOrderBody = {\n    data: {\n      order: { ...signedOrder, hash },\n      pricePerShare,\n      strategy: \"LIMIT\",\n    },\n  };\n}\n```\n\n## How to create a MARKET order\n\nSimilarly to the above, here's the flow to create a `MARKET` sell order:\n\n1. **Create Wallet**: The wallet is needed to sign orders.\n2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`.\n3. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](#set-approvals)).\n4. **Fetch Orderbook**: Query the Predict API for the latest orderbook for the market.\n5. **Determine Order Amounts**: Use `getMarketOrderAmounts` to calculate order amounts.\n6. **Build Order**: Call `buildOrder` to generate a `MARKET` strategy order.\n   - NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API\n7. **Generate Typed Data**: Use `buildTypedData` to create typed data for the order.\n8. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`.\n9. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`.\n\n```typescript\nimport { Wallet } from \"ethers\";\nimport { OrderBuilder, ChainId, Side } from \"@predictdotfun/sdk\";\n\n// Create a wallet for signing orders\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY);\n\n// The main function which initiates the OrderBuilder (only once per signer) and then provides it as dependency to other util functions\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  // Call an helper function to create the order and provide the OrderBuilder instance\n  await createOrder(orderBuilder);\n}\n\nasync function createOrder(orderBuilder: OrderBuilder) {\n  // Fetch the orderbook for the specific market via `GET /markets/{marketId}/orderbook`\n  const book = {};\n\n  /**\n   * NOTE: You can also call `setApprovals` once per wallet.\n   */\n\n  // Set all the approval needed within the protocol (if needed)\n  const result = await orderBuilder.setApprovals();\n\n  // Check if the approvals were set successfully\n  if (!result.success) {\n    throw new Error(\"Failed to set approvals.\");\n  }\n\n  // Helper function to calculate the amounts for a `MARKET` order\n  const {\n    lastPrice,\n    pricePerShare,\n    makerAmount,\n    takerAmount,\n    amount, // Non-deflated share quantity (differs from takerAmount when isMinAmountOut is true)\n    // Only needed if you set a slippage tolerance in the input\n    slippageBps,\n    isMinAmountOut, // Whether the alternative slippage model was used\n  } = orderBuilder.getMarketOrderAmounts(\n    {\n      side: Side.SELL,\n      quantityWei: 10000000000000000000n, // 10 shares (in wei) e.g. parseEther(\"10\")\n      slippageBps: 100n, // E.g. 1% slippage tolerance (100 bps)\n    },\n    book, // It's recommended to re-fetch the orderbook regularly to avoid issues\n  );\n\n  // Build a limit order (if you are using a Predict account replace `signer.address` with your deposit address)\n  const order = orderBuilder.buildOrder(\"MARKET\", {\n    maker: signer.address,\n    signer: signer.address,\n    side: Side.SELL, // Equivalent to 1\n    tokenId: \"OUTCOME_ON_CHAIN_ID\", // This can be fetched via the API or on-chain\n    makerAmount, // 10 shares (in wei)\n    takerAmount, // 0.4 USDT * 10 shares (in wei)\n    nonce: 0n,\n    feeRateBps: 0, // Should be fetched via the `GET /markets` endpoint\n  });\n\n  // Build typed data for the order (isNegRisk and isYieldBearing can be fetched via the API)\n  const typedData = orderBuilder.buildTypedData(order, { isNegRisk: false, isYieldBearing: false });\n\n  // Sign the order by providing the typedData of the order\n  const signedOrder = await orderBuilder.signTypedDataOrder(typedData);\n\n  // Compute the order's hash\n  const hash = orderBuilder.buildTypedDataHash(typedData);\n\n  // Example structure required to create an order via Predict's API\n  const createOrderBody = {\n    data: {\n      order: { ...signedOrder, hash },\n      pricePerShare,\n      strategy: \"MARKET\",\n      slippageBps,\n    },\n  };\n}\n```\n\n### How to apply slippage\n\nBy default, no additional slippage is applied to the order maker/taker amounts. You can specify a slippage tolerance in basis points (1 bps = 0.01%) to adjust the amounts:\n\n- **BUY orders**: set `isMinAmountOut: true` so that slippage decreases the `takerAmount` (minimum shares out), while `makerAmount` equals the expected cost (avg price × shares). This avoids inflating the USD commitment, allowing you to spend your full wallet balance.\n- **SELL orders**: slippage decreases the `takerAmount` (you're willing to receive less collateral)\n\n```typescript\n// Market order with 1% slippage (100 bps)\nconst amounts = orderBuilder.getMarketOrderAmounts(\n  {\n    side: Side.BUY,\n    quantityWei: 10000000000000000000n, // 10 shares (in wei)\n    slippageBps: 100n, // 1% slippage tolerance\n    isMinAmountOut: true,\n  },\n  book,\n);\n\n// makerAmount is the expected cost, takerAmount is deflated by slippage\nconsole.log(`Maker Amount: ${amounts.makerAmount}`); // Expected cost (not inflated)\nconsole.log(`Taker Amount: ${amounts.takerAmount}`); // Deflated by slippage\nconsole.log(`Amount: ${amounts.amount}`); // Original share quantity\nconsole.log(`Price Per Share: ${amounts.pricePerShare}`);\nconsole.log(`Slippage Applied: ${amounts.slippageBps} bps`); // 100n\n\n// Value-based market order with slippage\nconst valueAmounts = orderBuilder.getMarketOrderAmounts(\n  {\n    side: Side.BUY,\n    valueWei: 5000000000000000000n, // 5 USDT (in wei)\n    slippageBps: 50n, // 0.5% slippage tolerance\n    isMinAmountOut: true,\n  },\n  book,\n);\n```\n\n**Note:** Slippage will only be applied if you provide the `slippageBps` and `isMinAmountOut` values when submitting your order to the REST API.\n\n## How to redeem positions\n\nThe `OrderBuilder` class provides the `redeemPositions` method to redeem your positions on the Predict protocol. The method supports all market types through the `isNegRisk` and `isYieldBearing` options.\n\n1. **Create a Wallet**: Initialize a wallet that will be used to sign the redemption transaction.\n2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling the static `make` method.\n3. **Redeem Positions**: Call the `redeemPositions` method with the appropriate options.\n\nThe `conditionId` and `indexSet` can be fetched from the `GET /positions` endpoint.\n\n```typescript\nimport { Wallet } from \"ethers\";\nimport { OrderBuilder, ChainId } from \"@predictdotfun/sdk\";\n\n// Initialize the wallet with your private key\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY);\n\n// The main function initiates the OrderBuilder (only once per signer)\n// Then provides it as dependency to other functions\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  // Redeem positions for a standard market\n  await redeemStandardPositions(orderBuilder);\n\n  // Redeem positions for a NegRisk market\n  await redeemNegRiskPositions(orderBuilder);\n}\n\nasync function redeemStandardPositions(orderBuilder: OrderBuilder) {\n  const conditionId = \"CONDITION_ID_FROM_API\"; // A hash string\n  const indexSet = \"INDEX_SET_FROM_API\"; // 1 or 2 based on the position you want to redeem\n\n  const result = await orderBuilder.redeemPositions({\n    conditionId,\n    indexSet,\n    isNegRisk: false,\n    isYieldBearing: true, // Set based on market type\n  });\n\n  if (result.success) {\n    console.log(\"Positions redeemed successfully:\", result.receipt);\n  } else {\n    console.error(\"Failed to redeem positions:\", result.cause);\n  }\n}\n\nasync function redeemNegRiskPositions(orderBuilder: OrderBuilder) {\n  const conditionId = \"CONDITION_ID_FROM_API\"; // A hash string\n  const indexSet = \"INDEX_SET_FROM_API\"; // 1 or 2 based on the position you want to redeem\n  const amount = \"POSITION_AMOUNT_FROM_API\"; // The amount to redeem, usually the max\n\n  const result = await orderBuilder.redeemPositions({\n    conditionId,\n    indexSet,\n    amount,\n    isNegRisk: true,\n    isYieldBearing: true, // Set based on market type\n  });\n\n  if (result.success) {\n    console.log(\"Positions redeemed successfully:\", result.receipt);\n  } else {\n    console.error(\"Failed to redeem positions:\", result.cause);\n  }\n}\n```\n\n## How to merge positions\n\nThe `OrderBuilder` class provides the `mergePositions` method to combine both outcome tokens back into collateral (USDT). This is useful when you hold equal amounts of both YES and NO positions.\n\n1. **Create a Wallet**: Initialize a wallet that will be used to sign the merge transaction.\n2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling the static `make` method.\n3. **Merge Positions**: Call the `mergePositions` method with the appropriate options.\n\nThe `conditionId` can be fetched from the `GET /positions` endpoint.\n\n```typescript\nimport { Wallet } from \"ethers\";\nimport { OrderBuilder, ChainId } from \"@predictdotfun/sdk\";\n\n// Initialize the wallet with your private key\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY);\n\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  await mergePositions(orderBuilder);\n}\n\nasync function mergePositions(orderBuilder: OrderBuilder) {\n  const conditionId = \"CONDITION_ID_FROM_API\";\n  const amount = 10000000000000000000n; // 10 tokens (in wei)\n\n  const result = await orderBuilder.mergePositions({\n    conditionId,\n    amount,\n    isNegRisk: false,\n    isYieldBearing: true, // Set based on market type\n  });\n\n  if (result.success) {\n    console.log(\"Positions merged successfully:\", result.receipt);\n  } else {\n    console.error(\"Failed to merge positions:\", result.cause);\n  }\n}\n```\n\n## How to convert positions\n\nThe `OrderBuilder` class provides the `convertPositions` method to convert NO positions in a NegRisk market into the complementary YES positions plus collateral (USDT). Only NegRisk markets support conversions.\n\nFor each `amount` converted, the selected NO positions are burned and you receive:\n\n- `amount` of the YES position for every other market in the category.\n- `amount * (numberOfNoPositions - 1)` of collateral (USDT).\n\nIf the market has a fee, it is deducted from both the collateral and the YES tokens.\n\n1. **Create a Wallet**: Initialize a wallet that will be used to sign the conversion transaction.\n2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling the static `make` method.\n3. **Convert Positions**: Call the `convertPositions` method with the appropriate options.\n\nThe `negRiskOnChainId` matches the field of the same name returned by the `GET /categories` endpoint: the category's on-chain NegRisk market ID, a 32-byte hex string. Note that this is not the numeric `id` the API uses for markets and categories. The `indexSet` is a bitmask that selects which NO positions to convert: for each one, set the bit at the market's `questionIndex` (also returned by the `GET /categories` and `GET /positions` endpoints).\n\nConversions move your NO tokens through the NegRisk adapter, which must be approved as an operator first. See [How to set scoped approvals (per-operation)](#how-to-set-scoped-approvals-per-operation) and use the `CONVERT` operation.\n\n```typescript\nimport { Wallet } from \"ethers\";\nimport { OrderBuilder, ChainId } from \"@predictdotfun/sdk\";\n\n// Initialize the wallet with your private key\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY);\n\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  await convertPositions(orderBuilder);\n}\n\nasync function convertPositions(orderBuilder: OrderBuilder) {\n  const negRiskOnChainId = \"NEG_RISK_ON_CHAIN_ID_FROM_API\"; // 32-byte hex, not the numeric API id\n\n  // Set the bit at each market's `questionIndex` to select its NO position\n  const questionIndexes = [0, 2]; // e.g. convert the NO positions of the first and third questions\n  const indexSet = questionIndexes.reduce((set, index) => set | (1n << BigInt(index)), 0n);\n\n  const result = await orderBuilder.convertPositions({\n    negRiskOnChainId,\n    indexSet,\n    amount: 10000000000000000000n, // 10 tokens (in wei) of each NO position\n    isYieldBearing: true, // Set based on market type\n  });\n\n  if (result.success) {\n    console.log(\"Positions converted successfully:\", result.receipt);\n  } else {\n    console.error(\"Failed to convert positions:\", result.cause);\n  }\n}\n```\n\n## How to check USDT balance\n\nThe method `balanceOf` allows to easily check the current USDT balance of the connected signer.\n\n```typescript\nimport { Wallet } from \"ethers\";\nimport { OrderBuilder, ChainId } from \"@predictdotfun/sdk\";\n\n// Initialize the wallet with your private key\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY);\n\n// The main function initiates the OrderBuilder (only once per signer)\n// Then provides it as dependency to other functions\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  await checkBalance(orderBuilder);\n}\n\nasync function checkBalance(orderBuilder: OrderBuilder) {\n  // Fetch the current account/wallet balance in wei\n  const balanceWei = await orderBuilder.balanceOf();\n\n  // Example check\n  if (balanceWei >= orderAmountWei) {\n    console.log(\"Enough balance to create the order\");\n  } else {\n    console.error(\"Not enough balance to create the order\");\n  }\n}\n```\n\n## How to interface with contracts\n\nTo facilitate interactions with Predict's contracts we expose the necessary instances of each contract, including ABIs and types.\n\n```typescript\nimport { OrderBuilder, ChainId } from \"@predictdotfun/sdk\";\nimport { Wallet } from \"ethers\";\n\n// Create a wallet to interact with on-chain contracts\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY);\n\n// The main function initiates the OrderBuilder (only once per signer)\n// Then provides it as dependency to other functions\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  await callContracts(orderBuilder);\n}\n\nasync function callContracts(orderBuilder: OrderBuilder) {\n  // If the signer is not provided within `OrderBuilder.make` the contracts won't be initiated\n  if (!orderBuilder.contracts) {\n    throw new Error(\"The signer was not provided during the OrderBuilder init.\");\n  }\n\n  // You can now call contract functions (the actual contract instance is within `contract`)\n  // The `codec` property contains the ethers Interface, useful to encode and decode data\n  const balance = await orderBuilder.contracts[\"USDT\"].contract.balanceOf(signer.address);\n}\n```\n\nSome other useful utils, ABIs and types exposed by the SDK.\n\n```typescript\nimport {\n  // Supported Chains\n  ChainId,\n\n  // Addresses\n  AddressesByChainId,\n\n  // Contract Interfaces\n  CTFExchange,\n  ConditionalTokens,\n  YieldBearingConditionalTokens,\n  NegRiskAdapter,\n  NegRiskCtfExchange,\n  ERC20,\n\n  // ABIs\n  CTFExchangeAbi,\n  NegRiskCtfExchangeAbi,\n  NegRiskAdapterAbi,\n  ConditionalTokensAbi,\n  YieldBearingConditionalTokensAbi,\n  ERC20Abi,\n\n  // Order builder\n  OrderBuilder,\n} from \"@predictdotfun/sdk\";\n```\n\n## How to cancel orders\n\nHere's an example on how to cancel orders via the SDK\n\n1. **Fetch Orders**: Retrieve your open orders using `GET /orders`.\n2. **Group by `isNegRisk` and `isYieldBearing`**: Separate orders based on the `isNegRisk` and `isYieldBearing` properties.\n3. **Cancel Orders**: Call the cancel function and provide the orders to cancel and the `isNegRisk` and `isYieldBearing` properties.\n4. **Check Transaction Success**: Check to confirm the transaction was successful.\n\n```typescript\nimport { Wallet } from \"ethers\";\nimport { OrderBuilder, ChainId, Side } from \"@predictdotfun/sdk\";\n\n// Create a new JsonRpcProvider instance\nconst provider = new JsonRpcProvider(process.env.RPC_PROVIDER_URL);\n\n// Create a wallet to send the cancel transactions on-chain\nconst signer = new Wallet(process.env.WALLET_PRIVATE_KEY).connect(provider);\n\n// The main function which initiates the OrderBuilder (only once per signer) and then provides it as dependency to other util functions\nasync function main() {\n  // Create a new instance of the OrderBuilder class. Note: This should only be done once per signer\n  const orderBuilder = await OrderBuilder.make(ChainId.BnbMainnet, signer);\n\n  // Call a helper function to cancel orders and provide the OrderBuilder instance\n  await cancelOrdersHelper(orderBuilder);\n}\n\nasync function cancelOrdersHelper(orderBuilder: OrderBuilder) {\n  // Fetch your open orders from the `GET /orders` endpoint\n  const apiResponse = [\n    // There are more fields, but for cancellations we only care about `order`, `isNegRisk` and `isYieldBearing`\n    { order: {}, isNegRisk: true, isYieldBearing: true },\n    { order: {}, isNegRisk: true, isYieldBearing: false },\n    { order: {}, isNegRisk: false, isYieldBearing: true },\n    { order: {}, isNegRisk: false, isYieldBearing: false },\n  ];\n\n  // Determine which orders you want to cancel\n  const ordersToCancel = [\n    { order: {}, isNegRisk: true, isYieldBearing: true },\n    { order: {}, isNegRisk: true, isYieldBearing: false },\n    { order: {}, isNegRisk: false, isYieldBearing: true },\n    { order: {}, isNegRisk: false, isYieldBearing: false },\n  ];\n\n  const regularOrders: Order[] = [];\n  const negRiskOrders: Order[] = [];\n  const regularYieldBearingOrders: Order[] = [];\n  const negRiskYieldBearingOrders: Order[] = [];\n\n  // Group the orders by `isNegRisk` and `isYieldBearing`\n  for (const { order, isNegRisk, isYieldBearing } of ordersToCancel) {\n    if (isYieldBearing) {\n      if (isNegRisk) {\n        negRiskYieldBearingOrders.push(order);\n      } else {\n        regularYieldBearingOrders.push(order);\n      }\n    } else {\n      if (isNegRisk) {\n        negRiskOrders.push(order);\n      } else {\n        regularOrders.push(order);\n      }\n    }\n  }\n\n  // Call the cancel function\n  const regResult = await orderBuilder.cancelOrders(regularOrders, { isNegRisk: false, isYieldBearing: false });\n  const negRiskResult = await orderBuilder.cancelOrders(negRiskOrders, { isNegRisk: true, isYieldBearing: false });\n\n  const regYieldBearingResult = await orderBuilder.cancelOrders(regularYieldBearingOrders, {\n    isNegRisk: false,\n    isYieldBearing: true,\n  });\n  const negRiskYieldBearingResult = await orderBuilder.cancelOrders(negRiskYieldBearingOrders, {\n    isNegRisk: true,\n    isYieldBearing: true,\n  });\n\n  // Check for the transactions success\n  const success =\n    regResult.success && negRiskResult.success && regYieldBearingResult.success && negRiskYieldBearingResult.success;\n}\n```\n\n## License\n\nBy contributing to this project, you agree that your contributions will be licensed under the project's [MIT License](./LICENSE).\n","readmeFilename":"README.md"}