parseResponse static method
Implementation
static WalletInfo parseResponse(Map<String, dynamic> payload) {
if (!payload.containsKey('items')) {
throw TonConnectError('items not contains in payload');
}
final wallet = WalletInfo();
for (final item in payload['items']) {
if (item.containsKey('name')) {
if (item['name'] == 'ton_addr') {
wallet.account = Account.fromMap(item);
} else if (item['name'] == 'ton_proof') {
wallet.tonProof = TonProof.fromMap(item);
}
}
}
if (wallet.account == null) {
throw TonConnectError('ton_addr not contains in items');
}
wallet.device = DeviceInfo.fromMap(payload['device']);
return wallet;
}