mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-04 21:15:47 +00:00
Add support for disallowIncoming flags (#2221)
* Add support for disallowIncoming flags * Fix broken tests * Update packages/xrpl/src/models/ledger/AccountRoot.ts * Update packages/xrpl/src/models/ledger/AccountRoot.ts * Update HISTORY.md
This commit is contained in:
@@ -26,6 +26,7 @@ Wallet.fromMmnemonic()
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
* Optional custom amount field to `fundWallet`.
|
* Optional custom amount field to `fundWallet`.
|
||||||
|
* Support for `disallowIncoming` account set flags (e.g. `asfDisallowIncomingTrustline`)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Add support for Transaction objects in `verifyTransaction`
|
* Add support for Transaction objects in `verifyTransaction`
|
||||||
|
|||||||
@@ -116,6 +116,22 @@ export interface AccountRootFlagsInterface {
|
|||||||
* (It has DepositAuth enabled.)
|
* (It has DepositAuth enabled.)
|
||||||
*/
|
*/
|
||||||
lsfDepositAuth?: boolean
|
lsfDepositAuth?: boolean
|
||||||
|
/**
|
||||||
|
* Disallow incoming NFTOffers from other accounts.
|
||||||
|
*/
|
||||||
|
lsfDisallowIncomingNFTOffer?: boolean
|
||||||
|
/**
|
||||||
|
* Disallow incoming Checks from other accounts.
|
||||||
|
*/
|
||||||
|
lsfDisallowIncomingCheck?: boolean
|
||||||
|
/**
|
||||||
|
* Disallow incoming PayChannels from other accounts.
|
||||||
|
*/
|
||||||
|
lsfDisallowIncomingPayChan?: boolean
|
||||||
|
/**
|
||||||
|
* Disallow incoming Trustlines from other accounts.
|
||||||
|
*/
|
||||||
|
lsfDisallowIncomingTrustline?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AccountRootFlags {
|
export enum AccountRootFlags {
|
||||||
@@ -156,4 +172,20 @@ export enum AccountRootFlags {
|
|||||||
* (It has DepositAuth enabled.)
|
* (It has DepositAuth enabled.)
|
||||||
*/
|
*/
|
||||||
lsfDepositAuth = 0x01000000,
|
lsfDepositAuth = 0x01000000,
|
||||||
|
/**
|
||||||
|
* Disallow incoming NFTOffers from other accounts.
|
||||||
|
*/
|
||||||
|
lsfDisallowIncomingNFTOffer = 0x04000000,
|
||||||
|
/**
|
||||||
|
* Disallow incoming Checks from other accounts.
|
||||||
|
*/
|
||||||
|
lsfDisallowIncomingCheck = 0x08000000,
|
||||||
|
/**
|
||||||
|
* Disallow incoming PayChannels from other accounts.
|
||||||
|
*/
|
||||||
|
lsfDisallowIncomingPayChan = 0x10000000,
|
||||||
|
/**
|
||||||
|
* Disallow incoming Trustlines from other accounts.
|
||||||
|
*/
|
||||||
|
lsfDisallowIncomingTrustline = 0x20000000,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,15 @@ export enum AccountSetAsfFlags {
|
|||||||
* Allow another account to mint and burn tokens on behalf of this account.
|
* Allow another account to mint and burn tokens on behalf of this account.
|
||||||
*/
|
*/
|
||||||
asfAuthorizedNFTokenMinter = 10,
|
asfAuthorizedNFTokenMinter = 10,
|
||||||
|
/** asf 11 is reserved for Hooks amendment */
|
||||||
|
/** Disallow other accounts from creating incoming NFTOffers */
|
||||||
|
asfDisallowIncomingNFTOffer = 12,
|
||||||
|
/** Disallow other accounts from creating incoming Checks */
|
||||||
|
asfDisallowIncomingCheck = 13,
|
||||||
|
/** Disallow other accounts from creating incoming PayChannels */
|
||||||
|
asfDisallowIncomingPayChan = 14,
|
||||||
|
/** Disallow other accounts from creating incoming Trustlines */
|
||||||
|
asfDisallowIncomingTrustline = 15,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ describe('AccountSet', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it(`throws w/ invalid SetFlag (out of range)`, function () {
|
it(`throws w/ invalid SetFlag (out of range)`, function () {
|
||||||
account.SetFlag = 12
|
account.SetFlag = 20
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => validateAccountSet(account),
|
() => validateAccountSet(account),
|
||||||
@@ -60,7 +60,7 @@ describe('AccountSet', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it(`throws w/ invalid ClearFlag`, function () {
|
it(`throws w/ invalid ClearFlag`, function () {
|
||||||
account.ClearFlag = 12
|
account.ClearFlag = 20
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => validateAccountSet(account),
|
() => validateAccountSet(account),
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ describe('Models Utils', function () {
|
|||||||
assert.strictEqual(tx.Flags, 0)
|
assert.strictEqual(tx.Flags, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// eslint-disable-next-line complexity -- Simpler to list them all out at once.
|
||||||
it('parseAccountRootFlags all enabled', function () {
|
it('parseAccountRootFlags all enabled', function () {
|
||||||
const accountRootFlags =
|
const accountRootFlags =
|
||||||
AccountRootFlags.lsfDefaultRipple |
|
AccountRootFlags.lsfDefaultRipple |
|
||||||
@@ -161,7 +162,11 @@ describe('Models Utils', function () {
|
|||||||
AccountRootFlags.lsfNoFreeze |
|
AccountRootFlags.lsfNoFreeze |
|
||||||
AccountRootFlags.lsfPasswordSpent |
|
AccountRootFlags.lsfPasswordSpent |
|
||||||
AccountRootFlags.lsfRequireAuth |
|
AccountRootFlags.lsfRequireAuth |
|
||||||
AccountRootFlags.lsfRequireDestTag
|
AccountRootFlags.lsfRequireDestTag |
|
||||||
|
AccountRootFlags.lsfDisallowIncomingNFTOffer |
|
||||||
|
AccountRootFlags.lsfDisallowIncomingCheck |
|
||||||
|
AccountRootFlags.lsfDisallowIncomingPayChan |
|
||||||
|
AccountRootFlags.lsfDisallowIncomingTrustline
|
||||||
|
|
||||||
const parsed = parseAccountRootFlags(accountRootFlags)
|
const parsed = parseAccountRootFlags(accountRootFlags)
|
||||||
|
|
||||||
@@ -174,7 +179,11 @@ describe('Models Utils', function () {
|
|||||||
parsed.lsfNoFreeze &&
|
parsed.lsfNoFreeze &&
|
||||||
parsed.lsfPasswordSpent &&
|
parsed.lsfPasswordSpent &&
|
||||||
parsed.lsfRequireAuth &&
|
parsed.lsfRequireAuth &&
|
||||||
parsed.lsfRequireDestTag,
|
parsed.lsfRequireDestTag &&
|
||||||
|
parsed.lsfDisallowIncomingNFTOffer &&
|
||||||
|
parsed.lsfDisallowIncomingCheck &&
|
||||||
|
parsed.lsfDisallowIncomingPayChan &&
|
||||||
|
parsed.lsfDisallowIncomingTrustline,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -190,6 +199,10 @@ describe('Models Utils', function () {
|
|||||||
assert.isUndefined(parsed.lsfPasswordSpent)
|
assert.isUndefined(parsed.lsfPasswordSpent)
|
||||||
assert.isUndefined(parsed.lsfRequireAuth)
|
assert.isUndefined(parsed.lsfRequireAuth)
|
||||||
assert.isUndefined(parsed.lsfRequireDestTag)
|
assert.isUndefined(parsed.lsfRequireDestTag)
|
||||||
|
assert.isUndefined(parsed.lsfDisallowIncomingNFTOffer)
|
||||||
|
assert.isUndefined(parsed.lsfDisallowIncomingCheck)
|
||||||
|
assert.isUndefined(parsed.lsfDisallowIncomingPayChan)
|
||||||
|
assert.isUndefined(parsed.lsfDisallowIncomingTrustline)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user