Skip to content

Commit

Permalink
add nft mint
Browse files Browse the repository at this point in the history
  • Loading branch information
pdp2121 committed Feb 4, 2025
1 parent 468ddb3 commit 5665c4c
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 2 deletions.
9 changes: 9 additions & 0 deletions shared/requests/submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ components:
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 @@ -133,6 +134,7 @@ components:
- $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 @@ -181,6 +183,7 @@ components:
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 @@ -214,6 +217,7 @@ components:
- $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 @@ -321,6 +325,7 @@ components:
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 @@ -355,6 +360,7 @@ components:
- $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 @@ -398,6 +404,7 @@ components:
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 @@ -432,6 +439,7 @@ components:
- $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 Down Expand Up @@ -461,6 +469,7 @@ components:
- $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
2 changes: 0 additions & 2 deletions shared/transactions/nftoken_create_offer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ components:
notEqual:
- field: Destination
toField: Account
message: 'Must not be equal to the account.'
- field: Owner
toField: Account
message: 'Must not be equal to the account.'
NFTokenCreateOfferFlag:
$id: NFTokenCreateOfferFlag
type: string
Expand Down
108 changes: 108 additions & 0 deletions shared/transactions/nftoken_mint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
components:
schemas:
NFTokenMintTransaction:
$id: NFTokenMintTransaction
allOf:
- $ref: '../base.yaml#/components/schemas/BaseTransaction'
type: object
description: |
The NFTokenMint transaction creates a non-fungible token and adds it to the relevant NFTokenPage
object of the NFTokenMinter as an NFToken object. This transaction is the only opportunity the
NFTokenMinter has to specify any token fields that are defined as immutable (for example, the TokenFlags).
required:
- NFTokenTaxon
properties:
NFTokenTaxon:
type: integer
format: uint32
description: |
An arbitrary taxon, or shared identifier, for a series or collection of related NFTs. To mint a
series of NFTs, give them all the same taxon.
Issuer:
type: string
description: |
(Optional) The issuer of the token, if the sender of the account is issuing it on behalf of another
account. This field must be omitted if the account sending the transaction is the issuer of the NFToken.
If provided, the issuer's AccountRoot object must have the NFTokenMinter field set to the sender of this
transaction (this transaction's Account field).
TransferFee:
type: integer
format: uint16
description: |
(Optional) The value specifies the fee charged by the issuer for secondary sales of the NFToken,
if such sales are allowed. Valid values for this field are between 0 and 50000 inclusive, allowing
transfer rates of between 0.00% and 50.00% in increments of 0.001. If this field is provided, the
transaction MUST have the tfTransferable flag enabled.
maximum: 50000
URI:
type: string
description: |
(Optional) Up to 256 bytes of arbitrary data. In JSON, this should be encoded as a string of hexadecimal.
This is intended to be a URI that points to the data or metadata associated with the NFT.
maxLength: 512
Amount:
type: object
description: |
(Optional) Indicates the amount expected or offered for the corresponding NFToken. The amount must be
non-zero, except where the asset is XRP; then, it is legal to specify an amount of zero.
Expiration:
type: integer
format: uint32
description: |
(Optional) Time after which the offer is no longer active, in seconds since the Ripple Epoch.
Results in an error if the Amount field is not specified.
Destination:
type: string
description: |
(Optional) If present, indicates that this offer may only be accepted by the specified account.
Attempts by other accounts to accept this offer MUST fail. Results in an error if the Amount field
is not specified.
Flags:
type: integer
format: uint32
description: |
Flags modifying the behavior of the transaction. See NFTokenMintFlag for details.
x-custom-validation:
notEqual:
- field: Issuer
toField: Account
message: 'Must not be the same as the account.'
requiredFlag:
- field: TransferFee
flag: tfTransferable
NFTokenMintFlag:
$id: NFTokenMintFlag
type: string
enum:
- tfBurnable: 0x00000001
- tfOnlyXRP: 0x00000002
- tfTrustLine: 0x00000004
- tfTransferable: 0x00000008
description: Enum representing flags for NFTokenMint transactions.
x-enum-descriptions:
tfBurnable: Allow the issuer (or an entity authorized by the issuer) to destroy the minted NFToken. (The NFToken's owner can always do so.)
tfOnlyXRP: The minted NFToken can only be bought or sold for XRP.
tfTrustLine: DEPRECATED Automatically create trust lines from the issuer to hold transfer fees received from transferring the minted NFToken. The fixRemoveNFTokenAutoTrustLine amendment makes it invalid to set this flag.
tfTransferable: The minted NFToken can be transferred to others. If this flag is not enabled, the token can still be transferred from or to the issuer, but a transfer to the issuer must be made based on a buy offer from the issuer and not a sell offer from the NFT holder.
NFTokenMintErrorCode:
$id: NFTokenMintErrorCode
type: string
enum:
- temDISABLED
- temBAD_NFTOKEN_TRANSFER_FEE
- temINVALID_FLAG
- temMALFORMED
- tecNO_ISSUER
- tecNO_PERMISSION
- tecINSUFFICIENT_RESERVE
- tecMAX_SEQUENCE_REACHED
description: Enum representing possible error codes for NFTokenMint transactions.
x-enum-descriptions:
temDISABLED: The NonFungibleTokensV1 amendment is not enabled.
temBAD_NFTOKEN_TRANSFER_FEE: The TransferFee is not within the acceptable range.
temINVALID_FLAG: The Flags value has bits enabled that are not allowed or valid flags. If the fixRemoveNFTokenAutoTrustLine amendment is enabled, the tfTrustLine flag causes this error.
temMALFORMED: The transaction was not validly specified. For example, the URI field is longer than 256 bytes.
tecNO_ISSUER: The Issuer refers to an account that does not exist in the ledger.
tecNO_PERMISSION: The account referenced by the Issuer field has not authorized this transaction's sender (using the NFTokenMinter setting) to mint on their behalf.
tecINSUFFICIENT_RESERVE: The owner would not meet the updated reserve requirement after minting the token.
tecMAX_SEQUENCE_REACHED: The Issuer's MintedNFTokens field is already at its maximum. This is only possible if 2^32-1 NFTokens have been minted in total by the issuer or on their behalf.

0 comments on commit 5665c4c

Please sign in to comment.