The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Domain from "@alchemy.run/domain"; |
| 2 | import { Cents } from "../Money.ts"; |
| 3 | import { TransferId } from "../Transfer/Transfer.id.ts"; |
| 4 | import { AccountId } from "./Account.id.ts"; |
| 5 | import { NotOpen } from "./NotOpen.rejection.ts"; |
| 6 | |
| 7 | export class TransferCredited extends Domain.Event("TransferCredited", { |
| 8 | transferId: TransferId, |
| 9 | amount: Cents, |
| 10 | balanceAfter: Cents, |
| 11 | }) {} |
| 12 | |
| 13 | /** Pay a transfer's amount into the destination account. */ |
| 14 | export class CreditTransfer extends Domain.Command("CreditTransfer", { |
| 15 | target: AccountId, |
| 16 | input: { transferId: TransferId, amount: Cents }, |
| 17 | events: [TransferCredited], |
| 18 | rejects: [NotOpen], |
| 19 | }) {} |