瀏覽代碼

Tighten the return type of encode/decode functions for FixedSize cases

Callum 4 月之前
父節點
當前提交
a744ed64a8
共有 53 個文件被更改,包括 300 次插入144 次删除
  1. 3 3
      packages/renderers-js/e2e/anchor/src/generated/instructions/execute.ts
  2. 3 3
      packages/renderers-js/e2e/anchor/src/generated/instructions/initialize.ts
  3. 8 3
      packages/renderers-js/e2e/dummy/src/generated/instructions/instruction3.ts
  4. 10 3
      packages/renderers-js/e2e/dummy/src/generated/instructions/instruction4.ts
  5. 8 3
      packages/renderers-js/e2e/dummy/src/generated/instructions/instruction5.ts
  6. 6 3
      packages/renderers-js/e2e/system/src/generated/accounts/nonce.ts
  7. 8 3
      packages/renderers-js/e2e/system/src/generated/instructions/advanceNonceAccount.ts
  8. 3 3
      packages/renderers-js/e2e/system/src/generated/instructions/allocate.ts
  9. 3 3
      packages/renderers-js/e2e/system/src/generated/instructions/assign.ts
  10. 6 3
      packages/renderers-js/e2e/system/src/generated/instructions/authorizeNonceAccount.ts
  11. 6 3
      packages/renderers-js/e2e/system/src/generated/instructions/createAccount.ts
  12. 6 3
      packages/renderers-js/e2e/system/src/generated/instructions/initializeNonceAccount.ts
  13. 6 3
      packages/renderers-js/e2e/system/src/generated/instructions/transferSol.ts
  14. 8 3
      packages/renderers-js/e2e/system/src/generated/instructions/upgradeNonceAccount.ts
  15. 6 3
      packages/renderers-js/e2e/system/src/generated/instructions/withdrawNonceAccount.ts
  16. 10 3
      packages/renderers-js/e2e/system/src/generated/types/nonceState.ts
  17. 10 3
      packages/renderers-js/e2e/system/src/generated/types/nonceVersion.ts
  18. 6 3
      packages/renderers-js/e2e/token/src/generated/accounts/mint.ts
  19. 6 3
      packages/renderers-js/e2e/token/src/generated/accounts/multisig.ts
  20. 6 3
      packages/renderers-js/e2e/token/src/generated/accounts/token.ts
  21. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/amountToUiAmount.ts
  22. 3 3
      packages/renderers-js/e2e/token/src/generated/instructions/approve.ts
  23. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/approveChecked.ts
  24. 3 3
      packages/renderers-js/e2e/token/src/generated/instructions/burn.ts
  25. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/burnChecked.ts
  26. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/closeAccount.ts
  27. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/createAccount.ts
  28. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/createAssociatedToken.ts
  29. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/createAssociatedTokenIdempotent.ts
  30. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/freezeAccount.ts
  31. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/getAccountDataSize.ts
  32. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/initializeAccount.ts
  33. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/initializeAccount2.ts
  34. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/initializeAccount3.ts
  35. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/initializeImmutableOwner.ts
  36. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/initializeMultisig.ts
  37. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/initializeMultisig2.ts
  38. 3 3
      packages/renderers-js/e2e/token/src/generated/instructions/mintTo.ts
  39. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/mintToChecked.ts
  40. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/recoverNestedAssociatedToken.ts
  41. 5 3
      packages/renderers-js/e2e/token/src/generated/instructions/revoke.ts
  42. 5 3
      packages/renderers-js/e2e/token/src/generated/instructions/syncNative.ts
  43. 8 3
      packages/renderers-js/e2e/token/src/generated/instructions/thawAccount.ts
  44. 3 3
      packages/renderers-js/e2e/token/src/generated/instructions/transfer.ts
  45. 6 3
      packages/renderers-js/e2e/token/src/generated/instructions/transferChecked.ts
  46. 6 3
      packages/renderers-js/e2e/token/src/generated/types/accountState.ts
  47. 6 3
      packages/renderers-js/e2e/token/src/generated/types/authorityType.ts
  48. 1 1
      packages/renderers-js/public/templates/fragments/typeCodec.njk
  49. 1 1
      packages/renderers-js/public/templates/fragments/typeDecoder.njk
  50. 1 1
      packages/renderers-js/public/templates/fragments/typeEncoder.njk
  51. 1 0
      packages/renderers-js/src/fragments/typeCodec.ts
  52. 1 0
      packages/renderers-js/src/fragments/typeDecoder.ts
  53. 1 0
      packages/renderers-js/src/fragments/typeEncoder.ts

+ 3 - 3
packages/renderers-js/e2e/anchor/src/generated/instructions/execute.ts

@@ -100,14 +100,14 @@ export function getExecuteInstructionDataEncoder(): FixedSizeEncoder<ExecuteInst
       ['amount', getU64Encoder()],
     ]),
     (value) => ({ ...value, discriminator: EXECUTE_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<ExecuteInstructionDataArgs>;
 }
 
 export function getExecuteInstructionDataDecoder(): FixedSizeDecoder<ExecuteInstructionData> {
   return getStructDecoder([
     ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
     ['amount', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<ExecuteInstructionData>;
 }
 
 export function getExecuteInstructionDataCodec(): FixedSizeCodec<
@@ -117,7 +117,7 @@ export function getExecuteInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getExecuteInstructionDataEncoder(),
     getExecuteInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<ExecuteInstructionDataArgs, ExecuteInstructionData>;
 }
 
 export type ExecuteAsyncInput<

+ 3 - 3
packages/renderers-js/e2e/anchor/src/generated/instructions/initialize.ts

@@ -94,13 +94,13 @@ export function getInitializeInstructionDataEncoder(): FixedSizeEncoder<Initiali
   return transformEncoder(
     getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]),
     (value) => ({ ...value, discriminator: INITIALIZE_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<InitializeInstructionDataArgs>;
 }
 
 export function getInitializeInstructionDataDecoder(): FixedSizeDecoder<InitializeInstructionData> {
   return getStructDecoder([
     ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
-  ]);
+  ]) as FixedSizeDecoder<InitializeInstructionData>;
 }
 
 export function getInitializeInstructionDataCodec(): FixedSizeCodec<
@@ -110,7 +110,7 @@ export function getInitializeInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInitializeInstructionDataEncoder(),
     getInitializeInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<InitializeInstructionDataArgs, InitializeInstructionData>;
 }
 
 export type InitializeAsyncInput<

+ 8 - 3
packages/renderers-js/e2e/dummy/src/generated/instructions/instruction3.ts

