Skip to content

Commit

Permalink
add check_cash tx
Browse files Browse the repository at this point in the history
  • Loading branch information
pdp2121 committed Jan 29, 2025
1 parent a648009 commit b231152
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
9 changes: 9 additions & 0 deletions shared/requests/submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ components:
AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
CheckCancel: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction'
CheckCash: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction'
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
Expand All @@ -91,6 +92,7 @@ components:
- $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
- $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
- $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction'
- $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction'
# TODO: Add other transaction types here

description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.'
Expand Down Expand Up @@ -118,6 +120,7 @@ components:
AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
CheckCancel: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction'
CheckCash: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction'
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
Expand All @@ -130,6 +133,7 @@ components:
- $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
- $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
- $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction'
- $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction'
# TODO: Add other transaction types here
description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.'
required:
Expand Down Expand Up @@ -216,6 +220,7 @@ components:
AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
CheckCancel: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction'
CheckCash: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
Expand All @@ -229,6 +234,7 @@ components:
- $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
- $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
- $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction'
- $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction'
# TODO: Add other transaction types here

SubmitSuccessResponseV2:
Expand All @@ -251,6 +257,7 @@ components:
AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
CheckCancel: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction'
CheckCash: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
Expand All @@ -264,6 +271,7 @@ components:
- $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
- $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
- $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction'
- $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction'
# TODO: Add other transaction types here

SubmitErrorResponse:
Expand All @@ -280,6 +288,7 @@ components:
- $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteErrorCode'
- $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawErrorCode'
- $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelErrorCode'
- $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashErrorCode'
- enum:
- amendmentBlocked
- highFee
Expand Down
59 changes: 59 additions & 0 deletions shared/transactions/check_cash.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
components:
schemas:
CheckCashTransaction:
$id: CheckCashTransaction
allOf:
- $ref: '../base.yaml#/components/schemas/BaseTransaction'
type: object
description: |
Attempts to redeem a Check object in the ledger to receive up to the amount authorized by the
corresponding CheckCreate transaction. Only the Destination address of a Check can cash it with a
CheckCash transaction. Cashing a check this way is similar to executing a Payment initiated by the
destination.
Since the funds for a check are not guaranteed, redeeming a Check can fail because the sender does
not have a high enough balance or because there is not enough liquidity to deliver the funds. If
this happens, the Check remains in the ledger and the destination can try to cash it again later,
or for a different amount.
required:
- CheckID
properties:
CheckID:
type: string
format: hash256
description: |
The ID of the Check ledger object to cash, as a 64-character hexadecimal string.
Amount:
$ref: '../base.yaml#/components/schemas/CurrencyAmount'
description: |
(Optional) Redeem the Check for exactly this amount, if possible. The currency must match that
of the SendMax of the corresponding CheckCreate transaction. You must provide either this field
or DeliverMin.
DeliverMin:
$ref: '../base.yaml#/components/schemas/CurrencyAmount'
description: |
(Optional) Redeem the Check for at least this amount and for as much as possible. The currency
must match that of the SendMax of the corresponding CheckCreate transaction. You must provide
either this field or Amount.
x-custom-validation:
mutualExclusion:
- field1: Amount
field2: DeliverMin
CheckCashErrorCode:
$id: CheckCashErrorCode
type: string
enum:
- tecNO_PERMISSION
- tecNO_ENTRY
- tecEXPIRED
- tecDST_TAG_NEEDED
- temMALFORMED
- temBAD_CURRENCY
description: Enum representing possible error codes for CheckCash transactions.
x-enum-descriptions:
tecNO_PERMISSION: If the sender of the CheckCash transaction is not the Destination of the check, the transaction fails.
tecNO_ENTRY: If the Check identified by the CheckID field does not exist, the transaction fails.
tecEXPIRED: If the Check identified by the CheckID field has already expired, the transaction fails.
tecDST_TAG_NEEDED: If the destination of the Check has the RequireDest flag enabled but the Check, as created, does not have a destination tag, the transaction fails.
temMALFORMED: If the transaction specifies both Amount and DeliverMin, or omits both, the transaction fails.
temBAD_CURRENCY: If the Amount or DeliverMin does not match the currency (and issuer, if not XRP) of the Check, the transaction fails.

0 comments on commit b231152

Please sign in to comment.