This repository has been archived by the owner on Jul 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* solana add initial staking support * solana improve staking * solana fix typos * solana fix cli format for staking * solana add device fields for stake create acc * solana add stake delegate support * solana fix lint * solana add stake undelegate * solana add stake withdraw * solana add stake split * solana add stakes loading * solana improve staking * solana introduce solana resources * solana add preload data * solana add hydrate to bridge * solana add stake actions * solana improve staking * solana add meta to validators * solana add validator name * solana fix seed for stake accs * solana add stake reward * solana improve staking * solana stake add withdrawable amount * solana refactor framework * solana fix tests * solana make auto delegation mandatory * solana sort stakes * solana fix error key * solana add delegation validator validation * solana add staking create acc tests * solana add staking delegate tests * solana add stake undelegate tests * solana remove redundant checks for stake delegation * solana skip options validations on cli level * solana skip undelegate options validations on cli level * solana improve staking tests * solana add delegatable check to staking * solana fix estimate max spendable * solana add delegation active test * solana add stake state tests * solana introduce validators app validators * solana add validators for testnet & devnet * solana refactor validators app validators * solana update meta of stakes * solana update sort order of stakes * solana add delegated op type * solana shuffle staking validators * solana fix stake withdraw optimistic value * solana clean comments * solana update mock data * solana add initial staking bot specs * solana add staking bot specs * solana move ledger vote acc to utils * solana add swap util * solana update device tx config * solana fix lint
- Loading branch information
Showing
41 changed files
with
3,959 additions
and
1,344 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export { tryParseAsTokenAccount, parseTokenAccountInfo } from "./parser"; | ||
export { | ||
tryParseAsTokenAccount, | ||
parseTokenAccountInfo, | ||
tryParseAsVoteAccount, | ||
} from "./parser"; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* eslint-disable @typescript-eslint/no-redeclare */ | ||
|
||
import { | ||
Infer, | ||
enums, | ||
number, | ||
array, | ||
type, | ||
nullable, | ||
string, | ||
} from "superstruct"; | ||
import { PublicKeyFromString } from "../validators/pubkey"; | ||
|
||
export type VoteAccountType = Infer<typeof VoteAccountType>; | ||
export const VoteAccountType = enums(["vote"]); | ||
|
||
export type AuthorizedVoter = Infer<typeof AuthorizedVoter>; | ||
export const AuthorizedVoter = type({ | ||
authorizedVoter: PublicKeyFromString, | ||
epoch: number(), | ||
}); | ||
|
||
export type PriorVoter = Infer<typeof PriorVoter>; | ||
export const PriorVoter = type({ | ||
authorizedPubkey: PublicKeyFromString, | ||
epochOfLastAuthorizedSwitch: number(), | ||
targetEpoch: number(), | ||
}); | ||
|
||
export type EpochCredits = Infer<typeof EpochCredits>; | ||
export const EpochCredits = type({ | ||
epoch: number(), | ||
credits: string(), | ||
previousCredits: string(), | ||
}); | ||
|
||
export type Vote = Infer<typeof Vote>; | ||
export const Vote = type({ | ||
slot: number(), | ||
confirmationCount: number(), | ||
}); | ||
|
||
export type VoteAccountInfo = Infer<typeof VoteAccountInfo>; | ||
export const VoteAccountInfo = type({ | ||
authorizedVoters: array(AuthorizedVoter), | ||
authorizedWithdrawer: PublicKeyFromString, | ||
commission: number(), | ||
epochCredits: array(EpochCredits), | ||
lastTimestamp: type({ | ||
slot: number(), | ||
timestamp: number(), | ||
}), | ||
nodePubkey: PublicKeyFromString, | ||
priorVoters: array(PriorVoter), | ||
rootSlot: nullable(number()), | ||
votes: array(Vote), | ||
}); | ||
|
||
export type VoteAccount = Infer<typeof VoteAccount>; | ||
export const VoteAccount = type({ | ||
type: VoteAccountType, | ||
info: VoteAccountInfo, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ParsedInstruction } from "@solana/web3.js"; | ||
import { IX_STRUCTS, IX_TITLES, SystemInstructionType } from "./types"; | ||
|
||
import { ParsedInfo } from "../../validators"; | ||
import { create, Infer } from "superstruct"; | ||
import { PARSED_PROGRAMS } from "../../program/constants"; | ||
|
||
export function parseSystemInstruction( | ||
ix: ParsedInstruction & { program: typeof PARSED_PROGRAMS.SYSTEM } | ||
): SystemInstructionDescriptor { | ||
const parsed = create(ix.parsed, ParsedInfo); | ||
const { type: rawType, info } = parsed; | ||
const type = create(rawType, SystemInstructionType); | ||
const title = IX_TITLES[type]; | ||
const struct = IX_STRUCTS[type]; | ||
|
||
return { | ||
type, | ||
title: title as any, | ||
info: create(info, struct as any) as any, | ||
}; | ||
} | ||
|
||
export type SystemInstructionDescriptor = { | ||
[K in SystemInstructionType]: { | ||
title: typeof IX_TITLES[K]; | ||
type: K; | ||
info: Infer<typeof IX_STRUCTS[K]>; | ||
}; | ||
}[SystemInstructionType]; |
Oops, something went wrong.
d70cf09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
($0.00) for Bot 'Solana on Mooncake'
Details of the 0 mutations
Spec Solana (failed)
Details of the 8 uncovered mutations
Spec Solana (8)
Portfolio ($0.00)
Details of the 1 currencies