66 LEDGER_ENTRY_WIDTH ,
77 TRANSACTION_TYPE_WIDTH ,
88 TRANSACTION_RESULT_WIDTH ,
9+ DELEGATABLE_PERMISSIONS_WIDTH ,
910} from './constants'
1011
1112interface DefinitionsData {
@@ -35,6 +36,10 @@ class XrplDefinitionsBase {
3536 transactionNames : string [ ]
3637 // Maps serializable types to their TypeScript class implementation
3738 dataTypes : Record < string , typeof SerializedType >
39+ // Maps granular permissions names to their corresponding integer ids
40+ granularPermissions : Record < string , number >
41+ // Defined delegatable permissions
42+ delegatablePermissions : BytesLookup
3843
3944 /**
4045 * Present rippled types in a typed and updatable format.
@@ -75,6 +80,36 @@ class XrplDefinitionsBase {
7580
7681 this . dataTypes = { } // Filled in via associateTypes
7782 this . associateTypes ( types )
83+
84+ this . granularPermissions = {
85+ TrustlineAuthorize : 65537 ,
86+ TrustlineFreeze : 65538 ,
87+ TrustlineUnfreeze : 65539 ,
88+ AccountDomainSet : 65540 ,
89+ AccountEmailHashSet : 65541 ,
90+ AccountMessageKeySet : 65542 ,
91+ AccountTransferRateSet : 65543 ,
92+ AccountTickSizeSet : 65544 ,
93+ PaymentMint : 65545 ,
94+ PaymentBurn : 65546 ,
95+ MPTokenIssuanceLock : 65547 ,
96+ MPTokenIssuanceUnlock : 65548 ,
97+ }
98+
99+ const incrementedTransactionTypes = Object . fromEntries (
100+ Object . entries ( enums . TRANSACTION_TYPES ) . map ( ( [ key , value ] ) => [
101+ key ,
102+ value + 1 ,
103+ ] ) ,
104+ )
105+ const combinedPermissions = {
106+ ...this . granularPermissions ,
107+ ...incrementedTransactionTypes ,
108+ }
109+ this . delegatablePermissions = new BytesLookup (
110+ combinedPermissions ,
111+ DELEGATABLE_PERMISSIONS_WIDTH ,
112+ )
78113 }
79114
80115 /**
@@ -94,6 +129,7 @@ class XrplDefinitionsBase {
94129 this . field [ 'TransactionType' ] . associatedType = this . transactionType
95130 this . field [ 'TransactionResult' ] . associatedType = this . transactionResult
96131 this . field [ 'LedgerEntryType' ] . associatedType = this . ledgerEntryType
132+ this . field [ 'PermissionValue' ] . associatedType = this . delegatablePermissions
97133 }
98134
99135 public getAssociatedTypes ( ) : Record < string , typeof SerializedType > {
0 commit comments