diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index a1cef68a..6b69d639 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -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' diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 780db793..40415bc1 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -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' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 869bbadf..fe247693 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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' diff --git a/package.json b/package.json index d822d973..ab7d73bc 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,9 @@ "prettier": "^3.0.1", "typescript": "^5.1.6" }, + "resolutions": { + "postcss": "8.4.31" + }, "workspaces": [ "packages/*", "playground" diff --git a/packages/sdk/src/rewards/rewards.ts b/packages/sdk/src/rewards/rewards.ts index 42a9888e..0fc3ebba 100644 --- a/packages/sdk/src/rewards/rewards.ts +++ b/packages/sdk/src/rewards/rewards.ts @@ -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; diff --git a/packages/sdk/src/rewards/utils.ts b/packages/sdk/src/rewards/utils.ts index 7731fba1..5cf5529b 100644 --- a/packages/sdk/src/rewards/utils.ts +++ b/packages/sdk/src/rewards/utils.ts @@ -19,7 +19,7 @@ export const requestWithBlockStep = async ( ): Promise => { 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); diff --git a/playground/demo/rewards/index.tsx b/playground/demo/rewards/index.tsx index 2d898e00..40093585 100644 --- a/playground/demo/rewards/index.tsx +++ b/playground/demo/rewards/index.tsx @@ -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(); @@ -104,7 +105,7 @@ export const RewardsDemo = () => { return rewards.getRewardsFromChain({ address: rewardsAddress, blocksBack: BigInt(blocksBack), - step: 25000, + step, includeZeroRebases, }); }} @@ -125,6 +126,14 @@ export const RewardsDemo = () => { value={blocksBack} onChange={(event) => setBlocksBack(event.currentTarget.valueAsNumber)} /> + setStep(event.currentTarget.valueAsNumber)} + /> { return rewards.getRewardsFromSubgraph({ address: rewardsAddress, blocksBack: BigInt(blocksBack), + step, includeZeroRebases, // Warning! these endpoints will be deprecated getSubgraphUrl(_, chainId) { diff --git a/yarn.lock b/yarn.lock index 0e941369..327c6ade 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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: @@ -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