Skip to content

Commit a16f795

Browse files
Merge pull request #2 from jito-foundation/ck/weight_table
Using PreciseNumber for underlaying calculations
2 parents 27be373 + c83594b commit a16f795

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1588
-1909
lines changed

Cargo.lock

Lines changed: 142 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ serde = { version = "^1.0", features = ["derive"] }
5151
serde_with = "3.9.0"
5252
shank = "0.4.2"
5353
shank_idl = "0.4.2"
54+
spl-math = { version = "0.3.0", features = ["no-entrypoint"] }
5455
solana-account-decoder = "~1.18"
5556
solana-cli-config = "~1.18"
5657
solana-program = "~1.18"
@@ -68,14 +69,14 @@ jito-tip-router-client = { path = "./clients/rust/jito_tip_router", version = "0
6869
jito-tip-router-core = { path = "./core", version = "=0.0.1" }
6970
jito-tip-router-program = { path = "./program", version = "=0.0.1" }
7071
jito-tip-router-shank-cli = { path = "./shank_cli", version = "=0.0.1" }
71-
jito-bytemuck = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
72-
jito-account-traits-derive = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
73-
jito-jsm-core = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
74-
jito-restaking-client = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
75-
jito-restaking-core = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
76-
jito-restaking-program = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3", features = ["no-entrypoint"] }
77-
jito-restaking-sdk = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
78-
jito-vault-client = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
79-
jito-vault-core = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
80-
jito-vault-program = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3", features = ["no-entrypoint"] }
81-
jito-vault-sdk = { git = "https://github.com/jito-foundation/restaking.git", version = "=0.0.3" }
72+
jito-bytemuck = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }
73+
jito-account-traits-derive = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }
74+
jito-jsm-core = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }
75+
jito-restaking-client = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }
76+
jito-restaking-core = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }
77+
jito-restaking-program = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d", features = ["no-entrypoint"] }
78+
jito-restaking-sdk = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }
79+
jito-vault-client = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }
80+
jito-vault-core = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }
81+
jito-vault-program = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d", features = ["no-entrypoint"] }
82+
jito-vault-sdk = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }

