@rango-dev/queue-manager-rango-preset 0.5.1-next.8 → 0.6.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/src/helpers.ts CHANGED
@@ -5,11 +5,16 @@ import {
5
5
  QueueType,
6
6
  } from '@rango-dev/queue-manager-core';
7
7
  import {
8
+ ArrayElement,
8
9
  BlockReason,
10
+ StepEventType,
9
11
  SwapActionTypes,
10
12
  SwapQueueContext,
11
13
  SwapQueueDef,
12
14
  SwapStorage,
15
+ StepExecutionEventStatus,
16
+ StepExecutionBlockedEventStatus,
17
+ Step,
13
18
  } from './types';
14
19
  import {
15
20
  getBlockChainNameFromId,
@@ -29,6 +34,7 @@ import {
29
34
  } from 'rango-sdk';
30
35
 
31
36
  import {
37
+ DEFAULT_ERROR_CODE,
32
38
  ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK,
33
39
  ERROR_MESSAGE_WAIT_FOR_WALLET,
34
40
  ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION,
@@ -36,7 +42,6 @@ import {
36
42
  import { Manager } from '@rango-dev/queue-manager-core';
37
43
  import { Status } from '@rango-dev/queue-manager-core';
38
44
  import {
39
- EventType,
40
45
  getCurrentBlockchainOf,
41
46
  getCurrentBlockchainOfOrNull,
42
47
  getScannerUrl,
@@ -59,6 +64,7 @@ import {
59
64
  } from './shared-errors';
60
65
  import { httpService } from './services';
61
66
  import { APIErrorCode, SignerErrorCode } from 'rango-types/lib';
67
+ import { notifier } from './services/eventEmitter';
62
68
 
63
69
  type WhenTaskBlocked = Parameters<NonNullable<SwapQueueDef['whenTaskBlocked']>>;
64
70
  type WhenTaskBlockedEvent = WhenTaskBlocked[0];
@@ -227,6 +233,9 @@ export const setCurrentStepTx = (
227
233
  case TransactionType.TRANSFER:
228
234
  currentStep.transferTransaction = transaction;
229
235
  break;
236
+ case TransactionType.TON:
237
+ currentStep.tonTransaction = transaction;
238
+ break;
230
239
  default:
231
240
  ((x: never) => {
232
241
  throw new Error(`${x} was unhandled!`);
@@ -299,9 +308,18 @@ export function updateSwapStatus({
299
308
  }): {
300
309
  swap: PendingSwap;
301
310
  step: PendingSwapStep | null;
311
+ failureType?: APIErrorCode;
302
312
  } {
303
313
  const swap = getStorage().swapDetails;
304
314
  const currentStep = getCurrentStep(swap);
315
+ const updatedResult: {
316
+ swap: PendingSwap;
317
+ step: PendingSwapStep | null;
318
+ failureType?: APIErrorCode;
319
+ } = {
320
+ swap,
321
+ step: currentStep,
322
+ };
305
323
  if (!!nextStepStatus && !!currentStep) currentStep.status = nextStepStatus;
306
324
 
307
325
  if (nextStatus) swap.status = nextStatus;
@@ -323,13 +341,20 @@ export function updateSwapStatus({
323
341
  const walletType = getRelatedWalletOrNull(swap, currentStep!)?.walletType;
324
342
  swap.extraMessageSeverity = MessageSeverity.error;
325
343
 
344
+ const failureType = mapAppErrorCodesToAPIErrorCode(errorCode);
345
+ updatedResult.failureType = failureType;
346
+
326
347
  httpService()
327
348
  .reportFailure({
328
349
  requestId: swap.requestId,
329
350
  step: currentStep?.id || 1,
330
- eventType: mapAppErrorCodesToAPIErrorCode(errorCode),
351
+ eventType: failureType,
331
352
  reason: errorReason || '',
332
- data: walletType ? { wallet: walletType } : undefined,
353
+ tags: walletType
354
+ ? {
355
+ wallet: walletType,
356
+ }
357
+ : undefined,
333
358
  })
334
359
  .then()
335
360
  .catch();
@@ -348,10 +373,7 @@ export function updateSwapStatus({
348
373
  swapDetails: swap,
349
374
  });
350
375
 
351
- return {
352
- swap,
353
- step: currentStep,
354
- };
376
+ return updatedResult;
355
377
  }
356
378
 
357
379
  /**
@@ -362,8 +384,6 @@ export function updateSwapStatus({
362
384
  export function setStepTransactionIds(
363
385
  { getStorage, setStorage }: ExecuterActions<SwapStorage, SwapActionTypes>,
364
386
  txId: string | null,
365
- notifier: SwapQueueContext['notifier'],
366
- eventType?: EventType,
367
387
  explorerUrl?: { url?: string; description?: string }
368
388
  ): void {
369
389
  const swap = getStorage().swapDetails;
@@ -380,22 +400,34 @@ export function setStepTransactionIds(
380
400
  description: explorerUrl.description || null,
381
401
  },
382
402
  ];
383
- if (eventType === 'check_tx_status') {
384
- swap.extraMessage = 'Checking transaction status ...';
385
- swap.extraMessageDetail = '';
386
- swap.extraMessageSeverity = MessageSeverity.info;
387
- } else if (eventType === 'check_approve_tx_status') {
388
- swap.extraMessage = 'Checking approve transaction status ...';
389
- swap.extraMessageDetail = '';
390
- swap.extraMessageSeverity = MessageSeverity.info;
391
- }
403
+
404
+ const isApproval = isApprovalCurrentStepTx(currentStep);
405
+
406
+ if (isApproval) swap.extraMessage = 'Checking approve transaction status ...';
407
+ else swap.extraMessage = 'Checking transaction status ...';
408
+
409
+ swap.extraMessageDetail = '';
410
+ swap.extraMessageSeverity = MessageSeverity.info;
392
411
 
393
412
  setStorage({
394
413
  ...getStorage(),
395
414
  swapDetails: swap,
396
415
  });
397
- if (eventType)
398
- notifier({ eventType: eventType, swap: swap, step: currentStep });
416
+
417
+ notifier({
418
+ event: {
419
+ type: StepEventType.TX_EXECUTION,
420
+ status: StepExecutionEventStatus.TX_SENT,
421
+ },
422
+ swap: swap,
423
+ step: currentStep,
424
+ });
425
+
426
+ notifier({
427
+ event: { type: StepEventType.CHECK_STATUS },
428
+ swap: swap,
429
+ step: currentStep,
430
+ });
399
431
  }
400
432
 
401
433
  /**
@@ -486,10 +518,7 @@ export function markRunningSwapAsSwitchingNetwork({
486
518
  export function markRunningSwapAsDependsOnOtherQueues({
487
519
  getStorage,
488
520
  setStorage,
489
- notifier,
490
- }: Pick<ExecuterActions, 'getStorage' | 'setStorage'> & {
491
- notifier: SwapQueueContext['notifier'];
492
- }):
521
+ }: Pick<ExecuterActions, 'getStorage' | 'setStorage'>):
493
522
  | {
494
523
  swap: PendingSwap;
495
524
  step: PendingSwapStep;
@@ -504,7 +533,10 @@ export function markRunningSwapAsDependsOnOtherQueues({
504
533
  currentStep.networkStatus = PendingSwapNetworkStatus.WaitingForQueue;
505
534
 
506
535
  notifier({
507
- eventType: 'waiting_for_queue',
536
+ event: {
537
+ type: StepEventType.TX_EXECUTION_BLOCKED,
538
+ status: StepExecutionBlockedEventStatus.WAITING_FOR_QUEUE,
539
+ },
508
540
  swap,
509
541
  step: currentStep,
510
542
  });
@@ -743,11 +775,23 @@ export function onBlockForConnectWallet(
743
775
  if (!ok) {
744
776
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
745
777
  const currentStep = getCurrentStep(swap)!;
746
- context.notifier({
747
- eventType:
748
- reason === 'account_miss_match'
749
- ? 'waiting_for_change_wallet_account'
750
- : 'waiting_for_connecting_wallet',
778
+ const { type: walletType, address } = getRequiredWallet(swap);
779
+ notifier({
780
+ event: {
781
+ type: StepEventType.TX_EXECUTION_BLOCKED,
782
+ ...(reason === 'account_miss_match'
783
+ ? {
784
+ status:
785
+ StepExecutionBlockedEventStatus.WAITING_FOR_CHANGE_WALLET_ACCOUNT,
786
+ requiredAccount: address ?? undefined,
787
+ }
788
+ : {
789
+ status:
790
+ StepExecutionBlockedEventStatus.WAITING_FOR_WALLET_CONNECT,
791
+ requiredWallet: walletType ?? undefined,
792
+ requiredAccount: address ?? undefined,
793
+ }),
794
+ },
751
795
  swap: swap,
752
796
  step: currentStep,
753
797
  });
@@ -790,9 +834,22 @@ export function onBlockForChangeNetwork(
790
834
  setStorage: queue.setStorage.bind(queue),
791
835
  });
792
836
 
837
+ const requiredNetwork = getCurrentBlockchainOfOrNull(swap, currentStep);
838
+
839
+ const requiredWallet = getRequiredWallet(swap).type;
840
+
841
+ const currentNetwork = requiredWallet
842
+ ? context.state(requiredWallet).network
843
+ : undefined;
844
+
793
845
  if (result) {
794
- context.notifier({
795
- eventType: 'waiting_for_network_change',
846
+ notifier({
847
+ event: {
848
+ type: StepEventType.TX_EXECUTION_BLOCKED,
849
+ status: StepExecutionBlockedEventStatus.WAITING_FOR_NETWORK_CHANGE,
850
+ requiredNetwork: requiredNetwork ?? undefined,
851
+ currentNetwork: currentNetwork ?? undefined,
852
+ },
796
853
  swap: result.swap,
797
854
  step: result.step,
798
855
  });
@@ -851,7 +908,6 @@ export function onDependsOnOtherQueues(
851
908
  markRunningSwapAsDependsOnOtherQueues({
852
909
  getStorage: queue.getStorage.bind(queue),
853
910
  setStorage: queue.setStorage.bind(queue),
854
- notifier: context.notifier,
855
911
  });
856
912
  return;
857
913
  }
@@ -882,7 +938,6 @@ export function onDependsOnOtherQueues(
882
938
  // TODO: Use key generator
883
939
  retryOn(
884
940
  `${type}-${network}:${address}`,
885
- context.notifier,
886
941
  manager,
887
942
  context.canSwitchNetworkTo
888
943
  );
@@ -915,7 +970,7 @@ export function singTransaction(
915
970
  ): void {
916
971
  const { setTransactionDataByHash } = inMemoryTransactionsData();
917
972
  const { getStorage, setStorage, failed, next, schedule, context } = actions;
918
- const { meta, getSigners, notifier, isMobileWallet } = context;
973
+ const { meta, getSigners, isMobileWallet } = context;
919
974
  const swap = getStorage().swapDetails;
920
975
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
921
976
  const currentStep = getCurrentStep(swap)!;
@@ -936,11 +991,6 @@ export function singTransaction(
936
991
  const tx = getCurrentStepTx(currentStep);
937
992
  const txType = tx?.type;
938
993
  const isApproval = isApprovalCurrentStepTx(currentStep);
939
- const isSmartContractCall = [
940
- TransactionType.EVM,
941
- TransactionType.STARKNET,
942
- TransactionType.TRON,
943
- ].includes(txType!);
944
994
 
945
995
  if (!tx || !txType) {
946
996
  const extraMessage = 'Unexpected Error: tx is null!';
@@ -954,7 +1004,11 @@ export function singTransaction(
954
1004
  errorCode: 'CLIENT_UNEXPECTED_BEHAVIOUR',
955
1005
  });
956
1006
  notifier({
957
- eventType: 'transfer_failed',
1007
+ event: {
1008
+ type: StepEventType.FAILED,
1009
+ reason: extraMessage,
1010
+ reasonCode: 'CLIENT_UNEXPECTED_BEHAVIOUR',
1011
+ },
958
1012
  ...updateResult,
959
1013
  });
960
1014
  failed();
@@ -968,9 +1022,9 @@ export function singTransaction(
968
1022
 
969
1023
  let nextStatus: SwapStatus | undefined,
970
1024
  nextStepStatus: StepStatus,
971
- eventType: EventType,
972
1025
  message: string,
973
- details: string;
1026
+ details: string,
1027
+ eventType: StepEventType;
974
1028
 
975
1029
  if (isApproval) {
976
1030
  message = `Waiting for approval of ${currentStep?.fromSymbol} coin ${
@@ -980,21 +1034,19 @@ export function singTransaction(
980
1034
  'Waiting for approve transaction to be mined and confirmed successfully';
981
1035
  nextStepStatus = 'waitingForApproval';
982
1036
  nextStatus = undefined;
983
- eventType = 'confirm_approve_contract';
1037
+ eventType = StepEventType.TX_EXECUTION;
984
1038
  } else if (hasAlreadyProceededToSign) {
985
1039
  message = 'Transaction is expired. Please try again.';
986
1040
  nextStepStatus = 'failed';
987
1041
  nextStatus = 'failed';
988
1042
  details = '';
989
- eventType = 'transaction_expired';
1043
+ eventType = StepEventType.FAILED;
990
1044
  } else {
991
1045
  message = 'Executing transaction ...';
992
1046
  nextStepStatus = 'running';
993
1047
  nextStatus = 'running';
994
1048
  details = `${mobileWallet ? 'Check your mobile phone!' : ''}`;
995
- eventType = isSmartContractCall
996
- ? 'calling_smart_contract'
997
- : 'confirm_transfer';
1049
+ eventType = StepEventType.TX_EXECUTION;
998
1050
  }
999
1051
 
1000
1052
  const updateResult = updateSwapStatus({
@@ -1009,10 +1061,21 @@ export function singTransaction(
1009
1061
  : hasAlreadyProceededToSign,
1010
1062
  errorCode: hasAlreadyProceededToSign ? 'TX_EXPIRED' : undefined,
1011
1063
  });
1012
- notifier({
1013
- eventType,
1014
- ...updateResult,
1015
- });
1064
+
1065
+ if (eventType === StepEventType.FAILED) {
1066
+ notifier({
1067
+ event: {
1068
+ type: eventType,
1069
+ reason: message,
1070
+ reasonCode: updateResult.failureType ?? DEFAULT_ERROR_CODE,
1071
+ },
1072
+ ...updateResult,
1073
+ });
1074
+ } else
1075
+ notifier({
1076
+ event: { type: eventType, status: StepExecutionEventStatus.SEND_TX },
1077
+ ...updateResult,
1078
+ });
1016
1079
 
1017
1080
  if (hasAlreadyProceededToSign) {
1018
1081
  failed();
@@ -1030,8 +1093,6 @@ export function singTransaction(
1030
1093
  setStepTransactionIds(
1031
1094
  actions,
1032
1095
  hash,
1033
- notifier,
1034
- isApproval ? 'check_approve_tx_status' : 'check_tx_status',
1035
1096
  explorerUrl
1036
1097
  ? { url: explorerUrl, description: isApproval ? 'Approve' : 'Swap' }
1037
1098
  : undefined
@@ -1048,15 +1109,12 @@ export function singTransaction(
1048
1109
  const { extraMessage, extraMessageDetail, extraMessageErrorCode } =
1049
1110
  prettifyErrorMessage(error);
1050
1111
 
1051
- // if it is an rpc error with details, send the log to sentry
1052
- if (
1053
- error &&
1054
- error?.root &&
1055
- error?.root?.message &&
1056
- error?.root?.code &&
1057
- error?.root?.reason
1058
- )
1059
- logRPCError(error.root, swap, currentStep, sourceWallet?.walletType);
1112
+ logRPCError(
1113
+ error?.trace?.stack || error?.trace || error?.root || error,
1114
+ swap,
1115
+ currentStep,
1116
+ sourceWallet?.walletType
1117
+ );
1060
1118
 
1061
1119
  const updateResult = updateSwapStatus({
1062
1120
  getStorage,
@@ -1067,14 +1125,13 @@ export function singTransaction(
1067
1125
  details: extraMessageDetail,
1068
1126
  errorCode: extraMessageErrorCode,
1069
1127
  });
1070
- const eventType =
1071
- extraMessageErrorCode === 'REJECTED_BY_USER'
1072
- ? 'contract_rejected'
1073
- : isSmartContractCall
1074
- ? 'smart_contract_call_failed'
1075
- : 'transfer_failed';
1128
+
1076
1129
  notifier({
1077
- eventType,
1130
+ event: {
1131
+ type: StepEventType.FAILED,
1132
+ reason: extraMessage,
1133
+ reasonCode: updateResult.failureType ?? DEFAULT_ERROR_CODE,
1134
+ },
1078
1135
  ...updateResult,
1079
1136
  });
1080
1137
  failed();
@@ -1087,7 +1144,6 @@ export function checkWaitingForConnectWalletChange(params: {
1087
1144
  wallet_network: string;
1088
1145
  manager?: Manager;
1089
1146
  evmChains: EvmBlockchainMeta[];
1090
- notifier: SwapQueueContext['notifier'];
1091
1147
  }): void {
1092
1148
  const { wallet_network, evmChains, manager } = params;
1093
1149
  const [wallet, network] = splitWalletNetwork(wallet_network);
@@ -1116,10 +1172,12 @@ export function checkWaitingForConnectWalletChange(params: {
1116
1172
  }
1117
1173
  );
1118
1174
 
1175
+ const requiredNetwork = getCurrentBlockchainOfOrNull(swap, currentStep);
1176
+
1119
1177
  if (
1120
1178
  currentStepRequiredWallet === wallet &&
1121
1179
  hasWaitingForConnect &&
1122
- getCurrentBlockchainOfOrNull(swap, currentStep) != network
1180
+ requiredNetwork != network
1123
1181
  ) {
1124
1182
  const queueInstance = q.list;
1125
1183
  const { type } = getRequiredWallet(swap);
@@ -1139,8 +1197,14 @@ export function checkWaitingForConnectWalletChange(params: {
1139
1197
  });
1140
1198
 
1141
1199
  if (result) {
1142
- params?.notifier({
1143
- eventType: 'waiting_for_network_change',
1200
+ notifier({
1201
+ event: {
1202
+ type: StepEventType.TX_EXECUTION_BLOCKED,
1203
+ status:
1204
+ StepExecutionBlockedEventStatus.WAITING_FOR_NETWORK_CHANGE,
1205
+ currentNetwork: network,
1206
+ requiredNetwork: requiredNetwork ?? undefined,
1207
+ },
1144
1208
  swap: result.swap,
1145
1209
  step: result.step,
1146
1210
  });
@@ -1213,21 +1277,26 @@ export function getRunningSwaps(manager: Manager): PendingSwap[] {
1213
1277
  * @param notifier
1214
1278
  * @returns
1215
1279
  */
1216
- export function resetRunningSwapNotifsOnPageLoad(
1217
- runningSwaps: PendingSwap[],
1218
- notifier: SwapQueueContext['notifier']
1219
- ) {
1280
+ export function resetRunningSwapNotifsOnPageLoad(runningSwaps: PendingSwap[]) {
1220
1281
  runningSwaps.forEach((swap) => {
1221
1282
  const currentStep = getCurrentStep(swap);
1222
- let eventType: EventType | undefined;
1283
+ const eventType = StepEventType.TX_EXECUTION_BLOCKED;
1284
+ let eventSubtype:
1285
+ | StepExecutionBlockedEventStatus.WAITING_FOR_QUEUE
1286
+ | StepExecutionBlockedEventStatus.WAITING_FOR_WALLET_CONNECT
1287
+ | undefined;
1223
1288
  if (currentStep?.networkStatus === PendingSwapNetworkStatus.WaitingForQueue)
1224
- eventType = 'waiting_for_queue';
1289
+ eventSubtype = StepExecutionBlockedEventStatus.WAITING_FOR_QUEUE;
1225
1290
  else if (swap?.status === 'running') {
1226
- eventType = 'waiting_for_connecting_wallet';
1291
+ eventSubtype = StepExecutionBlockedEventStatus.WAITING_FOR_WALLET_CONNECT;
1227
1292
  }
1228
1293
  if (!!eventType && !!notifier) {
1229
1294
  notifier({
1230
- eventType,
1295
+ event: {
1296
+ type: eventType,
1297
+ status:
1298
+ eventSubtype ?? StepExecutionBlockedEventStatus.WAITING_FOR_QUEUE,
1299
+ },
1231
1300
  swap: swap,
1232
1301
  step: currentStep,
1233
1302
  });
@@ -1248,7 +1317,6 @@ export function resetRunningSwapNotifsOnPageLoad(
1248
1317
  */
1249
1318
  export function retryOn(
1250
1319
  wallet_network: string,
1251
- notifier: SwapQueueContext['notifier'],
1252
1320
  manager?: Manager,
1253
1321
  canSwitchNetworkTo?: (type: WalletType, network: Network) => boolean,
1254
1322
  options = { fallbackToOnlyWallet: true }
@@ -1297,7 +1365,6 @@ export function retryOn(
1297
1365
  markRunningSwapAsDependsOnOtherQueues({
1298
1366
  getStorage: currentQueue.getStorage.bind(currentQueue),
1299
1367
  setStorage: currentQueue.setStorage.bind(currentQueue),
1300
- notifier: notifier,
1301
1368
  });
1302
1369
  }
1303
1370
  }
@@ -1353,8 +1420,49 @@ export function cancelSwap(
1353
1420
  nextStepStatus: 'failed',
1354
1421
  errorCode: 'USER_CANCEL',
1355
1422
  });
1423
+
1424
+ notifier({
1425
+ event: {
1426
+ type: StepEventType.FAILED,
1427
+ reasonCode: 'USER_CANCEL',
1428
+ reason: updateResult.swap.extraMessage ?? undefined,
1429
+ },
1430
+
1431
+ swap: updateResult.swap,
1432
+ step: updateResult.step,
1433
+ });
1434
+
1356
1435
  reset();
1357
1436
  if (manager) manager?.retry();
1358
1437
 
1359
1438
  return updateResult;
1360
1439
  }
1440
+
1441
+ export function getLastSuccessfulStep<T extends { status: StepStatus }[]>(
1442
+ steps: T
1443
+ ): ArrayElement<T> | undefined {
1444
+ return steps
1445
+ .slice()
1446
+ .reverse()
1447
+ .find((step) => step.status === 'success') as ArrayElement<T> | undefined;
1448
+ }
1449
+
1450
+ export function getFailedStep<T extends { status: StepStatus }[]>(
1451
+ steps: T
1452
+ ): ArrayElement<T> | undefined {
1453
+ return steps
1454
+ .slice()
1455
+ .reverse()
1456
+ .find((step) => step.status === 'failed') as ArrayElement<T> | undefined;
1457
+ }
1458
+
1459
+ export function isApprovalTX(step: Step): boolean {
1460
+ const { transaction } = step;
1461
+ const approvalTx =
1462
+ (transaction?.type === TransactionType.EVM && transaction.isApprovalTx) ||
1463
+ (transaction?.type === TransactionType.STARKNET &&
1464
+ transaction.isApprovalTx) ||
1465
+ (transaction?.type === TransactionType.TRON && transaction.isApprovalTx);
1466
+
1467
+ return approvalTx;
1468
+ }
package/src/hooks.ts CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  } from './helpers';
8
8
  import { migrated, migration } from './migration';
9
9
  import { UseQueueManagerParams } from './types';
10
+ import { eventEmitter } from './services/eventEmitter';
10
11
 
11
12
  let isCalled = 0;
12
13
 
@@ -54,14 +55,8 @@ function useQueueManager(params: UseQueueManagerParams): void {
54
55
  evmChains: params.evmChains,
55
56
  wallet_network: params.lastConnectedWallet,
56
57
  manager,
57
- notifier: params.notifier,
58
58
  });
59
- retryOn(
60
- params.lastConnectedWallet,
61
- params.notifier,
62
- manager,
63
- params.canSwitchNetworkTo
64
- );
59
+ retryOn(params.lastConnectedWallet, manager, params.canSwitchNetworkTo);
65
60
  }
66
61
  }, [params.lastConnectedWallet]);
67
62
 
@@ -78,4 +73,8 @@ function useQueueManager(params: UseQueueManagerParams): void {
78
73
  }, [params.disconnectedWallet]);
79
74
  }
80
75
 
81
- export { useQueueManager, useMigration };
76
+ function useEvents() {
77
+ return eventEmitter;
78
+ }
79
+
80
+ export { useQueueManager, useMigration, useEvents };
package/src/index.ts CHANGED
@@ -3,13 +3,39 @@ import { SwapQueueDef } from './types';
3
3
  import { swapQueueDef } from './queueDef';
4
4
 
5
5
  export { PrettyError, prettifyErrorMessage } from './shared-errors';
6
- export type { SwapQueueContext, SwapStorage } from './types';
6
+ export type {
7
+ SwapQueueContext,
8
+ SwapStorage,
9
+ RouteExecutionEvents,
10
+ Route,
11
+ Step,
12
+ RouteEvent,
13
+ StepEvent,
14
+ EventSeverity,
15
+ RouteStartedEvent,
16
+ RouteSucceededEvent,
17
+ RouteFailedEvent,
18
+ StepStartedEvent,
19
+ StepSucceededEvent,
20
+ StepFailedEvent,
21
+ StepTxExecutionUpdatedEvent,
22
+ StepTxExecutionBlockedEvent,
23
+ StepCheckStatusEvent,
24
+ StepApprovalTxSucceededEvent,
25
+ StepOutputRevealedEvent,
26
+ } from './types';
27
+ export {
28
+ MainEvents,
29
+ StepEventType,
30
+ RouteEventType,
31
+ StepExecutionEventStatus,
32
+ StepExecutionBlockedEventStatus,
33
+ } from './types';
7
34
  export type {
8
35
  PendingSwapWithQueueID,
9
36
  PendingSwapStep,
10
37
  PendingSwap,
11
38
  EventType,
12
- SwapProgressNotification,
13
39
  } from './shared';
14
40
  export {
15
41
  getCurrentBlockchainOfOrNull,
@@ -29,8 +55,9 @@ export {
29
55
  getRunningSwaps,
30
56
  splitWalletNetwork,
31
57
  resetRunningSwapNotifsOnPageLoad,
58
+ isApprovalTX,
32
59
  } from './helpers';
33
- export { useMigration, useQueueManager } from './hooks';
60
+ export { useMigration, useQueueManager, useEvents } from './hooks';
34
61
 
35
62
  export function makeQueueDefinition(configs: Configs): SwapQueueDef {
36
63
  initConfig(configs);