diff --git a/shared/requests/submit.yaml b/shared/requests/submit.yaml index afe2e48..ad561d4 100644 --- a/shared/requests/submit.yaml +++ b/shared/requests/submit.yaml @@ -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' @@ -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.' @@ -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' @@ -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: @@ -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' @@ -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: @@ -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' @@ -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: @@ -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 diff --git a/shared/transactions/check_cash.yaml b/shared/transactions/check_cash.yaml new file mode 100644 index 0000000..73e2beb --- /dev/null +++ b/shared/transactions/check_cash.yaml @@ -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.