removed the duplicate

This commit is contained in:
leo1234 2024-03-09 19:04:12 +08:00
parent 9228d91daa
commit 75f1f3f7cc
2 changed files with 3 additions and 15 deletions

View file

@ -23,7 +23,7 @@ typedef _IsWalletExist = int Function(Pointer<Utf8>);
// void close_wallet(uint64_t hwallet)
typedef _close_wallet = Void Function(Int64);
typedef _closeWalletStatus = void Function(int hWallet);
typedef _closeWallet = void Function(int hWallet);
// uint64_t get_current_tx_fee(uint64_t priority)
typedef _get_current_tx_fee = Int64 Function(Int64);
@ -157,7 +157,7 @@ class ApiCalls {
return isExist;
}
static final _closeWalletNative = zanoApi.lookup<NativeFunction<_close_wallet>>('close_wallet').asFunction<_closeWalletStatus>();
static final _closeWalletNative = zanoApi.lookup<NativeFunction<_close_wallet>>('close_wallet').asFunction<_closeWallet>();
static void closeWallet({required int hWallet}) => _closeWalletNative(hWallet);

View file

@ -465,25 +465,13 @@ abstract class ZanoWalletBase extends WalletBase<ZanoBalance, ZanoTransactionHis
}
}
final _loadWalletNative = zanoApi.lookup<NativeFunction<_load_wallet>>('load_wallet').asFunction<_LoadWallet>();
String loadWallet(String path, String password) {
print('load_wallet path $path password $password');
final pathPointer = path.toNativeUtf8();
final passwordPointer = password.toNativeUtf8();
final result = _convertUTF8ToString(
pointer: _loadWalletNative(pathPointer, passwordPointer, 0),
);
final result = ApiCalls.loadWallet(path: path, password: password);
print('load_wallet result $result');
return result;
}
String _convertUTF8ToString({required Pointer<Utf8> pointer}) {
final str = pointer.toDartString();
calloc.free(pointer);
return str;
}
Future<String> invokeMethod(String methodName, Object params) async {
var invokeResult = ApiCalls.asyncCall(methodName: 'invoke', hWallet: hWallet, params: '{"method": "$methodName","params": ${jsonEncode(params)}}');
var map = jsonDecode(invokeResult) as Map<String, dynamic>;