Skip to content

Commit

Permalink
add deposit_preauth
Browse files Browse the repository at this point in the history
  • Loading branch information
pdp2121 committed Jan 31, 2025
1 parent 971a403 commit 36d3e5b
Show file tree
Hide file tree
Showing 2 changed files with 87 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 @@ -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'
Expand All @@ -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.'
Expand Down Expand Up @@ -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'
Expand All @@ -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:
Expand Down Expand Up @@ -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'
Expand All @@ -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:
Expand Down Expand Up @@ -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'
Expand All @@ -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:
Expand All @@ -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
Expand Down
78 changes: 78 additions & 0 deletions shared/transactions/deposit_preauth.yaml
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 36d3e5b

Please sign in to comment.