@@ -5,20 +5,25 @@ import {
5
5
getArrayEncoder ,
6
6
getStructDecoder ,
7
7
getStructEncoder ,
8
+ getU64Decoder ,
9
+ getU64Encoder ,
8
10
type VariableSizeCodec ,
9
11
type VariableSizeDecoder ,
10
12
type VariableSizeEncoder ,
11
13
} from '@solana/codecs' ;
12
14
import type { GetAccountInfoApi } from '@solana/rpc-api' ;
13
15
import type { Rpc } from '@solana/rpc-spec' ;
14
- import { getDefaultLamportsDecoder , getDefaultLamportsEncoder , type Lamports } from '@solana/rpc-types' ;
16
+ import { Epoch , getDefaultLamportsDecoder , getDefaultLamportsEncoder , type Lamports } from '@solana/rpc-types' ;
15
17
16
18
import { fetchEncodedSysvarAccount , SYSVAR_STAKE_HISTORY_ADDRESS } from './sysvar' ;
17
19
18
20
type Entry = Readonly < {
19
- activating : Lamports ;
20
- deactivating : Lamports ;
21
- effective : Lamports ;
21
+ epoch : Epoch ;
22
+ stakeHistory : Readonly < {
23
+ activating : Lamports ;
24
+ deactivating : Lamports ;
25
+ effective : Lamports ;
26
+ } > ;
22
27
} > ;
23
28
24
29
/**
@@ -31,20 +36,34 @@ export type SysvarStakeHistory = Entry[];
31
36
export function getSysvarStakeHistoryEncoder ( ) : VariableSizeEncoder < SysvarStakeHistory > {
32
37
return getArrayEncoder (
33
38
getStructEncoder ( [
34
- [ 'effective' , getDefaultLamportsEncoder ( ) ] ,
35
- [ 'activating' , getDefaultLamportsEncoder ( ) ] ,
36
- [ 'deactivating' , getDefaultLamportsEncoder ( ) ] ,
39
+ [ 'epoch' , getU64Encoder ( ) ] ,
40
+ [
41
+ 'stakeHistory' ,
42
+ getStructEncoder ( [
43
+ [ 'effective' , getDefaultLamportsEncoder ( ) ] ,
44
+ [ 'activating' , getDefaultLamportsEncoder ( ) ] ,
45
+ [ 'deactivating' , getDefaultLamportsEncoder ( ) ] ,
46
+ ] ) ,
47
+ ] ,
37
48
] ) ,
49
+ { size : getU64Encoder ( ) } ,
38
50
) ;
39
51
}
40
52
41
53
export function getSysvarStakeHistoryDecoder ( ) : VariableSizeDecoder < SysvarStakeHistory > {
42
54
return getArrayDecoder (
43
55
getStructDecoder ( [
44
- [ 'effective' , getDefaultLamportsDecoder ( ) ] ,
45
- [ 'activating' , getDefaultLamportsDecoder ( ) ] ,
46
- [ 'deactivating' , getDefaultLamportsDecoder ( ) ] ,
56
+ [ 'epoch' , getU64Decoder ( ) ] ,
57
+ [
58
+ 'stakeHistory' ,
59
+ getStructDecoder ( [
60
+ [ 'effective' , getDefaultLamportsDecoder ( ) ] ,
61
+ [ 'activating' , getDefaultLamportsDecoder ( ) ] ,
62
+ [ 'deactivating' , getDefaultLamportsDecoder ( ) ] ,
63
+ ] ) ,
64
+ ] ,
47
65
] ) ,
66
+ { size : getU64Decoder ( ) } ,
48
67
) ;
49
68
}
50
69
0 commit comments