File tree Expand file tree Collapse file tree 3 files changed +49
-6
lines changed
packages/xrpl/test/integration Expand file tree Collapse file tree 3 files changed +49
-6
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ online_delete=256
101101# Devnet amendments as of June 28th, 2023
102102NegativeUNL
103103fixRemoveNFTokenAutoTrustLine
104- NonFungibleTokensV1
105104CheckCashMakesTrustLine
106105fixRmSmallIncreasedQOffers
107106fixSTAmountCanonicalize
@@ -144,10 +143,8 @@ fix1512
144143fix1373
145144MultiSign
146145Checks
147- NonFungibleTokensV1_1
148146# 1.10.0 Amendments
149147DisallowIncoming
150- fixNonFungibleTokensV1_2
151148fixTrustLinesToSelf
152149fixUniversalNumber
153150ImmediateOfferKilled
@@ -158,7 +155,6 @@ ExpandedSignerList
158155AMM
159156Clawback
160157fixReducedOffersV1
161- fixNFTokenRemint
162158# 2.0.0 Amendments
163159XChainBridge
164160DID
@@ -188,7 +184,6 @@ PermissionedDomains
188184fixFrozenLPTokenTransfer
189185fixInvalidTxFlags
190186# 2.5.0 Amendments
191- PermissionDelegation
192187Batch
193188PermissionedDEX
194189TokenEscrow
Original file line number Diff line number Diff line change @@ -15,7 +15,11 @@ import {
1515 teardownClient ,
1616 type XrplIntegrationTestContext ,
1717} from '../setup'
18- import { generateFundedWallet , testTransaction } from '../utils'
18+ import {
19+ generateFundedWallet ,
20+ isAmendmentEnabled ,
21+ testTransaction ,
22+ } from '../utils'
1923
2024// how long before each test case times out
2125const TIMEOUT = 20000
@@ -37,6 +41,18 @@ describe('DelegateSet', function () {
3741 it (
3842 'base' ,
3943 async ( ) => {
44+ const isEnabled = await isAmendmentEnabled (
45+ testContext . client ,
46+ 'PermissionDelegation' ,
47+ )
48+ if ( ! isEnabled ) {
49+ // eslint-disable-next-line no-console -- Informing user about skipped test
50+ console . warn (
51+ 'Skipping DelegateSet test: PermissionDelegation amendment is not enabled on the server' ,
52+ )
53+ return
54+ }
55+
4056 // Authorize Bob account to execute Payment transactions and
4157 // modify the domain of an account behalf of Alice's account.
4258 const delegateTx : DelegateSet = {
Original file line number Diff line number Diff line change @@ -93,6 +93,38 @@ export function subscribeDone(client: Client): void {
9393 client . removeAllListeners ( )
9494}
9595
96+ /**
97+ * Checks if a specific amendment is enabled on the server.
98+ *
99+ * @param client - The XRPL client.
100+ * @param amendmentName - The name of the amendment to check (e.g., 'PermissionDelegation').
101+ * @returns True if the amendment is enabled, false otherwise.
102+ */
103+ export async function isAmendmentEnabled (
104+ client : Client ,
105+ amendmentName : string ,
106+ ) : Promise < boolean > {
107+ try {
108+ const featureResponse = await client . request ( {
109+ command : 'feature' ,
110+ } )
111+
112+ // Search through all features to find the one with the matching name
113+ const features = featureResponse . result . features
114+ for ( const feature of Object . values ( features ) ) {
115+ if ( feature . name === amendmentName ) {
116+ return feature . enabled
117+ }
118+ }
119+
120+ // Amendment not found
121+ return false
122+ } catch ( error ) {
123+ // If the feature command fails, assume the amendment is not enabled
124+ return false
125+ }
126+ }
127+
96128export async function submitTransaction ( {
97129 client,
98130 transaction,
You can’t perform that action at this time.
0 commit comments