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

feat: add nft related tx #27

Merged
merged 5 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions shared/requests/submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ components:
MPTokenIssuanceCreate: '../transactions/mptoken_issuance_create.yaml#/components/schemas/MPTokenIssuanceCreateTransaction'
MPTokenIssuanceDestroy: '../transactions/mptoken_issuance_destroy.yaml#/components/schemas/MPTokenIssuanceDestroyTransaction'
MPTokenIssuanceSet: '../transactions/mptoken_issuance_set.yaml#/components/schemas/MPTokenIssuanceSetTransaction'
NFTokenAcceptOffer: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferTransaction'
NFTokenBurn: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnTransaction'
NFTokenCancelOffer: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferTransaction'
NFTokenCreateOffer: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferTransaction'
NFTokenMint: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintTransaction'
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
Expand Down Expand Up @@ -125,6 +130,11 @@ components:
- $ref: '../transactions/mptoken_issuance_create.yaml#/components/schemas/MPTokenIssuanceCreateTransaction'
- $ref: '../transactions/mptoken_issuance_destroy.yaml#/components/schemas/MPTokenIssuanceDestroyTransaction'
- $ref: '../transactions/mptoken_issuance_set.yaml#/components/schemas/MPTokenIssuanceSetTransaction'
- $ref: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferTransaction'
- $ref: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnTransaction'
- $ref: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferTransaction'
- $ref: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferTransaction'
- $ref: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintTransaction'
# TODO: Add other transaction types here

description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.'
Expand Down Expand Up @@ -169,6 +179,11 @@ components:
MPTokenIssuanceCreate: '../transactions/mptoken_issuance_create.yaml#/components/schemas/MPTokenIssuanceCreateTransaction'
MPTokenIssuanceDestroy: '../transactions/mptoken_issuance_destroy.yaml#/components/schemas/MPTokenIssuanceDestroyTransaction'
MPTokenIssuanceSet: '../transactions/mptoken_issuance_set.yaml#/components/schemas/MPTokenIssuanceSetTransaction'
NFTokenAcceptOffer: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferTransaction'
NFTokenBurn: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnTransaction'
NFTokenCancelOffer: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferTransaction'
NFTokenCreateOffer: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferTransaction'
NFTokenMint: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintTransaction'
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
Expand Down Expand Up @@ -198,6 +213,11 @@ components:
- $ref: '../transactions/mptoken_issuance_create.yaml#/components/schemas/MPTokenIssuanceCreateTransaction'
- $ref: '../transactions/mptoken_issuance_destroy.yaml#/components/schemas/MPTokenIssuanceDestroyTransaction'
- $ref: '../transactions/mptoken_issuance_set.yaml#/components/schemas/MPTokenIssuanceSetTransaction'
- $ref: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferTransaction'
- $ref: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnTransaction'
- $ref: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferTransaction'
- $ref: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferTransaction'
- $ref: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintTransaction'
# TODO: Add other transaction types here
description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.'
required:
Expand Down Expand Up @@ -301,6 +321,11 @@ components:
MPTokenIssuanceCreate: '../transactions/mptoken_issuance_create.yaml#/components/schemas/MPTokenIssuanceCreateTransaction'
MPTokenIssuanceDestroy: '../transactions/mptoken_issuance_destroy.yaml#/components/schemas/MPTokenIssuanceDestroyTransaction'
MPTokenIssuanceSet: '../transactions/mptoken_issuance_set.yaml#/components/schemas/MPTokenIssuanceSetTransaction'
NFTokenAcceptOffer: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferTransaction'
NFTokenBurn: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnTransaction'
NFTokenCancelOffer: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferTransaction'
NFTokenCreateOffer: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferTransaction'
NFTokenMint: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
Expand Down Expand Up @@ -331,6 +356,11 @@ components:
- $ref: '../transactions/mptoken_issuance_create.yaml#/components/schemas/MPTokenIssuanceCreateTransaction'
- $ref: '../transactions/mptoken_issuance_destroy.yaml#/components/schemas/MPTokenIssuanceDestroyTransaction'
- $ref: '../transactions/mptoken_issuance_set.yaml#/components/schemas/MPTokenIssuanceSetTransaction'
- $ref: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferTransaction'
- $ref: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnTransaction'
- $ref: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferTransaction'
- $ref: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferTransaction'
- $ref: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintTransaction'
# TODO: Add other transaction types here

