mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-06 13:55:49 +00:00
Support for the Deposit Authorization account root flag (#852)
* Add depositAuth flag tests * Add support for depositAuth flag
This commit is contained in:
@@ -479,7 +479,8 @@ See [Transaction Types](#transaction-types) for a description.
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
defaultRipple | boolean | *Optional* Enable [rippling](https://ripple.com/knowledge_center/understanding-the-noripple-flag/) on this account’s trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))
|
||||
defaultRipple | boolean | *Optional* Enable [rippling](https://ripple.com/build/understanding-the-noripple-flag/) on this account’s trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))
|
||||
depositAuth | boolean | *Optional* Enable [Deposit Authorization](https://ripple.com/build/deposit-authorization/) on this account. If set, transactions cannot send value of any kind to this account unless the sender of those transactions is the account itself. (Requires the [DepositAuth amendment](https://ripple.com/build/known-amendments/#depositauth))
|
||||
disableMasterKey | boolean | *Optional* Disallows use of the master key to sign transactions for this account.
|
||||
disallowIncomingXRP | boolean | *Optional* Indicates that client applications should not send XRP to this account. Not enforced by rippled.
|
||||
domain | string | *Optional* The domain that owns this account, as a hexadecimal string representing the ASCII for the domain in lowercase.
|
||||
@@ -2718,7 +2719,8 @@ This method returns a promise that resolves with an array of objects with the fo
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
defaultRipple | boolean | *Optional* Enable [rippling](https://ripple.com/knowledge_center/understanding-the-noripple-flag/) on this account’s trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))
|
||||
defaultRipple | boolean | *Optional* Enable [rippling](https://ripple.com/build/understanding-the-noripple-flag/) on this account’s trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))
|
||||
depositAuth | boolean | *Optional* Enable [Deposit Authorization](https://ripple.com/build/deposit-authorization/) on this account. If set, transactions cannot send value of any kind to this account unless the sender of those transactions is the account itself. (Requires the [DepositAuth amendment](https://ripple.com/build/known-amendments/#depositauth))
|
||||
disableMasterKey | boolean | *Optional* Disallows use of the master key to sign transactions for this account.
|
||||
disallowIncomingXRP | boolean | *Optional* Indicates that client applications should not send XRP to this account. Not enforced by rippled.
|
||||
domain | string | *Optional* The domain that owns this account, as a hexadecimal string representing the ASCII for the domain in lowercase.
|
||||
|
||||
@@ -4,7 +4,8 @@ import {txFlagIndices} from './txflags'
|
||||
const accountRootFlags = {
|
||||
PasswordSpent: 0x00010000, // password set fee is spent
|
||||
RequireDestTag: 0x00020000, // require a DestinationTag for payments
|
||||
RequireAuth: 0x00040000, // require a authorization to hold IOUs
|
||||
RequireAuth: 0x00040000, // require authorization to hold IOUs
|
||||
DepositAuth: 0x01000000, // require account to auth deposits
|
||||
DisallowXRP: 0x00080000, // disallow sending XRP
|
||||
DisableMaster: 0x00100000, // force regular key
|
||||
NoFreeze: 0x00200000, // permanently disallowed freezing trustlines
|
||||
@@ -16,6 +17,7 @@ const AccountFlags = {
|
||||
passwordSpent: accountRootFlags.PasswordSpent,
|
||||
requireDestinationTag: accountRootFlags.RequireDestTag,
|
||||
requireAuthorization: accountRootFlags.RequireAuth,
|
||||
depositAuth: accountRootFlags.DepositAuth,
|
||||
disallowIncomingXRP: accountRootFlags.DisallowXRP,
|
||||
disableMasterKey: accountRootFlags.DisableMaster,
|
||||
noFreeze: accountRootFlags.NoFreeze,
|
||||
@@ -26,6 +28,7 @@ const AccountFlags = {
|
||||
const AccountFlagIndices = {
|
||||
requireDestinationTag: txFlagIndices.AccountSet.asfRequireDest,
|
||||
requireAuthorization: txFlagIndices.AccountSet.asfRequireAuth,
|
||||
depositAuth: txFlagIndices.AccountSet.asfDepositAuth,
|
||||
disallowIncomingXRP: txFlagIndices.AccountSet.asfDisallowXRP,
|
||||
disableMasterKey: txFlagIndices.AccountSet.asfDisableMaster,
|
||||
enableTransactionIDTracking: txFlagIndices.AccountSet.asfAccountTxnID,
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
"properties": {
|
||||
"defaultRipple": {
|
||||
"type": "boolean",
|
||||
"description": "Enable [rippling](https://ripple.com/knowledge_center/understanding-the-noripple-flag/) on this account’s trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))"
|
||||
"description": "Enable [rippling](https://ripple.com/build/understanding-the-noripple-flag/) on this account’s trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))"
|
||||
},
|
||||
"depositAuth": {
|
||||
"type": "boolean",
|
||||
"description": "Enable [Deposit Authorization](https://ripple.com/build/deposit-authorization/) on this account. If set, transactions cannot send value of any kind to this account unless the sender of those transactions is the account itself. (Requires the [DepositAuth amendment](https://ripple.com/build/known-amendments/#depositauth))"
|
||||
},
|
||||
"disableMasterKey": {
|
||||
"type": "boolean",
|
||||
|
||||
@@ -55,7 +55,8 @@ const txFlagIndices = {
|
||||
asfAccountTxnID: 5,
|
||||
asfNoFreeze: 6,
|
||||
asfGlobalFreeze: 7,
|
||||
asfDefaultRipple: 8
|
||||
asfDefaultRipple: 8,
|
||||
asfDepositAuth: 9
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ type GetSettings = {
|
||||
passwordSpent?: boolean,
|
||||
requireDestinationTag?: boolean,
|
||||
requireAuthorization?: boolean,
|
||||
depositAuthorization?: boolean,
|
||||
disallowIncomingXRP?: boolean,
|
||||
disableMasterKey?: boolean,
|
||||
enableTransactionIDTracking?: boolean,
|
||||
|
||||
@@ -42,6 +42,7 @@ type Settings = {
|
||||
passwordSpent?: boolean,
|
||||
requireDestinationTag?: boolean,
|
||||
requireAuthorization?: boolean,
|
||||
depositAuthorization?: boolean,
|
||||
disallowIncomingXRP?: boolean,
|
||||
disableMasterKey?: boolean,
|
||||
enableTransactionIDTracking?: boolean,
|
||||
|
||||
@@ -233,6 +233,18 @@ describe('RippleAPI', function () {
|
||||
_.partial(checkResult, responses.prepareSettings.flagClear, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings - set depositAuth flag', function () {
|
||||
const settings = { depositAuth: true };
|
||||
return this.api.prepareSettings(address, settings, instructions).then(
|
||||
_.partial(checkResult, responses.prepareSettings.flagSetDepositAuth, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings - clear depositAuth flag', function () {
|
||||
const settings = { depositAuth: false };
|
||||
return this.api.prepareSettings(address, settings, instructions).then(
|
||||
_.partial(checkResult, responses.prepareSettings.flagClearDepositAuth, 'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSettings - integer field clear', function () {
|
||||
const settings = { transferRate: null };
|
||||
return this.api.prepareSettings(address, settings, instructions)
|
||||
|
||||
2
test/fixtures/responses/index.js
vendored
2
test/fixtures/responses/index.js
vendored
@@ -104,6 +104,8 @@ module.exports = {
|
||||
flagsMultisign: require('./prepare-settings-multisign.json'),
|
||||
flagSet: require('./prepare-settings-flag-set.json'),
|
||||
flagClear: require('./prepare-settings-flag-clear.json'),
|
||||
flagSetDepositAuth: require('./prepare-settings-flag-set-deposit-auth.json'),
|
||||
flagClearDepositAuth: require('./prepare-settings-flag-clear-deposit-auth.json'),
|
||||
setTransferRate: require('./prepare-settings-set-transfer-rate.json'),
|
||||
fieldClear: require('./prepare-settings-field-clear.json'),
|
||||
noInstructions: require('./prepare-settings-no-instructions.json'),
|
||||
|
||||
8
test/fixtures/responses/prepare-settings-flag-clear-deposit-auth.json
vendored
Normal file
8
test/fixtures/responses/prepare-settings-flag-clear-deposit-auth.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"ClearFlag\":9,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
8
test/fixtures/responses/prepare-settings-flag-set-deposit-auth.json
vendored
Normal file
8
test/fixtures/responses/prepare-settings-flag-set-deposit-auth.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"SetFlag\":9,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
"maxLedgerVersion": 8820051
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user