@keetanetwork/anchor 0.0.81 → 0.0.83

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.
Files changed (52) hide show
  1. package/lib/anchor-metadata-server.js +1 -1
  2. package/lib/anchor-metadata-server.js.map +1 -1
  3. package/lib/anchor-status.d.ts +32 -1
  4. package/lib/anchor-status.d.ts.map +1 -1
  5. package/lib/anchor-status.js +62 -1
  6. package/lib/anchor-status.js.map +1 -1
  7. package/lib/asset.d.ts +3 -0
  8. package/lib/asset.d.ts.map +1 -1
  9. package/lib/asset.js +25 -1
  10. package/lib/asset.js.map +1 -1
  11. package/lib/chaining.d.ts +13 -1
  12. package/lib/chaining.d.ts.map +1 -1
  13. package/lib/chaining.js +58 -17
  14. package/lib/chaining.js.map +1 -1
  15. package/lib/encrypted-container.d.ts.map +1 -1
  16. package/lib/encrypted-container.js +22 -7
  17. package/lib/encrypted-container.js.map +1 -1
  18. package/lib/history.d.ts +77 -21
  19. package/lib/history.d.ts.map +1 -1
  20. package/lib/history.js +951 -70
  21. package/lib/history.js.map +1 -1
  22. package/lib/http-server/index.d.ts.map +1 -1
  23. package/lib/http-server/index.js +20 -1
  24. package/lib/http-server/index.js.map +1 -1
  25. package/lib/index.d.ts +4 -4
  26. package/lib/index.d.ts.map +1 -1
  27. package/lib/index.js +2 -2
  28. package/lib/index.js.map +1 -1
  29. package/lib/resolver.d.ts.map +1 -1
  30. package/lib/resolver.js +18 -2
  31. package/lib/resolver.js.map +1 -1
  32. package/lib/sensitive-attribute.d.ts.map +1 -1
  33. package/lib/sensitive-attribute.js +24 -2
  34. package/lib/sensitive-attribute.js.map +1 -1
  35. package/npm-shrinkwrap.json +18 -6
  36. package/package.json +2 -1
  37. package/services/fx/client.d.ts +18 -4
  38. package/services/fx/client.d.ts.map +1 -1
  39. package/services/fx/client.js +52 -6
  40. package/services/fx/client.js.map +1 -1
  41. package/services/fx/common.d.ts +35 -0
  42. package/services/fx/common.d.ts.map +1 -1
  43. package/services/fx/common.js +5 -5
  44. package/services/fx/common.js.map +1 -1
  45. package/services/fx/server.d.ts +17 -1
  46. package/services/fx/server.d.ts.map +1 -1
  47. package/services/fx/server.js +236 -18
  48. package/services/fx/server.js.map +1 -1
  49. package/services/fx/status-source.d.ts +34 -0
  50. package/services/fx/status-source.d.ts.map +1 -0
  51. package/services/fx/status-source.js +99 -0
  52. package/services/fx/status-source.js.map +1 -0
@@ -6,6 +6,8 @@ import { KeetaAnchorError, KeetaAnchorUserError } from '../../lib/error.js';
6
6
  import { assertConversionInputCanonicalJSON, assertKeetaFXAnchorClientCreateExchangeRequestJSON, Errors } from './common.js';
7
7
  import * as Signing from '../../lib/utils/signing.js';
8
8
  import { KeetaAnchorQueueRunner, KeetaAnchorQueueStorageDriverMemory } from '../../lib/queue/index.js';
9
+ import { ConvertStringToRequestID } from '../../lib/queue/internal.js';
10
+ import { AnchorExternal } from '../../lib/anchor-external.js';
9
11
  import { KeetaAnchorQueuePipelineAdvanced } from '../../lib/queue/pipeline.js';
10
12
  import { assertNever } from '../../lib/utils/never.js';
11
13
  import * as typia from 'typia';
@@ -171,6 +173,78 @@ function decodeKeetaFXAnchorQueueStage1Request(request) {
171
173
  };
172
174
  return (retval);
173
175
  }
