https://github.com/generationsoftware/pt-v5-utils-js-beta
You probably want GenerationSoftware/pt-v5-utils-js - this is an archived beta package for the old beta contracts!
https://github.com/generationsoftware/pt-v5-utils-js-beta
Last synced: 9 months ago
JSON representation
You probably want GenerationSoftware/pt-v5-utils-js - this is an archived beta package for the old beta contracts!
- Host: GitHub
- URL: https://github.com/generationsoftware/pt-v5-utils-js-beta
- Owner: GenerationSoftware
- License: mit
- Created: 2023-10-22T16:09:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-22T16:14:05.000Z (over 2 years ago)
- Last Synced: 2023-10-22T17:27:20.427Z (over 2 years ago)
- Language: TypeScript
- Homepage:
- Size: 271 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🧰 Javascript Utility Library - PoolTogether V5
[📖 Documentation](https://v4.docs.pooltogether.com/protocol/next/introduction)
## Compute
The `@pooltogether/v5-utils-js` [node module package](https://www.npmjs.com/package/@pooltogether/v5-utils-js) provides computations for the PoolTogether v5 protocol.
High-order operations like processing subgraphs and chain state (draws, winners, etc..) is included in the `compute` namespaced functions.
**🖥️ Computations:**
Consume subgraph and protocol chain state to return computed outcomes:
- [computeDrawWinners](docs/md/modules.md#computedrawwinners)
[Create Issue](https://github.com/pooltogether/v5-utils-js/issues) to request new features.
[Open Pull Request](#) adhering to Contribution guidelines.
# 💾 Installation
This project is available as an NPM package:
```sh
npm install @pooltogether/v5-utils-js
```
```sh
yarn add @pooltogether/v5-utils-js
```
The repo can be cloned from Github for contributions.
```sh
git clone https://github.com/pooltogether/v5-utils-js
```
# 🏆 Quickstart (Contracts Blob)
Getting the list of contracts for a specific network is easy using the `downloadContractsBlob(chainId)` function.
Currently supports:
- Optimism Goerli (testnet)
- Goerli (testnet)
```ts
import { downloadContractsBlob } from "@pooltogether/v5-utils-js";
async function main() {
const contracts = await downloadContractsBlob(chainId);
}
main();
```
# 🏆 Quickstart (Draw Results)
`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.
```ts
import { computeDrawWinners } from "@pooltogether/v5-utils-js";
// Compute Winners for the last Draw
const winners = computeDrawWinners(provider, contracts, chainId);
// Returns Claim[]:
//
// interface Claim {
// vault: string;
// winner: string;
// tier: number;
// prizeIndex: number;
// claimed?: boolean;
// }
//
```