Skip to content

Commit

Permalink
feat: add Xchain_bridge tx (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdp2121 authored Feb 7, 2025
1 parent c50e688 commit 2da5445
Show file tree
Hide file tree
Showing 14 changed files with 475 additions and 14 deletions.
44 changes: 42 additions & 2 deletions shared/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,18 @@ components:
type: string
description: 'Generally, the account that issues this token. In special cases, this can refer to the account that holds the token instead (for example, in a Clawback transaction).'

CurrencyWithoutAmount:
$id: CurrencyWithoutAmount
Currency:
$id: Currency
description: |
The XRP Ledger has two kinds of money: XRP, and issued currencies. Both types have high precision, although their
formats are different.
oneOf:
- type: string
description: 'XRP represented as a string.'
- $ref: '#/components/schemas/IssuedCurrency'

IssuedCurrency:
$id: IssuedCurrency
type: object
properties:
currency:
Expand All @@ -228,3 +238,33 @@ components:
issuer:
type: string
description: 'Generally, the account that issues this token. In special cases, this can refer to the account that holds the token instead (for example, in a Clawback transaction).'

XChainBridge:
$id: XChainBridge
type: object
description: |
The bridge to create accounts for.
required:
- IssuingChainDoor
- IssuingChainIssue
- LockingChainDoor
- LockingChainIssue
properties:
IssuingChainDoor:
type: string
description: |
The door account on the issuing chain. For an XRP-XRP bridge, this must be the genesis account
(the account that is created when the network is first started, which contains all of the XRP).
IssuingChainIssue:
$ref: '#/components/schemas/Currency'
description: |
The asset that is minted and burned on the issuing chain. For an IOU-IOU bridge, the issuer of
the asset must be the door account on the issuing chain, to avoid supply issues.
LockingChainDoor:
type: string
description: |
The door account on the locking chain.
LockingChainIssue:
$ref: '#/components/schemas/Currency'
description: |
The asset that is locked and unlocked on the locking chain.
8 changes: 4 additions & 4 deletions shared/requests/ledger_entry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ components:
- type: object
properties:
asset:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
asset2:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
required:
- asset
- asset2
Expand All @@ -86,11 +86,11 @@ components:
IssuingChainDoor:
type: string
IssuingChainIssue:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
LockingChainDoor:
type: string
LockingChainIssue:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
required:
- IssuingChainDoor
- IssuingChainIssue
Expand Down
56 changes: 56 additions & 0 deletions shared/requests/submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ components:
PaymentChannelClaim: '../transactions/payment_channel_claim.yaml#/components/schemas/PaymentChannelClaimTransaction'
PaymentChannelCreate: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateTransaction'
PaymentChannelFund: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundTransaction'
XChainAccountCreateCommit: '../transactions/xchain_account_create_commit.yaml#/components/schemas/XChainAccountCreateCommitTransaction'
XChainAddAccountCreateAttestation: '../transactions/xchain_add_account_create_attestation.yaml#/components/schemas/XChainAddAccountCreateAttestationTransaction'
XChainAddClaimAttestation: '../transactions/xchain_add_claim_attestation.yaml#/components/schemas/XChainAddClaimAttestationTransaction'
XChainClaim: '../transactions/xchain_claim.yaml#/components/schemas/XChainClaimTransaction'
XChainCommit: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
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/oracle_set.yaml#/components/schemas/OracleSetTransaction'
Expand Down Expand Up @@ -141,6 +148,13 @@ components:
- $ref: '../transactions/payment_channel_claim.yaml#/components/schemas/PaymentChannelClaimTransaction'
- $ref: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateTransaction'
- $ref: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundTransaction'
- $ref: '../transactions/xchain_account_create_commit.yaml#/components/schemas/XChainAccountCreateCommitTransaction'
- $ref: '../transactions/xchain_add_account_create_attestation.yaml#/components/schemas/XChainAddAccountCreateAttestationTransaction'
- $ref: '../transactions/xchain_add_claim_attestation.yaml#/components/schemas/XChainAddClaimAttestationTransaction'
- $ref: '../transactions/xchain_claim.yaml#/components/schemas/XChainClaimTransaction'
- $ref: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
- $ref: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
- $ref: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
# TODO: Add other transaction types here

description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.'
Expand Down Expand Up @@ -193,6 +207,13 @@ components:
PaymentChannelClaim: '../transactions/payment_channel_claim.yaml#/components/schemas/PaymentChannelClaimTransaction'
PaymentChannelCreate: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateTransaction'
PaymentChannelFund: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundTransaction'
XChainAccountCreateCommit: '../transactions/xchain_account_create_commit.yaml#/components/schemas/XChainAccountCreateCommitTransaction'
XChainAddAccountCreateAttestation: '../transactions/xchain_add_account_create_attestation.yaml#/components/schemas/XChainAddAccountCreateAttestationTransaction'
XChainAddClaimAttestation: '../transactions/xchain_add_claim_attestation.yaml#/components/schemas/XChainAddClaimAttestationTransaction'
XChainClaim: '../transactions/xchain_claim.yaml#/components/schemas/XChainClaimTransaction'
XChainCommit: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
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/oracle_set.yaml#/components/schemas/OracleSetTransaction'
Expand Down Expand Up @@ -230,6 +251,13 @@ components:
- $ref: '../transactions/payment_channel_claim.yaml#/components/schemas/PaymentChannelClaimTransaction'
- $ref: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateTransaction'
- $ref: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundTransaction'
- $ref: '../transactions/xchain_account_create_commit.yaml#/components/schemas/XChainAccountCreateCommitTransaction'
- $ref: '../transactions/xchain_add_account_create_attestation.yaml#/components/schemas/XChainAddAccountCreateAttestationTransaction'
- $ref: '../transactions/xchain_add_claim_attestation.yaml#/components/schemas/XChainAddClaimAttestationTransaction'
- $ref: '../transactions/xchain_claim.yaml#/components/schemas/XChainClaimTransaction'
- $ref: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
- $ref: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
- $ref: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
# TODO: Add other transaction types here
description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.'
required:
Expand Down Expand Up @@ -341,6 +369,13 @@ components:
PaymentChannelClaim: '../transactions/payment_channel_claim.yaml#/components/schemas/PaymentChannelClaimTransaction'
PaymentChannelCreate: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateTransaction'
PaymentChannelFund: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundTransaction'
XChainAccountCreateCommit: '../transactions/xchain_account_create_commit.yaml#/components/schemas/XChainAccountCreateCommitTransaction'
XChainAddAccountCreateAttestation: '../transactions/xchain_add_account_create_attestation.yaml#/components/schemas/XChainAddAccountCreateAttestationTransaction'
XChainAddClaimAttestation: '../transactions/xchain_add_claim_attestation.yaml#/components/schemas/XChainAddClaimAttestationTransaction'
XChainClaim: '../transactions/xchain_claim.yaml#/components/schemas/XChainClaimTransaction'
XChainCommit: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
XChainCreateBridge: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
Expand Down Expand Up @@ -379,6 +414,13 @@ components:
- $ref: '../transactions/payment_channel_claim.yaml#/components/schemas/PaymentChannelClaimTransaction'
- $ref: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateTransaction'
- $ref: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundTransaction'
- $ref: '../transactions/xchain_account_create_commit.yaml#/components/schemas/XChainAccountCreateCommitTransaction'
- $ref: '../transactions/xchain_add_account_create_attestation.yaml#/components/schemas/XChainAddAccountCreateAttestationTransaction'
- $ref: '../transactions/xchain_add_claim_attestation.yaml#/components/schemas/XChainAddClaimAttestationTransaction'
- $ref: '../transactions/xchain_claim.yaml#/components/schemas/XChainClaimTransaction'
- $ref: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
- $ref: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
- $ref: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
# TODO: Add other transaction types here

SubmitSuccessResponseV2:
Expand Down Expand Up @@ -426,6 +468,13 @@ components:
PaymentChannelClaim: '../transactions/payment_channel_claim.yaml#/components/schemas/PaymentChannelClaimTransaction'
PaymentChannelCreate: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateTransaction'
PaymentChannelFund: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundTransaction'
XChainAccountCreateCommit: '../transactions/xchain_account_create_commit.yaml#/components/schemas/XChainAccountCreateCommitTransaction'
XChainAddAccountCreateAttestation: '../transactions/xchain_add_account_create_attestation.yaml#/components/schemas/XChainAddAccountCreateAttestationTransaction'
XChainAddClaimAttestation: '../transactions/xchain_add_claim_attestation.yaml#/components/schemas/XChainAddClaimAttestationTransaction'
XChainClaim: '../transactions/xchain_claim.yaml#/components/schemas/XChainClaimTransaction'
XChainCommit: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
XChainCreateBridge: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
Expand Down Expand Up @@ -464,6 +513,13 @@ components:
- $ref: '../transactions/payment_channel_claim.yaml#/components/schemas/PaymentChannelClaimTransaction'
- $ref: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateTransaction'
- $ref: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundTransaction'
- $ref: '../transactions/xchain_account_create_commit.yaml#/components/schemas/XChainAccountCreateCommitTransaction'
- $ref: '../transactions/xchain_add_account_create_attestation.yaml#/components/schemas/XChainAddAccountCreateAttestationTransaction'
- $ref: '../transactions/xchain_add_claim_attestation.yaml#/components/schemas/XChainAddClaimAttestationTransaction'
- $ref: '../transactions/xchain_claim.yaml#/components/schemas/XChainClaimTransaction'
- $ref: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
- $ref: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
- $ref: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
# TODO: Add other transaction types here

SubmitErrorResponse:
Expand Down
4 changes: 2 additions & 2 deletions shared/transactions/amm_bid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ components:
- Asset2
properties:
Asset:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
description: |
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
with currency and issuer fields (omit issuer for XRP).
Asset2:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
description: |
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
with currency and issuer fields (omit issuer for XRP).
Expand Down
4 changes: 2 additions & 2 deletions shared/transactions/amm_deposit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ components:
- Asset2
properties:
Asset:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
description: |
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
with currency and issuer fields (omit issuer for XRP).
Asset2:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
description: |
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
with currency and issuer fields (omit issuer for XRP).
Expand Down
4 changes: 2 additions & 2 deletions shared/transactions/amm_vote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ components:
- TradingFee
properties:
Asset:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
description: |
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
with currency and issuer fields (omit issuer for XRP).
Asset2:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
description: |
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
with currency and issuer fields (omit issuer for XRP).
Expand Down
4 changes: 2 additions & 2 deletions shared/transactions/amm_withdraw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ components:
- Asset2
properties:
Asset:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
description: |
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
with currency and issuer fields (omit issuer for XRP).
Asset2:
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
description: |
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
with currency and issuer fields (omit issuer for XRP).
Expand Down
32 changes: 32 additions & 0 deletions shared/transactions/xchain_account_create_commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
components:
schemas:
XChainAccountCreateCommitTransaction:
$id: XChainAccountCreateCommitTransaction
allOf:
- $ref: '../base.yaml#/components/schemas/BaseTransaction'
type: object
description: |
This transaction can only be used for XRP-XRP bridges.
The XChainAccountCreateCommit transaction creates a new account for a witness server to submit transactions on an issuing chain.
required:
- Amount
- Destination
- XChainBridge
properties:
Amount:
type: string
description: |
The amount, in XRP, to use for account creation. This must be greater than or equal to
the MinAccountCreateAmount specified in the Bridge ledger object.
Destination:
type: string
description: |
The destination account on the destination chain.
SignatureReward:
type: string
description: |
(Optional) The amount, in XRP, to be used to reward the witness servers for providing signatures.
This must match the amount on the Bridge ledger object.
XChainBridge:
$ref: '../base.yaml#/components/schemas/XChainBridge'
Loading

0 comments on commit 2da5445

Please sign in to comment.