176
+ /**
177
+ * Build the conversion summary surfaced for FX history correlation.
178
+ */
179
+ function buildKeetaFXAnchorConversionSummary(expected, block, account, refunds = []) {
180
+ const conversion = {
181
+ from: {
182
+ token: expected.receive.token.publicKeyString.get(),
183
+ amount: expected.receive.amount.toString()
184
+ },
185
+ to: {
186
+ token: expected.send.token.publicKeyString.get(),
187
+ amount: expected.send.amount.toString()
188
+ },
189
+ liquidityProvider: account.publicKeyString.get()
190
+ };
191
+ /*
192
+ * The user's block funds the swap with the principal (the `from` token)
193
+ * and, when charged, a separate cost send in another token. Under a
194
+ * variable rate the user may over-send the cost and the anchor refunds the
195
+ * excess, so net the refunds against the gross send to report the cost the
196
+ * user actually paid.
197
+ */
198
+ for (const operation of block.operations) {
199
+ if (operation.type !== KeetaNet.lib.Block.OperationType.SEND) {
200
+ continue;
201
+ }
202
+ if (operation.token.comparePublicKey(expected.receive.token)) {
203
+ continue;
204
+ }
205
+ let costAmount = operation.amount;
206
+ for (const refund of refunds) {
207
+ if (operation.token.comparePublicKey(refund.token)) {
208
+ costAmount -= refund.amount;
209
+ }
210
+ }
211
+ if (costAmount > 0n) {
212
+ conversion.cost = {
213
+ token: operation.token.publicKeyString.get(),
214
+ amount: costAmount.toString()
215
+ };
216
+ }
217
+ break;
218
+ }
219
+ return (conversion);
220
+ }
221
+ /**
222
+ * Extract the client correlation id from a swap block's anchor external for the
223
+ * given provider account, or `undefined` when the block carries none.
224
+ */
225
+ async function correlationIdFromBlock(block, providerAccount) {
226
+ const anchorKey = providerAccount.publicKeyString.get();
227
+ for (const operation of block.operations) {
228
+ if (operation.type !== KeetaNet.lib.Block.OperationType.SEND) {
229
+ continue;
230
+ }
231
+ if (operation.external === undefined) {
232
+ continue;
233
+ }
234
+ let decoded;
235
+ try {
236
+ decoded = await AnchorExternal.fromPlainExternal(operation.external);
237
+ }
238
+ catch {
239
+ continue;
240
+ }
241
+ const entry = decoded.envelope.anchors[anchorKey];
242
+ if (entry !== undefined && 'transactionId' in entry) {
243
+ return (entry.transactionId);
244
+ }
245
+ }
246
+ return (undefined);
247
+ }
174
248
  class KeetaFXAnchorQueuePipelineStage1 extends KeetaAnchorQueueRunner {
175
249
  serverConfig;
176
250
  sequential = true;
@@ -250,12 +324,19 @@ class KeetaFXAnchorQueuePipelineStage1 extends KeetaAnchorQueueRunner {
250
324
  if (blockExists !== null) {
251
325
  const existingOutput = entry.output;
252
326
  const blocks = existingOutput?.blocks ?? [Buffer.from(block.toBytes()).toString('base64')];
327
+ const completedOutput = {
328
+ blockhash: block.hash.toString(),
329
+ blocks: blocks
330
+ };
331
+ if (existingOutput?.conversion !== undefined) {
332
+ completedOutput.conversion = existingOutput.conversion;
333
+ }
334
+ else if (entry.request.expected !== null) {
335
+ completedOutput.conversion = buildKeetaFXAnchorConversionSummary(entry.request.expected, block, entry.request.account);
336
+ }
253
337
  return ({
254
338
  status: 'completed',
255
- output: {
256
- blockhash: block.hash.toString(),
257
- blocks: blocks
258
- }
339
+ output: completedOutput
259
340
  });
260
341
  }
261
342
  /* Get the current head block of the account in the block */
@@ -309,6 +390,7 @@ class KeetaFXAnchorQueuePipelineStage1 extends KeetaAnchorQueueRunner {
309
390
  /* We are clear to attempt the swap now */
310
391
  const builder = userClient.initBuilder();
311
392
  let expected = entry.request.expected;
393
+ let refunds = [];
312
394
  /**
313
395
  * We only want to refund excess for cost/paying token if it is not a fixed rate
314
396
  * as if it is a fixed rate transfer, you can assume the client did not send unintentionally
@@ -341,13 +423,14 @@ class KeetaFXAnchorQueuePipelineStage1 extends KeetaAnchorQueueRunner {
341
423
  }
342
424
  }
343
425
  const quote = await this.serverConfig.fx.getConversionRateAndFee(request, { purpose: 'exchange', request: entry.request });
344
- const { refunds } = assertExchangeBlockParametersAndComputeRefund({
426
+ const refundResult = assertExchangeBlockParametersAndComputeRefund({
345
427
  block: block,
346
428
  liquidityAccount: entry.request.account,
347
429
  allowedLiquidityAccounts: null,
348
430
  checks: { quote, request },
349
431
  isQuoteBasedExchange: false
350
432
  });
433
+ refunds = refundResult.refunds;
351
434
  for (const refund of refunds) {
352
435
  builder.send(block.account, refund.amount, refund.token);
353
436
  }
@@ -381,6 +464,7 @@ class KeetaFXAnchorQueuePipelineStage1 extends KeetaAnchorQueueRunner {
381
464
  }
382
465
  throw (error);
383
466
  }
467
+ const conversion = buildKeetaFXAnchorConversionSummary(expected, block, entry.request.account, refunds);
384
468
  /* Set the output and mark the job as pending so we can run the queue again and check for completion */
385
469
  return ({
386
470
  status: 'pending',
@@ -388,7 +472,8 @@ class KeetaFXAnchorQueuePipelineStage1 extends KeetaAnchorQueueRunner {
388
472
  blockhash: block.hash.toString(),
389
473
  blocks: swapBlocks.map(function (block) {
390
474
  return (Buffer.from(block.toBytes()).toString('base64'));
391
- })
475
+ }),
476
+ conversion: conversion
392
477
  }
393
478
  });
394
479
  }
