Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use the concrete implementation of web3.js in the getStakeActivation package #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions js-v1/src/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export async function getStakeActivation(
connection: Connection,
stakeAddress: PublicKey
): Promise<StakeActivation> {
const SYSVAR_STAKE_HISTORY_ADDRESS = new PublicKey(
'SysvarStakeHistory1111111111111111111111111'
);
const SYSVAR_STAKE_HISTORY_ADDRESS = {
toBase58: () => 'SysvarStakeHistory1111111111111111111111111',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, because the only thing that parseAccountInfo() ever does with this thing is to call toBase58() on it.

‘Thin interfaces.’

} as unknown as PublicKey; // Prevents a concrete dependency on `PublicKey`
const [epochInfo, { stakeAccount, stakeAccountLamports }, stakeHistory] =
await Promise.all([
connection.getEpochInfo(),
Expand Down