Skip to content
Open
Show file tree
Hide file tree
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
35 changes: 8 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ test = "nightly-2025-02-16"

[workspace.metadata.spellcheck]
config = "scripts/spellcheck.toml"

[patch.crates-io]
solana-stake-interface = { path = "interface" }
15 changes: 9 additions & 6 deletions clients/js/src/generated/types/delegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

import {
combineCodec,
fixDecoderSize,
fixEncoderSize,
getAddressDecoder,
getAddressEncoder,
getF64Decoder,
getF64Encoder,
getBytesDecoder,
getBytesEncoder,
getStructDecoder,
getStructEncoder,
getU64Decoder,
Expand All @@ -20,22 +22,23 @@ import {
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type ReadonlyUint8Array,
} from '@solana/kit';

export type Delegation = {
voterPubkey: Address;
stake: bigint;
activationEpoch: bigint;
deactivationEpoch: bigint;
warmupCooldownRate: number;
reserved: ReadonlyUint8Array;
};

export type DelegationArgs = {
voterPubkey: Address;
stake: number | bigint;
activationEpoch: number | bigint;
deactivationEpoch: number | bigint;
warmupCooldownRate: number;
reserved: ReadonlyUint8Array;
};

export function getDelegationEncoder(): FixedSizeEncoder<DelegationArgs> {
Expand All @@ -44,7 +47,7 @@ export function getDelegationEncoder(): FixedSizeEncoder<DelegationArgs> {
['stake', getU64Encoder()],
['activationEpoch', getU64Encoder()],
['deactivationEpoch', getU64Encoder()],
['warmupCooldownRate', getF64Encoder()],
['reserved', fixEncoderSize(getBytesEncoder(), 8)],
]);
}

Expand All @@ -54,7 +57,7 @@ export function getDelegationDecoder(): FixedSizeDecoder<Delegation> {
['stake', getU64Decoder()],
['activationEpoch', getU64Decoder()],
['deactivationEpoch', getU64Decoder()],
['warmupCooldownRate', getF64Decoder()],
['reserved', fixDecoderSize(getBytesDecoder(), 8)],
]);
}

Expand Down
2 changes: 1 addition & 1 deletion clients/rust/src/generated/types/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ pub struct Delegation {
pub stake: u64,
pub activation_epoch: u64,
pub deactivation_epoch: u64,
pub warmup_cooldown_rate: f64,
pub reserved: [u8; 8],
}
1 change: 1 addition & 0 deletions interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ solana-sysvar-id = { version = "3.0.0", optional = true }
anyhow = "1"
assert_matches = "1.5.0"
bincode = "1.3.3"
proptest = "1.9.0"
serial_test = "3.2.0"
solana-account = {version = "3.2.0", features = ["bincode"] }
solana-borsh = "3.0.0"
Expand Down
7 changes: 5 additions & 2 deletions interface/idl.json
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,12 @@
}
},
{
"name": "warmupCooldownRate",
"name": "_reserved",
"type": {
"defined": "f64"
"array": [
"u8",
8
]
}
}
]
Expand Down
3 changes: 3 additions & 0 deletions interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ pub mod stake_history;
pub mod state;
#[cfg(feature = "sysvar")]
pub mod sysvar;
#[cfg(test)]
mod test_utils;
pub mod tools;
pub mod warmup_cooldown_allowance;

pub mod program {
solana_pubkey::declare_id!("Stake11111111111111111111111111111111111111");
Expand Down
Loading