mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-04-15 02:31:57 +00:00
add explicit cast and type check
This commit is contained in:
parent
d2e77c9ff0
commit
913a4ac7c5
1 changed files with 16 additions and 6 deletions
|
@ -361,12 +361,22 @@ class XelisWallet extends LibXelisWallet {
|
|||
await libXelisWallet!.rescan(topoheight: BigInt.from(pruningHeight));
|
||||
}
|
||||
|
||||
final txList = objTransactions ??
|
||||
(await libXelisWallet!.allHistory())
|
||||
.map((jsonStr) => xelis_sdk.TransactionEntry.fromJson(
|
||||
json.decode(jsonStr),
|
||||
) as xelis_sdk.TransactionEntry)
|
||||
.toList();
|
||||
xelis_sdk.TransactionEntry _checkDecodeJsonStringTxEntry(
|
||||
String jsonString,
|
||||
) {
|
||||
final json = jsonDecode(jsonString);
|
||||
if (json is Map) {
|
||||
return xelis_sdk.TransactionEntry.fromJson(json.cast());
|
||||
}
|
||||
|
||||
throw Exception("Not a Map on jsonDecode($jsonString)");
|
||||
}
|
||||
|
||||
final txList =
|
||||
objTransactions ??
|
||||
(await libXelisWallet!.allHistory())
|
||||
.map(_checkDecodeJsonStringTxEntry)
|
||||
.toList();
|
||||
|
||||
final List<TransactionV2> txns = [];
|
||||
|
||||
|
|
Loading…
Reference in a new issue