Merge branch 'main' into dev
This commit is contained in:
commit
e81da8f570
|
@ -34,6 +34,11 @@ pub fn account_create(
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut account = ctx.accounts.account.load_init()?;
|
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.name = fill32_from_str(name)?;
|
||||||
account.fixed.group = ctx.accounts.group.key();
|
account.fixed.group = ctx.accounts.group.key();
|
||||||
account.fixed.owner = ctx.accounts.owner.key();
|
account.fixed.owner = ctx.accounts.owner.key();
|
||||||
|
|
|
@ -422,9 +422,15 @@ impl<
|
||||||
fn header(&self) -> &MangoAccountDynamicHeader {
|
fn header(&self) -> &MangoAccountDynamicHeader {
|
||||||
self.header.deref_or_borrow()
|
self.header.deref_or_borrow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn header_version(&self) -> &u8 {
|
||||||
|
get_helper(self.dynamic(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
fn fixed(&self) -> &MangoAccountFixed {
|
fn fixed(&self) -> &MangoAccountFixed {
|
||||||
self.fixed.deref_or_borrow()
|
self.fixed.deref_or_borrow()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dynamic(&self) -> &[u8] {
|
fn dynamic(&self) -> &[u8] {
|
||||||
self.dynamic.deref_or_borrow()
|
self.dynamic.deref_or_borrow()
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ async function main() {
|
||||||
|
|
||||||
// account
|
// account
|
||||||
const mangoAccount = (
|
const mangoAccount = (
|
||||||
await client.getMangoAccountForOwner(group, user.publicKey)
|
await client.getMangoAccountsForOwner(group, user.publicKey)
|
||||||
)[0];
|
)[0];
|
||||||
console.log(`...found mangoAccount ${mangoAccount.publicKey}`);
|
console.log(`...found mangoAccount ${mangoAccount.publicKey}`);
|
||||||
console.log(mangoAccount.toString(group));
|
console.log(mangoAccount.toString(group));
|
||||||
|
@ -101,7 +101,7 @@ async function main() {
|
||||||
group.findBank(token.tokenIndex)!.name,
|
group.findBank(token.tokenIndex)!.name,
|
||||||
token.native(group.findBank(token.tokenIndex)!).toNumber(),
|
token.native(group.findBank(token.tokenIndex)!).toNumber(),
|
||||||
false,
|
false,
|
||||||
user
|
user,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue