Skip to content

Commit b6eb061

Browse files
authored
Merge branch 'main' into nftmintoffer
2 parents 3a3b0e4 + 23d26c8 commit b6eb061

File tree

15 files changed

+471
-99
lines changed

15 files changed

+471
-99
lines changed

.ci-config/rippled.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,4 @@ fixNFTokenPageLinks
188188
fixInnerObjTemplate2
189189
fixEnforceNFTokenTrustline
190190
fixReducedOffersV2
191+
DynamicNFT

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name: Node.js CI
55

66
env:
7-
RIPPLED_DOCKER_IMAGE: rippleci/rippled:2.3.0-rc1
7+
RIPPLED_DOCKER_IMAGE: rippleci/rippled:develop
88

99
on:
1010
push:

packages/ripple-binary-codec/HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
### Added
1313
* Support for the Price Oracles amendment (XLS-47).
14+
* Add `NFTokenModify` transaction and add `tfMutable` flag in `NFTokenMint`
1415

1516
### Fixed
1617
* Better error handling/error messages for serialization/deserialization errors.

packages/ripple-binary-codec/src/enums/definitions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3085,6 +3085,7 @@
30853085
"NFTokenCancelOffer": 28,
30863086
"NFTokenCreateOffer": 27,
30873087
"NFTokenMint": 25,
3088+
"NFTokenModify": 61,
30883089
"OfferCancel": 8,
30893090
"OfferCreate": 7,
30903091
"OracleDelete": 52,

packages/xrpl/HISTORY.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xrpl-announce) for release announcements. We recommend that xrpl.js (ripple-lib) users stay up-to-date with the latest stable release.
44

5-
## Unreleased Changes
5+
## Unreleased
6+
7+
### Added
8+
* Adds utility function `convertTxFlagsToNumber`
9+
10+
### Changed
11+
* Deprecated `setTransactionFlagsToNumber`. Start using convertTxFlagsToNumber instead
612

713
### Added
814
* Support for XLS-52 (NFTokenMintOffer)
@@ -14,6 +20,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
1420
* New `MPTAmount` type support for `Payment` and `Clawback` transactions
1521
* `parseTransactionFlags` as a utility function in the xrpl package to streamline transactions flags-to-map conversion
1622
* Support for XLS-70d (Credentials)
23+
* Add `NFTokenModify` transaction and add `tfMutable` flag in `NFTokenMint`
1724

1825
### Fixed
1926
* `TransactionStream` model supports APIv2

packages/xrpl/src/client/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import type {
4747
OnEventToListenerMap,
4848
} from '../models/methods/subscribe'
4949
import type { SubmittableTransaction } from '../models/transactions'
50-
import { setTransactionFlagsToNumber } from '../models/utils/flags'
50+
import { convertTxFlagsToNumber } from '../models/utils/flags'
5151
import {
5252
ensureClassicAddress,
5353
submitRequest,
@@ -665,7 +665,7 @@ class Client extends EventEmitter<EventTypes> {
665665
const tx = { ...transaction }
666666

667667
setValidAddresses(tx)
668-
setTransactionFlagsToNumber(tx)
668+
tx.Flags = convertTxFlagsToNumber(tx)
669669

670670
const promises: Array<Promise<void>> = []
671671
if (tx.NetworkID == null) {

packages/xrpl/src/models/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*/
99
export * as LedgerEntry from './ledger'
1010
export {
11-
setTransactionFlagsToNumber,
1211
parseAccountRootFlags,
12+
setTransactionFlagsToNumber,
13+
convertTxFlagsToNumber,
1314
parseTransactionFlags,
1415
} from './utils/flags'
1516
export * from './methods'

packages/xrpl/src/models/transactions/NFTokenMint.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export enum NFTokenMintFlags {
4141
* issuer.
4242
*/
4343
tfTransferable = 0x00000008,
44+
/**
45+
* If set, indicates that this NFT's URI can be modified.
46+
*/
47+
tfMutable = 0x00000010,
4448
}
4549

4650
/**
@@ -54,6 +58,7 @@ export interface NFTokenMintFlagsInterface extends GlobalFlags {
5458
tfOnlyXRP?: boolean
5559
tfTrustLine?: boolean
5660
tfTransferable?: boolean
61+
tfMutable?: boolean
5762
}
5863

5964
/**
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { ValidationError } from '../../errors'
2+
import { isHex } from '../utils'
3+
4+
import {
5+
BaseTransaction,
6+
validateBaseTransaction,
7+
isAccount,
8+
isString,
9+
validateOptionalField,
10+
Account,
11+
validateRequiredField,
12+
} from './common'
13+
14+
/**
15+
* The NFTokenModify transaction modifies an NFToken's URI
16+
* if its tfMutable is set to true.
17+
*/
18+
export interface NFTokenModify extends BaseTransaction {
19+
TransactionType: 'NFTokenModify'
20+
/**
21+
* Identifies the NFTokenID of the NFToken object that the
22+
* offer references.
23+
*/
24+
NFTokenID: string
25+
/**
26+
* Indicates the AccountID of the account that owns the corresponding NFToken.
27+
* Can be omitted if the owner is the account submitting this transaction
28+
*/
29+
Owner?: Account
30+
/**
31+
* URI that points to the data and/or metadata associated with the NFT.
32+
* This field need not be an HTTP or HTTPS URL; it could be an IPFS URI, a
33+
* magnet link, immediate data encoded as an RFC2379 "data" URL, or even an
34+
* opaque issuer-specific encoding. The URI is NOT checked for validity, but
35+
* the field is limited to a maximum length of 256 bytes.
36+
*
37+
* This field must be hex-encoded. You can use `convertStringToHex` to
38+
* convert this field to the proper encoding.
39+
*
40+
* This field must not be an empty string. Omit it from the transaction or
41+
* set to `undefined` value if you do not use it.
42+
*/
43+
URI?: string | null
44+
}
45+
46+
/**
47+
* Verify the form and type of an NFTokenModify at runtime.
48+
*
49+
* @param tx - An NFTokenModify Transaction.
50+
* @throws When the NFTokenModify is Malformed.
51+
*/
52+
export function validateNFTokenModify(tx: Record<string, unknown>): void {
53+
validateBaseTransaction(tx)
54+
55+
validateRequiredField(tx, 'NFTokenID', isString)
56+
validateOptionalField(tx, 'Owner', isAccount)
57+
validateOptionalField(tx, 'URI', isString)
58+
59+
if (tx.URI !== undefined && typeof tx.URI === 'string') {
60+
if (tx.URI === '') {
61+
throw new ValidationError('NFTokenModify: URI must not be empty string')
62+
}
63+
if (!isHex(tx.URI)) {
64+
throw new ValidationError('NFTokenModify: URI must be in hex format')
65+
}
66+
}
67+
}

packages/xrpl/src/models/transactions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export {
7171
NFTokenMintFlags,
7272
NFTokenMintFlagsInterface,
7373
} from './NFTokenMint'
74+
export { NFTokenModify, validateNFTokenModify } from './NFTokenModify'
7475
export { OfferCancel } from './offerCancel'
7576
export {
7677
OfferCreateFlags,

0 commit comments

Comments
 (0)