import 'dart:ffi'; import 'package:cw_zano/api/signatures.dart'; import 'package:cw_zano/api/types.dart'; import 'package:cw_zano/api/zano_api.dart'; import 'package:cw_zano/api/structs/zano_balance_row.dart'; import 'package:cw_zano/api/structs/zano_rate.dart'; import 'asset_types.dart'; List getZanoFullBalance({int accountIndex = 0}) { final size = assetTypesSizeNative(); final balanceAddressesPointer = getZanoFullBalanceNative(accountIndex); final balanceAddresses = balanceAddressesPointer.asTypedList(size); return balanceAddresses .map((addr) => Pointer.fromAddress(addr).ref) .toList(); } List getZanoUnlockedBalance({int accountIndex = 0}) { final size = assetTypesSizeNative(); final balanceAddressesPointer = getZanoUnlockedBalanceNative(accountIndex); final balanceAddresses = balanceAddressesPointer.asTypedList(size); return balanceAddresses .map((addr) => Pointer.fromAddress(addr).ref) .toList(); } List getRate() { updateRateNative(); final size = sizeOfRateNative(); final ratePointer = getRateNative(); final rate = ratePointer.asTypedList(size); return rate.map((addr) => Pointer.fromAddress(addr).ref).toList(); } final getZanoFullBalanceNative = zanoApi .lookup>('get_full_balance') .asFunction(); final getZanoUnlockedBalanceNative = zanoApi .lookup>('get_unlocked_balance') .asFunction(); final getRateNative = zanoApi.lookup>('get_rate').asFunction(); final sizeOfRateNative = zanoApi .lookup>('size_of_rate') .asFunction(); final updateRateNative = zanoApi .lookup>('update_rate') .asFunction();