mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 17:40:43 +00:00
call sync call in isolate to make it async
generate framework for iOS as well fix UR issues
This commit is contained in:
parent
f22ab329c4
commit
bea81d2c67
6 changed files with 52 additions and 8 deletions
|
@ -44,4 +44,9 @@ class PendingZanoTransaction with PendingTransaction {
|
||||||
await zanoWallet.transfer(destinations, fee, comment);
|
await zanoWallet.transfer(destinations, fee, comment);
|
||||||
zanoWallet.fetchTransactions();
|
zanoWallet.fetchTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<String?> commitUR() {
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:convert' as convert;
|
import 'dart:convert' as convert;
|
||||||
|
import 'dart:isolate';
|
||||||
|
|
||||||
import 'package:cw_core/transaction_priority.dart';
|
import 'package:cw_core/transaction_priority.dart';
|
||||||
import 'package:cw_zano/api/consts.dart';
|
import 'package:cw_zano/api/consts.dart';
|
||||||
|
@ -21,6 +22,7 @@ import 'package:cw_zano/zano_wallet_exceptions.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:json_bigint/json_bigint.dart';
|
import 'package:json_bigint/json_bigint.dart';
|
||||||
import 'package:monero/zano.dart' as zano;
|
import 'package:monero/zano.dart' as zano;
|
||||||
|
import 'package:monero/src/generated_bindings_zano.g.dart' as zanoapi;
|
||||||
|
|
||||||
mixin ZanoWalletApi {
|
mixin ZanoWalletApi {
|
||||||
static const _defaultNodeUri = '195.201.107.230:33336';
|
static const _defaultNodeUri = '195.201.107.230:33336';
|
||||||
|
@ -83,12 +85,31 @@ mixin ZanoWalletApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> invokeMethod(String methodName, Object params) async {
|
Future<String> invokeMethod(String methodName, Object params) async {
|
||||||
var invokeResult =
|
|
||||||
zano.PlainWallet_syncCall('invoke', hWallet, jsonEncode(
|
// var invokeResult = zano.PlainWallet_syncCall(
|
||||||
{
|
// 'invoke',
|
||||||
"method": "$methodName",
|
// hWallet,
|
||||||
"params": params,
|
// jsonEncode(
|
||||||
}));
|
// {
|
||||||
|
// "method": "$methodName",
|
||||||
|
// "params": params,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
final request = jsonEncode({
|
||||||
|
"method": methodName,
|
||||||
|
"params": params,
|
||||||
|
});
|
||||||
|
print("zano: >>> $request");
|
||||||
|
var invokeResult = await Isolate.run(() {
|
||||||
|
final ret = zano.PlainWallet_syncCall(
|
||||||
|
'invoke',
|
||||||
|
hWallet,
|
||||||
|
request,
|
||||||
|
);
|
||||||
|
return ret;
|
||||||
|
});
|
||||||
|
print("zano: <<< ${invokeResult}");
|
||||||
Map<String, dynamic> map;
|
Map<String, dynamic> map;
|
||||||
try {
|
try {
|
||||||
map = jsonDecode(invokeResult) as Map<String, dynamic>;
|
map = jsonDecode(invokeResult) as Map<String, dynamic>;
|
||||||
|
|
4
ios/.gitignore
vendored
4
ios/.gitignore
vendored
|
@ -31,4 +31,6 @@ Runner/GeneratedPluginRegistrant.*
|
||||||
!default.pbxuser
|
!default.pbxuser
|
||||||
!default.perspectivev3
|
!default.perspectivev3
|
||||||
|
|
||||||
Mwebd.xcframework
|
Mwebd.xcframework
|
||||||
|
ZanoWallet
|
||||||
|
zano_libwallet2_api_c.dylib
|
||||||
|
|
BIN
ios/ZanoWallet.framework/Info.plist
Normal file
BIN
ios/ZanoWallet.framework/Info.plist
Normal file
Binary file not shown.
|
@ -204,7 +204,7 @@ Future<void> initializeAppConfigs() async {
|
||||||
transactionDescriptions: transactionDescriptions,
|
transactionDescriptions: transactionDescriptions,
|
||||||
secureStorage: secureStorage,
|
secureStorage: secureStorage,
|
||||||
anonpayInvoiceInfo: anonpayInvoiceInfo,
|
anonpayInvoiceInfo: anonpayInvoiceInfo,
|
||||||
initialMigrationVersion: 43,
|
initialMigrationVersion: 44,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,3 +29,19 @@ cd $FRWK_DIR # go to iOS framework dir
|
||||||
lipo -create $DYLIB_LINK_PATH -output WowneroWallet
|
lipo -create $DYLIB_LINK_PATH -output WowneroWallet
|
||||||
|
|
||||||
echo "Generated ${FRWK_DIR}"
|
echo "Generated ${FRWK_DIR}"
|
||||||
|
|
||||||
|
# also generate for zano
|
||||||
|
IOS_DIR="$(pwd)/../../ios"
|
||||||
|
DYLIB_NAME="zano_libwallet2_api_c.dylib"
|
||||||
|
DYLIB_LINK_PATH="${IOS_DIR}/${DYLIB_NAME}"
|
||||||
|
FRWK_DIR="${IOS_DIR}/ZanoWallet.framework"
|
||||||
|
|
||||||
|
if [ ! -f $DYLIB_LINK_PATH ]; then
|
||||||
|
echo "Dylib is not found by the link: ${DYLIB_LINK_PATH}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $FRWK_DIR # go to iOS framework dir
|
||||||
|
lipo -create $DYLIB_LINK_PATH -output ZanoWallet
|
||||||
|
|
||||||
|
echo "Generated ${FRWK_DIR}"
|
||||||
|
|
Loading…
Reference in a new issue