@@ -411,6 +496,7 @@ class KeetaFXAnchorQueuePipeline extends KeetaAnchorQueuePipelineAdvanced {
411
496
  serverConfig;
412
497
  accounts;
413
498
  runners = {};
499
+ correlationIndex = null;
414
500
  extensions;
415
501
  successStageRunner = null;
416
502
  failureStageRunner = null;
@@ -510,6 +596,41 @@ class KeetaFXAnchorQueuePipeline extends KeetaAnchorQueuePipelineAdvanced {
510
596
  }
511
597
  this.runners[account.publicKeyAndTypeString] = runner;
512
598
  }
599
+ this.correlationIndex = await this.createQueue('correlation-index');
600
+ }
601
+ /**
602
+ * Record a correlation-id -> exchange-ID mapping so a swap can be resolved
603
+ * from the correlation id carried in its on-chain anchor external.
604
+ */
605
+ async registerCorrelation(correlationId, exchangeID) {
606
+ await super.init();
607
+ if (this.correlationIndex === null) {
608
+ throw (new Error('Correlation index not initialized'));
609
+ }
610
+ await this.correlationIndex.add({ exchangeID: String(exchangeID) }, { id: correlationId });
611
+ }
612
+ /**
613
+ * Resolve the exchange ID for a correlation id, or `undefined` when no
614
+ * exchange registered it.
615
+ */
616
+ async lookupCorrelation(correlationId) {
617
+ await super.init();
618
+ if (this.correlationIndex === null) {
619
+ throw (new Error('Correlation index not initialized'));
620
+ }
621
+ const entry = await this.correlationIndex.get(ConvertStringToRequestID(correlationId));
622
+ if (entry === null) {
623
+ return (undefined);
624
+ }
625
+ const request = entry.request;
626
+ if (typeof request !== 'object' || request === null || !('exchangeID' in request)) {
627
+ return (undefined);
628
+ }
629
+ const exchangeID = request.exchangeID;
630
+ if (typeof exchangeID !== 'string') {
631
+ return (undefined);
632
+ }
633
+ return (exchangeID);
513
634
  }
514
635
  getStage(_ignore_stageID) {
515
636
  throw (new Error('method not supported'));
@@ -1016,6 +1137,14 @@ export class KeetaNetFXAnchorHTTPServer extends BaseKeetaNetFXAnchorHTTPServer {
1016
1137
  request: conversionInput,
1017
1138
  expected: expectedConversion
1018
1139
  });
1140
+ /*
1141
+ * Index the correlation id carried in the swap block's anchor
1142
+ * external so the exchange is resolvable from chain history.
1143
+ */
1144
+ const correlationId = await correlationIdFromBlock(block, liquidityAccountInstance);
1145
+ if (correlationId !== undefined) {
1146
+ await instance.pipeline.registerCorrelation(correlationId, exchangeID);
1147
+ }
1019
1148
  const exchangeResponse = {
1020
1149
  ok: true,
1021
1150
  exchangeID: exchangeID.toString(),
@@ -1073,14 +1202,7 @@ export class KeetaNetFXAnchorHTTPServer extends BaseKeetaNetFXAnchorHTTPServer {
1073
1202
  output: JSON.stringify(exchangeResponse)
1074
1203
  });
1075
1204
  };
