-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFetch-mint-account
More file actions
39 lines (35 loc) · 933 Bytes
/
Fetch-mint-account
File metadata and controls
39 lines (35 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Connection, PublicKey } from "@solana/web3.js";
const connection = new Connection(
"https://api.mainnet-beta.solana.com",
"confirmed"
);
const address = new PublicKey("8w38AAv7ca9oGbNmK9GXP8ow98z2kukfGNVk8Hu6TfFu");
const accountInfo = await connection.getAccountInfo(8w38AAv7ca9oGbNmK9GXP8ow98z2kukfGNVk8Hu6TfFu);
console.log(
JSON.stringify(
accountInfo,
(key, value) => {
if (key === "data" && value && value.length > 1) {
return [
value[0],
"...truncated, total bytes: " + value.length + "...",
value[value.length - 1]
];
}
return value;
},
2
)
);
#example output:
{
"data": {
"type": "Buffer",
"data": [1, "...truncated, total bytes: 82...", 103]
},
"executable": false,
"lamports": 407438077149,
"owner": " 8w38AAv7ca9oGbNmK9GXP8ow98z2kukfGNVk8Hu6TfFu",
"rentEpoch": 18446744073709552000,
"space": 82
}