TokenInstruction.syncNative constructor

TokenInstruction.syncNative({
  1. required Ed25519HDPublicKey nativeTokenAccount,
})

Given a wrapped / native token account (a token account containing SOL) updates its amount field based on the account's underlying lamports. This is useful if a non-wrapped SOL account uses SystemInstruction.transfer to move lamports to a wrapped token account, and needs to have its token amount field updated.

Implementation

factory TokenInstruction.syncNative({
  required Ed25519HDPublicKey nativeTokenAccount,
}) =>
    TokenInstruction._(
      accounts: [
        AccountMeta.writeable(pubKey: nativeTokenAccount, isSigner: false),
      ],
      data: TokenProgram.syncNativeInstructionIndex,
    );