clients/js/jito_tip_router/accounts/weightTable.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export type WeightTable = {
4646
ncn: Address;
4747
ncnEpoch: bigint;
4848
slotCreated: bigint;
49-
slotFinalized: bigint;
5049
bump: number;
5150
reserved: Array<number>;
5251
table: Array<WeightEntry>;
@@ -57,7 +56,6 @@ export type WeightTableArgs = {
5756
ncn: Address;
5857
ncnEpoch: number | bigint;
5958
slotCreated: number | bigint;
60-
slotFinalized: number | bigint;
6159
bump: number;
6260
reserved: Array<number>;
6361
table: Array<WeightEntryArgs>;
@@ -69,7 +67,6 @@ export function getWeightTableEncoder(): Encoder<WeightTableArgs> {
6967
['ncn', getAddressEncoder()],
7068
['ncnEpoch', getU64Encoder()],
7169
['slotCreated', getU64Encoder()],
72-
['slotFinalized', getU64Encoder()],
7370
['bump', getU8Encoder()],
7471
['reserved', getArrayEncoder(getU8Encoder(), { size: 128 })],
7572
['table', getArrayEncoder(getWeightEntryEncoder(), { size: 32 })],
@@ -82,7 +79,6 @@ export function getWeightTableDecoder(): Decoder<WeightTable> {
8279
['ncn', getAddressDecoder()],
8380
['ncnEpoch', getU64Decoder()],
8481
['slotCreated', getU64Decoder()],
85-
['slotFinalized', getU64Decoder()],
8682
['bump', getU8Decoder()],
8783
['reserved', getArrayDecoder(getU8Decoder(), { size: 128 })],
8884
['table', getArrayDecoder(getWeightEntryDecoder(), { size: 32 })],

clients/js/jito_tip_router/errors/jitoTipRouter.ts

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,34 @@ import {
1414
} from '@solana/web3.js';
1515
import { JITO_TIP_ROUTER_PROGRAM_ADDRESS } from '../programs';
1616

17-
/** NoMoreTableSlots: No more table slots available */
18-
export const JITO_TIP_ROUTER_ERROR__NO_MORE_TABLE_SLOTS = 0x2000; // 8192
1917
/** DenominatorIsZero: Zero in the denominator */
2018
export const JITO_TIP_ROUTER_ERROR__DENOMINATOR_IS_ZERO = 0x2100; // 8448
2119
/** ArithmeticOverflow: Overflow */
2220
export const JITO_TIP_ROUTER_ERROR__ARITHMETIC_OVERFLOW = 0x2101; // 8449
2321
/** ModuloOverflow: Modulo Overflow */
2422
export const JITO_TIP_ROUTER_ERROR__MODULO_OVERFLOW = 0x2102; // 8450
23+
/** NewPreciseNumberError: New precise number error */
24+
export const JITO_TIP_ROUTER_ERROR__NEW_PRECISE_NUMBER_ERROR = 0x2103; // 8451
25+
/** CastToImpreciseNumberError: Cast to imprecise number error */
26+
export const JITO_TIP_ROUTER_ERROR__CAST_TO_IMPRECISE_NUMBER_ERROR = 0x2104; // 8452
2527
/** IncorrectWeightTableAdmin: Incorrect weight table admin */
2628
export const JITO_TIP_ROUTER_ERROR__INCORRECT_WEIGHT_TABLE_ADMIN = 0x2200; // 8704
29+
/** DuplicateMintsInTable: Duplicate mints in table */
30+
export const JITO_TIP_ROUTER_ERROR__DUPLICATE_MINTS_IN_TABLE = 0x2201; // 8705
31+
/** NoMintsInTable: There are no mints in the table */
32+
export const JITO_TIP_ROUTER_ERROR__NO_MINTS_IN_TABLE = 0x2202; // 8706
33+
/** TooManyMintsForTable: Too many mints for table */
34+
export const JITO_TIP_ROUTER_ERROR__TOO_MANY_MINTS_FOR_TABLE = 0x2203; // 8707
35+
/** WeightTableAlreadyInitialized: Weight table already initialized */
36+
export const JITO_TIP_ROUTER_ERROR__WEIGHT_TABLE_ALREADY_INITIALIZED = 0x2204; // 8708
2737
/** CannotCreateFutureWeightTables: Cannnot create future weight tables */
28-
export const JITO_TIP_ROUTER_ERROR__CANNOT_CREATE_FUTURE_WEIGHT_TABLES = 0x2201; // 8705
38+
export const JITO_TIP_ROUTER_ERROR__CANNOT_CREATE_FUTURE_WEIGHT_TABLES = 0x2205; // 8709
39+
/** WeightMintsDoNotMatchLength: Weight mints do not match - length */
40+
export const JITO_TIP_ROUTER_ERROR__WEIGHT_MINTS_DO_NOT_MATCH_LENGTH = 0x2206; // 8710
41+
/** WeightMintsDoNotMatchMintHash: Weight mints do not match - mint hash */
42+
export const JITO_TIP_ROUTER_ERROR__WEIGHT_MINTS_DO_NOT_MATCH_MINT_HASH = 0x2207; // 8711
43+
/** InvalidMintForWeightTable: Invalid mint for weight table */
44+
export const JITO_TIP_ROUTER_ERROR__INVALID_MINT_FOR_WEIGHT_TABLE = 0x2208; // 8712
2945
/** FeeCapExceeded: Fee cap exceeded */
3046
export const JITO_TIP_ROUTER_ERROR__FEE_CAP_EXCEEDED = 0x2300; // 8960
3147
/** IncorrectNcnAdmin: Incorrect NCN Admin */
@@ -38,28 +54,44 @@ export const JITO_TIP_ROUTER_ERROR__INCORRECT_FEE_ADMIN = 0x2402; // 9218
3854
export type JitoTipRouterError =
3955
| typeof JITO_TIP_ROUTER_ERROR__ARITHMETIC_OVERFLOW
4056
| typeof JITO_TIP_ROUTER_ERROR__CANNOT_CREATE_FUTURE_WEIGHT_TABLES
57+
| typeof JITO_TIP_ROUTER_ERROR__CAST_TO_IMPRECISE_NUMBER_ERROR
4158
| typeof JITO_TIP_ROUTER_ERROR__DENOMINATOR_IS_ZERO
59+
| typeof JITO_TIP_ROUTER_ERROR__DUPLICATE_MINTS_IN_TABLE
4260
| typeof JITO_TIP_ROUTER_ERROR__FEE_CAP_EXCEEDED
4361
| typeof JITO_TIP_ROUTER_ERROR__INCORRECT_FEE_ADMIN
4462
| typeof JITO_TIP_ROUTER_ERROR__INCORRECT_NCN
4563
| typeof JITO_TIP_ROUTER_ERROR__INCORRECT_NCN_ADMIN
4664
| typeof JITO_TIP_ROUTER_ERROR__INCORRECT_WEIGHT_TABLE_ADMIN
65+
| typeof JITO_TIP_ROUTER_ERROR__INVALID_MINT_FOR_WEIGHT_TABLE
4766
| typeof JITO_TIP_ROUTER_ERROR__MODULO_OVERFLOW
48-
| typeof JITO_TIP_ROUTER_ERROR__NO_MORE_TABLE_SLOTS;
67+
| typeof JITO_TIP_ROUTER_ERROR__NEW_PRECISE_NUMBER_ERROR
68+
| typeof JITO_TIP_ROUTER_ERROR__NO_MINTS_IN_TABLE
69+
| typeof JITO_TIP_ROUTER_ERROR__TOO_MANY_MINTS_FOR_TABLE
70+
| typeof JITO_TIP_ROUTER_ERROR__WEIGHT_MINTS_DO_NOT_MATCH_LENGTH
71+
| typeof JITO_TIP_ROUTER_ERROR__WEIGHT_MINTS_DO_NOT_MATCH_MINT_HASH
72+
| typeof JITO_TIP_ROUTER_ERROR__WEIGHT_TABLE_ALREADY_INITIALIZED;
4973

5074
let jitoTipRouterErrorMessages: Record<JitoTipRouterError, string> | undefined;
5175
if (process.env.NODE_ENV !== 'production') {
5276
jitoTipRouterErrorMessages = {
5377
[JITO_TIP_ROUTER_ERROR__ARITHMETIC_OVERFLOW]: `Overflow`,
5478
[JITO_TIP_ROUTER_ERROR__CANNOT_CREATE_FUTURE_WEIGHT_TABLES]: `Cannnot create future weight tables`,
79+
[JITO_TIP_ROUTER_ERROR__CAST_TO_IMPRECISE_NUMBER_ERROR]: `Cast to imprecise number error`,
5580
[JITO_TIP_ROUTER_ERROR__DENOMINATOR_IS_ZERO]: `Zero in the denominator`,
81+
[JITO_TIP_ROUTER_ERROR__DUPLICATE_MINTS_IN_TABLE]: `Duplicate mints in table`,
5682
[JITO_TIP_ROUTER_ERROR__FEE_CAP_EXCEEDED]: `Fee cap exceeded`,
5783
[JITO_TIP_ROUTER_ERROR__INCORRECT_FEE_ADMIN]: `Incorrect fee admin`,
5884
[JITO_TIP_ROUTER_ERROR__INCORRECT_NCN]: `Incorrect NCN`,
5985
[JITO_TIP_ROUTER_ERROR__INCORRECT_NCN_ADMIN]: `Incorrect NCN Admin`,
6086
[JITO_TIP_ROUTER_ERROR__INCORRECT_WEIGHT_TABLE_ADMIN]: `Incorrect weight table admin`,
87+
[JITO_TIP_ROUTER_ERROR__INVALID_MINT_FOR_WEIGHT_TABLE]: `Invalid mint for weight table`,
6188
[JITO_TIP_ROUTER_ERROR__MODULO_OVERFLOW]: `Modulo Overflow`,
62-
[JITO_TIP_ROUTER_ERROR__NO_MORE_TABLE_SLOTS]: `No more table slots available`,
89+
[JITO_TIP_ROUTER_ERROR__NEW_PRECISE_NUMBER_ERROR]: `New precise number error`,
90+
[JITO_TIP_ROUTER_ERROR__NO_MINTS_IN_TABLE]: `There are no mints in the table`,
91+
[JITO_TIP_ROUTER_ERROR__TOO_MANY_MINTS_FOR_TABLE]: `Too many mints for table`,
92+
[JITO_TIP_ROUTER_ERROR__WEIGHT_MINTS_DO_NOT_MATCH_LENGTH]: `Weight mints do not match - length`,
93+
[JITO_TIP_ROUTER_ERROR__WEIGHT_MINTS_DO_NOT_MATCH_MINT_HASH]: `Weight mints do not match - mint hash`,
94+
[JITO_TIP_ROUTER_ERROR__WEIGHT_TABLE_ALREADY_INITIALIZED]: `Weight table already initialized`,
6395
};
6496
}
6597

clients/js/jito_tip_router/instructions/finalizeWeightTable.ts renamed to clients/js/jito_tip_router/instructions/adminUpdateWeightTable.ts

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
combineCodec,
1111
getStructDecoder,
1212
getStructEncoder,
13+
getU128Decoder,
14+
getU128Encoder,
1315
getU64Decoder,
1416
getU64Encoder,
1517
getU8Decoder,
@@ -32,17 +34,18 @@ import {
3234
import { JITO_TIP_ROUTER_PROGRAM_ADDRESS } from '../programs';
3335
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3436

35-
export const FINALIZE_WEIGHT_TABLE_DISCRIMINATOR = 3;
37+
export const ADMIN_UPDATE_WEIGHT_TABLE_DISCRIMINATOR = 4;
3638

37-
export function getFinalizeWeightTableDiscriminatorBytes() {
38-
return getU8Encoder().encode(FINALIZE_WEIGHT_TABLE_DISCRIMINATOR);
39+
export function getAdminUpdateWeightTableDiscriminatorBytes() {
40+
return getU8Encoder().encode(ADMIN_UPDATE_WEIGHT_TABLE_DISCRIMINATOR);
3941
}
4042

41-
export type FinalizeWeightTableInstruction<
43+
export type AdminUpdateWeightTableInstruction<
4244
TProgram extends string = typeof JITO_TIP_ROUTER_PROGRAM_ADDRESS,
4345
TAccountNcn extends string | IAccountMeta<string> = string,
4446
TAccountWeightTable extends string | IAccountMeta<string> = string,
4547
TAccountWeightTableAdmin extends string | IAccountMeta<string> = string,
48+
TAccountMint extends string | IAccountMeta<string> = string,
4649
TAccountRestakingProgramId extends string | IAccountMeta<string> = string,
4750
TRemainingAccounts extends readonly IAccountMeta<string>[] = [],
4851
> = IInstruction<TProgram> &
@@ -57,84 +60,97 @@ export type FinalizeWeightTableInstruction<
5760
? ReadonlySignerAccount<TAccountWeightTableAdmin> &
5861
IAccountSignerMeta<TAccountWeightTableAdmin>
5962
: TAccountWeightTableAdmin,
63+
TAccountMint extends string
64+
? ReadonlyAccount<TAccountMint>
65+
: TAccountMint,
6066
TAccountRestakingProgramId extends string
6167
? ReadonlyAccount<TAccountRestakingProgramId>
6268
: TAccountRestakingProgramId,
6369
...TRemainingAccounts,
6470
]
6571
>;
6672

67-
export type FinalizeWeightTableInstructionData = {
73+
export type AdminUpdateWeightTableInstructionData = {
6874
discriminator: number;
6975
ncnEpoch: bigint;
76+
weight: bigint;
7077
};
7178

72-
export type FinalizeWeightTableInstructionDataArgs = {
79+
export type AdminUpdateWeightTableInstructionDataArgs = {
7380
ncnEpoch: number | bigint;
81+
weight: number | bigint;
7482
};
7583

76-
export function getFinalizeWeightTableInstructionDataEncoder(): Encoder<FinalizeWeightTableInstructionDataArgs> {
84+
export function getAdminUpdateWeightTableInstructionDataEncoder(): Encoder<AdminUpdateWeightTableInstructionDataArgs> {
7785
return transformEncoder(
7886
getStructEncoder([
7987
['discriminator', getU8Encoder()],
8088
['ncnEpoch', getU64Encoder()],
89+
['weight', getU128Encoder()],
8190
]),
8291
(value) => ({
8392
...value,
84-
discriminator: FINALIZE_WEIGHT_TABLE_DISCRIMINATOR,
93+
discriminator: ADMIN_UPDATE_WEIGHT_TABLE_DISCRIMINATOR,
8594
})
8695
);
8796
}
8897

89-
export function getFinalizeWeightTableInstructionDataDecoder(): Decoder<FinalizeWeightTableInstructionData> {
98+
export function getAdminUpdateWeightTableInstructionDataDecoder(): Decoder<AdminUpdateWeightTableInstructionData> {
9099
return getStructDecoder([
91100
['discriminator', getU8Decoder()],
92101
['ncnEpoch', getU64Decoder()],
102+
['weight', getU128Decoder()],
93103
]);
94104
}
95105

96-
export function getFinalizeWeightTableInstructionDataCodec(): Codec<
97-
FinalizeWeightTableInstructionDataArgs,
98-
FinalizeWeightTableInstructionData
106+
export function getAdminUpdateWeightTableInstructionDataCodec(): Codec<
107+
AdminUpdateWeightTableInstructionDataArgs,
108+
AdminUpdateWeightTableInstructionData
99109
> {
100110
return combineCodec(
101-
getFinalizeWeightTableInstructionDataEncoder(),
102-
getFinalizeWeightTableInstructionDataDecoder()
111+
getAdminUpdateWeightTableInstructionDataEncoder(),
112+
getAdminUpdateWeightTableInstructionDataDecoder()
103113
);
104114
}
105115

106-
export type FinalizeWeightTableInput<
116+
export type AdminUpdateWeightTableInput<
107117
TAccountNcn extends string = string,
108118
TAccountWeightTable extends string = string,
109119
TAccountWeightTableAdmin extends string = string,
120+
TAccountMint extends string = string,
110121
TAccountRestakingProgramId extends string = string,
111122
> = {
112123
ncn: Address<TAccountNcn>;
113124
weightTable: Address<TAccountWeightTable>;
114125
weightTableAdmin: TransactionSigner<TAccountWeightTableAdmin>;
126+
mint: Address<TAccountMint>;
115127
restakingProgramId: Address<TAccountRestakingProgramId>;
116-
ncnEpoch: FinalizeWeightTableInstructionDataArgs['ncnEpoch'];
128+
ncnEpoch: AdminUpdateWeightTableInstructionDataArgs['ncnEpoch'];
129+
weight: AdminUpdateWeightTableInstructionDataArgs['weight'];
117130
};
118131

119-
export function getFinalizeWeightTableInstruction<
132+
export function getAdminUpdateWeightTableInstruction<
120133
TAccountNcn extends string,
121134
TAccountWeightTable extends string,
122135
TAccountWeightTableAdmin extends string,
136+
TAccountMint extends string,
123137
TAccountRestakingProgramId extends string,
124138
TProgramAddress extends Address = typeof JITO_TIP_ROUTER_PROGRAM_ADDRESS,
125139
>(
126-
input: FinalizeWeightTableInput<
140+
input: AdminUpdateWeightTableInput<
127141
TAccountNcn,
128142
TAccountWeightTable,
129143
TAccountWeightTableAdmin,
144+
TAccountMint,
130145
TAccountRestakingProgramId
131146
>,
132147
config?: { programAddress?: TProgramAddress }
133-
): FinalizeWeightTableInstruction<
148+
): AdminUpdateWeightTableInstruction<
134149
TProgramAddress,
135150
TAccountNcn,
136151
TAccountWeightTable,
137152
TAccountWeightTableAdmin,
153+
TAccountMint,
138154
TAccountRestakingProgramId
139155
> {
140156
// Program address.
@@ -149,6 +165,7 @@ export function getFinalizeWeightTableInstruction<
149165
value: input.weightTableAdmin ?? null,
150166
isWritable: false,
151167
},
168+
mint: { value: input.mint ?? null, isWritable: false },
152169
restakingProgramId: {
153170
value: input.restakingProgramId ?? null,
154171
isWritable: false,
@@ -168,24 +185,26 @@ export function getFinalizeWeightTableInstruction<
168185
getAccountMeta(accounts.ncn),
169186
getAccountMeta(accounts.weightTable),
170187
getAccountMeta(accounts.weightTableAdmin),
188+
getAccountMeta(accounts.mint),
171189
getAccountMeta(accounts.restakingProgramId),
172190
],
173191
programAddress,
174-
data: getFinalizeWeightTableInstructionDataEncoder().encode(
175-
args as FinalizeWeightTableInstructionDataArgs
192+
data: getAdminUpdateWeightTableInstructionDataEncoder().encode(
193+
args as AdminUpdateWeightTableInstructionDataArgs
176194
),
177-
} as FinalizeWeightTableInstruction<
195+
} as AdminUpdateWeightTableInstruction<
178196
TProgramAddress,
179197
TAccountNcn,
180198
TAccountWeightTable,
181199
TAccountWeightTableAdmin,
200+
TAccountMint,
182201
TAccountRestakingProgramId
183202
>;
184203

185204
return instruction;
186205
}
187206

188-
export type ParsedFinalizeWeightTableInstruction<
207+
export type ParsedAdminUpdateWeightTableInstruction<
189208
TProgram extends string = typeof JITO_TIP_ROUTER_PROGRAM_ADDRESS,
190209
TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],
191210
> = {
@@ -194,20 +213,21 @@ export type ParsedFinalizeWeightTableInstruction<
194213
ncn: TAccountMetas[0];
195214
weightTable: TAccountMetas[1];
196215
weightTableAdmin: TAccountMetas[2];
197-
restakingProgramId: TAccountMetas[3];
216+
mint: TAccountMetas[3];
217+
restakingProgramId: TAccountMetas[4];
198218
};
199-
data: FinalizeWeightTableInstructionData;
219+
data: AdminUpdateWeightTableInstructionData;
200220
};
201221

202-
export function parseFinalizeWeightTableInstruction<
222+
export function parseAdminUpdateWeightTableInstruction<
203223
TProgram extends string,
204224
TAccountMetas extends readonly IAccountMeta[],
205225
>(
206226
instruction: IInstruction<TProgram> &
207227
IInstructionWithAccounts<TAccountMetas> &
208228
IInstructionWithData<Uint8Array>
209-
): ParsedFinalizeWeightTableInstruction<TProgram, TAccountMetas> {
210-
if (instruction.accounts.length < 4) {
229+
): ParsedAdminUpdateWeightTableInstruction<TProgram, TAccountMetas> {
230+
if (instruction.accounts.length < 5) {
211231
// TODO: Coded error.
212232
throw new Error('Not enough accounts');
213233
}
@@ -223,9 +243,10 @@ export function parseFinalizeWeightTableInstruction<
223243
ncn: getNextAccount(),
224244
weightTable: getNextAccount(),
225245
weightTableAdmin: getNextAccount(),
246+
mint: getNextAccount(),
226247
restakingProgramId: getNextAccount(),
227248
},
228-
data: getFinalizeWeightTableInstructionDataDecoder().decode(
249+
data: getAdminUpdateWeightTableInstructionDataDecoder().decode(
229250
instruction.data
230251
),
231252
};

clients/js/jito_tip_router/instructions/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* @see https://github.com/kinobi-so/kinobi
77
*/
88

9-
export * from './finalizeWeightTable';
10-
export * from './initializeConfig';
9+
export * from './adminUpdateWeightTable';
10+
export * from './initializeNCNConfig';
1111
export * from './initializeWeightTable';
1212
export * from './setConfigFees';
1313
export * from './setNewAdmin';
14-
export * from './updateWeightTable';

0 commit comments

Comments
 (0)