Skip to content

Commit

Permalink
Merge pull request #49 from lidofinance/develop
Browse files Browse the repository at this point in the history
Minor Release
  • Loading branch information
Jeday authored Oct 24, 2023
2 parents 3f86a29 + 3438612 commit 71d8ec2
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
cache: 'yarn'
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
"prettier": "^3.0.1",
"typescript": "^5.1.6"
},
"resolutions": {
"postcss": "8.4.31"
},
"workspaces": [
"packages/*",
"playground"
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/rewards/rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ export class LidoSDKRewards {
const fromBlock = await this.toBlockNumber(
props.fromBlock ?? toBlock - props.blocksBack,
);
invariant(toBlock > fromBlock, 'toBlock is higher than fromBlock');
invariant(toBlock >= fromBlock, 'toBlock is higher than fromBlock');

const { step = LidoSDKRewards.DEFAULT_STEP, includeZeroRebases = false } =
props;
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/rewards/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const requestWithBlockStep = async <TResultEntry>(
): Promise<TResultEntry[]> => {
let from = fromBlock;
const result: TResultEntry[] = [];
while (from < toBlock) {
while (from <= toBlock) {
const to = from + BigInt(step);
const nextResult = await request(from, to > toBlock ? toBlock : to);
result.push(...nextResult);
Expand Down
12 changes: 11 additions & 1 deletion playground/demo/rewards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const RewardsDemo = () => {
useAccount: true,
});
const [blocksBack, setBlocksBack] = useState(100000);
const [step, setStep] = useState(1000);
const [includeZeroRebases, setIncludeZeroRebases] = useState(false);
const { rewards } = useLidoSDK();

Expand All @@ -104,7 +105,7 @@ export const RewardsDemo = () => {
return rewards.getRewardsFromChain({
address: rewardsAddress,
blocksBack: BigInt(blocksBack),
step: 25000,
step,
includeZeroRebases,
});
}}
Expand All @@ -125,6 +126,14 @@ export const RewardsDemo = () => {
value={blocksBack}
onChange={(event) => setBlocksBack(event.currentTarget.valueAsNumber)}
/>
<Input
label="Requests Steps"
placeholder="1000"
min="1"
type="number"
value={step}
onChange={(event) => setStep(event.currentTarget.valueAsNumber)}
/>
<ToggleButton
title="Include Zero Rebases"
value={includeZeroRebases}
Expand All @@ -136,6 +145,7 @@ export const RewardsDemo = () => {
return rewards.getRewardsFromSubgraph({
address: rewardsAddress,
blocksBack: BigInt(blocksBack),
step,
includeZeroRebases,
// Warning! these endpoints will be deprecated
getSubgraphUrl(_, chainId) {
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10513,7 +10513,7 @@ __metadata:
languageName: node
linkType: hard

"nanoid@npm:^3.3.4":
"nanoid@npm:^3.3.6":
version: 3.3.6
resolution: "nanoid@npm:3.3.6"
bin:
Expand Down Expand Up @@ -11543,14 +11543,14 @@ __metadata:
languageName: node
linkType: hard

"postcss@npm:8.4.14":
version: 8.4.14
resolution: "postcss@npm:8.4.14"
"postcss@npm:8.4.31":
version: 8.4.31
resolution: "postcss@npm:8.4.31"
dependencies:
nanoid: ^3.3.4
nanoid: ^3.3.6
picocolors: ^1.0.0
source-map-js: ^1.0.2
checksum: fe58766ff32e4becf65a7d57678995cfd239df6deed2fe0557f038b47c94e4132e7e5f68b5aa820c13adfec32e523b693efaeb65798efb995ce49ccd83953816
checksum: 1d8611341b073143ad90486fcdfeab49edd243377b1f51834dc4f6d028e82ce5190e4f11bb2633276864503654fb7cab28e67abdc0fbf9d1f88cad4a0ff0beea
languageName: node
linkType: hard

Expand Down

0 comments on commit 71d8ec2

Please sign in to comment.