MCPcopy Create free account
hub / github.com/MystenLabs/capybot / getBalancesForCoinTypes

Function getBalancesForCoinTypes

src/utils/utils.ts:184–201  ·  view source on GitHub ↗
(
  provider: JsonRpcProvider,
  owner: SuiAddress,
  coinTypes: Set<string>
)

Source from the content-addressed store, hash-verified

182}
183
184export async function getBalancesForCoinTypes(
185 provider: JsonRpcProvider,
186 owner: SuiAddress,
187 coinTypes: Set<string>
188): Promise<Map<string, BigInt>> {
189 let coinsBalances = new Map<string, BigInt>();
190
191 for (let coinType of coinTypes.values()) {
192 let coinBalance = await provider.getBalance({
193 owner,
194 coinType,
195 });
196 console.log(coinType, " - ", BigInt(coinBalance.totalBalance));
197 coinsBalances.set(coinType, BigInt(coinBalance.totalBalance));
198 }
199
200 return coinsBalances;
201}
202
203export async function buildInputCoinForAmount(
204 txb: TransactionBlock,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected