evernode-js-client 0.5.17-beta-v3.3 → 0.5.17-beta-v3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +427 -310
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -11725,7 +11725,7 @@ const { Buffer } = __nccwpck_require__(4300);
11725
11725
  const { XrplApi } = __nccwpck_require__(1850);
11726
11726
  const { XrplAccount } = __nccwpck_require__(9329);
11727
11727
  const { XrplApiEvents, XrplConstants } = __nccwpck_require__(3307);
11728
- const { EvernodeEvents, MemoTypes, MemoFormats, EvernodeConstants, HookStateKeys } = __nccwpck_require__(9849);
11728
+ const { EvernodeEvents, EventTypes, MemoFormats, EvernodeConstants, HookStateKeys, HookParamKeys } = __nccwpck_require__(9849);
11729
11729
  const { DefaultValues } = __nccwpck_require__(8262);
11730
11730
  const { EncryptionHelper } = __nccwpck_require__(4832);
11731
11731
  const { EventEmitter } = __nccwpck_require__(6170);
@@ -11735,13 +11735,16 @@ const { StateHelpers } = __nccwpck_require__(3860);
11735
11735
  const { EvernodeHelpers } = __nccwpck_require__(2523);
11736
11736
  const { HookHelpers } = __nccwpck_require__(4675);
11737
11737
 
11738
- const CANDIDATE_PROPOSE_UNIQUE_ID_MEMO_OFFSET = 0;
11739
- const CANDIDATE_PROPOSE_SHORT_NAME_MEMO_OFFSET = 32;
11740
- const CANDIDATE_PROPOSE_KEYLETS_MEMO_OFFSET = 52;
11741
- const CANDIDATE_PROPOSE_MEMO_SIZE = 154;
11738
+ const CANDIDATE_PROPOSE_HASHES_PARAM_OFFSET = 0;
11739
+ const CANDIDATE_PROPOSE_KEYLETS_PARAM_OFFSET = 96;
11740
+ const CANDIDATE_PROPOSE_UNIQUE_ID_PARAM_OFFSET = 198;
11741
+ const CANDIDATE_PROPOSE_SHORT_NAME_PARAM_OFFSET = 230;
11742
+ const CANDIDATE_PROPOSE_PARAM_SIZE = 250;
11742
11743
 
11743
11744
  const DUD_HOST_CANDID_ADDRESS_OFFSET = 12;
11744
11745
 
