zetamarkets/sdk

Asset for APT accounts being Populated as `undefined` instead of `APT`

thekeviv opened this issue · 4 comments

When depositing funds into an APT account, after looking at the asset field corresponding to the margin account, it shows up as undefined and not APT. Is this a bug or is this expected? If not a bug, can you explain the significance of undefined please.

Which SDK version are you using?

I'm using 0.23.0

I'm unable to reproduce this, can you paste your code here? And margin account pubkey if possible

My code:

  let accs = await Exchange.program.account.marginAccount.all();
  for (var acc of accs) {
    let accDecoded = acc.account as unknown as programTypes.MarginAccount;
    console.log(accDecoded.asset, assets.fromProgramAsset(accDecoded.asset));
  }

shows me { apt: {} } APT for some margin accounts and no undefineds. I'm also on SDK 0.23.0.

Thank you! My SDK was up to date and it was the IDL which wasn't. Updating to the newest IDL from your repo fixed the issue. Thank you for all your help:pray: