Merge branch 'main' into dev

This commit is contained in:
microwavedcola1 2022-08-04 09:25:24 +02:00
commit e81da8f570
3 changed files with 13 additions and 2 deletions

View File

@ -34,6 +34,11 @@ pub fn account_create(
) -> Result<()> {
let mut account = ctx.accounts.account.load_init()?;
msg!(
"Initialized account with header version {}",
account.header_version()
);
account.fixed.name = fill32_from_str(name)?;
account.fixed.group = ctx.accounts.group.key();
account.fixed.owner = ctx.accounts.owner.key();

View File

@ -422,9 +422,15 @@ impl<
fn header(&self) -> &MangoAccountDynamicHeader {
self.header.deref_or_borrow()
}
pub fn header_version(&self) -> &u8 {
get_helper(self.dynamic(), 0)
}
fn fixed(&self) -> &MangoAccountFixed {
self.fixed.deref_or_borrow()
}
fn dynamic(&self) -> &[u8] {
self.dynamic.deref_or_borrow()
}

View File

@ -43,7 +43,7 @@ async function main() {
// account
const mangoAccount = (
await client.getMangoAccountForOwner(group, user.publicKey)
await client.getMangoAccountsForOwner(group, user.publicKey)
)[0];
console.log(`...found mangoAccount ${mangoAccount.publicKey}`);
console.log(mangoAccount.toString(group));
@ -101,7 +101,7 @@ async function main() {
group.findBank(token.tokenIndex)!.name,
token.native(group.findBank(token.tokenIndex)!).toNumber(),
false,
user
user,
);
}
} catch (error) {