Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use x-supported-flags for Transaction Flags #34

Merged
merged 11 commits into from
Mar 3, 2025
16 changes: 8 additions & 8 deletions shared/requests/submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ components:
discriminator:
propertyName: TransactionType
mapping:
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
OracleSet: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
AccountSet: '../transactions/account_set.yaml#/components/schemas/AccountSetTransaction'
AccountDelete: '../transactions/account_delete.yaml#/components/schemas/AccountDeleteTransaction'
Expand Down Expand Up @@ -115,7 +115,7 @@ components:
XChainCreateBridge: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
- $ref: '../transactions/account_set.yaml#/components/schemas/AccountSetTransaction'
- $ref: '../transactions/account_delete.yaml#/components/schemas/AccountDeleteTransaction'
Expand Down Expand Up @@ -177,7 +177,7 @@ components:
discriminator:
propertyName: TransactionType
mapping:
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
OracleSet: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
AccountSet: '../transactions/account_set.yaml#/components/schemas/AccountSetTransaction'
AccountDelete: '../transactions/account_delete.yaml#/components/schemas/AccountDeleteTransaction'
Expand Down Expand Up @@ -224,7 +224,7 @@ components:
XChainCreateBridge: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
- $ref: '../transactions/account_set.yaml#/components/schemas/AccountSetTransaction'
- $ref: '../transactions/account_delete.yaml#/components/schemas/AccountDeleteTransaction'
Expand Down Expand Up @@ -345,7 +345,7 @@ components:
discriminator:
propertyName: TransactionType
mapping:
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
OracleSet: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
AccountSet: '../transactions/account_set.yaml#/components/schemas/AccountSetTransaction'
AccountDelete: '../transactions/account_delete.yaml#/components/schemas/AccountDeleteTransaction'
Expand Down Expand Up @@ -393,7 +393,7 @@ components:
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
- $ref: '../transactions/account_set.yaml#/components/schemas/AccountSetTransaction'
- $ref: '../transactions/account_delete.yaml#/components/schemas/AccountDeleteTransaction'
Expand Down Expand Up @@ -450,7 +450,7 @@ components:
discriminator:
propertyName: TransactionType
mapping:
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
OracleSet: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
AccountSet: '../transactions/account_set.yaml#/components/schemas/AccountSetTransaction'
AccountDelete: '../transactions/account_delete.yaml#/components/schemas/AccountDeleteTransaction'
Expand Down Expand Up @@ -498,7 +498,7 @@ components:
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
- $ref: '../transactions/account_set.yaml#/components/schemas/AccountSetTransaction'
- $ref: '../transactions/account_delete.yaml#/components/schemas/AccountDeleteTransaction'
Expand Down
167 changes: 67 additions & 100 deletions shared/transactions/account_set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,113 +68,80 @@ components:
format: uint32
description: |
(Optional) Not used. This field is valid in AccountSet transactions but does nothing.
Flags:
$ref: '#/components/schemas/AccountSetFlag'
x-custom-validation:
specialValue:
- field: TransferRate
specialValue: 0
- field: TickSize
specialValue: 0
x-supported-flags:
type: integer
format: uint32
name: AccountSetFlag
description: AccountSet transaction flags.
flags:
- name: tfRequireDestTag
value: 65536
description: 'The same as SetFlag: asfRequireDest.'
hexValue: '0x00010000'
- name: tfOptionalDestTags
value: 131072
description: 'The same as ClearFlag: asfRequireDest.'
hexValue: '0x00020000'
- name: tfRequireAuth
value: 262144
description: 'The same as SetFlag: asfRequireAuth.'
hexValue: '0x00040000'
- name: tfOptionalAuth
value: 524288
description: 'The same as ClearFlag: asfRequireAuth.'
hexValue: '0x00080000'
- name: tfDisallowXRP
value: 1048576
description: 'The same as SetFlag: asfDisallowXRP.'
hexValue: '0x00100000'
- name: tfAllowXRP
value: 2097152
description: 'The same as ClearFlag: asfDisallowXRP.'
hexValue: '0x00200000'
x-generate-enum-in-model:
- AccountSetFlag
- AccountSetAsfFlag

