diff --git a/shared/requests/submit.yaml b/shared/requests/submit.yaml index d2f6744..bea7175 100644 --- a/shared/requests/submit.yaml +++ b/shared/requests/submit.yaml @@ -90,6 +90,7 @@ components: EscrowCreate: '../transactions/escrow_create.yaml#/components/schemas/EscrowCreateTransaction' EscrowFinish: '../transactions/escrow_finish.yaml#/components/schemas/EscrowFinishTransaction' Clawback: '../transactions/clawback.yaml#/components/schemas/ClawbackTransaction' + DepositPreauth: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthTransaction' oneOf: - $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1' - $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction' @@ -113,6 +114,7 @@ components: - $ref: '../transactions/escrow_create.yaml#/components/schemas/EscrowCreateTransaction' - $ref: '../transactions/escrow_finish.yaml#/components/schemas/EscrowFinishTransaction' - $ref: '../transactions/clawback.yaml#/components/schemas/ClawbackTransaction' + - $ref: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthTransaction' # TODO: Add other transaction types here description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.' @@ -151,6 +153,7 @@ components: EscrowCreate: '../transactions/escrow_create.yaml#/components/schemas/EscrowCreateTransaction' EscrowFinish: '../transactions/escrow_finish.yaml#/components/schemas/EscrowFinishTransaction' Clawback: '../transactions/clawback.yaml#/components/schemas/ClawbackTransaction' + DepositPreauth: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthTransaction' oneOf: - $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2' - $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction' @@ -174,6 +177,7 @@ components: - $ref: '../transactions/escrow_create.yaml#/components/schemas/EscrowCreateTransaction' - $ref: '../transactions/escrow_finish.yaml#/components/schemas/EscrowFinishTransaction' - $ref: '../transactions/clawback.yaml#/components/schemas/ClawbackTransaction' + - $ref: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthTransaction' # TODO: Add other transaction types here description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.' required: @@ -271,6 +275,7 @@ components: EscrowCreate: '../transactions/escrow_create.yaml#/components/schemas/EscrowCreateTransaction' EscrowFinish: '../transactions/escrow_finish.yaml#/components/schemas/EscrowFinishTransaction' Clawback: '../transactions/clawback.yaml#/components/schemas/ClawbackTransaction' + DepositPreauth: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthTransaction' # TODO: Add other transaction types here oneOf: - $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1' @@ -295,6 +300,7 @@ components: - $ref: '../transactions/escrow_create.yaml#/components/schemas/EscrowCreateTransaction' - $ref: '../transactions/escrow_finish.yaml#/components/schemas/EscrowFinishTransaction' - $ref: '../transactions/clawback.yaml#/components/schemas/ClawbackTransaction' + - $ref: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthTransaction' # TODO: Add other transaction types here SubmitSuccessResponseV2: @@ -328,6 +334,7 @@ components: EscrowCreate: '../transactions/escrow_create.yaml#/components/schemas/EscrowCreateTransaction' EscrowFinish: '../transactions/escrow_finish.yaml#/components/schemas/EscrowFinishTransaction' Clawback: '../transactions/clawback.yaml#/components/schemas/ClawbackTransaction' + DepositPreauth: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthTransaction' # TODO: Add other transaction types here oneOf: - $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2' @@ -352,6 +359,7 @@ components: - $ref: '../transactions/escrow_create.yaml#/components/schemas/EscrowCreateTransaction' - $ref: '../transactions/escrow_finish.yaml#/components/schemas/EscrowFinishTransaction' - $ref: '../transactions/clawback.yaml#/components/schemas/ClawbackTransaction' + - $ref: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthTransaction' # TODO: Add other transaction types here SubmitErrorResponse: @@ -375,6 +383,7 @@ components: - $ref: '../transactions/did_delete.yaml#/components/schemas/DIDDeleteErrorCode' - $ref: '../transactions/did_set.yaml#/components/schemas/DIDSetErrorCode' - $ref: '../transactions/clawback.yaml#/components/schemas/ClawbackErrorCode' + - $ref: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthErrorCode' - enum: - amendmentBlocked - highFee diff --git a/shared/transactions/deposit_preauth.yaml b/shared/transactions/deposit_preauth.yaml new file mode 100644 index 0000000..be600c7 --- /dev/null +++ b/shared/transactions/deposit_preauth.yaml @@ -0,0 +1,78 @@ +components: + schemas: + DepositPreauthTransaction: + $id: DepositPreauthTransaction + allOf: + - $ref: '../base.yaml#/components/schemas/BaseTransaction' + type: object + description: | + A DepositPreauth transaction grants preauthorization to deliver payments to your account. This is + only useful if you are using (or plan to use) Deposit Authorization. + properties: + Authorize: + type: string + description: | + (Optional) An account to preauthorize. + AuthorizeCredentials: + type: array + items: + $ref: '#/components/schemas/AuthorizeCredentials' + description: | + (Optional) A set of credentials to authorize. (Requires the Credentials amendment.) + Unauthorize: + type: string + description: | + (Optional) An account whose preauthorization should be revoked. + UnauthorizeCredentials: + type: array + items: + $ref: '#/components/schemas/AuthorizeCredentials' + description: | + (Optional) A set of credentials whose preauthorization should be revoked. (Requires the + Credentials amendment.) + x-custom-validation: + requireOneOf: + - fields: + - Authorize + - AuthorizeCredentials + - Unauthorize + - UnauthorizeCredentials + message: 'You must provide exactly one of Authorize, AuthorizeCredentials, Unauthorize, or UnauthorizeCredentials.' + AuthorizeCredentials: + $id: AuthorizeCredentials + type: object + description: | + Represents a credential used for preauthorization. + required: + - Issuer + - CredentialType + properties: + Issuer: + type: string + description: | + (Required) The issuer of the credential. + CredentialType: + type: string + format: hexadecimal + description: | + (Required) The credential type of the credential. + DepositPreauthErrorCode: + $id: DepositPreauthErrorCode + type: string + enum: + - tecDUPLICATE + - tecINSUFFICIENT_RESERVE + - tecNO_ENTRY + - tecNO_ISSUER + - tecNO_TARGET + - temCANNOT_PREAUTH_SELF + - temDISABLED + description: Enum representing possible error codes for DepositPreauth transactions. + x-enum-descriptions: + tecDUPLICATE: The transaction would create a preauthorization that already exists. + tecINSUFFICIENT_RESERVE: The sender would not meet the reserve requirement after adding another entry to the ledger. (A DepositPreauth entry counts as one item towards the authorizer's owner reserve.) + tecNO_ENTRY: The transaction tried to revoke a preauthorization that does not exist in the ledger. + tecNO_ISSUER: One or more specified credential issuers does not exist in the ledger. + tecNO_TARGET: The transaction tried to authorize an account that is not a funded account in the ledger. + temCANNOT_PREAUTH_SELF: The address in the Authorize field is the sender of the transaction. You cannot preauthorize yourself. + temDISABLED: A required amendment is not enabled.