Add saved payout destination UX and service contracts (#54)

This commit is contained in:
Stephan D committed 2026-10-16 12:01:33 +02:00
1 parent a5689876ff
commit 24af794112
49 files changed
+4687 -62

No files matched your search

@@ -235,11 +235,52 @@ void main() {
addTearDown(draft.dispose);
await wallet.refresh();
expect(draft.source, 'ledger');
expect(draft.recipient, 'method');
expect(draft.recipient, isEmpty);
expect(draft.hasDraft, false);
draft.change(recipient: 'method');
expect(draft.hasDraft, true);
draft.change(amount: '20.01');
await draft.review();
await draft.submit(approval: const FactorGrant('approved-intent-key'));
expect(draft.result, isNotNull);
});
test('new typed destinations cannot be silently dropped into the legacy live API', () async {
var calls = 0;
final service = BackendWalletService(
baseUri: Uri.parse('https://example.test'),
accessToken: () => 'test-token',
client: MockClient((request) async {
calls++;
return http.Response('{}', 500);
}),
);
addTearDown(service.close);
await expectLater(
service.quote(
const TransferRequest(
kind: TransferKind.payout,
source: 'ledger',
amount: 100,
payoutDestination: OneTimeDestination(
CryptoDestination(
assetId: 'asset',
networkId: 'network',
address: 'address',
assetLabel: 'Asset',
networkLabel: 'Network',
),
),
),
),
throwsA(
isA<WalletException>().having(
(e) => e.code,
'code',
WalletError.unsupported,
),
),
);
expect(calls, 0);
});
}