11746
+ const MAX_HOOK_PARAM_SIZE = 128;
11747
+
11745
11748
  class BaseEvernodeClient {
11746
11749
 
11747
11750
  #watchEvents;
@@ -11959,11 +11962,18 @@ class BaseEvernodeClient {
11959
11962
  /**
11960
11963
  * Extracts the transaction info from a given transaction.
11961
11964
  * @param {object} tx Transaction to be deserialized and extracted.
11962
- * @returns The event object in the format {name: '', data: {}}. Returns null if not handled. Note: You need to deserialize memos before passing the transaction to this function.
11965
+ * @returns The event object in the format {name: '', data: {}}. Returns null if not handled. Note: You need to deserialize HookParameters before passing the transaction to this function.
11963
11966
  */
11964
11967
  async extractEvernodeEvent(tx) {
11965
- if (tx.TransactionType === 'URITokenBuy' && tx.Memos.length >= 1 &&
11966
- tx.Memos[0].type === MemoTypes.ACQUIRE_LEASE && tx.Memos[0].format === MemoFormats.BASE64 && tx.Memos[0].data) {
11968
+ let eventType;
11969
+ let eventData;
11970
+ if (tx.HookParameters.length) {
11971
+ eventType = tx.HookParameters.find(p => p.name === HookParamKeys.PARAM_EVENT_TYPE_KEY)?.value;
11972
+ eventData = tx.HookParameters.find(p => p.name === HookParamKeys.PARAM_EVENT_DATA1_KEY)?.value;
11973
+ eventData += tx.HookParameters.find(p => p.name === HookParamKeys.PARAM_EVENT_DATA2_KEY)?.value ?? '';
11974
+ }
11975
+ if (tx.TransactionType === 'URITokenBuy' && eventType === EventTypes.ACQUIRE_LEASE && tx.Memos.length &&
11976
+ tx.Memos[0].type === EventTypes.ACQUIRE_LEASE && tx.Memos[0].format === MemoFormats.BASE64 && tx.Memos[0].data) {
11967
11977
 
11968
11978
  // If our account is the destination host account, then decrypt the payload.
11969
11979
  let payload = tx.Memos[0].data;
@@ -11989,12 +11999,11 @@ class BaseEvernodeClient {
11989
11999
  }
11990
12000
  }
11991
12001
 
11992
- else if (tx.Memos.length >= 2 &&
11993
- tx.Memos[0].type === MemoTypes.ACQUIRE_SUCCESS && tx.Memos[0].data &&
11994
- tx.Memos[1].type === MemoTypes.ACQUIRE_REF && tx.Memos[1].data) {
12002
+ else if (eventType === EventTypes.ACQUIRE_SUCCESS && eventData && tx.Memos.length &&
12003
+ tx.Memos[0].type === EventTypes.ACQUIRE_SUCCESS && tx.Memos[0].data) {
11995
12004
 
11996
12005
  let payload = tx.Memos[0].data;
11997
- const acquireRefId = tx.Memos[1].data;
12006
+ const acquireRefId = eventData;
11998
12007
 
11999
12008
  // If our account is the destination user account, then decrypt the payload.
12000
12009
  if (tx.Memos[0].format === MemoFormats.BASE64 && tx.Destination === this.xrplAcc.address) {
@@ -12015,12 +12024,11 @@ class BaseEvernodeClient {
12015
12024
  }
12016
12025
 
12017
12026
  }
12018
- else if (tx.Memos.length >= 2 &&
12019
- tx.Memos[0].type === MemoTypes.ACQUIRE_ERROR && tx.Memos[0].data &&
12020
- tx.Memos[1].type === MemoTypes.ACQUIRE_REF && tx.Memos[1].data) {
12027
+ else if (eventType === EventTypes.ACQUIRE_ERROR && eventData && tx.Memos.length &&
12028
+ tx.Memos[0].type === EventTypes.ACQUIRE_ERROR && tx.Memos[0].data) {
12021
12029
 
12022
12030
  let error = tx.Memos[0].data;
12023
- const acquireRefId = tx.Memos[1].data;
12031
+ const acquireRefId = eventData;
12024
12032
 
12025
12033
  if (tx.Memos[0].format === MemoFormats.JSON)
12026
12034
  error = JSON.parse(error).reason;
@@ -12034,8 +12042,7 @@ class BaseEvernodeClient {
12034
12042
  }
12035
12043
  }
12036
12044
  }
12037
- else if (tx.Memos.length >= 1 &&
12038
- tx.Memos[0].type === MemoTypes.HOST_REG && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12045
+ else if (eventType === EventTypes.HOST_REG && eventData) {
12039
12046
 
12040
12047
  return {
12041
12048
  name: EvernodeEvents.HostRegistered,
@@ -12045,7 +12052,7 @@ class BaseEvernodeClient {
12045
12052
  }
12046
12053
  }
12047
12054
  }
12048
- else if (tx.Memos.length >= 1 && tx.Memos[0].type === MemoTypes.HOST_DEREG) {
12055
+ else if (eventType === EventTypes.HOST_DEREG && eventData) {
12049
12056
  return {
12050
12057
  name: EvernodeEvents.HostDeregistered,
12051
12058
  data: {
@@ -12054,14 +12061,13 @@ class BaseEvernodeClient {
12054
12061
  }
12055
12062
  }
12056
12063
  }
12057
- else if (tx.Memos.length >= 1 &&
12058
- tx.Memos[0].type === MemoTypes.HEARTBEAT) {
12064
+ else if (eventType === EventTypes.HEARTBEAT) {
12059
12065
 
12060
- const voteInfo = (tx.Memos[0].data && tx.Memos[0].data.length) ?
12066
+ const voteInfo = (eventData && eventData.length) ?
12061
12067
  {
12062
12068
  voteInfo: {
12063
- candidateId: tx.Memos[0].data.substr(0, 64),
12064
- vote: Buffer.from(tx.Memos[0].data, 'hex').slice(32, 33).readUInt8()
12069
+ candidateId: eventData.substr(0, 64),
12070
+ vote: Buffer.from(eventData, 'hex').slice(32, 33).readUInt8()
12065
12071
  }
12066
12072
  } : {};
12067
12073
 
@@ -12074,10 +12080,9 @@ class BaseEvernodeClient {
12074
12080
  }
12075
12081
  }
12076
12082
  }
12077
- else if (tx.Memos.length >= 1 &&
12078
- tx.Memos[0].type === MemoTypes.EXTEND_LEASE && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12083
+ else if (eventType === EventTypes.EXTEND_LEASE && eventData) {
12079
12084
 
12080
- let uriTokenId = tx.Memos[0].data;
12085
+ let uriTokenId = eventData;
12081
12086
 
12082
12087
  return {
12083
12088
  name: EvernodeEvents.ExtendLease,
@@ -12091,12 +12096,11 @@ class BaseEvernodeClient {
12091
12096
  }
12092
12097
  }
12093
12098
  }
12094
- else if (tx.Memos.length >= 2 &&
12095
- tx.Memos[0].type === MemoTypes.EXTEND_SUCCESS && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data &&
12096
- tx.Memos[1].type === MemoTypes.EXTEND_REF && tx.Memos[1].format === MemoFormats.HEX && tx.Memos[1].data) {
12099
+ else if (eventType === EventTypes.EXTEND_SUCCESS && eventData && tx.Memos.length &&
12100
+ tx.Memos[0].type === EventTypes.EXTEND_SUCCESS && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12097
12101
 
12098
12102
  const extendResBuf = Buffer.from(tx.Memos[0].data, 'hex');
12099
- const extendRefId = tx.Memos[1].data;
12103
+ const extendRefId = eventData;
12100
12104
 
12101
12105
  return {
12102
12106
  name: EvernodeEvents.ExtendSuccess,
@@ -12108,12 +12112,11 @@ class BaseEvernodeClient {
12108
12112
  }
12109
12113
 
12110
12114
  }
12111
- else if (tx.Memos.length >= 2 &&
12112
- tx.Memos[0].type === MemoTypes.EXTEND_ERROR && tx.Memos[0].data &&
12113
- tx.Memos[1].type === MemoTypes.EXTEND_REF && tx.Memos[1].data) {
12115
+ else if (eventType === EventTypes.EXTEND_ERROR && eventData && tx.Memos.length &&
12116
+ tx.Memos[0].type === EventTypes.EXTEND_ERROR && tx.Memos[0].data) {
12114
12117
 
12115
12118
  let error = tx.Memos[0].data;
12116
- const extendRefId = tx.Memos[1].data;
12119
+ const extendRefId = eventData;
12117
12120
 
12118
12121
  if (tx.Memos[0].format === MemoFormats.JSON)
12119
12122
  error = JSON.parse(error).reason;
@@ -12127,8 +12130,7 @@ class BaseEvernodeClient {
12127
12130
  }
12128
12131
  }
12129
12132
  }
12130
- else if (tx.Memos.length >= 1 &&
12131
- tx.Memos[0].type === MemoTypes.INIT && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12133
+ else if (eventType === EventTypes.INIT && eventData) {
12132
12134
 
12133
12135
  return {
12134
12136
  name: EvernodeEvents.Initialized,
@@ -12137,8 +12139,7 @@ class BaseEvernodeClient {
12137
12139
  }
12138
12140
  }
12139
12141
  }
12140
- else if (tx.Memos.length >= 1 &&
12141
- tx.Memos[0].type === MemoTypes.HOST_UPDATE_INFO && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12142
+ else if (eventType === EventTypes.HOST_UPDATE_INFO && eventData) {
12142
12143
 
12143
12144
  return {
12144
12145
  name: EvernodeEvents.HostRegUpdated,
@@ -12148,10 +12149,9 @@ class BaseEvernodeClient {
12148
12149
  }
12149
12150
  }
12150
12151
  }
12151
- else if (tx.Memos.length >= 1 &&
12152
- tx.Memos[0].type === MemoTypes.DEAD_HOST_PRUNE && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12152
+ else if (eventType === EventTypes.DEAD_HOST_PRUNE && eventData) {
12153
12153
 
12154
- const addrsBuf = Buffer.from(tx.Memos[0].data, 'hex');
12154
+ const addrsBuf = Buffer.from(eventData, 'hex');
12155
12155
 
12156
12156
  return {
12157
12157
  name: EvernodeEvents.DeadHostPrune,
@@ -12161,8 +12161,7 @@ class BaseEvernodeClient {
12161
12161
  }
12162
12162
  }
12163
12163
  }
12164
- else if (tx.Memos.length >= 1 &&
12165
- tx.Memos[0].type === MemoTypes.HOST_REBATE) {
12164
+ else if (eventType === EventTypes.HOST_REBATE) {
12166
12165
 
12167
12166
  return {
12168
12167
  name: EvernodeEvents.HostRebate,
@@ -12172,10 +12171,9 @@ class BaseEvernodeClient {
12172
12171
  }
12173
12172
  }
12174
12173
  }
12175
- else if (tx.Memos.length >= 1 &&
12176
- tx.Memos[0].type === MemoTypes.HOST_TRANSFER && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12174
+ else if (eventType === EventTypes.HOST_TRANSFER && eventData) {
12177
12175
 
12178
- const addrsBuf = Buffer.from(tx.Memos[0].data, 'hex');
12176
+ const addrsBuf = Buffer.from(eventData, 'hex');
12179
12177
 
12180
12178
  return {
12181
12179
  name: EvernodeEvents.HostTransfer,
@@ -12185,40 +12183,36 @@ class BaseEvernodeClient {
12185
12183
  }
12186
12184
  }
12187
12185
  }
12188
- else if (tx.Memos.length >= 2 &&
12189
- tx.Memos[0].type === MemoTypes.CANDIDATE_PROPOSE && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data &&
12190
- tx.Memos[1].type === MemoTypes.CANDIDATE_PROPOSE_REF && tx.Memos[1].format === MemoFormats.HEX && tx.Memos[1].data) {
12186
+ else if (eventType === EventTypes.CANDIDATE_PROPOSE && eventData) {
12191
12187
 
12192
12188
  return {
12193
12189
  name: EvernodeEvents.CandidateProposed,
12194
12190
  data: {
12195
12191
  transaction: tx,
12196
12192
  owner: tx.Account,
12197
- candidateId: tx.Memos[1].data.substr(0, 64)
12193
+ candidateId: eventData.substr(CANDIDATE_PROPOSE_UNIQUE_ID_PARAM_OFFSET * 2, 64)
12198
12194
  }
12199
12195
  }
12200
12196
  }
12201
- else if (tx.Memos.length >= 1 &&
12202
- tx.Memos[0].type === MemoTypes.CANDIDATE_WITHDRAW && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12197
+ else if (eventType === EventTypes.CANDIDATE_WITHDRAW && eventData) {
12203
12198
  return {
12204
12199
  name: EvernodeEvents.CandidateWithdrew,
12205
12200
  data: {
12206
12201
  transaction: tx,
12207
12202
  owner: tx.Account,
12208
- candidateId: tx.Memos[0].data.substr(0, 64)
12203
+ candidateId: eventData.substr(0, 64)
12209
12204
  }
12210
12205
  }
12211
12206
  }
12212
- else if (tx.Memos.length >= 1 &&
12213
- tx.Memos[0].type === MemoTypes.CANDIDATE_STATUS_CHANGE && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12214
- const memoBuf = Buffer.from(tx.Memos[0].data, 'hex');
12215
- const candidateId = memoBuf.slice(0, 32).toString('hex');
12207
+ else if (eventType === EventTypes.CANDIDATE_STATUS_CHANGE && eventData) {
12208
+ const eventDataBuf = Buffer.from(eventData, 'hex');
12209
+ const candidateId = eventDataBuf.slice(0, 32).toString('hex');
12216
12210
  const candidateType = StateHelpers.getCandidateType(candidateId);
12217
12211
 
12218
12212
  switch (candidateType) {
12219
12213
  case (EvernodeConstants.CandidateTypes.DudHost):
12220
12214
  return {
12221
- name: memoBuf.readUInt8(32) === EvernodeConstants.CandidateStatuses.CANDIDATE_ELECTED ? EvernodeEvents.DudHostRemoved : EvernodeEvents.DudHostStatusChanged,
12215
+ name: eventDataBuf.readUInt8(32) === EvernodeConstants.CandidateStatuses.CANDIDATE_ELECTED ? EvernodeEvents.DudHostRemoved : EvernodeEvents.DudHostStatusChanged,
12222
12216
  data: {
12223
12217
  transaction: tx,
12224
12218
  candidateId: candidateId,
@@ -12246,20 +12240,18 @@ class BaseEvernodeClient {
12246
12240
  }
12247
12241
 
12248
12242
  }
12249
- else if (tx.Memos.length >= 1 &&
12250
- tx.Memos[0].type === MemoTypes.HOOK_UPDATE_RES && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12243
+ else if (eventType === EventTypes.HOOK_UPDATE_RES && eventData) {
12251
12244
  return {
12252
12245
  name: EvernodeEvents.ChildHookUpdated,
12253
12246
  data: {
12254
12247
  transaction: tx,
12255
12248
  account: tx.Account,
12256
- candidateId: tx.Memos[0].data.substr(0, 64)
12249
+ candidateId: eventData.substr(0, 64)
12257
12250
  }
12258
12251
  }
12259
12252
  }
12260
- else if (tx.Memos.length >= 1 &&
12261
- tx.Memos[0].type === MemoTypes.GOVERNANCE_MODE_CHANGE && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12262
- const mode = Buffer.from(tx.Memos[0].data, 'hex').slice(0, 1).readUInt8();
12253
+ else if (eventType === EventTypes.GOVERNANCE_MODE_CHANGE && eventData) {
12254
+ const mode = Buffer.from(eventData, 'hex').slice(0, 1).readUInt8();
12263
12255
 
12264
12256
  return {
12265
12257
  name: EvernodeEvents.GovernanceModeChanged,
@@ -12269,22 +12261,20 @@ class BaseEvernodeClient {
12269
12261
  }
12270
12262
  }
12271
12263
  }
12272
- else if (tx.Memos.length >= 1 &&
12273
- tx.Memos[0].type === MemoTypes.CANDIDATE_VOTE && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12274
- const vote = Buffer.from(tx.Memos[0].data, 'hex').slice(32, 33).readUInt8();
12264
+ else if (eventType === EventTypes.CANDIDATE_VOTE && eventData) {
12265
+ const vote = Buffer.from(eventData, 'hex').slice(32, 33).readUInt8();
12275
12266
 
12276
12267
  return {
12277
12268
  name: EvernodeEvents.FoundationVoted,
12278
12269
  data: {
12279
12270
  transaction: tx,
12280
- candidateId: tx.Memos[0].data.substr(0, 64),
12271
+ candidateId: eventData.substr(0, 64),
12281
12272
  vote: vote
12282
12273
  }
12283
12274
  }
12284
12275
  }
12285
- else if (tx.Memos.length >= 1 &&
12286
- tx.Memos[0].type === MemoTypes.DUD_HOST_REPORT && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12287
- const candidateId = tx.Memos[0].data.substr(0, 64);
12276
+ else if (eventType === EventTypes.DUD_HOST_REPORT && eventData) {
12277
+ const candidateId = eventData.substr(0, 64);
12288
12278
 
12289
12279
  return {
12290
12280
  name: EvernodeEvents.DudHostReported,
@@ -12449,8 +12439,8 @@ class BaseEvernodeClient {
12449
12439
  if (this.xrplAcc.address === this.config.registryAddress)
12450
12440
  throw 'Invalid function call';
12451
12441
 
12452
- let memoData = Buffer.allocUnsafe(20);
12453
- codec.decodeAccountID(hostAddress).copy(memoData);
12442
+ let paramData = Buffer.allocUnsafe(20);
12443
+ codec.decodeAccountID(hostAddress).copy(paramData);
12454
12444
 
12455
12445
  // To obtain registration NFT Page Keylet and index.
12456
12446
  const hostAcc = new XrplAccount(hostAddress, null, { xrplApi: this.xrplApi });
@@ -12460,9 +12450,13 @@ class BaseEvernodeClient {
12460
12450
  XrplConstants.MIN_XRP_AMOUNT,
12461
12451
  XrplConstants.XRP,
12462
12452
  null,
12463
- [
12464
- { type: MemoTypes.DEAD_HOST_PRUNE, format: MemoFormats.HEX, data: memoData.toString('hex') }
12465
- ]);
12453
+ null,
12454
+ {
12455
+ hookParams: [
12456
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.DEAD_HOST_PRUNE },
12457
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramData.toString('hex') }
12458
+ ]
12459
+ });
12466
12460
  } else
12467
12461
  throw "No Registration URI token was found for the Host account."
12468
12462
 
@@ -12615,10 +12609,11 @@ class BaseEvernodeClient {
12615
12609
  }
12616
12610
 
12617
12611
  const uniqueId = StateHelpers.getNewHookCandidateId(hashesBuf);
12618
- const memoBuf = Buffer.alloc(CANDIDATE_PROPOSE_MEMO_SIZE);
12619
- Buffer.from(uniqueId, 'hex').copy(memoBuf, CANDIDATE_PROPOSE_UNIQUE_ID_MEMO_OFFSET);
12620
- Buffer.from(shortName.substr(0, 20), "utf-8").copy(memoBuf, CANDIDATE_PROPOSE_SHORT_NAME_MEMO_OFFSET);
12621
- Buffer.from(keylets.join(''), 'hex').copy(memoBuf, CANDIDATE_PROPOSE_KEYLETS_MEMO_OFFSET);
12612
+ const paramBuf = Buffer.alloc(CANDIDATE_PROPOSE_PARAM_SIZE);
12613
+ hashesBuf.copy(paramBuf, CANDIDATE_PROPOSE_HASHES_PARAM_OFFSET);
12614
+ Buffer.from(keylets.join(''), 'hex').copy(paramBuf, CANDIDATE_PROPOSE_KEYLETS_PARAM_OFFSET);
12615
+ Buffer.from(uniqueId, 'hex').copy(paramBuf, CANDIDATE_PROPOSE_UNIQUE_ID_PARAM_OFFSET);
12616
+ Buffer.from(shortName.substr(0, 20), "utf-8").copy(paramBuf, CANDIDATE_PROPOSE_SHORT_NAME_PARAM_OFFSET);
12622
12617
 
12623
12618
  // Get the proposal fee. Proposal fee is current epochs moment worth of rewards.
12624
12619
  const proposalFee = EvernodeHelpers.getEpochRewardQuota(this.config.rewardInfo.epoch, this.config.rewardConfiguration.firstEpochRewardQuota);
@@ -12627,11 +12622,15 @@ class BaseEvernodeClient {
12627
12622
  proposalFee.toString(),
12628
12623
  EvernodeConstants.EVR,
12629
12624
  this.config.evrIssuerAddress,
12630
- [
12631
- { type: MemoTypes.CANDIDATE_PROPOSE, format: MemoFormats.HEX, data: hashesBuf.toString('hex').toUpperCase() },
12632
- { type: MemoTypes.CANDIDATE_PROPOSE_REF, format: MemoFormats.HEX, data: memoBuf.toString('hex').toUpperCase() }
12633
- ],
12634
- options.transactionOptions);
12625
+ null,
12626
+ {
12627
+ hookParams: [
12628
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.CANDIDATE_PROPOSE },
12629
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramBuf.slice(0, MAX_HOOK_PARAM_SIZE).toString('hex').toUpperCase() },
12630
+ { name: HookParamKeys.PARAM_EVENT_DATA2_KEY, value: paramBuf.slice(MAX_HOOK_PARAM_SIZE).toString('hex').toUpperCase() }
12631
+ ],
12632
+ ...options.transactionOptions
12633
+ });
12635
12634
 
12636
12635
  return uniqueId;
12637
12636
  }
@@ -12648,10 +12647,14 @@ class BaseEvernodeClient {
12648
12647
  XrplConstants.MIN_XRP_AMOUNT,
12649
12648
  XrplConstants.XRP,
12650
12649
  null,
12651
- [
12652
- { type: MemoTypes.CANDIDATE_WITHDRAW, format: MemoFormats.HEX, data: candidateIdBuf.toString('hex').toUpperCase() }
12653
- ],
12654
- options.transactionOptions);
12650
+ null,
12651
+ {
12652
+ hookParams: [
12653
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.CANDIDATE_WITHDRAW },
12654
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: candidateIdBuf.toString('hex').toUpperCase() }
12655
+ ],
12656
+ ...options.transactionOptions
12657
+ });
12655
12658
  }
12656
12659
 
12657
12660
  /**
@@ -12670,10 +12673,14 @@ class BaseEvernodeClient {
12670
12673
  proposalFee.toString(),
12671
12674
  EvernodeConstants.EVR,
12672
12675
  this.config.evrIssuerAddress,
12673
- [
12674
- { type: MemoTypes.DUD_HOST_REPORT, format: MemoFormats.HEX, data: candidateId }
12675
- ],
12676
- options.transactionOptions);
12676
+ null,
12677
+ {
12678
+ hookParams: [
12679
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.DUD_HOST_REPORT },
12680
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: candidateId }
12681
+ ],
12682
+ ...options.transactionOptions
12683
+ });
12677
12684
  }
12678
12685
  }
12679
12686
 
@@ -12688,14 +12695,14 @@ module.exports = {
12688
12695
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12689
12696
 
12690
12697
  const { Buffer } = __nccwpck_require__(4300);
12691
- const { MemoTypes, MemoFormats } = __nccwpck_require__(9849);
12698
+ const { EventTypes, HookParamKeys } = __nccwpck_require__(9849);
12692
12699
  const { StateHelpers } = __nccwpck_require__(3860);
12693
12700
  const { XrplConstants } = __nccwpck_require__(3307);
12694
12701
  const { BaseEvernodeClient } = __nccwpck_require__(6263);
12695
12702
 
12696
- const CANDIDATE_VOTE_UNIQUE_ID_MEMO_OFFSET = 0;
12697
- const CANDIDATE_VOTE_VALUE_MEMO_OFFSET = 32;
12698
- const CANDIDATE_VOTE_MEMO_SIZE = 33;
12703
+ const CANDIDATE_VOTE_UNIQUE_ID_PARAM_OFFSET = 0;
12704
+ const CANDIDATE_VOTE_VALUE_PARAM_OFFSET = 32;
12705
+ const CANDIDATE_VOTE_PARAM_SIZE = 33;
12699
12706
 
12700
12707
  const FoundationEvents = {}
12701
12708
 
@@ -12736,18 +12743,22 @@ class FoundationClient extends BaseEvernodeClient {
12736
12743
  if (this.xrplAcc.address !== this.config.foundationAddress)
12737
12744
  throw `Invalid foundation address ${this.xrplAcc.address}.`;
12738
12745
 
12739
- const voteBuf = Buffer.alloc(CANDIDATE_VOTE_MEMO_SIZE);
12740
- Buffer.from(candidateId, 'hex').copy(voteBuf, CANDIDATE_VOTE_UNIQUE_ID_MEMO_OFFSET);
12741
- voteBuf.writeUInt8(vote, CANDIDATE_VOTE_VALUE_MEMO_OFFSET)
12746
+ const voteBuf = Buffer.alloc(CANDIDATE_VOTE_PARAM_SIZE);
12747
+ Buffer.from(candidateId, 'hex').copy(voteBuf, CANDIDATE_VOTE_UNIQUE_ID_PARAM_OFFSET);
12748
+ voteBuf.writeUInt8(vote, CANDIDATE_VOTE_VALUE_PARAM_OFFSET)
12742
12749
 
12743
12750
  return await this.xrplAcc.makePayment(this.config.heartbeatAddress,
12744
12751
  XrplConstants.MIN_XRP_AMOUNT,
12745
12752
  XrplConstants.XRP,
12746
12753
  null,
12747
- [
12748
- { type: MemoTypes.CANDIDATE_VOTE, format: MemoFormats.HEX, data: voteBuf.toString('hex').toUpperCase() }
12749
- ],
12750
- options.transactionOptions);
12754
+ null,
12755
+ {
12756
+ hookParams: [
12757
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.CANDIDATE_VOTE },
12758
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: voteBuf.toString('hex').toUpperCase() }
12759
+ ],
12760
+ ...options.transactionOptions
12761
+ });
12751
12762
  }
12752
12763
 
12753
12764
  async reportDudHost(hostAddress, options = {}) {
@@ -12803,10 +12814,14 @@ class FoundationClient extends BaseEvernodeClient {
12803
12814
  XrplConstants.MIN_XRP_AMOUNT,
12804
12815
  XrplConstants.XRP,
12805
12816
  null,
12806
- [
12807
- { type: MemoTypes.GOVERNANCE_MODE_CHANGE, format: MemoFormats.HEX, data: modeBuf.toString('hex').toUpperCase() }
12808
- ],
12809
- options.transactionOptions);
12817
+ null,
12818
+ {
12819
+ hookParams: [
12820
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.GOVERNANCE_MODE_CHANGE },
12821
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: modeBuf.toString('hex').toUpperCase() }
12822
+ ],
12823
+ ...options.transactionOptions
12824
+ });
12810
12825
  }
12811
12826
  }
12812
12827
 
@@ -12993,7 +13008,7 @@ module.exports = {
12993
13008
 
12994
13009
  const { XrplConstants } = __nccwpck_require__(3307);
12995
13010
  const { BaseEvernodeClient } = __nccwpck_require__(6263);
12996
- const { EvernodeEvents, EvernodeConstants, MemoFormats, MemoTypes, ErrorCodes } = __nccwpck_require__(9849);
13011
+ const { EvernodeEvents, EvernodeConstants, MemoFormats, EventTypes, ErrorCodes, HookParamKeys } = __nccwpck_require__(9849);
12997
13012
  const { XrplAccount } = __nccwpck_require__(9329);
12998
13013
  const { EncryptionHelper } = __nccwpck_require__(4832);
12999
13014
  const { Buffer } = __nccwpck_require__(4300);
@@ -13010,28 +13025,28 @@ const HostEvents = {
13010
13025
  ExtendLease: EvernodeEvents.ExtendLease
13011
13026
  }
13012
13027
 
13013
- const HOST_COUNTRY_CODE_MEMO_OFFSET = 0;
13014
- const HOST_CPU_MICROSEC_MEMO_OFFSET = 2;
13015
- const HOST_RAM_MB_MEMO_OFFSET = 6;
13016
- const HOST_DISK_MB_MEMO_OFFSET = 10;
13017
- const HOST_TOT_INS_COUNT_MEMO_OFFSET = 14;
13018
- const HOST_CPU_MODEL_NAME_MEMO_OFFSET = 18;
13019
- const HOST_CPU_COUNT_MEMO_OFFSET = 58;
13020
- const HOST_CPU_SPEED_MEMO_OFFSET = 60;
13021
- const HOST_DESCRIPTION_MEMO_OFFSET = 62;
13022
- const HOST_EMAIL_ADDRESS_MEMO_OFFSET = 88;
13023
- const HOST_REG_MEMO_SIZE = 128;
13024
-
13025
- const HOST_UPDATE_TOKEN_ID_MEMO_OFFSET = 0;
13026
- const HOST_UPDATE_COUNTRY_CODE_MEMO_OFFSET = 32;
13027
- const HOST_UPDATE_CPU_MICROSEC_MEMO_OFFSET = 34;
13028
- const HOST_UPDATE_RAM_MB_MEMO_OFFSET = 38;
13029
- const HOST_UPDATE_DISK_MB_MEMO_OFFSET = 42;
13030
- const HOST_UPDATE_TOT_INS_COUNT_MEMO_OFFSET = 46;
13031
- const HOST_UPDATE_ACT_INS_COUNT_MEMO_OFFSET = 50;
13032
- const HOST_UPDATE_DESCRIPTION_MEMO_OFFSET = 54;
13033
- const HOST_UPDATE_VERSION_MEMO_OFFSET = 80;
13034
- const HOST_UPDATE_MEMO_SIZE = 83;
13028
+ const HOST_COUNTRY_CODE_PARAM_OFFSET = 0;
13029
+ const HOST_CPU_MICROSEC_PARAM_OFFSET = 2;
13030
+ const HOST_RAM_MB_PARAM_OFFSET = 6;
13031
+ const HOST_DISK_MB_PARAM_OFFSET = 10;
13032
+ const HOST_TOT_INS_COUNT_PARAM_OFFSET = 14;
13033
+ const HOST_CPU_MODEL_NAME_PARAM_OFFSET = 18;
13034
+ const HOST_CPU_COUNT_PARAM_OFFSET = 58;
13035
+ const HOST_CPU_SPEED_PARAM_OFFSET = 60;
13036
+ const HOST_DESCRIPTION_PARAM_OFFSET = 62;
13037
+ const HOST_EMAIL_ADDRESS_PARAM_OFFSET = 88;
13038
+ const HOST_REG_PARAM_SIZE = 128;
13039
+
13040
+ const HOST_UPDATE_TOKEN_ID_PARAM_OFFSET = 0;
13041
+ const HOST_UPDATE_COUNTRY_CODE_PARAM_OFFSET = 32;
13042
+ const HOST_UPDATE_CPU_MICROSEC_PARAM_OFFSET = 34;
13043
+ const HOST_UPDATE_RAM_MB_PARAM_OFFSET = 38;
13044
+ const HOST_UPDATE_DISK_MB_PARAM_OFFSET = 42;
13045
+ const HOST_UPDATE_TOT_INS_COUNT_PARAM_OFFSET = 46;
13046
+ const HOST_UPDATE_ACT_INS_COUNT_PARAM_OFFSET = 50;
13047
+ const HOST_UPDATE_DESCRIPTION_PARAM_OFFSET = 54;
13048
+ const HOST_UPDATE_VERSION_PARAM_OFFSET = 80;
13049
+ const HOST_UPDATE_PARAM_SIZE = 83;
13035
13050
 
13036
13051
  const VOTE_VALIDATION_ERR = "VOTE_VALIDATION_ERR";
13037
13052
 
@@ -13209,24 +13224,30 @@ class HostClient extends BaseEvernodeClient {
13209
13224
  }
13210
13225
 
13211
13226
  // <country_code(2)><cpu_microsec(4)><ram_mb(4)><disk_mb(4)><no_of_total_instances(4)><cpu_model(40)><cpu_count(2)><cpu_speed(2)><description(26)><email_address(40)>
13212
- const memoBuf = Buffer.alloc(HOST_REG_MEMO_SIZE, 0);
13213
- Buffer.from(countryCode.substr(0, 2), "utf-8").copy(memoBuf, HOST_COUNTRY_CODE_MEMO_OFFSET);
13214
- memoBuf.writeUInt32BE(cpuMicroSec, HOST_CPU_MICROSEC_MEMO_OFFSET);
13215
- memoBuf.writeUInt32BE(ramMb, HOST_RAM_MB_MEMO_OFFSET);
13216
- memoBuf.writeUInt32BE(diskMb, HOST_DISK_MB_MEMO_OFFSET);
13217
- memoBuf.writeUInt32BE(totalInstanceCount, HOST_TOT_INS_COUNT_MEMO_OFFSET);
13218
- Buffer.from(cpuModel.substr(0, 40), "utf-8").copy(memoBuf, HOST_CPU_MODEL_NAME_MEMO_OFFSET);
13219
- memoBuf.writeUInt16BE(cpuCount, HOST_CPU_COUNT_MEMO_OFFSET);
13220
- memoBuf.writeUInt16BE(cpuSpeed, HOST_CPU_SPEED_MEMO_OFFSET);
13221
- Buffer.from(description.substr(0, 26), "utf-8").copy(memoBuf, HOST_DESCRIPTION_MEMO_OFFSET);
13222
- Buffer.from(emailAddress.substr(0, 40), "utf-8").copy(memoBuf, HOST_EMAIL_ADDRESS_MEMO_OFFSET);
13227
+ const paramBuf = Buffer.alloc(HOST_REG_PARAM_SIZE, 0);
13228
+ Buffer.from(countryCode.substr(0, 2), "utf-8").copy(paramBuf, HOST_COUNTRY_CODE_PARAM_OFFSET);
13229
+ paramBuf.writeUInt32LE(cpuMicroSec, HOST_CPU_MICROSEC_PARAM_OFFSET);
13230
+ paramBuf.writeUInt32LE(ramMb, HOST_RAM_MB_PARAM_OFFSET);
13231
+ paramBuf.writeUInt32LE(diskMb, HOST_DISK_MB_PARAM_OFFSET);
13232
+ paramBuf.writeUInt32LE(totalInstanceCount, HOST_TOT_INS_COUNT_PARAM_OFFSET);
13233
+ Buffer.from(cpuModel.substr(0, 40), "utf-8").copy(paramBuf, HOST_CPU_MODEL_NAME_PARAM_OFFSET);
13234
+ paramBuf.writeUInt16LE(cpuCount, HOST_CPU_COUNT_PARAM_OFFSET);
13235
+ paramBuf.writeUInt16LE(cpuSpeed, HOST_CPU_SPEED_PARAM_OFFSET);
13236
+ Buffer.from(description.substr(0, 26), "utf-8").copy(paramBuf, HOST_DESCRIPTION_PARAM_OFFSET);
13237
+ Buffer.from(emailAddress.substr(0, 40), "utf-8").copy(paramBuf, HOST_EMAIL_ADDRESS_PARAM_OFFSET);
13223
13238
 
13224
13239
  const tx = await this.xrplAcc.makePayment(this.config.registryAddress,
13225
13240
  (transferredNFTokenId) ? EvernodeConstants.NOW_IN_EVRS : this.config.hostRegFee.toString(),
13226
13241
  EvernodeConstants.EVR,
13227
13242
  this.config.evrIssuerAddress,
13228
- [{ type: MemoTypes.HOST_REG, format: MemoFormats.HEX, data: memoBuf.toString('hex') }],
13229
- options.transactionOptions);
13243
+ null,
13244
+ {
13245
+ hookParams: [
13246
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HOST_REG },
13247
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramBuf.toString('hex').toUpperCase() }
13248
+ ],
13249
+ ...options.transactionOptions
13250
+ });
13230
13251
 
13231
13252
  console.log('Waiting for the sell offer', tx.id)
13232
13253
  let sellOffer = null;
@@ -13278,54 +13299,62 @@ class HostClient extends BaseEvernodeClient {
13278
13299
  XrplConstants.MIN_XRP_AMOUNT,
13279
13300
  XrplConstants.XRP,
13280
13301
  null,
13281
- [
13282
- { type: MemoTypes.HOST_DEREG, format: MemoFormats.HEX, data: regUriToken.index }
13283
- ],
13284
- options.transactionOptions);
13302
+ null,
13303
+ {
13304
+ hookParams: [
13305
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HOST_DEREG },
13306
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: regUriToken.index }
13307
+ ],
13308
+ ...options.transactionOptions
13309
+ });
13285
13310
 
13286
13311
  return await this.isRegistered();
13287
13312
  }
13288
13313
 
13289
13314
  async updateRegInfo(activeInstanceCount = null, version = null, totalInstanceCount = null, tokenID = null, countryCode = null, cpuMicroSec = null, ramMb = null, diskMb = null, description = null, options = {}) {
13290
13315
  // <token_id(32)><country_code(2)><cpu_microsec(4)><ram_mb(4)><disk_mb(4)><total_instance_count(4)><active_instances(4)><description(26)><version(3)>
13291
- const memoBuf = Buffer.alloc(HOST_UPDATE_MEMO_SIZE, 0);
13316
+ const paramBuf = Buffer.alloc(HOST_UPDATE_PARAM_SIZE, 0);
13292
13317
  if (tokenID)
13293
- Buffer.from(tokenID.substr(0, 32), "hex").copy(memoBuf, HOST_UPDATE_TOKEN_ID_MEMO_OFFSET);
13318
+ Buffer.from(tokenID.substr(0, 32), "hex").copy(paramBuf, HOST_UPDATE_TOKEN_ID_PARAM_OFFSET);
13294
13319
  if (countryCode)
13295
- Buffer.from(countryCode.substr(0, 2), "utf-8").copy(memoBuf, HOST_UPDATE_COUNTRY_CODE_MEMO_OFFSET);
13320
+ Buffer.from(countryCode.substr(0, 2), "utf-8").copy(paramBuf, HOST_UPDATE_COUNTRY_CODE_PARAM_OFFSET);
13296
13321
  if (cpuMicroSec)
13297
- memoBuf.writeUInt32BE(cpuMicroSec, HOST_UPDATE_CPU_MICROSEC_MEMO_OFFSET);
13322
+ paramBuf.writeUInt32LE(cpuMicroSec, HOST_UPDATE_CPU_MICROSEC_PARAM_OFFSET);
13298
13323
  if (ramMb)
13299
- memoBuf.writeUInt32BE(ramMb, HOST_UPDATE_RAM_MB_MEMO_OFFSET);
13324
+ paramBuf.writeUInt32LE(ramMb, HOST_UPDATE_RAM_MB_PARAM_OFFSET);
13300
13325
  if (diskMb)
13301
- memoBuf.writeUInt32BE(diskMb, HOST_UPDATE_DISK_MB_MEMO_OFFSET);
13326
+ paramBuf.writeUInt32LE(diskMb, HOST_UPDATE_DISK_MB_PARAM_OFFSET);
13302
13327
  if (totalInstanceCount)
13303
- memoBuf.writeUInt32BE(totalInstanceCount, HOST_UPDATE_TOT_INS_COUNT_MEMO_OFFSET);
13328
+ paramBuf.writeUInt32LE(totalInstanceCount, HOST_UPDATE_TOT_INS_COUNT_PARAM_OFFSET);
13304
13329
  if (activeInstanceCount)
13305
- memoBuf.writeUInt32BE(activeInstanceCount, HOST_UPDATE_ACT_INS_COUNT_MEMO_OFFSET);
13330
+ paramBuf.writeUInt32LE(activeInstanceCount, HOST_UPDATE_ACT_INS_COUNT_PARAM_OFFSET);
13306
13331
  if (description)
13307
- Buffer.from(description.substr(0, 26), "utf-8").copy(memoBuf, HOST_UPDATE_DESCRIPTION_MEMO_OFFSET);
13332
+ Buffer.from(description.substr(0, 26), "utf-8").copy(paramBuf, HOST_UPDATE_DESCRIPTION_PARAM_OFFSET);
13308
13333
  if (version) {
13309
13334
  const components = version.split('.').map(v => parseInt(v));
13310
13335
  if (components.length != 3)
13311
13336
  throw 'Invalid version format.';
13312
- memoBuf.writeUInt8(components[0], HOST_UPDATE_VERSION_MEMO_OFFSET);
13313
- memoBuf.writeUInt8(components[1], HOST_UPDATE_VERSION_MEMO_OFFSET + 1);
13314
- memoBuf.writeUInt8(components[2], HOST_UPDATE_VERSION_MEMO_OFFSET + 2);
13337
+ paramBuf.writeUInt8(components[0], HOST_UPDATE_VERSION_PARAM_OFFSET);
13338
+ paramBuf.writeUInt8(components[1], HOST_UPDATE_VERSION_PARAM_OFFSET + 1);
13339
+ paramBuf.writeUInt8(components[2], HOST_UPDATE_VERSION_PARAM_OFFSET + 2);
13315
13340
  }
13316
13341
 
13317
13342
  return await this.xrplAcc.makePayment(this.config.registryAddress,
13318
13343
  XrplConstants.MIN_XRP_AMOUNT,
13319
13344
  XrplConstants.XRP,
13320
13345
  null,
13321
- [
13322
- { type: MemoTypes.HOST_UPDATE_INFO, format: MemoFormats.HEX, data: memoBuf.toString('hex') }
13323
- ],
13324
- options.transactionOptions);
13346
+ null,
13347
+ {
13348
+ hookParams: [
13349
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HOST_UPDATE_INFO },
13350
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramBuf.toString('hex') }
13351
+ ],
13352
+ ...options.transactionOptions
13353
+ });
13325
13354
  }
13326
13355
 
13327
13356
  async heartbeat(voteInfo = {}, options = {}) {
13328
- let data = "";
13357
+ let data;
13329
13358
  // Prepare voteInfo
13330
13359
  if (Object.keys(voteInfo).length > 1) {
13331
13360
  let voteBuf = Buffer.alloc(33);
@@ -13339,10 +13368,14 @@ class HostClient extends BaseEvernodeClient {
13339
13368
  XrplConstants.MIN_XRP_AMOUNT,
13340
13369
  XrplConstants.XRP,
13341
13370
  null,
13342
- [
13343
- { type: MemoTypes.HEARTBEAT, format: MemoFormats.HEX, data: data }
13344
- ],
13345
- options.transactionOptions);
13371
+ null,
13372
+ {
13373
+ hookParams: [
13374
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HEARTBEAT },
13375
+ ...(data ? [{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: data }] : [])
13376
+ ],
13377
+ ...options.transactionOptions
13378
+ });
13346
13379
  return res;
13347
13380
  }
13348
13381
  catch (e) {
@@ -13367,74 +13400,94 @@ class HostClient extends BaseEvernodeClient {
13367
13400
  throw "Tenant encryption key not set.";
13368
13401
 
13369
13402
  const encrypted = await EncryptionHelper.encrypt(encKey, instanceInfo);
13370
- const memos = [
13371
- { type: MemoTypes.ACQUIRE_SUCCESS, format: MemoFormats.BASE64, data: encrypted },
13372
- { type: MemoTypes.ACQUIRE_REF, format: MemoFormats.HEX, data: txHash }];
13373
-
13374
13403
  return this.xrplAcc.makePayment(tenantAddress,
13375
13404
  XrplConstants.MIN_XRP_AMOUNT,
13376
13405
  XrplConstants.XRP,
13377
13406
  null,
13378
- memos,
13379
- options.transactionOptions);
13407
+ [
13408
+ { type: EventTypes.ACQUIRE_SUCCESS, format: MemoFormats.BASE64, data: encrypted }
13409
+ ],
13410
+ {
13411
+ hookParams: [
13412
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.ACQUIRE_SUCCESS },
13413
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
13414
+ ],
13415
+ ...options.transactionOptions
13416
+ });
13380
13417
  }
13381
13418
 
13382
13419
  async acquireError(txHash, tenantAddress, leaseAmount, reason, options = {}) {
13383
13420
 
13384
- const memos = [
13385
- { type: MemoTypes.ACQUIRE_ERROR, format: MemoFormats.JSON, data: { type: ErrorCodes.ACQUIRE_ERR, reason: reason } },
13386
- { type: MemoTypes.ACQUIRE_REF, format: MemoFormats.HEX, data: txHash }];
13387
-
13388
13421
  return this.xrplAcc.makePayment(tenantAddress,
13389
13422
  leaseAmount.toString(),
13390
13423
  EvernodeConstants.EVR,
13391
13424
  this.config.evrIssuerAddress,
13392
- memos,
13393
- options.transactionOptions);
13425
+ [
13426
+ { type: EventTypes.ACQUIRE_ERROR, format: MemoFormats.JSON, data: { type: ErrorCodes.ACQUIRE_ERR, reason: reason } }
13427
+ ],
13428
+ {
13429
+ hookParams: [
13430
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.ACQUIRE_ERROR },
13431
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
13432
+ ],
13433
+ ...options.transactionOptions
13434
+ });
13394
13435
  }
13395
13436
 
13396
13437
  async extendSuccess(txHash, tenantAddress, expiryMoment, options = {}) {
13397
13438
  let buf = Buffer.allocUnsafe(4);
13398
13439
  buf.writeUInt32BE(expiryMoment);
13399
13440
 
13400
- const memos = [
13401
- { type: MemoTypes.EXTEND_SUCCESS, format: MemoFormats.HEX, data: buf.toString('hex') },
13402
- { type: MemoTypes.EXTEND_REF, format: MemoFormats.HEX, data: txHash }];
13403
-
13404
13441
  return this.xrplAcc.makePayment(tenantAddress,
13405
13442
  XrplConstants.MIN_XRP_AMOUNT,
13406
13443
  XrplConstants.XRP,
13407
13444
  null,
13408
- memos,
13409
- options.transactionOptions);
13445
+ [
13446
+ { type: EventTypes.EXTEND_SUCCESS, format: MemoFormats.HEX, data: buf.toString('hex') }
13447
+ ],
13448
+ {
13449
+ hookParams: [
13450
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.EXTEND_SUCCESS },
13451
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
13452
+ ],
13453
+ ...options.transactionOptions
13454
+ });
13410
13455
  }
13411
13456
 
13412
13457
  async extendError(txHash, tenantAddress, reason, refund, options = {}) {
13413
13458
 
13414
- const memos = [
13415
- { type: MemoTypes.EXTEND_ERROR, format: MemoFormats.JSON, data: { type: ErrorCodes.EXTEND_ERR, reason: reason } },
13416
- { type: MemoTypes.EXTEND_REF, format: MemoFormats.HEX, data: txHash }];
13417
-
13418
13459
  // Required to refund the paid EVR amount as the offer extention is not successfull.
13419
13460
  return this.xrplAcc.makePayment(tenantAddress,
13420
13461
  refund.toString(),
13421
13462
  EvernodeConstants.EVR,
13422
13463
  this.config.evrIssuerAddress,
13423
- memos,
13424
- options.transactionOptions);
13464
+ [
13465
+ { type: EventTypes.EXTEND_ERROR, format: MemoFormats.JSON, data: { type: ErrorCodes.EXTEND_ERR, reason: reason } }
13466
+ ],
13467
+ {
13468
+ hookParams: [
13469
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.EXTEND_ERROR },
13470
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
13471
+ ],
13472
+ ...options.transactionOptions
13473
+ });
13425
13474
  }
13426
13475
 
13427
13476
  async refundTenant(txHash, tenantAddress, refundAmount, options = {}) {
13428
- const memos = [
13429
- { type: MemoTypes.REFUND, format: '', data: '' },
13430
- { type: MemoTypes.REFUND_REF, format: MemoFormats.HEX, data: txHash }];
13431
-
13432
13477
  return this.xrplAcc.makePayment(tenantAddress,
13433
13478
  refundAmount.toString(),
13434
13479
  EvernodeConstants.EVR,
13435
13480
  this.config.evrIssuerAddress,
13436
- memos,
13437
- options.transactionOptions);
13481
+ [
13482
+ { type: EventTypes.REFUND, format: '', data: '' }
13483
+ ],
13484
+ {
13485
+ hookParams: [
13486
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.REFUND },
13487
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
13488
+ ],
13489
+ ...options.transactionOptions
13490
+ });
13438
13491
  }
13439
13492
 
13440
13493
  async requestRebate(options = {}) {
@@ -13443,9 +13496,14 @@ class HostClient extends BaseEvernodeClient {
13443
13496
  XrplConstants.XRP,
13444
13497
  null,
13445
13498
  [
13446
- { type: MemoTypes.HOST_REBATE, format: "", data: "" }
13499
+ { type: EventTypes.HOST_REBATE, format: "", data: "" }
13447
13500
  ],
13448
- options.transactionOptions);
13501
+ {
13502
+ hookParams: [
13503
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HOST_REBATE }
13504
+ ],
13505
+ ...options.transactionOptions
13506
+ });
13449
13507
  }
13450
13508
 
13451
13509
  getLeaseNFTokenIdPrefix() {
@@ -13469,8 +13527,7 @@ class HostClient extends BaseEvernodeClient {
13469
13527
  throw "The transferee is already registered in Evernode.";
13470
13528
  }
13471
13529
 
13472
- let memoData = Buffer.allocUnsafe(20);
13473
- codec.decodeAccountID(transfereeAddress).copy(memoData);
13530
+ const paramData = codec.decodeAccountID(transfereeAddress);
13474
13531
 
13475
13532
  const regUriToken = await this.getRegistrationUriToken();
13476
13533
 
@@ -13479,10 +13536,14 @@ class HostClient extends BaseEvernodeClient {
13479
13536
  XrplConstants.XRP,
13480
13537
  null,
13481
13538
  this.config.registryAddress,
13482
- [
13483
- { type: MemoTypes.HOST_TRANSFER, format: MemoFormats.HEX, data: memoData.toString('hex') }
13484
- ],
13485
- options.transactionOptions);
13539
+ null,
13540
+ {
13541
+ hookParams: [
13542
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HOST_TRANSFER },
13543
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramData.toString('hex') }
13544
+ ],
13545
+ ...options.transactionOptions
13546
+ });
13486
13547
 
13487
13548
  let token = null;
13488
13549
  let attempts = 0;
@@ -13546,7 +13607,7 @@ module.exports = {
13546
13607
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
13547
13608
 
13548
13609
  const { BaseEvernodeClient } = __nccwpck_require__(6263);
13549
- const { EvernodeEvents, MemoFormats, MemoTypes, ErrorCodes, ErrorReasons, EvernodeConstants } = __nccwpck_require__(9849);
13610
+ const { EvernodeEvents, MemoFormats, EventTypes, ErrorCodes, ErrorReasons, EvernodeConstants, HookParamKeys } = __nccwpck_require__(9849);
13550
13611
  const { EncryptionHelper } = __nccwpck_require__(4832);
13551
13612
  const { XrplAccount } = __nccwpck_require__(9329);
13552
13613
  const { UtilHelpers } = __nccwpck_require__(6687);
@@ -13642,7 +13703,17 @@ class TenantClient extends BaseEvernodeClient {
13642
13703
  ephemPrivateKey: options.ephemPrivateKey // Must be null or 32 bytes.
13643
13704
  });
13644
13705
 
13645
- return this.xrplAcc.buyURIToken(buyUriOffer, [{ type: MemoTypes.ACQUIRE_LEASE, format: MemoFormats.BASE64, data: ecrypted }], options.transactionOptions);
13706
+ return this.xrplAcc.buyURIToken(
13707
+ buyUriOffer,
13708
+ [
13709
+ { type: EventTypes.ACQUIRE_LEASE, format: MemoFormats.BASE64, data: ecrypted }
13710
+ ],
13711
+ {
13712
+ hookParams: [
13713
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.ACQUIRE_LEASE }
13714
+ ],
13715
+ ...options.transactionOptions
13716
+ });
13646
13717
  }
13647
13718
 
13648
13719
  /**
@@ -13666,6 +13737,7 @@ class TenantClient extends BaseEvernodeClient {
13666
13737
  const txList = await this.xrplAcc.getAccountTrx(tx.details.ledger_index);
13667
13738
  for (let t of txList) {
13668
13739
  t.tx.Memos = TransactionHelper.deserializeMemos(t.tx?.Memos);
13740
+ t.tx.HookParameters = TransactionHelper.deserializeHookParams(t.tx?.HookParameters);
13669
13741
  const res = await this.extractEvernodeEvent(t.tx);
13670
13742
  if ((res?.name === EvernodeEvents.AcquireSuccess || res?.name === EvernodeEvents.AcquireError) && res?.data?.acquireRefId === tx.id) {
13671
13743
  clearTimeout(failTimeout);
@@ -13728,8 +13800,18 @@ class TenantClient extends BaseEvernodeClient {
13728
13800
  */
13729
13801
  async extendLeaseSubmit(hostAddress, amount, tokenID, options = {}) {
13730
13802
  const host = await this.getLeaseHost(hostAddress);
13731
- return this.xrplAcc.makePayment(host.address, amount.toString(), EvernodeConstants.EVR, this.config.evrIssuerAddress,
13732
- [{ type: MemoTypes.EXTEND_LEASE, format: MemoFormats.HEX, data: tokenID }], options.transactionOptions);
13803
+ return this.xrplAcc.makePayment(
13804
+ host.address, amount.toString(),
13805
+ EvernodeConstants.EVR,
13806
+ this.config.evrIssuerAddress,
13807
+ null,
13808
+ {
13809
+ hookParams: [
13810
+ { name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.EXTEND_LEASE },
13811
+ { name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: tokenID }
13812
+ ],
13813
+ ...options.transactionOptions
13814
+ });
13733
13815
  }
13734
13816
 
13735
13817
  /**
@@ -13753,6 +13835,7 @@ class TenantClient extends BaseEvernodeClient {
13753
13835
  const txList = await this.xrplAcc.getAccountTrx(tx.details.ledger_index);
13754
13836
  for (let t of txList) {
13755
13837
  t.tx.Memos = TransactionHelper.deserializeMemos(t.tx.Memos);
13838
+ t.tx.HookParameters = TransactionHelper.deserializeHookParams(t.tx?.HookParameters);
13756
13839
  const res = await this.extractEvernodeEvent(t.tx);
13757
13840
  if ((res?.name === TenantEvents.ExtendSuccess || res?.name === TenantEvents.ExtendError) && res?.data?.extendRefId === tx.id) {
13758
13841
  clearTimeout(failTimeout);
@@ -13795,7 +13878,7 @@ class TenantClient extends BaseEvernodeClient {
13795
13878
  const uriToken = (await this.xrplAcc.getURITokens())?.find(n => n.index == tokenID);
13796
13879
 
13797
13880
  if (!uriToken) {
13798
- reject({ error: ErrorCodes.EXTEND_ERR, reason: ErrorReasons.NO_NFT, content: 'Could not find the uri token for lease extend request.' });
13881
+ reject({ error: ErrorCodes.EXTEND_ERR, reason: ErrorReasons.NO_TOKEN, content: 'Could not find the uri token for lease extend request.' });
13799
13882
  return;
13800
13883
  }
13801
13884
 
@@ -14316,7 +14399,7 @@ const EvernodeConstants = {
14316
14399
  }
14317
14400
  }
14318
14401
 
14319
- const MemoTypes = {
14402
+ const EventTypes = {
14320
14403
  ACQUIRE_LEASE: 'evnAcquireLease',
14321
14404
  ACQUIRE_SUCCESS: 'evnAcquireSuccess',
14322
14405
  ACQUIRE_ERROR: 'evnAcquireError',
@@ -14361,7 +14444,7 @@ const ErrorCodes = {
14361
14444
  const ErrorReasons = {
14362
14445
  TRANSACTION_FAILURE: 'TRANSACTION_FAILURE',
14363
14446
  NO_OFFER: 'NO_OFFER',
14364
- NO_NFT: 'NO_NFT',
14447
+ NO_TOKEN: 'NO_TOKEN',
14365
14448
  INTERNAL_ERR: 'INTERNAL_ERR',
14366
14449
  TIMEOUT: 'TIMEOUT',
14367
14450
  HOST_INVALID: 'HOST_INVALID',
@@ -14404,6 +14487,14 @@ const HookStateKeys = {
14404
14487
  PREFIX_CANDIDATE_ID: "45565206",
14405
14488
  }
14406
14489
 
14490
+ // All keys are prefixed with 'EVR' (0x455652)
14491
+ const HookParamKeys = {
14492
+ PARAM_STATE_HOOK_KEY: "4556520100000000000000000000000000000000000000000000000000000001",
14493
+ PARAM_EVENT_TYPE_KEY: "4556520100000000000000000000000000000000000000000000000000000002",
14494
+ PARAM_EVENT_DATA1_KEY: "4556520100000000000000000000000000000000000000000000000000000003",
14495
+ PARAM_EVENT_DATA2_KEY: "4556520100000000000000000000000000000000000000000000000000000004",
14496
+ }
14497
+
14407
14498
  const EvernodeEvents = {
14408
14499
  HostRegistered: "HostRegistered",
14409
14500
  HostDeregistered: "HostDeregistered",
@@ -14439,13 +14530,14 @@ const URITokenTypes = {
14439
14530
 
14440
14531
  module.exports = {
14441
14532
  EvernodeConstants,
14442
- MemoTypes,
14533
+ EventTypes,
14443
14534
  MemoFormats,
14444
14535
  ErrorCodes,
14445
14536
  ErrorReasons,
14446
14537
  HookStateKeys,
14447
14538
  EvernodeEvents,
14448
- URITokenTypes
14539
+ URITokenTypes,
14540
+ HookParamKeys
14449
14541
  }
14450
14542
 
14451
14543
  /***/ }),
@@ -14888,7 +14980,7 @@ const { FoundationClient, FoundationEvents } = __nccwpck_require__(2466);
14888
14980
  const { XrplApi } = __nccwpck_require__(1850);
14889
14981
  const { XrplApiEvents, XrplConstants } = __nccwpck_require__(3307);
14890
14982
  const { XrplAccount } = __nccwpck_require__(9329);
14891
- const { EvernodeConstants, HookStateKeys, MemoTypes } = __nccwpck_require__(9849);
14983
+ const { EvernodeConstants, HookStateKeys, HookParamKeys, EventTypes } = __nccwpck_require__(9849);
14892
14984
  const { XflHelpers } = __nccwpck_require__(3243);
14893
14985
  const { FirestoreHandler } = __nccwpck_require__(9718);
14894
14986
  const { StateHelpers } = __nccwpck_require__(3860);
@@ -14924,7 +15016,8 @@ module.exports = {
14924
15016
  TransactionHelper,
14925
15017
  EncryptionHelper,
14926
15018
  HookStateKeys,
14927
- MemoTypes,
15019
+ HookParamKeys,
15020
+ EventTypes,
14928
15021
  HookTypes,
14929
15022
  HookClientFactory,
14930
15023
  EvernodeHelpers
@@ -15081,19 +15174,19 @@ class StateHelpers {
15081
15174
  uriTokenId: stateDataBuf.slice(HOST_TOKEN_ID_OFFSET, HOST_COUNTRY_CODE_OFFSET).toString('hex').toUpperCase(),
15082
15175
  countryCode: stateDataBuf.slice(HOST_COUNTRY_CODE_OFFSET, HOST_RESERVED_OFFSET).toString(),
15083
15176
  description: stateDataBuf.slice(HOST_DESCRIPTION_OFFSET, HOST_REG_LEDGER_OFFSET).toString().replace(/\0/g, ''),
15084
- registrationLedger: Number(stateDataBuf.readBigUInt64BE(HOST_REG_LEDGER_OFFSET)),
15085
- registrationFee: Number(stateDataBuf.readBigUInt64BE(HOST_REG_FEE_OFFSET)),
15086
- maxInstances: stateDataBuf.readUInt32BE(HOST_TOT_INS_COUNT_OFFSET),
15087
- activeInstances: stateDataBuf.readUInt32BE(HOST_ACT_INS_COUNT_OFFSET),
15088
- lastHeartbeatIndex: Number(stateDataBuf.readBigUInt64BE(HOST_HEARTBEAT_TIMESTAMP_OFFSET)),
15177
+ registrationLedger: Number(stateDataBuf.readBigUInt64LE(HOST_REG_LEDGER_OFFSET)),
15178
+ registrationFee: Number(stateDataBuf.readBigUInt64LE(HOST_REG_FEE_OFFSET)),
15179
+ maxInstances: stateDataBuf.readUInt32LE(HOST_TOT_INS_COUNT_OFFSET),
15180
+ activeInstances: stateDataBuf.readUInt32LE(HOST_ACT_INS_COUNT_OFFSET),
15181
+ lastHeartbeatIndex: Number(stateDataBuf.readBigUInt64LE(HOST_HEARTBEAT_TIMESTAMP_OFFSET)),
15089
15182
  version: `${stateDataBuf.readUInt8(HOST_VERSION_OFFSET)}.${stateDataBuf.readUInt8(HOST_VERSION_OFFSET + 1)}.${stateDataBuf.readUInt8(HOST_VERSION_OFFSET + 2)}`,
15090
15183
  isATransferer: (stateDataBuf.readUInt8(HOST_TRANSFER_FLAG_OFFSET) === PENDING_TRANSFER) ? TRANSFER_STATES.HAS_A_TRANSFER : TRANSFER_STATES.NO_TRANSFER,
15091
- lastVoteCandidateIdx: stateDataBuf.readUInt32BE(HOST_LAST_VOTE_CANDIDATE_IDX_OFFSET),
15092
- lastVoteTimestamp: Number(stateDataBuf.readBigUInt64BE(HOST_LAST_VOTE_TIMESTAMP_OFFSET)),
15184
+ lastVoteCandidateIdx: stateDataBuf.readUInt32LE(HOST_LAST_VOTE_CANDIDATE_IDX_OFFSET),
15185
+ lastVoteTimestamp: Number(stateDataBuf.readBigUInt64LE(HOST_LAST_VOTE_TIMESTAMP_OFFSET)),
15093
15186
  supportVoteSent: stateDataBuf.readUInt8(HOST_SUPPORT_VOTE_FLAG_OFFSET)
15094
15187
  }
15095
15188
  if (stateDataBuf.length > HOST_REG_TIMESTAMP_OFFSET)
15096
- data.registrationTimestamp = Number(stateDataBuf.readBigUInt64BE(HOST_REG_TIMESTAMP_OFFSET));
15189
+ data.registrationTimestamp = Number(stateDataBuf.readBigUInt64LE(HOST_REG_TIMESTAMP_OFFSET));
15097
15190
  return data;
15098
15191
  }
15099
15192
 
@@ -15101,13 +15194,13 @@ class StateHelpers {
15101
15194
  return {
15102
15195
  address: codec.encodeAccountID(stateDataBuf.slice(HOST_ADDRESS_OFFSET, HOST_CPU_MODEL_NAME_OFFSET)),
15103
15196
  cpuModelName: stateDataBuf.slice(HOST_CPU_MODEL_NAME_OFFSET, HOST_CPU_COUNT_OFFSET).toString().replace(/\x00+$/, ''), // Remove trailing \x00 characters.
15104
- cpuCount: stateDataBuf.readUInt16BE(HOST_CPU_COUNT_OFFSET),
15105
- cpuMHz: stateDataBuf.readUInt16BE(HOST_CPU_SPEED_OFFSET),
15106
- cpuMicrosec: stateDataBuf.readUInt32BE(HOST_CPU_MICROSEC_OFFSET),
15107
- ramMb: stateDataBuf.readUInt32BE(HOST_RAM_MB_OFFSET),
15108
- diskMb: stateDataBuf.readUInt32BE(HOST_DISK_MB_OFFSET),
15197
+ cpuCount: stateDataBuf.readUInt16LE(HOST_CPU_COUNT_OFFSET),
15198
+ cpuMHz: stateDataBuf.readUInt16LE(HOST_CPU_SPEED_OFFSET),
15199
+ cpuMicrosec: stateDataBuf.readUInt32LE(HOST_CPU_MICROSEC_OFFSET),
15200
+ ramMb: stateDataBuf.readUInt32LE(HOST_RAM_MB_OFFSET),
15201
+ diskMb: stateDataBuf.readUInt32LE(HOST_DISK_MB_OFFSET),
15109
15202
  email: stateDataBuf.slice(HOST_EMAIL_ADDRESS_OFFSET, HOST_EMAIL_ADDRESS_OFFSET + HOST_EMAIL_ADDRESS_LEN).toString().toString().replace(/\0/g, ''),
15110
- accumulatedRewardAmount: XflHelpers.toString(stateDataBuf.readBigInt64BE(HOST_ACCUMULATED_REWARD_OFFSET))
15203
+ accumulatedRewardAmount: XflHelpers.toString(stateDataBuf.readBigInt64LE(HOST_ACCUMULATED_REWARD_OFFSET))
15111
15204
  }
15112
15205
  }
15113
15206
 
@@ -15117,7 +15210,7 @@ class StateHelpers {
15117
15210
  futureOwnerAddress: codec.encodeAccountID(stateKeyBuf.slice(12)),
15118
15211
  prevHostAddressKey: this.generateHostAddrStateKey(prevHostClassicAddress),
15119
15212
  prevHostAddress: prevHostClassicAddress,
15120
- transferLedgerIdx: Number(stateDataBuf.readBigUInt64BE(TRANSFER_LEDGER_IDX_OFFSET)),
15213
+ transferLedgerIdx: Number(stateDataBuf.readBigUInt64LE(TRANSFER_LEDGER_IDX_OFFSET)),
15121
15214
  transferredNfTokenId: stateDataBuf.slice(TRANSFERRED_NFT_ID_OFFSET, 60).toString('hex').toUpperCase()
15122
15215
  }
15123
15216
  }
@@ -15155,14 +15248,14 @@ class StateHelpers {
15155
15248
 
15156
15249
  return {
15157
15250
  ownerAddress: codec.encodeAccountID(stateDataBuf.slice(CANDIDATE_OWNER_ADDRESS_OFFSET, CANDIDATE_IDX_OFFSET)),
15158
- index: stateDataBuf.readUInt32BE(CANDIDATE_IDX_OFFSET),
15251
+ index: stateDataBuf.readUInt32LE(CANDIDATE_IDX_OFFSET),
15159
15252
  shortName: stateDataBuf.slice(CANDIDATE_SHORT_NAME_OFFSET, CANDIDATE_CREATED_TIMESTAMP_OFFSET).toString().replace(/\x00+$/, ''), // Remove trailing \x00 characters.
15160
- createdTimestamp: Number(stateDataBuf.readBigUInt64BE(CANDIDATE_CREATED_TIMESTAMP_OFFSET)),
15161
- proposalFee: XflHelpers.toString(stateDataBuf.readBigInt64BE(CANDIDATE_PROPOSAL_FEE_OFFSET)),
15162
- positiveVoteCount: stateDataBuf.readUInt32BE(CANDIDATE_POSITIVE_VOTE_COUNT_OFFSET),
15163
- lastVoteTimestamp: Number(stateDataBuf.readBigUInt64BE(CANDIDATE_LAST_VOTE_TIMESTAMP_OFFSET)),
15253
+ createdTimestamp: Number(stateDataBuf.readBigUInt64LE(CANDIDATE_CREATED_TIMESTAMP_OFFSET)),
15254
+ proposalFee: XflHelpers.toString(stateDataBuf.readBigInt64LE(CANDIDATE_PROPOSAL_FEE_OFFSET)),
15255
+ positiveVoteCount: stateDataBuf.readUInt32LE(CANDIDATE_POSITIVE_VOTE_COUNT_OFFSET),
15256
+ lastVoteTimestamp: Number(stateDataBuf.readBigUInt64LE(CANDIDATE_LAST_VOTE_TIMESTAMP_OFFSET)),
15164
15257
  status: status,
15165
- statusChangeTimestamp: Number(stateDataBuf.readBigUInt64BE(CANDIDATE_STATUS_CHANGE_TIMESTAMP_OFFSET)),
15258
+ statusChangeTimestamp: Number(stateDataBuf.readBigUInt64LE(CANDIDATE_STATUS_CHANGE_TIMESTAMP_OFFSET)),
15166
15259
  foundationVoteStatus: stateDataBuf.readUInt8(CANDIDATE_FOUNDATION_VOTE_STATUS_OFFSET) === EvernodeConstants.CandidateStatuses.CANDIDATE_SUPPORTED ? 'supported' : 'rejected'
15167
15260
  }
15168
15261
  }
@@ -15222,7 +15315,7 @@ class StateHelpers {
15222
15315
  return {
15223
15316
  type: this.StateTypes.SIGLETON,
15224
15317
  key: hexKey,
15225
- value: stateData.readUInt32BE()
15318
+ value: stateData.readUInt32LE()
15226
15319
  }
15227
15320
  }
15228
15321
  else if (Buffer.from(HookStateKeys.MOMENT_BASE_INFO, 'hex').compare(stateKey) === 0) {
@@ -15230,8 +15323,8 @@ class StateHelpers {
15230
15323
  type: this.StateTypes.SIGLETON,
15231
15324
  key: hexKey,
15232
15325
  value: {
15233
- baseIdx: Number(stateData.readBigUInt64BE(MOMENT_BASE_POINT_OFFSET)),
15234
- baseTransitionMoment: stateData.length > MOMENT_AT_TRANSITION_OFFSET ? stateData.readUInt32BE(MOMENT_AT_TRANSITION_OFFSET) : 0,
15326
+ baseIdx: Number(stateData.readBigUInt64LE(MOMENT_BASE_POINT_OFFSET)),
15327
+ baseTransitionMoment: stateData.length > MOMENT_AT_TRANSITION_OFFSET ? stateData.readUInt32LE(MOMENT_AT_TRANSITION_OFFSET) : 0,
15235
15328
  momentType: (stateData.length <= MOMENT_TYPE_OFFSET || stateData.readUInt8(MOMENT_TYPE_OFFSET) === MOMENT_TYPES.LEDGER) ? 'ledger' : 'timestamp'
15236
15329
  }
15237
15330
  }
@@ -15240,7 +15333,7 @@ class StateHelpers {
15240
15333
  return {
15241
15334
  type: this.StateTypes.SIGLETON,
15242
15335
  key: hexKey,
15243
- value: Number(stateData.readBigUInt64BE())
15336
+ value: Number(stateData.readBigUInt64LE())
15244
15337
  }
15245
15338
  }
15246
15339
  else if (Buffer.from(HookStateKeys.REGISTRY_ADDR, 'hex').compare(stateKey) === 0 ||
@@ -15259,14 +15352,14 @@ class StateHelpers {
15259
15352
  return {
15260
15353
  type: this.StateTypes.CONFIGURATION,
15261
15354
  key: hexKey,
15262
- value: stateData.readUInt16BE()
15355
+ value: stateData.readUInt16LE()
15263
15356
  }
15264
15357
  }
15265
15358
  else if (Buffer.from(HookStateKeys.MINT_LIMIT, 'hex').compare(stateKey) === 0 || Buffer.from(HookStateKeys.FIXED_REG_FEE, 'hex').compare(stateKey) === 0) {
15266
15359
  return {
15267
15360
  type: this.StateTypes.CONFIGURATION,
15268
15361
  key: hexKey,
15269
- value: Number(stateData.readBigUInt64BE())
15362
+ value: Number(stateData.readBigUInt64LE())
15270
15363
  }
15271
15364
  }
15272
15365
  else if (Buffer.from(HookStateKeys.REWARD_CONFIGURATION, 'hex').compare(stateKey) === 0) {
@@ -15275,10 +15368,10 @@ class StateHelpers {
15275
15368
  key: hexKey,
15276
15369
  value: {
15277
15370
  epochCount: stateData.readUInt8(EPOCH_COUNT_OFFSET),
15278
- firstEpochRewardQuota: stateData.readUInt32BE(FIRST_EPOCH_REWARD_QUOTA_OFFSET),
15279
- epochRewardAmount: stateData.readUInt32BE(EPOCH_REWARD_AMOUNT_OFFSET),
15280
- rewardStartMoment: stateData.readUInt32BE(REWARD_START_MOMENT_OFFSET),
15281
- accumulatedRewardFrequency: stateData.readUInt16BE(ACCUMULATED_REWARD_FREQUENCY_OFFSET)
15371
+ firstEpochRewardQuota: stateData.readUInt32LE(FIRST_EPOCH_REWARD_QUOTA_OFFSET),
15372
+ epochRewardAmount: stateData.readUInt32LE(EPOCH_REWARD_AMOUNT_OFFSET),
15373
+ rewardStartMoment: stateData.readUInt32LE(REWARD_START_MOMENT_OFFSET),
15374
+ accumulatedRewardFrequency: stateData.readUInt16LE(ACCUMULATED_REWARD_FREQUENCY_OFFSET)
15282
15375
  }
15283
15376
  }
15284
15377
  }
@@ -15288,10 +15381,10 @@ class StateHelpers {
15288
15381
  key: hexKey,
15289
15382
  value: {
15290
15383
  epoch: stateData.readUInt8(EPOCH_OFFSET),
15291
- savedMoment: stateData.readUInt32BE(SAVED_MOMENT_OFFSET),
15292
- prevMomentActiveHostCount: stateData.readUInt32BE(PREV_MOMENT_ACTIVE_HOST_COUNT_OFFSET),
15293
- curMomentActiveHostCount: stateData.readUInt32BE(CUR_MOMENT_ACTIVE_HOST_COUNT_OFFSET),
15294
- epochPool: XflHelpers.toString(stateData.readBigInt64BE(EPOCH_POOL_OFFSET))
15384
+ savedMoment: stateData.readUInt32LE(SAVED_MOMENT_OFFSET),
15385
+ prevMomentActiveHostCount: stateData.readUInt32LE(PREV_MOMENT_ACTIVE_HOST_COUNT_OFFSET),
15386
+ curMomentActiveHostCount: stateData.readUInt32LE(CUR_MOMENT_ACTIVE_HOST_COUNT_OFFSET),
15387
+ epochPool: XflHelpers.toString(stateData.readBigInt64LE(EPOCH_POOL_OFFSET))
15295
15388
  }
15296
15389
  }
15297
15390
  }
@@ -15299,7 +15392,7 @@ class StateHelpers {
15299
15392
  return {
15300
15393
  type: this.StateTypes.CONFIGURATION,
15301
15394
  key: hexKey,
15302
- value: stateData.readUInt16BE()
15395
+ value: stateData.readUInt16LE()
15303
15396
  }
15304
15397
  }
15305
15398
  else if (Buffer.from(HookStateKeys.MOMENT_TRANSIT_INFO, 'hex').compare(stateKey) === 0) {
@@ -15308,8 +15401,8 @@ class StateHelpers {
15308
15401
  type: this.StateTypes.CONFIGURATION,
15309
15402
  key: hexKey,
15310
15403
  value: {
15311
- transitionIndex: Number(stateData.readBigInt64BE(TRANSIT_IDX_OFFSET)),
15312
- momentSize: stateData.readUInt16BE(TRANSIT_MOMENT_SIZE_OFFSET),
15404
+ transitionIndex: Number(stateData.readBigInt64LE(TRANSIT_IDX_OFFSET)),
15405
+ momentSize: stateData.readUInt16LE(TRANSIT_MOMENT_SIZE_OFFSET),
15313
15406
  momentType: stateData.readUInt8(TRANSIT_MOMENT_TYPE_OFFSET) === MOMENT_TYPES.LEDGER ? 'ledger' : 'timestamp'
15314
15407
  }
15315
15408
  }
@@ -15318,7 +15411,7 @@ class StateHelpers {
15318
15411
  return {
15319
15412
  type: this.StateTypes.CONFIGURATION,
15320
15413
  key: hexKey,
15321
- value: Number(stateData.readBigUInt64BE())
15414
+ value: Number(stateData.readBigUInt64LE())
15322
15415
  }
15323
15416
  }
15324
15417
  else if (Buffer.from(HookStateKeys.GOVERNANCE_CONFIGURATION, 'hex').compare(stateKey) === 0) {
@@ -15326,10 +15419,10 @@ class StateHelpers {
15326
15419
  type: this.StateTypes.CONFIGURATION,
15327
15420
  key: hexKey,
15328
15421
  value: {
15329
- eligibilityPeriod: stateData.readUInt32BE(ELIGIBILITY_PERIOD_OFFSET),
15330
- candidateLifePeriod: stateData.readUInt32BE(CANDIDATE_LIFE_PERIOD_OFFSET),
15331
- candidateElectionPeriod: stateData.readUInt32BE(CANDIDATE_ELECTION_PERIOD_OFFSET),
15332
- candidateSupportAverage: stateData.readUInt16BE(CANDIDATE_SUPPORT_AVERAGE_OFFSET)
15422
+ eligibilityPeriod: stateData.readUInt32LE(ELIGIBILITY_PERIOD_OFFSET),
15423
+ candidateLifePeriod: stateData.readUInt32LE(CANDIDATE_LIFE_PERIOD_OFFSET),
15424
+ candidateElectionPeriod: stateData.readUInt32LE(CANDIDATE_ELECTION_PERIOD_OFFSET),
15425
+ candidateSupportAverage: stateData.readUInt16LE(CANDIDATE_SUPPORT_AVERAGE_OFFSET)
15333
15426
  }
15334
15427
  }
15335
15428
  }
@@ -15354,13 +15447,13 @@ class StateHelpers {
15354
15447
  key: hexKey,
15355
15448
  value: {
15356
15449
  governanceMode: mode,
15357
- lastCandidateIdx: stateData.readUInt32BE(LAST_CANDIDATE_IDX_OFFSET),
15358
- voteBaseCount: stateData.readUInt32BE(VOTER_BASE_COUNT_OFFSET),
15359
- voteBaseCountChangedTimestamp: Number(stateData.readBigUInt64BE(VOTER_BASE_COUNT_CHANGED_TIMESTAMP_OFFSET)),
15360
- foundationLastVotedCandidateIdx: stateData.readUInt32BE(FOUNDATION_LAST_VOTED_CANDIDATE_IDX),
15361
- foundationLastVotedTimestamp: Number(stateData.readBigUInt64BE(FOUNDATION_LAST_VOTED_TIMESTAMP_OFFSET)),
15450
+ lastCandidateIdx: stateData.readUInt32LE(LAST_CANDIDATE_IDX_OFFSET),
15451
+ voteBaseCount: stateData.readUInt32LE(VOTER_BASE_COUNT_OFFSET),
15452
+ voteBaseCountChangedTimestamp: Number(stateData.readBigUInt64LE(VOTER_BASE_COUNT_CHANGED_TIMESTAMP_OFFSET)),
15453
+ foundationLastVotedCandidateIdx: stateData.readUInt32LE(FOUNDATION_LAST_VOTED_CANDIDATE_IDX),
15454
+ foundationLastVotedTimestamp: Number(stateData.readBigUInt64LE(FOUNDATION_LAST_VOTED_TIMESTAMP_OFFSET)),
15362
15455
  electedProposalUniqueId: stateData.slice(ELECTED_PROPOSAL_UNIQUE_ID_OFFSET, PROPOSAL_ELECTED_TIMESTAMP_OFFSET).toString('hex').toUpperCase(),
15363
- proposalElectedTimestamp: Number(stateData.readBigUInt64BE(PROPOSAL_ELECTED_TIMESTAMP_OFFSET)),
15456
+ proposalElectedTimestamp: Number(stateData.readBigUInt64LE(PROPOSAL_ELECTED_TIMESTAMP_OFFSET)),
15364
15457
  updatedHookCount: stateData.readUInt8(UPDATED_HOOK_COUNT_OFFSET),
15365
15458
  supportVoteSent: stateData.readUInt8(FOUNDATION_SUPPORT_VOTE_FLAG_OFFSET)
15366
15459
  }
@@ -15553,7 +15646,7 @@ module.exports = {
15553
15646
  /***/ 7071:
15554
15647
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
15555
15648
 
15556
- const { MemoFormats } = __nccwpck_require__(9849);
15649
+ const { MemoFormats, HookParamKeys } = __nccwpck_require__(9849);
15557
15650
 
15558
15651
  class TransactionHelper {
15559
15652
 
@@ -15589,26 +15682,47 @@ class TransactionHelper {
15589
15682
  })
15590
15683
  }
15591
15684
 
15685
+ // Convert hook params from our object type to xrpl lib object type.
15686
+ static formatHookParams(params) {
15687
+ return params ? params.filter(m => m.name).map(m => {
15688
+ return {
15689
+ HookParameter: {
15690
+ HookParameterName: m.name,
15691
+ HookParameterValue: m.value ?
15692
+ (m.name === HookParamKeys.PARAM_EVENT_TYPE_KEY ? TransactionHelper.asciiToHex(m.value) :
15693
+ m.value.toUpperCase()) : ''
15694
+ }
15695
+ }
15696
+ }) : [];
15697
+ }
15698
+
15699
+ // Convert hook params from xrpl lib object type to our object type.
15700
+ static deserializeHookParams(params) {
15701
+ if (!params)
15702
+ return [];
15703
+
15704
+ return params.filter(m => m.HookParameter).map(m => {
15705
+ return {
15706
+ name: m.HookParameter.HookParameterName,
15707
+ value: m.HookParameter.HookParameterValue ?
15708
+ (m.HookParameter.HookParameterName === HookParamKeys.PARAM_EVENT_TYPE_KEY ? TransactionHelper.hexToASCII(m.HookParameter.HookParameterValue) :
15709
+ m.HookParameter.HookParameterValue.toUpperCase()) : '',
15710
+ }
15711
+ })
15712
+ }
15713
+
15592
15714
  static hexToASCII(hex) {
15593
15715
  if (!hex)
15594
15716
  return "";
15595
15717
 
15596
- let str = "";
15597
- for (let n = 0; n < hex.length; n += 2) {
15598
- str += String.fromCharCode(parseInt(hex.substr(n, 2), 16));
15599
- }
15600
- return str;
15718
+ return Buffer.from(hex, 'hex').toString();
15601
15719
  }
15602
15720
 
15603
15721
  static asciiToHex(str) {
15604
15722
  if (!str)
15605
15723
  return "";
15606
15724
 
15607
- let hex = "";
15608
- for (let n = 0; n < str.length; n++) {
15609
- hex += str.charCodeAt(n).toString(16)
15610
- }
15611
- return hex;
15725
+ return Buffer.from(str).toString('hex').toUpperCase();
15612
15726
  }
15613
15727
  }
15614
15728
 
@@ -15623,28 +15737,12 @@ module.exports = {
15623
15737
 
15624
15738
  const { Buffer } = __nccwpck_require__(4300);
15625
15739
  const { XflHelpers } = __nccwpck_require__(3243);
15626
- const { EvernodeConstants, ErrorReasons } = __nccwpck_require__(9849);
15740
+ const { EvernodeConstants } = __nccwpck_require__(9849);
15627
15741
  const { TransactionHelper } = __nccwpck_require__(7071);
15628
15742
 
15629
15743
  // Utility helper functions.
15630
15744
  class UtilHelpers {
15631
15745
 
15632
- static readUInt(buf, base = 32, isBE = true) {
15633
- buf = Buffer.from(buf);
15634
- switch (base) {
15635
- case (8):
15636
- return buf.readUInt8();
15637
- case (16):
15638
- return isBE ? buf.readUInt16BE() : buf.readUInt16LE();
15639
- case (32):
15640
- return isBE ? buf.readUInt32BE() : buf.readUInt32LE();
15641
- case (64):
15642
- return isBE ? Number(buf.readBigUInt64BE()) : Number(buf.readBigUInt64LE());
15643
- default:
15644
- throw 'Invalid base value';
15645
- }
15646
- }
15647
-
15648
15746
  static decodeLeaseNftUri(hexUri) {
15649
15747
  // Get the lease index from the nft URI.
15650
15748
  // <prefix><lease index (uint16)><half of tos hash (16 bytes)><lease amount (uint32)>
@@ -16062,7 +16160,8 @@ class XrplAccount {
16062
16160
  Account: this.address,
16063
16161
  Amount: amountObj,
16064
16162
  Destination: toAddr,
16065
- Memos: TransactionHelper.formatMemos(memos)
16163
+ Memos: TransactionHelper.formatMemos(memos),
16164
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16066
16165
  }, options);
16067
16166
  }
16068
16167
 
@@ -16079,7 +16178,8 @@ class XrplAccount {
16079
16178
  issuer: issuer,
16080
16179
  value: limit
16081
16180
  },
16082
- Memos: TransactionHelper.formatMemos(memos)
16181
+ Memos: TransactionHelper.formatMemos(memos),
16182
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16083
16183
  };
16084
16184
 
16085
16185
  if (!allowRippling)
@@ -16094,7 +16194,8 @@ class XrplAccount {
16094
16194
  TransactionType: 'SetRegularKey',
16095
16195
  Account: this.address,
16096
16196
  RegularKey: regularKey,
16097
- Memos: TransactionHelper.formatMemos(memos)
16197
+ Memos: TransactionHelper.formatMemos(memos),
16198
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16098
16199
  }, options);
16099
16200
  }
16100
16201
 
@@ -16131,7 +16232,8 @@ class XrplAccount {
16131
16232
  TakerGets: sellAmountObj,
16132
16233
  TakerPays: forAmountObj,
16133
16234
  Expiration: expiration,
16134
- Memos: TransactionHelper.formatMemos(memos)
16235
+ Memos: TransactionHelper.formatMemos(memos),
16236
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16135
16237
  }, options);
16136
16238
  }
16137
16239
 
@@ -16146,7 +16248,8 @@ class XrplAccount {
16146
16248
  TakerGets: forAmountObj,
16147
16249
  TakerPays: buyAmountObj,
16148
16250
  Expiration: expiration,
16149
- Memos: TransactionHelper.formatMemos(memos)
16251
+ Memos: TransactionHelper.formatMemos(memos),
16252
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16150
16253
  }, options);
16151
16254
  }
16152
16255
 
@@ -16155,7 +16258,8 @@ class XrplAccount {
16155
16258
  TransactionType: 'OfferCancel',
16156
16259
  Account: this.address,
16157
16260
  OfferSequence: offerSequence,
16158
- Memos: TransactionHelper.formatMemos(memos)
16261
+ Memos: TransactionHelper.formatMemos(memos),
16262
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16159
16263
  }, options);
16160
16264
  }
16161
16265
 
@@ -16167,7 +16271,8 @@ class XrplAccount {
16167
16271
  NFTokenTaxon: taxon,
16168
16272
  TransferFee: transferFee,
16169
16273
  Flags: (flags.isBurnable ? 1 : 0) | (flags.isOnlyXRP ? 2 : 0) | (flags.isTrustLine ? 4 : 0) | (flags.isTransferable ? 8 : 0),
16170
- Memos: TransactionHelper.formatMemos(memos)
16274
+ Memos: TransactionHelper.formatMemos(memos),
16275
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16171
16276
  }, options);
16172
16277
  }
16173
16278
 
@@ -16181,7 +16286,8 @@ class XrplAccount {
16181
16286
  Amount: amountObj,
16182
16287
  Expiration: expiration,
16183
16288
  Flags: 1, // tfSellToken
16184
- Memos: TransactionHelper.formatMemos(memos)
16289
+ Memos: TransactionHelper.formatMemos(memos),
16290
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16185
16291
  };
16186
16292
 
16187
16293
  return this.#submitAndVerifyTransaction(destination ? { ...tx, Destination: destination } : tx, options);
@@ -16199,7 +16305,8 @@ class XrplAccount {
16199
16305
  Amount: amountObj,
16200
16306
  Expiration: expiration,
16201
16307
  Flags: 0, // Buy offer
16202
- Memos: TransactionHelper.formatMemos(memos)
16308
+ Memos: TransactionHelper.formatMemos(memos),
16309
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16203
16310
  }, options);
16204
16311
  }
16205
16312
 
@@ -16209,7 +16316,8 @@ class XrplAccount {
16209
16316
  TransactionType: 'NFTokenAcceptOffer',
16210
16317
  Account: this.address,
16211
16318
  NFTokenBuyOffer: offerId,
16212
- Memos: TransactionHelper.formatMemos(memos)
16319
+ Memos: TransactionHelper.formatMemos(memos),
16320
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16213
16321
  }, options);
16214
16322
  }
16215
16323
 
@@ -16219,7 +16327,8 @@ class XrplAccount {
16219
16327
  TransactionType: 'NFTokenAcceptOffer',
16220
16328
  Account: this.address,
16221
16329
  NFTokenSellOffer: offerId,
16222
- Memos: TransactionHelper.formatMemos(memos)
16330
+ Memos: TransactionHelper.formatMemos(memos),
16331
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16223
16332
  }, options);
16224
16333
  }
16225
16334
 
@@ -16229,7 +16338,8 @@ class XrplAccount {
16229
16338
  TransactionType: 'NFTokenBurn',
16230
16339
  Account: this.address,
16231
16340
  NFTokenID: nfTokenId,
16232
- Memos: TransactionHelper.formatMemos(memos)
16341
+ Memos: TransactionHelper.formatMemos(memos),
16342
+ HookParameters: TransactionHelper.formatHookParams(options.hookParams)
16233
16343
  };
16234
16344
 
16235
16345
  return this.#submitAndVerifyTransaction(owner ? { ...tx, Owner: owner } : tx, options);
@@ -16317,7 +16427,7 @@ class XrplAccount {
16317
16427
  const hookExecRes = txResult.details?.meta?.HookExecutions?.map(o => {
16318
16428
  return {
16319
16429
  result: o.HookExecution?.HookResult,
16320
- returnCode: o.HookExecution?.HookReturnCode,
16430
+ returnCode: parseInt(o.HookExecution?.HookReturnCode, 16),
16321
16431
  message: TransactionHelper.hexToASCII(o.HookExecution?.HookReturnString).replace(/\x00+$/, '')
16322
16432
  }
16323
16433
  });
@@ -16362,7 +16472,7 @@ class XrplAccount {
16362
16472
  const hookExecRes = txResult.details?.meta?.HookExecutions?.map(o => {
16363
16473
  return {
16364
16474
  result: o.HookExecution?.HookResult,
16365
- returnCode: o.HookExecution?.HookReturnCode,
16475
+ returnCode: parseInt(o.HookExecution?.HookReturnCode, 16),
16366
16476
  message: TransactionHelper.hexToASCII(o.HookExecution?.HookReturnString).replace(/\x00+$/, '')
16367
16477
  }
16368
16478
  });
@@ -16430,6 +16540,9 @@ class XrplAccount {
16430
16540
  if (memos)
16431
16541
  tx.Memos = TransactionHelper.formatMemos(memos);
16432
16542
 
16543
+ if (options.hookParams)
16544
+ tx.HookParameters = TransactionHelper.formatHookParams(options.hookParams);
16545
+
16433
16546
  return this.#submitAndVerifyTransaction(tx, options);
16434
16547
  }
16435
16548
 
@@ -16444,6 +16557,9 @@ class XrplAccount {
16444
16557
  if (memos)
16445
16558
  tx.Memos = TransactionHelper.formatMemos(memos);
16446
16559
 
16560
+ if (options.hookParams)
16561
+ tx.HookParameters = TransactionHelper.formatHookParams(options.hookParams);
16562
+
16447
16563
  return this.#submitAndVerifyTransaction(tx, options);
16448
16564
  }
16449
16565
 
@@ -16612,6 +16728,7 @@ class XrplApi {
16612
16728
  // Emit the event only for successful transactions, Otherwise emit error.
16613
16729
  if (data.engine_result === "tesSUCCESS") {
16614
16730
  tx.Memos = TransactionHelper.deserializeMemos(tx.Memos);
16731
+ tx.HookParameters = TransactionHelper.deserializeHookParams(tx.HookParameters);
16615
16732
  matches.forEach(s => s.handler(eventName, tx));
16616
16733
  }
16617
16734
  else {