{"id":20030817,"url":"https://github.com/generationsoftware/pt-v5-utils-js-beta","last_synced_at":"2025-05-05T03:33:06.877Z","repository":{"id":202937476,"uuid":"708456689","full_name":"GenerationSoftware/pt-v5-utils-js-beta","owner":"GenerationSoftware","description":"You probably want GenerationSoftware/pt-v5-utils-js - this is an archived beta package for the old beta contracts!","archived":false,"fork":false,"pushed_at":"2023-10-22T16:14:05.000Z","size":277,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-10-22T17:27:20.427Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GenerationSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-22T16:09:37.000Z","updated_at":"2023-10-22T17:27:23.228Z","dependencies_parsed_at":null,"dependency_job_id":"b73320b3-cc29-43e5-8fa6-06240d47c6e4","html_url":"https://github.com/GenerationSoftware/pt-v5-utils-js-beta","commit_stats":null,"previous_names":["generationsoftware/pt-v5-utils-js-beta"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fpt-v5-utils-js-beta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fpt-v5-utils-js-beta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fpt-v5-utils-js-beta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerationSoftware%2Fpt-v5-utils-js-beta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GenerationSoftware","download_url":"https://codeload.github.com/GenerationSoftware/pt-v5-utils-js-beta/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224423325,"owners_count":17308690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T09:28:29.052Z","updated_at":"2024-11-13T09:28:29.958Z","avatar_url":"https://github.com/GenerationSoftware.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/GenerationSoftware/pt-v5-utils-js/main/img/pooltogether-logo--purple@2x.png?raw=true\" alt=\"PoolTogether Brand\" style=\"max-width:100%;\" width=\"300\"\u003e\n\u003c/p\u003e\n\n\u003cbr /\u003e\n\n# 🧰 Javascript Utility Library - PoolTogether V5\n\n[📖 Documentation](https://v4.docs.pooltogether.com/protocol/next/introduction)\n\n## Compute\n\nThe `@pooltogether/v5-utils-js` [node module package](https://www.npmjs.com/package/@pooltogether/v5-utils-js) provides computations for the PoolTogether v5 protocol.\n\nHigh-order operations like processing subgraphs and chain state (draws, winners, etc..) is included in the `compute` namespaced functions.\n\n**🖥️ Computations:**\n\nConsume subgraph and protocol chain state to return computed outcomes:\n\n- [computeDrawWinners](docs/md/modules.md#computedrawwinners)\n\n[Create Issue](https://github.com/pooltogether/v5-utils-js/issues) to request new features.\u003cbr/\u003e[Open Pull Request](#) adhering to Contribution guidelines.\n\n# 💾 Installation\n\nThis project is available as an NPM package:\n\n```sh\nnpm install @pooltogether/v5-utils-js\n```\n\n```sh\nyarn add @pooltogether/v5-utils-js\n```\n\nThe repo can be cloned from Github for contributions.\n\n```sh\ngit clone https://github.com/pooltogether/v5-utils-js\n```\n\n# 🏆 Quickstart (Contracts Blob)\n\nGetting the list of contracts for a specific network is easy using the `downloadContractsBlob(chainId)` function.\n\nCurrently supports:\n\n- Optimism Goerli (testnet)\n- Goerli (testnet)\n\n```ts\nimport { downloadContractsBlob } from \"@pooltogether/v5-utils-js\";\n\nasync function main() {\n  const contracts = await downloadContractsBlob(chainId);\n}\nmain();\n```\n\n# 🏆 Quickstart (Draw Results)\n\n`computeDrawWinners(provider, contracts, chainId)` computes and returns a JSON blob of all previous draw winner's Claim objects for each tier of a prize pool, grouped by vault.\n\n```ts\nimport { computeDrawWinners } from \"@pooltogether/v5-utils-js\";\n\n// Compute Winners for the last Draw\nconst winners = computeDrawWinners(provider, contracts, chainId);\n\n// Returns Claim[]:\n//\n// interface Claim {\n//   vault: string;\n//   winner: string;\n//   tier: number;\n//   prizeIndex: number;\n//   claimed?: boolean;\n// }\n//\n```\n\n\u003c!--\n# 📖 Documentation\n\n### Namespaces\n\n- [compute](docs/md/modules/compute.md)\n- [utils](docs/md/modules/utils.md) --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerationsoftware%2Fpt-v5-utils-js-beta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenerationsoftware%2Fpt-v5-utils-js-beta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerationsoftware%2Fpt-v5-utils-js-beta/lists"}