zetamarkets / sdk

SDK for accessing the Zeta program
Other
85 stars 29 forks source link

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

Closed thekeviv closed 1 year ago

thekeviv commented 1 year ago

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.

filipzeta commented 1 year ago

Which SDK version are you using?

thekeviv commented 1 year ago

I'm using 0.23.0

filipzeta commented 1 year ago

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.

thekeviv commented 1 year ago

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: