# @manul.parihar/test-package

> Reports updated balance to Balance Report Smart Contract

Latest version **5.2.2** (published 2022-02-03) · 0 weekly downloads

## Install

```sh
npm install @manul.parihar/test-package
pnpm add @manul.parihar/test-package
yarn add @manul.parihar/test-package
bun add @manul.parihar/test-package
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.2.2 |
| Published | 2022-02-03 |
| First published | 2022-01-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 147.5 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | manul.parihar |

## Links

- npm: https://www.npmjs.com/package/@manul.parihar/test-package
- Repository: https://github.com/ManulParihar/test-package
- npm.io page: https://npm.io/package/@manul.parihar/test-package

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^0.24.0
- [dotenv](https://npm.io/package/dotenv.md) ^15.0.0
- [ethers](https://npm.io/package/ethers.md) ^5.5.3
- [graphql](https://npm.io/package/graphql.md) ^16.3.0
- [graphql-request](https://npm.io/package/graphql-request.md) ^3.7.0

## Recent versions

- 5.2.2 (latest) — 2022-02-03
- 5.2.1 — 2022-02-03
- 5.1.0 — 2022-02-02
- 5.0.3 — 2022-02-02
- 5.0.2 — 2022-02-02
- 5.0.1 — 2022-02-02
- 5.0.0 — 2022-02-02
- 4.0.4 — 2022-02-02
- 4.0.2 — 2022-02-01
- 4.0.1 — 2022-01-14
- 4.0.0 — 2022-01-14
- 3.0.1 — 2022-01-14
- 3.0.0 — 2022-01-14
- 2.4.0 — 2022-01-14
- 2.3.0 — 2022-01-13
- … 5 more at https://npm.io/package/@manul.parihar/test-package/versions

## README

# @blockswaplab/stakehouse-sdk
Stakehouse SDK is a NPM Package which can be used by ETH2 validators to interact with the Balance Reporter Smart Contract, retreive finalised epoch report from beacon chain, authenticate the finalised epoch report and update their increased ETH balance.  
  
## Installation
To install the package use the comamnd `npm i @manul.parihar/test-package`
  
## Using test-package
Import the package as shown below
```
const { getFinalisedEpochReport, authenticateReport, reportBalanceIncrease } = require("@manul.parihar/test-package");
```  

## getFinalisedEpochReport function
This function accepts a beacon node URL and BLS Public Key to return the most recent finalised epoch report. This report can then be authenticated using the authenticateReport function and the resulting output can be fed to the reportBalanceIncrease to submit updated ETH balance to the Balance Reporter Smart Contract. 

### Input Parameter
beaconNodeURL : URL of the beacon chain node,  
blsPublicKey : Validator's BLS Public key  

### Using getFinalisedEpochReport function
```
getFinalisedEpochReport(beaconNodeURL, blsPublicKey);
```

### Return Parameter
```
// This is what a finalised epoch report looks like
{  
  "blsPublicKey":"a97f0308ffffd1d253f35ef4d8309059b7d89fd53...",  
  "withdrawalCredentials":"010000000000000000000000f847b446...",  
  "slashed":false,  
  "activeBalance":"32042871296",  
  "effectiveBalance":"32000000000",  
  "exitEpoch":"18446744073709551615",  
  "activationEpoch":"63601",  
  "withdrawalEpoch":"18446744073709551615",  
  "currentCheckpointEpoch":66805  
}
```
  
  
## authenticateReport function
This function accepts a finalised beacon chain report from the user and returns Deposit Router response data if the authentication was successful, otherwise an error statement is returned.  

### Input Parameter
finalisedBeaconChainReport : 
```
// This is just a sample Finalised Beacon Chain Report
{  
  "blsPublicKey":"a97f0308ffffd1d253f35ef4d8309059b7d89fd53...",  
  "withdrawalCredentials":"010000000000000000000000f847b446...",  
  "slashed":false,  
  "activeBalance":"32042871296",  
  "effectiveBalance":"32000000000",  
  "exitEpoch":"18446744073709551615",  
  "activationEpoch":"63601",  
  "withdrawalEpoch":"18446744073709551615",  
  "currentCheckpointEpoch":66805  
}
```

### Using authenticateReport function
```
authenticateReport(finalisedBeaconChainReport);
```

### Return Parameter
If the authentication was successful, then a Deposit Router response is returned. Here is how it looks like : 
```
{
  report: {
    blsPublicKey: 'a97f0308ffffd1d253f35ef4d8309059b7d89f...',
    withdrawalCredentials: '010000000000000000000000f847b...',
    slashed: false,
    activeBalance: '32042855400',
    effectiveBalance: '32000000000',
    exitEpoch: '18446744073709551615',
    activationEpoch: '63601',
    withdrawalEpoch: '18446744073709551615',
    currentCheckpointEpoch: 66804
  },
  deadline: 6199503,
  v: 27,
  r: '88bf72df9e2b8e4588e26c4a50f4bfaf3746a57b52f50ee61f61...',
  s: '129474d568b986e7747b46e63438ab181c861d72831b3a674cbb...'
}
```
Otherwise, an error response is returned.
  

## reportBalanceIncrease function
This function allows validators to report their updated ETH balance to the Deposit Router  

### Input Parameters
signer : 
```
const provider = new ethers.providers.InfuraProvider("goerli", {
    projectId: INFURA_PROJECT_ID,
    projectSecret: INFURA_PROJECT_SECRET
});
const signer = new ethers.Wallet(PRIV_KEY, provider);
```
stakeHouseAddr : Address of the Stakehouse  
balanceReport : Deposit Router response obtained from the nodejs-balane-reporter 

### Using reportBalanceIncrease function
```
reportBalanceIncrease(signer, stakeHouseAddr, balanceReport);
```

### Return Parameter
Returns the transaction data

---
_Source: https://npm.io/package/@manul.parihar/test-package · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
