-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_list_price.js
29 lines (25 loc) · 1.05 KB
/
check_list_price.js
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
import { getFullnodeUrl, SuiClient } from "@mysten/sui/client";
const client = new SuiClient({
url: getFullnodeUrl("testnet"),
});
async function readTable(tableId) {
try {
const dynamicFieldPage = await client.getDynamicFields({parentId: tableId});
const resultData = dynamicFieldPage.data;
for (const tableRowResult of resultData) {
const priceTableId = tableRowResult.objectId;
const priceTable = await client.getObject({
id: priceTableId,
options: {showContent: true}
});
const priceFields = priceTable.data.content.fields;
console.log("order nft address =", priceTable.data.objectId);
console.log("price = ", priceFields);
console.log("--------------------------------------------------");
}
} catch (error) {
console.error("An error occurred:", error);
}
}
// it is the id of table(found in field) not object!
readTable('0x6b9a2766d65b6fd24b2372b79c1eb340d046112bdde76057da365a7686b20787');