{"_id":"@0g-brier/protocol","_rev":"3-8319223407c8362f4102ddd29ec5ff49","name":"@0g-brier/protocol","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@0g-brier/protocol","version":"0.1.0","keywords":["prediction-market","dpm","parimutuel","0g","defi"],"author":{"name":"0g-brier"},"license":"MIT","_id":"@0g-brier/protocol@0.1.0","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"dist":{"shasum":"261c0c25a949076b25c9ab2ea2ca3a99482a8bfa","tarball":"https://registry.npmjs.org/@0g-brier/protocol/-/protocol-0.1.0.tgz","fileCount":38,"integrity":"sha512-sSRRELEwY5Y5sYFzfQYEHBRlL4NVf9xJjEgnLTMr1szzIQUa+EPs7sw4nsx69vrEHhaY5hmUl6lKA8rYSEDFrw==","signatures":[{"sig":"MEUCIQCKXv4aHc/+P8gWN00vX4Rh2zwXTe67AlTkGO29vHk0PgIgIl2sgziXSqdzHtgwbTrys4o6vUfhjOgFeCwhbJqMsKU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40638},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./node":{"types":"./dist/deployments.node.d.ts","import":"./dist/deployments.node.js","default":"./dist/deployments.node.js"}},"gitHead":"0e4fda9535b37bcd6299164d322601ddeacab73f","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc --noEmit","gen:vectors":"tsx scripts/gen-vectors.ts"},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/protocol"},"_npmVersion":"10.9.8","description":"The Dynamic Pari-mutuel Market maths behind Brier, in TypeScript — pricing, quoting, units and deployment manifests.","directories":{},"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^3.0.5","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/protocol_0.1.0_1787972541146_0.6037424455880396","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@0g-brier/protocol","version":"0.2.0","keywords":["prediction-market","dpm","parimutuel","0g","defi"],"author":{"name":"0g-brier"},"license":"MIT","_id":"@0g-brier/protocol@0.2.0","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"dist":{"shasum":"cdd3dabc554966e4b4d1f1de0898bd1c3de3b15d","tarball":"https://registry.npmjs.org/@0g-brier/protocol/-/protocol-0.2.0.tgz","fileCount":38,"integrity":"sha512-dF2iL5ZQprttuhhwyDfibd+uktI0KQB3t46w1rercfLhtFUysIDfAs/aLTJuOBJURjmPeQVvv0JuSMr7CNCUpQ==","signatures":[{"sig":"MEYCIQDpWCjS9rn4mXEY6GuU80owPV329fu3CwNw+Ok8ze7/jQIhAPafG2Ye0pPFzCz7VmXy++XUO4bqZ2UuoIczj8fMc091","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIDSK7xG8UdVmqf0Un2c263JNFGigZ7xRT90MaG37JvuQAiEAmJ4HsifHqmb8iO1S1jpFGJCpYUe6dAIxnzYohgm+bLE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45075},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./node":{"types":"./dist/deployments.node.d.ts","import":"./dist/deployments.node.js","default":"./dist/deployments.node.js"}},"gitHead":"d8733db9aa0fbfe3da0d8bf177b355e5b752e8e5","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc --noEmit","gen:vectors":"tsx scripts/gen-vectors.ts"},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/protocol"},"_npmVersion":"10.9.8","description":"The Dynamic Pari-mutuel Market maths behind Brier, in TypeScript — pricing, quoting, units and deployment manifests.","directories":{},"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^3.0.5","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/protocol_0.2.0_1788250303247_0.610052899918595","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"_id":"@0g-brier/protocol@0.2.1","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"dist":{"shasum":"c87bffa746dd0f7b915b96667f43a35daf052b49","tarball":"https://registry.npmjs.org/@0g-brier/protocol/-/protocol-0.2.1.tgz","fileCount":38,"integrity":"sha512-rxn3EED61RZ7MNwfV63dhyCNtRBVn+UAzqkWMqpL/frKtuCKMyFnx9KdWrzP4D6Xra581nQdy/GZ2KP530TDpg==","signatures":[{"sig":"MEQCIF+fNiB+eD3j9UXq0QjJjSaXA3oSOzaielTPy3EIKY2PAiAd/4SE4mvsyNxtc/wAQ7QvqBXvAQvE2gD9uwPoiuKtiQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBYuv9eSz0uYEyuR3a2ya3K7rBRbyQ6pwOO6P8PBT6y5AiAA1rGaznW943xCBcgLWQGA0cXhgufa1PZHhNXshrOavA=="}],"unpackedSize":45089},"main":"./dist/index.js","name":"@0g-brier/protocol","type":"module","types":"./dist/index.d.ts","author":{"name":"0g-brier"},"engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./node":{"types":"./dist/deployments.node.d.ts","import":"./dist/deployments.node.js","default":"./dist/deployments.node.js"}},"gitHead":"9ef884348561f41360908bdda7f3ec9e8e6db048","license":"MIT","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc --noEmit","gen:vectors":"tsx scripts/gen-vectors.ts"},"version":"0.2.1","_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"homepage":"https://github.com/hevDev7/0g-brier#readme","keywords":["prediction-market","dpm","parimutuel","0g","defi"],"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/protocol"},"_npmVersion":"10.9.8","description":"The Dynamic Pari-mutuel Market maths behind Brier, in TypeScript — pricing, quoting, units and deployment manifests.","directories":{},"maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","vitest":"^3.0.5","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/protocol_0.2.1_1788259962795_0.9393428203014689"}}},"time":{"created":"2026-08-29T03:02:20.940Z","modified":"2026-09-01T10:52:43.035Z","0.1.0":"2026-08-29T03:02:21.296Z","0.2.0":"2026-09-01T08:11:43.361Z","0.2.1":"2026-09-01T10:52:42.883Z"},"bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"author":{"name":"0g-brier"},"license":"MIT","homepage":"https://github.com/hevDev7/0g-brier#readme","keywords":["prediction-market","dpm","parimutuel","0g","defi"],"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/protocol"},"description":"The Dynamic Pari-mutuel Market maths behind Brier, in TypeScript — pricing, quoting, units and deployment manifests.","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"readme":"# @0g-brier/protocol\n\nThe Dynamic Pari-mutuel Market maths behind [Brier](https://github.com/hevDev7/0g-brier),\nin TypeScript. A mirror of the Solidity library, pinned to it by vectors generated\nfrom the contracts themselves — a mirror is only worth having if something fails\nwhen it drifts.\n\n```bash\nnpm i @0g-brier/protocol\n```\n\n```ts\nimport {dpm, WAD, networkFor} from \"@0g-brier/protocol\";\n\nconst q: readonly [bigint, bigint] = [1000n * WAD, 1200n * WAD]; // [NO, YES]\n\ndpm.probability(q, 1); // 0.590… — P(YES)\ndpm.price(q, 1);       // 0.768… — the marginal PRICE per share\n```\n\n**Those are different numbers, and confusing them is the mistake this package\nexists to prevent.** The implied probability is `pᵢ²`; the marginal price is `pᵢ`.\nA price shown with a `%` sign is a lie about the instrument.\n\nA winning share pays `1/pᵢ`, funded entirely by the pool — so every later buyer on\nyour side dilutes you, including your own next order. `dpm.costUp`, `sharesForSpend`\nand `quote` size a trade against that.\n\nDeployment manifests load through the `./node` entry point:\n\n```ts\nimport {loadDeployment} from \"@0g-brier/protocol/node\";\nconst {contracts} = loadDeployment(16661, \"./deployments\"); // 0G mainnet\n```\n\nMIT.\n","readmeFilename":"README.md"}