1076
- routes['GET /api/getExchangeStatus/:id'] = async function (params) {
1077
- if (params === undefined || params === null) {
1078
- throw (new KeetaAnchorUserError('Expected params'));
1079
- }
1080
- const exchangeID = params.get('id');
1081
- if (typeof exchangeID !== 'string') {
1082
- throw (new Error('Missing exchangeID in params'));
1083
- }
1205
+ const buildExchangeStatus = async function (exchangeID) {
1084
1206
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1085
1207
  const queueEntryInfo = await instance.pipeline.get(exchangeID);
1086
1208
  const exchangeResponse = (function () {
@@ -1108,12 +1230,17 @@ export class KeetaNetFXAnchorHTTPServer extends BaseKeetaNetFXAnchorHTTPServer {
1108
1230
  });
1109
1231
  }
1110
1232
  else {
1111
- return ({
1233
+ const completed = {
1112
1234
  ok: true,
1113
1235
  status: 'completed',
1114
1236
  exchangeID: exchangeID,
1115
1237
  blockhash: blockhash
1116
- });
1238
+ };
1239
+ const conversion = queueEntryInfo?.output?.conversion;
1240
+ if (conversion !== undefined) {
1241
+ completed.conversion = conversion;
1242
+ }
1243
+ return (completed);
1117
1244
  }
1118
1245
  }
1119
1246
  case 'failed_permanently':
@@ -1131,7 +1258,23 @@ export class KeetaNetFXAnchorHTTPServer extends BaseKeetaNetFXAnchorHTTPServer {
1131
1258
  assertNever(inputStatus);
1132
1259
  }
1133
1260
  })();
1134
- logger.debug('GET /api/getExchangeStatus/:id', 'Exchange Status for ID', exchangeID, 'is', exchangeResponse, 'based on jobInfo', queueEntryInfo);
1261
+ logger.debug('buildExchangeStatus', 'Exchange Status for ID', exchangeID, 'is', exchangeResponse, 'based on jobInfo', queueEntryInfo);
1262
+ return (exchangeResponse);
1263
+ };
1264
+ routes['GET /api/getExchangeStatus/:id'] = async function (params) {
1265
+ if (params === undefined || params === null) {
1266
+ throw (new KeetaAnchorUserError('Expected params'));
1267
+ }
1268
+ const id = params.get('id');
1269
+ if (typeof id !== 'string') {
1270
+ throw (new Error('Missing exchangeID in params'));
1271
+ }
1272
+ /*
1273
+ * Accept either an exchange id or a client correlation id.
1274
+ */
1275
+ const correlated = await instance.pipeline.lookupCorrelation(id);
1276
+ const exchangeID = correlated ?? id;
1277
+ const exchangeResponse = await buildExchangeStatus(exchangeID);
1135
1278
  return ({
1136
1279
  output: JSON.stringify(exchangeResponse)
1137
1280
  });
@@ -1275,7 +1418,7 @@ const assertKeetaFXAnchorQueueStage1RequestJSON = (() => { const _io0 = input =>
1275
1418
  }
1276
1419
  return input;
1277
1420
  }; })();