@@ -46,11 +46,13 @@ export function getInstruction3InstructionDataEncoder(): FixedSizeEncoder<Instru
   return transformEncoder(
     getStructEncoder([['discriminator', getU32Encoder()]]),
     (value) => ({ ...value, discriminator: INSTRUCTION3_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<Instruction3InstructionDataArgs>;
 }
 
 export function getInstruction3InstructionDataDecoder(): FixedSizeDecoder<Instruction3InstructionData> {
-  return getStructDecoder([['discriminator', getU32Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU32Decoder()],
+  ]) as FixedSizeDecoder<Instruction3InstructionData>;
 }
 
 export function getInstruction3InstructionDataCodec(): FixedSizeCodec<
@@ -60,7 +62,10 @@ export function getInstruction3InstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInstruction3InstructionDataEncoder(),
     getInstruction3InstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    Instruction3InstructionDataArgs,
+    Instruction3InstructionData
+  >;
 }
 
 export type Instruction3Input = {};

+ 10 - 3
packages/renderers-js/e2e/dummy/src/generated/instructions/instruction4.ts

@@ -36,11 +36,15 @@ export type Instruction4InstructionData = { myArgument: bigint };
 export type Instruction4InstructionDataArgs = { myArgument: number | bigint };
 
 export function getInstruction4InstructionDataEncoder(): FixedSizeEncoder<Instruction4InstructionDataArgs> {
-  return getStructEncoder([['myArgument', getU64Encoder()]]);
+  return getStructEncoder([
+    ['myArgument', getU64Encoder()],
+  ]) as FixedSizeEncoder<Instruction4InstructionDataArgs>;
 }
 
 export function getInstruction4InstructionDataDecoder(): FixedSizeDecoder<Instruction4InstructionData> {
-  return getStructDecoder([['myArgument', getU64Decoder()]]);
+  return getStructDecoder([
+    ['myArgument', getU64Decoder()],
+  ]) as FixedSizeDecoder<Instruction4InstructionData>;
 }
 
 export function getInstruction4InstructionDataCodec(): FixedSizeCodec<
@@ -50,7 +54,10 @@ export function getInstruction4InstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInstruction4InstructionDataEncoder(),
     getInstruction4InstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    Instruction4InstructionDataArgs,
+    Instruction4InstructionData
+  >;
 }
 
 export type Instruction4Input = {

+ 8 - 3
packages/renderers-js/e2e/dummy/src/generated/instructions/instruction5.ts

@@ -40,11 +40,13 @@ export function getInstruction5InstructionDataEncoder(): FixedSizeEncoder<Instru
   return transformEncoder(
     getStructEncoder([['myArgument', getU64Encoder()]]),
     (value) => ({ ...value, myArgument: value.myArgument ?? 42 })
-  );
+  ) as FixedSizeEncoder<Instruction5InstructionDataArgs>;
 }
 
 export function getInstruction5InstructionDataDecoder(): FixedSizeDecoder<Instruction5InstructionData> {
-  return getStructDecoder([['myArgument', getU64Decoder()]]);
+  return getStructDecoder([
+    ['myArgument', getU64Decoder()],
+  ]) as FixedSizeDecoder<Instruction5InstructionData>;
 }
 
 export function getInstruction5InstructionDataCodec(): FixedSizeCodec<
@@ -54,7 +56,10 @@ export function getInstruction5InstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInstruction5InstructionDataEncoder(),
     getInstruction5InstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    Instruction5InstructionDataArgs,
+    Instruction5InstructionData
+  >;
 }
 
 export type Instruction5Input = {

+ 6 - 3
packages/renderers-js/e2e/system/src/generated/accounts/nonce.ts

@@ -67,7 +67,7 @@ export function getNonceEncoder(): FixedSizeEncoder<NonceArgs> {
     ['authority', getAddressEncoder()],
     ['blockhash', getAddressEncoder()],
     ['lamportsPerSignature', getLamportsEncoder(getU64Encoder())],
-  ]);
+  ]) as FixedSizeEncoder<NonceArgs>;
 }
 
 export function getNonceDecoder(): FixedSizeDecoder<Nonce> {
@@ -77,11 +77,14 @@ export function getNonceDecoder(): FixedSizeDecoder<Nonce> {
     ['authority', getAddressDecoder()],
     ['blockhash', getAddressDecoder()],
     ['lamportsPerSignature', getLamportsDecoder(getU64Decoder())],
-  ]);
+  ]) as FixedSizeDecoder<Nonce>;
 }
 
 export function getNonceCodec(): FixedSizeCodec<NonceArgs, Nonce> {
-  return combineCodec(getNonceEncoder(), getNonceDecoder());
+  return combineCodec(getNonceEncoder(), getNonceDecoder()) as FixedSizeCodec<
+    NonceArgs,
+    Nonce
+  >;
 }
 
 export function decodeNonce<TAddress extends string = string>(

+ 8 - 3
packages/renderers-js/e2e/system/src/generated/instructions/advanceNonceAccount.ts

@@ -74,11 +74,13 @@ export function getAdvanceNonceAccountInstructionDataEncoder(): FixedSizeEncoder
       ...value,
       discriminator: ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<AdvanceNonceAccountInstructionDataArgs>;
 }
 
 export function getAdvanceNonceAccountInstructionDataDecoder(): FixedSizeDecoder<AdvanceNonceAccountInstructionData> {
-  return getStructDecoder([['discriminator', getU32Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU32Decoder()],
+  ]) as FixedSizeDecoder<AdvanceNonceAccountInstructionData>;
 }
 
 export function getAdvanceNonceAccountInstructionDataCodec(): FixedSizeCodec<
@@ -88,7 +90,10 @@ export function getAdvanceNonceAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getAdvanceNonceAccountInstructionDataEncoder(),
     getAdvanceNonceAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    AdvanceNonceAccountInstructionDataArgs,
+    AdvanceNonceAccountInstructionData
+  >;
 }
 
 export type AdvanceNonceAccountInput<

+ 3 - 3
packages/renderers-js/e2e/system/src/generated/instructions/allocate.ts

@@ -64,14 +64,14 @@ export function getAllocateInstructionDataEncoder(): FixedSizeEncoder<AllocateIn
       ['space', getU64Encoder()],
     ]),
     (value) => ({ ...value, discriminator: ALLOCATE_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<AllocateInstructionDataArgs>;
 }
 
 export function getAllocateInstructionDataDecoder(): FixedSizeDecoder<AllocateInstructionData> {
   return getStructDecoder([
     ['discriminator', getU32Decoder()],
     ['space', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<AllocateInstructionData>;
 }
 
 export function getAllocateInstructionDataCodec(): FixedSizeCodec<
@@ -81,7 +81,7 @@ export function getAllocateInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getAllocateInstructionDataEncoder(),
     getAllocateInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<AllocateInstructionDataArgs, AllocateInstructionData>;
 }
 
 export type AllocateInput<TAccountNewAccount extends string = string> = {

+ 3 - 3
packages/renderers-js/e2e/system/src/generated/instructions/assign.ts

@@ -67,14 +67,14 @@ export function getAssignInstructionDataEncoder(): FixedSizeEncoder<AssignInstru
       ['programAddress', getAddressEncoder()],
     ]),
     (value) => ({ ...value, discriminator: ASSIGN_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<AssignInstructionDataArgs>;
 }
 
 export function getAssignInstructionDataDecoder(): FixedSizeDecoder<AssignInstructionData> {
   return getStructDecoder([
     ['discriminator', getU32Decoder()],
     ['programAddress', getAddressDecoder()],
-  ]);
+  ]) as FixedSizeDecoder<AssignInstructionData>;
 }
 
 export function getAssignInstructionDataCodec(): FixedSizeCodec<
@@ -84,7 +84,7 @@ export function getAssignInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getAssignInstructionDataEncoder(),
     getAssignInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<AssignInstructionDataArgs, AssignInstructionData>;
 }
 
 export type AssignInput<TAccountAccount extends string = string> = {

+ 6 - 3
packages/renderers-js/e2e/system/src/generated/instructions/authorizeNonceAccount.ts

@@ -77,14 +77,14 @@ export function getAuthorizeNonceAccountInstructionDataEncoder(): FixedSizeEncod
       ...value,
       discriminator: AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<AuthorizeNonceAccountInstructionDataArgs>;
 }
 
 export function getAuthorizeNonceAccountInstructionDataDecoder(): FixedSizeDecoder<AuthorizeNonceAccountInstructionData> {
   return getStructDecoder([
     ['discriminator', getU32Decoder()],
     ['newNonceAuthority', getAddressDecoder()],
-  ]);
+  ]) as FixedSizeDecoder<AuthorizeNonceAccountInstructionData>;
 }
 
 export function getAuthorizeNonceAccountInstructionDataCodec(): FixedSizeCodec<
