-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFetch-Token-Program
More file actions
36 lines (34 loc) · 880 Bytes
/
Fetch-Token-Program
File metadata and controls
36 lines (34 loc) · 880 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
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(address);
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
)
);
{
"data": {
"type": "Buffer",
"data": [127, "...truncated, total bytes: 134080...", 0]
},
"executable": true,
"lamports": 4522329612,
"owner": "8w38AAv7ca9oGbNmK9GXP8ow98z2kukfGNVk8Hu6TfFu",
"rentEpoch": 18446744073709552000,
"space": 134080
}