SubmitSuccessResponseV2:
Expand Down Expand Up @@ -370,6 +400,11 @@ components:
MPTokenIssuanceCreate: '../transactions/mptoken_issuance_create.yaml#/components/schemas/MPTokenIssuanceCreateTransaction'
MPTokenIssuanceDestroy: '../transactions/mptoken_issuance_destroy.yaml#/components/schemas/MPTokenIssuanceDestroyTransaction'
MPTokenIssuanceSet: '../transactions/mptoken_issuance_set.yaml#/components/schemas/MPTokenIssuanceSetTransaction'
NFTokenAcceptOffer: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferTransaction'
NFTokenBurn: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnTransaction'
NFTokenCancelOffer: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferTransaction'
NFTokenCreateOffer: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferTransaction'
NFTokenMint: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV2'
Expand Down Expand Up @@ -400,6 +435,11 @@ components:
- $ref: '../transactions/mptoken_issuance_create.yaml#/components/schemas/MPTokenIssuanceCreateTransaction'
- $ref: '../transactions/mptoken_issuance_destroy.yaml#/components/schemas/MPTokenIssuanceDestroyTransaction'
- $ref: '../transactions/mptoken_issuance_set.yaml#/components/schemas/MPTokenIssuanceSetTransaction'
- $ref: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferTransaction'
- $ref: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnTransaction'
- $ref: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferTransaction'
- $ref: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferTransaction'
- $ref: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintTransaction'
# TODO: Add other transaction types here

SubmitErrorResponse:
Expand All @@ -425,6 +465,11 @@ components:
- $ref: '../transactions/clawback.yaml#/components/schemas/ClawbackErrorCode'
- $ref: '../transactions/deposit_preauth.yaml#/components/schemas/DepositPreauthErrorCode'
- $ref: '../transactions/ticket_create.yaml#/components/schemas/TicketCreateErrorCode'
- $ref: '../transactions/nftoken_accept_offer.yaml#/components/schemas/NFTokenAcceptOfferErrorCode'
- $ref: '../transactions/nftoken_burn.yaml#/components/schemas/NFTokenBurnErrorCode'
- $ref: '../transactions/nftoken_cancel_offer.yaml#/components/schemas/NFTokenCancelOfferErrorCode'
- $ref: '../transactions/nftoken_create_offer.yaml#/components/schemas/NFTokenCreateOfferErrorCode'
- $ref: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintErrorCode'
- enum:
- amendmentBlocked
- highFee
Expand Down
69 changes: 69 additions & 0 deletions shared/transactions/nftoken_accept_offer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
components:
schemas:
NFTokenAcceptOfferTransaction:
$id: NFTokenAcceptOfferTransaction
allOf:
- $ref: '../base.yaml#/components/schemas/BaseTransaction'
type: object
description: |
The NFTokenAcceptOffer transaction is used to accept offers to buy or sell an NFToken. It can either:

- Allow one offer to be accepted. This is called direct mode.
- Allow two distinct offers, one offering to buy a given NFToken and the other offering to sell the same NFToken,
to be accepted in an atomic fashion. This is called brokered mode.
properties:
NFTokenSellOffer:
type: string
description: |
(Optional) Identifies the NFTokenOffer that offers to sell the NFToken.
NFTokenBuyOffer:
type: string
description: |
(Optional) Identifies the NFTokenOffer that offers to buy the NFToken.
NFTokenBrokerFee:
type: object
description: |
(Optional) This field is only valid in brokered mode, and specifies the amount that the broker keeps
as part of their fee for bringing the two offers together; the remaining amount is sent to the seller
of the NFToken being bought. If specified, the fee must be such that, before applying the transfer fee,
the amount that the seller would receive is at least as much as the amount indicated in the sell offer.
x-custom-validation:
conditionalRequired:
- field: NFTokenBrokerFee
requires:
- NFTokenSellOffer
- NFTokenBuyOffer
message: 'Must be set if using brokered mode.'
requireOneOf:
- fields:
- NFTokenSellOffer
- NFTokenBuyOffer
greaterThan:
- field: NFTokenBrokerFee
value: 0
message: 'Must be greater than 0; omit if there is no broker fee.'
NFTokenAcceptOfferErrorCode:
$id: NFTokenAcceptOfferErrorCode
type: string
enum:
- temDISABLED
- temMALFORMED
- tecCANT_ACCEPT_OWN_NFTOKEN_OFFER
- tecEXPIRED
- tecINSUFFICIENT_FUNDS
- tecINSUFFICIENT_PAYMENT
- tecOBJECT_NOT_FOUND
- tecNFTOKEN_BUY_SELL_MISMATCH
- tecNFTOKEN_OFFER_TYPE_MISMATCH
- tecNO_PERMISSION
x-enum-descriptions:
temDISABLED: The NonFungibleTokensV1 amendment is not enabled.
temMALFORMED: The transaction was not validly formatted. For example, it specified neither NFTokenSellOffer nor NFTokenBuyOffer, or it specified a negative NFTokenBrokerFee.
tecCANT_ACCEPT_OWN_NFTOKEN_OFFER: The buyer and seller are the same account.
tecEXPIRED: An offer specified in the transaction has already expired.
tecINSUFFICIENT_FUNDS: The buyer does not have the full amount they are offering. If the buy amount is specified in XRP, this could be because of the reserve requirement. If the buy amount is a token, it could be because the token is frozen.
tecINSUFFICIENT_PAYMENT: In brokered mode, the buy amount offered is not high enough to pay the BrokerFee and the sell cost of the NFToken.
tecOBJECT_NOT_FOUND: One of the offers specified in the transaction does not exist in the ledger.
tecNFTOKEN_BUY_SELL_MISMATCH: In brokered mode, the two offers are not a valid match. For example, the seller is asking more than the buyer is offering, the buy and sell offer are denominated in different assets, or the seller specified a destination that is not the buyer or the broker.
tecNFTOKEN_OFFER_TYPE_MISMATCH: The object identified by the NFTokenBuyOffer is not actually a buy offer, or the object identified by the NFTokenSellOffer is not actually a sell offer.
tecNO_PERMISSION: The seller does not own the NFToken being sold; or the matching offer specifies a different Destination account than the account accepting the offer.
41 changes: 41 additions & 0 deletions shared/transactions/nftoken_burn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
components:
schemas:
NFTokenBurnTransaction:
$id: NFTokenBurnTransaction
allOf:
- $ref: '../base.yaml#/components/schemas/BaseTransaction'
type: object
description: |
The NFTokenBurn transaction is used to remove a NFToken object from the NFTokenPage in which it is
being held, effectively removing the token from the ledger (burning it).

The sender of this transaction must be the owner of the NFToken to burn; or, if the NFToken has the
lsfBurnable flag enabled, can be the issuer or the issuer's authorized NFTokenMinter account instead.

If this operation succeeds, the corresponding NFToken is removed. If this operation empties the
NFTokenPage holding the NFToken or results in consolidation, thus removing a NFTokenPage, the owner’s
reserve requirement is reduced by one.
required:
- NFTokenID
properties:
NFTokenID:
type: string
description: |
The NFToken to be removed by this transaction.
Owner:
type: string
description: |
(Optional) The owner of the NFToken to burn. Only used if that owner is different than the account
sending this transaction. The issuer or authorized minter can use this field to burn NFTs that have
the lsfBurnable flag enabled.
NFTokenBurnErrorCode:
$id: NFTokenBurnErrorCode
type: string
enum:
- temDISABLED
- tecNO_ENTRY
- tecNO_PERMISSION
x-enum-descriptions:
temDISABLED: The NonFungibleTokensV1 amendment is not enabled.
tecNO_ENTRY: The specified TokenID was not found.
tecNO_PERMISSION: The account does not have permission to burn the token.
32 changes: 32 additions & 0 deletions shared/transactions/nftoken_cancel_offer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
components:
schemas:
NFTokenCancelOfferTransaction:
$id: NFTokenCancelOfferTransaction
allOf:
- $ref: '../base.yaml#/components/schemas/BaseTransaction'
type: object
description: |
The NFTokenCancelOffer transaction can be used to cancel existing token offers created using NFTokenCreateOffer.
required:
- NFTokenOffers
properties:
NFTokenOffers:
type: array
items:
type: string
description: |
An array of IDs of the NFTokenOffer objects to cancel (not the IDs of NFToken objects, but the IDs
of the NFTokenOffer objects). Each entry must be a different object ID of an NFTokenOffer object;
the transaction is invalid if the array contains duplicate entries.
minLength: 1
NFTokenCancelOfferErrorCode:
$id: NFTokenCancelOfferErrorCode
type: string
enum:
- temDISABLED
- temMALFORMED
- tecNO_PERMISSION
x-enum-descriptions:
temDISABLED: The NonFungibleTokensV1 amendment is not enabled.
temMALFORMED: The transaction was not validly formatted. For example, the NFTokenOffers array was empty or contained more than the maximum number of offers that can be canceled at one time.
tecNO_PERMISSION: At least one of the IDs in the NFTokenOffers field refers to an object that cannot be canceled. For example, the sender of this transaction is not the owner or Destination of the offer, or the object was not an NFTokenOffer type object.
Loading