syncNative static method

TransactionInstruction syncNative({
  1. required Pubkey account,
})

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 system_instruction::transfer to move lamports to a wrapped token account, and needs to have its token amount field updated.

Keys:

  • [w] account - The native token account to sync with its underlying lamports.

Implementation

static TransactionInstruction syncNative({required final Pubkey account}) {
  // 0. `[w]` The native token account to sync with its underlying lamports.
  final List<AccountMeta> keys = [AccountMeta.writable(account)];

  return _instance.createTransactionIntruction(
    TokenInstruction.syncNative,
    keys: keys,
  );
}