-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdevInspectMoveCall.js
More file actions
28 lines (22 loc) · 891 Bytes
/
Copy pathdevInspectMoveCall.js
File metadata and controls
28 lines (22 loc) · 891 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
const { JsonRpcProvider } = require("@mysten/sui.js");
(async ()=> {
const DEVNET_URL = "https://fullnode.devnet.sui.io:443";
const address = "0xf15b467c66c983310d3966e84bdf0c399963842c";
const provider = new JsonRpcProvider(DEVNET_URL);
const coins = await provider.getGasObjectsOwnedByAddress(address);
console.log("coins[0]: ", coins[0].objectId);
console.log("coins[1]: ", coins[1].objectId);
const result = await provider.devInspectMoveCall(
address,
{
packageObjectId: '0x2',
module: 'coin',
function: 'value',
typeArguments: ["0x2::sui::SUI"],
arguments: [coins[1].objectId],
}
);
let buffer = Buffer.from(result.results.Ok[0][1].returnValues[0][0]);
let balance = buffer.readBigUInt64LE(0);
console.log("coins[1] balance: ",balance.toString());
})()