@@ -94,7 +94,10 @@ export function getAuthorizeNonceAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getAuthorizeNonceAccountInstructionDataEncoder(),
     getAuthorizeNonceAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    AuthorizeNonceAccountInstructionDataArgs,
+    AuthorizeNonceAccountInstructionData
+  >;
 }
 
 export type AuthorizeNonceAccountInput<

+ 6 - 3
packages/renderers-js/e2e/system/src/generated/instructions/createAccount.ts

@@ -90,7 +90,7 @@ export function getCreateAccountInstructionDataEncoder(): FixedSizeEncoder<Creat
       ['programAddress', getAddressEncoder()],
     ]),
     (value) => ({ ...value, discriminator: CREATE_ACCOUNT_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<CreateAccountInstructionDataArgs>;
 }
 
 export function getCreateAccountInstructionDataDecoder(): FixedSizeDecoder<CreateAccountInstructionData> {
@@ -99,7 +99,7 @@ export function getCreateAccountInstructionDataDecoder(): FixedSizeDecoder<Creat
     ['lamports', getLamportsDecoder(getU64Decoder())],
     ['space', getU64Decoder()],
     ['programAddress', getAddressDecoder()],
-  ]);
+  ]) as FixedSizeDecoder<CreateAccountInstructionData>;
 }
 
 export function getCreateAccountInstructionDataCodec(): FixedSizeCodec<
@@ -109,7 +109,10 @@ export function getCreateAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getCreateAccountInstructionDataEncoder(),
     getCreateAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    CreateAccountInstructionDataArgs,
+    CreateAccountInstructionData
+  >;
 }
 
 export type CreateAccountInput<

+ 6 - 3
packages/renderers-js/e2e/system/src/generated/instructions/initializeNonceAccount.ts

@@ -82,14 +82,14 @@ export function getInitializeNonceAccountInstructionDataEncoder(): FixedSizeEnco
       ...value,
       discriminator: INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<InitializeNonceAccountInstructionDataArgs>;
 }
 
 export function getInitializeNonceAccountInstructionDataDecoder(): FixedSizeDecoder<InitializeNonceAccountInstructionData> {
   return getStructDecoder([
     ['discriminator', getU32Decoder()],
     ['nonceAuthority', getAddressDecoder()],
-  ]);
+  ]) as FixedSizeDecoder<InitializeNonceAccountInstructionData>;
 }
 
 export function getInitializeNonceAccountInstructionDataCodec(): FixedSizeCodec<
@@ -99,7 +99,10 @@ export function getInitializeNonceAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInitializeNonceAccountInstructionDataEncoder(),
     getInitializeNonceAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    InitializeNonceAccountInstructionDataArgs,
+    InitializeNonceAccountInstructionData
+  >;
 }
 
 export type InitializeNonceAccountInput<

+ 6 - 3
packages/renderers-js/e2e/system/src/generated/instructions/transferSol.ts

@@ -72,14 +72,14 @@ export function getTransferSolInstructionDataEncoder(): FixedSizeEncoder<Transfe
       ['amount', getU64Encoder()],
     ]),
     (value) => ({ ...value, discriminator: TRANSFER_SOL_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<TransferSolInstructionDataArgs>;
 }
 
 export function getTransferSolInstructionDataDecoder(): FixedSizeDecoder<TransferSolInstructionData> {
   return getStructDecoder([
     ['discriminator', getU32Decoder()],
     ['amount', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<TransferSolInstructionData>;
 }
 
 export function getTransferSolInstructionDataCodec(): FixedSizeCodec<
@@ -89,7 +89,10 @@ export function getTransferSolInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getTransferSolInstructionDataEncoder(),
     getTransferSolInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    TransferSolInstructionDataArgs,
+    TransferSolInstructionData
+  >;
 }
 
 export type TransferSolInput<

+ 8 - 3
packages/renderers-js/e2e/system/src/generated/instructions/upgradeNonceAccount.ts

@@ -59,11 +59,13 @@ export function getUpgradeNonceAccountInstructionDataEncoder(): FixedSizeEncoder
       ...value,
       discriminator: UPGRADE_NONCE_ACCOUNT_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<UpgradeNonceAccountInstructionDataArgs>;
 }
 
 export function getUpgradeNonceAccountInstructionDataDecoder(): FixedSizeDecoder<UpgradeNonceAccountInstructionData> {
-  return getStructDecoder([['discriminator', getU32Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU32Decoder()],
+  ]) as FixedSizeDecoder<UpgradeNonceAccountInstructionData>;
 }
 
 export function getUpgradeNonceAccountInstructionDataCodec(): FixedSizeCodec<
@@ -73,7 +75,10 @@ export function getUpgradeNonceAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getUpgradeNonceAccountInstructionDataEncoder(),
     getUpgradeNonceAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    UpgradeNonceAccountInstructionDataArgs,
+    UpgradeNonceAccountInstructionData
+  >;
 }
 
 export type UpgradeNonceAccountInput<

+ 6 - 3
packages/renderers-js/e2e/system/src/generated/instructions/withdrawNonceAccount.ts

@@ -94,14 +94,14 @@ export function getWithdrawNonceAccountInstructionDataEncoder(): FixedSizeEncode
       ...value,
       discriminator: WITHDRAW_NONCE_ACCOUNT_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<WithdrawNonceAccountInstructionDataArgs>;
 }
 
 export function getWithdrawNonceAccountInstructionDataDecoder(): FixedSizeDecoder<WithdrawNonceAccountInstructionData> {
   return getStructDecoder([
     ['discriminator', getU32Decoder()],
     ['withdrawAmount', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<WithdrawNonceAccountInstructionData>;
 }
 
 export function getWithdrawNonceAccountInstructionDataCodec(): FixedSizeCodec<
@@ -111,7 +111,10 @@ export function getWithdrawNonceAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getWithdrawNonceAccountInstructionDataEncoder(),
     getWithdrawNonceAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    WithdrawNonceAccountInstructionDataArgs,
+    WithdrawNonceAccountInstructionData
+  >;
 }
 
 export type WithdrawNonceAccountInput<

+ 10 - 3
packages/renderers-js/e2e/system/src/generated/types/nonceState.ts

@@ -25,16 +25,23 @@ export enum NonceState {
 export type NonceStateArgs = NonceState;
 
 export function getNonceStateEncoder(): FixedSizeEncoder<NonceStateArgs> {
-  return getEnumEncoder(NonceState, { size: getU32Encoder() });
+  return getEnumEncoder(NonceState, {
+    size: getU32Encoder(),
+  }) as FixedSizeEncoder<NonceStateArgs>;
 }
 
 export function getNonceStateDecoder(): FixedSizeDecoder<NonceState> {
-  return getEnumDecoder(NonceState, { size: getU32Decoder() });
+  return getEnumDecoder(NonceState, {
+    size: getU32Decoder(),
+  }) as FixedSizeDecoder<NonceState>;
 }
 
 export function getNonceStateCodec(): FixedSizeCodec<
   NonceStateArgs,
   NonceState
 > {
-  return combineCodec(getNonceStateEncoder(), getNonceStateDecoder());
+  return combineCodec(
+    getNonceStateEncoder(),
+    getNonceStateDecoder()
+  ) as FixedSizeCodec<NonceStateArgs, NonceState>;
 }

+ 10 - 3
packages/renderers-js/e2e/system/src/generated/types/nonceVersion.ts

@@ -25,16 +25,23 @@ export enum NonceVersion {
 export type NonceVersionArgs = NonceVersion;
 
 export function getNonceVersionEncoder(): FixedSizeEncoder<NonceVersionArgs> {
-  return getEnumEncoder(NonceVersion, { size: getU32Encoder() });
+  return getEnumEncoder(NonceVersion, {
+    size: getU32Encoder(),
+  }) as FixedSizeEncoder<NonceVersionArgs>;
 }
 
 export function getNonceVersionDecoder(): FixedSizeDecoder<NonceVersion> {
-  return getEnumDecoder(NonceVersion, { size: getU32Decoder() });
+  return getEnumDecoder(NonceVersion, {
+    size: getU32Decoder(),
+  }) as FixedSizeDecoder<NonceVersion>;
 }
 
 export function getNonceVersionCodec(): FixedSizeCodec<
   NonceVersionArgs,
   NonceVersion
 > {
-  return combineCodec(getNonceVersionEncoder(), getNonceVersionDecoder());
+  return combineCodec(
+    getNonceVersionEncoder(),
+    getNonceVersionDecoder()
+  ) as FixedSizeCodec<NonceVersionArgs, NonceVersion>;
 }

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/accounts/mint.ts

@@ -94,7 +94,7 @@ export function getMintEncoder(): FixedSizeEncoder<MintArgs> {
         noneValue: 'zeroes',
       }),
     ],
-  ]);
+  ]) as FixedSizeEncoder<MintArgs>;
 }
 
 export function getMintDecoder(): FixedSizeDecoder<Mint> {
@@ -116,11 +116,14 @@ export function getMintDecoder(): FixedSizeDecoder<Mint> {
         noneValue: 'zeroes',
       }),
     ],
