Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include all account object properties in GraphQL response #9

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/klesia/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ describe("Mina Devnet RPC", () => {
// biome-ignore lint/suspicious/noExplicitAny: TODO
const { result } = (await response.json()) as any;
expect(BigInt(result.nonce)).toBeGreaterThanOrEqual(0);
expect(BigInt(result.balance)).toBeGreaterThanOrEqual(0);
expect(BigInt(result.balance.total)).toBeGreaterThanOrEqual(0);
});
});
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);
});
48 changes: 43 additions & 5 deletions apps/klesia/src/methods/mina.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,23 +150,61 @@ 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",
balance: {
total: "0",
},
};
}
};
Expand Down
Loading