evernode-js-client 0.5.15 → 0.5.17-beta-v3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -11733,6 +11733,14 @@ const { UtilHelpers } = __nccwpck_require__(6687);
11733
11733
  const { FirestoreHandler } = __nccwpck_require__(9718);
11734
11734
  const { StateHelpers } = __nccwpck_require__(3860);
11735
11735
  const { EvernodeHelpers } = __nccwpck_require__(2523);
11736
+ const { HookHelpers } = __nccwpck_require__(4675);
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;
11742
+
11743
+ const DUD_HOST_CANDID_ADDRESS_OFFSET = 12;
11736
11744
 
11737
11745
  class BaseEvernodeClient {
11738
11746
 
@@ -11744,7 +11752,7 @@ class BaseEvernodeClient {
11744
11752
  constructor(xrpAddress, xrpSecret, watchEvents, autoSubscribe = false, options = {}) {
11745
11753
 
11746
11754
  this.connected = false;
11747
- this.registryAddress = options.registryAddress || DefaultValues.registryAddress;
11755
+ this.governorAddress = options.governorAddress || DefaultValues.governorAddress;
11748
11756
 
11749
11757
  this.xrplApi = options.xrplApi || DefaultValues.xrplApi || new XrplApi(options.rippledServer);
11750
11758
  if (!options.xrplApi && !DefaultValues.xrplApi)
@@ -11758,9 +11766,8 @@ class BaseEvernodeClient {
11758
11766
  this.#firestoreHandler = new FirestoreHandler()
11759
11767
 
11760
11768
  this.xrplAcc.on(XrplApiEvents.PAYMENT, (tx, error) => this.#handleEvernodeEvent(tx, error));
11761
- this.xrplAcc.on(XrplApiEvents.NFT_OFFER_CREATE, (tx, error) => this.#handleEvernodeEvent(tx, error));
11762
- this.xrplAcc.on(XrplApiEvents.NFT_OFFER_ACCEPT, (tx, error) => this.#handleEvernodeEvent(tx, error));
11763
-
11769
+ this.xrplAcc.on(XrplApiEvents.URI_TOKEN_BUY, (tx, error) => this.#handleEvernodeEvent(tx, error));
11770
+ this.xrplAcc.on(XrplApiEvents.URI_TOKEN_CREATE_SELL_OFFER, (tx, error) => this.#handleEvernodeEvent(tx, error));
11764
11771
  }
11765
11772
 
11766
11773
  /**
@@ -11824,21 +11831,21 @@ class BaseEvernodeClient {
11824
11831
  }
11825
11832
 
11826
11833
  /**
11827
- * Subscribes to the registry client events.
11834
+ * Subscribes to the client events.
11828
11835
  */
11829
11836
  async subscribe() {
11830
11837
  await this.xrplAcc.subscribe();
11831
11838
  }
11832
11839
 
11833
11840
  /**
11834
- * Unsubscribes from the registry client events.
11841
+ * Unsubscribes from the client events.
11835
11842
  */
11836
11843
  async unsubscribe() {
11837
11844
  await this.xrplAcc.unsubscribe();
11838
11845
  }
11839
11846
 
11840
11847
  /**
11841
- * Get the EVR balance in the registry account.
11848
+ * Get the EVR balance in the account.
11842
11849
  * @returns The available EVR amount as a 'string'.
11843
11850
  */
11844
11851
  async getEVRBalance() {
@@ -11854,7 +11861,7 @@ class BaseEvernodeClient {
11854
11861
  * @returns The list of hook states including Evernode configuration and hosts.
11855
11862
  */
11856
11863
  async getHookStates() {
11857
- const regAcc = new XrplAccount(this.registryAddress, null, { xrplApi: this.xrplApi });
11864
+ const regAcc = new XrplAccount(this.governorAddress, null, { xrplApi: this.xrplApi });
11858
11865
  const configs = await regAcc.getNamespaceEntries(EvernodeConstants.HOOK_NAMESPACE);
11859
11866
 
11860
11867
  if (configs)
@@ -11895,19 +11902,22 @@ class BaseEvernodeClient {
11895
11902
  async #getEvernodeConfig() {
11896
11903
  let states = await this.getHookStates();
11897
11904
  const configStateKeys = {
11905
+ registryAddress: HookStateKeys.REGISTRY_ADDR,
11906
+ heartbeatAddress: HookStateKeys.HEARTBEAT_ADDR,
11898
11907
  evrIssuerAddress: HookStateKeys.EVR_ISSUER_ADDR,
11899
11908
  foundationAddress: HookStateKeys.FOUNDATION_ADDR,
11900
11909
  hostRegFee: HookStateKeys.HOST_REG_FEE,
11901
11910
  momentSize: HookStateKeys.MOMENT_SIZE,
11902
11911
  hostHeartbeatFreq: HookStateKeys.HOST_HEARTBEAT_FREQ,
11903
11912
  momentBaseInfo: HookStateKeys.MOMENT_BASE_INFO,
11904
- purchaserTargetPrice: HookStateKeys.PURCHASER_TARGET_PRICE,
11905
11913
  leaseAcquireWindow: HookStateKeys.LEASE_ACQUIRE_WINDOW,
11906
11914
  rewardInfo: HookStateKeys.REWARD_INFO,
11907
11915
  rewardConfiguration: HookStateKeys.REWARD_CONFIGURATION,
11908
11916
  hostCount: HookStateKeys.HOST_COUNT,
11909
11917
  momentTransitInfo: HookStateKeys.MOMENT_TRANSIT_INFO,
11910
- registryMaxTrxEmitFee: HookStateKeys.MAX_TRX_EMISSION_FEE
11918
+ registryMaxTrxEmitFee: HookStateKeys.MAX_TRX_EMISSION_FEE,
11919
+ governanceConfiguration: HookStateKeys.GOVERNANCE_CONFIGURATION,
11920
+ governanceInfo: HookStateKeys.GOVERNANCE_INFO
11911
11921
  }
11912
11922
  let config = {};
11913
11923
  for (const [key, value] of Object.entries(configStateKeys)) {
@@ -11952,7 +11962,7 @@ class BaseEvernodeClient {
11952
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.
11953
11963
  */
11954
11964
  async extractEvernodeEvent(tx) {
11955
- if (tx.TransactionType === 'NFTokenAcceptOffer' && tx.NFTokenSellOffer && tx.Memos.length >= 1 &&
11965
+ if (tx.TransactionType === 'URITokenBuy' && tx.Memos.length >= 1 &&
11956
11966
  tx.Memos[0].type === MemoTypes.ACQUIRE_LEASE && tx.Memos[0].format === MemoFormats.BASE64 && tx.Memos[0].data) {
11957
11967
 
11958
11968
  // If our account is the destination host account, then decrypt the payload.
@@ -11970,8 +11980,8 @@ class BaseEvernodeClient {
11970
11980
  data: {
11971
11981
  transaction: tx,
11972
11982
  host: tx.Destination,
11973
- nfTokenId: tx.NFTokenSellOffer?.NFTokenID,
11974
- leaseAmount: tx.NFTokenSellOffer?.Amount?.value,
11983
+ uriTokenId: tx.URITokenSellOffer?.index,
11984
+ leaseAmount: tx.URITokenSellOffer?.Amount?.value,
11975
11985
  acquireRefId: tx.hash,
11976
11986
  tenant: tx.Account,
11977
11987
  payload: payload
@@ -11979,19 +11989,6 @@ class BaseEvernodeClient {
11979
11989
  }
11980
11990
  }
11981
11991
 
11982
- else if (tx.TransactionType === 'NFTokenAcceptOffer' && tx.NFTokenBuyOffer && tx.Memos.length >= 1 &&
11983
- tx.Memos[0].type === MemoTypes.HOST_POST_DEREG && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
11984
- return {
11985
- name: EvernodeEvents.HostPostDeregistered,
11986
- data: {
11987
- transaction: tx,
11988
- nfTokenId: tx.NFTokenBuyOffer.NFTokenID,
11989
- flags: tx.Flags,
11990
- hash: tx.hash
11991
- }
11992
- }
11993
- }
11994
-
11995
11992
  else if (tx.Memos.length >= 2 &&
11996
11993
  tx.Memos[0].type === MemoTypes.ACQUIRE_SUCCESS && tx.Memos[0].data &&
11997
11994
  tx.Memos[1].type === MemoTypes.ACQUIRE_REF && tx.Memos[1].data) {
@@ -12060,18 +12057,27 @@ class BaseEvernodeClient {
12060
12057
  else if (tx.Memos.length >= 1 &&
12061
12058
  tx.Memos[0].type === MemoTypes.HEARTBEAT) {
12062
12059
 
12060
+ const voteInfo = (tx.Memos[0].data && tx.Memos[0].data.length) ?
12061
+ {
12062
+ voteInfo: {
12063
+ candidateId: tx.Memos[0].data.substr(0, 64),
12064
+ vote: Buffer.from(tx.Memos[0].data, 'hex').slice(32, 33).readUInt8()
12065
+ }
12066
+ } : {};
12067
+
12063
12068
  return {
12064
12069
  name: EvernodeEvents.Heartbeat,
12065
12070
  data: {
12066
12071
  transaction: tx,
12067
- host: tx.Account
12072
+ host: tx.Account,
12073
+ ...voteInfo
12068
12074
  }
12069
12075
  }
12070
12076
  }
12071
12077
  else if (tx.Memos.length >= 1 &&
12072
12078
  tx.Memos[0].type === MemoTypes.EXTEND_LEASE && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12073
12079
 
12074
- let nfTokenId = tx.Memos[0].data;
12080
+ let uriTokenId = tx.Memos[0].data;
12075
12081
 
12076
12082
  return {
12077
12083
  name: EvernodeEvents.ExtendLease,
@@ -12081,7 +12087,7 @@ class BaseEvernodeClient {
12081
12087
  tenant: tx.Account,
12082
12088
  currency: tx.Amount.currency,
12083
12089
  payment: parseFloat(tx.Amount.value),
12084
- nfTokenId: nfTokenId
12090
+ uriTokenId: uriTokenId
12085
12091
  }
12086
12092
  }
12087
12093
  }
@@ -12122,10 +12128,10 @@ class BaseEvernodeClient {
12122
12128
  }
12123
12129
  }
12124
12130
  else if (tx.Memos.length >= 1 &&
12125
- tx.Memos[0].type === MemoTypes.REGISTRY_INIT && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12131
+ tx.Memos[0].type === MemoTypes.INIT && tx.Memos[0].format === MemoFormats.HEX && tx.Memos[0].data) {
12126
12132
 
12127
12133
  return {
12128
- name: EvernodeEvents.RegistryInitialized,
12134
+ name: EvernodeEvents.Initialized,
12129
12135
  data: {
12130
12136
  transaction: tx
12131
12137
  }
@@ -12179,6 +12185,116 @@ class BaseEvernodeClient {
12179
12185
  }
12180
12186
  }
12181
12187
  }
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) {
12191
+
12192
+ return {
12193
+ name: EvernodeEvents.CandidateProposed,
12194
+ data: {
12195
+ transaction: tx,
12196
+ owner: tx.Account,
12197
+ candidateId: tx.Memos[1].data.substr(0, 64)
12198
+ }
12199
+ }
12200
+ }
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) {
12203
+ return {
12204
+ name: EvernodeEvents.CandidateWithdrew,
12205
+ data: {
12206
+ transaction: tx,
12207
+ owner: tx.Account,
12208
+ candidateId: tx.Memos[0].data.substr(0, 64)
12209
+ }
12210
+ }
12211
+ }
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');
12216
+ const candidateType = StateHelpers.getCandidateType(candidateId);
12217
+
12218
+ switch (candidateType) {
12219
+ case (EvernodeConstants.CandidateTypes.DudHost):
12220
+ return {
12221
+ name: memoBuf.readUInt8(32) === EvernodeConstants.CandidateStatuses.CANDIDATE_ELECTED ? EvernodeEvents.DudHostRemoved : EvernodeEvents.DudHostStatusChanged,
12222
+ data: {
12223
+ transaction: tx,
12224
+ candidateId: candidateId,
12225
+ host: codec.encodeAccountID(Buffer.from(candidateId, 'hex').slice(DUD_HOST_CANDID_ADDRESS_OFFSET, 32))
12226
+ }
12227
+ }
12228
+ case (EvernodeConstants.CandidateTypes.PilotedMode):
12229
+ return {
12230
+ name: EvernodeEvents.FallbackToPiloted,
12231
+ data: {
12232
+ transaction: tx,
12233
+ candidateId: candidateId,
12234
+ }
12235
+ }
12236
+ case (EvernodeConstants.CandidateTypes.NewHook):
12237
+ return {
12238
+ name: EvernodeEvents.NewHookStatusChanged,
12239
+ data: {
12240
+ transaction: tx,
12241
+ candidateId: candidateId,
12242
+ }
12243
+ }
12244
+ default:
12245
+ return null;
12246
+ }
12247
+
12248
+ }
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) {
12251
+ return {
12252
+ name: EvernodeEvents.ChildHookUpdated,
12253
+ data: {
12254
+ transaction: tx,
12255
+ account: tx.Account,
12256
+ candidateId: tx.Memos[0].data.substr(0, 64)
12257
+ }
12258
+ }
12259
+ }
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();
12263
+
12264
+ return {
12265
+ name: EvernodeEvents.GovernanceModeChanged,
12266
+ data: {
12267
+ transaction: tx,
12268
+ mode: mode
12269
+ }
12270
+ }
12271
+ }
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();
12275
+
12276
+ return {
12277
+ name: EvernodeEvents.FoundationVoted,
12278
+ data: {
12279
+ transaction: tx,
12280
+ candidateId: tx.Memos[0].data.substr(0, 64),
12281
+ vote: vote
12282
+ }
12283
+ }
12284
+ }
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);
12288
+
12289
+ return {
12290
+ name: EvernodeEvents.DudHostReported,
12291
+ data: {
12292
+ transaction: tx,
12293
+ candidateId: candidateId,
12294
+ host: codec.encodeAccountID(Buffer.from(candidateId, 'hex').slice(DUD_HOST_CANDID_ADDRESS_OFFSET, 32))
12295
+ }
12296
+ }
12297
+ }
12182
12298
 
12183
12299
  return null;
12184
12300
  }
@@ -12186,12 +12302,12 @@ class BaseEvernodeClient {
12186
12302
  /**
12187
12303
  * Get the registered host information.
12188
12304
  * @param {string} hostAddress [Optional] Address of the host.
12189
- * @returns The registered host information object. Returns null is not registered.
12305
+ * @returns The registered host information object. Returns null if not registered.
12190
12306
  */
12191
12307
  async getHostInfo(hostAddress = this.xrplAcc.address) {
12192
12308
  try {
12193
12309
  const addrStateKey = StateHelpers.generateHostAddrStateKey(hostAddress);
12194
- const addrStateIndex = StateHelpers.getHookStateIndex(this.registryAddress, addrStateKey);
12310
+ const addrStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, addrStateKey);
12195
12311
  const addrLedgerEntry = await this.xrplApi.getLedgerEntry(addrStateIndex);
12196
12312
  const addrStateData = addrLedgerEntry?.HookStateData;
12197
12313
  if (addrStateData) {
@@ -12201,14 +12317,14 @@ class BaseEvernodeClient {
12201
12317
  (addrStateDecoded.lastHeartbeatIndex >= (curMomentStartIdx - (this.config.hostHeartbeatFreq * this.config.momentSize))) :
12202
12318
  (addrStateDecoded.lastHeartbeatIndex > 0))
12203
12319
 
12204
- const nftIdStatekey = StateHelpers.generateTokenIdStateKey(addrStateDecoded.nfTokenId);
12205
- const nftIdStateIndex = StateHelpers.getHookStateIndex(this.registryAddress, nftIdStatekey);
12206
- const nftIdLedgerEntry = await this.xrplApi.getLedgerEntry(nftIdStateIndex);
12320
+ const tokenIdStatekey = StateHelpers.generateTokenIdStateKey(addrStateDecoded.uriTokenId);
12321
+ const tokenIdStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, tokenIdStatekey);
12322
+ const tokenIdLedgerEntry = await this.xrplApi.getLedgerEntry(tokenIdStateIndex);
12207
12323
 
12208
- const nftIdStateData = nftIdLedgerEntry?.HookStateData;
12209
- if (nftIdStateData) {
12210
- const nftIdStateDecoded = StateHelpers.decodeTokenIdState(Buffer.from(nftIdStateData, 'hex'));
12211
- return { ...addrStateDecoded, ...nftIdStateDecoded };
12324
+ const tokenIdStateData = tokenIdLedgerEntry?.HookStateData;
12325
+ if (tokenIdStateData) {
12326
+ const tokenIdStateDecoded = StateHelpers.decodeTokenIdState(Buffer.from(tokenIdStateData, 'hex'));
12327
+ return { ...addrStateDecoded, ...tokenIdStateDecoded };
12212
12328
  }
12213
12329
  }
12214
12330
  }
@@ -12236,12 +12352,24 @@ class BaseEvernodeClient {
12236
12352
  host.domain = await hostAcc.getDomain();
12237
12353
 
12238
12354
  host.active = (host.lastHeartbeatIndex > (this.config.hostHeartbeatFreq * this.config.momentSize) ?
12239
- (host.lastHeartbeatIndex >= (curMomentStartIdx - (this.config.hostHeartbeatFreq * this.config.momentSize))) :
12240
- (host.lastHeartbeatIndex > 0));
12355
+ (host.lastHeartbeatIndex >= (curMomentStartIdx - (this.config.hostHeartbeatFreq * this.config.momentSize))) :
12356
+ (host.lastHeartbeatIndex > 0));
12241
12357
  return host;
12242
12358
  }));
12243
12359
 
12244
- return (hosts.nextPageToken ? {...hosts, data: res} : res);
12360
+ return (hosts.nextPageToken ? { ...hosts, data: res } : res);
12361
+ }
12362
+
12363
+ /**
12364
+ * Get all the candidates proposed in Evernode. The result's are paginated. Default page size is 20. Note: Specifying both filter and pagination does not supported.
12365
+ * @param {object} filters [Optional] Filter criteria to filter the hosts. The filter key can be a either property of the host.
12366
+ * @param {number} pageSize [Optional] Page size for the results.
12367
+ * @param {string} nextPageToken [Optional] Next page's token, If received by the previous result set.
12368
+ * @returns The list of candidates. The response will be in '{data: [], nextPageToken: ''}' only if there are more pages. Otherwise the response will only contain the host list.
12369
+ */
12370
+ async getCandidates(filters = null, pageSize = null, nextPageToken = null) {
12371
+ const candidates = await this.#firestoreHandler.getCandidates(filters, pageSize, nextPageToken);
12372
+ return candidates;
12245
12373
  }
12246
12374
 
12247
12375
  /**
@@ -12290,12 +12418,35 @@ class BaseEvernodeClient {
12290
12418
  return fullHostList;
12291
12419
  }
12292
12420
 
12421
+ /**
12422
+ * Get all the candidates without paginating.
12423
+ * @returns The list of candidates.
12424
+ */
12425
+ async getAllCandidates() {
12426
+ let fullCandidateList = [];
12427
+ const candidates = await this.#firestoreHandler.getCandidates();
12428
+ if (candidates.nextPageToken) {
12429
+ let currentPageToken = candidates.nextPageToken;
12430
+ let nextCandidates = null;
12431
+ fullCandidateList = fullCandidateList.concat(candidates.data);
12432
+ while (currentPageToken) {
12433
+ nextCandidates = await this.#firestoreHandler.getCandidates(null, 50, currentPageToken);
12434
+ fullCandidateList = fullCandidateList.concat(nextCandidates.nextPageToken ? nextCandidates.data : nextCandidates);
12435
+ currentPageToken = nextCandidates.nextPageToken;
12436
+ }
12437
+ } else {
12438
+ fullCandidateList = fullCandidateList.concat(candidates);
12439
+ }
12440
+
12441
+ return fullCandidateList;
12442
+ }
12443
+
12293
12444
  /**
12294
12445
  * Remove a host which is inactive for a long period. The inactivity is checked by Evernode it self and only pruned if inactive thresholds are met.
12295
12446
  * @param {string} hostAddress XRPL address of the host to be pruned.
12296
12447
  */
12297
12448
  async pruneDeadHost(hostAddress) {
12298
- if (this.xrplAcc.address === this.registryAddress)
12449
+ if (this.xrplAcc.address === this.config.registryAddress)
12299
12450
  throw 'Invalid function call';
12300
12451
 
12301
12452
  let memoData = Buffer.allocUnsafe(20);
@@ -12303,27 +12454,224 @@ class BaseEvernodeClient {
12303
12454
 
12304
12455
  // To obtain registration NFT Page Keylet and index.
12305
12456
  const hostAcc = new XrplAccount(hostAddress, null, { xrplApi: this.xrplApi });
12306
- const regNFT = (await hostAcc.getNfts()).find(n => n.URI.startsWith(EvernodeConstants.NFT_PREFIX_HEX) && n.Issuer === this.registryAddress);
12307
- if (regNFT) {
12308
- // Check whether the token was actually issued from Evernode registry contract.
12309
- const issuerHex = regNFT.NFTokenID.substr(8, 40);
12310
- const issuerAddr = codec.encodeAccountID(Buffer.from(issuerHex, 'hex'));
12311
- if (issuerAddr == this.registryAddress) {
12312
- const nftPageDataBuf = await EvernodeHelpers.getNFTPageAndLocation(regNFT.NFTokenID, hostAcc, this.xrplApi);
12313
-
12314
- await this.xrplAcc.makePayment(this.registryAddress,
12315
- XrplConstants.MIN_XRP_AMOUNT,
12316
- XrplConstants.XRP,
12317
- null,
12318
- [
12319
- { type: MemoTypes.DEAD_HOST_PRUNE, format: MemoFormats.HEX, data: memoData.toString('hex') },
12320
- { type: MemoTypes.HOST_REGISTRY_REF, format: MemoFormats.HEX, data: nftPageDataBuf.toString('hex') }
12321
- ]);
12322
- } else
12323
- throw "Invalid Registration NFT."
12457
+ const regUriToken = (await hostAcc.getURITokens()).find(n => n.URI.startsWith(EvernodeConstants.TOKEN_PREFIX_HEX) && n.Issuer === this.config.registryAddress);
12458
+ if (regUriToken) {
12459
+ await this.xrplAcc.makePayment(this.config.registryAddress,
12460
+ XrplConstants.MIN_XRP_AMOUNT,
12461
+ XrplConstants.XRP,
12462
+ null,
12463
+ [
12464
+ { type: MemoTypes.DEAD_HOST_PRUNE, format: MemoFormats.HEX, data: memoData.toString('hex') }
12465
+ ]);
12324
12466
  } else
12325
- throw "No Registration NFT was found for the Host account."
12467
+ throw "No Registration URI token was found for the Host account."
12468
+
12469
+ }
12470
+
12471
+ /**
12472
+ * Get proposed candidate info.
12473
+ * @param {string} ownerAddress [Optional] Address of the owner.
12474
+ * @returns The candidate information. Returns null if no candidate.
12475
+ */
12476
+ async getCandidateByOwner(ownerAddress = this.xrplAcc.address) {
12477
+ try {
12478
+ const ownerStateKey = StateHelpers.generateCandidateOwnerStateKey(ownerAddress);
12479
+ const ownerStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, ownerStateKey);
12480
+ const ownerLedgerEntry = await this.xrplApi.getLedgerEntry(ownerStateIndex);
12481
+ const ownerStateData = ownerLedgerEntry?.HookStateData;
12482
+ if (ownerStateData) {
12483
+ const ownerStateDecoded = StateHelpers.decodeCandidateOwnerState(Buffer.from(ownerStateKey, 'hex'), Buffer.from(ownerStateData, 'hex'));
12484
+
12485
+ const idStateKey = StateHelpers.generateCandidateIdStateKey(ownerStateDecoded.uniqueId);
12486
+ const idStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, idStateKey);
12487
+ const idLedgerEntry = await this.xrplApi.getLedgerEntry(idStateIndex);
12488
+
12489
+ const idStateData = idLedgerEntry?.HookStateData;
12490
+ if (idStateData) {
12491
+ const idStateDecoded = StateHelpers.decodeCandidateIdState(Buffer.from(idStateData, 'hex'));
12492
+ return { ...ownerStateDecoded, ...idStateDecoded };
12493
+ }
12494
+ }
12495
+ }
12496
+ catch (e) {
12497
+ // If the exception is entryNotFound from Rippled there's no entry for the host, So return null.
12498
+ if (e?.data?.error !== 'entryNotFound')
12499
+ throw e;
12500
+ }
12326
12501
 
12502
+ return null;
12503
+ }
12504
+
12505
+ /**
12506
+ * Get proposed candidate info.
12507
+ * @param {string} candidateId Id of the candidate.
12508
+ * @returns The candidate information. Returns null if no candidate.
12509
+ */
12510
+ async getCandidateById(candidateId) {
12511
+ try {
12512
+ const idStateKey = StateHelpers.generateCandidateIdStateKey(candidateId);
12513
+ const idStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, idStateKey);
12514
+ const idLedgerEntry = await this.xrplApi.getLedgerEntry(idStateIndex);
12515
+ const idStateData = idLedgerEntry?.HookStateData;
12516
+ if (idStateData) {
12517
+ const idStateDecoded = StateHelpers.decodeCandidateIdState(Buffer.from(idStateData, 'hex'));
12518
+
12519
+ const ownerStateKey = StateHelpers.generateCandidateOwnerStateKey(idStateDecoded.ownerAddress);
12520
+ const ownerStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, ownerStateKey);
12521
+ const ownerLedgerEntry = await this.xrplApi.getLedgerEntry(ownerStateIndex);
12522
+
12523
+ const ownerStateData = ownerLedgerEntry?.HookStateData;
12524
+ if (ownerStateData) {
12525
+ const ownerStateDecoded = StateHelpers.decodeCandidateOwnerState(Buffer.from(ownerStateKey, 'hex'), Buffer.from(ownerStateData, 'hex'));
12526
+ return { ...ownerStateDecoded, ...idStateDecoded };
12527
+ }
12528
+ }
12529
+ }
12530
+ catch (e) {
12531
+ // If the exception is entryNotFound from Rippled there's no entry for the host, So return null.
12532
+ if (e?.data?.error !== 'entryNotFound')
12533
+ throw e;
12534
+ }
12535
+
12536
+ return null;
12537
+ }
12538
+
12539
+ /**
12540
+ * Get reported dud host info.
12541
+ * @param {string} hostAddress [Optional] Address of the dud host.
12542
+ * @returns The dud host candidate information. Returns null if no candidate.
12543
+ */
12544
+ async getDudHostVoteInfo(hostAddress = this.xrplAcc.address) {
12545
+ try {
12546
+ const candidateId = StateHelpers.getDudHostCandidateId(hostAddress);
12547
+ const idStateKey = StateHelpers.generateCandidateIdStateKey(candidateId);
12548
+ const idStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, idStateKey);
12549
+ const idLedgerEntry = await this.xrplApi.getLedgerEntry(idStateIndex);
12550
+
12551
+ const idStateData = idLedgerEntry?.HookStateData;
12552
+ if (idStateData) {
12553
+ const idStateDecoded = StateHelpers.decodeCandidateIdState(Buffer.from(idStateData, 'hex'));
12554
+ return idStateDecoded;
12555
+ }
12556
+ }
12557
+ catch (e) {
12558
+ // If the exception is entryNotFound from Rippled there's no entry for the host, So return null.
12559
+ if (e?.data?.error !== 'entryNotFound')
12560
+ throw e;
12561
+ }
12562
+
12563
+ return null;
12564
+ }
12565
+
12566
+ /**
12567
+ * Get piloted mode vote info.
12568
+ * @returns The piloted mode candidate information. Returns null if no candidate.
12569
+ */
12570
+ async getPilotedModeVoteInfo() {
12571
+ try {
12572
+ const candidateId = StateHelpers.getPilotedModeCandidateId();
12573
+ const idStateKey = StateHelpers.generateCandidateIdStateKey(candidateId);
12574
+ const idStateIndex = StateHelpers.getHookStateIndex(this.governorAddress, idStateKey);
12575
+ const idLedgerEntry = await this.xrplApi.getLedgerEntry(idStateIndex);
12576
+
12577
+ const idStateData = idLedgerEntry?.HookStateData;
12578
+ if (idStateData) {
12579
+ const idStateDecoded = StateHelpers.decodeCandidateIdState(Buffer.from(idStateData, 'hex'));
12580
+ return idStateDecoded;
12581
+ }
12582
+ }
12583
+ catch (e) {
12584
+ // If the exception is entryNotFound from Rippled there's no entry for the host, So return null.
12585
+ if (e?.data?.error !== 'entryNotFound')
12586
+ throw e;
12587
+ }
12588
+
12589
+ return null;
12590
+ }
12591
+
12592
+ /**
12593
+ * Withdraw a hook candidate.
12594
+ * @param {*} hashes Hook candidate hashes in hex format, <GOVERNOR_HASH(32)><REGISTRY_HASH(32)><HEARTBEAT_HASH(32)>.
12595
+ * @param {*} shortName Short name for the proposal candidate.
12596
+ * @param {*} options [Optional] transaction options.
12597
+ * @returns Proposed candidate id.
12598
+ */
12599
+ async _propose(hashes, shortName, options = {}) {
12600
+ const hashesBuf = Buffer.from(hashes, 'hex');
12601
+ if (!hashesBuf || hashesBuf.length != 96)
12602
+ throw 'Invalid hashes: Hashes should contain all three Governor, Registry, Heartbeat hook hashes.';
12603
+
12604
+ // Check whether hook hashes exist in the definition.
12605
+ let keylets = [];
12606
+ for (const [i, hook] of EvernodeConstants.HOOKS.entries()) {
12607
+ const index = HookHelpers.getHookDefinitionIndex(hashes.substr(i * 64, 64));
12608
+ const ledgerEntry = await this.xrplApi.getLedgerEntry(index);
12609
+ if (!ledgerEntry)
12610
+ throw `No hook exists with the specified ${hook} hook hash.`;
12611
+ else
12612
+ keylets.push(HookHelpers.getHookDefinitionKeylet(index));
12613
+ }
12614
+
12615
+ const uniqueId = StateHelpers.getNewHookCandidateId(hashesBuf);
12616
+ const memoBuf = Buffer.alloc(CANDIDATE_PROPOSE_MEMO_SIZE);
12617
+ Buffer.from(uniqueId, 'hex').copy(memoBuf, CANDIDATE_PROPOSE_UNIQUE_ID_MEMO_OFFSET);
12618
+ Buffer.from(shortName.substr(0, 20), "utf-8").copy(memoBuf, CANDIDATE_PROPOSE_SHORT_NAME_MEMO_OFFSET);
12619
+ Buffer.from(keylets.join(''), 'hex').copy(memoBuf, CANDIDATE_PROPOSE_KEYLETS_MEMO_OFFSET);
12620
+
12621
+ // Get the proposal fee. Proposal fee is current epochs moment worth of rewards.
12622
+ const proposalFee = EvernodeHelpers.getEpochRewardQuota(this.config.rewardInfo.epoch, this.config.rewardConfiguration.firstEpochRewardQuota);
12623
+
12624
+ await this.xrplAcc.makePayment(this.governorAddress,
12625
+ proposalFee.toString(),
12626
+ EvernodeConstants.EVR,
12627
+ this.config.evrIssuerAddress,
12628
+ [
12629
+ { type: MemoTypes.CANDIDATE_PROPOSE, format: MemoFormats.HEX, data: hashesBuf.toString('hex').toUpperCase() },
12630
+ { type: MemoTypes.CANDIDATE_PROPOSE_REF, format: MemoFormats.HEX, data: memoBuf.toString('hex').toUpperCase() }
12631
+ ],
12632
+ options.transactionOptions);
12633
+
12634
+ return uniqueId;
12635
+ }
12636
+
12637
+ /**
12638
+ * Withdraw a hook candidate.
12639
+ * @param {string} candidateId Id of the candidate in hex format.
12640
+ * @param {*} options [Optional] transaction options.
12641
+ * @returns Transaction result.
12642
+ */
12643
+ async _withdraw(candidateId, options = {}) {
12644
+ const candidateIdBuf = Buffer.from(candidateId, 'hex');
12645
+ return await this.xrplAcc.makePayment(this.governorAddress,
12646
+ XrplConstants.MIN_XRP_AMOUNT,
12647
+ XrplConstants.XRP,
12648
+ null,
12649
+ [
12650
+ { type: MemoTypes.CANDIDATE_WITHDRAW, format: MemoFormats.HEX, data: candidateIdBuf.toString('hex').toUpperCase() }
12651
+ ],
12652
+ options.transactionOptions);
12653
+ }
12654
+
12655
+ /**
12656
+ * Report dud host for removal.
12657
+ * @param {*} hostAddress Address of the dud host.
12658
+ * @param {*} options [Optional] transaction options.
12659
+ * @returns Transaction result.
12660
+ */
12661
+ async _reportDudHost(hostAddress, options = {}) {
12662
+ const candidateId = StateHelpers.getDudHostCandidateId(hostAddress);
12663
+
12664
+ // Get the proposal fee. Proposal fee is 25% of current epochs moment worth of rewards.
12665
+ const proposalFee = (EvernodeHelpers.getEpochRewardQuota(this.config.rewardInfo.epoch, this.config.rewardConfiguration.firstEpochRewardQuota) / 4);
12666
+
12667
+ return await this.xrplAcc.makePayment(this.governorAddress,
12668
+ proposalFee.toString(),
12669
+ EvernodeConstants.EVR,
12670
+ this.config.evrIssuerAddress,
12671
+ [
12672
+ { type: MemoTypes.DUD_HOST_REPORT, format: MemoFormats.HEX, data: candidateId }
12673
+ ],
12674
+ options.transactionOptions);
12327
12675
  }
12328
12676
  }
12329
12677
 
@@ -12332,6 +12680,310 @@ module.exports = {
12332
12680
  }
12333
12681
 
12334
12682
 
12683
+ /***/ }),
12684
+
12685
+ /***/ 2466:
12686
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12687
+
12688
+ const { Buffer } = __nccwpck_require__(4300);
12689
+ const { MemoTypes, MemoFormats } = __nccwpck_require__(9849);
12690
+ const { StateHelpers } = __nccwpck_require__(3860);
12691
+ const { XrplConstants } = __nccwpck_require__(3307);
12692
+ const { BaseEvernodeClient } = __nccwpck_require__(6263);
12693
+
12694
+ const CANDIDATE_VOTE_UNIQUE_ID_MEMO_OFFSET = 0;
12695
+ const CANDIDATE_VOTE_VALUE_MEMO_OFFSET = 32;
12696
+ const CANDIDATE_VOTE_MEMO_SIZE = 33;
12697
+
12698
+ const FoundationEvents = {}
12699
+
12700
+ class FoundationClient extends BaseEvernodeClient {
12701
+
12702
+ /**
12703
+ * Constructs a tenant client instance.
12704
+ * @param {string} xrpAddress XRPL address of the tenant.
12705
+ * @param {string} XRPL secret of the tenant.
12706
+ * @param {object} options [Optional] An object with 'rippledServer' URL and 'governorAddress'.
12707
+ */
12708
+ constructor(xrpAddress, xrpSecret, options = {}) {
12709
+ super(xrpAddress, xrpSecret, Object.values(FoundationEvents), false, options);
12710
+ }
12711
+
12712
+ async propose(hashes, shortName, options = {}) {
12713
+ if (this.xrplAcc.address !== this.config.foundationAddress)
12714
+ throw `Invalid foundation address ${this.xrplAcc.address}.`;
12715
+
12716
+ return await super._propose(hashes, shortName, options);
12717
+ }
12718
+
12719
+ async withdraw(candidateId, options = {}) {
12720
+ if (this.xrplAcc.address !== this.config.foundationAddress)
12721
+ throw `Invalid foundation address ${this.xrplAcc.address}.`;
12722
+
12723
+ return await super._withdraw(candidateId, options);
12724
+ }
12725
+
12726
+ /**
12727
+ * Vote for a hook candidate.
12728
+ * @param {string} candidateId Id of the candidate in hex format.
12729
+ * @param {int} vote Vote value CandidateVote (0 - Reject, 1 - Support).
12730
+ * @param {*} options [Optional] transaction options.
12731
+ * @returns Transaction result.
12732
+ */
12733
+ async vote(candidateId, vote, options = {}) {
12734
+ if (this.xrplAcc.address !== this.config.foundationAddress)
12735
+ throw `Invalid foundation address ${this.xrplAcc.address}.`;
12736
+
12737
+ const voteBuf = Buffer.alloc(CANDIDATE_VOTE_MEMO_SIZE);
12738
+ Buffer.from(candidateId, 'hex').copy(voteBuf, CANDIDATE_VOTE_UNIQUE_ID_MEMO_OFFSET);
12739
+ voteBuf.writeUInt8(vote, CANDIDATE_VOTE_VALUE_MEMO_OFFSET)
12740
+
12741
+ return await this.xrplAcc.makePayment(this.governorAddress,
12742
+ XrplConstants.MIN_XRP_AMOUNT,
12743
+ XrplConstants.XRP,
12744
+ null,
12745
+ [
12746
+ { type: MemoTypes.CANDIDATE_VOTE, format: MemoFormats.HEX, data: voteBuf.toString('hex').toUpperCase() }
12747
+ ],
12748
+ options.transactionOptions);
12749
+ }
12750
+
12751
+ async reportDudHost(hostAddress, options = {}) {
12752
+ if (this.xrplAcc.address !== this.config.foundationAddress)
12753
+ throw `Invalid foundation address ${this.xrplAcc.address}.`;
12754
+
12755
+ return await this._reportDudHost(hostAddress, options);
12756
+ }
12757
+
12758
+ /**
12759
+ * Vote for a dud host.
12760
+ * @param {string} hostAddress Address of the dud host.
12761
+ * @param {int} vote Vote value CandidateVote (0 - Reject, 1 - Support).
12762
+ * @param {*} options [Optional] transaction options.
12763
+ * @returns Transaction result.
12764
+ */
12765
+ async voteDudHost(hostAddress, vote, options = {}) {
12766
+ if (this.xrplAcc.address !== this.config.foundationAddress)
12767
+ throw `Invalid foundation address ${this.xrplAcc.address}.`;
12768
+
12769
+ const candidateId = StateHelpers.getDudHostCandidateId(hostAddress);
12770
+ return await this.vote(candidateId, vote, options);
12771
+ }
12772
+
12773
+ /**
12774
+ * Vote for a piloted mode.
12775
+ * @param {int} vote Vote value CandidateVote (0 - Reject, 1 - Support).
12776
+ * @param {*} options [Optional] transaction options.
12777
+ * @returns Transaction result.
12778
+ */
12779
+ async votePilotedMode(vote, options = {}) {
12780
+ if (this.xrplAcc.address !== this.config.foundationAddress)
12781
+ throw `Invalid foundation address ${this.xrplAcc.address}.`;
12782
+
12783
+ const candidateId = StateHelpers.getPilotedModeCandidateId();
12784
+ return await this.vote(candidateId, vote, options);
12785
+ }
12786
+
12787
+ /**
12788
+ * Change the governance mode.
12789
+ * @param {int} mode Mode (1 - Piloted, 2 - CoPiloted, 3 - AutoPiloted).
12790
+ * @param {*} options [Optional] transaction options.
12791
+ * @returns Transaction result.
12792
+ */
12793
+ async changeGovernanceMode(mode, options = {}) {
12794
+ if (this.xrplAcc.address !== this.config.foundationAddress)
12795
+ throw `Invalid foundation address ${this.xrplAcc.address}.`;
12796
+
12797
+ const modeBuf = Buffer.alloc(1);
12798
+ modeBuf.writeUInt8(mode);
12799
+
12800
+ return await this.xrplAcc.makePayment(this.governorAddress,
12801
+ XrplConstants.MIN_XRP_AMOUNT,
12802
+ XrplConstants.XRP,
12803
+ null,
12804
+ [
12805
+ { type: MemoTypes.GOVERNANCE_MODE_CHANGE, format: MemoFormats.HEX, data: modeBuf.toString('hex').toUpperCase() }
12806
+ ],
12807
+ options.transactionOptions);
12808
+ }
12809
+ }
12810
+
12811
+ module.exports = {
12812
+ FoundationEvents,
12813
+ FoundationClient
12814
+ }
12815
+
12816
+ /***/ }),
12817
+
12818
+ /***/ 335:
12819
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12820
+
12821
+ const { BaseEvernodeClient } = __nccwpck_require__(6263);
12822
+ const { DefaultValues } = __nccwpck_require__(8262);
12823
+ const { EvernodeEvents } = __nccwpck_require__(9849);
12824
+
12825
+ const GovernorEvents = {
12826
+ Initialized: EvernodeEvents.Initialized,
12827
+ CandidateProposed: EvernodeEvents.CandidateProposed,
12828
+ CandidateWithdrew: EvernodeEvents.CandidateWithdrew,
12829
+ ChildHookUpdated: EvernodeEvents.ChildHookUpdated,
12830
+ GovernanceModeChanged: EvernodeEvents.GovernanceModeChanged,
12831
+ FoundationVoted: EvernodeEvents.FoundationVoted,
12832
+ DudHostReported: EvernodeEvents.DudHostReported,
12833
+ DudHostRemoved: EvernodeEvents.DudHostRemoved,
12834
+ DudHostStatusChanged: EvernodeEvents.DudHostStatusChanged,
12835
+ FallbackToPiloted: EvernodeEvents.FallbackToPiloted,
12836
+ NewHookStatusChanged: EvernodeEvents.NewHookStatusChanged
12837
+ }
12838
+
12839
+ class GovernorClient extends BaseEvernodeClient {
12840
+ constructor(options = {}) {
12841
+ super((options.governorAddress || DefaultValues.governorAddress), null, Object.values(GovernorEvents), false, options);
12842
+ }
12843
+ }
12844
+
12845
+ module.exports = {
12846
+ GovernorClient,
12847
+ GovernorEvents
12848
+ }
12849
+
12850
+ /***/ }),
12851
+
12852
+ /***/ 6510:
12853
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12854
+
12855
+ const { BaseEvernodeClient } = __nccwpck_require__(6263);
12856
+ const { EvernodeEvents } = __nccwpck_require__(9849);
12857
+
12858
+ const HeartbeatEvents = {
12859
+ Heartbeat: EvernodeEvents.Heartbeat
12860
+ }
12861
+
12862
+ class HeartbeatClient extends BaseEvernodeClient {
12863
+ constructor(options = {}) {
12864
+ super(options.heartbeatAddress, null, Object.values(HeartbeatEvents), false, options);
12865
+ }
12866
+ }
12867
+
12868
+ module.exports = {
12869
+ HeartbeatClient,
12870
+ HeartbeatEvents
12871
+ }
12872
+
12873
+ /***/ }),
12874
+
12875
+ /***/ 2344:
12876
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12877
+
12878
+ const { HookTypes } = __nccwpck_require__(8262);
12879
+ const { RegistryClient } = __nccwpck_require__(8074);
12880
+ const { GovernorClient } = __nccwpck_require__(335);
12881
+ const { HeartbeatClient } = __nccwpck_require__(6510);
12882
+
12883
+ class HookClientFactory {
12884
+ static async create(hookType) {
12885
+ let hookClient;
12886
+ switch (hookType) {
12887
+ case HookTypes.governor: {
12888
+ hookClient = new GovernorClient();
12889
+ break;
12890
+ }
12891
+ case HookTypes.registry: {
12892
+ const registryAddress = await HookClientFactory.#getAccountAddress(hookType);
12893
+ hookClient = new RegistryClient({ registryAddress: registryAddress });
12894
+ break;
12895
+ }
12896
+ case HookTypes.heartbeat: {
12897
+ const heartbeatAddress = await HookClientFactory.#getAccountAddress(hookType);
12898
+ hookClient = new HeartbeatClient({ heartbeatAddress: heartbeatAddress });
12899
+ break;
12900
+ }
12901
+ default: {
12902
+ hookClient = null;
12903
+ break;
12904
+ }
12905
+ }
12906
+
12907
+ return hookClient;
12908
+ }
12909
+
12910
+ static async #getAccountAddress(hookType) {
12911
+ const governorHook = await HookClientFactory.create(HookTypes.governor);
12912
+
12913
+ let configs;
12914
+ try {
12915
+ await governorHook.connect();
12916
+ configs = governorHook.config;
12917
+ } catch (error) {
12918
+ throw (error)
12919
+ } finally {
12920
+ await governorHook.disconnect();
12921
+ }
12922
+
12923
+ if (hookType == HookTypes.registry)
12924
+ return configs.registryAddress;
12925
+ else if (hookType == HookTypes.heartbeat)
12926
+ return configs.heartbeatAddress;
12927
+
12928
+ }
12929
+ }
12930
+
12931
+ module.exports = {
12932
+ HookClientFactory
12933
+ }
12934
+
12935
+ /***/ }),
12936
+
12937
+ /***/ 8074:
12938
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12939
+
12940
+ const { BaseEvernodeClient } = __nccwpck_require__(6263);
12941
+ const { EvernodeEvents } = __nccwpck_require__(9849);
12942
+
12943
+ const RegistryEvents = {
12944
+ HostRegistered: EvernodeEvents.HostRegistered,
12945
+ HostDeregistered: EvernodeEvents.HostDeregistered,
12946
+ HostRegUpdated: EvernodeEvents.HostRegUpdated,
12947
+ DeadHostPrune: EvernodeEvents.DeadHostPrune,
12948
+ HostTransfer: EvernodeEvents.HostTransfer,
12949
+ HostRebate: EvernodeEvents.HostRebate
12950
+ }
12951
+
12952
+ class RegistryClient extends BaseEvernodeClient {
12953
+
12954
+ constructor(options = {}) {
12955
+ super(options.registryAddress, null, Object.values(RegistryEvents), false, options);
12956
+ }
12957
+
12958
+ /**
12959
+ * Gets all the active hosts registered in Evernode without paginating.
12960
+ * @returns The list of active hosts.
12961
+ */
12962
+ async getActiveHosts() {
12963
+ let fullHostList = [];
12964
+ const hosts = await this.getHosts();
12965
+ if (hosts.nextPageToken) {
12966
+ let currentPageToken = hosts.nextPageToken;
12967
+ let nextHosts = null;
12968
+ fullHostList = fullHostList.concat(hosts.data);
12969
+ while (currentPageToken) {
12970
+ nextHosts = await this.getHosts(null, null, currentPageToken);
12971
+ fullHostList = fullHostList.concat(nextHosts.nextPageToken ? nextHosts.data : nextHosts);
12972
+ currentPageToken = nextHosts.nextPageToken;
12973
+ }
12974
+ } else {
12975
+ fullHostList = fullHostList.concat(hosts);
12976
+ }
12977
+ // Filter only active hosts.
12978
+ return fullHostList.filter(h => h.active);
12979
+ }
12980
+ }
12981
+
12982
+ module.exports = {
12983
+ RegistryClient,
12984
+ RegistryEvents
12985
+ }
12986
+
12335
12987
  /***/ }),
