mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
Merge pull request #520 from cypherstack/add-epic-send-to-address
fix: Add send to address for epic when sending
This commit is contained in:
commit
6efa5597bf
1 changed files with 12 additions and 9 deletions
|
@ -452,8 +452,6 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
|
|
||||||
EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig();
|
EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig();
|
||||||
|
|
||||||
print("EPICBOX CONFIG HERE IS $epicboxConfig");
|
|
||||||
|
|
||||||
// TODO determine whether it is worth sending change to a change address.
|
// TODO determine whether it is worth sending change to a change address.
|
||||||
dynamic message;
|
dynamic message;
|
||||||
|
|
||||||
|
@ -522,6 +520,11 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
throw BadEpicHttpAddressException(message: sendTx);
|
throw BadEpicHttpAddressException(message: sendTx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, String> txAddressInfo = {};
|
||||||
|
txAddressInfo['from'] = await currentReceivingAddress;
|
||||||
|
txAddressInfo['to'] = txData['addresss'] as String;
|
||||||
|
await putSendToAddresses(sendTx, txAddressInfo);
|
||||||
|
|
||||||
Logging.instance.log("CONFIRM_RESULT_IS $sendTx", level: LogLevel.Info);
|
Logging.instance.log("CONFIRM_RESULT_IS $sendTx", level: LogLevel.Info);
|
||||||
|
|
||||||
final decodeData = json.decode(sendTx);
|
final decodeData = json.decode(sendTx);
|
||||||
|
@ -1247,7 +1250,6 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
await _secureStore.write(key: '${_walletId}_config', value: stringConfig);
|
await _secureStore.write(key: '${_walletId}_config', value: stringConfig);
|
||||||
await _secureStore.write(key: '${_walletId}_password', value: password);
|
await _secureStore.write(key: '${_walletId}_password', value: password);
|
||||||
|
|
||||||
print("EPIC BOX MODEL IS ${epicboxConfig.toString()}");
|
|
||||||
await _secureStore.write(
|
await _secureStore.write(
|
||||||
key: '${_walletId}_epicboxConfig', value: epicboxConfig.toString());
|
key: '${_walletId}_epicboxConfig', value: epicboxConfig.toString());
|
||||||
|
|
||||||
|
@ -1390,7 +1392,8 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> putSendToAddresses(String slateMessage) async {
|
Future<bool> putSendToAddresses(
|
||||||
|
String slateMessage, Map<String, String> txAddressInfo) async {
|
||||||
try {
|
try {
|
||||||
var slatesToCommits = await getSlatesToCommits();
|
var slatesToCommits = await getSlatesToCommits();
|
||||||
final slate0 = jsonDecode(slateMessage);
|
final slate0 = jsonDecode(slateMessage);
|
||||||
|
@ -1400,19 +1403,19 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
final slateId = part1[0]['tx_slate_id'];
|
final slateId = part1[0]['tx_slate_id'];
|
||||||
final commitId = part2['tx']['body']['outputs'][0]['commit'];
|
final commitId = part2['tx']['body']['outputs'][0]['commit'];
|
||||||
|
|
||||||
final toFromInfoString = jsonDecode(slateMessage);
|
final from = txAddressInfo['from'];
|
||||||
final toFromInfo = jsonDecode(toFromInfoString[1] as String);
|
final to = txAddressInfo['to'];
|
||||||
final from = toFromInfo['from'];
|
|
||||||
final to = toFromInfo['to'];
|
|
||||||
slatesToCommits[slateId] = {
|
slatesToCommits[slateId] = {
|
||||||
"commitId": commitId,
|
"commitId": commitId,
|
||||||
"from": from,
|
"from": from,
|
||||||
"to": to,
|
"to": to,
|
||||||
};
|
};
|
||||||
|
|
||||||
await epicUpdateSlatesToCommits(slatesToCommits);
|
await epicUpdateSlatesToCommits(slatesToCommits);
|
||||||
return true;
|
return true;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logging.instance.log("$e $s", level: LogLevel.Error);
|
Logging.instance
|
||||||
|
.log("ERROR STORING ADDRESS $e $s", level: LogLevel.Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue