Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit b1252a6

Browse files
committed
Revert "removed stakers"
This reverts commit 4c6a9a9.
1 parent 4c6a9a9 commit b1252a6

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { ApiPromise, WsProvider } from '@polkadot/api';
2+
import { options } from '@astar-network/astar-api';
3+
4+
const getAddressEnum = (address: string) => ({ Evm: address });
5+
const address = '0x072416b9df2382a62Df34956DffB7B0aDdf668F9';
6+
7+
const endpoint = 'wss://shiden.api.onfinality.io/public-ws';
8+
// const endpoint = 'ws://localhost:9944';
9+
const provider = new WsProvider(endpoint);
10+
11+
describe('astar-api-derive', () => {
12+
const api = new ApiPromise(options({ provider }));
13+
beforeAll(async () => {
14+
await api.isReadyOrError;
15+
});
16+
17+
test('api.derive.stakers', async (): Promise<void> => {
18+
if (api === null) {
19+
fail('API is not initialized');
20+
}
21+
const stakers = await api.derive.dappStaking.stakers(getAddressEnum(address));
22+
// If you want top print the result nicely... Go ahead.
23+
// console.log({ stakers: stakers.map((s) => s.toHuman()) });
24+
stakers.forEach((s) => expect(s.length).toBe(32));
25+
});
26+
27+
afterAll(async () => {
28+
await api.disconnect();
29+
});
30+
});

0 commit comments

Comments
 (0)