diff --git a/docs/README.md b/DOCUMENTATION.md similarity index 75% rename from docs/README.md rename to DOCUMENTATION.md index a275345..dff130f 100644 --- a/docs/README.md +++ b/DOCUMENTATION.md @@ -1,47 +1,45 @@ -@pooltogether/v4-client-js / [Exports](modules.md) +# Client Library -@pooltogether/v4-client-js / [Exports](modules.md) - -@pooltogether/v4-client-js / [Exports](modules.md) - -@pooltogether/v4-client-js / [Exports](modules.md) - -@pooltogether/v4-client-js / [Exports](modules.md) - -# 💻 PoolTogether Client Library || PoolTogether V4 - -![npm](https://img.shields.io/npm/v/@pooltogether/v4-client-js) -![ts](https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555) ![Tests](https://github.com/pooltogether/v4-client-js/actions/workflows/main.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/pooltogether/v4-client-js/badge.svg?branch=main)](https://coveralls.io/github/pooltogether/v4-client-js?branch=main) +![ts](https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555) [![MIT license](https://img.shields.io/npm/l/@pooltogether/v4-client-js)](https://img.shields.io/npm/l/@pooltogether/v4-client-js) - -Brand - -[Application](https://app.pooltogether.com/) | [Contracts](https://github.com/pooltogether/v4-core) | [Documentation](https://v4.docs.pooltogether.com/) | [Draw Calculator](https://github.com/pooltogether/draw-calculator-cli) | [Utility Library](https://github.com/pooltogether/v4-utils-js) | [Static Cache](https://github.com/pooltogether/v4-draw-results) - -# 🏆 Quickstart +![npm](https://img.shields.io/npm/v/@pooltogether/v4-client-js) +[![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://pooltogether.com/discord) This library includes a simplified interface for interacting with a v4 PoolTogether deployment. Create an instance of `PrizePoolNetwork` and use the initialized `PrizePool` and `PrizeDistributor` to begin reading and writing data to the protocol. -There are several classes that provide interfaces to the different aspects of the V4 PoolTogether protocol. +There are several classes that provide interfaces to the different aspects of the V4 PoolTogether protocol. `PrizePoolNetwork` is the main entry point. A full tutorial is available [here](/protocol/tutorials/js-client-quickstart/) - [PrizePoolNetwork](./classes/PrizePoolNetwork.md) + - [PrizePool](./classes/PrizePool.md) - [User](./classes/User.md) - [PrizeDistributor](./classes/PrizeDistributor.md) - [DrawCalculatorApi](./classes/DrawCalculatorApi.md) - [ContractFactory](./classes/ContractFactory.md) -## 💾 Installation +## 💾   Installation This project is available as an NPM package: -```bash +```sh +npm install @pooltogether/v4-utils-js +``` + +or + +```sh yarn add @pooltogether/v4-client-js ``` -## 🌱 Initialization +The repo can be cloned from Github for contributions. + +```sh +git clone https://github.com/pooltogether/v4-client-js.git +``` + +## 🏎️   Quickstart ### PrizePoolNetwork @@ -93,7 +91,7 @@ const signerPrizeDistributor = new PrizeDistributor( ) ``` -## Examples +## 🧮   Examples ### Get token data for a Prize Pool @@ -180,29 +178,3 @@ NOTE: Ensure the `PrizeDistributor` was initialized with a `Signer` ```js const txResponse: TransactionResponse = await prizeDistributor.claimPrizesByDraw(1) ``` - -## 💻 Developer Experience - -### Contributing - -[Create an Issue](https://github.com/pooltogether/v4-utils-js/issues) to request new features. - -[Open Pull Request](#) adhering to Contribution guidelines. - -The package is setup using the [TSDX zero-config CLI](https://tsdx.io/) which includes: - -- Typescript -- Rollup -- Jest -- Prettier -- ESLint - -**Minor changes have been made to extend the default configuration.** - -#### ESLint - -The TSDX linting configuration is overwritten to include override(s)\* for: - -- Import/Order (used to enforce consistent module import ordering) - -###### \*The ESLint overrides may incorrectly be interpreted by VSCode since the nested config file is ignored in the IDE diff --git a/README.md b/README.md index d5f1168..189e601 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,56 @@ -# 💻 PoolTogether Client Library || PoolTogether V4 +

+ + PoolTogether Brand + +