-  ]);
+  ]) as FixedSizeDecoder<Mint>;
 }
 
 export function getMintCodec(): FixedSizeCodec<MintArgs, Mint> {
-  return combineCodec(getMintEncoder(), getMintDecoder());
+  return combineCodec(getMintEncoder(), getMintDecoder()) as FixedSizeCodec<
+    MintArgs,
+    Mint
+  >;
 }
 
 export function decodeMint<TAddress extends string = string>(

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/accounts/multisig.ts

@@ -54,7 +54,7 @@ export function getMultisigEncoder(): FixedSizeEncoder<MultisigArgs> {
     ['n', getU8Encoder()],
     ['isInitialized', getBooleanEncoder()],
     ['signers', getArrayEncoder(getAddressEncoder(), { size: 11 })],
-  ]);
+  ]) as FixedSizeEncoder<MultisigArgs>;
 }
 
 export function getMultisigDecoder(): FixedSizeDecoder<Multisig> {
@@ -63,11 +63,14 @@ export function getMultisigDecoder(): FixedSizeDecoder<Multisig> {
     ['n', getU8Decoder()],
     ['isInitialized', getBooleanDecoder()],
     ['signers', getArrayDecoder(getAddressDecoder(), { size: 11 })],
-  ]);
+  ]) as FixedSizeDecoder<Multisig>;
 }
 
 export function getMultisigCodec(): FixedSizeCodec<MultisigArgs, Multisig> {
-  return combineCodec(getMultisigEncoder(), getMultisigDecoder());
+  return combineCodec(
+    getMultisigEncoder(),
+    getMultisigDecoder()
+  ) as FixedSizeCodec<MultisigArgs, Multisig>;
 }
 
 export function decodeMultisig<TAddress extends string = string>(

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/accounts/token.ts

@@ -125,7 +125,7 @@ export function getTokenEncoder(): FixedSizeEncoder<TokenArgs> {
         noneValue: 'zeroes',
       }),
     ],
-  ]);
+  ]) as FixedSizeEncoder<TokenArgs>;
 }
 
 export function getTokenDecoder(): FixedSizeDecoder<Token> {
@@ -156,11 +156,14 @@ export function getTokenDecoder(): FixedSizeDecoder<Token> {
         noneValue: 'zeroes',
       }),
     ],
-  ]);
+  ]) as FixedSizeDecoder<Token>;
 }
 
 export function getTokenCodec(): FixedSizeCodec<TokenArgs, Token> {
-  return combineCodec(getTokenEncoder(), getTokenDecoder());
+  return combineCodec(getTokenEncoder(), getTokenDecoder()) as FixedSizeCodec<
+    TokenArgs,
+    Token
+  >;
 }
 
 export function decodeToken<TAddress extends string = string>(

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/amountToUiAmount.ts

@@ -68,14 +68,14 @@ export function getAmountToUiAmountInstructionDataEncoder(): FixedSizeEncoder<Am
       ['amount', getU64Encoder()],
     ]),
     (value) => ({ ...value, discriminator: AMOUNT_TO_UI_AMOUNT_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<AmountToUiAmountInstructionDataArgs>;
 }
 
 export function getAmountToUiAmountInstructionDataDecoder(): FixedSizeDecoder<AmountToUiAmountInstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<AmountToUiAmountInstructionData>;
 }
 
 export function getAmountToUiAmountInstructionDataCodec(): FixedSizeCodec<
@@ -85,7 +85,10 @@ export function getAmountToUiAmountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getAmountToUiAmountInstructionDataEncoder(),
     getAmountToUiAmountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    AmountToUiAmountInstructionDataArgs,
+    AmountToUiAmountInstructionData
+  >;
 }
 
 export type AmountToUiAmountInput<TAccountMint extends string = string> = {

+ 3 - 3
packages/renderers-js/e2e/token/src/generated/instructions/approve.ts

@@ -81,14 +81,14 @@ export function getApproveInstructionDataEncoder(): FixedSizeEncoder<ApproveInst
       ['amount', getU64Encoder()],
     ]),
     (value) => ({ ...value, discriminator: APPROVE_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<ApproveInstructionDataArgs>;
 }
 
 export function getApproveInstructionDataDecoder(): FixedSizeDecoder<ApproveInstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<ApproveInstructionData>;
 }
 
 export function getApproveInstructionDataCodec(): FixedSizeCodec<
