Skip to content

Commit

Permalink
feat: include all account object properties in GraphQL response for g…
Browse files Browse the repository at this point in the history
…etAccount API query
  • Loading branch information
DeMonkeyCoder committed Dec 18, 2024
1 parent 05cdbc4 commit bc7863d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/klesia/src/methods/mina.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ it("should return network id", async () => {
it("should get account info", async () => {
const result = await mina.getAccount({ publicKey: TEST_PKEY });
expect(BigInt(result.nonce)).toBeGreaterThanOrEqual(0);
expect(BigInt(result.balance)).toBeGreaterThanOrEqual(0);
expect(BigInt(result.balance.total)).toBeGreaterThanOrEqual(0);
});
49 changes: 41 additions & 8 deletions apps/klesia/src/methods/mina.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,57 @@ const getAccount = async ({ publicKey }: { publicKey: string }) => {
gql`
query {
account(publicKey: $publicKey) {
publicKey
token
nonce
balance {
total
}
tokenSymbol
receiptChainHash
timing {
initialMinimumBalance
cliffTime
cliffAmount
vestingPeriod
vestingIncrement
}
permissions {
editState
access
send
receive
setDelegate
setPermissions
setVerificationKey {
auth
txnVersion
}
setZkappUri
editActionState
setTokenSymbol
incrementNonce
setVotingFor
setTiming
}
delegateAccount { publicKey }
votingFor
zkappState
verificationKey {
verificationKey
hash
}
actionState
provedState
zkappUri
}
}
`,
{ publicKey },
);
return {
nonce: data.account.nonce,
balance: data.account.balance.total,
};
return data.account;
} catch {
return {
nonce: "0",
balance: "0",
};
return null;
}
};

Expand Down

0 comments on commit bc7863d

Please sign in to comment.