AccountSetAsfFlag:
$id: AccountSetAsfFlag
AccountSetFlag:
type: integer
format: uint32
description: Enum representing AccountSet transaction flags.
description: Enum for AccountSet Transaction Flags.
enum:
- 5
- 16
- 10
- 8
- 9
- 4
- 13
- 12
- 14
- 15
- 3
- 7
- 6
- 2
- 1
x-flags:
- name: asfAccountTxnID
value: 5
description: Track the ID of this account's most recent transaction. Required for AccountTxnID.
- name: asfAllowTrustLineClawback
value: 16
description: |
Allow account to claw back tokens it has issued. (Requires the Clawback amendment.)
Can only be set if the account has an empty owner directory (no trust lines, offers, escrows, payment channels, checks, or signer lists).
After you set this flag, it cannot be reverted. The account permanently gains the ability to claw back issued assets on trust lines.
- name: asfAuthorizedNFTokenMinter
value: 10
description: |
Enable to allow another account to mint non-fungible tokens (NFTokens) on this account's behalf.
Specify the authorized account in the NFTokenMinter field of the AccountRoot object.
To remove an authorized minter, enable this flag and omit the NFTokenMinter field. (Added by the NonFungibleTokensV1_1 amendment.)
- name: asfDefaultRipple
value: 8
description: Enable rippling on this account's trust lines by default.
- name: asfDepositAuth
value: 9
description: Enable Deposit Authorization on this account. (Added by the DepositAuth amendment.)
- name: asfDisableMaster
value: 4
description: Disallow use of the master key pair. Can only be enabled if the account has configured another way to sign transactions, such as a Regular Key or a Signer List.
- name: asfDisallowIncomingCheck
value: 13
description: Block incoming Checks. (Requires the DisallowIncoming amendment.)
- name: asfDisallowIncomingNFTokenOffer
value: 12
description: Block incoming NFTokenOffers. (Requires the DisallowIncoming amendment.)
- name: asfDisallowIncomingPayChan
value: 14
description: Block incoming Payment Channels. (Requires the DisallowIncoming amendment.)
- name: asfDisallowIncomingTrustline
value: 15
description: Block incoming trust lines. (Requires the DisallowIncoming amendment.)
- name: asfDisallowXRP
value: 3
description: XRP should not be sent to this account. (Advisory; not enforced by the XRP Ledger protocol.)
- name: asfGlobalFreeze
value: 7
description: Freeze all assets issued by this account.
- name: asfNoFreeze
value: 6
description: Permanently give up the ability to freeze individual trust lines or disable Global Freeze. This flag can never be disabled after being enabled.
- name: asfRequireAuth
value: 2
description: Require authorization for users to hold balances issued by this address. Can only be enabled if the address has no trust lines connected to it.
- name: asfRequireDest
value: 1
description: Require a destination tag to send transactions to this account.
- 0x00010000
- 0x00020000
- 0x00040000
- 0x00080000
- 0x00100000
- 0x00200000
x-enum-varnames:
- tfRequireDestTag
- tfOptionalDestTags
- tfRequireAuth
- tfOptionalAuth
- tfDisallowXRP
- tfAllowXRP
x-enum-descriptions:
- 'The same as SetFlag: asfRequireDest.'
- 'The same as ClearFlag: asfRequireDest.'
- 'The same as SetFlag: asfRequireAuth.'
- 'The same as ClearFlag: asfRequireAuth.'
- 'The same as SetFlag: asfDisallowXRP.'
- 'The same as ClearFlag: asfDisallowXRP.'
x-generate-hex: true
x-generate-flag-interface: true

AccountSetAsfFlag:
type: integer
format: uint32
description: Enum for AccountSet Flags.
enum: [5, 16, 10, 8, 9, 4, 13, 12, 14, 15, 3, 7, 6, 2, 1]
x-enum-varnames:
- asfAccountTxnID
- asfAllowTrustLineClawback
- asfAuthorizedNFTokenMinter
- asfDefaultRipple
- asfDepositAuth
- asfDisableMaster
- asfDisallowIncomingCheck
- asfDisallowIncomingNFTokenOffer
- asfDisallowIncomingPayChan
- asfDisallowIncomingTrustline
- asfDisallowXRP
- asfGlobalFreeze
- asfNoFreeze
- asfRequireAuth
- asfRequireDest
x-enum-descriptions:
- Track the ID of this account's most recent transaction. Required for AccountTxnID.
- Allow account to claw back tokens it has issued. (Requires the Clawback amendment.)
- Enable to allow another account to mint non-fungible tokens (NFTokens) on this account's behalf.
- Enable rippling on this account's trust lines by default.
- Enable Deposit Authorization on this account. (Added by the DepositAuth amendment.)
- Disallow use of the master key pair. Can only be enabled if the account has configured another way to sign transactions.
- Block incoming Checks. (Requires the DisallowIncoming amendment.)
- Block incoming NFTokenOffers. (Requires the DisallowIncoming amendment.)
- Block incoming Payment Channels. (Requires the DisallowIncoming amendment.)
- Block incoming trust lines. (Requires the DisallowIncoming amendment.)
- XRP should not be sent to this account. (Advisory; not enforced by the XRP Ledger protocol.)
- Freeze all assets issued by this account.
- Permanently give up the ability to freeze individual trust lines or disable Global Freeze.
- Require authorization for users to hold balances issued by this address.
- Require a destination tag to send transactions to this account.
44 changes: 29 additions & 15 deletions shared/transactions/amm_deposit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ components:
equivalent to 0.001%. The maximum value is 1000, indicating a 1% fee.
minimum: 0
maximum: 1000
Flags:
$ref: '#/components/schemas/AMMDepositFlag'
x-custom-validation:
dependentPresence:
- dependentField: Amount2
Expand All @@ -62,25 +64,37 @@ components:
- fields:
- LPTokenOut
- Amount
x-generate-enum-in-model:
- AMMDepositFlag

AMMDepositFlag:
$id: AMMDepositFlag
type: string
type: integer
format: uint32
description: Enum for AMMDeposit Transaction Flags.
enum:
- tfLPToken: 0x00010000
- tfTwoAsset: 0x00100000
- tfTwoAssetIfEmpty: 0x00800000
- tfSingleAsset: 0x00080000
- tfOneAssetLPToken: 0x00200000
- tfLimitLPToken: 0x00400000
description: Enum representing flags for AMMDeposit transactions.
- 0x00010000
- 0x00100000
- 0x00800000
- 0x00080000
- 0x00200000
- 0x00400000
x-enum-varnames:
- tfLPToken
- tfTwoAsset
- tfTwoAssetIfEmpty
- tfSingleAsset
- tfOneAssetLPToken
- tfLimitLPToken
x-enum-descriptions:
tfLPToken: Deposit both of this AMM's assets, in amounts calculated so that you receive the specified amount of LP Tokens in return. The amounts deposited maintain the relative proportions of the two assets the AMM already holds.
tfTwoAsset: Deposit both of this AMM's assets, up to the specified amounts. The actual amounts deposited must maintain the same balance of assets as the AMM already holds, so the amount of either one deposited MAY be less than specified. The amount of LP Tokens you get in return is based on the total value deposited.
tfTwoAssetIfEmpty: Deposit both of this AMM's assets, in exactly the specified amounts, to an AMM with an empty asset pool. The amount of LP Tokens you get in return is based on the total value deposited.
tfSingleAsset: Deposit exactly the specified amount of one asset, and receive an amount of LP Tokens based on the resulting share of the pool (minus fees).
tfOneAssetLPToken: Deposit up to the specified amount of one asset, so that you receive exactly the specified amount of LP Tokens in return (after fees).
tfLimitLPToken: Deposit up to the specified amount of one asset, but pay no more than the specified effective price per LP Token (after fees).
- Deposit both of this AMM's assets, in amounts calculated so that you receive the specified amount of LP Tokens in return. The amounts deposited maintain the relative proportions of the two assets the AMM already holds.
- Deposit both of this AMM's assets, up to the specified amounts. The actual amounts deposited must maintain the same balance of assets as the AMM already holds, so the amount of either one deposited MAY be less than specified. The amount of LP Tokens you get in return is based on the total value deposited.
- Deposit both of this AMM's assets, in exactly the specified amounts, to an AMM with an empty asset pool. The amount of LP Tokens you get in return is based on the total value deposited.
- Deposit exactly the specified amount of one asset, and receive an amount of LP Tokens based on the resulting share of the pool (minus fees).
- Deposit up to the specified amount of one asset, so that you receive exactly the specified amount of LP Tokens in return (after fees).
- Deposit up to the specified amount of one asset, but pay no more than the specified effective price per LP Token (after fees).
x-generate-hex: true
x-generate-flag-interface: true

AMMDepositErrorCode:
$id: AMMDepositErrorCode
type: string
Expand Down
50 changes: 33 additions & 17 deletions shared/transactions/amm_withdraw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,48 @@ components:
$ref: '../base.yaml#/components/schemas/CurrencyAmount'
description: |
(Optional) How many of the AMM's LP Tokens to redeem.
Flags:
$ref: '#/components/schemas/AMMWithdrawFlag'
x-custom-validation:
dependentPresence:
- dependentField: Amount2
requiredField: Amount
- dependentField: EPrice
requiredField: Amount
x-generate-enum-in-model:
- AMMWithdrawFlag

AMMWithdrawFlag:
$id: AMMWithdrawFlag
type: string
type: integer
format: uint32
description: Enum for AMMWithdraw Transaction Flags.
enum:
- tfLPToken: 0x00010000
- tfWithdrawAll: 0x00020000
- tfOneAssetWithdrawAll: 0x00040000
- tfSingleAsset: 0x00080000
- tfTwoAsset: 0x00100000
- tfOneAssetLPToken: 0x00200000
- tfLimitLPToken: 0x00400000
description: Enum representing flags for AMMWithdraw transactions.
- 0x00010000
- 0x00020000
- 0x00040000
- 0x00080000
- 0x00100000
- 0x00200000
- 0x00400000
x-enum-varnames:
- tfLPToken
- tfWithdrawAll
- tfOneAssetWithdrawAll
- tfSingleAsset
- tfTwoAsset
- tfOneAssetLPToken
- tfLimitLPToken
x-enum-descriptions:
tfLPToken: Perform a double-asset withdrawal and receive the specified amount of LP Tokens.
tfWithdrawAll: Perform a double-asset withdrawal returning all your LP Tokens.
tfOneAssetWithdrawAll: Perform a single-asset withdrawal returning all of your LP Tokens.
tfSingleAsset: Perform a single-asset withdrawal with a specified amount of the asset to withdraw.
tfTwoAsset: Perform a double-asset withdrawal with specified amounts of both assets.
tfOneAssetLPToken: Perform a single-asset withdrawal and receive the specified amount of LP Tokens.
tfLimitLPToken: Perform a single-asset withdrawal with a specified effective price.
- Perform a double-asset withdrawal and receive the specified amount of LP Tokens.
- Perform a double-asset withdrawal returning all your LP Tokens.
- Perform a single-asset withdrawal returning all of your LP Tokens.
- Perform a single-asset withdrawal with a specified amount of the asset to withdraw.
- Perform a double-asset withdrawal with specified amounts of both assets.
- Perform a single-asset withdrawal and receive the specified amount of LP Tokens.
- Perform a single-asset withdrawal with a specified effective price.
x-generate-hex: true
x-generate-flag-interface: true

AMMWithdrawErrorCode:
$id: AMMWithdrawErrorCode
type: string
Expand Down
Loading