mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-06-07 18:56:40 +00:00
docs: export and document asf Flags (#1525)
* docs: export and document asf Flags
This commit is contained in:
@@ -101,6 +101,7 @@
|
||||
- [iso8601ToRippleTime](#iso8601torippletime)
|
||||
- [rippleTimeToISO8601](#rippletimetoiso8601)
|
||||
- [txFlags](#txflags)
|
||||
- [accountSetFlags](#accountsetflags)
|
||||
- [schemaValidator](#schemavalidator)
|
||||
- [schemaValidate](#schemavalidate)
|
||||
- [API Events](#api-events)
|
||||
@@ -6410,6 +6411,21 @@ The remaining transaction types do not have any flags at this time.
|
||||
* PaymentChannelCreate
|
||||
* PaymentChannelFund
|
||||
|
||||
## accountSetFlags
|
||||
|
||||
To modify account flags, you can use an AccountSet transaction and its `SetFlag` or `ClearFlag` fields.
|
||||
|
||||
The flags are called [AccountSet flags (asf*)](https://xrpl.org/accountset.html#accountset-flags):
|
||||
|
||||
`RippleAPI.accountSetFlags.requireDestinationTag`: Require a destination tag to send transactions to this account.
|
||||
`RippleAPI.accountSetFlags.requireAuthorization`: Require authorization for users to hold balances issued by this address. Can only be enabled if the address has no trust lines connected to it.
|
||||
`RippleAPI.accountSetFlags.disallowIncomingXRP`: XRP should not be sent to this account. (Enforced by client applications, not by rippled)
|
||||
`RippleAPI.accountSetFlags.disableMasterKey`: Disallow use of the master key pair. Can only be enabled if the account has configured another way to sign transactions.
|
||||
`RippleAPI.accountSetFlags.enableTransactionIDTracking`: Track the ID of this account's most recent transaction.
|
||||
`RippleAPI.accountSetFlags.noFreeze`: Permanently give up the ability to freeze individual trust lines or disable Global Freeze. This flag can never be disabled after being enabled.
|
||||
`RippleAPI.accountSetFlags.globalFreeze`: Freeze all assets issued by this account.
|
||||
`RippleAPI.accountSetFlags.defaultRipple`: Enable [rippling](https://xrpl.org/rippling.html) on this account's trust lines by default.
|
||||
`RippleAPI.accountSetFlags.depositAuth`:Enable Deposit Authorization on this account.
|
||||
## schemaValidator
|
||||
|
||||
Unlike the rest of the ripple-lib API, schemaValidator is a static object on RippleAPI. It provides utility methods that do not use a server.
|
||||
|
||||
15
docs/src/accountSetFlags.md.ejs
Normal file
15
docs/src/accountSetFlags.md.ejs
Normal file
@@ -0,0 +1,15 @@
|
||||
## accountSetFlags
|
||||
|
||||
To modify account flags, you can use an AccountSet transaction and its `SetFlag` or `ClearFlag` fields.
|
||||
|
||||
The flags are called [AccountSet flags (asf*)](https://xrpl.org/accountset.html#accountset-flags):
|
||||
|
||||
`RippleAPI.accountSetFlags.requireDestinationTag`: Require a destination tag to send transactions to this account.
|
||||
`RippleAPI.accountSetFlags.requireAuthorization`: Require authorization for users to hold balances issued by this address. Can only be enabled if the address has no trust lines connected to it.
|
||||
`RippleAPI.accountSetFlags.disallowIncomingXRP`: XRP should not be sent to this account. (Enforced by client applications, not by rippled)
|
||||
`RippleAPI.accountSetFlags.disableMasterKey`: Disallow use of the master key pair. Can only be enabled if the account has configured another way to sign transactions.
|
||||
`RippleAPI.accountSetFlags.enableTransactionIDTracking`: Track the ID of this account's most recent transaction.
|
||||
`RippleAPI.accountSetFlags.noFreeze`: Permanently give up the ability to freeze individual trust lines or disable Global Freeze. This flag can never be disabled after being enabled.
|
||||
`RippleAPI.accountSetFlags.globalFreeze`: Freeze all assets issued by this account.
|
||||
`RippleAPI.accountSetFlags.defaultRipple`: Enable [rippling](https://xrpl.org/rippling.html) on this account's trust lines by default.
|
||||
`RippleAPI.accountSetFlags.depositAuth`:Enable Deposit Authorization on this account.
|
||||
@@ -66,5 +66,6 @@
|
||||
<%- include('iso8601ToRippleTime.md.ejs') %>
|
||||
<%- include('rippleTimeToISO8601.md.ejs') %>
|
||||
<%- include('txFlags.md.ejs') %>
|
||||
<%- include('accountSetFlags.md.ejs') %>
|
||||
<%- include('schemaValidator.md.ejs') %>
|
||||
<%- include('events.md.ejs') %>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {EventEmitter} from 'events'
|
||||
import {
|
||||
Connection,
|
||||
constants,
|
||||
errors,
|
||||
validate,
|
||||
xrpToDrops,
|
||||
@@ -8,7 +9,7 @@ import {
|
||||
rippleTimeToISO8601,
|
||||
iso8601ToRippleTime,
|
||||
txFlags,
|
||||
ensureClassicAddress
|
||||
ensureClassicAddress,
|
||||
} from './common'
|
||||
import {
|
||||
connect,
|
||||
@@ -487,6 +488,7 @@ class RippleAPI extends EventEmitter {
|
||||
rippleTimeToISO8601 = rippleTimeToISO8601 // @deprecated Invoke from top-level package instead
|
||||
iso8601ToRippleTime = iso8601ToRippleTime // @deprecated Invoke from top-level package instead
|
||||
txFlags = txFlags
|
||||
static accountSetFlags = constants.AccountSetFlags
|
||||
|
||||
isValidAddress = schemaValidator.isValidAddress
|
||||
isValidSecret = schemaValidator.isValidSecret
|
||||
|
||||
@@ -70,7 +70,7 @@ export interface Settings {
|
||||
defaultRipple?: boolean
|
||||
}
|
||||
|
||||
const AccountFlagIndices = {
|
||||
const AccountSetFlags = {
|
||||
requireDestinationTag: txFlagIndices.AccountSet.asfRequireDest,
|
||||
requireAuthorization: txFlagIndices.AccountSet.asfRequireAuth,
|
||||
depositAuth: txFlagIndices.AccountSet.asfDepositAuth,
|
||||
@@ -96,4 +96,4 @@ const AccountFields = {
|
||||
TickSize: {name: 'tickSize', defaults: 0}
|
||||
}
|
||||
|
||||
export {AccountFields, AccountFlagIndices, AccountFlags}
|
||||
export {AccountFields, AccountSetFlags, AccountFlags}
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as assert from 'assert'
|
||||
import BigNumber from 'bignumber.js'
|
||||
import * as utils from './utils'
|
||||
const validate = utils.common.validate
|
||||
const AccountFlagIndices = utils.common.constants.AccountFlagIndices
|
||||
const AccountSetFlags = utils.common.constants.AccountSetFlags
|
||||
const AccountFields = utils.common.constants.AccountFields
|
||||
import {
|
||||
Instructions,
|
||||
@@ -17,14 +17,14 @@ function setTransactionFlags(
|
||||
txJSON: TransactionJSON,
|
||||
values: FormattedSettings
|
||||
) {
|
||||
const keys = Object.keys(values).filter((key) => AccountFlagIndices[key] != null)
|
||||
const keys = Object.keys(values).filter((key) => AccountSetFlags[key] != null)
|
||||
assert.ok(
|
||||
keys.length <= 1,
|
||||
'ERROR: can only set one setting per transaction'
|
||||
)
|
||||
const flagName = keys[0]
|
||||
const value = values[flagName]
|
||||
const index = AccountFlagIndices[flagName]
|
||||
const index = AccountSetFlags[flagName]
|
||||
if (index != null) {
|
||||
if (value) {
|
||||
txJSON.SetFlag = index
|
||||
|
||||
Reference in New Issue
Block a user