1278
- const assertKeetaFXAnchorQueueStage1ResponseOrNull = (() => { const _io0 = input => Array.isArray(input.blocks) && input.blocks.every(elem => "string" === typeof elem) && "string" === typeof input.blockhash; const _ao0 = (input, _path, _exceptionable = true) => ((Array.isArray(input.blocks) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1421
+ const assertKeetaFXAnchorQueueStage1ResponseOrNull = (() => { const _io0 = input => Array.isArray(input.blocks) && input.blocks.every(elem => "string" === typeof elem) && "string" === typeof input.blockhash && (undefined === input.conversion || "object" === typeof input.conversion && null !== input.conversion && _io1(input.conversion)); const _io1 = input => "object" === typeof input.from && null !== input.from && _io2(input.from) && ("object" === typeof input.to && null !== input.to && _io3(input.to)) && "string" === typeof input.liquidityProvider && (undefined === input.cost || "object" === typeof input.cost && null !== input.cost && _io4(input.cost)); const _io2 = input => "string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) && "string" === typeof input.amount; const _io3 = input => "string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) && "string" === typeof input.amount; const _io4 = input => "string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) && "string" === typeof input.amount; const _ao0 = (input, _path, _exceptionable = true) => ((Array.isArray(input.blocks) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1279
1422
  method: "typia.createAssert",
1280
1423
  path: _path + ".blocks",
1281
1424
  expected: "Array<string>",
@@ -1295,6 +1438,81 @@ const assertKeetaFXAnchorQueueStage1ResponseOrNull = (() => { const _io0 = input
1295
1438
  path: _path + ".blockhash",
1296
1439
  expected: "string",
1297
1440
  value: input.blockhash
1441
+ }, _errorFactory)) && (undefined === input.conversion || ("object" === typeof input.conversion && null !== input.conversion || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1442
+ method: "typia.createAssert",
1443
+ path: _path + ".conversion",
1444
+ expected: "(KeetaFXAnchorConversionSummary | undefined)",
1445
+ value: input.conversion
1446
+ }, _errorFactory)) && _ao1(input.conversion, _path + ".conversion", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1447
+ method: "typia.createAssert",
1448
+ path: _path + ".conversion",
1449
+ expected: "(KeetaFXAnchorConversionSummary | undefined)",
1450
+ value: input.conversion
1451
+ }, _errorFactory)); const _ao1 = (input, _path, _exceptionable = true) => (("object" === typeof input.from && null !== input.from || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1452
+ method: "typia.createAssert",
1453
+ path: _path + ".from",
1454
+ expected: "__type",
1455
+ value: input.from
1456
+ }, _errorFactory)) && _ao2(input.from, _path + ".from", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1457
+ method: "typia.createAssert",
1458
+ path: _path + ".from",
1459
+ expected: "__type",
1460
+ value: input.from
1461
+ }, _errorFactory)) && (("object" === typeof input.to && null !== input.to || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1462
+ method: "typia.createAssert",
1463
+ path: _path + ".to",
1464
+ expected: "__type.o1",
1465
+ value: input.to
1466
+ }, _errorFactory)) && _ao3(input.to, _path + ".to", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1467
+ method: "typia.createAssert",
1468
+ path: _path + ".to",
1469
+ expected: "__type.o1",
1470
+ value: input.to
1471
+ }, _errorFactory)) && ("string" === typeof input.liquidityProvider || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1472
+ method: "typia.createAssert",
1473
+ path: _path + ".liquidityProvider",
1474
+ expected: "string",
1475
+ value: input.liquidityProvider
1476
+ }, _errorFactory)) && (undefined === input.cost || ("object" === typeof input.cost && null !== input.cost || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1477
+ method: "typia.createAssert",
1478
+ path: _path + ".cost",
1479
+ expected: "(__type.o2 | undefined)",
1480
+ value: input.cost
1481
+ }, _errorFactory)) && _ao4(input.cost, _path + ".cost", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1482
+ method: "typia.createAssert",
1483
+ path: _path + ".cost",
1484
+ expected: "(__type.o2 | undefined)",
1485
+ value: input.cost
1486
+ }, _errorFactory)); const _ao2 = (input, _path, _exceptionable = true) => ("string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1487
+ method: "typia.createAssert",
1488
+ path: _path + ".token",
1489
+ expected: "(`keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}`)",
1490
+ value: input.token
1491
+ }, _errorFactory)) && ("string" === typeof input.amount || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1492
+ method: "typia.createAssert",
1493
+ path: _path + ".amount",
1494
+ expected: "string",
1495
+ value: input.amount
1496
+ }, _errorFactory)); const _ao3 = (input, _path, _exceptionable = true) => ("string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1497
+ method: "typia.createAssert",
1498
+ path: _path + ".token",
1499
+ expected: "(`keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}`)",
1500
+ value: input.token
1501
+ }, _errorFactory)) && ("string" === typeof input.amount || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1502
+ method: "typia.createAssert",
1503
+ path: _path + ".amount",
1504
+ expected: "string",
1505
+ value: input.amount
1506
+ }, _errorFactory)); const _ao4 = (input, _path, _exceptionable = true) => ("string" === typeof input.token && (RegExp(/^keeta_am(.*)/).test(input.token) || RegExp(/^keeta_an(.*)/).test(input.token) || RegExp(/^keeta_ao(.*)/).test(input.token) || RegExp(/^keeta_ap(.*)/).test(input.token) || RegExp(/^tyblocks_am(.*)/).test(input.token) || RegExp(/^tyblocks_an(.*)/).test(input.token) || RegExp(/^tyblocks_ao(.*)/).test(input.token) || RegExp(/^tyblocks_ap(.*)/).test(input.token)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1507
+ method: "typia.createAssert",
1508
+ path: _path + ".token",
1509
+ expected: "(`keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}`)",
1510
+ value: input.token
1511
+ }, _errorFactory)) && ("string" === typeof input.amount || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1512
+ method: "typia.createAssert",
1513
+ path: _path + ".amount",
1514
+ expected: "string",
1515
+ value: input.amount
1298
1516
  }, _errorFactory)); const __is = input => null === input || "object" === typeof input && null !== input && _io0(input); let _errorFactory; return (input, errorFactory) => {
1299
1517
  if (false === __is(input)) {
1300
1518
  _errorFactory = errorFactory;