@@ -13,15 +13,16 @@ import {
1313 getU8Decoder ,
1414 getU8Encoder ,
1515 transformEncoder ,
16+ type AccountMeta ,
1617 type Address ,
17- type Codec ,
18- type Decoder ,
19- type Encoder ,
20- type IAccountMeta ,
21- type IInstruction ,
22- type IInstructionWithAccounts ,
23- type IInstructionWithData ,
18+ type FixedSizeCodec ,
19+ type FixedSizeDecoder ,
20+ type FixedSizeEncoder ,
21+ type Instruction ,
22+ type InstructionWithAccounts ,
23+ type InstructionWithData ,
2424 type ReadonlyAccount ,
25+ type ReadonlyUint8Array ,
2526 type WritableAccount ,
2627} from '@solana/kit' ;
2728import { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs' ;
@@ -35,18 +36,18 @@ export function getCloseStuckEscrowDiscriminatorBytes() {
3536
3637export type CloseStuckEscrowInstruction <
3738 TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS ,
38- TAccountEscrow extends string | IAccountMeta < string > = string ,
39- TAccountDestination extends string | IAccountMeta < string > = string ,
40- TAccountUnwrappedMint extends string | IAccountMeta < string > = string ,
41- TAccountWrappedMint extends string | IAccountMeta < string > = string ,
42- TAccountWrappedMintAuthority extends string | IAccountMeta < string > = string ,
39+ TAccountEscrow extends string | AccountMeta < string > = string ,
40+ TAccountDestination extends string | AccountMeta < string > = string ,
41+ TAccountUnwrappedMint extends string | AccountMeta < string > = string ,
42+ TAccountWrappedMint extends string | AccountMeta < string > = string ,
43+ TAccountWrappedMintAuthority extends string | AccountMeta < string > = string ,
4344 TAccountToken2022Program extends
4445 | string
45- | IAccountMeta < string > = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' ,
46- TRemainingAccounts extends readonly IAccountMeta < string > [ ] = [ ] ,
47- > = IInstruction < TProgram > &
48- IInstructionWithData < Uint8Array > &
49- IInstructionWithAccounts <
46+ | AccountMeta < string > = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' ,
47+ TRemainingAccounts extends readonly AccountMeta < string > [ ] = [ ] ,
48+ > = Instruction < TProgram > &
49+ InstructionWithData < ReadonlyUint8Array > &
50+ InstructionWithAccounts <
5051 [
5152 TAccountEscrow extends string
5253 ? WritableAccount < TAccountEscrow >
@@ -74,18 +75,18 @@ export type CloseStuckEscrowInstructionData = { discriminator: number };
7475
7576export type CloseStuckEscrowInstructionDataArgs = { } ;
7677
77- export function getCloseStuckEscrowInstructionDataEncoder ( ) : Encoder < CloseStuckEscrowInstructionDataArgs > {
78+ export function getCloseStuckEscrowInstructionDataEncoder ( ) : FixedSizeEncoder < CloseStuckEscrowInstructionDataArgs > {
7879 return transformEncoder (
7980 getStructEncoder ( [ [ 'discriminator' , getU8Encoder ( ) ] ] ) ,
8081 ( value ) => ( { ...value , discriminator : CLOSE_STUCK_ESCROW_DISCRIMINATOR } )
8182 ) ;
8283}
8384
84- export function getCloseStuckEscrowInstructionDataDecoder ( ) : Decoder < CloseStuckEscrowInstructionData > {
85+ export function getCloseStuckEscrowInstructionDataDecoder ( ) : FixedSizeDecoder < CloseStuckEscrowInstructionData > {
8586 return getStructDecoder ( [ [ 'discriminator' , getU8Decoder ( ) ] ] ) ;
8687}
8788
88- export function getCloseStuckEscrowInstructionDataCodec ( ) : Codec <
89+ export function getCloseStuckEscrowInstructionDataCodec ( ) : FixedSizeCodec <
8990 CloseStuckEscrowInstructionDataArgs ,
9091 CloseStuckEscrowInstructionData
9192> {
@@ -200,7 +201,7 @@ export function getCloseStuckEscrowInstruction<
200201
201202export type ParsedCloseStuckEscrowInstruction <
202203 TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS ,
203- TAccountMetas extends readonly IAccountMeta [ ] = readonly IAccountMeta [ ] ,
204+ TAccountMetas extends readonly AccountMeta [ ] = readonly AccountMeta [ ] ,
204205> = {
205206 programAddress : Address < TProgram > ;
206207 accounts : {
@@ -222,19 +223,19 @@ export type ParsedCloseStuckEscrowInstruction<
222223
223224export function parseCloseStuckEscrowInstruction <
224225 TProgram extends string ,
225- TAccountMetas extends readonly IAccountMeta [ ] ,
226+ TAccountMetas extends readonly AccountMeta [ ] ,
226227> (
227- instruction : IInstruction < TProgram > &
228- IInstructionWithAccounts < TAccountMetas > &
229- IInstructionWithData < Uint8Array >
228+ instruction : Instruction < TProgram > &
229+ InstructionWithAccounts < TAccountMetas > &
230+ InstructionWithData < ReadonlyUint8Array >
230231) : ParsedCloseStuckEscrowInstruction < TProgram , TAccountMetas > {
231232 if ( instruction . accounts . length < 6 ) {
232233 // TODO: Coded error.
233234 throw new Error ( 'Not enough accounts' ) ;
234235 }
235236 let accountIndex = 0 ;
236237 const getNextAccount = ( ) => {
237- const accountMeta = instruction . accounts ! [ accountIndex ] ! ;
238+ const accountMeta = ( instruction . accounts as TAccountMetas ) [ accountIndex ] ! ;
238239 accountIndex += 1 ;
239240 return accountMeta ;
240241 } ;
0 commit comments