mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-21 22:58:45 +00:00
restored old wallet.dart
This commit is contained in:
parent
e1da71a1d1
commit
7fcdc8c0cb
1 changed files with 22 additions and 45 deletions
|
@ -124,23 +124,18 @@ final trustedDaemonNative = havenApi
|
||||||
.lookup<NativeFunction<trusted_daemon>>('trusted_daemon')
|
.lookup<NativeFunction<trusted_daemon>>('trusted_daemon')
|
||||||
.asFunction<TrustedDaemon>();
|
.asFunction<TrustedDaemon>();
|
||||||
|
|
||||||
int getSyncingHeight() {
|
int getSyncingHeight() => getSyncingHeightNative();
|
||||||
return getSyncingHeightNative();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isNeededToRefresh() => isNeededToRefreshNative() != 0;
|
bool isNeededToRefresh() => isNeededToRefreshNative() != 0;
|
||||||
|
|
||||||
bool isNewTransactionExist() {
|
bool isNewTransactionExist() => isNewTransactionExistNative() != 0;
|
||||||
return isNewTransactionExistNative() != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getFilename() => convertUTF8ToString(pointer: getFileNameNative());
|
String getFilename() => convertUTF8ToString(pointer: getFileNameNative());
|
||||||
|
|
||||||
String getSeed() => convertUTF8ToString(pointer: getSeedNative());
|
String getSeed() => convertUTF8ToString(pointer: getSeedNative());
|
||||||
|
|
||||||
String getAddress({int accountIndex = 0, int addressIndex = 0}) {
|
String getAddress({int accountIndex = 0, int addressIndex = 0}) =>
|
||||||
return convertUTF8ToString(pointer: getAddressNative(accountIndex, addressIndex));
|
convertUTF8ToString(pointer: getAddressNative(accountIndex, addressIndex));
|
||||||
}
|
|
||||||
|
|
||||||
int getFullBalance({int accountIndex = 0}) =>
|
int getFullBalance({int accountIndex = 0}) =>
|
||||||
getFullBalanceNative(accountIndex);
|
getFullBalanceNative(accountIndex);
|
||||||
|
@ -148,17 +143,11 @@ int getFullBalance({int accountIndex = 0}) =>
|
||||||
int getUnlockedBalance({int accountIndex = 0}) =>
|
int getUnlockedBalance({int accountIndex = 0}) =>
|
||||||
getUnlockedBalanceNative(accountIndex);
|
getUnlockedBalanceNative(accountIndex);
|
||||||
|
|
||||||
int getCurrentHeight() {
|
int getCurrentHeight() => getCurrentHeightNative();
|
||||||
return getCurrentHeightNative();
|
|
||||||
}
|
|
||||||
|
|
||||||
int getNodeHeightSync() {
|
int getNodeHeightSync() => getNodeHeightNative();
|
||||||
return getNodeHeightNative();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isConnectedSync() {
|
bool isConnectedSync() => isConnectedNative() != 0;
|
||||||
return isConnectedNative() != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setupNodeSync(
|
bool setupNodeSync(
|
||||||
{required String address,
|
{required String address,
|
||||||
|
@ -217,13 +206,11 @@ void startRefreshSync() => startRefreshNative();
|
||||||
|
|
||||||
Future<bool> connectToNode() async => connecToNodeNative() != 0;
|
Future<bool> connectToNode() async => connecToNodeNative() != 0;
|
||||||
|
|
||||||
void setRefreshFromBlockHeight({required int height}) {
|
void setRefreshFromBlockHeight({required int height}) =>
|
||||||
setRefreshFromBlockHeightNative(height);
|
setRefreshFromBlockHeightNative(height);
|
||||||
}
|
|
||||||
|
|
||||||
void setRecoveringFromSeed({required bool isRecovery}) {
|
void setRecoveringFromSeed({required bool isRecovery}) =>
|
||||||
setRecoveringFromSeedNative(_boolToInt(isRecovery));
|
setRecoveringFromSeedNative(_boolToInt(isRecovery));
|
||||||
}
|
|
||||||
|
|
||||||
void storeSync() {
|
void storeSync() {
|
||||||
final pathPointer = ''.toNativeUtf8();
|
final pathPointer = ''.toNativeUtf8();
|
||||||
|
@ -248,21 +235,17 @@ void setPasswordSync(String password) {
|
||||||
|
|
||||||
void closeCurrentWallet() => closeCurrentWalletNative();
|
void closeCurrentWallet() => closeCurrentWalletNative();
|
||||||
|
|
||||||
String getSecretViewKey() {
|
String getSecretViewKey() =>
|
||||||
return convertUTF8ToString(pointer: getSecretViewKeyNative());
|
convertUTF8ToString(pointer: getSecretViewKeyNative());
|
||||||
}
|
|
||||||
|
|
||||||
String getPublicViewKey() {
|
String getPublicViewKey() =>
|
||||||
return convertUTF8ToString(pointer: getPublicViewKeyNative());
|
convertUTF8ToString(pointer: getPublicViewKeyNative());
|
||||||
}
|
|
||||||
|
|
||||||
String getSecretSpendKey() {
|
String getSecretSpendKey() =>
|
||||||
return convertUTF8ToString(pointer: getSecretSpendKeyNative());
|
convertUTF8ToString(pointer: getSecretSpendKeyNative());
|
||||||
}
|
|
||||||
|
|
||||||
String getPublicSpendKey() {
|
String getPublicSpendKey() =>
|
||||||
return convertUTF8ToString(pointer: getPublicSpendKeyNative());
|
convertUTF8ToString(pointer: getPublicSpendKeyNative());
|
||||||
}
|
|
||||||
|
|
||||||
class SyncListener {
|
class SyncListener {
|
||||||
SyncListener(this.onNewBlock, this.onNewTransaction)
|
SyncListener(this.onNewBlock, this.onNewTransaction)
|
||||||
|
@ -337,9 +320,7 @@ SyncListener setListeners(void Function(int, int, double) onNewBlock,
|
||||||
return listener;
|
return listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStartup() {
|
void onStartup() => onStartupNative();
|
||||||
onStartupNative();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _storeSync(Object _) => storeSync();
|
void _storeSync(Object _) => storeSync();
|
||||||
|
|
||||||
|
@ -364,9 +345,7 @@ bool _isConnected(Object _) => isConnectedSync();
|
||||||
|
|
||||||
int _getNodeHeight(Object _) => getNodeHeightSync();
|
int _getNodeHeight(Object _) => getNodeHeightSync();
|
||||||
|
|
||||||
void startRefresh() {
|
void startRefresh() => startRefreshSync();
|
||||||
startRefreshSync();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> setupNode(
|
Future<void> setupNode(
|
||||||
{required String address,
|
{required String address,
|
||||||
|
@ -390,9 +369,7 @@ Future<bool> isConnected() => compute(_isConnected, 0);
|
||||||
|
|
||||||
Future<int> getNodeHeight() => compute(_getNodeHeight, 0);
|
Future<int> getNodeHeight() => compute(_getNodeHeight, 0);
|
||||||
|
|
||||||
void rescanBlockchainAsync() {
|
void rescanBlockchainAsync() => rescanBlockchainAsyncNative();
|
||||||
rescanBlockchainAsyncNative();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future setTrustedDaemon(bool trusted) async => setTrustedDaemonNative(_boolToInt(trusted));
|
Future setTrustedDaemon(bool trusted) async => setTrustedDaemonNative(_boolToInt(trusted));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue