-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: replace sidecar with node (#7470)
* fix: replace sidecar with node * fix: use erasStakersOverview to fetch tvl for each validator * fix: remove identities code for polkadot * get rid of sidecar api * fix unit tests * fix: polkadot integration test * refactoring
- Loading branch information
1 parent
9a4a3bc
commit 93128e3
Showing
10 changed files
with
138 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/coin-polkadot": patch | ||
--- | ||
|
||
get rid of sidecar fork api and fix validator list for polkadot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 0 additions & 100 deletions
100
libs/coin-modules/coin-polkadot/src/network/node/identities.ts
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
libs/coin-modules/coin-polkadot/src/network/node/node.integ.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ApiPromise, HttpProvider } from "@polkadot/api"; | ||
import { fetchValidators } from "./validators"; | ||
import getApiPromise from "./apiPromise"; | ||
|
||
jest.mock("./apiPromise"); | ||
|
||
describe("fetchValidators", () => { | ||
let provider: HttpProvider; | ||
beforeAll(async () => { | ||
provider = new HttpProvider("https://polkadot-rpc.publicnode.com"); | ||
const api = await ApiPromise.create({ provider, noInitWarn: true }); | ||
(getApiPromise as jest.Mock).mockResolvedValue(api); | ||
}); | ||
|
||
it("should not exceed 40 RPC API calls to fetch all validators", async () => { | ||
const result = await fetchValidators(); | ||
expect(result.length).toBeGreaterThan(300); | ||
const requestCount = provider.stats.total.requests; | ||
expect(requestCount).toBeGreaterThan(0); // should have made at least one request | ||
expect(requestCount).toBeLessThanOrEqual(40); // should not exceed 50 requests | ||
}, 10000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.