-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd7e3b1
commit b5d77e0
Showing
24 changed files
with
3,009 additions
and
223 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
189 changes: 189 additions & 0 deletions
189
clients/js/jito_tip_router/accounts/vaultOperatorDelegationSnapshot.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,189 @@ | ||
/** | ||
* This code was AUTOGENERATED using the kinobi library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun kinobi to update it. | ||
* | ||
* @see https://github.com/kinobi-so/kinobi | ||
*/ | ||
|
||
import { | ||
assertAccountExists, | ||
assertAccountsExist, | ||
combineCodec, | ||
decodeAccount, | ||
fetchEncodedAccount, | ||
fetchEncodedAccounts, | ||
getAddressDecoder, | ||
getAddressEncoder, | ||
getArrayDecoder, | ||
getArrayEncoder, | ||
getBoolDecoder, | ||
getBoolEncoder, | ||
getStructDecoder, | ||
getStructEncoder, | ||
getU128Decoder, | ||
getU128Encoder, | ||
getU64Decoder, | ||
getU64Encoder, | ||
getU8Decoder, | ||
getU8Encoder, | ||
type Account, | ||
type Address, | ||
type Codec, | ||
type Decoder, | ||
type EncodedAccount, | ||
type Encoder, | ||
type FetchAccountConfig, | ||
type FetchAccountsConfig, | ||
type MaybeAccount, | ||
type MaybeEncodedAccount, | ||
} from '@solana/web3.js'; | ||
|
||
export type VaultOperatorDelegationSnapshot = { | ||
discriminator: bigint; | ||
vault: Address; | ||
operator: Address; | ||
ncn: Address; | ||
ncnEpoch: bigint; | ||
bump: number; | ||
slotCreated: bigint; | ||
isActive: number; | ||
stMint: Address; | ||
totalSecurity: bigint; | ||
totalVotes: bigint; | ||
reserved: Array<number>; | ||
}; | ||
|
||
export type VaultOperatorDelegationSnapshotArgs = { | ||
discriminator: number | bigint; | ||
vault: Address; | ||
operator: Address; | ||
ncn: Address; | ||
ncnEpoch: number | bigint; | ||
bump: number; | ||
slotCreated: number | bigint; | ||
isActive: number; | ||
stMint: Address; | ||
totalSecurity: number | bigint; | ||
totalVotes: number | bigint; | ||
reserved: Array<number>; | ||
}; | ||
|
||
export function getVaultOperatorDelegationSnapshotEncoder(): Encoder<VaultOperatorDelegationSnapshotArgs> { | ||
return getStructEncoder([ | ||
['discriminator', getU64Encoder()], | ||
['vault', getAddressEncoder()], | ||
['operator', getAddressEncoder()], | ||
['ncn', getAddressEncoder()], | ||
['ncnEpoch', getU64Encoder()], | ||
['bump', getU8Encoder()], | ||
['slotCreated', getU64Encoder()], | ||
['isActive', getBoolEncoder()], | ||
['stMint', getAddressEncoder()], | ||
['totalSecurity', getU64Encoder()], | ||
['totalVotes', getU128Encoder()], | ||
['reserved', getArrayEncoder(getU8Encoder(), { size: 128 })], | ||
]); | ||
} | ||
|
||
export function getVaultOperatorDelegationSnapshotDecoder(): Decoder<VaultOperatorDelegationSnapshot> { | ||
return getStructDecoder([ | ||
['discriminator', getU64Decoder()], | ||
['vault', getAddressDecoder()], | ||
['operator', getAddressDecoder()], | ||
['ncn', getAddressDecoder()], | ||
['ncnEpoch', getU64Decoder()], | ||
['bump', getU8Decoder()], | ||
['slotCreated', getU64Decoder()], | ||
['isActive', getBoolDecoder()], | ||
['stMint', getAddressDecoder()], | ||
['totalSecurity', getU64Decoder()], | ||
['totalVotes', getU128Decoder()], | ||
['reserved', getArrayDecoder(getU8Decoder(), { size: 128 })], | ||
]); | ||
} | ||
|
||
export function getVaultOperatorDelegationSnapshotCodec(): Codec< | ||
VaultOperatorDelegationSnapshotArgs, | ||
VaultOperatorDelegationSnapshot | ||
> { | ||
return combineCodec( | ||
getVaultOperatorDelegationSnapshotEncoder(), | ||
getVaultOperatorDelegationSnapshotDecoder() | ||
); | ||
} | ||
|
||
export function decodeVaultOperatorDelegationSnapshot< | ||
TAddress extends string = string, | ||
>( | ||
encodedAccount: EncodedAccount<TAddress> | ||
): Account<VaultOperatorDelegationSnapshot, TAddress>; | ||
export function decodeVaultOperatorDelegationSnapshot< | ||
TAddress extends string = string, | ||
>( | ||
encodedAccount: MaybeEncodedAccount<TAddress> | ||
): MaybeAccount<VaultOperatorDelegationSnapshot, TAddress>; | ||
export function decodeVaultOperatorDelegationSnapshot< | ||
TAddress extends string = string, | ||
>( | ||
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress> | ||
): | ||
| Account<VaultOperatorDelegationSnapshot, TAddress> | ||
| MaybeAccount<VaultOperatorDelegationSnapshot, TAddress> { | ||
return decodeAccount( | ||
encodedAccount as MaybeEncodedAccount<TAddress>, | ||
getVaultOperatorDelegationSnapshotDecoder() | ||
); | ||
} | ||
|
||
export async function fetchVaultOperatorDelegationSnapshot< | ||
TAddress extends string = string, | ||
>( | ||
rpc: Parameters<typeof fetchEncodedAccount>[0], | ||
address: Address<TAddress>, | ||
config?: FetchAccountConfig | ||
): Promise<Account<VaultOperatorDelegationSnapshot, TAddress>> { | ||
const maybeAccount = await fetchMaybeVaultOperatorDelegationSnapshot( | ||
rpc, | ||
address, | ||
config | ||
); | ||
assertAccountExists(maybeAccount); | ||
return maybeAccount; | ||
} | ||
|
||
export async function fetchMaybeVaultOperatorDelegationSnapshot< | ||
TAddress extends string = string, | ||
>( | ||
rpc: Parameters<typeof fetchEncodedAccount>[0], | ||
address: Address<TAddress>, | ||
config?: FetchAccountConfig | ||
): Promise<MaybeAccount<VaultOperatorDelegationSnapshot, TAddress>> { | ||
const maybeAccount = await fetchEncodedAccount(rpc, address, config); | ||
return decodeVaultOperatorDelegationSnapshot(maybeAccount); | ||
} | ||
|
||
export async function fetchAllVaultOperatorDelegationSnapshot( | ||
rpc: Parameters<typeof fetchEncodedAccounts>[0], | ||
addresses: Array<Address>, | ||
config?: FetchAccountsConfig | ||
): Promise<Account<VaultOperatorDelegationSnapshot>[]> { | ||
const maybeAccounts = await fetchAllMaybeVaultOperatorDelegationSnapshot( | ||
rpc, | ||
addresses, | ||
config | ||
); | ||
assertAccountsExist(maybeAccounts); | ||
return maybeAccounts; | ||
} | ||
|
||
export async function fetchAllMaybeVaultOperatorDelegationSnapshot( | ||
rpc: Parameters<typeof fetchEncodedAccounts>[0], | ||
addresses: Array<Address>, | ||
config?: FetchAccountsConfig | ||
): Promise<MaybeAccount<VaultOperatorDelegationSnapshot>[]> { | ||
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config); | ||
return maybeAccounts.map((maybeAccount) => | ||
decodeVaultOperatorDelegationSnapshot(maybeAccount) | ||
); | ||
} |
Oops, something went wrong.