You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
931 B
29 lines
931 B
import { SuiClient } from '@mysten/sui.js/client';
|
|
|
|
async function getBalances(addresses) {
|
|
const client = new SuiClient({ url: 'https://fullnode.mainnet.sui.io:443' });
|
|
|
|
let n = 1;
|
|
|
|
for (const address of addresses) {
|
|
const balance = await client.getCoins({ owner: address });
|
|
|
|
if (balance.data.length > 0) {
|
|
const suiBalance = balance.data[0].balance;
|
|
const balanceInSUI = suiBalance / 1e9; // 将 MIST 转换为 SUI
|
|
console.log(`Address${n}: ${address}, Balance in SUI: ${balanceInSUI}`);
|
|
} else {
|
|
console.log(`Address${n}: ${address}, No SUI balance found.`);
|
|
}
|
|
n++;
|
|
}
|
|
}
|
|
|
|
// 替换为你的SUI钱包地址数组
|
|
const addresses = [
|
|
'0x32ec84aca7c2e7be65ea1a72dad58ae7d8a1ac3b5d64a84118e4aafca44b6d1a',
|
|
'0x1b9f4bd38af84e4a05d97a3609512d6aa3da2ad1792a24c30b9acddec3993fd5',
|
|
'0xd3f63fadfffd4f0230712b6e66af903cba6937a8e751d6b1306158eaa91fdd18'
|
|
];
|
|
|
|
getBalances(addresses); |