+ +
+ +# 💻   PoolTogether Client Library || PoolTogether V4 -![npm](https://img.shields.io/npm/v/@pooltogether/v4-client-js) -![ts](https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555) ![Tests](https://github.com/pooltogether/v4-client-js/actions/workflows/main.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/pooltogether/v4-client-js/badge.svg?branch=main)](https://coveralls.io/github/pooltogether/v4-client-js?branch=main) +![ts](https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555) [![MIT license](https://img.shields.io/npm/l/@pooltogether/v4-client-js)](https://img.shields.io/npm/l/@pooltogether/v4-client-js) - -Brand +![npm](https://img.shields.io/npm/v/@pooltogether/v4-client-js) [Application](https://app.pooltogether.com/) | [Contracts](https://github.com/pooltogether/v4-core) | [Documentation](https://v4.docs.pooltogether.com/) | [Draw Calculator](https://github.com/pooltogether/draw-calculator-cli) | [Utility Library](https://github.com/pooltogether/v4-utils-js) | [Static Cache](https://github.com/pooltogether/v4-draw-results) -# 🏆 Quickstart +# 🏆   Overview This library includes a simplified interface for interacting with a v4 PoolTogether deployment. Create an instance of `PrizePoolNetwork` and use the initialized `PrizePool` and `PrizeDistributor` to begin reading and writing data to the protocol. -There are several classes that provide interfaces to the different aspects of the V4 PoolTogether protocol. +There are several classes that provide interfaces to the different aspects of the V4 PoolTogether protocol. `PrizePoolNetwork` is the main entry point. - [PrizePoolNetwork](./classes/PrizePoolNetwork.md) + - [PrizePool](./classes/PrizePool.md) - [User](./classes/User.md) - [PrizeDistributor](./classes/PrizeDistributor.md) - [DrawCalculatorApi](./classes/DrawCalculatorApi.md) - [ContractFactory](./classes/ContractFactory.md) -## 💾 Installation +## 💾   Installation This project is available as an NPM package: -```bash +```sh +npm install @pooltogether/v4-utils-js +``` + +or + +```sh yarn add @pooltogether/v4-client-js ``` -## 🌱 Initialization +The repo can be cloned from Github for contributions. + +```sh +git clone https://github.com/pooltogether/v4-client-js.git +``` + +## 🏎️   Quickstart ### PrizePoolNetwork @@ -83,7 +102,7 @@ const signerPrizeDistributor = new PrizeDistributor( ) ``` -## Examples +## 🧮   Examples ### Get token data for a Prize Pool @@ -171,7 +190,7 @@ NOTE: Ensure the `PrizeDistributor` was initialized with a `Signer` const txResponse: TransactionResponse = await prizeDistributor.claimPrizesByDraw(1) ``` -## 💻 Developer Experience +## 💻   Developer Experience ### Contributing diff --git a/docs/.nojekyll b/docs/.nojekyll deleted file mode 100644 index e2ac661..0000000 --- a/docs/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/classes/ContractFactory.md b/docs/classes/ContractFactory.md deleted file mode 100644 index cbc738e..0000000 --- a/docs/classes/ContractFactory.md +++ /dev/null @@ -1,173 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / ContractFactory - -# Class: ContractFactory - -An ethers Contract Factory. -Given a ContractList, the ContractFactory will initialize ethers Contracts and easily provide Providers or Signers. - -## Table of contents - -### Constructors - -- [constructor](ContractFactory.md#constructor) - -### Properties - -- [contractList](ContractFactory.md#contractlist) -- [signersOrProviders](ContractFactory.md#signersorproviders) - -### Methods - -- [getContract](ContractFactory.md#getcontract) -- [getContractList](ContractFactory.md#getcontractlist) -- [getContracts](ContractFactory.md#getcontracts) -- [getSignerOrProvider](ContractFactory.md#getsignerorprovider) -- [getSignersOrProviders](ContractFactory.md#getsignersorproviders) - -## Constructors - -### constructor - -• **new ContractFactory**(`signersOrProviders`, `contractList`) - -Create an instance of a ContractFactory by providing Signers or Providers keyed by their chain ids and a list of contract metadata. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `signersOrProviders` | [`SignersOrProviders`](../interfaces/SignersOrProviders.md) | signers or providers keyed by their chain ids | -| `contractList` | [`ContractList`](../interfaces/ContractList.md) | a list of contract metadata | - -#### Defined in - -[src/ContractFactory.ts:25](https://github.com/pooltogether/v4-client-js/blob/7357147/src/ContractFactory.ts#L25) - -## Properties - -### contractList - -• `Readonly` **contractList**: [`ContractList`](../interfaces/ContractList.md) - -#### Defined in - -[src/ContractFactory.ts:17](https://github.com/pooltogether/v4-client-js/blob/7357147/src/ContractFactory.ts#L17) - -___ - -### signersOrProviders - -• `Readonly` **signersOrProviders**: [`SignersOrProviders`](../interfaces/SignersOrProviders.md) - -#### Defined in - -[src/ContractFactory.ts:16](https://github.com/pooltogether/v4-client-js/blob/7357147/src/ContractFactory.ts#L16) - -## Methods - -### getContract - -▸ **getContract**(`chainId`, `address`): `Contract` - -Creates an ethers Contract for the contract identifier provided using the ContractList and Signers or Providers provided on initialization. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `chainId` | `number` | the chain id the contract was deployed on | -| `address` | `string` | the address of the contract to create | - -#### Returns - -`Contract` - -an ethers contract for the provided contract identifier - -#### Defined in - -[src/ContractFactory.ts:40](https://github.com/pooltogether/v4-client-js/blob/7357147/src/ContractFactory.ts#L40) - -___ - -### getContractList - -▸ **getContractList**(): [`ContractList`](../interfaces/ContractList.md) - -Getter for the ContractList provided on initialization. - -#### Returns - -[`ContractList`](../interfaces/ContractList.md) - -the contract list the contract factory was initialized with - -#### Defined in - -[src/ContractFactory.ts:87](https://github.com/pooltogether/v4-client-js/blob/7357147/src/ContractFactory.ts#L87) - -___ - -### getContracts - -▸ **getContracts**(`contractIdentifiers`): `Contract`[] - -Creates multiple ethers Contracts for the identifiers provided using the ContractList and Signers or Providers provided on initialization. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `contractIdentifiers` | [`ContractIdentifier`](../interfaces/ContractIdentifier.md)[] | a list of unique identifiers for contracts to create | - -#### Returns - -`Contract`[] - -a list of ethers contracts for the provided conract identifiers - -#### Defined in - -[src/ContractFactory.ts:58](https://github.com/pooltogether/v4-client-js/blob/7357147/src/ContractFactory.ts#L58) - -___ - -### getSignerOrProvider - -▸ **getSignerOrProvider**(`chainId`): `Signer` \| `Provider` - -Gets a Signer or Provider for the chain id requested from the Signers or Providers prodiced on initialization. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `chainId` | `number` | the chain id to get a signer or provider for | - -#### Returns - -`Signer` \| `Provider` - -the signer or provider for the chain id requested - -#### Defined in - -[src/ContractFactory.ts:71](https://github.com/pooltogether/v4-client-js/blob/7357147/src/ContractFactory.ts#L71) - -___ - -### getSignersOrProviders - -▸ **getSignersOrProviders**(): [`SignersOrProviders`](../interfaces/SignersOrProviders.md) - -Getter for the Signers or Providers provided on initialization. - -#### Returns - -[`SignersOrProviders`](../interfaces/SignersOrProviders.md) - -the signers or providers the contract factory was initialized with - -#### Defined in - -[src/ContractFactory.ts:79](https://github.com/pooltogether/v4-client-js/blob/7357147/src/ContractFactory.ts#L79) diff --git a/docs/classes/PrizeApi.md b/docs/classes/PrizeApi.md deleted file mode 100644 index 5f8320f..0000000 --- a/docs/classes/PrizeApi.md +++ /dev/null @@ -1,177 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / PrizeApi - -# Class: PrizeApi - -PoolTogether Prize API. -Provides easy access to PoolTogether Prize APIs. - -## Table of contents - -### Constructors - -- [constructor](PrizeApi.md#constructor) - -### Methods - -- [checkPrizeApiStatus](PrizeApi.md#checkprizeapistatus) -- [getCloudFlareDrawResultsUrl](PrizeApi.md#getcloudflaredrawresultsurl) -- [getDrawResultsStatusUrl](PrizeApi.md#getdrawresultsstatusurl) -- [getDrawResultsUrl](PrizeApi.md#getdrawresultsurl) -- [getUsersDrawResultsByDraw](PrizeApi.md#getusersdrawresultsbydraw) -- [getUsersDrawResultsByDraws](PrizeApi.md#getusersdrawresultsbydraws) - -## Constructors - -### constructor - -• **new PrizeApi**() - -## Methods - -### checkPrizeApiStatus - -▸ `Static` **checkPrizeApiStatus**(`chainId`, `prizeDistributorAddress`, `drawId`): `Promise`<`boolean`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chainId` | `number` | -| `prizeDistributorAddress` | `string` | -| `drawId` | `number` | - -#### Returns - -`Promise`<`boolean`\> - -#### Defined in - -src/PrizeApi.ts:99 - -___ - -### getCloudFlareDrawResultsUrl - -▸ `Static` **getCloudFlareDrawResultsUrl**(`chainId`, `prizeDistributorAddress`, `usersAddress`, `drawId`): `string` - -Returns the URL that the prizes can be calculated at on CloudFlare - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chainId` | `number` | -| `prizeDistributorAddress` | `string` | -| `usersAddress` | `string` | -| `drawId` | `number` | - -#### Returns - -`string` - -#### Defined in - -src/PrizeApi.ts:166 - -___ - -### getDrawResultsStatusUrl - -▸ `Static` **getDrawResultsStatusUrl**(`chainId`, `prizeDistributorAddress`, `drawId`): `string` - -Returns the URL for the status of the calculations for the draw requested from the Prize API - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chainId` | `number` | -| `prizeDistributorAddress` | `string` | -| `drawId` | `number` | - -#### Returns - -`string` - -#### Defined in - -src/PrizeApi.ts:148 - -___ - -### getDrawResultsUrl - -▸ `Static` **getDrawResultsUrl**(`chainId`, `prizeDistributorAddress`, `usersAddress`, `drawId`): `string` - -Returns the URL for pre-calculated prizes from the Prize API -TODO: Fix the casing functions once Kames fixes the bug - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chainId` | `number` | -| `prizeDistributorAddress` | `string` | -| `usersAddress` | `string` | -| `drawId` | `number` | - -#### Returns - -`string` - -#### Defined in - -src/PrizeApi.ts:129 - -___ - -### getUsersDrawResultsByDraw - -▸ `Static` **getUsersDrawResultsByDraw**(`chainId`, `usersAddress`, `prizeDistributorAddress`, `drawId`, `maxPicksPerUser`): `Promise`<[`DrawResults`](../modules.md#drawresults)\> - -Fetches a users DrawResults for the provided draw id - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `chainId` | `number` | the chain id the PrizeDistributor is deployed on | -| `usersAddress` | `string` | the address of the user to fetch draw results for | -| `prizeDistributorAddress` | `string` | the address of the PrizeDistributor to fetch prizes for | -| `drawId` | `number` | the id of the draw to check | -| `maxPicksPerUser` | `number` | the maximum number of picks per user | - -#### Returns - -`Promise`<[`DrawResults`](../modules.md#drawresults)\> - -#### Defined in - -src/PrizeApi.ts:21 - -___ - -### getUsersDrawResultsByDraws - -▸ `Static` **getUsersDrawResultsByDraws**(`chainId`, `usersAddress`, `prizeDistributorAddress`, `drawIds`, `maxPicksPerUser`): `Promise`<{ [drawId: number]: [`DrawResults`](../modules.md#drawresults); }\> - -Fetches a users DrawResults for the provided draw ids. -Checks the status of the Prize API, falls back to the CloudFlare worker if Prize API status is invalid. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `chainId` | `number` | the chain id the PrizeDistributor is deployed on | -| `usersAddress` | `string` | the address of the user to fetch draw results for | -| `prizeDistributorAddress` | `string` | the address of the PrizeDistributor to fetch prizes for | -| `drawIds` | `number`[] | a list of draw ids to check for prizes | -| `maxPicksPerUser` | `number` | the maximum number of picks per user | - -#### Returns - -`Promise`<{ [drawId: number]: [`DrawResults`](../modules.md#drawresults); }\> - -#### Defined in - -src/PrizeApi.ts:47 diff --git a/docs/classes/PrizeDistributor.md b/docs/classes/PrizeDistributor.md deleted file mode 100644 index 8b892bb..0000000 --- a/docs/classes/PrizeDistributor.md +++ /dev/null @@ -1,919 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / PrizeDistributor - -# Class: PrizeDistributor - -A Prize Distributor. -Provides access to the contracts for viewing expiration times on draws, timelock timers and checking/claiming prizes for a user. Can be instantiated with an ethers Signer or Provider. Use a Signer if you want to claim transactions for a user. If a provider is provided, only read methods are available. - -## Table of contents - -### Constructors - -- [constructor](PrizeDistributor.md#constructor) - -### Properties - -- [address](PrizeDistributor.md#address) -- [chainId](PrizeDistributor.md#chainid) -- [contractMetadataList](PrizeDistributor.md#contractmetadatalist) -- [drawBufferContract](PrizeDistributor.md#drawbuffercontract) -- [drawBufferMetadata](PrizeDistributor.md#drawbuffermetadata) -- [drawCalculatorContract](PrizeDistributor.md#drawcalculatorcontract) -- [drawCalculatorMetadata](PrizeDistributor.md#drawcalculatormetadata) -- [drawCalculatorTimelockContract](PrizeDistributor.md#drawcalculatortimelockcontract) -- [drawCalculatorTimelockMetadata](PrizeDistributor.md#drawcalculatortimelockmetadata) -- [prizeDistributionsBufferContract](PrizeDistributor.md#prizedistributionsbuffercontract) -- [prizeDistributionsBufferMetadata](PrizeDistributor.md#prizedistributionsbuffermetadata) -- [prizeDistributorContract](PrizeDistributor.md#prizedistributorcontract) -- [prizeDistributorMetadata](PrizeDistributor.md#prizedistributormetadata) -- [signerOrProvider](PrizeDistributor.md#signerorprovider) -- [tokenContract](PrizeDistributor.md#tokencontract) -- [tokenMetadata](PrizeDistributor.md#tokenmetadata) - -### Methods - -- [calculateUsersPrizes](PrizeDistributor.md#calculateusersprizes) -- [calculateUsersPrizesByDrawId](PrizeDistributor.md#calculateusersprizesbydrawid) -- [claimPrizesAcrossMultipleDrawsByDrawResults](PrizeDistributor.md#claimprizesacrossmultipledrawsbydrawresults) -- [claimPrizesByDraw](PrizeDistributor.md#claimprizesbydraw) -- [claimPrizesByDrawResults](PrizeDistributor.md#claimprizesbydrawresults) -- [getAndSetEthersContract](PrizeDistributor.md#getandsetetherscontract) -- [getDraw](PrizeDistributor.md#getdraw) -- [getDrawBufferContract](PrizeDistributor.md#getdrawbuffercontract) -- [getDrawCalculatorContract](PrizeDistributor.md#getdrawcalculatorcontract) -- [getDrawIdsFromDrawBuffer](PrizeDistributor.md#getdrawidsfromdrawbuffer) -- [getDrawIdsFromPrizeDistributionBuffer](PrizeDistributor.md#getdrawidsfromprizedistributionbuffer) -- [getDraws](PrizeDistributor.md#getdraws) -- [getDrawsAndPrizeDistributions](PrizeDistributor.md#getdrawsandprizedistributions) -- [getNewestDraw](PrizeDistributor.md#getnewestdraw) -- [getNewestPrizeDistribution](PrizeDistributor.md#getnewestprizedistribution) -- [getOldestDraw](PrizeDistributor.md#getoldestdraw) -- [getOldestPrizeDistribution](PrizeDistributor.md#getoldestprizedistribution) -- [getPrizeDistribution](PrizeDistributor.md#getprizedistribution) -- [getPrizeDistributions](PrizeDistributor.md#getprizedistributions) -- [getPrizeDistributionsBufferContract](PrizeDistributor.md#getprizedistributionsbuffercontract) -- [getTimelockDrawId](PrizeDistributor.md#gettimelockdrawid) -- [getTokenContract](PrizeDistributor.md#gettokencontract) -- [getTokenData](PrizeDistributor.md#gettokendata) -- [getUsersAddress](PrizeDistributor.md#getusersaddress) -- [getUsersClaimedAmount](PrizeDistributor.md#getusersclaimedamount) -- [getUsersClaimedAmounts](PrizeDistributor.md#getusersclaimedamounts) -- [getUsersNormalizedBalancesForDrawIds](PrizeDistributor.md#getusersnormalizedbalancesfordrawids) -- [getValidDrawIds](PrizeDistributor.md#getvaliddrawids) -- [id](PrizeDistributor.md#id) -- [validateIsSigner](PrizeDistributor.md#validateissigner) -- [validateSignerNetwork](PrizeDistributor.md#validatesignernetwork) - -## Constructors - -### constructor - -• **new PrizeDistributor**(`prizeDistributorMetadata`, `signerOrProvider`, `contractMetadataList`) - -Create an instance of a PrizeDistributor by providing the metadata of the PrizeDistributor contract, an ethers Provider or Signer for the network the PrizeDistributor contract is deployed on and a list of contract metadata for the other contracts that make up the PrizeDistributor. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `prizeDistributorMetadata` | [`Contract`](../interfaces/Contract.md) | -| `signerOrProvider` | `Signer` \| `Provider` | -| `contractMetadataList` | [`Contract`](../interfaces/Contract.md)[] | - -#### Defined in - -[src/PrizeDistributor.ts:67](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L67) - -## Properties - -### address - -• `Readonly` **address**: `string` - -#### Defined in - -[src/PrizeDistributor.ts:43](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L43) - -___ - -### chainId - -• `Readonly` **chainId**: `number` - -#### Defined in - -[src/PrizeDistributor.ts:42](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L42) - -___ - -### contractMetadataList - -• `Readonly` **contractMetadataList**: [`Contract`](../interfaces/Contract.md)[] - -#### Defined in - -[src/PrizeDistributor.ts:40](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L40) - -___ - -### drawBufferContract - -• **drawBufferContract**: `undefined` \| `Contract` - -#### Defined in - -[src/PrizeDistributor.ts:57](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L57) - -___ - -### drawBufferMetadata - -• **drawBufferMetadata**: `undefined` \| [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizeDistributor.ts:49](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L49) - -___ - -### drawCalculatorContract - -• **drawCalculatorContract**: `undefined` \| `Contract` - -#### Defined in - -[src/PrizeDistributor.ts:56](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L56) - -___ - -### drawCalculatorMetadata - -• **drawCalculatorMetadata**: `undefined` \| [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizeDistributor.ts:48](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L48) - -___ - -### drawCalculatorTimelockContract - -• `Readonly` **drawCalculatorTimelockContract**: `Contract` - -#### Defined in - -[src/PrizeDistributor.ts:55](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L55) - -___ - -### drawCalculatorTimelockMetadata - -• `Readonly` **drawCalculatorTimelockMetadata**: [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizeDistributor.ts:47](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L47) - -___ - -### prizeDistributionsBufferContract - -• **prizeDistributionsBufferContract**: `undefined` \| `Contract` - -#### Defined in - -[src/PrizeDistributor.ts:58](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L58) - -___ - -### prizeDistributionsBufferMetadata - -• **prizeDistributionsBufferMetadata**: `undefined` \| [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizeDistributor.ts:50](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L50) - -___ - -### prizeDistributorContract - -• `Readonly` **prizeDistributorContract**: `Contract` - -#### Defined in - -[src/PrizeDistributor.ts:54](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L54) - -___ - -### prizeDistributorMetadata - -• `Readonly` **prizeDistributorMetadata**: [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizeDistributor.ts:46](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L46) - -___ - -### signerOrProvider - -• `Readonly` **signerOrProvider**: `Signer` \| `Provider` - -#### Defined in - -[src/PrizeDistributor.ts:41](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L41) - -___ - -### tokenContract - -• **tokenContract**: `undefined` \| `Contract` - -#### Defined in - -[src/PrizeDistributor.ts:59](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L59) - -___ - -### tokenMetadata - -• **tokenMetadata**: `undefined` \| [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizeDistributor.ts:51](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L51) - -## Methods - -### calculateUsersPrizes - -▸ **calculateUsersPrizes**(`usersAddress`, `draw`): `Promise`<[`DrawResults`](../modules.md#drawresults)\> - -Calculates the prizes a user won for a specific Draw. -NOTE: This is computationally expensive and may cause a long delay. It is not recommended to run this on a clients device. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the users address to compute prizes for | -| `draw` | [`Draw`](../interfaces/Draw.md) | the draw to compute prizes for | - -#### Returns - -`Promise`<[`DrawResults`](../modules.md#drawresults)\> - -the results for user for the provided draw - -#### Defined in - -[src/PrizeDistributor.ts:644](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L644) - -___ - -### calculateUsersPrizesByDrawId - -▸ **calculateUsersPrizesByDrawId**(`usersAddress`, `drawId`): `Promise`<[`DrawResults`](../modules.md#drawresults)\> - -Fetches Draw data and calculates the prizes a user won for a specific draw id. -NOTE: This is computationally expensive and may cause a long delay. It is not recommended to run this on a clients device. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the users address to compute prizes for | -| `drawId` | `number` | the draw id for fetch and compute prizes for | - -#### Returns - -`Promise`<[`DrawResults`](../modules.md#drawresults)\> - -the results for user for the provided draw id - -#### Defined in - -[src/PrizeDistributor.ts:689](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L689) - -___ - -### claimPrizesAcrossMultipleDrawsByDrawResults - -▸ **claimPrizesAcrossMultipleDrawsByDrawResults**(`drawResults`, `overrides?`): `Promise`<`TransactionResponse`\> - -Submits a transaction to claim a users prizes across multiple draws -PrizeDistributor must be initialized with a Signer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `drawResults` | `Object` | an object of the users draw results to claim keyed by draw ids | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/PrizeDistributor.ts:180](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L180) - -___ - -### claimPrizesByDraw - -▸ **claimPrizesByDraw**(`draw`, `overrides?`): `Promise`<`TransactionResponse`\> - -Fetches a users prizes for the provided draw and submits a transaction to claim them to the Signer. -PrizeDistributor must be initialized with a Signer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `draw` | [`Draw`](../interfaces/Draw.md) | the draw to claim prizes for | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/PrizeDistributor.ts:129](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L129) - -___ - -### claimPrizesByDrawResults - -▸ **claimPrizesByDrawResults**(`drawResults`, `overrides?`): `Promise`<`TransactionResponse`\> - -Submits a transaction to claim a users prizes -PrizeDistributor must be initialized with a Signer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `drawResults` | [`DrawResults`](../modules.md#drawresults) | the prize results for a user for a specific draw | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/PrizeDistributor.ts:144](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L144) - -___ - -### getAndSetEthersContract - -▸ `Private` **getAndSetEthersContract**(`key`, `contractType`, `getContractAddress`): `Promise`<`Contract`\> - -Fetches a contract address, finds the relevant metadata in the ContractList and creates an ethers Contract for that contract. The ethers Contract is cached on the instance of the PrizeDistributor and is returned immediately if already stored. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `string` | the key for the requested contract to be stored on the PrizeDistributor | -| `contractType` | `ContractType` | the contract name | -| `getContractAddress` | () => `Promise`<`string`\> | a function to fetch the contract address | - -#### Returns - -`Promise`<`Contract`\> - -an ethers Contract for the provided address and contract type - -#### Defined in - -[src/PrizeDistributor.ts:730](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L730) - -___ - -### getDraw - -▸ **getDraw**(`drawId`): `Promise`<[`Draw`](../interfaces/Draw.md)\> - -Fetches a Draw from the DrawBuffer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `drawId` | `number` | the draw id of the Draw to fetch | - -#### Returns - -`Promise`<[`Draw`](../interfaces/Draw.md)\> - -the Draw - -#### Defined in - -[src/PrizeDistributor.ts:489](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L489) - -___ - -### getDrawBufferContract - -▸ **getDrawBufferContract**(): `Promise`<`Contract`\> - -Fetches the address of the DrawBuffer and caches the ethers Contract for the DrawBuffer. - -#### Returns - -`Promise`<`Contract`\> - -an ethers Contract for the DrawBuffer related to this PrizeDistributor - -#### Defined in - -[src/PrizeDistributor.ts:782](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L782) - -___ - -### getDrawCalculatorContract - -▸ **getDrawCalculatorContract**(): `Promise`<`Contract`\> - -Fetches the address of the DrawCalculator and caches the ethers Contract for the DrawCalculator - -#### Returns - -`Promise`<`Contract`\> - -an ethers Contract for the DrawCalculator related to this PrizeDistributor - -#### Defined in - -[src/PrizeDistributor.ts:759](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L759) - -___ - -### getDrawIdsFromDrawBuffer - -▸ **getDrawIdsFromDrawBuffer**(): `Promise`<`number`[]\> - -Fetches the range of draw ids that are available in the DrawBuffer. - -#### Returns - -`Promise`<`number`[]\> - -a list of draw ids in the buffer - -#### Defined in - -[src/PrizeDistributor.ts:350](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L350) - -___ - -### getDrawIdsFromPrizeDistributionBuffer - -▸ **getDrawIdsFromPrizeDistributionBuffer**(): `Promise`<`number`[]\> - -Fetches the range of draw ids for the prize distributions that are available in the PrizeDistributionBuffer. - -#### Returns - -`Promise`<`number`[]\> - -a list of draw ids in the buffer - -#### Defined in - -[src/PrizeDistributor.ts:375](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L375) - -___ - -### getDraws - -▸ **getDraws**(`drawIds`): `Promise`<{ [drawId: number]: [`Draw`](../interfaces/Draw.md); }\> - -Fetches multiple Draws from the DrawBuffer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `drawIds` | `number`[] | a list of draw ids to fetch | - -#### Returns - -`Promise`<{ [drawId: number]: [`Draw`](../interfaces/Draw.md); }\> - -an object with Draws keyed by their draw ids - -#### Defined in - -[src/PrizeDistributor.ts:506](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L506) - -___ - -### getDrawsAndPrizeDistributions - -▸ **getDrawsAndPrizeDistributions**(`drawIds`): `Promise`<{ [drawId: number]: { `draw`: [`Draw`](../interfaces/Draw.md) ; `prizeDistribution`: [`PrizeDistribution`](../modules.md#prizedistribution) }; }\> - -Fetches Draws and PrizeDistributions from their respective buffers for the provided list of draw ids. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `drawIds` | `number`[] | the list of draw ids to fetch Draws and PrizeDistributions for | - -#### Returns - -`Promise`<{ [drawId: number]: { `draw`: [`Draw`](../interfaces/Draw.md) ; `prizeDistribution`: [`PrizeDistribution`](../modules.md#prizedistribution) }; }\> - -an object full of Draws and PrizeDistributions keyed by their draw id - -#### Defined in - -[src/PrizeDistributor.ts:454](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L454) - -___ - -### getNewestDraw - -▸ **getNewestDraw**(): `Promise`<[`Draw`](../interfaces/Draw.md)\> - -Fetches the newest Draw in the DrawBuffer related to the PrizeDistributor. -NOTE: Will throw an error if the buffer is empty. - -#### Returns - -`Promise`<[`Draw`](../interfaces/Draw.md)\> - -the newest draw in the draw buffer - -#### Defined in - -[src/PrizeDistributor.ts:245](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L245) - -___ - -### getNewestPrizeDistribution - -▸ **getNewestPrizeDistribution**(): `Promise`<{ `drawId`: `number` ; `prizeDistribution`: [`PrizeDistribution`](../modules.md#prizedistribution) }\> - -Fetches the newest PrizeDistribution in the PrizeDistributionBuffer related to the PrizeDistributor. -NOTE: Will throw an error if the buffer is empty. - -#### Returns - -`Promise`<{ `drawId`: `number` ; `prizeDistribution`: [`PrizeDistribution`](../modules.md#prizedistribution) }\> - -the newest prize distribution in the prize distribution buffer - -#### Defined in - -[src/PrizeDistributor.ts:280](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L280) - -___ - -### getOldestDraw - -▸ **getOldestDraw**(): `Promise`<[`Draw`](../interfaces/Draw.md)\> - -Fetches the oldest Draw in the DrawBuffer related to the PrizeDistributor. - -#### Returns - -`Promise`<[`Draw`](../interfaces/Draw.md)\> - -the oldest draw in the draw buffer - -#### Defined in - -[src/PrizeDistributor.ts:262](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L262) - -___ - -### getOldestPrizeDistribution - -▸ **getOldestPrizeDistribution**(): `Promise`<{ `drawId`: `number` ; `prizeDistribution`: [`PrizeDistribution`](../modules.md#prizedistribution) }\> - -Fetches the oldest PrizeDistribution in the PrizeDistributionBuffer related to the PrizeDistributor. - -#### Returns - -`Promise`<{ `drawId`: `number` ; `prizeDistribution`: [`PrizeDistribution`](../modules.md#prizedistribution) }\> - -the oldest prize distribution in the prize distribution buffer - -#### Defined in - -[src/PrizeDistributor.ts:307](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L307) - -___ - -### getPrizeDistribution - -▸ **getPrizeDistribution**(`drawId`): `Promise`<[`PrizeDistribution`](../modules.md#prizedistribution)\> - -Fetches a PrizeDistribution from the PrizeDistributionBuffer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `drawId` | `number` | the draw id for the PrizeDistribution to fetch | - -#### Returns - -`Promise`<[`PrizeDistribution`](../modules.md#prizedistribution)\> - -the PrizeDistribution - -#### Defined in - -[src/PrizeDistributor.ts:530](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L530) - -___ - -### getPrizeDistributions - -▸ **getPrizeDistributions**(`drawIds`): `Promise`<{ [drawId: number]: [`PrizeDistribution`](../modules.md#prizedistribution); }\> - -Fetches multiple PrizeDistributions from the PrizeDistributionBuffer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `drawIds` | `number`[] | a list of draw ids to fetch PrizeDistributions for | - -#### Returns - -`Promise`<{ [drawId: number]: [`PrizeDistribution`](../modules.md#prizedistribution); }\> - -an object with PrizeDistributions keyed by draw ids - -#### Defined in - -[src/PrizeDistributor.ts:553](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L553) - -___ - -### getPrizeDistributionsBufferContract - -▸ **getPrizeDistributionsBufferContract**(): `Promise`<`Contract`\> - -Fetches the address of the PrizeDistributionsBuffer and caches the ethers Contract for the PrizeDistributionsBuffer. - -#### Returns - -`Promise`<`Contract`\> - -an ethers Contract for the PrizeDistributionsBuffer related to this PrizeDistributor - -#### Defined in - -[src/PrizeDistributor.ts:795](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L795) - -___ - -### getTimelockDrawId - -▸ **getTimelockDrawId**(): `Promise`<{ `drawId`: `number` ; `endTimeSeconds`: `BigNumber` }\> - -Fetches the id and end time stamp of the draw that is currently in the DrawCalcluatorTimelock. - -#### Returns - -`Promise`<{ `drawId`: `number` ; `endTimeSeconds`: `BigNumber` }\> - -the draw id and the end time as a unix time stamp in seconds - -#### Defined in - -[src/PrizeDistributor.ts:334](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L334) - -___ - -### getTokenContract - -▸ **getTokenContract**(): `Promise`<`Contract`\> - -Fetches the address of the Token that is distributed by this PrizeDistributor and caches the ethers Contract for the ERC20 Token. - -#### Returns - -`Promise`<`Contract`\> - -an ethers Contract for the ERC20 Token related to this PrizeDistributor - -#### Defined in - -[src/PrizeDistributor.ts:812](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L812) - -___ - -### getTokenData - -▸ **getTokenData**(): `Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -Fetches decimals, name and symbol for the Token that will be distributed. - -#### Returns - -`Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -the decimals, name and symbol for the token - -#### Defined in - -[src/PrizeDistributor.ts:235](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L235) - -___ - -### getUsersAddress - -▸ **getUsersAddress**(`errorPrefix?`): `Promise`<`string`\> - -Returns the users address of the provided Signer. -PrizeDistributor must be initialized with a Signer. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `errorPrefix` | `string` | `'PrizeDistributors [getUsersAddress] |'` | the class and function name of where the error occurred | - -#### Returns - -`Promise`<`string`\> - -the address of the user - -#### Defined in - -[src/PrizeDistributor.ts:843](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L843) - -___ - -### getUsersClaimedAmount - -▸ **getUsersClaimedAmount**(`usersAddress`, `drawId`): `Promise`<`BigNumber`\> - -Fetches the amount of tokens a user claimed for a draw. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address of the user to check | -| `drawId` | `number` | the draw id to check | - -#### Returns - -`Promise`<`BigNumber`\> - -the amount a user claimed - -#### Defined in - -[src/PrizeDistributor.ts:584](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L584) - -___ - -### getUsersClaimedAmounts - -▸ **getUsersClaimedAmounts**(`usersAddress`, `drawIds`): `Promise`<{ [drawId: number]: `BigNumber`; }\> - -Fetches the amount of tokens a user claimed for multiple draws. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address of the user to check | -| `drawIds` | `number`[] | a list of draw ids to check | - -#### Returns - -`Promise`<{ [drawId: number]: `BigNumber`; }\> - -an object of claimed amounts keyed by the draw ids - -#### Defined in - -[src/PrizeDistributor.ts:601](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L601) - -___ - -### getUsersNormalizedBalancesForDrawIds - -▸ **getUsersNormalizedBalancesForDrawIds**(`usersAddress`, `drawIds`): `Promise`<{ [drawId: number]: `BigNumber`; }\> - -Fetches a users normalized balance for several draw ids. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address of a user to fetch normalized balances for | -| `drawIds` | `number`[] | a list of draw ids to fetch normalized balances for | - -#### Returns - -`Promise`<{ [drawId: number]: `BigNumber`; }\> - -an object of normalized balances keyed by draw ids - -#### Defined in - -[src/PrizeDistributor.ts:622](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L622) - -___ - -### getValidDrawIds - -▸ **getValidDrawIds**(): `Promise`<`number`[]\> - -Gets the list of draw ids of draws that have are available in both the DrawBuffer and PrizeDistributionBuffer. - -#### Returns - -`Promise`<`number`[]\> - -a list of draw ids in both buffers - -#### Defined in - -[src/PrizeDistributor.ts:406](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L406) - -___ - -### id - -▸ **id**(): `string` - -Returns a unique id string for this PrizeDistributor. - -#### Returns - -`string` - -a unique id for the PrizeDistributor - -#### Defined in - -[src/PrizeDistributor.ts:116](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L116) - -___ - -### validateIsSigner - -▸ **validateIsSigner**(`errorPrefix`): `Promise`<`void`\> - -Validates that the data provided for providerOrSigner is a Signer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `errorPrefix` | `string` | the class and function name of where the error occurred | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[src/PrizeDistributor.ts:862](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L862) - -___ - -### validateSignerNetwork - -▸ **validateSignerNetwork**(`errorPrefix`): `Promise`<`void`\> - -Validates that a Signer is on the network the PrizeDistributor is deployed on. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `errorPrefix` | `string` | the class and function name of where the error occurred | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[src/PrizeDistributor.ts:854](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L854) diff --git a/docs/classes/PrizePool.md b/docs/classes/PrizePool.md deleted file mode 100644 index 8d5fa18..0000000 --- a/docs/classes/PrizePool.md +++ /dev/null @@ -1,419 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / PrizePool - -# Class: PrizePool - -A Prize Pool. -Provides read only functions for the contracts that make up the deployment of this Prize Pool. - -## Hierarchy - -- **`PrizePool`** - - ↳ [`User`](User.md) - -## Table of contents - -### Constructors - -- [constructor](PrizePool.md#constructor) - -### Properties - -- [address](PrizePool.md#address) -- [chainId](PrizePool.md#chainid) -- [contractMetadataList](PrizePool.md#contractmetadatalist) -- [prizePoolContract](PrizePool.md#prizepoolcontract) -- [prizePoolMetadata](PrizePool.md#prizepoolmetadata) -- [signerOrProvider](PrizePool.md#signerorprovider) -- [ticketContract](PrizePool.md#ticketcontract) -- [ticketMetadata](PrizePool.md#ticketmetadata) -- [tokenContract](PrizePool.md#tokencontract) -- [tokenMetadata](PrizePool.md#tokenmetadata) - -### Methods - -- [getTicketContract](PrizePool.md#getticketcontract) -- [getTicketData](PrizePool.md#getticketdata) -- [getTicketTotalSupply](PrizePool.md#gettickettotalsupply) -- [getTokenContract](PrizePool.md#gettokencontract) -- [getTokenData](PrizePool.md#gettokendata) -- [getUsersDepositAllowance](PrizePool.md#getusersdepositallowance) -- [getUsersPrizePoolBalances](PrizePool.md#getusersprizepoolbalances) -- [getUsersTicketBalance](PrizePool.md#getusersticketbalance) -- [getUsersTicketDelegate](PrizePool.md#getusersticketdelegate) -- [getUsersTicketTwabAt](PrizePool.md#getuserstickettwabat) -- [getUsersTokenBalance](PrizePool.md#getuserstokenbalance) -- [id](PrizePool.md#id) - -## Constructors - -### constructor - -• **new PrizePool**(`prizePoolMetadata`, `signerOrProvider`, `contractMetadataList`) - -Create an instance of a PrizePool by providing the metadata for the YieldSourcePrizePool contract, an ethers Provider or Signer for the network the Prize Pool is deployed on and a list of contract metadata for the other contracts that make up the Prize Pool. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `prizePoolMetadata` | [`Contract`](../interfaces/Contract.md) | the metadata for the YieldSourcePrizePool contract in the Prize Pool | -| `signerOrProvider` | `Signer` \| `Provider` | a Provider or Signer for the network the Prize Pool deployment is on | -| `contractMetadataList` | [`Contract`](../interfaces/Contract.md)[] | an array of metadata for the Prize Pool | - -#### Defined in - -[src/PrizePool.ts:49](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L49) - -## Properties - -### address - -• `Readonly` **address**: `string` - -#### Defined in - -[src/PrizePool.ts:30](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L30) - -___ - -### chainId - -• `Readonly` **chainId**: `number` - -#### Defined in - -[src/PrizePool.ts:29](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L29) - -___ - -### contractMetadataList - -• `Readonly` **contractMetadataList**: [`Contract`](../interfaces/Contract.md)[] - -#### Defined in - -[src/PrizePool.ts:27](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L27) - -___ - -### prizePoolContract - -• `Readonly` **prizePoolContract**: `Contract` - -#### Defined in - -[src/PrizePool.ts:38](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L38) - -___ - -### prizePoolMetadata - -• `Readonly` **prizePoolMetadata**: [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizePool.ts:33](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L33) - -___ - -### signerOrProvider - -• `Readonly` **signerOrProvider**: `Signer` \| `Provider` - -#### Defined in - -[src/PrizePool.ts:28](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L28) - -___ - -### ticketContract - -• **ticketContract**: `undefined` \| `Contract` - -#### Defined in - -[src/PrizePool.ts:39](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L39) - -___ - -### ticketMetadata - -• **ticketMetadata**: `undefined` \| [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizePool.ts:34](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L34) - -___ - -### tokenContract - -• **tokenContract**: `undefined` \| `Contract` - -#### Defined in - -[src/PrizePool.ts:40](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L40) - -___ - -### tokenMetadata - -• **tokenMetadata**: `undefined` \| [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizePool.ts:35](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L35) - -## Methods - -### getTicketContract - -▸ **getTicketContract**(): `Promise`<`Contract`\> - -Fetches the addresses to build an instance of an ethers Contract for the Ticket - -#### Returns - -`Promise`<`Contract`\> - -an ethers contract for the ticket - -#### Defined in - -[src/PrizePool.ts:273](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L273) - -___ - -### getTicketData - -▸ **getTicketData**(): `Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -Fetches decimals, name and symbol for the Ticket. - -#### Returns - -`Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -decimals, name and symbol for the ticket - -#### Defined in - -[src/PrizePool.ts:201](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L201) - -___ - -### getTicketTotalSupply - -▸ **getTicketTotalSupply**(): `Promise`<`BigNumber`\> - -Fetches total supply for the Ticket. - -#### Returns - -`Promise`<`BigNumber`\> - -the total supply of the ticket - -#### Defined in - -[src/PrizePool.ts:213](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L213) - -___ - -### getTokenContract - -▸ **getTokenContract**(): `Promise`<`Contract`\> - -Fetches the addresses to build an instance of an ethers Contract for the underlying Token - -#### Returns - -`Promise`<`Contract`\> - -an ethers contract for the underlying token - -#### Defined in - -[src/PrizePool.ts:296](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L296) - -___ - -### getTokenData - -▸ **getTokenData**(): `Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -Fetches decimals, name and symbol for the underling Token. - -#### Returns - -`Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -decimals, name and symbol for the underling token - -#### Defined in - -[src/PrizePool.ts:189](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L189) - -___ - -### getUsersDepositAllowance - -▸ **getUsersDepositAllowance**(`usersAddress`): `Promise`<{ `allowanceUnformatted`: `BigNumber` ; `isApproved`: `boolean` = !allowanceUnformatted.isZero() }\> - -Fetches a users deposit allowance for the Prize Pool. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the deposit allowance for | - -#### Returns - -`Promise`<{ `allowanceUnformatted`: `BigNumber` ; `isApproved`: `boolean` = !allowanceUnformatted.isZero() }\> - -the amount the user has approved for deposits - -#### Defined in - -[src/PrizePool.ts:159](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L159) - -___ - -### getUsersPrizePoolBalances - -▸ **getUsersPrizePoolBalances**(`usersAddress`): `Promise`<[`PrizePoolTokenBalances`](../interfaces/PrizePoolTokenBalances.md)\> - -Fetches a users balances for the Prize Pool underlying Token and Ticket. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the users address to fetch balances for | - -#### Returns - -`Promise`<[`PrizePoolTokenBalances`](../interfaces/PrizePoolTokenBalances.md)\> - -the users balances for the underlying deposit token and the ticket token - -#### Defined in - -[src/PrizePool.ts:93](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L93) - -___ - -### getUsersTicketBalance - -▸ **getUsersTicketBalance**(`usersAddress`): `Promise`<`BigNumber`\> - -Fetches a users balance for the Prize Pools Ticket. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the balance for | - -#### Returns - -`Promise`<`BigNumber`\> - -the users ticket balance - -#### Defined in - -[src/PrizePool.ts:114](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L114) - -___ - -### getUsersTicketDelegate - -▸ **getUsersTicketDelegate**(`usersAddress`): `Promise`<`string`\> - -Fetches the address a user has delegated to. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the delegate for | - -#### Returns - -`Promise`<`string`\> - -the address a user has delegated to - -#### Defined in - -[src/PrizePool.ts:176](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L176) - -___ - -### getUsersTicketTwabAt - -▸ **getUsersTicketTwabAt**(`usersAddress`, `unixTimestamp`): `Promise`<`BigNumber`\> - -Fetches a users Ticket TWAB at a specific unix timestamp. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the ticket TWAB for | -| `unixTimestamp` | `number` | the unix timestamp to fetch in seconds | - -#### Returns - -`Promise`<`BigNumber`\> - -the users TWAB at the requested time - -#### Defined in - -[src/PrizePool.ts:129](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L129) - -___ - -### getUsersTokenBalance - -▸ **getUsersTokenBalance**(`usersAddress`): `Promise`<`BigNumber`\> - -Fetches a users balance for the Prize Pools underlying Token. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the balance for | - -#### Returns - -`Promise`<`BigNumber`\> - -the users token balance - -#### Defined in - -[src/PrizePool.ts:145](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L145) - -___ - -### id - -▸ **id**(): `string` - -Returns a unique id string for this Prize Pool. - -#### Returns - -`string` - -a unique id for the Prize Pool - -#### Defined in - -[src/PrizePool.ts:82](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L82) diff --git a/docs/classes/PrizePoolNetwork.md b/docs/classes/PrizePoolNetwork.md deleted file mode 100644 index 15ca145..0000000 --- a/docs/classes/PrizePoolNetwork.md +++ /dev/null @@ -1,337 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / PrizePoolNetwork - -# Class: PrizePoolNetwork - -A Prize Pool Network. -The network consists of one or more Prize Pools and Prize Distributors. PrizePoolNetwork provides read only functions for reading data from the contracts that make up the network. Initializes several PrizePools and PrizeDistributors on creation. - -## Table of contents - -### Constructors - -- [constructor](PrizePoolNetwork.md#constructor) - -### Properties - -- [beaconAddress](PrizePoolNetwork.md#beaconaddress) -- [beaconChainId](PrizePoolNetwork.md#beaconchainid) -- [contractList](PrizePoolNetwork.md#contractlist) -- [drawBeaconContract](PrizePoolNetwork.md#drawbeaconcontract) -- [drawBeaconMetadata](PrizePoolNetwork.md#drawbeaconmetadata) -- [drawBufferContract](PrizePoolNetwork.md#drawbuffercontract) -- [drawBufferMetadata](PrizePoolNetwork.md#drawbuffermetadata) -- [prizeDistributors](PrizePoolNetwork.md#prizedistributors) -- [prizePools](PrizePoolNetwork.md#prizepools) -- [prizeTierHistoryContract](PrizePoolNetwork.md#prizetierhistorycontract) -- [prizeTierHistoryMetadata](PrizePoolNetwork.md#prizetierhistorymetadata) -- [providers](PrizePoolNetwork.md#providers) - -### Methods - -- [getBeaconChainDrawIds](PrizePoolNetwork.md#getbeaconchaindrawids) -- [getBeaconChainDraws](PrizePoolNetwork.md#getbeaconchaindraws) -- [getDrawBeaconPeriod](PrizePoolNetwork.md#getdrawbeaconperiod) -- [getPrizeDistributor](PrizePoolNetwork.md#getprizedistributor) -- [getPrizePool](PrizePoolNetwork.md#getprizepool) -- [getUpcomingPrizeTier](PrizePoolNetwork.md#getupcomingprizetier) -- [getUsersPrizePoolBalances](PrizePoolNetwork.md#getusersprizepoolbalances) -- [id](PrizePoolNetwork.md#id) - -## Constructors - -### constructor - -• **new PrizePoolNetwork**(`providers`, `prizePoolNetworkContractList`) - -Create an instance of a PrizePoolNetwork by providing ethers Providers for each relevant network and a Contract List. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `providers` | [`Providers`](../interfaces/Providers.md) | ethers Providers for each network in the Prize Pool Network, keyed by their chain id. | -| `prizePoolNetworkContractList` | [`ContractList`](../interfaces/ContractList.md) | a Contract List containing all of the relevant metadata for the Prize Pool Network. | - -#### Defined in - -[src/PrizePoolNetwork.ts:41](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L41) - -## Properties - -### beaconAddress - -• `Readonly` **beaconAddress**: `string` - -#### Defined in - -[src/PrizePoolNetwork.ts:23](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L23) - -___ - -### beaconChainId - -• `Readonly` **beaconChainId**: `number` - -#### Defined in - -[src/PrizePoolNetwork.ts:22](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L22) - -___ - -### contractList - -• `Readonly` **contractList**: [`ContractList`](../interfaces/ContractList.md) - -#### Defined in - -[src/PrizePoolNetwork.ts:19](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L19) - -___ - -### drawBeaconContract - -• `Readonly` **drawBeaconContract**: `Contract` - -#### Defined in - -[src/PrizePoolNetwork.ts:31](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L31) - -___ - -### drawBeaconMetadata - -• `Readonly` **drawBeaconMetadata**: [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizePoolNetwork.ts:26](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L26) - -___ - -### drawBufferContract - -• `Readonly` **drawBufferContract**: `Contract` - -#### Defined in - -[src/PrizePoolNetwork.ts:32](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L32) - -___ - -### drawBufferMetadata - -• `Readonly` **drawBufferMetadata**: [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizePoolNetwork.ts:27](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L27) - -___ - -### prizeDistributors - -• `Readonly` **prizeDistributors**: [`PrizeDistributor`](PrizeDistributor.md)[] - -#### Defined in - -[src/PrizePoolNetwork.ts:18](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L18) - -___ - -### prizePools - -• `Readonly` **prizePools**: [`PrizePool`](PrizePool.md)[] - -#### Defined in - -[src/PrizePoolNetwork.ts:17](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L17) - -___ - -### prizeTierHistoryContract - -• `Readonly` **prizeTierHistoryContract**: `Contract` - -#### Defined in - -[src/PrizePoolNetwork.ts:33](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L33) - -___ - -### prizeTierHistoryMetadata - -• `Readonly` **prizeTierHistoryMetadata**: [`Contract`](../interfaces/Contract.md) - -#### Defined in - -[src/PrizePoolNetwork.ts:28](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L28) - -___ - -### providers - -• `Readonly` **providers**: [`Providers`](../interfaces/Providers.md) - -#### Defined in - -[src/PrizePoolNetwork.ts:16](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L16) - -## Methods - -### getBeaconChainDrawIds - -▸ **getBeaconChainDrawIds**(): `Promise`<`number`[]\> - -Fetch the range of available draw ids in the Draw Buffer for the beacon Prize Pool. - -#### Returns - -`Promise`<`number`[]\> - -an array of draw ids - -#### Defined in - -[src/PrizePoolNetwork.ts:143](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L143) - -___ - -### getBeaconChainDraws - -▸ **getBeaconChainDraws**(): `Promise`<{ [drawId: number]: [`Draw`](../interfaces/Draw.md); }\> - -Fetch all of the available Draws in the Draw Buffer for the beacon Prize Pool. - -#### Returns - -`Promise`<{ [drawId: number]: [`Draw`](../interfaces/Draw.md); }\> - -an object of draws keyed by their draw id - -#### Defined in - -[src/PrizePoolNetwork.ts:168](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L168) - -___ - -### getDrawBeaconPeriod - -▸ **getDrawBeaconPeriod**(): `Promise`<{ `drawId`: `number` ; `endsAtSeconds`: `BigNumber` ; `periodSeconds`: `number` ; `startedAtSeconds`: `BigNumber` }\> - -Fetch the current Draw Beacon period data from the beacon Prize Pool. - -#### Returns - -`Promise`<{ `drawId`: `number` ; `endsAtSeconds`: `BigNumber` ; `periodSeconds`: `number` ; `startedAtSeconds`: `BigNumber` }\> - -the current draw beacon period. - -#### Defined in - -[src/PrizePoolNetwork.ts:121](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L121) - -___ - -### getPrizeDistributor - -▸ **getPrizeDistributor**(`chainId`, `address`): `undefined` \| [`PrizeDistributor`](PrizeDistributor.md) - -Returns a PrizeDistributor from the list of Prize Distributors that was created on initialization by their primary key. The primary key of a Prize Disctributor is the chain id it is on and the address of the PrizeDistributor contract. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `chainId` | `number` | the chain id the requested prize distributor is on | -| `address` | `string` | the address of the PrizeDistributor contract | - -#### Returns - -`undefined` \| [`PrizeDistributor`](PrizeDistributor.md) - -#### Defined in - -[src/PrizePoolNetwork.ts:218](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L218) - -___ - -### getPrizePool - -▸ **getPrizePool**(`chainId`, `address`): `undefined` \| [`PrizePool`](PrizePool.md) - -Returns a PrizePool from the list of Prize Pools that was created on initialization by their primary key. The primary key of a Prize Pool is the chain id it is on and the address of the YieldSourcePrizePool contract. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `chainId` | `number` | the chain id the requested prize pool is on | -| `address` | `string` | the address of the YieldSourcePrizePool contract | - -#### Returns - -`undefined` \| [`PrizePool`](PrizePool.md) - -#### Defined in - -[src/PrizePoolNetwork.ts:206](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L206) - -___ - -### getUpcomingPrizeTier - -▸ **getUpcomingPrizeTier**(): `Promise`<[`PrizeTier`](../modules.md#prizetier)\> - -Fetches the upcoming prize tier data from the prize tier history contract. This data is used for the next prize distribution that will be added to the Prize Distribution Buffer for the beacon Prize Pool. - -#### Returns - -`Promise`<[`PrizeTier`](../modules.md#prizetier)\> - -the upcoming prize tier - -#### Defined in - -[src/PrizePoolNetwork.ts:188](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L188) - -___ - -### getUsersPrizePoolBalances - -▸ **getUsersPrizePoolBalances**(`usersAddress`): `Promise`<{ `address`: `string` = prizePool.address; `balances`: [`PrizePoolTokenBalances`](../interfaces/PrizePoolTokenBalances.md) ; `chainId`: `number` = prizePool.chainId }[]\> - -Fetch the users balances for all relevant tokens for all Prize Pools in the Prize Pool Network. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | address to get balances for. | - -#### Returns - -`Promise`<{ `address`: `string` = prizePool.address; `balances`: [`PrizePoolTokenBalances`](../interfaces/PrizePoolTokenBalances.md) ; `chainId`: `number` = prizePool.chainId }[]\> - -an array of objects containing the chain id & Prize Pool address and a balances object with the users balances for relevant tokens to the prize pool - -#### Defined in - -[src/PrizePoolNetwork.ts:105](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L105) - -___ - -### id - -▸ **id**(): `string` - -Returns a unique id string for this PrizePoolNetwork. - -#### Returns - -`string` - -a unique id for the PrizePoolNetwork - -#### Defined in - -[src/PrizePoolNetwork.ts:94](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePoolNetwork.ts#L94) diff --git a/docs/classes/User.md b/docs/classes/User.md deleted file mode 100644 index 29afb47..0000000 --- a/docs/classes/User.md +++ /dev/null @@ -1,778 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / User - -# Class: User - -A User for a PrizePool. -Provides read & write functionality for a Prize Pool. Reads use the provider from the PrizePool. Writes use the signer from the contructor. Throws an error if a write is triggered with a signer that does not match the network of the Prize Pool. - -## Hierarchy - -- [`PrizePool`](PrizePool.md) - - ↳ **`User`** - -## Table of contents - -### Constructors - -- [constructor](User.md#constructor) - -### Properties - -- [address](User.md#address) -- [chainId](User.md#chainid) -- [contractMetadataList](User.md#contractmetadatalist) -- [prizePoolContract](User.md#prizepoolcontract) -- [prizePoolMetadata](User.md#prizepoolmetadata) -- [signer](User.md#signer) -- [signerOrProvider](User.md#signerorprovider) -- [ticketContract](User.md#ticketcontract) -- [ticketMetadata](User.md#ticketmetadata) -- [tokenContract](User.md#tokencontract) -- [tokenMetadata](User.md#tokenmetadata) - -### Methods - -- [approveDeposits](User.md#approvedeposits) -- [delegateTickets](User.md#delegatetickets) -- [deposit](User.md#deposit) -- [depositAndDelegate](User.md#depositanddelegate) -- [getDepositAllowance](User.md#getdepositallowance) -- [getTicketBalance](User.md#getticketbalance) -- [getTicketContract](User.md#getticketcontract) -- [getTicketData](User.md#getticketdata) -- [getTicketDelegate](User.md#getticketdelegate) -- [getTicketTotalSupply](User.md#gettickettotalsupply) -- [getTokenBalance](User.md#gettokenbalance) -- [getTokenContract](User.md#gettokencontract) -- [getTokenData](User.md#gettokendata) -- [getUsersDepositAllowance](User.md#getusersdepositallowance) -- [getUsersPrizePoolBalances](User.md#getusersprizepoolbalances) -- [getUsersTicketBalance](User.md#getusersticketbalance) -- [getUsersTicketDelegate](User.md#getusersticketdelegate) -- [getUsersTicketTwabAt](User.md#getuserstickettwabat) -- [getUsersTokenBalance](User.md#getuserstokenbalance) -- [id](User.md#id) -- [selfDelegateTickets](User.md#selfdelegatetickets) -- [validateSignerNetwork](User.md#validatesignernetwork) -- [withdraw](User.md#withdraw) - -## Constructors - -### constructor - -• **new User**(`prizePoolMetadata`, `signer`, `prizePool`) - -Creates an instance of a User for a specific PrizePool - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `prizePoolMetadata` | [`Contract`](../interfaces/Contract.md) | - | -| `signer` | `Signer` | signer to submit transactions with | -| `prizePool` | [`PrizePool`](PrizePool.md) | PrizePool that the User should interact with | - -#### Overrides - -[PrizePool](PrizePool.md).[constructor](PrizePool.md#constructor) - -#### Defined in - -[src/User.ts:24](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L24) - -## Properties - -### address - -• `Readonly` **address**: `string` - -#### Inherited from - -[PrizePool](PrizePool.md).[address](PrizePool.md#address) - -#### Defined in - -[src/PrizePool.ts:30](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L30) - -___ - -### chainId - -• `Readonly` **chainId**: `number` - -#### Inherited from - -[PrizePool](PrizePool.md).[chainId](PrizePool.md#chainid) - -#### Defined in - -[src/PrizePool.ts:29](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L29) - -___ - -### contractMetadataList - -• `Readonly` **contractMetadataList**: [`Contract`](../interfaces/Contract.md)[] - -#### Inherited from - -[PrizePool](PrizePool.md).[contractMetadataList](PrizePool.md#contractmetadatalist) - -#### Defined in - -[src/PrizePool.ts:27](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L27) - -___ - -### prizePoolContract - -• `Readonly` **prizePoolContract**: `Contract` - -#### Inherited from - -[PrizePool](PrizePool.md).[prizePoolContract](PrizePool.md#prizepoolcontract) - -#### Defined in - -[src/PrizePool.ts:38](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L38) - -___ - -### prizePoolMetadata - -• `Readonly` **prizePoolMetadata**: [`Contract`](../interfaces/Contract.md) - -#### Inherited from - -[PrizePool](PrizePool.md).[prizePoolMetadata](PrizePool.md#prizepoolmetadata) - -#### Defined in - -[src/PrizePool.ts:33](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L33) - -___ - -### signer - -• `Readonly` **signer**: `Signer` - -#### Defined in - -[src/User.ts:17](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L17) - -___ - -### signerOrProvider - -• `Readonly` **signerOrProvider**: `Signer` \| `Provider` - -#### Inherited from - -[PrizePool](PrizePool.md).[signerOrProvider](PrizePool.md#signerorprovider) - -#### Defined in - -[src/PrizePool.ts:28](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L28) - -___ - -### ticketContract - -• **ticketContract**: `undefined` \| `Contract` - -#### Inherited from - -[PrizePool](PrizePool.md).[ticketContract](PrizePool.md#ticketcontract) - -#### Defined in - -[src/PrizePool.ts:39](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L39) - -___ - -### ticketMetadata - -• **ticketMetadata**: `undefined` \| [`Contract`](../interfaces/Contract.md) - -#### Inherited from - -[PrizePool](PrizePool.md).[ticketMetadata](PrizePool.md#ticketmetadata) - -#### Defined in - -[src/PrizePool.ts:34](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L34) - -___ - -### tokenContract - -• **tokenContract**: `undefined` \| `Contract` - -#### Inherited from - -[PrizePool](PrizePool.md).[tokenContract](PrizePool.md#tokencontract) - -#### Defined in - -[src/PrizePool.ts:40](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L40) - -___ - -### tokenMetadata - -• **tokenMetadata**: `undefined` \| [`Contract`](../interfaces/Contract.md) - -#### Inherited from - -[PrizePool](PrizePool.md).[tokenMetadata](PrizePool.md#tokenmetadata) - -#### Defined in - -[src/PrizePool.ts:35](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L35) - -## Methods - -### approveDeposits - -▸ **approveDeposits**(`amountUnformatted?`, `overrides?`): `Promise`<`TransactionResponse`\> - -Submits a transaction to set an allowance for deposits into the Prize Pool. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `amountUnformatted?` | `BigNumber` | an unformatted and decimal shifted amount to approve for deposits | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/User.ts:111](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L111) - -___ - -### delegateTickets - -▸ **delegateTickets**(`address`, `overrides?`): `Promise`<`TransactionResponse`\> - -Delegates the users ticket chance to the provided address - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `string` | the address to delegate to | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/User.ts:150](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L150) - -___ - -### deposit - -▸ **deposit**(`amountUnformatted`, `overrides?`): `Promise`<`TransactionResponse`\> - -Submits a transaction to deposit a controlled token into the Prize Pool to the Signer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `amountUnformatted` | `BigNumber` | an unformatted and decimal shifted amount to deposit from the prize pool | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/User.ts:59](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L59) - -___ - -### depositAndDelegate - -▸ **depositAndDelegate**(`amountUnformatted`, `to?`, `overrides?`): `Promise`<`TransactionResponse`\> - -Submits a transaction to deposit a controlled token into the Prize Pool to the Signer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `amountUnformatted` | `BigNumber` | an unformatted and decimal shifted amount to deposit from the prize pool | -| `to?` | `string` | - | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/User.ts:77](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L77) - -___ - -### getDepositAllowance - -▸ **getDepositAllowance**(): `Promise`<{ `allowanceUnformatted`: `BigNumber` ; `isApproved`: `boolean` = !allowanceUnformatted.isZero() }\> - -Fetches the allowance the User has for depositing into the Prize Pool. - -#### Returns - -`Promise`<{ `allowanceUnformatted`: `BigNumber` ; `isApproved`: `boolean` = !allowanceUnformatted.isZero() }\> - -the allowance the user has set for deposits - -#### Defined in - -[src/User.ts:187](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L187) - -___ - -### getTicketBalance - -▸ **getTicketBalance**(): `Promise`<`BigNumber`\> - -Fetches the Users ticket balance. - -#### Returns - -`Promise`<`BigNumber`\> - -the users ticket balance - -#### Defined in - -[src/User.ts:169](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L169) - -___ - -### getTicketContract - -▸ **getTicketContract**(): `Promise`<`Contract`\> - -Fetches the addresses to build an instance of an ethers Contract for the Ticket - -#### Returns - -`Promise`<`Contract`\> - -an ethers contract for the ticket - -#### Inherited from - -[PrizePool](PrizePool.md).[getTicketContract](PrizePool.md#getticketcontract) - -#### Defined in - -[src/PrizePool.ts:273](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L273) - -___ - -### getTicketData - -▸ **getTicketData**(): `Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -Fetches decimals, name and symbol for the Ticket. - -#### Returns - -`Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -decimals, name and symbol for the ticket - -#### Inherited from - -[PrizePool](PrizePool.md).[getTicketData](PrizePool.md#getticketdata) - -#### Defined in - -[src/PrizePool.ts:201](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L201) - -___ - -### getTicketDelegate - -▸ **getTicketDelegate**(): `Promise`<`string`\> - -Fetches the address the user has delegated to - -#### Returns - -`Promise`<`string`\> - -the address the user has delegated to - -#### Defined in - -[src/User.ts:196](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L196) - -___ - -### getTicketTotalSupply - -▸ **getTicketTotalSupply**(): `Promise`<`BigNumber`\> - -Fetches total supply for the Ticket. - -#### Returns - -`Promise`<`BigNumber`\> - -the total supply of the ticket - -#### Inherited from - -[PrizePool](PrizePool.md).[getTicketTotalSupply](PrizePool.md#gettickettotalsupply) - -#### Defined in - -[src/PrizePool.ts:213](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L213) - -___ - -### getTokenBalance - -▸ **getTokenBalance**(): `Promise`<`BigNumber`\> - -Fetches the Users token (underlying token) balance. - -#### Returns - -`Promise`<`BigNumber`\> - -the users underlying token balance - -#### Defined in - -[src/User.ts:178](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L178) - -___ - -### getTokenContract - -▸ **getTokenContract**(): `Promise`<`Contract`\> - -Fetches the addresses to build an instance of an ethers Contract for the underlying Token - -#### Returns - -`Promise`<`Contract`\> - -an ethers contract for the underlying token - -#### Inherited from - -[PrizePool](PrizePool.md).[getTokenContract](PrizePool.md#gettokencontract) - -#### Defined in - -[src/PrizePool.ts:296](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L296) - -___ - -### getTokenData - -▸ **getTokenData**(): `Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -Fetches decimals, name and symbol for the underling Token. - -#### Returns - -`Promise`<[`TokenData`](../interfaces/TokenData.md)\> - -decimals, name and symbol for the underling token - -#### Inherited from - -[PrizePool](PrizePool.md).[getTokenData](PrizePool.md#gettokendata) - -#### Defined in - -[src/PrizePool.ts:189](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L189) - -___ - -### getUsersDepositAllowance - -▸ **getUsersDepositAllowance**(`usersAddress`): `Promise`<{ `allowanceUnformatted`: `BigNumber` ; `isApproved`: `boolean` = !allowanceUnformatted.isZero() }\> - -Fetches a users deposit allowance for the Prize Pool. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the deposit allowance for | - -#### Returns - -`Promise`<{ `allowanceUnformatted`: `BigNumber` ; `isApproved`: `boolean` = !allowanceUnformatted.isZero() }\> - -the amount the user has approved for deposits - -#### Inherited from - -[PrizePool](PrizePool.md).[getUsersDepositAllowance](PrizePool.md#getusersdepositallowance) - -#### Defined in - -[src/PrizePool.ts:159](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L159) - -___ - -### getUsersPrizePoolBalances - -▸ **getUsersPrizePoolBalances**(`usersAddress`): `Promise`<[`PrizePoolTokenBalances`](../interfaces/PrizePoolTokenBalances.md)\> - -Fetches a users balances for the Prize Pool underlying Token and Ticket. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the users address to fetch balances for | - -#### Returns - -`Promise`<[`PrizePoolTokenBalances`](../interfaces/PrizePoolTokenBalances.md)\> - -the users balances for the underlying deposit token and the ticket token - -#### Inherited from - -[PrizePool](PrizePool.md).[getUsersPrizePoolBalances](PrizePool.md#getusersprizepoolbalances) - -#### Defined in - -[src/PrizePool.ts:93](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L93) - -___ - -### getUsersTicketBalance - -▸ **getUsersTicketBalance**(`usersAddress`): `Promise`<`BigNumber`\> - -Fetches a users balance for the Prize Pools Ticket. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the balance for | - -#### Returns - -`Promise`<`BigNumber`\> - -the users ticket balance - -#### Inherited from - -[PrizePool](PrizePool.md).[getUsersTicketBalance](PrizePool.md#getusersticketbalance) - -#### Defined in - -[src/PrizePool.ts:114](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L114) - -___ - -### getUsersTicketDelegate - -▸ **getUsersTicketDelegate**(`usersAddress`): `Promise`<`string`\> - -Fetches the address a user has delegated to. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the delegate for | - -#### Returns - -`Promise`<`string`\> - -the address a user has delegated to - -#### Inherited from - -[PrizePool](PrizePool.md).[getUsersTicketDelegate](PrizePool.md#getusersticketdelegate) - -#### Defined in - -[src/PrizePool.ts:176](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L176) - -___ - -### getUsersTicketTwabAt - -▸ **getUsersTicketTwabAt**(`usersAddress`, `unixTimestamp`): `Promise`<`BigNumber`\> - -Fetches a users Ticket TWAB at a specific unix timestamp. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the ticket TWAB for | -| `unixTimestamp` | `number` | the unix timestamp to fetch in seconds | - -#### Returns - -`Promise`<`BigNumber`\> - -the users TWAB at the requested time - -#### Inherited from - -[PrizePool](PrizePool.md).[getUsersTicketTwabAt](PrizePool.md#getuserstickettwabat) - -#### Defined in - -[src/PrizePool.ts:129](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L129) - -___ - -### getUsersTokenBalance - -▸ **getUsersTokenBalance**(`usersAddress`): `Promise`<`BigNumber`\> - -Fetches a users balance for the Prize Pools underlying Token. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `usersAddress` | `string` | the address to fetch the balance for | - -#### Returns - -`Promise`<`BigNumber`\> - -the users token balance - -#### Inherited from - -[PrizePool](PrizePool.md).[getUsersTokenBalance](PrizePool.md#getuserstokenbalance) - -#### Defined in - -[src/PrizePool.ts:145](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L145) - -___ - -### id - -▸ **id**(): `string` - -Returns a unique id string for this Prize Pool. - -#### Returns - -`string` - -a unique id for the Prize Pool - -#### Inherited from - -[PrizePool](PrizePool.md).[id](PrizePool.md#id) - -#### Defined in - -[src/PrizePool.ts:82](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L82) - -___ - -### selfDelegateTickets - -▸ **selfDelegateTickets**(`overrides?`): `Promise`<`TransactionResponse`\> - -Submits a transaction to delegate to ticket chance to the users self - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/User.ts:132](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L132) - -___ - -### validateSignerNetwork - -▸ **validateSignerNetwork**(`errorPrefix`): `Promise`<`void`\> - -Validates the provided signers network. -Throws if it does not match the expected network. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `errorPrefix` | `string` | the class and function name of where the error occurred | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[src/User.ts:208](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L208) - -___ - -### withdraw - -▸ **withdraw**(`amountUnformatted`, `overrides?`): `Promise`<`TransactionResponse`\> - -Submits a transaction to withdraw a controlled token from the Prize Pool to the Signer. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `amountUnformatted` | `BigNumber` | an unformatted and decimal shifted amount to withdraw from the prize pool | -| `overrides?` | `Overrides` | optional overrides for the transaction creation | - -#### Returns - -`Promise`<`TransactionResponse`\> - -the transaction response - -#### Defined in - -[src/User.ts:38](https://github.com/pooltogether/v4-client-js/blob/7357147/src/User.ts#L38) diff --git a/docs/interfaces/ABIIdentifier.md b/docs/interfaces/ABIIdentifier.md deleted file mode 100644 index 49d02ed..0000000 --- a/docs/interfaces/ABIIdentifier.md +++ /dev/null @@ -1,36 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / ABIIdentifier - -# Interface: ABIIdentifier - -## Hierarchy - -- **`ABIIdentifier`** - - ↳ [`Contract`](Contract.md) - -## Table of contents - -### Properties - -- [type](ABIIdentifier.md#type) -- [version](ABIIdentifier.md#version) - -## Properties - -### type - -• `Readonly` **type**: `string` - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:14 - -___ - -### version - -• `Readonly` **version**: [`Version`](Version.md) - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:13 diff --git a/docs/interfaces/ChildContractAddresses.md b/docs/interfaces/ChildContractAddresses.md deleted file mode 100644 index a33eedd..0000000 --- a/docs/interfaces/ChildContractAddresses.md +++ /dev/null @@ -1,7 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / ChildContractAddresses - -# Interface: ChildContractAddresses - -## Indexable - -▪ [chainId: `number`]: { [contractAddress: string]: { [childContractType: string]: `string`; }; } diff --git a/docs/interfaces/Contract.md b/docs/interfaces/Contract.md deleted file mode 100644 index bf7e3d9..0000000 --- a/docs/interfaces/Contract.md +++ /dev/null @@ -1,113 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / Contract - -# Interface: Contract - -## Hierarchy - -- [`ABIIdentifier`](ABIIdentifier.md) - -- [`ContractIdentifier`](ContractIdentifier.md) - - ↳ **`Contract`** - -## Table of contents - -### Properties - -- [abi](Contract.md#abi) -- [address](Contract.md#address) -- [chainId](Contract.md#chainid) -- [extensions](Contract.md#extensions) -- [tags](Contract.md#tags) -- [type](Contract.md#type) -- [version](Contract.md#version) - -## Properties - -### abi - -• `Readonly` **abi**: `object`[] - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:21 - -___ - -### address - -• `Readonly` **address**: `string` - -#### Inherited from - -[ContractIdentifier](ContractIdentifier.md).[address](ContractIdentifier.md#address) - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:18 - -___ - -### chainId - -• `Readonly` **chainId**: `number` - -#### Inherited from - -[ContractIdentifier](ContractIdentifier.md).[chainId](ContractIdentifier.md#chainid) - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:17 - -___ - -### extensions - -• `Optional` `Readonly` **extensions**: `Object` - -#### Index signature - -▪ [key: `string`]: `any` - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:23 - -___ - -### tags - -• `Optional` `Readonly` **tags**: `string`[] - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:22 - -___ - -### type - -• `Readonly` **type**: `string` - -#### Inherited from - -[ABIIdentifier](ABIIdentifier.md).[type](ABIIdentifier.md#type) - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:14 - -___ - -### version - -• `Readonly` **version**: [`Version`](Version.md) - -#### Inherited from - -[ABIIdentifier](ABIIdentifier.md).[version](ABIIdentifier.md#version) - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:13 diff --git a/docs/interfaces/ContractIdentifier.md b/docs/interfaces/ContractIdentifier.md deleted file mode 100644 index 58baa1c..0000000 --- a/docs/interfaces/ContractIdentifier.md +++ /dev/null @@ -1,36 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / ContractIdentifier - -# Interface: ContractIdentifier - -## Hierarchy - -- **`ContractIdentifier`** - - ↳ [`Contract`](Contract.md) - -## Table of contents - -### Properties - -- [address](ContractIdentifier.md#address) -- [chainId](ContractIdentifier.md#chainid) - -## Properties - -### address - -• `Readonly` **address**: `string` - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:18 - -___ - -### chainId - -• `Readonly` **chainId**: `number` - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:17 diff --git a/docs/interfaces/ContractList.md b/docs/interfaces/ContractList.md deleted file mode 100644 index cba523b..0000000 --- a/docs/interfaces/ContractList.md +++ /dev/null @@ -1,52 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / ContractList - -# Interface: ContractList - -## Table of contents - -### Properties - -- [contracts](ContractList.md#contracts) -- [name](ContractList.md#name) -- [tags](ContractList.md#tags) -- [version](ContractList.md#version) - -## Properties - -### contracts - -• **contracts**: [`Contract`](Contract.md)[] - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:31 - -___ - -### name - -• **name**: `string` - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:28 - -___ - -### tags - -• **tags**: [`Tags`](Tags.md) - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:30 - -___ - -### version - -• **version**: [`Version`](Version.md) - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:29 diff --git a/docs/interfaces/Draw.md b/docs/interfaces/Draw.md deleted file mode 100644 index 21c889b..0000000 --- a/docs/interfaces/Draw.md +++ /dev/null @@ -1,63 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / Draw - -# Interface: Draw - -## Table of contents - -### Properties - -- [beaconPeriodSeconds](Draw.md#beaconperiodseconds) -- [beaconPeriodStartedAt](Draw.md#beaconperiodstartedat) -- [drawId](Draw.md#drawid) -- [timestamp](Draw.md#timestamp) -- [winningRandomNumber](Draw.md#winningrandomnumber) - -## Properties - -### beaconPeriodSeconds - -• **beaconPeriodSeconds**: `number` - -#### Defined in - -[src/types.ts:46](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L46) - -___ - -### beaconPeriodStartedAt - -• **beaconPeriodStartedAt**: `BigNumber` - -#### Defined in - -[src/types.ts:45](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L45) - -___ - -### drawId - -• **drawId**: `number` - -#### Defined in - -[src/types.ts:42](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L42) - -___ - -### timestamp - -• **timestamp**: `BigNumber` - -#### Defined in - -[src/types.ts:43](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L43) - -___ - -### winningRandomNumber - -• **winningRandomNumber**: `BigNumber` - -#### Defined in - -[src/types.ts:44](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L44) diff --git a/docs/interfaces/Prize.md b/docs/interfaces/Prize.md deleted file mode 100644 index 9244866..0000000 --- a/docs/interfaces/Prize.md +++ /dev/null @@ -1,52 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / Prize - -# Interface: Prize - -## Table of contents - -### Properties - -- [address](Prize.md#address) -- [amount](Prize.md#amount) -- [pick](Prize.md#pick) -- [tier](Prize.md#tier) - -## Properties - -### address - -• **address**: `string` - -#### Defined in - -[src/types.ts:33](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L33) - -___ - -### amount - -• **amount**: `string` - -#### Defined in - -[src/types.ts:36](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L36) - -___ - -### pick - -• **pick**: `string` - -#### Defined in - -[src/types.ts:34](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L34) - -___ - -### tier - -• **tier**: `number` - -#### Defined in - -[src/types.ts:35](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L35) diff --git a/docs/interfaces/PrizePoolTokenBalances.md b/docs/interfaces/PrizePoolTokenBalances.md deleted file mode 100644 index 998d32c..0000000 --- a/docs/interfaces/PrizePoolTokenBalances.md +++ /dev/null @@ -1,30 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / PrizePoolTokenBalances - -# Interface: PrizePoolTokenBalances - -## Table of contents - -### Properties - -- [ticket](PrizePoolTokenBalances.md#ticket) -- [token](PrizePoolTokenBalances.md#token) - -## Properties - -### ticket - -• **ticket**: `BigNumber` - -#### Defined in - -[src/types.ts:11](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L11) - -___ - -### token - -• **token**: `BigNumber` - -#### Defined in - -[src/types.ts:12](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L12) diff --git a/docs/interfaces/Providers.md b/docs/interfaces/Providers.md deleted file mode 100644 index d5a3757..0000000 --- a/docs/interfaces/Providers.md +++ /dev/null @@ -1,7 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / Providers - -# Interface: Providers - -## Indexable - -▪ [chainId: `number`]: `Provider` diff --git a/docs/interfaces/SignersOrProviders.md b/docs/interfaces/SignersOrProviders.md deleted file mode 100644 index 5ada50d..0000000 --- a/docs/interfaces/SignersOrProviders.md +++ /dev/null @@ -1,7 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / SignersOrProviders - -# Interface: SignersOrProviders - -## Indexable - -▪ [chainId: `number`]: `Provider` \| `Signer` diff --git a/docs/interfaces/Tags.md b/docs/interfaces/Tags.md deleted file mode 100644 index 62e8875..0000000 --- a/docs/interfaces/Tags.md +++ /dev/null @@ -1,7 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / Tags - -# Interface: Tags - -## Indexable - -▪ [tagId: `string`]: { `description`: `string` ; `name`: `string` } diff --git a/docs/interfaces/TokenData.md b/docs/interfaces/TokenData.md deleted file mode 100644 index 6a5ad06..0000000 --- a/docs/interfaces/TokenData.md +++ /dev/null @@ -1,41 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / TokenData - -# Interface: TokenData - -## Table of contents - -### Properties - -- [decimals](TokenData.md#decimals) -- [name](TokenData.md#name) -- [symbol](TokenData.md#symbol) - -## Properties - -### decimals - -• **decimals**: `string` - -#### Defined in - -[src/types.ts:7](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L7) - -___ - -### name - -• **name**: `string` - -#### Defined in - -[src/types.ts:5](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L5) - -___ - -### symbol - -• **symbol**: `string` - -#### Defined in - -[src/types.ts:6](https://github.com/pooltogether/v4-client-js/blob/7357147/src/types.ts#L6) diff --git a/docs/interfaces/Version.md b/docs/interfaces/Version.md deleted file mode 100644 index b626782..0000000 --- a/docs/interfaces/Version.md +++ /dev/null @@ -1,41 +0,0 @@ -[@pooltogether/v4-client-js](../README.md) / [Exports](../modules.md) / Version - -# Interface: Version - -## Table of contents - -### Properties - -- [major](Version.md#major) -- [minor](Version.md#minor) -- [patch](Version.md#patch) - -## Properties - -### major - -• `Readonly` **major**: `number` - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:2 - -___ - -### minor - -• `Readonly` **minor**: `number` - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:3 - -___ - -### patch - -• `Readonly` **patch**: `number` - -#### Defined in - -node_modules/@pooltogether/contract-list-schema/dist/types.d.ts:4 diff --git a/docs/modules.md b/docs/modules.md deleted file mode 100644 index c020c1d..0000000 --- a/docs/modules.md +++ /dev/null @@ -1,904 +0,0 @@ -[@pooltogether/v4-client-js](README.md) / Exports - -# @pooltogether/v4-client-js - -## Table of contents - -### Classes - -- [ContractFactory](classes/ContractFactory.md) -- [PrizeApi](classes/PrizeApi.md) -- [PrizeDistributor](classes/PrizeDistributor.md) -- [PrizePool](classes/PrizePool.md) -- [PrizePoolNetwork](classes/PrizePoolNetwork.md) -- [User](classes/User.md) - -### Interfaces - -- [ABIIdentifier](interfaces/ABIIdentifier.md) -- [ChildContractAddresses](interfaces/ChildContractAddresses.md) -- [Contract](interfaces/Contract.md) -- [ContractIdentifier](interfaces/ContractIdentifier.md) -- [ContractList](interfaces/ContractList.md) -- [Draw](interfaces/Draw.md) -- [Prize](interfaces/Prize.md) -- [PrizePoolTokenBalances](interfaces/PrizePoolTokenBalances.md) -- [Providers](interfaces/Providers.md) -- [SignersOrProviders](interfaces/SignersOrProviders.md) -- [Tags](interfaces/Tags.md) -- [TokenData](interfaces/TokenData.md) -- [Version](interfaces/Version.md) - -### Type aliases - -- [Claim](modules.md#claim) -- [DrawCalcDraw](modules.md#drawcalcdraw) -- [DrawCalcUser](modules.md#drawcalcuser) -- [DrawCalcUserDrawResult](modules.md#drawcalcuserdrawresult) -- [DrawResults](modules.md#drawresults) -- [Pick](modules.md#pick) -- [PickPrize](modules.md#pickprize) -- [PrizeAwardable](modules.md#prizeawardable) -- [PrizeDistribution](modules.md#prizedistribution) -- [PrizeTier](modules.md#prizetier) - -### Functions - -- [batchCalculateDrawResults](modules.md#batchcalculatedrawresults) -- [calculateDrawResults](modules.md#calculatedrawresults) -- [calculateNumberOfPicksForUser](modules.md#calculatenumberofpicksforuser) -- [calculateNumberOfPrizesForIndex](modules.md#calculatenumberofprizesforindex) -- [calculatePrizeForDistributionIndex](modules.md#calculateprizefordistributionindex) -- [computeCardinality](modules.md#computecardinality) -- [computeDrawResults](modules.md#computedrawresults) -- [computePicks](modules.md#computepicks) -- [createContract](modules.md#createcontract) -- [createContractMetadata](modules.md#createcontractmetadata) -- [createInterface](modules.md#createinterface) -- [filterResultsByValue](modules.md#filterresultsbyvalue) -- [formatTierToBasePercentage](modules.md#formattiertobasepercentage) -- [generatePicks](modules.md#generatepicks) -- [getContractListChainIds](modules.md#getcontractlistchainids) -- [getContractsByType](modules.md#getcontractsbytype) -- [getMetadataAndContract](modules.md#getmetadataandcontract) -- [getTokenData](modules.md#gettokendata) -- [getUsersERC20Balance](modules.md#getuserserc20balance) -- [getUsersTokenAllowance](modules.md#getuserstokenallowance) -- [initializePrizeDistributors](modules.md#initializeprizedistributors) -- [initializePrizePools](modules.md#initializeprizepools) -- [prepareClaims](modules.md#prepareclaims) -- [sortContractsByChainId](modules.md#sortcontractsbychainid) -- [sortContractsByContractTypeAndChildren](modules.md#sortcontractsbycontracttypeandchildren) -- [validateAddress](modules.md#validateaddress) -- [validateIsSigner](modules.md#validateissigner) -- [validateSignerNetwork](modules.md#validatesignernetwork) -- [validateSignerOrProviderNetwork](modules.md#validatesignerorprovidernetwork) - -## Type aliases - -### Claim - -Ƭ **Claim**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `drawIds` | `number`[] | -| `encodedWinningPickIndices` | `string` | -| `userAddress` | `string` | -| `winningPickIndices` | `BigNumber`[][] | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:45 - -___ - -### DrawCalcDraw - -Ƭ **DrawCalcDraw**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `beaconPeriodSeconds?` | `number` | -| `beaconPeriodStartedAt?` | `number` | -| `drawId` | `number` | -| `timestamp?` | `number` | -| `winningRandomNumber` | `BigNumber` | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:15 - -___ - -### DrawCalcUser - -Ƭ **DrawCalcUser**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `normalizedBalances` | `BigNumber`[] | -| `picks?` | [`Pick`](modules.md#pick)[] | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:26 - -___ - -### DrawCalcUserDrawResult - -Ƭ **DrawCalcUserDrawResult**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `drawResult` | [`DrawResults`](modules.md#drawresults) | -| `user` | [`DrawCalcUser`](modules.md#drawcalcuser) | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:51 - -___ - -### DrawResults - -Ƭ **DrawResults**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `drawId` | `number` | -| `prizes` | [`PrizeAwardable`](modules.md#prizeawardable)[] | -| `totalValue` | `BigNumber` | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:31 - -___ - -### Pick - -Ƭ **Pick**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `hash` | `string` | -| `index` | `number` | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:22 - -___ - -### PickPrize - -Ƭ **PickPrize**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `amount` | `BigNumber` | -| `distributionIndex` | `number` | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:41 - -___ - -### PrizeAwardable - -Ƭ **PrizeAwardable**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `amount` | `BigNumber` | -| `distributionIndex` | `number` | -| `pick` | `BigNumber` | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:36 - -___ - -### PrizeDistribution - -Ƭ **PrizeDistribution**: [`PrizeTier`](modules.md#prizetier) & { `drawEndTimestampOffset?`: `number` ; `drawStartTimestampOffset?`: `number` ; `matchCardinality`: `number` ; `numberOfPicks`: `BigNumber` } - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:9 - -___ - -### PrizeTier - -Ƭ **PrizeTier**: `Object` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `bitRangeSize` | `number` | -| `expiryDuration?` | `number` | -| `maxPicksPerUser` | `number` | -| `prize` | `BigNumber` | -| `tiers` | `number`[] | - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/types.d.ts:2 - -## Functions - -### batchCalculateDrawResults - -▸ **batchCalculateDrawResults**(`prizeDistribution`, `draws`, `user`): [`DrawResults`](modules.md#drawresults)[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `prizeDistribution` | [`PrizeDistribution`](modules.md#prizedistribution)[] | -| `draws` | [`DrawCalcDraw`](modules.md#drawcalcdraw)[] | -| `user` | [`DrawCalcUser`](modules.md#drawcalcuser) | - -#### Returns - -[`DrawResults`](modules.md#drawresults)[] - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/batchCalculateDrawResults.d.ts:2 - -___ - -### calculateDrawResults - -▸ **calculateDrawResults**(`prizeDistribution`, `draw`, `user`, `drawIndex?`): [`DrawResults`](modules.md#drawresults) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `prizeDistribution` | [`PrizeDistribution`](modules.md#prizedistribution) | -| `draw` | [`DrawCalcDraw`](modules.md#drawcalcdraw) | -| `user` | [`DrawCalcUser`](modules.md#drawcalcuser) | -| `drawIndex?` | `number` | - -#### Returns - -[`DrawResults`](modules.md#drawresults) - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/calculateDrawResults.d.ts:2 - -___ - -### calculateNumberOfPicksForUser - -▸ **calculateNumberOfPicksForUser**(`prizeDistribution`, `normalizedBalance`): `number` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `prizeDistribution` | [`PrizeDistribution`](modules.md#prizedistribution) | -| `normalizedBalance` | `BigNumber` | - -#### Returns - -`number` - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/helpers/calculateNumberOfPicksForUser.d.ts:3 - -___ - -### calculateNumberOfPrizesForIndex - -▸ **calculateNumberOfPrizesForIndex**(`bitRangeSize`, `tierIndex`): `number` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `bitRangeSize` | `number` | -| `tierIndex` | `number` | - -#### Returns - -`number` - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/helpers/calculateNumberOfPrizesForIndex.d.ts:1 - -___ - -### calculatePrizeForDistributionIndex - -▸ **calculatePrizeForDistributionIndex**(`distributionIndex`, `prizeDistrbution`): `BigNumber` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `distributionIndex` | `number` | -| `prizeDistrbution` | [`PrizeDistribution`](modules.md#prizedistribution) | - -#### Returns - -`BigNumber` - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/helpers/calculatePrizeForDistributionIndex.d.ts:3 - -___ - -### computeCardinality - -▸ **computeCardinality**(`bitRangeSize`, `totalSupply`, `totalSupplyDecimals?`): `number` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `bitRangeSize` | `number` | -| `totalSupply` | `BigNumber` | -| `totalSupplyDecimals?` | `number` | - -#### Returns - -`number` - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/computeCardinality.d.ts:2 - -___ - -### computeDrawResults - -▸ **computeDrawResults**(`prizeDistribution`, `draw`, `picks`): [`DrawResults`](modules.md#drawresults) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `prizeDistribution` | [`PrizeDistribution`](modules.md#prizedistribution) | -| `draw` | [`DrawCalcDraw`](modules.md#drawcalcdraw) | -| `picks` | [`Pick`](modules.md#pick)[] | - -#### Returns - -[`DrawResults`](modules.md#drawresults) - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/computeDrawResults.d.ts:2 - -___ - -### computePicks - -▸ **computePicks**(`address`, `pickIndices`): [`Pick`](modules.md#pick)[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `pickIndices` | `BigNumber`[] | - -#### Returns - -[`Pick`](modules.md#pick)[] - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/computePicks.d.ts:3 - -___ - -### createContract - -▸ `Const` **createContract**(`address`, `contractInterface`, `provider`): `Contract` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `contractInterface` | `Interface` | -| `provider` | `Signer` \| `Provider` | - -#### Returns - -`Contract` - -#### Defined in - -[src/utils/createContract.ts:6](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/createContract.ts#L6) - -___ - -### createContractMetadata - -▸ **createContractMetadata**(`chainId`, `address`, `type`, `abi`, `version?`, `tags?`, `extensions?`): [`Contract`](interfaces/Contract.md) - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `chainId` | `number` | `undefined` | -| `address` | `string` | `undefined` | -| `type` | `ContractType` | `undefined` | -| `abi` | `any`[] | `undefined` | -| `version` | [`Version`](interfaces/Version.md) | `undefined` | -| `tags` | `string`[] | `[]` | -| `extensions` | `Object` | `{}` | - -#### Returns - -[`Contract`](interfaces/Contract.md) - -#### Defined in - -[src/utils/createContractMetadata.ts:6](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/createContractMetadata.ts#L6) - -___ - -### createInterface - -▸ **createInterface**(`abi`): `Interface` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `abi` | `any` | - -#### Returns - -`Interface` - -#### Defined in - -[src/utils/createInterface.ts:3](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/createInterface.ts#L3) - -___ - -### filterResultsByValue - -▸ **filterResultsByValue**(`drawResults`, `maxPicksPerUser`): [`DrawResults`](modules.md#drawresults) - -Filters out prizes if: -- there's more prizes than the max picks per user -- the prize won is 0 tokens - -Sorts prizes by descending value too. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `drawResults` | [`DrawResults`](modules.md#drawresults) | -| `maxPicksPerUser` | `number` | - -#### Returns - -[`DrawResults`](modules.md#drawresults) - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/helpers/filterResultsByValue.d.ts:12 - -___ - -### formatTierToBasePercentage - -▸ **formatTierToBasePercentage**(`distribution`): `BigNumber` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `distribution` | `string` | - -#### Returns - -`BigNumber` - -#### Defined in - -[src/utils/formatTierToBasePercentage.ts:5](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/formatTierToBasePercentage.ts#L5) - -___ - -### generatePicks - -▸ **generatePicks**(`prizeDistribution`, `address`, `normalizedBalance`): [`Pick`](modules.md#pick)[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `prizeDistribution` | [`PrizeDistribution`](modules.md#prizedistribution) | -| `address` | `string` | -| `normalizedBalance` | `BigNumber` | - -#### Returns - -[`Pick`](modules.md#pick)[] - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/generatePicks.d.ts:3 - -___ - -### getContractListChainIds - -▸ **getContractListChainIds**(`contracts`): `number`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contracts` | [`Contract`](interfaces/Contract.md)[] | - -#### Returns - -`number`[] - -#### Defined in - -[src/utils/getContractListChainIds.ts:3](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/getContractListChainIds.ts#L3) - -___ - -### getContractsByType - -▸ **getContractsByType**(`contracts`, `type`): [`Contract`](interfaces/Contract.md)[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contracts` | [`Contract`](interfaces/Contract.md)[] | -| `type` | `ContractType` | - -#### Returns - -[`Contract`](interfaces/Contract.md)[] - -#### Defined in - -[src/utils/getContractsByType.ts:4](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/getContractsByType.ts#L4) - -___ - -### getMetadataAndContract - -▸ **getMetadataAndContract**(`chainId`, `signerOrProvider`, `contractType`, `contractMetadataList`, `addressOverride?`): `Object` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `chainId` | `number` | -| `signerOrProvider` | `Signer` \| `Provider` | -| `contractType` | `ContractType` | -| `contractMetadataList` | [`Contract`](interfaces/Contract.md)[] | -| `addressOverride?` | `string` | - -#### Returns - -`Object` - -| Name | Type | -| :------ | :------ | -| `contract` | `Contract` | -| `contractMetadata` | [`Contract`](interfaces/Contract.md) | - -#### Defined in - -[src/utils/getMetadataAndContract.ts:10](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/getMetadataAndContract.ts#L10) - -___ - -### getTokenData - -▸ **getTokenData**(`tokenContract`): `Promise`<[`TokenData`](interfaces/TokenData.md)\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tokenContract` | `Contract` | - -#### Returns - -`Promise`<[`TokenData`](interfaces/TokenData.md)\> - -#### Defined in - -[src/utils/contractGetters.ts:7](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/contractGetters.ts#L7) - -___ - -### getUsersERC20Balance - -▸ **getUsersERC20Balance**(`usersAddress`, `tokenContract`): `Promise`<`BigNumber`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `usersAddress` | `string` | -| `tokenContract` | `Contract` | - -#### Returns - -`Promise`<`BigNumber`\> - -#### Defined in - -[src/utils/contractGetters.ts:19](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/contractGetters.ts#L19) - -___ - -### getUsersTokenAllowance - -▸ **getUsersTokenAllowance**(`usersAddress`, `spendersAddress`, `tokenContract`): `Promise`<`BigNumber`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `usersAddress` | `string` | -| `spendersAddress` | `string` | -| `tokenContract` | `Contract` | - -#### Returns - -`Promise`<`BigNumber`\> - -#### Defined in - -[src/utils/contractGetters.ts:27](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/contractGetters.ts#L27) - -___ - -### initializePrizeDistributors - -▸ **initializePrizeDistributors**(`contractList`, `signersOrProviders`): [`PrizeDistributor`](classes/PrizeDistributor.md)[] - -Utility function to create several PrizeDistributors from a contract list. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `contractList` | [`ContractList`](interfaces/ContractList.md) | a list of all of the relevant contract metadata for all of the PrizeDistributors to create | -| `signersOrProviders` | [`SignersOrProviders`](interfaces/SignersOrProviders.md) | signers or providers for all of the networks the PrizeDistributors are deployed on keyed by the chain id | - -#### Returns - -[`PrizeDistributor`](classes/PrizeDistributor.md)[] - -a list of PrizeDistributors - -#### Defined in - -[src/PrizeDistributor.ts:873](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizeDistributor.ts#L873) - -___ - -### initializePrizePools - -▸ **initializePrizePools**(`contractList`, `providers`): [`PrizePool`](classes/PrizePool.md)[] - -A utility function to create several PrizePools from a contract list. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `contractList` | [`ContractList`](interfaces/ContractList.md) | a list of all of the relevant contract metadata for all of the Prize Pools | -| `providers` | [`Providers`](interfaces/Providers.md) | providers for all of the networks in the list of Prize Pools | - -#### Returns - -[`PrizePool`](classes/PrizePool.md)[] - -a list of initialized PrizePools - -#### Defined in - -[src/PrizePool.ts:326](https://github.com/pooltogether/v4-client-js/blob/7357147/src/PrizePool.ts#L326) - -___ - -### prepareClaims - -▸ **prepareClaims**(`user`, `drawResults`): [`Claim`](modules.md#claim) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `user` | [`DrawCalcUser`](modules.md#drawcalcuser) | -| `drawResults` | [`DrawResults`](modules.md#drawresults)[] | - -#### Returns - -[`Claim`](modules.md#claim) - -#### Defined in - -node_modules/@pooltogether/draw-calculator-js/dist/prepareClaims.d.ts:2 - -___ - -### sortContractsByChainId - -▸ **sortContractsByChainId**(`contracts`): `Object` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contracts` | [`Contract`](interfaces/Contract.md)[] | - -#### Returns - -`Object` - -#### Defined in - -[src/utils/sortContractsByChainId.ts:3](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/sortContractsByChainId.ts#L3) - -___ - -### sortContractsByContractTypeAndChildren - -▸ **sortContractsByContractTypeAndChildren**(`contracts`, `contractType`): [`Contract`](interfaces/Contract.md)[][] - -Reads the contract list and pulls out connected contracts based on the -children extension. - -NOTE: This extension is added in the intialize functions for creating the instances of -PrizePoolNetwork and PrizeDistributors - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contracts` | [`Contract`](interfaces/Contract.md)[] | -| `contractType` | `ContractType` | - -#### Returns - -[`Contract`](interfaces/Contract.md)[][] - -#### Defined in - -[src/utils/sortContractsByContractTypeAndChildren.ts:12](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/sortContractsByContractTypeAndChildren.ts#L12) - -___ - -### validateAddress - -▸ **validateAddress**(`errorPrefix`, `address`): `void` - -Throws an error if the provided address is invalid. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `errorPrefix` | `string` | the class and function name of where the error occurred | -| `address` | `string` | the address to validate | - -#### Returns - -`void` - -#### Defined in - -[src/utils/validation.ts:10](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/validation.ts#L10) - -___ - -### validateIsSigner - -▸ **validateIsSigner**(`errorPrefix`, `signerOrProvider`): `void` - -Throws an error if the signerOrProvider is not a Signer - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `errorPrefix` | `string` | the class and function name of where the error occurred | -| `signerOrProvider` | `Signer` \| `Provider` | a Signer or Provider to check | - -#### Returns - -`void` - -#### Defined in - -[src/utils/validation.ts:37](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/validation.ts#L37) - -___ - -### validateSignerNetwork - -▸ **validateSignerNetwork**(`errorPrefix`, `signer`, `chainId`): `Promise`<`void`\> - -Throws an error if the Signer provided is not on the chain id provided. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `errorPrefix` | `string` | the class and function name of where the error occurred | -| `signer` | `Signer` | a Signer to validate | -| `chainId` | `number` | the network to check for | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[src/utils/validation.ts:23](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/validation.ts#L23) - -___ - -### validateSignerOrProviderNetwork - -▸ **validateSignerOrProviderNetwork**(`errorPrefix`, `signerOrProvider`, `chainId`): `Promise`<`void`\> - -Throws and error if the Signer or Provider is not on the chain id provided. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `errorPrefix` | `string` | the class and function name of where the error occurred | -| `signerOrProvider` | `Signer` \| `Provider` | a Signer or Provider to check | -| `chainId` | `number` | the network to check for | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[src/utils/validation.ts:49](https://github.com/pooltogether/v4-client-js/blob/7357147/src/utils/validation.ts#L49) diff --git a/package.json b/package.json index 7c0a2b1..14d0599 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,16 @@ { "name": "@pooltogether/v4-client-js", "author": "PoolTogether Inc.", + "description": "Client library for simple interactions with PoolTogether V4 contracts.", "module": "dist/v4-client-js.esm.js", "version": "0.10.2", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", + "bugs": { + "url": "https://github.com/pooltogether/issues", + "email": "bugs@pooltogether.com" + }, "files": [ "dist", "src" @@ -29,8 +34,10 @@ "prepare": "tsdx build", "size": "size-limit", "analyze": "size-limit --why", - "prepublish": "yarn docs", - "docs": "yarn typedoc src/index.ts --out docs --readme docs/README.md" + "docs": "yarn docs:md ; yarn docs:clean", + "docs:md": "yarn typedoc --plugin typedoc-plugin-markdown --entryDocument index.md --hideBreadcrumbs true --namedAnchors false --out docs/md", + "docs:html": "yarn typedoc --plugin none --out docs/app src/index.ts ", + "docs:clean": "node ./scripts/docsFindAndReplace.js ; node ./scripts/docsCleanup.js" }, "husky": { "hooks": { @@ -62,6 +69,7 @@ "@size-limit/preset-small-lib": "^5.0.3", "@types/lodash.memoize": "^4.1.6", "husky": "^7.0.2", + "replace-in-files": "^3.0.0", "size-limit": "^5.0.3", "tsdx": "^0.14.1", "tslib": "^2.3.1", diff --git a/scripts/docsCleanup.js b/scripts/docsCleanup.js new file mode 100644 index 0000000..1537a28 --- /dev/null +++ b/scripts/docsCleanup.js @@ -0,0 +1,25 @@ +#!/usr/bin/env node + +const fs = require('fs') + +// const path = './docs/md/modules.md' +// try { +// fs.unlinkSync(path) +// } catch (err) { +// console.error(err) +// } + +const paths = [ + // ['./docs/md/modules/calculate.md', './docs/md/calculate.md'], + // ['./docs/md/modules/compute.md', './docs/md/compute.md'], + // ['./docs/md/modules/utils.md', './docs/md/utils.md'] +] + +try { + for (let index = 0; index < paths.length; index++) { + const element = paths[index] + fs.renameSync(element[0], element[1]) + } +} catch (err) { + console.error(err) +} diff --git a/scripts/docsFindAndReplace.js b/scripts/docsFindAndReplace.js new file mode 100644 index 0000000..71de0dc --- /dev/null +++ b/scripts/docsFindAndReplace.js @@ -0,0 +1,38 @@ +const replaceInFiles = require('replace-in-files') + +const replaces = [ + // [/modules.md/g, 'modules'], + // [/calculate.md/g, ''], + // [/Namespace:/g, ''] +] + +const createOptions = (from, to) => { + const options = { + files: 'docs/md/**/*.md', + from: from, // string or regex + to: to, // string or fn (fn: carrying last argument - path to replaced file) + optionsForFiles: { + ignore: ['**/node_modules/**'] + }, + saveOldFile: false, + encoding: 'utf8', + shouldSkipBinaryFiles: true, + onlyFindPathsWithoutReplace: false, + returnPaths: true, + returnCountOfMatchesByPaths: true + } + return options +} + +for (let index = 0; index < replaces.length; index++) { + const element = replaces[index] + replaceInFiles(createOptions(element[0], element[1])) + .then(({ changedFiles, countOfMatchesByPaths }) => { + console.log('Modified files:', changedFiles) + console.log('Count of matches by paths:', countOfMatchesByPaths) + console.log('was called with:', options) + }) + .catch((error) => { + console.error('Error occurred:', error) + }) +} diff --git a/tsconfig.json b/tsconfig.json index 6d8286c..bb3d13a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,39 @@ { "include": ["src", "types"], + "typedocOptions": { + "entryPoints": ["./src/index.ts"], + "out": "docs", + "readme": "DOCUMENTATION.md", + "exclude": ["**+/node_modules/+*.ts"] + }, "compilerOptions": { - "target": "ES6", + "resolveJsonModule": true, "module": "esnext", "lib": ["dom", "esnext"], "importHelpers": true, + // output .d.ts declaration files for consumers "declaration": true, + // output .js.map sourcemap files for consumers "sourceMap": true, + // match output dir to input dir. e.g. dist/index instead of dist/src/index "rootDir": "./src", + // stricter type-checking for stronger correctness. Recommended by TS "strict": true, + // linter checks for common issues "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "noUnusedLocals": true, + // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative + "noUnusedLocals": false, + "noUnusedParameters": true, + // use Node's module resolution algorithm, instead of the legacy TS one "moduleResolution": "node", + // transpile JSX to React.createElement "jsx": "react", - "esModuleInterop": true + // interop between ESM and CJS modules. Recommended by TS + "esModuleInterop": true, + // error out if import and file system have a casing mismatch. Recommended by TS + "forceConsistentCasingInFileNames": true, + // `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc` + "noEmit": true } } diff --git a/yarn.lock b/yarn.lock index 97281f9..b7923ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3609,6 +3609,11 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +es6-promisify@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-6.1.1.tgz#46837651b7b06bf6fff893d03f29393668d01621" + integrity sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg== + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -4454,7 +4459,7 @@ globalyzer@0.1.0: resolved "https://registry.yarnpkg.com/globalyzer/-/globalyzer-0.1.0.tgz#cb76da79555669a1519d5a8edf093afaa0bf1465" integrity sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q== -globby@^11.0.4: +globby@^11.0.1, globby@^11.0.4: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -4809,6 +4814,11 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" +is-binary@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-binary/-/is-binary-0.1.0.tgz#8e7d327a7ab907a838f8113e9ce5168dfdbbf3ab" + integrity sha1-jn0yenq5B6g4+BE+nOUWjf2786s= + is-boolean-object@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" @@ -7258,6 +7268,17 @@ repeat-string@^1.6.1: resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= +replace-in-files@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/replace-in-files/-/replace-in-files-3.0.0.tgz#535f6311c5188b2fb95b488304348a5d989517f2" + integrity sha512-f3lb8Fac0JZ56BrebGFoRaGvmSAF+M6Zcj0NZl3Qrd6L8HT2LA8/LObCjbTb4Sof/J/gg0tC9pUD/loW4X5u6w== + dependencies: + co "^4.6.0" + es6-promisify "^6.1.1" + globby "^11.0.1" + is-binary "^0.1.0" + lodash "^4.17.20" + request-promise-core@1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f"