kin-labs / kinetic

MIT License
40 stars 24 forks source link

feat: implement getAccountInfo method #502

Closed beeman closed 1 year ago

beeman commented 1 year ago

This PR adds new method to get account info. It takes in an account: PublicKeyString and returns a summary of the account:

const res = await sdk.getAccountInfo({ account: aliceKeypair.publicKey })
{
   "account":"ALisrzsaVqciCxy8r6g7MUrPoRo3CpGxPhwBbZzqZ9bA",
   "isMint":false,
   "isOwner":true,
   "isTokenAccount":false,
   "owner":null,
   "program":null,
   "tokens":[
      {
         "account":"Ebq6K7xVh6PYQ8DrTQnD9fC91uQiyBMPGSV6JCG6GPdD",
         "balance":"87564.19775",
         "closeAuthority":null,
         "decimals": 0,
         "mint":"MoGaMuJnB3k8zXjBYBnHxHG47vWcW3nyb7bFYvdVzek",
         "owner":"ALisrzsaVqciCxy8r6g7MUrPoRo3CpGxPhwBbZzqZ9bA"
      }
   ]
}

It detects if an account is a mint, a token account or an owner account.

Follow-up:

Implement in the other SDKs:

nx-cloud[bot] commented 1 year ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 41ec6b73dc21418e69709fb559b5ad44f78ab3ab. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 3 targets - [`nx e2e api-e2e --skip-nx-cache`](https://cloud.nx.app/runs/loIL04GFeh) - [`nx e2e sdk-e2e --skip-nx-cache`](https://cloud.nx.app/runs/Oc40J8RFcC) - [`nx e2e web-e2e --skip-nx-cache`](https://cloud.nx.app/runs/a0joZhHBXG)

Sent with 💌 from NxCloud.