@@ -98,7 +98,7 @@ export function getApproveInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getApproveInstructionDataEncoder(),
     getApproveInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<ApproveInstructionDataArgs, ApproveInstructionData>;
 }
 
 export type ApproveInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/approveChecked.ts

@@ -90,7 +90,7 @@ export function getApproveCheckedInstructionDataEncoder(): FixedSizeEncoder<Appr
       ['decimals', getU8Encoder()],
     ]),
     (value) => ({ ...value, discriminator: APPROVE_CHECKED_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<ApproveCheckedInstructionDataArgs>;
 }
 
 export function getApproveCheckedInstructionDataDecoder(): FixedSizeDecoder<ApproveCheckedInstructionData> {
@@ -98,7 +98,7 @@ export function getApproveCheckedInstructionDataDecoder(): FixedSizeDecoder<Appr
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
     ['decimals', getU8Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<ApproveCheckedInstructionData>;
 }
 
 export function getApproveCheckedInstructionDataCodec(): FixedSizeCodec<
@@ -108,7 +108,10 @@ export function getApproveCheckedInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getApproveCheckedInstructionDataEncoder(),
     getApproveCheckedInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    ApproveCheckedInstructionDataArgs,
+    ApproveCheckedInstructionData
+  >;
 }
 
 export type ApproveCheckedInput<

+ 3 - 3
packages/renderers-js/e2e/token/src/generated/instructions/burn.ts

@@ -78,14 +78,14 @@ export function getBurnInstructionDataEncoder(): FixedSizeEncoder<BurnInstructio
       ['amount', getU64Encoder()],
     ]),
     (value) => ({ ...value, discriminator: BURN_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<BurnInstructionDataArgs>;
 }
 
 export function getBurnInstructionDataDecoder(): FixedSizeDecoder<BurnInstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<BurnInstructionData>;
 }
 
 export function getBurnInstructionDataCodec(): FixedSizeCodec<
@@ -95,7 +95,7 @@ export function getBurnInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getBurnInstructionDataEncoder(),
     getBurnInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<BurnInstructionDataArgs, BurnInstructionData>;
 }
 
 export type BurnInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/burnChecked.ts

@@ -86,7 +86,7 @@ export function getBurnCheckedInstructionDataEncoder(): FixedSizeEncoder<BurnChe
       ['decimals', getU8Encoder()],
     ]),
     (value) => ({ ...value, discriminator: BURN_CHECKED_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<BurnCheckedInstructionDataArgs>;
 }
 
 export function getBurnCheckedInstructionDataDecoder(): FixedSizeDecoder<BurnCheckedInstructionData> {
@@ -94,7 +94,7 @@ export function getBurnCheckedInstructionDataDecoder(): FixedSizeDecoder<BurnChe
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
     ['decimals', getU8Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<BurnCheckedInstructionData>;
 }
 
 export function getBurnCheckedInstructionDataCodec(): FixedSizeCodec<
@@ -104,7 +104,10 @@ export function getBurnCheckedInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getBurnCheckedInstructionDataEncoder(),
     getBurnCheckedInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    BurnCheckedInstructionDataArgs,
+    BurnCheckedInstructionData
+  >;
 }
 
 export type BurnCheckedInput<

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/closeAccount.ts

@@ -69,11 +69,13 @@ export function getCloseAccountInstructionDataEncoder(): FixedSizeEncoder<CloseA
   return transformEncoder(
     getStructEncoder([['discriminator', getU8Encoder()]]),
     (value) => ({ ...value, discriminator: CLOSE_ACCOUNT_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<CloseAccountInstructionDataArgs>;
 }
 
 export function getCloseAccountInstructionDataDecoder(): FixedSizeDecoder<CloseAccountInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<CloseAccountInstructionData>;
 }
 
 export function getCloseAccountInstructionDataCodec(): FixedSizeCodec<
@@ -83,7 +85,10 @@ export function getCloseAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getCloseAccountInstructionDataEncoder(),
     getCloseAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    CloseAccountInstructionDataArgs,
+    CloseAccountInstructionData
+  >;
 }
 
 export type CloseAccountInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/createAccount.ts

@@ -90,7 +90,7 @@ export function getCreateAccountInstructionDataEncoder(): FixedSizeEncoder<Creat
       ['programAddress', getAddressEncoder()],
     ]),
     (value) => ({ ...value, discriminator: CREATE_ACCOUNT_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<CreateAccountInstructionDataArgs>;
 }
 
 export function getCreateAccountInstructionDataDecoder(): FixedSizeDecoder<CreateAccountInstructionData> {
@@ -99,7 +99,7 @@ export function getCreateAccountInstructionDataDecoder(): FixedSizeDecoder<Creat
     ['lamports', getLamportsDecoder(getU64Decoder())],
     ['space', getU64Decoder()],
     ['programAddress', getAddressDecoder()],
-  ]);
+  ]) as FixedSizeDecoder<CreateAccountInstructionData>;
 }
 
 export function getCreateAccountInstructionDataCodec(): FixedSizeCodec<
@@ -109,7 +109,10 @@ export function getCreateAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getCreateAccountInstructionDataEncoder(),
     getCreateAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    CreateAccountInstructionDataArgs,
+    CreateAccountInstructionData
+  >;
 }
 
 export type CreateAccountInput<

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/createAssociatedToken.ts

@@ -91,11 +91,13 @@ export function getCreateAssociatedTokenInstructionDataEncoder(): FixedSizeEncod
       ...value,
       discriminator: CREATE_ASSOCIATED_TOKEN_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<CreateAssociatedTokenInstructionDataArgs>;
 }
 
 export function getCreateAssociatedTokenInstructionDataDecoder(): FixedSizeDecoder<CreateAssociatedTokenInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<CreateAssociatedTokenInstructionData>;
 }
 
 export function getCreateAssociatedTokenInstructionDataCodec(): FixedSizeCodec<
@@ -105,7 +107,10 @@ export function getCreateAssociatedTokenInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getCreateAssociatedTokenInstructionDataEncoder(),
     getCreateAssociatedTokenInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    CreateAssociatedTokenInstructionDataArgs,
+    CreateAssociatedTokenInstructionData
+  >;
 }
 
 export type CreateAssociatedTokenAsyncInput<

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/createAssociatedTokenIdempotent.ts

@@ -95,11 +95,13 @@ export function getCreateAssociatedTokenIdempotentInstructionDataEncoder(): Fixe
       ...value,
       discriminator: CREATE_ASSOCIATED_TOKEN_IDEMPOTENT_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<CreateAssociatedTokenIdempotentInstructionDataArgs>;
 }
 
 export function getCreateAssociatedTokenIdempotentInstructionDataDecoder(): FixedSizeDecoder<CreateAssociatedTokenIdempotentInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<CreateAssociatedTokenIdempotentInstructionData>;
 }
 
 export function getCreateAssociatedTokenIdempotentInstructionDataCodec(): FixedSizeCodec<
@@ -109,7 +111,10 @@ export function getCreateAssociatedTokenIdempotentInstructionDataCodec(): FixedS
   return combineCodec(
     getCreateAssociatedTokenIdempotentInstructionDataEncoder(),
     getCreateAssociatedTokenIdempotentInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    CreateAssociatedTokenIdempotentInstructionDataArgs,
+    CreateAssociatedTokenIdempotentInstructionData
+  >;
 }
 
 export type CreateAssociatedTokenIdempotentAsyncInput<

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/freezeAccount.ts