12336
12988
 
12337
12989
  /***/ 1437:
@@ -12347,6 +12999,7 @@ const codec = __nccwpck_require__(597);
12347
12999
  const { XflHelpers } = __nccwpck_require__(3243);
12348
13000
  const { EvernodeHelpers } = __nccwpck_require__(2523);
12349
13001
  const { StateHelpers } = __nccwpck_require__(3860);
13002
+ const { TransactionHelper } = __nccwpck_require__(7071);
12350
13003
 
12351
13004
  const OFFER_WAIT_TIMEOUT = 60;
12352
13005
 
@@ -12378,33 +13031,26 @@ const HOST_UPDATE_DESCRIPTION_MEMO_OFFSET = 54;
12378
13031
  const HOST_UPDATE_VERSION_MEMO_OFFSET = 80;
12379
13032
  const HOST_UPDATE_MEMO_SIZE = 83;
12380
13033
 
13034
+ const VOTE_VALIDATION_ERR = "VOTE_VALIDATION_ERR";
13035
+
12381
13036
  class HostClient extends BaseEvernodeClient {
12382
13037
 
12383
13038
  constructor(xrpAddress, xrpSecret, options = {}) {
12384
13039
  super(xrpAddress, xrpSecret, Object.values(HostEvents), true, options);
12385
13040
  }
12386
13041
 
12387
- async getRegistrationNft() {
13042
+ async getRegistrationUriToken() {
12388
13043
  // Find an owned NFT with matching Evernode host NFT prefix.
12389
- const nft = (await this.xrplAcc.getNfts()).find(n => n.URI.startsWith(EvernodeConstants.NFT_PREFIX_HEX) && n.Issuer === this.registryAddress);
12390
- if (nft) {
12391
- // Check whether the token was actually issued from Evernode registry contract.
12392
- const issuerHex = nft.NFTokenID.substr(8, 40);
12393
- const issuerAddr = codec.encodeAccountID(Buffer.from(issuerHex, 'hex'));
12394
- if (issuerAddr == this.registryAddress) {
12395
- return nft;
12396
- }
12397
- }
12398
-
12399
- return null;
13044
+ const uriToken = (await this.xrplAcc.getURITokens()).find(n => n.URI.startsWith(EvernodeConstants.TOKEN_PREFIX_HEX) && n.Issuer === this.config.registryAddress);
13045
+ return uriToken ?? null;
12400
13046
  }
12401
13047
 
12402
13048
  async getRegistration() {
12403
13049
  // Check whether we own an evernode host token.
12404
- const nft = await this.getRegistrationNft();
12405
- if (nft) {
13050
+ const regUriToken = await this.getRegistrationUriToken();
13051
+ if (regUriToken) {
12406
13052
  const host = await this.getHostInfo();
12407
- return (host?.nfTokenId == nft.NFTokenID) ? host : null;
13053
+ return (host?.uriTokenId == regUriToken.index) ? host : null;
12408
13054
  }
12409
13055
 
12410
13056
  return null;
@@ -12446,29 +13092,27 @@ class HostClient extends BaseEvernodeClient {
12446
13092
 
12447
13093
  async offerLease(leaseIndex, leaseAmount, tosHash) {
12448
13094
  // <prefix><lease index 16)><half of tos hash><lease amount (uint32)>
12449
- const prefixLen = EvernodeConstants.LEASE_NFT_PREFIX_HEX.length / 2;
13095
+ const prefixLen = EvernodeConstants.LEASE_TOKEN_PREFIX_HEX.length / 2;
12450
13096
  const halfToSLen = tosHash.length / 4;
12451
13097
  const uriBuf = Buffer.allocUnsafe(prefixLen + halfToSLen + 10);
12452
- Buffer.from(EvernodeConstants.LEASE_NFT_PREFIX_HEX, 'hex').copy(uriBuf);
13098
+ Buffer.from(EvernodeConstants.LEASE_TOKEN_PREFIX_HEX, 'hex').copy(uriBuf);
12453
13099
  uriBuf.writeUInt16BE(leaseIndex, prefixLen);
12454
13100
  Buffer.from(tosHash, 'hex').copy(uriBuf, prefixLen + 2, 0, halfToSLen);
12455
13101
  uriBuf.writeBigInt64BE(XflHelpers.getXfl(leaseAmount.toString()), prefixLen + 2 + halfToSLen);
12456
- const uri = uriBuf.toString('hex').toUpperCase();
12457
-
12458
- await this.xrplAcc.mintNft(uri, 0, 0, { isBurnable: true, isHexUri: true });
12459
-
12460
- const nft = await this.xrplAcc.getNftByUri(uri, true);
12461
- if (!nft)
13102
+ const uri = uriBuf.toString('base64');
13103
+ await this.xrplAcc.mintURIToken(uri, null, { isBurnable: true, isHexUri: false });
13104
+ const uriToken = await this.xrplAcc.getURITokenByUri(uri);
13105
+ if (!uriToken)
12462
13106
  throw "Offer lease NFT creation error.";
12463
13107
 
12464
- await this.xrplAcc.offerSellNft(nft.NFTokenID,
13108
+ await this.xrplAcc.sellURIToken(uriToken.index,
12465
13109
  leaseAmount.toString(),
12466
13110
  EvernodeConstants.EVR,
12467
13111
  this.config.evrIssuerAddress);
12468
13112
  }
12469
13113
 
12470
- async expireLease(nfTokenId, tenantAddress = null) {
12471
- await this.xrplAcc.burnNft(nfTokenId, tenantAddress);
13114
+ async expireLease(uriTokenId) {
13115
+ await this.xrplAcc.burnURIToken(uriTokenId);
12472
13116
  }
12473
13117
 
12474
13118
  async register(countryCode, cpuMicroSec, ramMb, diskMb, totalInstanceCount, cpuModel, cpuCount, cpuSpeed, description, emailAddress, options = {}) {
@@ -12504,14 +13148,16 @@ class HostClient extends BaseEvernodeClient {
12504
13148
 
12505
13149
  // Check whether is there any missed NFT sell offer that needs to be accepted
12506
13150
  // from the client-side in order to complete the registration.
12507
- const regNft = await this.getRegistrationNft();
12508
- if (!regNft) {
13151
+ const registryAcc = new XrplAccount(this.config.registryAddress, null, { xrplApi: this.xrplApi });
13152
+ const regUriToken = await this.getRegistrationUriToken();
13153
+
13154
+ if (!regUriToken) {
12509
13155
  const regInfo = await this.getHostInfo(this.xrplAcc.address);
12510
13156
  if (regInfo) {
12511
- const registryAcc = new XrplAccount(this.registryAddress, null, { xrplApi: this.xrplApi });
12512
- const sellOffer = (await registryAcc.getNftOffers()).find(o => o.NFTokenID == regInfo.nfTokenId);
13157
+ const sellOffer = (await registryAcc.getURITokens()).find(o => o.index == regInfo.uriTokenId && o.Amount);
13158
+ console.log('sell offer')
12513
13159
  if (sellOffer) {
12514
- await this.xrplAcc.buyNft(sellOffer.index);
13160
+ await this.xrplAcc.buyURIToken(sellOffer);
12515
13161
  console.log("Registration was successfully completed after acquiring the NFT.");
12516
13162
  return await this.isRegistered();
12517
13163
  }
@@ -12521,7 +13167,7 @@ class HostClient extends BaseEvernodeClient {
12521
13167
  // Check the availability of an initiated transfer.
12522
13168
  // Need to modify the amount accordingly.
12523
13169
  const stateTransfereeAddrKey = StateHelpers.generateTransfereeAddrStateKey(this.xrplAcc.address);
12524
- const stateTransfereeAddrIndex = StateHelpers.getHookStateIndex(this.registryAddress, stateTransfereeAddrKey);
13170
+ const stateTransfereeAddrIndex = StateHelpers.getHookStateIndex(this.governorAddress, stateTransfereeAddrKey);
12525
13171
  let transfereeAddrLedgerEntry = {};
12526
13172
  let transfereeAddrStateData = {};
12527
13173
  let transferredNFTokenId = null;
@@ -12551,31 +13197,35 @@ class HostClient extends BaseEvernodeClient {
12551
13197
  Buffer.from(description.substr(0, 26), "utf-8").copy(memoBuf, HOST_DESCRIPTION_MEMO_OFFSET);
12552
13198
  Buffer.from(emailAddress.substr(0, 40), "utf-8").copy(memoBuf, HOST_EMAIL_ADDRESS_MEMO_OFFSET);
12553
13199
 
12554
- const tx = await this.xrplAcc.makePayment(this.registryAddress,
13200
+ const tx = await this.xrplAcc.makePayment(this.config.registryAddress,
12555
13201
  (transferredNFTokenId) ? EvernodeConstants.NOW_IN_EVRS : this.config.hostRegFee.toString(),
12556
13202
  EvernodeConstants.EVR,
12557
13203
  this.config.evrIssuerAddress,
12558
13204
  [{ type: MemoTypes.HOST_REG, format: MemoFormats.HEX, data: memoBuf.toString('hex') }],
12559
13205
  options.transactionOptions);
12560
13206
 
12561
- console.log('Waiting for the sell offer')
12562
- const regAcc = new XrplAccount(this.registryAddress, null, { xrplApi: this.xrplApi });
12563
- let offer = null;
13207
+ console.log('Waiting for the sell offer', tx.id)
13208
+ let sellOffer = null;
12564
13209
  let attempts = 0;
12565
13210
  let offerLedgerIndex = 0;
13211
+ const firstPart = tx.id.substring(0, 8);
13212
+ const lastPart = tx.id.substring(tx.id.length - 8);
13213
+ const trxRef = TransactionHelper.asciiToHex(firstPart + lastPart);
12566
13214
  while (attempts < OFFER_WAIT_TIMEOUT) {
12567
- const nft = (await regAcc.getNfts()).find(n => (n.URI === `${EvernodeConstants.NFT_PREFIX_HEX}${tx.id}`) || (n.NFTokenID === transferredNFTokenId));
12568
- if (nft) {
12569
- offer = (await regAcc.getNftOffers()).find(o => o.Destination === this.xrplAcc.address && o.NFTokenID === nft.NFTokenID && o.Flags === 1);
12570
- offerLedgerIndex = this.xrplApi.ledgerIndex;
12571
- if (offer)
12572
- break;
12573
- await new Promise(resolve => setTimeout(resolve, 1000));
12574
- attempts++;
12575
- }
13215
+ sellOffer = (await registryAcc.getURITokens()).find(n => (
13216
+ n.Amount &&
13217
+ n.Destination === this.xrplAcc.address &&
13218
+ (!transferredNFTokenId ?
13219
+ (n.URI === `${EvernodeConstants.TOKEN_PREFIX_HEX}${trxRef}`) :
13220
+ (n.index === transferredNFTokenId))));
12576
13221
 
13222
+ offerLedgerIndex = this.xrplApi.ledgerIndex;
13223
+ if (sellOffer)
13224
+ break;
13225
+ await new Promise(resolve => setTimeout(resolve, 1000));
13226
+ attempts++;
12577
13227
  }
12578
- if (!offer)
13228
+ if (!sellOffer)
12579
13229
  throw 'No sell offer found within timeout.';
12580
13230
 
12581
13231
  console.log('Accepting the sell offer..');
@@ -12589,8 +13239,7 @@ class HostClient extends BaseEvernodeClient {
12589
13239
  resolve();
12590
13240
  });
12591
13241
 
12592
- await this.xrplAcc.buyNft(offer.index);
12593
-
13242
+ await this.xrplAcc.buyURIToken(sellOffer);
12594
13243
  return await this.isRegistered();
12595
13244
  }
12596
13245
 
@@ -12599,53 +13248,17 @@ class HostClient extends BaseEvernodeClient {
12599
13248
  if (!(await this.isRegistered()))
12600
13249
  throw "Host not registered."
12601
13250
 
12602
- const regNFT = await this.getRegistrationNft();
13251
+ const regUriToken = await this.getRegistrationUriToken();
12603
13252
 
12604
- // To obtain registration NFT Page Keylet and index.
12605
- const nftPageDataBuf = await EvernodeHelpers.getNFTPageAndLocation(regNFT.NFTokenID, this.xrplAcc, this.xrplApi);
12606
-
12607
- await this.xrplAcc.makePayment(this.registryAddress,
13253
+ await this.xrplAcc.makePayment(this.config.registryAddress,
12608
13254
  XrplConstants.MIN_XRP_AMOUNT,
12609
13255
  XrplConstants.XRP,
12610
13256
  null,
12611
13257
  [
12612
- { type: MemoTypes.HOST_DEREG, format: MemoFormats.HEX, data: regNFT.NFTokenID },
12613
- { type: MemoTypes.HOST_REGISTRY_REF, format: MemoFormats.HEX, data: nftPageDataBuf.toString('hex') }
13258
+ { type: MemoTypes.HOST_DEREG, format: MemoFormats.HEX, data: regUriToken.index }
12614
13259
  ],
12615
13260
  options.transactionOptions);
12616
13261
 
12617
- console.log('Waiting for the buy offer')
12618
- const regAcc = new XrplAccount(this.registryAddress, null, { xrplApi: this.xrplApi });
12619
- let offer = null;
12620
- let attempts = 0;
12621
- let offerLedgerIndex = 0;
12622
- while (attempts < OFFER_WAIT_TIMEOUT) {
12623
- offer = (await regAcc.getNftOffers()).find(o => (o.NFTokenID == regNFT.NFTokenID) && (o.Flags === 0));
12624
- offerLedgerIndex = this.xrplApi.ledgerIndex;
12625
- if (offer)
12626
- break;
12627
- await new Promise(resolve => setTimeout(resolve, 1000));
12628
- attempts++;
12629
- }
12630
- if (!offer)
12631
- throw 'No buy offer found within timeout.';
12632
-
12633
- console.log('Accepting the buy offer..');
12634
-
12635
- // Wait until the next ledger after the offer is created.
12636
- // Otherwise if the offer accepted in the same legder which it's been created,
12637
- // We cannot fetch the offer from registry contract event handler since it's getting deleted immediately.
12638
- await new Promise(async resolve => {
12639
- while (this.xrplApi.ledgerIndex <= offerLedgerIndex)
12640
- await new Promise(resolve2 => setTimeout(resolve2, 1000));
12641
- resolve();
12642
- });
12643
-
12644
- await this.xrplAcc.sellNft(
12645
- offer.index,
12646
- [{ type: MemoTypes.HOST_POST_DEREG, format: MemoFormats.HEX, data: regNFT.NFTokenID }]
12647
- );
12648
-
12649
13262
  return await this.isRegistered();
12650
13263
  }
12651
13264
 
@@ -12677,36 +13290,48 @@ class HostClient extends BaseEvernodeClient {
12677
13290
  memoBuf.writeUInt8(components[2], HOST_UPDATE_VERSION_MEMO_OFFSET + 2);
12678
13291
  }
12679
13292
 
12680
- // To obtain registration NFT Page Keylet and index.
12681
- if (!tokenID)
12682
- tokenID = (await this.getRegistrationNft()).NFTokenID;
12683
- const nftPageDataBuf = await EvernodeHelpers.getNFTPageAndLocation(tokenID, this.xrplAcc, this.xrplApi);
12684
-
12685
- return await this.xrplAcc.makePayment(this.registryAddress,
13293
+ return await this.xrplAcc.makePayment(this.config.registryAddress,
12686
13294
  XrplConstants.MIN_XRP_AMOUNT,
12687
13295
  XrplConstants.XRP,
12688
13296
  null,
12689
13297
  [
12690
- { type: MemoTypes.HOST_UPDATE_INFO, format: MemoFormats.HEX, data: memoBuf.toString('hex') },
12691
- { type: MemoTypes.HOST_REGISTRY_REF, format: MemoFormats.HEX, data: nftPageDataBuf.toString('hex') }
13298
+ { type: MemoTypes.HOST_UPDATE_INFO, format: MemoFormats.HEX, data: memoBuf.toString('hex') }
12692
13299
  ],
12693
13300
  options.transactionOptions);
12694
13301
  }
12695
13302
 
12696
- async heartbeat(options = {}) {
12697
- // To obtain registration NFT Page Keylet and index.
12698
- const regNFT = await this.getRegistrationNft();
12699
- const nftPageDataBuf = await EvernodeHelpers.getNFTPageAndLocation(regNFT.NFTokenID, this.xrplAcc, this.xrplApi);
13303
+ async heartbeat(voteInfo = {}, options = {}) {
13304
+ let data = "";
13305
+ // Prepare voteInfo
13306
+ if (Object.keys(voteInfo).length > 1) {
13307
+ let voteBuf = Buffer.alloc(33);
13308
+ Buffer.from(voteInfo.candidate, 'hex').copy(voteBuf, 0);
13309
+ voteBuf.writeUInt8(voteInfo.vote, 32);
13310
+ data = voteBuf.toString('hex').toUpperCase();
13311
+ }
12700
13312
 
12701
- return this.xrplAcc.makePayment(this.registryAddress,
12702
- XrplConstants.MIN_XRP_AMOUNT,
12703
- XrplConstants.XRP,
12704
- null,
12705
- [
12706
- { type: MemoTypes.HEARTBEAT, format: "", data: "" },
12707
- { type: MemoTypes.HOST_REGISTRY_REF, format: MemoFormats.HEX, data: nftPageDataBuf.toString('hex') }
12708
- ],
12709
- options.transactionOptions);
13313
+ try {
13314
+ const res = await this.xrplAcc.makePayment(this.config.heartbeatAddress,
13315
+ XrplConstants.MIN_XRP_AMOUNT,
13316
+ XrplConstants.XRP,
13317
+ null,
13318
+ [
13319
+ { type: MemoTypes.HEARTBEAT, format: MemoFormats.HEX, data: data }
13320
+ ],
13321
+ options.transactionOptions);
13322
+ return res;
13323
+ }
13324
+ catch (e) {
13325
+ const validationErr = e?.hookExecutionResult?.find(r => r.message.includes(VOTE_VALIDATION_ERR));
13326
+ if (validationErr) {
13327
+ console.log('Vote validation error occurred.')
13328
+ throw {
13329
+ code: VOTE_VALIDATION_ERR,
13330
+ error: validationErr.message
13331
+ }
13332
+ }
13333
+ throw e;
13334
+ }
12710
13335
  }
12711
13336
 
12712
13337
  async acquireSuccess(txHash, tenantAddress, instanceInfo, options = {}) {
@@ -12789,18 +13414,12 @@ class HostClient extends BaseEvernodeClient {
12789
13414
  }
12790
13415
 
12791
13416
  async requestRebate(options = {}) {
12792
-
12793
- // To obtain registration NFT Page Keylet and index.
12794
- const regNFT = await this.getRegistrationNft();
12795
- const nftPageDataBuf = await EvernodeHelpers.getNFTPageAndLocation(regNFT.NFTokenID, this.xrplAcc, this.xrplApi);
12796
-
12797
- return this.xrplAcc.makePayment(this.registryAddress,
13417
+ return this.xrplAcc.makePayment(this.config.registryAddress,
12798
13418
  XrplConstants.MIN_XRP_AMOUNT,
12799
13419
  XrplConstants.XRP,
12800
13420
  null,
12801
13421
  [
12802
- { type: MemoTypes.HOST_REBATE, format: "", data: "" },
12803
- { type: MemoTypes.HOST_REGISTRY_REF, format: MemoFormats.HEX, data: nftPageDataBuf.toString('hex') }
13422
+ { type: MemoTypes.HOST_REBATE, format: "", data: "" }
12804
13423
  ],
12805
13424
  options.transactionOptions);
12806
13425
  }
@@ -12820,70 +13439,47 @@ class HostClient extends BaseEvernodeClient {
12820
13439
  const transfereeAcc = new XrplAccount(transfereeAddress, null, { xrplApi: this.xrplApi });
12821
13440
 
12822
13441
  if (this.xrplAcc.address !== transfereeAddress) {
12823
- // Find the new transferee also owns an Evernode Host Registration NFT.
12824
- const nft = (await transfereeAcc.getNfts()).find(n => n.URI.startsWith(EvernodeConstants.NFT_PREFIX_HEX) && n.Issuer === this.registryAddress);
12825
- if (nft) {
12826
- // Check whether the token was actually issued from Evernode registry contract.
12827
- const issuerHex = nft.NFTokenID.substr(8, 40);
12828
- const issuerAddr = codec.encodeAccountID(Buffer.from(issuerHex, 'hex'));
12829
- if (issuerAddr == this.registryAddress) {
12830
- throw "The transferee is already registered in Evernode.";
12831
- }
12832
- }
13442
+ // Find the new transferee also owns an Evernode Host Registration token.
13443
+ const token = (await transfereeAcc.getURITokens()).find(n => n.URI.startsWith(EvernodeConstants.TOKEN_PREFIX_HEX) && n.Issuer === this.config.registryAddress);
13444
+ if (token)
13445
+ throw "The transferee is already registered in Evernode.";
12833
13446
  }
12834
13447
 
12835
13448
  let memoData = Buffer.allocUnsafe(20);
12836
13449
  codec.decodeAccountID(transfereeAddress).copy(memoData);
12837
13450
 
12838
- // To obtain registration NFT Page Keylet and index.
12839
- const regNFT = await this.getRegistrationNft();
12840
- const nftPageDataBuf = await EvernodeHelpers.getNFTPageAndLocation(regNFT.NFTokenID, this.xrplAcc, this.xrplApi);
13451
+ const regUriToken = await this.getRegistrationUriToken();
12841
13452
 
12842
- await this.xrplAcc.makePayment(this.registryAddress,
13453
+ await this.xrplAcc.sellURIToken(regUriToken.index,
12843
13454
  XrplConstants.MIN_XRP_AMOUNT,
12844
13455
  XrplConstants.XRP,
12845
13456
  null,
13457
+ this.config.registryAddress,
12846
13458
  [
12847
- { type: MemoTypes.HOST_TRANSFER, format: MemoFormats.HEX, data: memoData.toString('hex') },
12848
- { type: MemoTypes.HOST_REGISTRY_REF, format: MemoFormats.HEX, data: nftPageDataBuf.toString('hex') }
13459
+ { type: MemoTypes.HOST_TRANSFER, format: MemoFormats.HEX, data: memoData.toString('hex') }
12849
13460
  ],
12850
13461
  options.transactionOptions);
12851
13462
 
12852
- let offer = null;
13463
+ let token = null;
12853
13464
  let attempts = 0;
12854
- let offerLedgerIndex = 0;
12855
- const regAcc = new XrplAccount(this.registryAddress, null, { xrplApi: this.xrplApi });
13465
+ const regAcc = new XrplAccount(this.config.registryAddress, null, { xrplApi: this.xrplApi });
12856
13466
 
12857
13467
  while (attempts < OFFER_WAIT_TIMEOUT) {
12858
- offer = (await regAcc.getNftOffers()).find(o => (o.NFTokenID == regNFT.NFTokenID) && (o.Flags === 0));
12859
- offerLedgerIndex = this.xrplApi.ledgerIndex;
12860
- if (offer)
13468
+ token = (await regAcc.getURITokens()).find(o => o.index == regUriToken.index);
13469
+ if (token)
12861
13470
  break;
12862
13471
  await new Promise(resolve => setTimeout(resolve, 1000));
12863
13472
  attempts++;
12864
13473
  }
12865
- if (!offer)
12866
- throw 'No buy offer found within timeout.';
12867
-
12868
- console.log('Accepting the buy offer..');
12869
-
12870
- // Wait until the next ledger after the offer is created.
12871
- // Otherwise if the offer accepted in the same legder which it's been created,
12872
- // We cannot fetch the offer from registry contract event handler since it's getting deleted immediately.
12873
- await new Promise(async resolve => {
12874
- while (this.xrplApi.ledgerIndex <= offerLedgerIndex)
12875
- await new Promise(resolve2 => setTimeout(resolve2, 1000));
12876
- resolve();
12877
- });
12878
-
12879
- await this.xrplAcc.sellNft(offer.index);
13474
+ if (!token)
13475
+ throw 'Token hasn\'t transferred within timeout.';
12880
13476
  }
12881
13477
 
12882
13478
  async isTransferee() {
12883
13479
 
12884
13480
  // Check the availability of TRANSFEREE state for this host address.
12885
13481
  const stateTransfereeAddrKey = StateHelpers.generateTransfereeAddrStateKey(this.xrplAcc.address);
12886
- const stateTransfereeAddrIndex = StateHelpers.getHookStateIndex(this.registryAddress, stateTransfereeAddrKey);
13482
+ const stateTransfereeAddrIndex = StateHelpers.getHookStateIndex(this.governorAddress, stateTransfereeAddrKey);
12887
13483
  const res = await this.xrplApi.getLedgerEntry(stateTransfereeAddrIndex);
12888
13484
 
12889
13485
  if (res && res?.HookStateData)
@@ -12891,74 +13487,35 @@ class HostClient extends BaseEvernodeClient {
12891
13487
 
12892
13488
  return false;
12893
13489
  }
12894
- }
12895
-
12896
- module.exports = {
12897
- HostEvents,
12898
- HostClient
12899
- }
12900
-
12901
-
12902
- /***/ }),
12903
-
12904
- /***/ 5898:
12905
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12906
-
12907
- const { EvernodeEvents } = __nccwpck_require__(9849);
12908
- const { BaseEvernodeClient } = __nccwpck_require__(6263);
12909
- const { DefaultValues } = __nccwpck_require__(8262);
12910
13490
 
12911
- const RegistryEvents = {
12912
- HostRegistered: EvernodeEvents.HostRegistered,
12913
- HostDeregistered: EvernodeEvents.HostDeregistered,
12914
- HostRegUpdated: EvernodeEvents.HostRegUpdated,
12915
- RegistryInitialized: EvernodeEvents.RegistryInitialized,
12916
- Heartbeat: EvernodeEvents.Heartbeat,
12917
- HostPostDeregistered: EvernodeEvents.HostPostDeregistered,
12918
- DeadHostPrune: EvernodeEvents.DeadHostPrune,
12919
- HostTransfer: EvernodeEvents.HostTransfer,
12920
- HostRebate: EvernodeEvents.HostRebate
12921
- }
13491
+ async propose(hashes, shortName, options = {}) {
13492
+ if (!(await this.isRegistered()))
13493
+ throw 'Host should be registered to propose candidates.';
12922
13494
 
12923
- class RegistryClient extends BaseEvernodeClient {
13495
+ return await super._propose(hashes, shortName, options);
13496
+ }
12924
13497
 
12925
- /**
12926
- * Constructs a registry client instance.
12927
- * @param {object} options [Optional] An object with 'rippledServer' URL and 'registryAddress'.
12928
- */
12929
- constructor(options = {}) {
12930
- super((options.registryAddress || DefaultValues.registryAddress), null, Object.values(RegistryEvents), false, options);
13498
+ async withdraw(candidateId, options = {}) {
13499
+ if (!(await this.isRegistered()))
13500
+ throw 'Host should be registered to withdraw candidates.';
13501
+
13502
+ return await super._withdraw(candidateId, options);
12931
13503
  }
12932
13504
 
12933
- /**
12934
- * Gets all the active hosts registered in Evernode without paginating.
12935
- * @returns The list of active hosts.
12936
- */
12937
- async getActiveHosts() {
12938
- let fullHostList = [];
12939
- const hosts = await this.getHosts();
12940
- if (hosts.nextPageToken) {
12941
- let currentPageToken = hosts.nextPageToken;
12942
- let nextHosts = null;
12943
- fullHostList = fullHostList.concat(hosts.data);
12944
- while (currentPageToken) {
12945
- nextHosts = await this.getHosts(null, null, currentPageToken);
12946
- fullHostList = fullHostList.concat(nextHosts.nextPageToken ? nextHosts.data : nextHosts);
12947
- currentPageToken = nextHosts.nextPageToken;
12948
- }
12949
- } else {
12950
- fullHostList = fullHostList.concat(hosts);
12951
- }
12952
- // Filter only active hosts.
12953
- return fullHostList.filter(h => h.active);
13505
+ async reportDudHost(hostAddress, options = {}) {
13506
+ if (!(await this.isRegistered()))
13507
+ throw 'Host should be registered to report dud hosts.';
13508
+
13509
+ return await this._reportDudHost(hostAddress, options);
12954
13510
  }
12955
13511
  }
12956
13512
 
12957
13513
  module.exports = {
12958
- RegistryEvents,
12959
- RegistryClient
13514
+ HostEvents,
13515
+ HostClient
12960
13516
  }
12961
13517
 
13518
+
12962
13519
  /***/ }),
12963
13520
 
12964
13521
  /***/ 6449:
@@ -12969,8 +13526,6 @@ const { EvernodeEvents, MemoFormats, MemoTypes, ErrorCodes, ErrorReasons, Everno
12969
13526
  const { EncryptionHelper } = __nccwpck_require__(4832);
12970
13527
  const { XrplAccount } = __nccwpck_require__(9329);
12971
13528
  const { UtilHelpers } = __nccwpck_require__(6687);
12972
- const { Buffer } = __nccwpck_require__(4300);
12973
- const codec = __nccwpck_require__(597);
12974
13529
  const { EvernodeHelpers } = __nccwpck_require__(2523);
12975
13530
  const { TransactionHelper } = __nccwpck_require__(7071);
12976
13531
 
@@ -12989,7 +13544,7 @@ class TenantClient extends BaseEvernodeClient {
12989
13544
  * Constructs a tenant client instance.
12990
13545
  * @param {string} xrpAddress XRPL address of the tenant.
12991
13546
  * @param {string} XRPL secret of the tenant.
12992
- * @param {object} options [Optional] An object with 'rippledServer' URL and 'registryAddress'.
13547
+ * @param {object} options [Optional] An object with 'rippledServer' URL and 'governorAddress'.
12993
13548
  */
12994
13549
  constructor(xrpAddress, xrpSecret, options = {}) {
12995
13550
  super(xrpAddress, xrpSecret, Object.values(TenantEvents), false, options);
@@ -13007,15 +13562,13 @@ class TenantClient extends BaseEvernodeClient {
13007
13562
 
13008
13563
  async getLeaseHost(hostAddress) {
13009
13564
  const host = new XrplAccount(hostAddress, null, { xrplApi: this.xrplApi });
13010
- // Find an owned NFT with matching Evernode host NFT prefix.
13011
- const nft = (await host.getNfts()).find(n => n.URI.startsWith(EvernodeConstants.NFT_PREFIX_HEX));
13012
- if (!nft)
13565
+ // Find an owned URI token with matching Evernode host NFT prefix.
13566
+ const uriToken = (await host.getURITokens()).find(n => n.URI.startsWith(EvernodeConstants.TOKEN_PREFIX_HEX));
13567
+ if (!uriToken)
13013
13568
  throw { reason: ErrorReasons.HOST_INVALID, error: "Host is not registered." };
13014
13569
 
13015
13570
  // Check whether the token was actually issued from Evernode registry contract.
13016
- const issuerHex = nft.NFTokenID.substr(8, 40);
13017
- const issuerAddr = codec.encodeAccountID(Buffer.from(issuerHex, 'hex'));
13018
- if (issuerAddr != this.registryAddress)
13571
+ if (uriToken.Issuer != this.config.registryAddress)
13019
13572
  throw { reason: ErrorReasons.HOST_INVALID, error: "Host is not registered." };
13020
13573
 
13021
13574
  // Check whether active.
@@ -13040,15 +13593,21 @@ class TenantClient extends BaseEvernodeClient {
13040
13593
  const hostAcc = await this.getLeaseHost(hostAddress);
13041
13594
  let selectedOfferIndex = options.leaseOfferIndex;
13042
13595
 
13043
- // Attempt to get first available offer, if offer is not specified in options.
13044
- if (!selectedOfferIndex) {
13045
- const nftOffers = await EvernodeHelpers.getLeaseOffers(hostAcc);
13046
- selectedOfferIndex = nftOffers && nftOffers[0] && nftOffers[0].index;
13596
+ let buyUriOffer = null;
13597
+ const uriTokenOffers = await EvernodeHelpers.getLeaseOffers(hostAcc);
13047
13598
 
13048
- if (!selectedOfferIndex)
13049
- throw { reason: ErrorReasons.NO_OFFER, error: "No offers available." };
13599
+ if (!selectedOfferIndex) {
13600
+ // Attempt to get first available offer, if offer is not specified in options.
13601
+ buyUriOffer = uriTokenOffers && uriTokenOffers[0];
13602
+ }
13603
+ else {
13604
+ // Attempt to get relevant available offer using selectedOfferIndex.
13605
+ buyUriOffer = uriTokenOffers && uriTokenOffers.find(uriOffer => { uriOffer.index === selectedOfferIndex });
13050
13606
  }
13051
13607
 
13608
+ if (!buyUriOffer)
13609
+ throw { reason: ErrorReasons.NO_OFFER, error: "No offers available." };
13610
+
13052
13611
  // Encrypt the requirements with the host's encryption key (Specified in MessageKey field of the host account).
13053
13612
  const encKey = await hostAcc.getMessageKey();
13054
13613
  if (!encKey)
@@ -13059,7 +13618,7 @@ class TenantClient extends BaseEvernodeClient {
13059
13618
  ephemPrivateKey: options.ephemPrivateKey // Must be null or 32 bytes.
13060
13619
  });
13061
13620
 
13062
- return this.xrplAcc.buyNft(selectedOfferIndex, [{ type: MemoTypes.ACQUIRE_LEASE, format: MemoFormats.BASE64, data: ecrypted }], options.transactionOptions);
13621
+ return this.xrplAcc.buyURIToken(buyUriOffer, [{ type: MemoTypes.ACQUIRE_LEASE, format: MemoFormats.BASE64, data: ecrypted }], options.transactionOptions);
13063
13622
  }
13064
13623
 
13065
13624
  /**
@@ -13185,7 +13744,7 @@ class TenantClient extends BaseEvernodeClient {
13185
13744
  resolve({
13186
13745
  transaction: relevantTx?.data.transaction,
13187
13746
  expiryMoment: relevantTx?.data.expiryMoment,
13188
- extendeRefId: relevantTx?.data.extendRefId
13747
+ extendRefId: relevantTx?.data.extendRefId
13189
13748
  });
13190
13749
  } else if (relevantTx?.name === TenantEvents.ExtendError) {
13191
13750
  reject({
@@ -13209,17 +13768,17 @@ class TenantClient extends BaseEvernodeClient {
13209
13768
  extendLease(hostAddress, moments, instanceName, options = {}) {
13210
13769
  return new Promise(async (resolve, reject) => {
13211
13770
  const tokenID = instanceName;
13212
- const nft = (await this.xrplAcc.getNfts())?.find(n => n.NFTokenID == tokenID);
13771
+ const uriToken = (await this.xrplAcc.getURITokens())?.find(n => n.index == tokenID);
13213
13772
 
13214
- if (!nft) {
13215
- reject({ error: ErrorCodes.EXTEND_ERR, reason: ErrorReasons.NO_NFT, content: 'Could not find the nft for lease extend request.' });
13773
+ if (!uriToken) {
13774
+ reject({ error: ErrorCodes.EXTEND_ERR, reason: ErrorReasons.NO_NFT, content: 'Could not find the uri token for lease extend request.' });
13216
13775
  return;
13217
13776
  }
13218
13777
 
13219
13778
  let minLedgerIndex = this.xrplApi.ledgerIndex;
13220
13779
 
13221
13780
  // Get the agreement lease amount from the nft and calculate EVR amount to be sent.
13222
- const uriInfo = UtilHelpers.decodeLeaseNftUri(nft.URI);
13781
+ const uriInfo = UtilHelpers.decodeLeaseTokenUri(uriToken.URI);
13223
13782
  const tx = await this.extendLeaseSubmit(hostAddress, moments * uriInfo.leaseAmount, tokenID, options).catch(error => {
13224
13783
  reject({ error: ErrorCodes.EXTEND_ERR, reason: error.reason || ErrorReasons.TRANSACTION_FAILURE, content: error.error || error });
13225
13784
  });
@@ -13241,16 +13800,24 @@ module.exports = {
13241
13800
  TenantClient
13242
13801
  }
13243
13802
 
13803
+
13244
13804
  /***/ }),
13245
13805
 
13246
13806
  /***/ 8262:
13247
13807
  /***/ ((module) => {
13248
13808
 
13249
13809
  const DefaultValues = {
13250
- registryAddress: 'raaFre81618XegCrzTzVotAmarBcqNSAvK',
13251
- rippledServer: 'wss://hooks-testnet-v2.xrpl-labs.com',
13810
+ governorAddress: 'r9keGGSTDRg58RuiWYAQYuAAA8nqMG7EP5',
13811
+ rippledServer: 'wss://hooks-testnet-v3.xrpl-labs.com',
13252
13812
  xrplApi: null,
13253
- stateIndexId: 'evernodeindex'
13813
+ stateIndexId: 'evernodeindex',
13814
+ networkID: 21338
13815
+ }
13816
+
13817
+ const HookTypes = {
13818
+ governor: 'GOVERNOR',
13819
+ registry: 'REGISTRY',
13820
+ heartbeat: 'HEARTBEAT'
13254
13821
  }
13255
13822
 
13256
13823
  class Defaults {
@@ -13265,7 +13832,8 @@ class Defaults {
13265
13832
 
13266
13833
  module.exports = {
13267
13834
  DefaultValues,
13268
- Defaults
13835
+ Defaults,
13836
+ HookTypes
13269
13837
  }
13270
13838
 
13271
13839
  /***/ }),
@@ -13692,10 +14260,36 @@ module.exports = {
13692
14260
 
13693
14261
  const EvernodeConstants = {
13694
14262
  EVR: 'EVR',
13695
- NFT_PREFIX_HEX: '657672686F7374', // evrhost
13696
- LEASE_NFT_PREFIX_HEX: '6576726C65617365', // evrlease
14263
+ TOKEN_PREFIX_HEX: '657672686F7374', // evrhost
14264
+ LEASE_TOKEN_PREFIX_HEX: '6576726C65617365', // evrlease
13697
14265
  HOOK_NAMESPACE: '01EAF09326B4911554384121FF56FA8FECC215FDDE2EC35D9E59F2C53EC665A0',
13698
- NOW_IN_EVRS: "0.00000001"
14266
+ NOW_IN_EVRS: "0.00000001",
14267
+ HOOKS: [
14268
+ "Governor",
14269
+ "Registry",
14270
+ "Heartbeat"
14271
+ ],
14272
+ CandidateVote: {
14273
+ Reject: 0,
14274
+ Support: 1
14275
+ },
14276
+ CandidateTypes: {
14277
+ NewHook: 1,
14278
+ PilotedMode: 2,
14279
+ DudHost: 3
14280
+ },
14281
+ GovernanceModes: {
14282
+ Piloted: 1,
14283
+ CoPiloted: 2,
14284
+ AutoPiloted: 3
14285
+ },
14286
+ CandidateStatuses: {
14287
+ CANDIDATE_REJECTED: 0,
14288
+ CANDIDATE_SUPPORTED: 1,
14289
+ CANDIDATE_ELECTED: 2,
14290
+ CANDIDATE_VETOED: 3,
14291
+ CANDIDATE_EXPIRED: 4
14292
+ }
13699
14293
  }
13700
14294
 
13701
14295
  const MemoTypes = {
@@ -13707,18 +14301,24 @@ const MemoTypes = {
13707
14301
  HOST_DEREG: 'evnHostDereg',
13708
14302
  HOST_UPDATE_INFO: 'evnHostUpdateReg',
13709
14303
  HEARTBEAT: 'evnHeartbeat',
13710
- HOST_POST_DEREG: 'evnHostPostDereg',
13711
14304
  HOST_TRANSFER: 'evnTransfer',
13712
14305
  EXTEND_LEASE: 'evnExtendLease',
13713
14306
  EXTEND_SUCCESS: 'evnExtendSuccess',
13714
14307
  EXTEND_ERROR: 'evnExtendError',
13715
14308
  EXTEND_REF: 'evnExtendRef',
13716
- REGISTRY_INIT: 'evnInitialize',
14309
+ INIT: 'evnInitialize',
13717
14310
  REFUND: 'evnRefund',
13718
14311
  REFUND_REF: 'evnRefundRef',
13719
14312
  DEAD_HOST_PRUNE: 'evnDeadHostPrune',
13720
14313
  HOST_REBATE: 'evnHostRebate',
13721
- HOST_REGISTRY_REF: 'evnHostRegistryRef'
14314
+ CANDIDATE_PROPOSE: 'evnCandidatePropose',
14315
+ CANDIDATE_PROPOSE_REF: 'evnCandidateProposeRef',
14316
+ CANDIDATE_WITHDRAW: 'evnCandidateWithdraw',
14317
+ CANDIDATE_VOTE: 'evnCandidateVote',
14318
+ CANDIDATE_STATUS_CHANGE: 'evnCandidateStatusChange',
14319
+ DUD_HOST_REPORT: 'evnDudHostReport',
14320
+ HOOK_UPDATE_RES: 'evnHookUpdateRes',
14321
+ GOVERNANCE_MODE_CHANGE: 'evnGovernanceModeChange'
13722
14322
  }
13723
14323
 
13724
14324
  const MemoFormats = {
@@ -13730,7 +14330,8 @@ const MemoFormats = {
13730
14330
 
13731
14331
  const ErrorCodes = {
13732
14332
  ACQUIRE_ERR: 'ACQUIRE_ERR',
13733
- EXTEND_ERR: 'EXTEND_ERR'
14333
+ EXTEND_ERR: 'EXTEND_ERR',
14334
+ PROPOSE_ERR: 'PROPOSE_ERR',
13734
14335
  }
13735
14336
 
13736
14337
  const ErrorReasons = {
@@ -13754,13 +14355,14 @@ const HookStateKeys = {
13754
14355
  MINT_LIMIT: "4556520100000000000000000000000000000000000000000000000000000004",
13755
14356
  FIXED_REG_FEE: "4556520100000000000000000000000000000000000000000000000000000005",
13756
14357
  HOST_HEARTBEAT_FREQ: "4556520100000000000000000000000000000000000000000000000000000006",
13757
- PURCHASER_TARGET_PRICE: "4556520100000000000000000000000000000000000000000000000000000007",
13758
- LEASE_ACQUIRE_WINDOW: "4556520100000000000000000000000000000000000000000000000000000008",
13759
- REWARD_CONFIGURATION: "4556520100000000000000000000000000000000000000000000000000000009",
13760
- MAX_TOLERABLE_DOWNTIME: "455652010000000000000000000000000000000000000000000000000000000A",
13761
- MOMENT_TRANSIT_INFO: "455652010000000000000000000000000000000000000000000000000000000B",
13762
- MAX_TRX_EMISSION_FEE: "455652010000000000000000000000000000000000000000000000000000000C",
13763
-
14358
+ LEASE_ACQUIRE_WINDOW: "4556520100000000000000000000000000000000000000000000000000000007",
14359
+ REWARD_CONFIGURATION: "4556520100000000000000000000000000000000000000000000000000000008",
14360
+ MAX_TOLERABLE_DOWNTIME: "4556520100000000000000000000000000000000000000000000000000000009",
14361
+ MOMENT_TRANSIT_INFO: "455652010000000000000000000000000000000000000000000000000000000A",
14362
+ MAX_TRX_EMISSION_FEE: "455652010000000000000000000000000000000000000000000000000000000B",
14363
+ HEARTBEAT_ADDR: "455652010000000000000000000000000000000000000000000000000000000C",
14364
+ REGISTRY_ADDR: "455652010000000000000000000000000000000000000000000000000000000D",
14365
+ GOVERNANCE_CONFIGURATION: "455652010000000000000000000000000000000000000000000000000000000E",
13764
14366
 
13765
14367
  // Singleton
13766
14368
  HOST_COUNT: "4556523200000000000000000000000000000000000000000000000000000000",
@@ -13768,17 +14370,19 @@ const HookStateKeys = {
13768
14370
  HOST_REG_FEE: "4556523400000000000000000000000000000000000000000000000000000000",
13769
14371
  MAX_REG: "4556523500000000000000000000000000000000000000000000000000000000",
13770
14372
  REWARD_INFO: "4556523600000000000000000000000000000000000000000000000000000000",
14373
+ GOVERNANCE_INFO: "4556523700000000000000000000000000000000000000000000000000000000",
13771
14374
 
13772
14375
  // Prefixes
13773
14376
  PREFIX_HOST_TOKENID: "45565202",
13774
14377
  PREFIX_HOST_ADDR: "45565203",
13775
14378
  PREFIX_TRANSFEREE_ADDR: "45565204",
14379
+ PREFIX_CANDIDATE_OWNER: "45565205",
14380
+ PREFIX_CANDIDATE_ID: "45565206",
13776
14381
  }
13777
14382
 
13778
14383
  const EvernodeEvents = {
13779
14384
  HostRegistered: "HostRegistered",
13780
14385
  HostDeregistered: "HostDeregistered",
13781
- HostPostDeregistered: "HostPostDeregistered",
13782
14386
  HostTransfer: "HostTransfer",
13783
14387
  AcquireLease: "AcquireLease",
13784
14388
  AcquireSuccess: "AcquireSuccess",
@@ -13789,9 +14393,24 @@ const EvernodeEvents = {
13789
14393
  ExtendError: "ExtendError",
13790
14394
  HostRegUpdated: "HostRegUpdated",
13791
14395
  HostReRegistered: "HostReRegistered",
13792
- RegistryInitialized: "RegistryInitialized",
14396
+ Initialized: "Initialized",
13793
14397
  DeadHostPrune: "DeadHostPrune",
13794
- HostRebate: "HostRebate"
14398
+ HostRebate: "HostRebate",
14399
+ CandidateProposed: "CandidateProposed",
14400
+ CandidateWithdrew: "CandidateWithdrew",
14401
+ ChildHookUpdated: "ChildHookUpdated",
14402
+ GovernanceModeChanged: "GovernanceModeChanged",
14403
+ FoundationVoted: "FoundationVoted",
14404
+ DudHostReported: "DudHostReported",
14405
+ DudHostRemoved: "DudHostRemoved",
14406
+ DudHostStatusChanged: "DudHostStatusChanged",
14407
+ FallbackToPiloted: "FallbackToPiloted",
14408
+ NewHookStatusChanged: "NewHookStatusChanged"
14409
+ }
14410
+
14411
+ const URITokenTypes = {
14412
+ LEASE_URI_TOKEN: 1,
14413
+ REGISTRATION_URI_TOKEN: 2
13795
14414
  }
13796
14415
 
13797
14416
  module.exports = {
@@ -13801,7 +14420,8 @@ module.exports = {
13801
14420
  ErrorCodes,
13802
14421
  ErrorReasons,
13803
14422
  HookStateKeys,
13804
- EvernodeEvents
14423
+ EvernodeEvents,
14424
+ URITokenTypes
13805
14425
  }
13806
14426
 
13807
14427
  /***/ }),
@@ -13809,15 +14429,16 @@ module.exports = {
13809
14429
  /***/ 2523:
13810
14430
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
13811
14431
 
13812
- const { EvernodeConstants } = __nccwpck_require__(9849);
14432
+ const { EvernodeConstants, URITokenTypes } = __nccwpck_require__(9849);
14433
+ const { UtilHelpers } = __nccwpck_require__(6687);
14434
+ const { TransactionHelper } = __nccwpck_require__(7071);
14435
+
13813
14436
  const NFT_PAGE_LEDGER_ENTRY_TYPE_HEX = '0050';
13814
14437
 
13815
14438
  class EvernodeHelpers {
13816
14439
  static async getLeaseOffers(xrplAcc) {
13817
- const hostNfts = (await xrplAcc.getNfts()).filter(nft => nft.URI.startsWith(EvernodeConstants.LEASE_NFT_PREFIX_HEX));
13818
- const hostTokenIDs = hostNfts.map(nft => nft.NFTokenID);
13819
- const nftOffers = (await xrplAcc.getNftOffers())?.filter(offer => (offer.Flags == 1 && hostTokenIDs.includes(offer.NFTokenID))); // Filter only sell offers
13820
- return nftOffers;
14440
+ const hostUriOffers = (await xrplAcc.getURITokens()).filter(uriToken => this.isValidURI(uriToken.URI, EvernodeConstants.LEASE_TOKEN_PREFIX_HEX) && uriToken.Flags == 1 && uriToken.Amount);
14441
+ return hostUriOffers;
13821
14442
  }
13822
14443
 
13823
14444
  static async getNFTPageAndLocation(nfTokenId, xrplAcc, xrplApi, buffer = true) {
@@ -13849,6 +14470,20 @@ class EvernodeHelpers {
13849
14470
 
13850
14471
  return nftPageInfo;
13851
14472
  }
14473
+
14474
+ static getEpochRewardQuota(epoch, firstEpochRewardQuota) {
14475
+ const div = (epoch > 1) ? Math.pow(2, epoch - 1) : 1;
14476
+ return firstEpochRewardQuota / div;
14477
+ }
14478
+
14479
+ static isValidURI(uri, pattern, tokenCategory = URITokenTypes.LEASE_URI_TOKEN) {
14480
+ if (tokenCategory === URITokenTypes.LEASE_URI_TOKEN) {
14481
+ uri = TransactionHelper.hexToASCII(uri);
14482
+ const uriBuf = Buffer.from(uri, 'base64');
14483
+ uri = uriBuf.toString('hex').toUpperCase();
14484
+ }
14485
+ return uri.startsWith(pattern);
14486
+ }
13852
14487
  }
13853
14488
 
13854
14489
  module.exports = {
@@ -13874,7 +14509,7 @@ class FirestoreHandler {
13874
14509
 
13875
14510
  constructor(options = {}) {
13876
14511
  this.#projectId = options.stateIndexId || DefaultValues.stateIndexId;
13877
- this.#collectionPrefix = options.collectionPrefix || DefaultValues.registryAddress;
14512
+ this.#collectionPrefix = options.collectionPrefix || DefaultValues.governorAddress;
13878
14513
  }
13879
14514
 
13880
14515
  /**
@@ -14156,6 +14791,10 @@ class FirestoreHandler {
14156
14791
  return item;
14157
14792
  }
14158
14793
 
14794
+ async getCandidates(filters = null, pageSize = null, nextPageToken = null) {
14795
+ return await this.#getDocuments(this.getCollectionId('candidates'), filters, pageSize, nextPageToken);
14796
+ }
14797
+
14159
14798
  async getHosts(filters = null, pageSize = null, nextPageToken = null) {
14160
14799
  return await this.#getDocuments(this.getCollectionId('hosts'), filters, pageSize, nextPageToken);
14161
14800
  }
@@ -14172,13 +14811,56 @@ module.exports = {
14172
14811
 
14173
14812
  /***/ }),
14174
14813
 
14814
+ /***/ 4675:
14815
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
14816
+
14817
+ const crypto = __nccwpck_require__(6113);
14818
+
14819
+ const HOOK_DEFINITION_LEDGER_TYPE_PREFIX = 68; // Decimal value of ASCII 'D'
14820
+
14821
+ class HookHelpers {
14822
+ static getHookDefinitionIndex(hookHash) {
14823
+ const typeBuf = Buffer.allocUnsafe(2);
14824
+ typeBuf.writeInt16BE(HOOK_DEFINITION_LEDGER_TYPE_PREFIX);
14825
+
14826
+ const hookHashBuf = Buffer.from(hookHash, 'hex');
14827
+
14828
+ let hash = crypto.createHash('sha512');
14829
+
14830
+ let data = hash.update(typeBuf);
14831
+ data = hash.update(hookHashBuf);
14832
+
14833
+ const digest = data.digest('hex');
14834
+ // Get the first 32 bytes of hash.
14835
+ return digest.substring(0, 64).toUpperCase();
14836
+ }
14837
+
14838
+ static getHookDefinitionKeylet(index) {
14839
+ const keyletBuf = Buffer.allocUnsafe(34);
14840
+ keyletBuf.writeInt16BE(HOOK_DEFINITION_LEDGER_TYPE_PREFIX);
14841
+ Buffer.from(index, 'hex').copy(keyletBuf, 2);
14842
+
14843
+ return keyletBuf.toString('hex');
14844
+ }
14845
+ }
14846
+
14847
+ module.exports = {
14848
+ HookHelpers
14849
+ }
14850
+
14851
+ /***/ }),
14852
+
14175
14853
  /***/ 5053:
14176
14854
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
14177
14855
 
14178
- const { Defaults } = __nccwpck_require__(8262);
14179
- const { RegistryClient, RegistryEvents } = __nccwpck_require__(5898);
14856
+ const { Defaults, HookTypes } = __nccwpck_require__(8262);
14857
+ const { RegistryClient, RegistryEvents } = __nccwpck_require__(8074);
14858
+ const { GovernorClient, GovernorEvents } = __nccwpck_require__(335);
14859
+ const { HeartbeatClient, HeartbeatEvents } = __nccwpck_require__(6510);
14860
+ const { HookClientFactory } = __nccwpck_require__(2344);
14180
14861
  const { TenantClient, TenantEvents } = __nccwpck_require__(6449);
14181
14862
  const { HostClient, HostEvents } = __nccwpck_require__(1437);
14863
+ const { FoundationClient, FoundationEvents } = __nccwpck_require__(2466);
14182
14864
  const { XrplApi } = __nccwpck_require__(1850);
14183
14865
  const { XrplApiEvents, XrplConstants } = __nccwpck_require__(3307);
14184
14866
  const { XrplAccount } = __nccwpck_require__(9329);
@@ -14189,14 +14871,22 @@ const { StateHelpers } = __nccwpck_require__(3860);
14189
14871
  const { UtilHelpers } = __nccwpck_require__(6687);
14190
14872
  const { TransactionHelper } = __nccwpck_require__(7071);
14191
14873
  const { EncryptionHelper } = __nccwpck_require__(4832);
14874
+ const { EvernodeHelpers } = __nccwpck_require__(2523);
14875
+
14192
14876
 
14193
14877
  module.exports = {
14194
14878
  RegistryClient,
14195
14879
  RegistryEvents,
14880
+ GovernorClient,
14881
+ GovernorEvents,
14882
+ HeartbeatClient,
14883
+ HeartbeatEvents,
14196
14884
  TenantClient,
14197
14885
  TenantEvents,
14198
14886
  HostClient,
14199
14887
  HostEvents,
14888
+ FoundationClient,
14889
+ FoundationEvents,
14200
14890
  XrplApi,
14201
14891
  XrplApiEvents,
14202
14892
  XrplConstants,
@@ -14210,7 +14900,10 @@ module.exports = {
14210
14900
  TransactionHelper,
14211
14901
  EncryptionHelper,
14212
14902
  HookStateKeys,
14213
- MemoTypes
14903
+ MemoTypes,
14904
+ HookTypes,
14905
+ HookClientFactory,
14906
+ EvernodeHelpers
14214
14907
  }
14215
14908
 
14216
14909
  /***/ }),
@@ -14223,6 +14916,8 @@ const { Buffer } = __nccwpck_require__(4300);
14223
14916
  const { HookStateKeys, EvernodeConstants } = __nccwpck_require__(9849);
14224
14917
  const { XflHelpers } = __nccwpck_require__(3243);
14225
14918
  const crypto = __nccwpck_require__(6113);
14919
+ const { UtilHelpers } = __nccwpck_require__(6687);
14920
+ const { sha512Half } = __nccwpck_require__(4010);
14226
14921
 
14227
14922
  const NFTOKEN_PREFIX = '00000000';
14228
14923
 
@@ -14245,6 +14940,22 @@ const MOMENT_BASE_POINT_OFFSET = 0;
14245
14940
  const MOMENT_AT_TRANSITION_OFFSET = 8;
14246
14941
  const MOMENT_TYPE_OFFSET = 12;
14247
14942
 
14943
+ const ELIGIBILITY_PERIOD_OFFSET = 0;
14944
+ const CANDIDATE_LIFE_PERIOD_OFFSET = 4;
14945
+ const CANDIDATE_ELECTION_PERIOD_OFFSET = 8;
14946
+ const CANDIDATE_SUPPORT_AVERAGE_OFFSET = 12;
14947
+
14948
+ const GOVERNANCE_MODE_OFFSET = 0;
14949
+ const LAST_CANDIDATE_IDX_OFFSET = 1;
14950
+ const VOTER_BASE_COUNT_OFFSET = 5;
14951
+ const VOTER_BASE_COUNT_CHANGED_TIMESTAMP_OFFSET = 9;
14952
+ const FOUNDATION_LAST_VOTED_CANDIDATE_IDX = 17;
14953
+ const FOUNDATION_LAST_VOTED_TIMESTAMP_OFFSET = 21;
14954
+ const ELECTED_PROPOSAL_UNIQUE_ID_OFFSET = 29;
14955
+ const PROPOSAL_ELECTED_TIMESTAMP_OFFSET = 61;
14956
+ const UPDATED_HOOK_COUNT_OFFSET = 69;
14957
+ const FOUNDATION_SUPPORT_VOTE_FLAG_OFFSET = 70;
14958
+
14248
14959
  const HOST_TOKEN_ID_OFFSET = 0;
14249
14960
  const HOST_COUNTRY_CODE_OFFSET = 32;
14250
14961
  const HOST_RESERVED_OFFSET = 34;
@@ -14253,10 +14964,13 @@ const HOST_REG_LEDGER_OFFSET = 68;
14253
14964
  const HOST_REG_FEE_OFFSET = 76;
14254
14965
  const HOST_TOT_INS_COUNT_OFFSET = 84;
14255
14966
  const HOST_ACT_INS_COUNT_OFFSET = 88;
14256
- const HOST_HEARTBEAT_LEDGER_IDX_OFFSET = 92;
14967
+ const HOST_HEARTBEAT_TIMESTAMP_OFFSET = 92;
14257
14968
  const HOST_VERSION_OFFSET = 100;
14258
14969
  const HOST_REG_TIMESTAMP_OFFSET = 103;
14259
14970
  const HOST_TRANSFER_FLAG_OFFSET = 111;
14971
+ const HOST_LAST_VOTE_CANDIDATE_IDX_OFFSET = 112;
14972
+ const HOST_LAST_VOTE_TIMESTAMP_OFFSET = 116;
14973
+ const HOST_SUPPORT_VOTE_FLAG_OFFSET = 124;
14260
14974
 
14261
14975
  const HOST_ADDRESS_OFFSET = 0;
14262
14976
  const HOST_CPU_MODEL_NAME_OFFSET = 20;
@@ -14271,10 +14985,27 @@ const PREV_HOST_ADDRESS_OFFSET = 0;
14271
14985
  const TRANSFER_LEDGER_IDX_OFFSET = 20;
14272
14986
  const TRANSFERRED_NFT_ID_OFFSET = 28;
14273
14987
 
14988
+ const CANDIDATE_GOVERNOR_HOOK_HASH_OFFSET = 0;
14989
+ const CANDIDATE_REGISTRY_HOOK_HASH_OFFSET = 32;
14990
+ const CANDIDATE_HEARTBEAT_HOOK_HASH_OFFSET = 64;
14991
+
14992
+ const CANDIDATE_OWNER_ADDRESS_OFFSET = 0;
14993
+ const CANDIDATE_IDX_OFFSET = 20;
14994
+ const CANDIDATE_SHORT_NAME_OFFSET = 24;
14995
+ const CANDIDATE_CREATED_TIMESTAMP_OFFSET = 44;
14996
+ const CANDIDATE_PROPOSAL_FEE_OFFSET = 52;
14997
+ const CANDIDATE_POSITIVE_VOTE_COUNT_OFFSET = 60;
14998
+ const CANDIDATE_LAST_VOTE_TIMESTAMP_OFFSET = 64;
14999
+ const CANDIDATE_STATUS_OFFSET = 72;
15000
+ const CANDIDATE_STATUS_CHANGE_TIMESTAMP_OFFSET = 73;
15001
+ const CANDIDATE_FOUNDATION_VOTE_STATUS_OFFSET = 81;
15002
+
14274
15003
  const STATE_KEY_TYPES = {
14275
15004
  TOKEN_ID: 2,
14276
15005
  HOST_ADDR: 3,
14277
- TRANSFEREE_ADDR: 4
15006
+ TRANSFEREE_ADDR: 4,
15007
+ CANDIDATE_OWNER: 5,
15008
+ CANDIDATE_ID: 6
14278
15009
  }
14279
15010
 
14280
15011
  const MOMENT_TYPES = {
@@ -14290,6 +15021,7 @@ const TRANSFER_STATES = {
14290
15021
  const EVERNODE_PREFIX = 'EVR';
14291
15022
  const HOST_ADDR_KEY_ZERO_COUNT = 8;
14292
15023
  const TRANSFEREE_ADDR_KEY_ZERO_COUNT = 8;
15024
+ const CANDIDATE_OWNER_KEY_ZERO_COUNT = 8;
14293
15025
  const HOOK_STATE_LEDGER_TYPE_PREFIX = 118; // Decimal value of ASCII 'v'
14294
15026
  const PENDING_TRANSFER = 1;
14295
15027
  const HOST_EMAIL_ADDRESS_LEN = 40;
@@ -14300,7 +15032,9 @@ class StateHelpers {
14300
15032
  HOST_ADDR: 'hostAddr',
14301
15033
  SIGLETON: 'singleton',
14302
15034
  CONFIGURATION: 'configuration',
14303
- TRANSFEREE_ADDR: 'transfereeAddr'
15035
+ TRANSFEREE_ADDR: 'transfereeAddr',
15036
+ CANDIDATE_OWNER: 'candidateOwner',
15037
+ CANDIDATE_ID: 'candidateId'
14304
15038
  }
14305
15039
 
14306
15040
  static timeLines = {
@@ -14318,16 +15052,19 @@ class StateHelpers {
14318
15052
  static decodeHostAddressState(stateKeyBuf, stateDataBuf) {
14319
15053
  let data = {
14320
15054
  address: codec.encodeAccountID(stateKeyBuf.slice(12)),
14321
- nfTokenId: stateDataBuf.slice(HOST_TOKEN_ID_OFFSET, HOST_COUNTRY_CODE_OFFSET).toString('hex').toUpperCase(),
15055
+ uriTokenId: stateDataBuf.slice(HOST_TOKEN_ID_OFFSET, HOST_COUNTRY_CODE_OFFSET).toString('hex').toUpperCase(),
14322
15056
  countryCode: stateDataBuf.slice(HOST_COUNTRY_CODE_OFFSET, HOST_RESERVED_OFFSET).toString(),
14323
15057
  description: stateDataBuf.slice(HOST_DESCRIPTION_OFFSET, HOST_REG_LEDGER_OFFSET).toString().replace(/\0/g, ''),
14324
15058
  registrationLedger: Number(stateDataBuf.readBigUInt64BE(HOST_REG_LEDGER_OFFSET)),
14325
15059
  registrationFee: Number(stateDataBuf.readBigUInt64BE(HOST_REG_FEE_OFFSET)),
14326
15060
  maxInstances: stateDataBuf.readUInt32BE(HOST_TOT_INS_COUNT_OFFSET),
14327
15061
  activeInstances: stateDataBuf.readUInt32BE(HOST_ACT_INS_COUNT_OFFSET),
14328
- lastHeartbeatIndex: Number(stateDataBuf.readBigUInt64BE(HOST_HEARTBEAT_LEDGER_IDX_OFFSET)),
15062
+ lastHeartbeatIndex: Number(stateDataBuf.readBigUInt64BE(HOST_HEARTBEAT_TIMESTAMP_OFFSET)),
14329
15063
  version: `${stateDataBuf.readUInt8(HOST_VERSION_OFFSET)}.${stateDataBuf.readUInt8(HOST_VERSION_OFFSET + 1)}.${stateDataBuf.readUInt8(HOST_VERSION_OFFSET + 2)}`,
14330
- isATransferer: (stateDataBuf.length > HOST_TRANSFER_FLAG_OFFSET && (stateDataBuf.readUInt8(HOST_TRANSFER_FLAG_OFFSET) === PENDING_TRANSFER)) ? TRANSFER_STATES.HAS_A_TRANSFER : TRANSFER_STATES.NO_TRANSFER
15064
+ isATransferer: (stateDataBuf.readUInt8(HOST_TRANSFER_FLAG_OFFSET) === PENDING_TRANSFER) ? TRANSFER_STATES.HAS_A_TRANSFER : TRANSFER_STATES.NO_TRANSFER,
15065
+ lastVoteCandidateIdx: stateDataBuf.readUInt32BE(HOST_LAST_VOTE_CANDIDATE_IDX_OFFSET),
15066
+ lastVoteTimestamp: Number(stateDataBuf.readBigUInt64BE(HOST_LAST_VOTE_TIMESTAMP_OFFSET)),
15067
+ supportVoteSent: stateDataBuf.readUInt8(HOST_SUPPORT_VOTE_FLAG_OFFSET)
14331
15068
  }
14332
15069
  if (stateDataBuf.length > HOST_REG_TIMESTAMP_OFFSET)
14333
15070
  data.registrationTimestamp = Number(stateDataBuf.readBigUInt64BE(HOST_REG_TIMESTAMP_OFFSET));
@@ -14343,13 +15080,10 @@ class StateHelpers {
14343
15080
  cpuMicrosec: stateDataBuf.readUInt32BE(HOST_CPU_MICROSEC_OFFSET),
14344
15081
  ramMb: stateDataBuf.readUInt32BE(HOST_RAM_MB_OFFSET),
14345
15082
  diskMb: stateDataBuf.readUInt32BE(HOST_DISK_MB_OFFSET),
14346
- email: (stateDataBuf.length > HOST_EMAIL_ADDRESS_OFFSET ?
14347
- stateDataBuf.slice(HOST_EMAIL_ADDRESS_OFFSET, HOST_EMAIL_ADDRESS_OFFSET + HOST_EMAIL_ADDRESS_LEN).toString().toString().replace(/\0/g, '') :
14348
- "")
15083
+ email: stateDataBuf.slice(HOST_EMAIL_ADDRESS_OFFSET, HOST_EMAIL_ADDRESS_OFFSET + HOST_EMAIL_ADDRESS_LEN).toString().toString().replace(/\0/g, '')
14349
15084
  }
14350
15085
  }
14351
15086
 
14352
-
14353
15087
  static decodeTransfereeAddrState(stateKeyBuf, stateDataBuf) {
14354
15088
  const prevHostClassicAddress = codec.encodeAccountID(stateDataBuf.slice(PREV_HOST_ADDRESS_OFFSET, TRANSFER_LEDGER_IDX_OFFSET));
14355
15089
  return {
@@ -14361,6 +15095,51 @@ class StateHelpers {
14361
15095
  }
14362
15096
  }
14363
15097
 
15098
+ static decodeCandidateOwnerState(stateKeyBuf, stateDataBuf) {
15099
+ let data = {
15100
+ ownerAddress: codec.encodeAccountID(stateKeyBuf.slice(12)),
15101
+ uniqueId: this.getNewHookCandidateId(stateDataBuf),
15102
+ governorHookHash: stateDataBuf.slice(CANDIDATE_GOVERNOR_HOOK_HASH_OFFSET, CANDIDATE_REGISTRY_HOOK_HASH_OFFSET).toString('hex').toUpperCase(),
15103
+ registryHookHash: stateDataBuf.slice(CANDIDATE_REGISTRY_HOOK_HASH_OFFSET, CANDIDATE_HEARTBEAT_HOOK_HASH_OFFSET).toString('hex').toUpperCase(),
15104
+ heartbeatHookHash: stateDataBuf.slice(CANDIDATE_HEARTBEAT_HOOK_HASH_OFFSET, CANDIDATE_HEARTBEAT_HOOK_HASH_OFFSET + 32).toString('hex').toUpperCase(),
15105
+ }
15106
+ return data;
15107
+ }
15108
+
15109
+ static decodeCandidateIdState(stateDataBuf) {
15110
+ let status = '';
15111
+ switch (stateDataBuf.readUInt8(CANDIDATE_STATUS_OFFSET)) {
15112
+ case EvernodeConstants.CandidateStatuses.CANDIDATE_SUPPORTED:
15113
+ status = 'supported';
15114
+ break;
15115
+ case EvernodeConstants.CandidateStatuses.CANDIDATE_ELECTED:
15116
+ status = 'elected';
15117
+ break;
15118
+ case EvernodeConstants.CandidateStatuses.CANDIDATE_VETOED:
15119
+ status = 'vetoed';
15120
+ break;
15121
+ case EvernodeConstants.CandidateStatuses.CANDIDATE_EXPIRED:
15122
+ status = 'expired';
15123
+ break;
15124
+ default:
15125
+ status = 'rejected';
15126
+ break;
15127
+ }
15128
+
15129
+ return {
15130
+ ownerAddress: codec.encodeAccountID(stateDataBuf.slice(CANDIDATE_OWNER_ADDRESS_OFFSET, CANDIDATE_IDX_OFFSET)),
15131
+ index: stateDataBuf.readUInt32BE(CANDIDATE_IDX_OFFSET),
15132
+ shortName: stateDataBuf.slice(CANDIDATE_SHORT_NAME_OFFSET, CANDIDATE_CREATED_TIMESTAMP_OFFSET).toString().replace(/\x00+$/, ''), // Remove trailing \x00 characters.
15133
+ createdTimestamp: Number(stateDataBuf.readBigUInt64BE(CANDIDATE_CREATED_TIMESTAMP_OFFSET)),
15134
+ proposalFee: XflHelpers.toString(stateDataBuf.readBigInt64BE(CANDIDATE_PROPOSAL_FEE_OFFSET)),
15135
+ positiveVoteCount: stateDataBuf.readUInt32BE(CANDIDATE_POSITIVE_VOTE_COUNT_OFFSET),
15136
+ lastVoteTimestamp: Number(stateDataBuf.readBigUInt64BE(CANDIDATE_LAST_VOTE_TIMESTAMP_OFFSET)),
15137
+ status: status,
15138
+ statusChangeTimestamp: Number(stateDataBuf.readBigUInt64BE(CANDIDATE_STATUS_CHANGE_TIMESTAMP_OFFSET)),
15139
+ foundationVoteStatus: stateDataBuf.readUInt8(CANDIDATE_FOUNDATION_VOTE_STATUS_OFFSET) === EvernodeConstants.CandidateStatuses.CANDIDATE_SUPPORTED ? 'supported' : 'rejected'
15140
+ }
15141
+ }
15142
+
14364
15143
  static decodeStateData(stateKey, stateData) {
14365
15144
  const hexKey = stateKey.toString('hex').toUpperCase();
14366
15145
  if (Buffer.from(HookStateKeys.PREFIX_HOST_ADDR, 'hex').compare(stateKey, 0, 4) === 0) {
@@ -14389,6 +15168,29 @@ class StateHelpers {
14389
15168
  ...this.decodeTransfereeAddrState(stateKey, stateData)
14390
15169
  }
14391
15170
  }
15171
+ else if (Buffer.from(HookStateKeys.PREFIX_CANDIDATE_OWNER, 'hex').compare(stateKey, 0, 4) === 0) {
15172
+ const decoded = this.decodeCandidateOwnerState(stateKey, stateData);
15173
+
15174
+ // Generate the address state key.
15175
+ const idBuf = Buffer.alloc(32, 0);
15176
+ Buffer.from(HookStateKeys.PREFIX_CANDIDATE_ID, 'hex').copy(idBuf);
15177
+ Buffer.from(decoded.uniqueId, 'hex').copy(idBuf, 4, 4, 32)
15178
+
15179
+ return {
15180
+ type: this.StateTypes.CANDIDATE_OWNER,
15181
+ key: hexKey,
15182
+ idKey: idBuf.toString('hex').toUpperCase(),
15183
+ ...decoded
15184
+ }
15185
+ }
15186
+ else if (Buffer.from(HookStateKeys.PREFIX_CANDIDATE_ID, 'hex').compare(stateKey, 0, 4) === 0) {
15187
+ // Generate the owner state key.
15188
+ return {
15189
+ type: this.StateTypes.CANDIDATE_ID,
15190
+ key: hexKey,
15191
+ ...this.decodeCandidateIdState(stateData)
15192
+ }
15193
+ }
14392
15194
  else if (Buffer.from(HookStateKeys.HOST_COUNT, 'hex').compare(stateKey) === 0) {
14393
15195
  return {
14394
15196
  type: this.StateTypes.SIGLETON,
@@ -14414,7 +15216,10 @@ class StateHelpers {
14414
15216
  value: Number(stateData.readBigUInt64BE())
14415
15217
  }
14416
15218
  }
14417
- else if (Buffer.from(HookStateKeys.EVR_ISSUER_ADDR, 'hex').compare(stateKey) === 0 || Buffer.from(HookStateKeys.FOUNDATION_ADDR, 'hex').compare(stateKey) === 0) {
15219
+ else if (Buffer.from(HookStateKeys.REGISTRY_ADDR, 'hex').compare(stateKey) === 0 ||
15220
+ Buffer.from(HookStateKeys.HEARTBEAT_ADDR, 'hex').compare(stateKey) === 0 ||
15221
+ Buffer.from(HookStateKeys.EVR_ISSUER_ADDR, 'hex').compare(stateKey) === 0 ||
15222
+ Buffer.from(HookStateKeys.FOUNDATION_ADDR, 'hex').compare(stateKey) === 0) {
14418
15223
  return {
14419
15224
  type: this.StateTypes.CONFIGURATION,
14420
15225
  key: hexKey,
@@ -14437,15 +15242,6 @@ class StateHelpers {
14437
15242
  value: Number(stateData.readBigUInt64BE())
14438
15243
  }
14439
15244
  }
14440
- else if (Buffer.from(HookStateKeys.PURCHASER_TARGET_PRICE, 'hex').compare(stateKey) === 0) {
14441
- const xfl = stateData.readBigInt64BE(0);
14442
- const val = XflHelpers.toString(xfl);
14443
- return {
14444
- type: this.StateTypes.CONFIGURATION,
14445
- key: hexKey,
14446
- value: val
14447
- }
14448
- }
14449
15245
  else if (Buffer.from(HookStateKeys.REWARD_CONFIGURATION, 'hex').compare(stateKey) === 0) {
14450
15246
  return {
14451
15247
  type: this.StateTypes.CONFIGURATION,
@@ -14497,6 +15293,51 @@ class StateHelpers {
14497
15293
  value: Number(stateData.readBigUInt64BE())
14498
15294
  }
14499
15295
  }
15296
+ else if (Buffer.from(HookStateKeys.GOVERNANCE_CONFIGURATION, 'hex').compare(stateKey) === 0) {
15297
+ return {
15298
+ type: this.StateTypes.CONFIGURATION,
15299
+ key: hexKey,
15300
+ value: {
15301
+ eligibilityPeriod: stateData.readUInt32BE(ELIGIBILITY_PERIOD_OFFSET),
15302
+ candidateLifePeriod: stateData.readUInt32BE(CANDIDATE_LIFE_PERIOD_OFFSET),
15303
+ candidateElectionPeriod: stateData.readUInt32BE(CANDIDATE_ELECTION_PERIOD_OFFSET),
15304
+ candidateSupportAverage: stateData.readUInt16BE(CANDIDATE_SUPPORT_AVERAGE_OFFSET)
15305
+ }
15306
+ }
15307
+ }
15308
+ else if (Buffer.from(HookStateKeys.GOVERNANCE_INFO, 'hex').compare(stateKey) === 0) {
15309
+ let mode = '';
15310
+ switch (stateData.readUInt8(GOVERNANCE_MODE_OFFSET)) {
15311
+ case EvernodeConstants.GovernanceModes.Piloted:
15312
+ mode = 'piloted';
15313
+ break;
15314
+ case EvernodeConstants.GovernanceModes.CoPiloted:
15315
+ mode = 'co-piloted';
15316
+ break;
15317
+ case EvernodeConstants.GovernanceModes.AutoPiloted:
15318
+ mode = 'auto-piloted';
15319
+ break;
15320
+ default:
15321
+ mode = 'undefined';
15322
+ break;
15323
+ }
15324
+ return {
15325
+ type: this.StateTypes.CONFIGURATION,
15326
+ key: hexKey,
15327
+ value: {
15328
+ governanceMode: mode,
15329
+ lastCandidateIdx: stateData.readUInt32BE(LAST_CANDIDATE_IDX_OFFSET),
15330
+ voteBaseCount: stateData.readUInt32BE(VOTER_BASE_COUNT_OFFSET),
15331
+ voteBaseCountChangedTimestamp: Number(stateData.readBigUInt64BE(VOTER_BASE_COUNT_CHANGED_TIMESTAMP_OFFSET)),
15332
+ foundationLastVotedCandidateIdx: stateData.readUInt32BE(FOUNDATION_LAST_VOTED_CANDIDATE_IDX),
15333
+ foundationLastVotedTimestamp: Number(stateData.readBigUInt64BE(FOUNDATION_LAST_VOTED_TIMESTAMP_OFFSET)),
15334
+ electedProposalUniqueId: stateData.readUInt32BE(ELECTED_PROPOSAL_UNIQUE_ID_OFFSET),
15335
+ proposalElectedTimestamp: Number(stateData.readBigUInt64BE(PROPOSAL_ELECTED_TIMESTAMP_OFFSET)),
15336
+ updatedHookCount: stateData.readUInt8(UPDATED_HOOK_COUNT_OFFSET),
15337
+ supportVoteSent: stateData.readUInt8(FOUNDATION_SUPPORT_VOTE_FLAG_OFFSET)
15338
+ }
15339
+ }
15340
+ }
14500
15341
  else
14501
15342
  throw { type: 'Validation Error', message: 'Invalid state key.' };
14502
15343
  }
@@ -14521,6 +15362,18 @@ class StateHelpers {
14521
15362
  type: this.StateTypes.TRANSFEREE_ADDR
14522
15363
  };
14523
15364
  }
15365
+ else if (Buffer.from(HookStateKeys.PREFIX_CANDIDATE_ID, 'hex').compare(stateKey, 0, 4) === 0) {
15366
+ return {
15367
+ key: hexKey,
15368
+ type: this.StateTypes.CANDIDATE_ID
15369
+ };
15370
+ }
15371
+ else if (Buffer.from(HookStateKeys.PREFIX_CANDIDATE_OWNER, 'hex').compare(stateKey, 0, 4) === 0) {
15372
+ return {
15373
+ key: hexKey,
15374
+ type: this.StateTypes.CANDIDATE_OWNER
15375
+ };
15376
+ }
14524
15377
  else if (Buffer.from(HookStateKeys.HOST_COUNT, 'hex').compare(stateKey) === 0 ||
14525
15378
  Buffer.from(HookStateKeys.MOMENT_BASE_INFO, 'hex').compare(stateKey) === 0 ||
14526
15379
  Buffer.from(HookStateKeys.HOST_REG_FEE, 'hex').compare(stateKey) === 0 ||
@@ -14528,13 +15381,12 @@ class StateHelpers {
14528
15381
  Buffer.from(HookStateKeys.REWARD_INFO, 'hex').compare(stateKey) === 0) {
14529
15382
  return {
14530
15383
  key: hexKey,
14531
- type: this.STATE_TYPES.SIGLETON
15384
+ type: this.StateTypes.SIGLETON
14532
15385
  };
14533
15386
  }
14534
15387
  else if (Buffer.from(HookStateKeys.EVR_ISSUER_ADDR, 'hex').compare(stateKey) === 0 ||
14535
15388
  Buffer.from(HookStateKeys.FOUNDATION_ADDR, 'hex').compare(stateKey) === 0 ||
14536
15389
  Buffer.from(HookStateKeys.MOMENT_SIZE, 'hex').compare(stateKey) === 0 ||
14537
- Buffer.from(HookStateKeys.PURCHASER_TARGET_PRICE, 'hex').compare(stateKey) === 0 ||
14538
15390
  Buffer.from(HookStateKeys.HOST_HEARTBEAT_FREQ, 'hex').compare(stateKey) ||
14539
15391
  Buffer.from(HookStateKeys.MINT_LIMIT, 'hex').compare(stateKey) === 0 ||
14540
15392
  Buffer.from(HookStateKeys.FIXED_REG_FEE, 'hex').compare(stateKey) === 0 ||
@@ -14542,23 +15394,27 @@ class StateHelpers {
14542
15394
  Buffer.from(HookStateKeys.REWARD_CONFIGURATION, 'hex').compare(stateKey) === 0 ||
14543
15395
  Buffer.from(HookStateKeys.MAX_TOLERABLE_DOWNTIME, 'hex').compare(stateKey) === 0 ||
14544
15396
  Buffer.from(HookStateKeys.MOMENT_TRANSIT_INFO, 'hex').compare(stateKey) === 0 ||
14545
- Buffer.from(HookStateKeys.MAX_TRX_EMISSION_FEE, 'hex').compare(stateKey) === 0) {
15397
+ Buffer.from(HookStateKeys.MAX_TRX_EMISSION_FEE, 'hex').compare(stateKey) === 0 ||
15398
+ Buffer.from(HookStateKeys.REGISTRY_ADDR, 'hex').compare(stateKey) === 0 ||
15399
+ Buffer.from(HookStateKeys.HEARTBEAT_ADDR, 'hex').compare(stateKey) === 0 ||
15400
+ Buffer.from(HookStateKeys.GOVERNANCE_CONFIGURATION, 'hex').compare(stateKey) === 0 ||
15401
+ Buffer.from(HookStateKeys.GOVERNANCE_INFO, 'hex').compare(stateKey) === 0) {
14546
15402
  return {
14547
15403
  key: hexKey,
14548
- type: this.STATE_TYPES.CONFIGURATION
15404
+ type: this.StateTypes.CONFIGURATION
14549
15405
  };
14550
15406
  }
14551
15407
  else
14552
15408
  throw { type: 'Validation Error', message: 'Invalid state key.' };
14553
15409
  }
14554
15410
 
14555
- static generateTokenIdStateKey(nfTokenId) {
15411
+ static generateTokenIdStateKey(uriToken) {
14556
15412
  // 1 byte - Key Type.
14557
15413
  let buf = Buffer.allocUnsafe(1);
14558
15414
  buf.writeUInt8(STATE_KEY_TYPES.TOKEN_ID);
14559
15415
 
14560
- const nfTokenIdBuf = Buffer.from(nfTokenId, "hex");
14561
- const stateKeyBuf = (Buffer.concat([Buffer.from(EVERNODE_PREFIX, "utf-8"), buf, nfTokenIdBuf.slice(4, 32)]));
15416
+ const uriTokenBuf = Buffer.from(uriToken, "hex");
15417
+ const stateKeyBuf = (Buffer.concat([Buffer.from(EVERNODE_PREFIX, "utf-8"), buf, uriTokenBuf.slice(4, 32)]));
14562
15418
  return stateKeyBuf.toString('hex').toUpperCase();
14563
15419
  }
14564
15420
 
@@ -14590,6 +15446,30 @@ class StateHelpers {
14590
15446
  return stateKeyBuf.toString('hex').toUpperCase();
14591
15447
  }
14592
15448
 
15449
+ static generateCandidateIdStateKey(uniqueId) {
15450
+ // 1 byte - Key Type.
15451
+ let buf = Buffer.allocUnsafe(1);
15452
+ buf.writeUInt8(STATE_KEY_TYPES.CANDIDATE_ID);
15453
+
15454
+ const idBuf = Buffer.from(uniqueId, "hex");
15455
+ const stateKeyBuf = (Buffer.concat([Buffer.from(EVERNODE_PREFIX, "utf-8"), buf, idBuf.slice(4, 32)]));
15456
+ return stateKeyBuf.toString('hex').toUpperCase();
15457
+ }
15458
+
15459
+ static generateCandidateOwnerStateKey(owner) {
15460
+ // 1 byte - Key Type.
15461
+ // 8 bytes - Zeros.
15462
+ let buf = Buffer.allocUnsafe(9);
15463
+ buf.writeUInt8(STATE_KEY_TYPES.CANDIDATE_OWNER);
15464
+ for (let i = 0; i < CANDIDATE_OWNER_KEY_ZERO_COUNT; i++) {
15465
+ buf.writeUInt8(0, i + 1);
15466
+ }
15467
+
15468
+ const addrBuf = Buffer.from(codec.decodeAccountID(owner), "hex");
15469
+ const stateKeyBuf = Buffer.concat([Buffer.from(EVERNODE_PREFIX, "utf-8"), buf, addrBuf]);
15470
+ return stateKeyBuf.toString('hex').toUpperCase();
15471
+ }
15472
+
14593
15473
  static getHookStateIndex(hookAccount, stateKey, hookNamespace = EvernodeConstants.HOOK_NAMESPACE) {
14594
15474
  const typeBuf = Buffer.allocUnsafe(2);
14595
15475
  typeBuf.writeInt16BE(HOOK_STATE_LEDGER_TYPE_PREFIX);
@@ -14609,6 +15489,31 @@ class StateHelpers {
14609
15489
  // Get the first 32 bytes of hash.
14610
15490
  return digest.substring(0, 64).toUpperCase();
14611
15491
  }
15492
+
15493
+ static getNewHookCandidateId(hashesBuf) {
15494
+ const idBuf = Buffer.alloc(32, 0);
15495
+ idBuf.writeUInt8(EvernodeConstants.CandidateTypes.NewHook, 4);
15496
+ Buffer.from(sha512Half(hashesBuf)).copy(idBuf, 5, 5);
15497
+ return idBuf.toString('hex').toUpperCase();
15498
+ }
15499
+
15500
+ static getPilotedModeCandidateId() {
15501
+ const idBuf = Buffer.alloc(32, 0);
15502
+ idBuf.writeUInt8(EvernodeConstants.CandidateTypes.PilotedMode, 4);
15503
+ Buffer.from(EvernodeConstants.HOOK_NAMESPACE, 'hex').copy(idBuf, 5, 5);
15504
+ return idBuf.toString('hex').toUpperCase();
15505
+ }
15506
+
15507
+ static getDudHostCandidateId(hostAddress) {
15508
+ const idBuf = Buffer.alloc(32, 0);
15509
+ idBuf.writeUInt8(EvernodeConstants.CandidateTypes.DudHost, 4);
15510
+ codec.decodeAccountID(hostAddress).copy(idBuf, 12);
15511
+ return idBuf.toString('hex').toUpperCase();
15512
+ }
15513
+
15514
+ static getCandidateType(candidateId) {
15515
+ return Buffer.from(candidateId, 'hex').readUInt8(4);
15516
+ }
14612
15517
  }
14613
15518
 
14614
15519
  module.exports = {
@@ -14691,6 +15596,7 @@ module.exports = {
14691
15596
  const { Buffer } = __nccwpck_require__(4300);
14692
15597
  const { XflHelpers } = __nccwpck_require__(3243);
14693
15598
  const { EvernodeConstants, ErrorReasons } = __nccwpck_require__(9849);
15599
+ const { TransactionHelper } = __nccwpck_require__(7071);
14694
15600
 
14695
15601
  // Utility helper functions.
14696
15602
  class UtilHelpers {
@@ -14714,7 +15620,7 @@ class UtilHelpers {
14714
15620
  static decodeLeaseNftUri(hexUri) {
14715
15621
  // Get the lease index from the nft URI.
14716
15622
  // <prefix><lease index (uint16)><half of tos hash (16 bytes)><lease amount (uint32)>
14717
- const prefixLen = EvernodeConstants.LEASE_NFT_PREFIX_HEX.length / 2;
15623
+ const prefixLen = EvernodeConstants.LEASE_TOKEN_PREFIX_HEX.length / 2;
14718
15624
  const halfToSLen = 16;
14719
15625
  const uriBuf = Buffer.from(hexUri, 'hex');
14720
15626
  return {
@@ -14724,6 +15630,21 @@ class UtilHelpers {
14724
15630
  }
14725
15631
  }
14726
15632
 
15633
+ static decodeLeaseTokenUri(hexUri) {
15634
+ // Get the lease index from the token's URI.
15635
+ // <prefix><lease index (uint16)><half of tos hash (16 bytes)><lease amount (uint32)>
15636
+
15637
+ const asciiUri = TransactionHelper.hexToASCII(hexUri);
15638
+ const uriBuf = Buffer.from(asciiUri, 'base64');
15639
+ const prefixLen = EvernodeConstants.LEASE_TOKEN_PREFIX_HEX.length / 2;
15640
+ const halfToSLen = 16;
15641
+ return {
15642
+ leaseIndex: uriBuf.readUint16BE(prefixLen),
15643
+ halfTos: uriBuf.slice(prefixLen + 2, halfToSLen),
15644
+ leaseAmount: parseFloat(XflHelpers.toString(uriBuf.readBigInt64BE(prefixLen + 2 + halfToSLen)))
15645
+ }
15646
+ }
15647
+
14727
15648
  static getCurrentUnixTime(format = "sec") {
14728
15649
  const time = Date.now();
14729
15650
  switch (format) {
@@ -15339,7 +16260,6 @@ class XrplAccount {
15339
16260
  // details: submission and transaction details, (if signing success)
15340
16261
  // error: Any error that prevents submission.
15341
16262
  // }
15342
-
15343
16263
  return new Promise(async (resolve, reject) => {
15344
16264
 
15345
16265
  // Attach tx options to the transaction.
@@ -15347,7 +16267,8 @@ class XrplAccount {
15347
16267
  LastLedgerSequence: options.maxLedgerIndex || (this.xrplApi.ledgerIndex + XrplConstants.MAX_LEDGER_OFFSET),
15348
16268
  Sequence: options.sequence || await this.getSequence(),
15349
16269
  SigningPubKey: '', // This field is required for fee calculation.
15350
- Fee: '0' // This field is required for fee calculation.
16270
+ Fee: '0', // This field is required for fee calculation.
16271
+ NetworkID: DefaultValues.networkID
15351
16272
  }
15352
16273
  Object.assign(tx, txOptions);
15353
16274
  const txnBlob = xrplCodec.encode(tx);
@@ -15365,10 +16286,17 @@ class XrplAccount {
15365
16286
  };
15366
16287
 
15367
16288
  console.log("Transaction result: " + txResult.code);
16289
+ const hookExecRes = txResult.details?.meta?.HookExecutions?.map(o => {
16290
+ return {
16291
+ result: o.HookExecution?.HookResult,
16292
+ returnCode: o.HookExecution?.HookReturnCode,
16293
+ message: TransactionHelper.hexToASCII(o.HookExecution?.HookReturnString).replace(/\x00+$/, '')
16294
+ }
16295
+ });
15368
16296
  if (txResult.code === "tesSUCCESS")
15369
- resolve(txResult);
16297
+ resolve({ ...txResult, ...(hookExecRes ? { hookExecutionResult: hookExecRes } : {}) });
15370
16298
  else
15371
- reject(txResult);
16299
+ reject({ ...txResult, ...(hookExecRes ? { hookExecutionResult: hookExecRes } : {}) });
15372
16300
  }
15373
16301
  catch (err) {
15374
16302
  console.log("Error submitting transaction:", err);
@@ -15403,10 +16331,17 @@ class XrplAccount {
15403
16331
  };
15404
16332
 
15405
16333
  console.log("Transaction result: " + txResult.code);
16334
+ const hookExecRes = txResult.details?.meta?.HookExecutions?.map(o => {
16335
+ return {
16336
+ result: o.HookExecution?.HookResult,
16337
+ returnCode: o.HookExecution?.HookReturnCode,
16338
+ message: TransactionHelper.hexToASCII(o.HookExecution?.HookReturnString).replace(/\x00+$/, '')
16339
+ }
16340
+ });
15406
16341
  if (txResult.code === "tesSUCCESS")
15407
- resolve(txResult);
16342
+ resolve({ ...txResult, ...(hookExecRes ? { hookExecutionResult: hookExecRes } : {}) });
15408
16343
  else
15409
- reject(txResult);
16344
+ reject({ ...txResult, ...(hookExecRes ? { hookExecutionResult: hookExecRes } : {}) });
15410
16345
  }
15411
16346
  catch (err) {
15412
16347
  console.log("Error submitting transaction:", err);
@@ -15425,6 +16360,83 @@ class XrplAccount {
15425
16360
  sign(tx, isMultiSign = false) {
15426
16361
  return this.wallet.sign(tx, isMultiSign);
15427
16362
  }
16363
+
16364
+ // URIToken related methods
16365
+
16366
+ mintURIToken(uri, digest = null, flags = {}, options = {}) {
16367
+ const tx = {
16368
+ Account: this.address,
16369
+ TransactionType: "URITokenMint",
16370
+ URI: flags.isHexUri ? uri : TransactionHelper.asciiToHex(uri).toUpperCase(),
16371
+ Flags: flags.isBurnable ? 1 : 0
16372
+ }
16373
+
16374
+ if (digest)
16375
+ tx.Digest = digest;
16376
+
16377
+ return this.#submitAndVerifyTransaction(tx, options);
16378
+ }
16379
+
16380
+ burnURIToken(uriTokenID, options = {}) {
16381
+ const tx = {
16382
+ Account: this.address,
16383
+ TransactionType: "URITokenBurn",
16384
+ URITokenID: uriTokenID
16385
+ }
16386
+ return this.#submitAndVerifyTransaction(tx, options);
16387
+ }
16388
+
16389
+ sellURIToken(uriTokenID, amount, currency, issuer = null, toAddr = null, memos = null, options = {}) {
16390
+ const amountObj = makeAmountObject(amount, currency, issuer);
16391
+
16392
+ const tx = {
16393
+ Account: this.address,
16394
+ TransactionType: "URITokenCreateSellOffer",
16395
+ Amount: amountObj,
16396
+ URITokenID: uriTokenID
16397
+ };
16398
+
16399
+ if (toAddr)
16400
+ tx.Destination = toAddr;
16401
+
16402
+ if (memos)
16403
+ tx.Memos = TransactionHelper.formatMemos(memos);
16404
+
16405
+ return this.#submitAndVerifyTransaction(tx, options);
16406
+ }
16407
+
16408
+ buyURIToken(uriToken, memos = null, options = {}) {
16409
+ const tx = {
16410
+ Account: this.address,
16411
+ TransactionType: "URITokenBuy",
16412
+ Amount: uriToken.Amount,
16413
+ URITokenID: uriToken.index
16414
+ }
16415
+
16416
+ if (memos)
16417
+ tx.Memos = TransactionHelper.formatMemos(memos);
16418
+
16419
+ return this.#submitAndVerifyTransaction(tx, options);
16420
+ }
16421
+
16422
+ async clearURITokenOffer(uriTokenID, options = {}) {
16423
+ return this.#submitAndVerifyTransaction({
16424
+ Account: this.address,
16425
+ TransactionType: "URITokenCancelSellOffer",
16426
+ URITokenID: uriTokenID
16427
+ }, options);
16428
+ }
16429
+
16430
+ async getURITokens(options) {
16431
+ const obj = await this.getAccountObjects(options);
16432
+ return obj.filter(t => t.LedgerEntryType == 'URIToken');
16433
+ }
16434
+
16435
+ async getURITokenByUri(uri, isHexUri = false) {
16436
+ const tokens = await this.getURITokens();
16437
+ const hexUri = isHexUri ? uri : TransactionHelper.asciiToHex(uri).toUpperCase();
16438
+ return tokens.find(t => t.URI == hexUri);
16439
+ }
15428
16440
  }
15429
16441
 
15430
16442
  function makeAmountObject(amount, currency, issuer) {
@@ -15445,6 +16457,7 @@ module.exports = {
15445
16457
  XrplAccount
15446
16458
  }
15447
16459
 
16460
+
15448
16461
  /***/ }),
15449
16462
 
15450
16463
  /***/ 1850:
@@ -15456,6 +16469,7 @@ const { EventEmitter } = __nccwpck_require__(6170);
15456
16469
  const { DefaultValues } = __nccwpck_require__(8262);
15457
16470
  const { TransactionHelper } = __nccwpck_require__(7071);
15458
16471
  const { XrplApiEvents } = __nccwpck_require__(3307);
16472
+ const { XrplAccount } = __nccwpck_require__(9329);
15459
16473
 
15460
16474
  const MAX_PAGE_LIMIT = 400;
15461
16475
  const API_REQ_TYPE = {
@@ -15511,19 +16525,20 @@ class XrplApi {
15511
16525
  this.#client.on("transaction", async (data) => {
15512
16526
  if (data.validated) {
15513
16527
  // NFTokenAcceptOffer transactions does not contain a Destination. So we check whether the accepted offer is created by which subscribed account
15514
- if (data.transaction.TransactionType === 'NFTokenAcceptOffer') {
16528
+ if (data.transaction.TransactionType === 'URITokenBuy') {
15515
16529
  // We take all the offers created by subscribed accounts in previous ledger until we get the respective offer.
15516
16530
  for (const subscription of this.#addressSubscriptions) {
15517
- const offer = (await this.getNftOffers(subscription.address, { ledger_index: data.ledger_index - 1 }))?.find(o => o.index === (data.transaction.NFTokenSellOffer || data.transaction.NFTokenBuyOffer));
16531
+ const acc = new XrplAccount(subscription.address, null);
16532
+ // Here we access the offers that were there in this account based on the given ledger index.
16533
+ const offers = await acc.getURITokens({ ledger_index: data.ledger_index - 1 });
16534
+ // Filter out the matching URI token offer for the scenario.
16535
+ const offer = offers.find(o => o.index === data.transaction.URITokenID && o.Amount);
15518
16536
  // When we find the respective offer. We populate the destination and offer info and then we break the loop.
15519
16537
  if (offer) {
15520
16538
  // We populate some sell offer properties to the transaction to be sent with the event.
15521
16539
  data.transaction.Destination = subscription.address;
15522
16540
  // Replace the offer with the found offer object.
15523
- if (data.transaction.NFTokenSellOffer)
15524
- data.transaction.NFTokenSellOffer = offer;
15525
- else if (data.transaction.NFTokenBuyOffer)
15526
- data.transaction.NFTokenBuyOffer = offer;
16541
+ data.transaction.URITokenSellOffer = offer;
15527
16542
  break;
15528
16543
  }
15529
16544
  }
@@ -15670,6 +16685,11 @@ class XrplApi {
15670
16685
  return resp?.result?.account_data;
15671
16686
  }
15672
16687
 
16688
+ async getServerDefinition() {
16689
+ const resp = (await this.#client.request({ command: 'server_definitions' }));
16690
+ return resp?.result;
16691
+ }
16692
+
15673
16693
  async getAccountObjects(address, options) {
15674
16694
  return this.#requestWithPaging({ command: 'account_objects', account: address, ...options }, API_REQ_TYPE.ACCOUNT_OBJECTS);
15675
16695
  }
@@ -15747,6 +16767,10 @@ class XrplApi {
15747
16767
  await this.#client.request({ command: 'subscribe', streams: [streamName] });
15748
16768
  }
15749
16769
 
16770
+ async submitMultisigned(tx) {
16771
+ return await this.#client.request({ command: 'submit_multisigned', tx_json: tx });
16772
+ }
16773
+
15750
16774
  /**
15751
16775
  * Join the given the array of signed transactions into one multi-signed transaction.
15752
16776
  * For more details: https://js.xrpl.org/functions/multisign.html
@@ -15755,10 +16779,10 @@ class XrplApi {
15755
16779
  * @returns A single signed Transaction string which has all Signers from transactions within it.
15756
16780
  */
15757
16781
  multiSign(transactions) {
15758
- if(transactions.length > 0){
16782
+ if (transactions.length > 0) {
15759
16783
  return xrpl.multisign(transactions);
15760
16784
  } else
15761
- throw("Transaction list is empty for multi-signing.");
16785
+ throw ("Transaction list is empty for multi-signing.");
15762
16786
  }
15763
16787
  }
15764
16788
 
@@ -15775,7 +16799,9 @@ const XrplApiEvents = {
15775
16799
  LEDGER: 'ledger',
15776
16800
  PAYMENT: 'payment',
15777
16801
  NFT_OFFER_CREATE: 'nftokencreateoffer',
15778
- NFT_OFFER_ACCEPT: 'nftokenacceptoffer'
16802
+ NFT_OFFER_ACCEPT: 'nftokenacceptoffer',
16803
+ URI_TOKEN_CREATE_SELL_OFFER: 'uritokencreateselloffer', // For Transfers
16804
+ URI_TOKEN_BUY: 'uritokenbuy' // For Acquires
15779
16805
  }
15780
16806
 
15781
16807
  const XrplConstants = {
@@ -15875,7 +16901,7 @@ module.exports = require("xrpl");
15875
16901
  /***/ ((module) => {
15876
16902
 
15877
16903
  "use strict";
15878
- module.exports = JSON.parse('{"TYPES":{"Done":-1,"Unknown":-2,"NotPresent":0,"UInt16":1,"UInt32":2,"UInt64":3,"Hash128":4,"Hash256":5,"Amount":6,"Blob":7,"AccountID":8,"STObject":14,"STArray":15,"UInt8":16,"Hash160":17,"PathSet":18,"Vector256":19,"UInt96":20,"UInt192":21,"UInt384":22,"UInt512":23,"Transaction":10001,"LedgerEntry":10002,"Validation":10003,"Metadata":10004},"LEDGER_ENTRY_TYPES":{"Invalid":-1,"AccountRoot":97,"DirectoryNode":100,"RippleState":114,"Ticket":84,"SignerList":83,"Offer":111,"LedgerHashes":104,"Amendments":102,"FeeSettings":115,"Escrow":117,"PayChannel":120,"Check":67,"DepositPreauth":112,"NegativeUnl":78,"Any":0,"Child":7378,"Nickname":110,"Contract":99,"GeneratorMap":103},"FIELDS":[["Generic",{"nth":0,"isVLEncoded":false,"isSerialized":false,"isSigningField":false,"type":"Unknown"}],["Invalid",{"nth":-1,"isVLEncoded":false,"isSerialized":false,"isSigningField":false,"type":"Unknown"}],["ObjectEndMarker",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["ArrayEndMarker",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["hash",{"nth":257,"isVLEncoded":false,"isSerialized":false,"isSigningField":false,"type":"Hash256"}],["index",{"nth":258,"isVLEncoded":false,"isSerialized":false,"isSigningField":false,"type":"Hash256"}],["taker_gets_funded",{"nth":258,"isVLEncoded":false,"isSerialized":false,"isSigningField":false,"type":"Amount"}],["taker_pays_funded",{"nth":259,"isVLEncoded":false,"isSerialized":false,"isSigningField":false,"type":"Amount"}],["LedgerEntry",{"nth":257,"isVLEncoded":false,"isSerialized":false,"isSigningField":true,"type":"LedgerEntry"}],["Transaction",{"nth":257,"isVLEncoded":false,"isSerialized":false,"isSigningField":true,"type":"Transaction"}],["Validation",{"nth":257,"isVLEncoded":false,"isSerialized":false,"isSigningField":true,"type":"Validation"}],["Metadata",{"nth":257,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Metadata"}],["CloseResolution",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt8"}],["Method",{"nth":2,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt8"}],["TransactionResult",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt8"}],["TickSize",{"nth":16,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt8"}],["UNLModifyDisabling",{"nth":17,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt8"}],["HookResult",{"nth":18,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt8"}],["LedgerEntryType",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["TransactionType",{"nth":2,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["SignerWeight",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["TransferFee",{"nth":4,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["Version",{"nth":16,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["HookStateChangeCount",{"nth":17,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["HookEmitCount",{"nth":18,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["HookExecutionIndex",{"nth":19,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["HookApiVersion",{"nth":20,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt16"}],["Flags",{"nth":2,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["SourceTag",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["Sequence",{"nth":4,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["PreviousTxnLgrSeq",{"nth":5,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["LedgerSequence",{"nth":6,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["CloseTime",{"nth":7,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["ParentCloseTime",{"nth":8,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["SigningTime",{"nth":9,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["Expiration",{"nth":10,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["TransferRate",{"nth":11,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["WalletSize",{"nth":12,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["OwnerCount",{"nth":13,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["DestinationTag",{"nth":14,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["HighQualityIn",{"nth":16,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["HighQualityOut",{"nth":17,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["LowQualityIn",{"nth":18,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["LowQualityOut",{"nth":19,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["QualityIn",{"nth":20,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["QualityOut",{"nth":21,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["StampEscrow",{"nth":22,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["BondAmount",{"nth":23,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["LoadFee",{"nth":24,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["OfferSequence",{"nth":25,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["FirstLedgerSequence",{"nth":26,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["LastLedgerSequence",{"nth":27,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["TransactionIndex",{"nth":28,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["OperationLimit",{"nth":29,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["ReferenceFeeUnits",{"nth":30,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["ReserveBase",{"nth":31,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["ReserveIncrement",{"nth":32,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["SetFlag",{"nth":33,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["ClearFlag",{"nth":34,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["SignerQuorum",{"nth":35,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["CancelAfter",{"nth":36,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["FinishAfter",{"nth":37,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["SignerListID",{"nth":38,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["SettleDelay",{"nth":39,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["TicketCount",{"nth":40,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["TicketSequence",{"nth":41,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["NFTokenTaxon",{"nth":42,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["MintedNFTokens",{"nth":43,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["BurnedNFTokens",{"nth":44,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["HookStateCount",{"nth":45,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["EmitGeneration",{"nth":46,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt32"}],["IndexNext",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["IndexPrevious",{"nth":2,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["BookNode",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["OwnerNode",{"nth":4,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["BaseFee",{"nth":5,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["ExchangeRate",{"nth":6,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["LowNode",{"nth":7,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["HighNode",{"nth":8,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["DestinationNode",{"nth":9,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["Cookie",{"nth":10,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["ServerVersion",{"nth":11,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["NFTokenOfferNode",{"nth":12,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["EmitBurden",{"nth":13,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["HookOn",{"nth":16,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["HookInstructionCount",{"nth":17,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["HookReturnCode",{"nth":18,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["ReferenceCount",{"nth":19,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"UInt64"}],["EmailHash",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash128"}],["TakerPaysCurrency",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash160"}],["TakerPaysIssuer",{"nth":2,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash160"}],["TakerGetsCurrency",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash160"}],["TakerGetsIssuer",{"nth":4,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash160"}],["LedgerHash",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["ParentHash",{"nth":2,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["TransactionHash",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["AccountHash",{"nth":4,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["PreviousTxnID",{"nth":5,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["LedgerIndex",{"nth":6,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["WalletLocator",{"nth":7,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["RootIndex",{"nth":8,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["AccountTxnID",{"nth":9,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["NFTokenID",{"nth":10,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["EmitParentTxnID",{"nth":11,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["EmitNonce",{"nth":12,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["EmitHookHash",{"nth":13,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["BookDirectory",{"nth":16,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["InvoiceID",{"nth":17,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["Nickname",{"nth":18,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["Amendment",{"nth":19,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["Digest",{"nth":21,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["Channel",{"nth":22,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["ConsensusHash",{"nth":23,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["CheckID",{"nth":24,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["ValidatedHash",{"nth":25,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["PreviousPageMin",{"nth":26,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["NextPageMin",{"nth":27,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["NFTokenBuyOffer",{"nth":28,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["NFTokenSellOffer",{"nth":29,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["HookStateKey",{"nth":30,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["HookHash",{"nth":31,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["HookNamespace",{"nth":32,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["HookSetTxnID",{"nth":33,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Hash256"}],["Amount",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["Balance",{"nth":2,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["LimitAmount",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["TakerPays",{"nth":4,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["TakerGets",{"nth":5,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["LowLimit",{"nth":6,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["HighLimit",{"nth":7,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["Fee",{"nth":8,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["SendMax",{"nth":9,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["DeliverMin",{"nth":10,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["MinimumOffer",{"nth":16,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["RippleEscrow",{"nth":17,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["DeliveredAmount",{"nth":18,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["NFTokenBrokerFee",{"nth":19,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"Amount"}],["PublicKey",{"nth":1,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["MessageKey",{"nth":2,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["SigningPubKey",{"nth":3,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["TxnSignature",{"nth":4,"isVLEncoded":true,"isSerialized":true,"isSigningField":false,"type":"Blob"}],["URI",{"nth":5,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["Signature",{"nth":6,"isVLEncoded":true,"isSerialized":true,"isSigningField":false,"type":"Blob"}],["Domain",{"nth":7,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["FundCode",{"nth":8,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["RemoveCode",{"nth":9,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["ExpireCode",{"nth":10,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["CreateCode",{"nth":11,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["MemoType",{"nth":12,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["MemoData",{"nth":13,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["MemoFormat",{"nth":14,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["Fulfillment",{"nth":16,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["Condition",{"nth":17,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["MasterSignature",{"nth":18,"isVLEncoded":true,"isSerialized":true,"isSigningField":false,"type":"Blob"}],["UNLModifyValidator",{"nth":19,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["ValidatorToDisable",{"nth":20,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["ValidatorToReEnable",{"nth":21,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["HookStateData",{"nth":22,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["HookReturnString",{"nth":23,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["HookParameterName",{"nth":24,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["HookParameterValue",{"nth":25,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Blob"}],["Account",{"nth":1,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["Owner",{"nth":2,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["Destination",{"nth":3,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["Issuer",{"nth":4,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["Authorize",{"nth":5,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["Unauthorize",{"nth":6,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["RegularKey",{"nth":8,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["NFTokenMinter",{"nth":9,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["EmitCallback",{"nth":10,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["HookAccount",{"nth":16,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"AccountID"}],["Indexes",{"nth":1,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Vector256"}],["Hashes",{"nth":2,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Vector256"}],["Amendments",{"nth":3,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Vector256"}],["NFTokenOffers",{"nth":4,"isVLEncoded":true,"isSerialized":true,"isSigningField":true,"type":"Vector256"}],["Paths",{"nth":1,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"PathSet"}],["TransactionMetaData",{"nth":2,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["CreatedNode",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["DeletedNode",{"nth":4,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["ModifiedNode",{"nth":5,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["PreviousFields",{"nth":6,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["FinalFields",{"nth":7,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["NewFields",{"nth":8,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["TemplateEntry",{"nth":9,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["Memo",{"nth":10,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["SignerEntry",{"nth":11,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["NFToken",{"nth":12,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["EmitDetails",{"nth":13,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["Hook",{"nth":14,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["Signer",{"nth":16,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["Majority",{"nth":18,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["DisabledValidator",{"nth":19,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["EmittedTxn",{"nth":20,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["HookExecution",{"nth":21,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["HookDefinition",{"nth":22,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["HookParameter",{"nth":23,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["HookGrant",{"nth":24,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STObject"}],["Signers",{"nth":3,"isVLEncoded":false,"isSerialized":true,"isSigningField":false,"type":"STArray"}],["SignerEntries",{"nth":4,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["Template",{"nth":5,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["Necessary",{"nth":6,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["Sufficient",{"nth":7,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["AffectedNodes",{"nth":8,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["Memos",{"nth":9,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["NFTokens",{"nth":10,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["Hooks",{"nth":11,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["Majorities",{"nth":16,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["DisabledValidators",{"nth":17,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["HookExecutions",{"nth":18,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["HookParameters",{"nth":19,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}],["HookGrants",{"nth":20,"isVLEncoded":false,"isSerialized":true,"isSigningField":true,"type":"STArray"}]],"TRANSACTION_RESULTS":{"telLOCAL_ERROR":-399,"telBAD_DOMAIN":-398,"telBAD_PATH_COUNT":-397,"telBAD_PUBLIC_KEY":-396,"telFAILED_PROCESSING":-395,"telINSUF_FEE_P":-394,"telNO_DST_PARTIAL":-393,"telCAN_NOT_QUEUE":-392,"telCAN_NOT_QUEUE_BALANCE":-391,"telCAN_NOT_QUEUE_BLOCKS":-390,"telCAN_NOT_QUEUE_BLOCKED":-389,"telCAN_NOT_QUEUE_FEE":-388,"telCAN_NOT_QUEUE_FULL":-387,"temMALFORMED":-299,"temBAD_AMOUNT":-298,"temBAD_CURRENCY":-297,"temBAD_EXPIRATION":-296,"temBAD_FEE":-295,"temBAD_ISSUER":-294,"temBAD_LIMIT":-293,"temBAD_OFFER":-292,"temBAD_PATH":-291,"temBAD_PATH_LOOP":-290,"temBAD_REGKEY":-289,"temBAD_SEND_XRP_LIMIT":-288,"temBAD_SEND_XRP_MAX":-287,"temBAD_SEND_XRP_NO_DIRECT":-286,"temBAD_SEND_XRP_PARTIAL":-285,"temBAD_SEND_XRP_PATHS":-284,"temBAD_SEQUENCE":-283,"temBAD_SIGNATURE":-282,"temBAD_SRC_ACCOUNT":-281,"temBAD_TRANSFER_RATE":-280,"temDST_IS_SRC":-279,"temDST_NEEDED":-278,"temINVALID":-277,"temINVALID_FLAG":-276,"temREDUNDANT":-275,"temRIPPLE_EMPTY":-274,"temDISABLED":-273,"temBAD_SIGNER":-272,"temBAD_QUORUM":-271,"temBAD_WEIGHT":-270,"temBAD_TICK_SIZE":-269,"temINVALID_ACCOUNT_ID":-268,"temCANNOT_PREAUTH_SELF":-267,"temUNCERTAIN":-266,"temUNKNOWN":-265,"temSEQ_AND_TICKET":-264,"temBAD_NFTOKEN_TRANSFER_FEE":-263,"tefFAILURE":-199,"tefALREADY":-198,"tefBAD_ADD_AUTH":-197,"tefBAD_AUTH":-196,"tefBAD_LEDGER":-195,"tefCREATED":-194,"tefEXCEPTION":-193,"tefINTERNAL":-192,"tefNO_AUTH_REQUIRED":-191,"tefPAST_SEQ":-190,"tefWRONG_PRIOR":-189,"tefMASTER_DISABLED":-188,"tefMAX_LEDGER":-187,"tefBAD_SIGNATURE":-186,"tefBAD_QUORUM":-185,"tefNOT_MULTI_SIGNING":-184,"tefBAD_AUTH_MASTER":-183,"tefINVARIANT_FAILED":-182,"tefTOO_BIG":-181,"tefNO_TICKET":-180,"tefNFTOKEN_IS_NOT_TRANSFERABLE":-179,"terRETRY":-99,"terFUNDS_SPENT":-98,"terINSUF_FEE_B":-97,"terNO_ACCOUNT":-96,"terNO_AUTH":-95,"terNO_LINE":-94,"terOWNERS":-93,"terPRE_SEQ":-92,"terLAST":-91,"terNO_RIPPLE":-90,"terQUEUED":-89,"terPRE_TICKET":-88,"tesSUCCESS":0,"tecCLAIM":100,"tecPATH_PARTIAL":101,"tecUNFUNDED_ADD":102,"tecUNFUNDED_OFFER":103,"tecUNFUNDED_PAYMENT":104,"tecFAILED_PROCESSING":105,"tecDIR_FULL":121,"tecINSUF_RESERVE_LINE":122,"tecINSUF_RESERVE_OFFER":123,"tecNO_DST":124,"tecNO_DST_INSUF_XRP":125,"tecNO_LINE_INSUF_RESERVE":126,"tecNO_LINE_REDUNDANT":127,"tecPATH_DRY":128,"tecUNFUNDED":129,"tecNO_ALTERNATIVE_KEY":130,"tecNO_REGULAR_KEY":131,"tecOWNERS":132,"tecNO_ISSUER":133,"tecNO_AUTH":134,"tecNO_LINE":135,"tecINSUFF_FEE":136,"tecFROZEN":137,"tecNO_TARGET":138,"tecNO_PERMISSION":139,"tecNO_ENTRY":140,"tecINSUFFICIENT_RESERVE":141,"tecNEED_MASTER_KEY":142,"tecDST_TAG_NEEDED":143,"tecINTERNAL":144,"tecOVERSIZE":145,"tecCRYPTOCONDITION_ERROR":146,"tecINVARIANT_FAILED":147,"tecEXPIRED":148,"tecDUPLICATE":149,"tecKILLED":150,"tecHAS_OBLIGATIONS":151,"tecTOO_SOON":152,"tecHOOK_REJECTED":153,"tecMAX_SEQUENCE_REACHED":154,"tecNO_SUITABLE_NFTOKEN_PAGE":155,"tecNFTOKEN_BUY_SELL_MISMATCH":156,"tecNFTOKEN_OFFER_TYPE_MISMATCH":157,"tecCANT_ACCEPT_OWN_NFTOKEN_OFFER":158,"tecINSUFFICIENT_FUNDS":159,"tecOBJECT_NOT_FOUND":160,"tecINSUFFICIENT_PAYMENT":161,"tecINCORRECT_ASSET":162,"tecTOO_MANY":163},"TRANSACTION_TYPES":{"Invalid":-1,"Payment":0,"EscrowCreate":1,"EscrowFinish":2,"AccountSet":3,"EscrowCancel":4,"SetRegularKey":5,"NickNameSet":6,"OfferCreate":7,"OfferCancel":8,"Contract":9,"TicketCreate":10,"TicketCancel":11,"SignerListSet":12,"PaymentChannelCreate":13,"PaymentChannelFund":14,"PaymentChannelClaim":15,"CheckCreate":16,"CheckCash":17,"CheckCancel":18,"DepositPreauth":19,"TrustSet":20,"AccountDelete":21,"SetHook":22,"NFTokenMint":25,"NFTokenBurn":26,"NFTokenCreateOffer":27,"NFTokenCancelOffer":28,"NFTokenAcceptOffer":29,"EnableAmendment":100,"SetFee":101,"UNLModify":102}}');
16904
+ module.exports = JSON.parse('{"FIELDS":[["Generic",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":0,"type":"Unknown"}],["Invalid",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":-1,"type":"Unknown"}],["ObjectEndMarker",{"isSerialized":false,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"STObject"}],["ArrayEndMarker",{"isSerialized":false,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"STArray"}],["hash",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":257,"type":"Hash256"}],["index",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":258,"type":"Hash256"}],["taker_gets_funded",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":258,"type":"Amount"}],["taker_pays_funded",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":259,"type":"Amount"}],["LedgerEntryType",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"UInt16"}],["TransactionType",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":2,"type":"UInt16"}],["SignerWeight",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":3,"type":"UInt16"}],["TransferFee",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":4,"type":"UInt16"}],["Version",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":16,"type":"UInt16"}],["HookStateChangeCount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":17,"type":"UInt16"}],["HookEmitCount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":18,"type":"UInt16"}],["HookExecutionIndex",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":19,"type":"UInt16"}],["HookApiVersion",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":20,"type":"UInt16"}],["NetworkID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"UInt32"}],["Flags",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":2,"type":"UInt32"}],["SourceTag",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":3,"type":"UInt32"}],["Sequence",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":4,"type":"UInt32"}],["PreviousTxnLgrSeq",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":5,"type":"UInt32"}],["LedgerSequence",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":6,"type":"UInt32"}],["CloseTime",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":7,"type":"UInt32"}],["ParentCloseTime",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":8,"type":"UInt32"}],["SigningTime",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":9,"type":"UInt32"}],["Expiration",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":10,"type":"UInt32"}],["TransferRate",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":11,"type":"UInt32"}],["WalletSize",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":12,"type":"UInt32"}],["OwnerCount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":13,"type":"UInt32"}],["DestinationTag",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":14,"type":"UInt32"}],["HighQualityIn",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":16,"type":"UInt32"}],["HighQualityOut",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":17,"type":"UInt32"}],["LowQualityIn",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":18,"type":"UInt32"}],["LowQualityOut",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":19,"type":"UInt32"}],["QualityIn",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":20,"type":"UInt32"}],["QualityOut",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":21,"type":"UInt32"}],["StampEscrow",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":22,"type":"UInt32"}],["BondAmount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":23,"type":"UInt32"}],["LoadFee",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":24,"type":"UInt32"}],["OfferSequence",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":25,"type":"UInt32"}],["FirstLedgerSequence",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":26,"type":"UInt32"}],["LastLedgerSequence",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":27,"type":"UInt32"}],["TransactionIndex",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":28,"type":"UInt32"}],["OperationLimit",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":29,"type":"UInt32"}],["ReferenceFeeUnits",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":30,"type":"UInt32"}],["ReserveBase",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":31,"type":"UInt32"}],["ReserveIncrement",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":32,"type":"UInt32"}],["SetFlag",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":33,"type":"UInt32"}],["ClearFlag",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":34,"type":"UInt32"}],["SignerQuorum",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":35,"type":"UInt32"}],["CancelAfter",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":36,"type":"UInt32"}],["FinishAfter",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":37,"type":"UInt32"}],["SignerListID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":38,"type":"UInt32"}],["SettleDelay",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":39,"type":"UInt32"}],["TicketCount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":40,"type":"UInt32"}],["TicketSequence",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":41,"type":"UInt32"}],["NFTokenTaxon",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":42,"type":"UInt32"}],["MintedNFTokens",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":43,"type":"UInt32"}],["BurnedNFTokens",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":44,"type":"UInt32"}],["HookStateCount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":45,"type":"UInt32"}],["EmitGeneration",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":46,"type":"UInt32"}],["LockCount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":47,"type":"UInt32"}],["RewardTime",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":98,"type":"UInt32"}],["RewardLgrFirst",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":99,"type":"UInt32"}],["RewardLgrLast",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":100,"type":"UInt32"}],["IndexNext",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"UInt64"}],["IndexPrevious",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":2,"type":"UInt64"}],["BookNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":3,"type":"UInt64"}],["OwnerNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":4,"type":"UInt64"}],["BaseFee",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":5,"type":"UInt64"}],["ExchangeRate",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":6,"type":"UInt64"}],["LowNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":7,"type":"UInt64"}],["HighNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":8,"type":"UInt64"}],["DestinationNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":9,"type":"UInt64"}],["Cookie",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":10,"type":"UInt64"}],["ServerVersion",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":11,"type":"UInt64"}],["NFTokenOfferNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":12,"type":"UInt64"}],["EmitBurden",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":13,"type":"UInt64"}],["HookInstructionCount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":17,"type":"UInt64"}],["HookReturnCode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":18,"type":"UInt64"}],["ReferenceCount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":19,"type":"UInt64"}],["RewardAccumulator",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":100,"type":"UInt64"}],["EmailHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"Hash128"}],["LedgerHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"Hash256"}],["ParentHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":2,"type":"Hash256"}],["TransactionHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":3,"type":"Hash256"}],["AccountHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":4,"type":"Hash256"}],["PreviousTxnID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":5,"type":"Hash256"}],["LedgerIndex",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":6,"type":"Hash256"}],["WalletLocator",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":7,"type":"Hash256"}],["RootIndex",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":8,"type":"Hash256"}],["AccountTxnID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":9,"type":"Hash256"}],["NFTokenID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":10,"type":"Hash256"}],["EmitParentTxnID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":11,"type":"Hash256"}],["EmitNonce",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":12,"type":"Hash256"}],["EmitHookHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":13,"type":"Hash256"}],["BookDirectory",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":16,"type":"Hash256"}],["InvoiceID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":17,"type":"Hash256"}],["Nickname",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":18,"type":"Hash256"}],["Amendment",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":19,"type":"Hash256"}],["HookOn",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":20,"type":"Hash256"}],["Digest",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":21,"type":"Hash256"}],["Channel",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":22,"type":"Hash256"}],["ConsensusHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":23,"type":"Hash256"}],["CheckID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":24,"type":"Hash256"}],["ValidatedHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":25,"type":"Hash256"}],["PreviousPageMin",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":26,"type":"Hash256"}],["NextPageMin",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":27,"type":"Hash256"}],["NFTokenBuyOffer",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":28,"type":"Hash256"}],["NFTokenSellOffer",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":29,"type":"Hash256"}],["HookStateKey",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":30,"type":"Hash256"}],["HookHash",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":31,"type":"Hash256"}],["HookNamespace",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":32,"type":"Hash256"}],["HookSetTxnID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":33,"type":"Hash256"}],["OfferID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":34,"type":"Hash256"}],["EscrowID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":35,"type":"Hash256"}],["URITokenID",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":36,"type":"Hash256"}],["hash",{"isSerialized":true,"isSigningField":false,"isVLEncoded":false,"nth":1,"type":"Hash256"}],["index",{"isSerialized":true,"isSigningField":false,"isVLEncoded":false,"nth":2,"type":"Hash256"}],["Amount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"Amount"}],["Balance",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":2,"type":"Amount"}],["LimitAmount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":3,"type":"Amount"}],["TakerPays",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":4,"type":"Amount"}],["TakerGets",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":5,"type":"Amount"}],["LowLimit",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":6,"type":"Amount"}],["HighLimit",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":7,"type":"Amount"}],["Fee",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":8,"type":"Amount"}],["SendMax",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":9,"type":"Amount"}],["DeliverMin",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":10,"type":"Amount"}],["MinimumOffer",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":16,"type":"Amount"}],["RippleEscrow",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":17,"type":"Amount"}],["DeliveredAmount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":18,"type":"Amount"}],["NFTokenBrokerFee",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":19,"type":"Amount"}],["HookCallbackFee",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":20,"type":"Amount"}],["LockedBalance",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":21,"type":"Amount"}],["PublicKey",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":1,"type":"Blob"}],["MessageKey",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":2,"type":"Blob"}],["SigningPubKey",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":3,"type":"Blob"}],["TxnSignature",{"isSerialized":true,"isSigningField":false,"isVLEncoded":true,"nth":4,"type":"Blob"}],["URI",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":5,"type":"Blob"}],["Signature",{"isSerialized":true,"isSigningField":false,"isVLEncoded":true,"nth":6,"type":"Blob"}],["Domain",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":7,"type":"Blob"}],["FundCode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":8,"type":"Blob"}],["RemoveCode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":9,"type":"Blob"}],["ExpireCode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":10,"type":"Blob"}],["CreateCode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":11,"type":"Blob"}],["MemoType",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":12,"type":"Blob"}],["MemoData",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":13,"type":"Blob"}],["MemoFormat",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":14,"type":"Blob"}],["Fulfillment",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":16,"type":"Blob"}],["Condition",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":17,"type":"Blob"}],["MasterSignature",{"isSerialized":true,"isSigningField":false,"isVLEncoded":true,"nth":18,"type":"Blob"}],["UNLModifyValidator",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":19,"type":"Blob"}],["ValidatorToDisable",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":20,"type":"Blob"}],["ValidatorToReEnable",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":21,"type":"Blob"}],["HookStateData",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":22,"type":"Blob"}],["HookReturnString",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":23,"type":"Blob"}],["HookParameterName",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":24,"type":"Blob"}],["HookParameterValue",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":25,"type":"Blob"}],["Blob",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":26,"type":"Blob"}],["Account",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":1,"type":"AccountID"}],["Owner",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":2,"type":"AccountID"}],["Destination",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":3,"type":"AccountID"}],["Issuer",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":4,"type":"AccountID"}],["Authorize",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":5,"type":"AccountID"}],["Unauthorize",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":6,"type":"AccountID"}],["RegularKey",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":8,"type":"AccountID"}],["NFTokenMinter",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":9,"type":"AccountID"}],["EmitCallback",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":10,"type":"AccountID"}],["HookAccount",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":16,"type":"AccountID"}],["TransactionMetaData",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":2,"type":"STObject"}],["CreatedNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":3,"type":"STObject"}],["DeletedNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":4,"type":"STObject"}],["ModifiedNode",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":5,"type":"STObject"}],["PreviousFields",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":6,"type":"STObject"}],["FinalFields",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":7,"type":"STObject"}],["NewFields",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":8,"type":"STObject"}],["TemplateEntry",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":9,"type":"STObject"}],["Memo",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":10,"type":"STObject"}],["SignerEntry",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":11,"type":"STObject"}],["NFToken",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":12,"type":"STObject"}],["EmitDetails",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":13,"type":"STObject"}],["Hook",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":14,"type":"STObject"}],["Signer",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":16,"type":"STObject"}],["Majority",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":18,"type":"STObject"}],["DisabledValidator",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":19,"type":"STObject"}],["EmittedTxn",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":20,"type":"STObject"}],["HookExecution",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":21,"type":"STObject"}],["HookDefinition",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":22,"type":"STObject"}],["HookParameter",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":23,"type":"STObject"}],["HookGrant",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":24,"type":"STObject"}],["Signers",{"isSerialized":true,"isSigningField":false,"isVLEncoded":false,"nth":3,"type":"STArray"}],["SignerEntries",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":4,"type":"STArray"}],["Template",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":5,"type":"STArray"}],["Necessary",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":6,"type":"STArray"}],["Sufficient",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":7,"type":"STArray"}],["AffectedNodes",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":8,"type":"STArray"}],["Memos",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":9,"type":"STArray"}],["NFTokens",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":10,"type":"STArray"}],["Hooks",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":11,"type":"STArray"}],["Majorities",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":16,"type":"STArray"}],["DisabledValidators",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":17,"type":"STArray"}],["HookExecutions",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":18,"type":"STArray"}],["HookParameters",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":19,"type":"STArray"}],["HookGrants",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":20,"type":"STArray"}],["CloseResolution",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"UInt8"}],["Method",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":2,"type":"UInt8"}],["TransactionResult",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":3,"type":"UInt8"}],["TickSize",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":16,"type":"UInt8"}],["UNLModifyDisabling",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":17,"type":"UInt8"}],["HookResult",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":18,"type":"UInt8"}],["TakerPaysCurrency",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"Hash160"}],["TakerPaysIssuer",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":2,"type":"Hash160"}],["TakerGetsCurrency",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":3,"type":"Hash160"}],["TakerGetsIssuer",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":4,"type":"Hash160"}],["Paths",{"isSerialized":true,"isSigningField":true,"isVLEncoded":false,"nth":1,"type":"PathSet"}],["Indexes",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":1,"type":"Vector256"}],["Hashes",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":2,"type":"Vector256"}],["Amendments",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":3,"type":"Vector256"}],["NFTokenOffers",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":4,"type":"Vector256"}],["HookNamespaces",{"isSerialized":true,"isSigningField":true,"isVLEncoded":true,"nth":5,"type":"Vector256"}],["Transaction",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":1,"type":"Transaction"}],["LedgerEntry",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":1,"type":"LedgerEntry"}],["Validation",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":1,"type":"Validation"}],["Metadata",{"isSerialized":false,"isSigningField":false,"isVLEncoded":false,"nth":1,"type":"Metadata"}]],"LEDGER_ENTRY_TYPES":{"AccountRoot":97,"Amendments":102,"Any":0,"Check":67,"Child":7378,"Contract":99,"DepositPreauth":112,"DirectoryNode":100,"EmittedTxn":69,"Escrow":117,"FeeSettings":115,"GeneratorMap":103,"Hook":72,"HookDefinition":68,"HookState":118,"Invalid":-1,"LedgerHashes":104,"NFTokenOffer":55,"NFTokenPage":80,"NegativeUNL":78,"Nickname":110,"Offer":111,"PayChannel":120,"RippleState":114,"SignerList":83,"Ticket":84,"URIToken":85},"TRANSACTION_RESULTS":{"tecCANT_ACCEPT_OWN_NFTOKEN_OFFER":158,"tecCLAIM":100,"tecCRYPTOCONDITION_ERROR":146,"tecDIR_FULL":121,"tecDST_TAG_NEEDED":143,"tecDUPLICATE":149,"tecEXPIRED":148,"tecFAILED_PROCESSING":105,"tecFROZEN":137,"tecHAS_OBLIGATIONS":151,"tecHOOK_REJECTED":153,"tecINSUFFICIENT_FUNDS":159,"tecINSUFFICIENT_PAYMENT":161,"tecINSUFFICIENT_RESERVE":141,"tecINSUFF_FEE":136,"tecINSUF_RESERVE_LINE":122,"tecINSUF_RESERVE_OFFER":123,"tecINTERNAL":144,"tecINVARIANT_FAILED":147,"tecKILLED":150,"tecMAX_SEQUENCE_REACHED":154,"tecNEED_MASTER_KEY":142,"tecNFTOKEN_BUY_SELL_MISMATCH":156,"tecNFTOKEN_OFFER_TYPE_MISMATCH":157,"tecNO_ALTERNATIVE_KEY":130,"tecNO_AUTH":134,"tecNO_DST":124,"tecNO_DST_INSUF_XRP":125,"tecNO_ENTRY":140,"tecNO_ISSUER":133,"tecNO_LINE":135,"tecNO_LINE_INSUF_RESERVE":126,"tecNO_LINE_REDUNDANT":127,"tecNO_PERMISSION":139,"tecNO_REGULAR_KEY":131,"tecNO_SUITABLE_NFTOKEN_PAGE":155,"tecNO_TARGET":138,"tecOBJECT_NOT_FOUND":160,"tecOVERSIZE":145,"tecOWNERS":132,"tecPATH_DRY":128,"tecPATH_PARTIAL":101,"tecPRECISION_LOSS":163,"tecREQUIRES_FLAG":162,"tecTOO_SOON":152,"tecUNFUNDED":129,"tecUNFUNDED_ADD":102,"tecUNFUNDED_OFFER":103,"tecUNFUNDED_PAYMENT":104,"tefALREADY":-198,"tefBAD_ADD_AUTH":-197,"tefBAD_AUTH":-196,"tefBAD_AUTH_MASTER":-183,"tefBAD_LEDGER":-195,"tefBAD_QUORUM":-185,"tefBAD_SIGNATURE":-186,"tefCREATED":-194,"tefEXCEPTION":-193,"tefFAILURE":-199,"tefINTERNAL":-192,"tefINVARIANT_FAILED":-182,"tefMASTER_DISABLED":-188,"tefMAX_LEDGER":-187,"tefNFTOKEN_IS_NOT_TRANSFERABLE":-179,"tefNOT_MULTI_SIGNING":-184,"tefNO_AUTH_REQUIRED":-191,"tefNO_TICKET":-180,"tefPAST_SEQ":-190,"tefTOO_BIG":-181,"tefWRONG_PRIOR":-189,"telBAD_DOMAIN":-398,"telBAD_PATH_COUNT":-397,"telBAD_PUBLIC_KEY":-396,"telCAN_NOT_QUEUE":-392,"telCAN_NOT_QUEUE_BALANCE":-391,"telCAN_NOT_QUEUE_BLOCKED":-389,"telCAN_NOT_QUEUE_BLOCKS":-390,"telCAN_NOT_QUEUE_FEE":-388,"telCAN_NOT_QUEUE_FULL":-387,"telFAILED_PROCESSING":-395,"telINSUF_FEE_P":-394,"telLOCAL_ERROR":-399,"telNETWORK_ID_MAKES_TX_NON_CANONICAL":-384,"telNON_LOCAL_EMITTED_TXN":-383,"telNO_DST_PARTIAL":-393,"telREQUIRES_NETWORK_ID":-385,"telWRONG_NETWORK":-386,"temBAD_AMOUNT":-298,"temBAD_CURRENCY":-297,"temBAD_EXPIRATION":-296,"temBAD_FEE":-295,"temBAD_ISSUER":-294,"temBAD_LIMIT":-293,"temBAD_NFTOKEN_TRANSFER_FEE":-260,"temBAD_OFFER":-292,"temBAD_PATH":-291,"temBAD_PATH_LOOP":-290,"temBAD_QUORUM":-271,"temBAD_REGKEY":-289,"temBAD_SEND_XRP_LIMIT":-288,"temBAD_SEND_XRP_MAX":-287,"temBAD_SEND_XRP_NO_DIRECT":-286,"temBAD_SEND_XRP_PARTIAL":-285,"temBAD_SEND_XRP_PATHS":-284,"temBAD_SEQUENCE":-283,"temBAD_SIGNATURE":-282,"temBAD_SIGNER":-272,"temBAD_SRC_ACCOUNT":-281,"temBAD_TICK_SIZE":-269,"temBAD_TRANSFER_RATE":-280,"temBAD_WEIGHT":-270,"temCANNOT_PREAUTH_SELF":-267,"temDISABLED":-273,"temDST_IS_SRC":-279,"temDST_NEEDED":-278,"temHOOK_DATA_TOO_LARGE":-265,"temHOOK_REJECTED":-264,"temINVALID":-277,"temINVALID_ACCOUNT_ID":-268,"temINVALID_COUNT":-266,"temINVALID_FLAG":-276,"temMALFORMED":-299,"temREDUNDANT":-275,"temRIPPLE_EMPTY":-274,"temSEQ_AND_TICKET":-261,"temUNCERTAIN":-263,"temUNKNOWN":-262,"terFUNDS_SPENT":-98,"terINSUF_FEE_B":-97,"terLAST":-91,"terNO_ACCOUNT":-96,"terNO_AUTH":-95,"terNO_HOOK":-87,"terNO_LINE":-94,"terNO_RIPPLE":-90,"terOWNERS":-93,"terPRE_SEQ":-92,"terPRE_TICKET":-88,"terQUEUED":-89,"terRETRY":-99,"tesSUCCESS":0},"TRANSACTION_TYPES":{"AccountDelete":21,"AccountSet":3,"Amendment":100,"CheckCancel":18,"CheckCash":17,"CheckCreate":16,"ClaimReward":98,"Contract":9,"DepositPreauth":19,"EmitFailure":103,"EscrowCancel":4,"EscrowCreate":1,"EscrowFinish":2,"Fee":101,"Invalid":-1,"Invoke":99,"NFTokenAcceptOffer":29,"NFTokenBurn":26,"NFTokenCancelOffer":28,"NFTokenCreateOffer":27,"NFTokenMint":25,"NicknameSet":6,"OfferCancel":8,"OfferCreate":7,"Payment":0,"PaymentChannelClaim":15,"PaymentChannelCreate":13,"PaymentChannelFund":14,"SetHook":22,"SetRegularKey":5,"SignerListSet":12,"SpinalTap":11,"TicketCreate":10,"TrustSet":20,"UNLModify":102,"URITokenBurn":46,"URITokenBuy":47,"URITokenCancelSellOffer":49,"URITokenCreateSellOffer":48,"URITokenMint":45},"TYPES":{"AccountID":8,"Amount":6,"Blob":7,"Done":-1,"Hash128":4,"Hash160":17,"Hash256":5,"LedgerEntry":10002,"Metadata":10004,"NotPresent":0,"PathSet":18,"STArray":15,"STObject":14,"Transaction":10001,"UInt16":1,"UInt192":21,"UInt32":2,"UInt384":22,"UInt512":23,"UInt64":3,"UInt8":16,"UInt96":20,"Unknown":-2,"Validation":10003,"Vector256":19},"hash":"67D2FC42C6321687BCC47B1D912D7EB2E077A7016D6E2D5B8A2E128D7493B650"}');
15879
16905
 
15880
16906
  /***/ })
15881
16907