mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
Send all
This commit is contained in:
parent
5b23b2efd4
commit
e3fb83a61f
1 changed files with 7 additions and 10 deletions
|
@ -195,14 +195,20 @@ class TezosWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
final String destinationAddress = txData["address"] as String;
|
final String destinationAddress = txData["address"] as String;
|
||||||
final secretKey = Keystore.fromMnemonic((await mnemonicString)!)
|
final secretKey = Keystore.fromMnemonic((await mnemonicString)!)
|
||||||
.secretKey;
|
.secretKey;
|
||||||
|
|
||||||
Logging.instance.log(secretKey, level: LogLevel.Info);
|
Logging.instance.log(secretKey, level: LogLevel.Info);
|
||||||
final sourceKeyStore = Keystore.fromSecretKey(secretKey);
|
final sourceKeyStore = Keystore.fromSecretKey(secretKey);
|
||||||
final client = TezartClient(getCurrentNode().host);
|
final client = TezartClient(getCurrentNode().host);
|
||||||
|
|
||||||
|
int? sendAmount = microtezToInt;
|
||||||
|
if (balance.spendable == txData["recipientAmt"] as Amount) {
|
||||||
|
sendAmount = microtezToInt - feeInMicroTez;
|
||||||
|
}
|
||||||
|
|
||||||
final operation = await client.transferOperation(
|
final operation = await client.transferOperation(
|
||||||
source: sourceKeyStore,
|
source: sourceKeyStore,
|
||||||
destination: destinationAddress,
|
destination: destinationAddress,
|
||||||
amount: microtezToInt,
|
amount: sendAmount,
|
||||||
customFee: feeInMicroTez,
|
customFee: feeInMicroTez,
|
||||||
customGasLimit: feeInMicroTez
|
customGasLimit: feeInMicroTez
|
||||||
);
|
);
|
||||||
|
@ -430,7 +436,6 @@ class TezosWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateTransactions() async {
|
Future<void> updateTransactions() async {
|
||||||
// TODO: Use node RPC instead of tzstats API
|
|
||||||
String transactionsCall = "https://api.mainnet.tzkt.io/v1/accounts/${await currentReceivingAddress}/operations";
|
String transactionsCall = "https://api.mainnet.tzkt.io/v1/accounts/${await currentReceivingAddress}/operations";
|
||||||
var response = jsonDecode(await get(Uri.parse(transactionsCall)).then((value) => value.body));
|
var response = jsonDecode(await get(Uri.parse(transactionsCall)).then((value) => value.body));
|
||||||
List<Tuple2<Transaction, Address>> txs = [];
|
List<Tuple2<Transaction, Address>> txs = [];
|
||||||
|
@ -443,14 +448,6 @@ class TezosWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
txType = TransactionType.incoming;
|
txType = TransactionType.incoming;
|
||||||
}
|
}
|
||||||
|
|
||||||
final amount = tx["amount"] as int;
|
|
||||||
final fee = tx["bakerFee"] as int;
|
|
||||||
final amountInMicroTez =
|
|
||||||
amount / 1000000;
|
|
||||||
|
|
||||||
final feeInMicroTez =
|
|
||||||
fee / 1000000;
|
|
||||||
|
|
||||||
var theTx = Transaction(
|
var theTx = Transaction(
|
||||||
walletId: walletId,
|
walletId: walletId,
|
||||||
txid: tx["hash"].toString(),
|
txid: tx["hash"].toString(),
|
||||||
|
|
Loading…
Reference in a new issue