@@ -69,11 +69,13 @@ export function getFreezeAccountInstructionDataEncoder(): FixedSizeEncoder<Freez
   return transformEncoder(
     getStructEncoder([['discriminator', getU8Encoder()]]),
     (value) => ({ ...value, discriminator: FREEZE_ACCOUNT_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<FreezeAccountInstructionDataArgs>;
 }
 
 export function getFreezeAccountInstructionDataDecoder(): FixedSizeDecoder<FreezeAccountInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<FreezeAccountInstructionData>;
 }
 
 export function getFreezeAccountInstructionDataCodec(): FixedSizeCodec<
@@ -83,7 +85,10 @@ export function getFreezeAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getFreezeAccountInstructionDataEncoder(),
     getFreezeAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    FreezeAccountInstructionDataArgs,
+    FreezeAccountInstructionData
+  >;
 }
 
 export type FreezeAccountInput<

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/getAccountDataSize.ts

@@ -59,11 +59,13 @@ export function getGetAccountDataSizeInstructionDataEncoder(): FixedSizeEncoder<
       ...value,
       discriminator: GET_ACCOUNT_DATA_SIZE_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<GetAccountDataSizeInstructionDataArgs>;
 }
 
 export function getGetAccountDataSizeInstructionDataDecoder(): FixedSizeDecoder<GetAccountDataSizeInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<GetAccountDataSizeInstructionData>;
 }
 
 export function getGetAccountDataSizeInstructionDataCodec(): FixedSizeCodec<
@@ -73,7 +75,10 @@ export function getGetAccountDataSizeInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getGetAccountDataSizeInstructionDataEncoder(),
     getGetAccountDataSizeInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    GetAccountDataSizeInstructionDataArgs,
+    GetAccountDataSizeInstructionData
+  >;
 }
 
 export type GetAccountDataSizeInput<TAccountMint extends string = string> = {

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/initializeAccount.ts

@@ -71,11 +71,13 @@ export function getInitializeAccountInstructionDataEncoder(): FixedSizeEncoder<I
   return transformEncoder(
     getStructEncoder([['discriminator', getU8Encoder()]]),
     (value) => ({ ...value, discriminator: INITIALIZE_ACCOUNT_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<InitializeAccountInstructionDataArgs>;
 }
 
 export function getInitializeAccountInstructionDataDecoder(): FixedSizeDecoder<InitializeAccountInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<InitializeAccountInstructionData>;
 }
 
 export function getInitializeAccountInstructionDataCodec(): FixedSizeCodec<
@@ -85,7 +87,10 @@ export function getInitializeAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInitializeAccountInstructionDataEncoder(),
     getInitializeAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    InitializeAccountInstructionDataArgs,
+    InitializeAccountInstructionData
+  >;
 }
 
 export type InitializeAccountInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/initializeAccount2.ts

@@ -79,14 +79,14 @@ export function getInitializeAccount2InstructionDataEncoder(): FixedSizeEncoder<
       ['owner', getAddressEncoder()],
     ]),
     (value) => ({ ...value, discriminator: INITIALIZE_ACCOUNT2_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<InitializeAccount2InstructionDataArgs>;
 }
 
 export function getInitializeAccount2InstructionDataDecoder(): FixedSizeDecoder<InitializeAccount2InstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['owner', getAddressDecoder()],
-  ]);
+  ]) as FixedSizeDecoder<InitializeAccount2InstructionData>;
 }
 
 export function getInitializeAccount2InstructionDataCodec(): FixedSizeCodec<
@@ -96,7 +96,10 @@ export function getInitializeAccount2InstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInitializeAccount2InstructionDataEncoder(),
     getInitializeAccount2InstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    InitializeAccount2InstructionDataArgs,
+    InitializeAccount2InstructionData
+  >;
 }
 
 export type InitializeAccount2Input<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/initializeAccount3.ts

@@ -73,14 +73,14 @@ export function getInitializeAccount3InstructionDataEncoder(): FixedSizeEncoder<
       ['owner', getAddressEncoder()],
     ]),
     (value) => ({ ...value, discriminator: INITIALIZE_ACCOUNT3_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<InitializeAccount3InstructionDataArgs>;
 }
 
 export function getInitializeAccount3InstructionDataDecoder(): FixedSizeDecoder<InitializeAccount3InstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['owner', getAddressDecoder()],
-  ]);
+  ]) as FixedSizeDecoder<InitializeAccount3InstructionData>;
 }
 
 export function getInitializeAccount3InstructionDataCodec(): FixedSizeCodec<
@@ -90,7 +90,10 @@ export function getInitializeAccount3InstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInitializeAccount3InstructionDataEncoder(),
     getInitializeAccount3InstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    InitializeAccount3InstructionDataArgs,
+    InitializeAccount3InstructionData
+  >;
 }
 
 export type InitializeAccount3Input<

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/initializeImmutableOwner.ts

@@ -59,11 +59,13 @@ export function getInitializeImmutableOwnerInstructionDataEncoder(): FixedSizeEn
       ...value,
       discriminator: INITIALIZE_IMMUTABLE_OWNER_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<InitializeImmutableOwnerInstructionDataArgs>;
 }
 
 export function getInitializeImmutableOwnerInstructionDataDecoder(): FixedSizeDecoder<InitializeImmutableOwnerInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<InitializeImmutableOwnerInstructionData>;
 }
 
 export function getInitializeImmutableOwnerInstructionDataCodec(): FixedSizeCodec<
@@ -73,7 +75,10 @@ export function getInitializeImmutableOwnerInstructionDataCodec(): FixedSizeCode
   return combineCodec(
     getInitializeImmutableOwnerInstructionDataEncoder(),
     getInitializeImmutableOwnerInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    InitializeImmutableOwnerInstructionDataArgs,
+    InitializeImmutableOwnerInstructionData
+  >;
 }
 
 export type InitializeImmutableOwnerInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/initializeMultisig.ts

@@ -74,14 +74,14 @@ export function getInitializeMultisigInstructionDataEncoder(): FixedSizeEncoder<
       ['m', getU8Encoder()],
     ]),
     (value) => ({ ...value, discriminator: INITIALIZE_MULTISIG_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<InitializeMultisigInstructionDataArgs>;
 }
 
 export function getInitializeMultisigInstructionDataDecoder(): FixedSizeDecoder<InitializeMultisigInstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['m', getU8Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<InitializeMultisigInstructionData>;
 }
 
 export function getInitializeMultisigInstructionDataCodec(): FixedSizeCodec<
@@ -91,7 +91,10 @@ export function getInitializeMultisigInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInitializeMultisigInstructionDataEncoder(),
     getInitializeMultisigInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    InitializeMultisigInstructionDataArgs,
+    InitializeMultisigInstructionData
+  >;
 }
 
 export type InitializeMultisigInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/initializeMultisig2.ts

@@ -67,14 +67,14 @@ export function getInitializeMultisig2InstructionDataEncoder(): FixedSizeEncoder
       ['m', getU8Encoder()],
     ]),
     (value) => ({ ...value, discriminator: INITIALIZE_MULTISIG2_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<InitializeMultisig2InstructionDataArgs>;
 }
 
 export function getInitializeMultisig2InstructionDataDecoder(): FixedSizeDecoder<InitializeMultisig2InstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['m', getU8Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<InitializeMultisig2InstructionData>;
 }
 
 export function getInitializeMultisig2InstructionDataCodec(): FixedSizeCodec<
@@ -84,7 +84,10 @@ export function getInitializeMultisig2InstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getInitializeMultisig2InstructionDataEncoder(),
     getInitializeMultisig2InstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    InitializeMultisig2InstructionDataArgs,
+    InitializeMultisig2InstructionData
+  >;
 }
 
 export type InitializeMultisig2Input<TAccountMultisig extends string = string> =

+ 3 - 3
packages/renderers-js/e2e/token/src/generated/instructions/mintTo.ts

@@ -81,14 +81,14 @@ export function getMintToInstructionDataEncoder(): FixedSizeEncoder<MintToInstru
       ['amount', getU64Encoder()],
     ]),
     (value) => ({ ...value, discriminator: MINT_TO_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<MintToInstructionDataArgs>;
 }
 
 export function getMintToInstructionDataDecoder(): FixedSizeDecoder<MintToInstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<MintToInstructionData>;
 }
 
 export function getMintToInstructionDataCodec(): FixedSizeCodec<
@@ -98,7 +98,7 @@ export function getMintToInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getMintToInstructionDataEncoder(),
     getMintToInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<MintToInstructionDataArgs, MintToInstructionData>;
 }
 
 export type MintToInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/mintToChecked.ts

@@ -86,7 +86,7 @@ export function getMintToCheckedInstructionDataEncoder(): FixedSizeEncoder<MintT
       ['decimals', getU8Encoder()],
     ]),
     (value) => ({ ...value, discriminator: MINT_TO_CHECKED_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<MintToCheckedInstructionDataArgs>;
 }
 
 export function getMintToCheckedInstructionDataDecoder(): FixedSizeDecoder<MintToCheckedInstructionData> {
@@ -94,7 +94,7 @@ export function getMintToCheckedInstructionDataDecoder(): FixedSizeDecoder<MintT
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
     ['decimals', getU8Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<MintToCheckedInstructionData>;
 }
 
 export function getMintToCheckedInstructionDataCodec(): FixedSizeCodec<
@@ -104,7 +104,10 @@ export function getMintToCheckedInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getMintToCheckedInstructionDataEncoder(),
     getMintToCheckedInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    MintToCheckedInstructionDataArgs,
+    MintToCheckedInstructionData
+  >;
 }
 
 export type MintToCheckedInput<

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/recoverNestedAssociatedToken.ts

@@ -103,11 +103,13 @@ export function getRecoverNestedAssociatedTokenInstructionDataEncoder(): FixedSi
       ...value,
       discriminator: RECOVER_NESTED_ASSOCIATED_TOKEN_DISCRIMINATOR,
     })
-  );
+  ) as FixedSizeEncoder<RecoverNestedAssociatedTokenInstructionDataArgs>;
 }
 
 export function getRecoverNestedAssociatedTokenInstructionDataDecoder(): FixedSizeDecoder<RecoverNestedAssociatedTokenInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<RecoverNestedAssociatedTokenInstructionData>;
 }
 
 export function getRecoverNestedAssociatedTokenInstructionDataCodec(): FixedSizeCodec<
@@ -117,7 +119,10 @@ export function getRecoverNestedAssociatedTokenInstructionDataCodec(): FixedSize
   return combineCodec(
     getRecoverNestedAssociatedTokenInstructionDataEncoder(),
     getRecoverNestedAssociatedTokenInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    RecoverNestedAssociatedTokenInstructionDataArgs,
+    RecoverNestedAssociatedTokenInstructionData
+  >;
 }
 
 export type RecoverNestedAssociatedTokenAsyncInput<

+ 5 - 3
packages/renderers-js/e2e/token/src/generated/instructions/revoke.ts

@@ -65,11 +65,13 @@ export function getRevokeInstructionDataEncoder(): FixedSizeEncoder<RevokeInstru
   return transformEncoder(
     getStructEncoder([['discriminator', getU8Encoder()]]),
     (value) => ({ ...value, discriminator: REVOKE_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<RevokeInstructionDataArgs>;
 }
 
 export function getRevokeInstructionDataDecoder(): FixedSizeDecoder<RevokeInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<RevokeInstructionData>;
 }
 
 export function getRevokeInstructionDataCodec(): FixedSizeCodec<
@@ -79,7 +81,7 @@ export function getRevokeInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getRevokeInstructionDataEncoder(),
     getRevokeInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<RevokeInstructionDataArgs, RevokeInstructionData>;
 }
 
 export type RevokeInput<

+ 5 - 3
packages/renderers-js/e2e/token/src/generated/instructions/syncNative.ts

@@ -56,11 +56,13 @@ export function getSyncNativeInstructionDataEncoder(): FixedSizeEncoder<SyncNati
   return transformEncoder(
     getStructEncoder([['discriminator', getU8Encoder()]]),
     (value) => ({ ...value, discriminator: SYNC_NATIVE_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<SyncNativeInstructionDataArgs>;
 }
 
 export function getSyncNativeInstructionDataDecoder(): FixedSizeDecoder<SyncNativeInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<SyncNativeInstructionData>;
 }
 
 export function getSyncNativeInstructionDataCodec(): FixedSizeCodec<
@@ -70,7 +72,7 @@ export function getSyncNativeInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getSyncNativeInstructionDataEncoder(),
     getSyncNativeInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<SyncNativeInstructionDataArgs, SyncNativeInstructionData>;
 }
 
 export type SyncNativeInput<TAccountAccount extends string = string> = {

+ 8 - 3
packages/renderers-js/e2e/token/src/generated/instructions/thawAccount.ts

@@ -69,11 +69,13 @@ export function getThawAccountInstructionDataEncoder(): FixedSizeEncoder<ThawAcc
   return transformEncoder(
     getStructEncoder([['discriminator', getU8Encoder()]]),
     (value) => ({ ...value, discriminator: THAW_ACCOUNT_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<ThawAccountInstructionDataArgs>;
 }
 
 export function getThawAccountInstructionDataDecoder(): FixedSizeDecoder<ThawAccountInstructionData> {
-  return getStructDecoder([['discriminator', getU8Decoder()]]);
+  return getStructDecoder([
+    ['discriminator', getU8Decoder()],
+  ]) as FixedSizeDecoder<ThawAccountInstructionData>;
 }
 
 export function getThawAccountInstructionDataCodec(): FixedSizeCodec<
@@ -83,7 +85,10 @@ export function getThawAccountInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getThawAccountInstructionDataEncoder(),
     getThawAccountInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    ThawAccountInstructionDataArgs,
+    ThawAccountInstructionData
+  >;
 }
 
 export type ThawAccountInput<

+ 3 - 3
packages/renderers-js/e2e/token/src/generated/instructions/transfer.ts

@@ -81,14 +81,14 @@ export function getTransferInstructionDataEncoder(): FixedSizeEncoder<TransferIn
       ['amount', getU64Encoder()],
     ]),
     (value) => ({ ...value, discriminator: TRANSFER_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<TransferInstructionDataArgs>;
 }
 
 export function getTransferInstructionDataDecoder(): FixedSizeDecoder<TransferInstructionData> {
   return getStructDecoder([
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<TransferInstructionData>;
 }
 
 export function getTransferInstructionDataCodec(): FixedSizeCodec<
@@ -98,7 +98,7 @@ export function getTransferInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getTransferInstructionDataEncoder(),
     getTransferInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<TransferInstructionDataArgs, TransferInstructionData>;
 }
 
 export type TransferInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/instructions/transferChecked.ts

@@ -90,7 +90,7 @@ export function getTransferCheckedInstructionDataEncoder(): FixedSizeEncoder<Tra
       ['decimals', getU8Encoder()],
     ]),
     (value) => ({ ...value, discriminator: TRANSFER_CHECKED_DISCRIMINATOR })
