decodePlpRequests function
All SupplyRequested/WithdrawRequested receipts in result.
Implementation
List<PlpRequestReceipt> decodePlpRequests(
PredictConfig cfg, DecodableTransactionResult result) {
final pkg = cfg.packages.predictV1;
PlpRequestReceipt make(String kind, Map e) {
final amount = _big(e['amount'] as Object);
return PlpRequestReceipt(
kind: kind,
vaultId: normalizeSuiAddress(e['pool_vault_id'] as String),
accountId: normalizeSuiAddress(e['account_id'] as String),
recipient: normalizeSuiAddress(e['recipient'] as String),
index: _big(e['index'] as Object),
amount: fromRaw(amount, 6),
rawAmount: amount,
);
}
return [
..._decodeAll(result, pkg, 'vault_events', 'SupplyRequested',
vault_events.SupplyRequested, (e) => make('supply', e)),
..._decodeAll(result, pkg, 'vault_events', 'WithdrawRequested',
vault_events.WithdrawRequested, (e) => make('withdraw', e)),
];
}