-  );
+  ) as FixedSizeEncoder<TransferCheckedInstructionDataArgs>;
 }
 
 export function getTransferCheckedInstructionDataDecoder(): FixedSizeDecoder<TransferCheckedInstructionData> {
@@ -98,7 +98,7 @@ export function getTransferCheckedInstructionDataDecoder(): FixedSizeDecoder<Tra
     ['discriminator', getU8Decoder()],
     ['amount', getU64Decoder()],
     ['decimals', getU8Decoder()],
-  ]);
+  ]) as FixedSizeDecoder<TransferCheckedInstructionData>;
 }
 
 export function getTransferCheckedInstructionDataCodec(): FixedSizeCodec<
@@ -108,7 +108,10 @@ export function getTransferCheckedInstructionDataCodec(): FixedSizeCodec<
   return combineCodec(
     getTransferCheckedInstructionDataEncoder(),
     getTransferCheckedInstructionDataDecoder()
-  );
+  ) as FixedSizeCodec<
+    TransferCheckedInstructionDataArgs,
+    TransferCheckedInstructionData
+  >;
 }
 
 export type TransferCheckedInput<

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/types/accountState.ts

@@ -24,16 +24,19 @@ export enum AccountState {
 export type AccountStateArgs = AccountState;
 
 export function getAccountStateEncoder(): FixedSizeEncoder<AccountStateArgs> {
-  return getEnumEncoder(AccountState);
+  return getEnumEncoder(AccountState) as FixedSizeEncoder<AccountStateArgs>;
 }
 
 export function getAccountStateDecoder(): FixedSizeDecoder<AccountState> {
-  return getEnumDecoder(AccountState);
+  return getEnumDecoder(AccountState) as FixedSizeDecoder<AccountState>;
 }
 
 export function getAccountStateCodec(): FixedSizeCodec<
   AccountStateArgs,
   AccountState
 > {
-  return combineCodec(getAccountStateEncoder(), getAccountStateDecoder());
+  return combineCodec(
+    getAccountStateEncoder(),
+    getAccountStateDecoder()
+  ) as FixedSizeCodec<AccountStateArgs, AccountState>;
 }

+ 6 - 3
packages/renderers-js/e2e/token/src/generated/types/authorityType.ts

@@ -25,16 +25,19 @@ export enum AuthorityType {
 export type AuthorityTypeArgs = AuthorityType;
 
 export function getAuthorityTypeEncoder(): FixedSizeEncoder<AuthorityTypeArgs> {
-  return getEnumEncoder(AuthorityType);
+  return getEnumEncoder(AuthorityType) as FixedSizeEncoder<AuthorityTypeArgs>;
 }
 
 export function getAuthorityTypeDecoder(): FixedSizeDecoder<AuthorityType> {
-  return getEnumDecoder(AuthorityType);
+  return getEnumDecoder(AuthorityType) as FixedSizeDecoder<AuthorityType>;
 }
 
 export function getAuthorityTypeCodec(): FixedSizeCodec<
   AuthorityTypeArgs,
   AuthorityType
 > {
-  return combineCodec(getAuthorityTypeEncoder(), getAuthorityTypeDecoder());
+  return combineCodec(
+    getAuthorityTypeEncoder(),
+    getAuthorityTypeDecoder()
+  ) as FixedSizeCodec<AuthorityTypeArgs, AuthorityType>;
 }

+ 1 - 1
packages/renderers-js/public/templates/fragments/typeCodec.njk

@@ -2,5 +2,5 @@
 
 {{ macros.docblock(docs) }}
 export function {{ codecFunction }}(): {{ codecType }}<{{ looseName }}, {{ strictName }}> {
-  return combineCodec({{ encoderFunction }}(), {{ decoderFunction }}());
+  return combineCodec({{ encoderFunction }}(), {{ decoderFunction }}()){% if tightenReturnedType %} as {{ codecType }}<{{ looseName }}, {{ strictName }}>{% endif %};
 }

+ 1 - 1
packages/renderers-js/public/templates/fragments/typeDecoder.njk

@@ -2,5 +2,5 @@
 
 {{ macros.docblock(docs) }}
 export function {{ decoderFunction }}(): {{ decoderType }}<{{ strictName }}> {
-  return {{ manifest.decoder.render }};
+  return {{ manifest.decoder.render }}{% if tightenReturnedType %} as {{ decoderType }}<{{ strictName }}>{% endif %};
 }

+ 1 - 1
packages/renderers-js/public/templates/fragments/typeEncoder.njk

@@ -2,5 +2,5 @@
 
 {{ macros.docblock(docs) }}
 export function {{ encoderFunction }}(): {{ encoderType }}<{{ looseName }}> {
-  return {{ manifest.encoder.render }};
+  return {{ manifest.encoder.render }}{% if tightenReturnedType %} as {{ encoderType }}<{{ looseName }}>{% endif %};
 }

+ 1 - 0
packages/renderers-js/src/fragments/typeCodec.ts

@@ -29,6 +29,7 @@ export function getTypeCodecFragment(
                 looseName: nameApi.dataArgsType(name),
                 manifest,
                 strictName: nameApi.dataType(name),
+                tightenReturnedType: typeof scope.size === 'number'
             }).addImports('solanaCodecsCore', [`type ${codecType}`, 'combineCodec']),
         ],
         renders => renders.join('\n\n'),

+ 1 - 0
packages/renderers-js/src/fragments/typeDecoder.ts

@@ -19,6 +19,7 @@ export function getTypeDecoderFragment(
         looseName: nameApi.dataArgsType(name),
         manifest,
         strictName: nameApi.dataType(name),
+        tightenReturnedType: typeof scope.size === 'number'
     })
         .mergeImportsWith(manifest.decoder)
         .addImports('solanaCodecsCore', `type ${decoderType}`);

+ 1 - 0
packages/renderers-js/src/fragments/typeEncoder.ts

@@ -19,6 +19,7 @@ export function getTypeEncoderFragment(
         looseName: nameApi.dataArgsType(name),
         manifest,
         strictName: nameApi.dataType(name),
+        tightenReturnedType: typeof scope.size === 'number'
     })
         .mergeImportsWith(manifest.encoder)
         .addImports('solanaCodecsCore', `type ${encoderType}`);