@pushchain/core 5.1.5-alpha.0 → 5.1.5

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 (86) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/package.json +1 -1
  3. package/src/lib/constants/abi/index.d.ts +2 -0
  4. package/src/lib/constants/abi/index.js +6 -1
  5. package/src/lib/constants/abi/uniswap-v3-router.evm.d.ts +58 -0
  6. package/src/lib/constants/abi/uniswap-v3-router.evm.js +41 -0
  7. package/src/lib/constants/abi/wpc.evm.d.ts +24 -0
  8. package/src/lib/constants/abi/wpc.evm.js +27 -0
  9. package/src/lib/constants/chain.d.ts +1 -0
  10. package/src/lib/constants/chain.js +8 -6
  11. package/src/lib/constants/tokens.js +3 -3
  12. package/src/lib/generated/uexecutor/v2/types.d.ts +14 -0
  13. package/src/lib/generated/uexecutor/v2/types.js +96 -3
  14. package/src/lib/orchestrator/internals/cascade.d.ts +1 -1
  15. package/src/lib/orchestrator/internals/cascade.js +556 -225
  16. package/src/lib/orchestrator/internals/confirmation.js +60 -15
  17. package/src/lib/orchestrator/internals/context.d.ts +23 -0
  18. package/src/lib/orchestrator/internals/context.js +54 -0
  19. package/src/lib/orchestrator/internals/execute-funds-only.js +47 -21
  20. package/src/lib/orchestrator/internals/execute-funds-payload.js +53 -31
  21. package/src/lib/orchestrator/internals/execute-standard.js +137 -26
  22. package/src/lib/orchestrator/internals/gas-calculator.d.ts +5 -2
  23. package/src/lib/orchestrator/internals/gas-calculator.js +59 -11
  24. package/src/lib/orchestrator/internals/gas-usd-sizer.d.ts +53 -0
  25. package/src/lib/orchestrator/internals/gas-usd-sizer.js +165 -0
  26. package/src/lib/orchestrator/internals/helpers.js +2 -0
  27. package/src/lib/orchestrator/internals/inbound-tracker.d.ts +83 -0
  28. package/src/lib/orchestrator/internals/inbound-tracker.js +322 -0
  29. package/src/lib/orchestrator/internals/index.d.ts +3 -1
  30. package/src/lib/orchestrator/internals/index.js +8 -2
  31. package/src/lib/orchestrator/internals/outbound-sync.d.ts +32 -1
  32. package/src/lib/orchestrator/internals/outbound-sync.js +154 -17
  33. package/src/lib/orchestrator/internals/pc-usd-oracle.d.ts +28 -0
  34. package/src/lib/orchestrator/internals/pc-usd-oracle.js +285 -0
  35. package/src/lib/orchestrator/internals/progress-route-hooks.d.ts +23 -0
  36. package/src/lib/orchestrator/internals/progress-route-hooks.js +72 -0
  37. package/src/lib/orchestrator/internals/push-chain-tx.d.ts +27 -1
  38. package/src/lib/orchestrator/internals/push-chain-tx.js +111 -15
  39. package/src/lib/orchestrator/internals/rescue.js +1 -1
  40. package/src/lib/orchestrator/internals/response-builder.d.ts +5 -0
  41. package/src/lib/orchestrator/internals/response-builder.js +252 -53
  42. package/src/lib/orchestrator/internals/route-handlers.js +480 -206
  43. package/src/lib/orchestrator/internals/tx-transformer.js +293 -35
  44. package/src/lib/orchestrator/orchestrator.d.ts +7 -1
  45. package/src/lib/orchestrator/orchestrator.js +108 -56
  46. package/src/lib/orchestrator/orchestrator.types.d.ts +120 -5
  47. package/src/lib/orchestrator/payload-builders.d.ts +16 -0
  48. package/src/lib/orchestrator/payload-builders.js +6 -5
  49. package/src/lib/orchestrator/route-detector.js +20 -8
  50. package/src/lib/orchestrator/svm-idl/normalize-address.d.ts +19 -0
  51. package/src/lib/orchestrator/svm-idl/normalize-address.js +56 -0
  52. package/src/lib/orchestrator/svm-idl/registry.d.ts +13 -4
  53. package/src/lib/orchestrator/svm-idl/registry.js +15 -14
  54. package/src/lib/orchestrator/svm-idl/resolve.js +5 -2
  55. package/src/lib/progress-hook/progress-hook.d.ts +28 -0
  56. package/src/lib/progress-hook/progress-hook.js +555 -101
  57. package/src/lib/progress-hook/progress-hook.types.d.ts +76 -24
  58. package/src/lib/progress-hook/progress-hook.types.js +74 -29
  59. package/src/lib/push-client/push-client.d.ts +7 -0
  60. package/src/lib/push-client/push-client.js +18 -1
  61. package/src/lib/universal-tx-detector/__tests__/fixtures/builders.d.ts +32 -0
  62. package/src/lib/universal-tx-detector/__tests__/fixtures/builders.js +65 -0
  63. package/src/lib/universal-tx-detector/__tests__/fixtures/scenarios.d.ts +72 -0
  64. package/src/lib/universal-tx-detector/__tests__/fixtures/scenarios.js +669 -0
  65. package/src/lib/universal-tx-detector/auto-detect.d.ts +37 -0
  66. package/src/lib/universal-tx-detector/auto-detect.js +112 -0
  67. package/src/lib/universal-tx-detector/cascade.d.ts +64 -0
  68. package/src/lib/universal-tx-detector/cascade.js +254 -0
  69. package/src/lib/universal-tx-detector/child-inbounds.d.ts +58 -0
  70. package/src/lib/universal-tx-detector/child-inbounds.js +145 -0
  71. package/src/lib/universal-tx-detector/classify.d.ts +33 -0
  72. package/src/lib/universal-tx-detector/classify.js +228 -0
  73. package/src/lib/universal-tx-detector/detector-svm.d.ts +46 -0
  74. package/src/lib/universal-tx-detector/detector-svm.js +324 -0
  75. package/src/lib/universal-tx-detector/detector.d.ts +13 -0
  76. package/src/lib/universal-tx-detector/detector.js +233 -0
  77. package/src/lib/universal-tx-detector/events.d.ts +765 -0
  78. package/src/lib/universal-tx-detector/events.js +241 -0
  79. package/src/lib/universal-tx-detector/index.d.ts +18 -0
  80. package/src/lib/universal-tx-detector/index.js +36 -0
  81. package/src/lib/universal-tx-detector/svm-events.d.ts +41 -0
  82. package/src/lib/universal-tx-detector/svm-events.js +68 -0
  83. package/src/lib/universal-tx-detector/types.d.ts +100 -0
  84. package/src/lib/universal-tx-detector/types.js +3 -0
  85. package/src/lib/utils.d.ts +30 -13
  86. package/src/lib/utils.js +47 -21
@@ -18,10 +18,10 @@ const context_2 = require("./context");
18
18
  function waitForEvmConfirmationsWithCountdown(ctx, evmClient, txHash, confirmations, timeoutMs) {
19
19
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
20
  if (confirmations <= 0) {
21
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03_02, 0, 0);
21
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_02, 0, 0);
22
22
  return;
23
23
  }
24
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03, confirmations);
24
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03, confirmations);
25
25
  const start = Date.now();
26
26
  const receipt = yield evmClient.publicClient.waitForTransactionReceipt({
27
27
  hash: txHash,
@@ -33,7 +33,7 @@ function waitForEvmConfirmationsWithCountdown(ctx, evmClient, txHash, confirmati
33
33
  const currentBlock = yield evmClient.publicClient.getBlockNumber();
34
34
  if (currentBlock >= targetBlock) {
35
35
  if (lastEmitted < confirmations) {
36
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03_02, confirmations, confirmations);
36
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_02, confirmations, confirmations);
37
37
  }
38
38
  return;
39
39
  }
@@ -41,8 +41,8 @@ function waitForEvmConfirmationsWithCountdown(ctx, evmClient, txHash, confirmati
41
41
  const completed = Math.max(1, confirmations - remaining + 1);
42
42
  if (completed > lastEmitted) {
43
43
  (0, context_2.fireProgressHook)(ctx, completed >= confirmations
44
- ? progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03_02
45
- : progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03_01, completed, confirmations);
44
+ ? progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_02
45
+ : progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_01, completed, confirmations);
46
46
  lastEmitted = completed;
47
47
  if (completed >= confirmations)
48
48
  return;
@@ -57,10 +57,10 @@ function waitForEvmConfirmationsWithCountdown(ctx, evmClient, txHash, confirmati
57
57
  function waitForSvmConfirmationsWithCountdown(ctx, svmClient, txSignature, confirmations, timeoutMs) {
58
58
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
59
59
  if (confirmations <= 0) {
60
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03_02, 0, 0);
60
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_02, 0, 0);
61
61
  return;
62
62
  }
63
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03, confirmations);
63
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03, confirmations);
64
64
  const start = Date.now();
65
65
  let lastConfirmed = 0;
66
66
  // eslint-disable-next-line no-constant-condition
@@ -81,13 +81,13 @@ function waitForSvmConfirmationsWithCountdown(ctx, svmClient, txSignature, confi
81
81
  if (currentConfirms > lastConfirmed) {
82
82
  const clamped = currentConfirms >= confirmations ? confirmations : currentConfirms;
83
83
  (0, context_2.fireProgressHook)(ctx, clamped >= confirmations
84
- ? progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03_02
85
- : progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03_01, Math.max(1, clamped), confirmations);
84
+ ? progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_02
85
+ : progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_01, Math.max(1, clamped), confirmations);
86
86
  lastConfirmed = currentConfirms;
87
87
  }
88
88
  if (hasEnoughConfirmations || isFinalized) {
89
89
  if (lastConfirmed < confirmations) {
90
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_03_02, confirmations, confirmations);
90
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_02, confirmations, confirmations);
91
91
  }
92
92
  return;
93
93
  }
@@ -103,17 +103,62 @@ function waitForLockerFeeConfirmation(ctx, txHashBytes) {
103
103
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
104
104
  const chain = ctx.universalSigner.account.chain;
105
105
  const { vm, defaultRPC, fastConfirmations, timeout } = chain_1.CHAIN_INFO[chain];
106
- const rpcUrls = ctx.rpcUrls[chain] || defaultRPC;
106
+ // Poll silently — the fee-lock path fires SEND-TX-105-02 as its terminal
107
+ // confirmation marker; emitting 106-xx here would leak funds-bridge hooks
108
+ // into a non-funds-bridge path. Uses the same underlying RPC wait as the
109
+ // funds-bridge confirmation helpers but without the 106-03 / 106-03-02
110
+ // emissions.
107
111
  switch (vm) {
108
112
  case enums_1.VM.EVM: {
109
113
  const evmClient = (0, context_1.getOriginEvmClient)(ctx);
110
- yield waitForEvmConfirmationsWithCountdown(ctx, evmClient, (0, viem_1.bytesToHex)(txHashBytes), fastConfirmations, timeout);
111
- return;
114
+ const txHash = (0, viem_1.bytesToHex)(txHashBytes);
115
+ const receipt = yield evmClient.publicClient.waitForTransactionReceipt({
116
+ hash: txHash,
117
+ });
118
+ if (fastConfirmations <= 1)
119
+ return;
120
+ const targetBlock = receipt.blockNumber + BigInt(fastConfirmations);
121
+ const start = Date.now();
122
+ // eslint-disable-next-line no-constant-condition
123
+ while (true) {
124
+ const currentBlock = yield evmClient.publicClient.getBlockNumber();
125
+ if (currentBlock >= targetBlock)
126
+ return;
127
+ if (Date.now() - start > timeout) {
128
+ throw new Error(`Timeout: fee-lock tx ${txHash} not confirmed with ${fastConfirmations} confirmations within ${timeout} ms`);
129
+ }
130
+ yield new Promise((r) => setTimeout(r, 12000));
131
+ }
112
132
  }
113
133
  case enums_1.VM.SVM: {
134
+ const rpcUrls = ctx.rpcUrls[chain] || defaultRPC;
114
135
  const svmClient = new svm_client_1.SvmClient({ rpcUrls });
115
- yield waitForSvmConfirmationsWithCountdown(ctx, svmClient, bs58_1.bs58.encode(Buffer.from(txHashBytes)), fastConfirmations, timeout);
116
- return;
136
+ const signature = bs58_1.bs58.encode(Buffer.from(txHashBytes));
137
+ const start = Date.now();
138
+ // eslint-disable-next-line no-constant-condition
139
+ while (true) {
140
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
141
+ const connection = svmClient.connections[
142
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
+ svmClient.currentConnectionIndex];
144
+ const { value } = yield connection.getSignatureStatuses([signature]);
145
+ const status = value[0];
146
+ if (status) {
147
+ if (status.err) {
148
+ throw new Error(`SVM fee-lock tx ${signature} failed: ${JSON.stringify(status.err)}`);
149
+ }
150
+ const isFinalized = status.confirmationStatus === 'finalized' ||
151
+ status.confirmations === null;
152
+ const hasEnough = status.confirmations != null &&
153
+ status.confirmations >= fastConfirmations;
154
+ if (isFinalized || hasEnough)
155
+ return;
156
+ }
157
+ if (Date.now() - start > timeout) {
158
+ throw new Error(`Timeout: fee-lock tx ${signature} not confirmed with ${fastConfirmations} confirmations within ${timeout} ms`);
159
+ }
160
+ yield new Promise((r) => setTimeout(r, 500));
161
+ }
117
162
  }
118
163
  default:
119
164
  throw new Error(`Unsupported VM for tx confirmation: ${vm}`);
@@ -10,6 +10,7 @@ import type { UniversalSigner } from '../../universal/universal.types';
10
10
  import type { CHAIN, PUSH_NETWORK } from '../../constants/enums';
11
11
  import type { ProgressEvent } from '../../progress-hook/progress-hook.types';
12
12
  import type { AccountStatus } from '../orchestrator.types';
13
+ import { TransactionRoute } from '../route-detector';
13
14
  import { EvmClient } from '../../vm-client/evm-client';
14
15
  export interface OrchestratorContext {
15
16
  readonly pushClient: PushClient;
@@ -18,10 +19,26 @@ export interface OrchestratorContext {
18
19
  readonly rpcUrls: Partial<Record<CHAIN, string[]>>;
19
20
  readonly printTraces: boolean;
20
21
  progressHook?: (progress: ProgressEvent) => void;
22
+ /**
23
+ * The transaction route currently being executed. Set by
24
+ * `Orchestrator.execute()` and `Orchestrator.trackTransaction()` before any
25
+ * submodule fires progress hooks, so route-aware emission code can pick the
26
+ * correct ID range (101 / 201 / 301). Undefined when no transaction is in
27
+ * flight (e.g. during account-status reads).
28
+ */
29
+ currentRoute?: TransactionRoute;
21
30
  ueaVersionCache?: string;
22
31
  accountStatusCache: AccountStatus | null;
23
32
  /** Cached origin chain EvmClient — avoids creating new clients per call site */
24
33
  _originEvmClient?: EvmClient;
34
+ /**
35
+ * Set to `true` by inner route handlers after they emit a terminal-ish
36
+ * error hook (104-04 / 204-04 / 304-04 / 199-02 via execute-standard).
37
+ * Checked by `Orchestrator.execute()`'s outer catch so it doesn't fire a
38
+ * second terminal (199-02 / 299-02 / 399-02) on top of the inner one.
39
+ * Reset to `false` at the start of each `execute()` call.
40
+ */
41
+ _routeTerminalEmitted?: boolean;
25
42
  }
26
43
  /**
27
44
  * Returns (and caches) an EvmClient for the signer's origin chain.
@@ -34,5 +51,11 @@ export declare function getOriginEvmClient(ctx: OrchestratorContext): EvmClient;
34
51
  export declare function printLog(ctx: OrchestratorContext, msg: string): void;
35
52
  /**
36
53
  * Fires a progress hook event by ID, forwarding args to the hook factory.
54
+ *
55
+ * Suppresses Route 1 IDs when the active route is not R1 — the inner R1
56
+ * execute pipeline still calls fireProgressHook for events like 101 / 107 /
57
+ * 199_01, but those describe a Push-perspective view that doesn't match the
58
+ * R2/R3/R4 lifecycle the consumer is observing. Route handlers emit the
59
+ * route-specific IDs (201/207/301/307/etc.) explicitly.
37
60
  */
38
61
  export declare function fireProgressHook(ctx: OrchestratorContext, hookId: string, ...args: any[]): void;
@@ -11,9 +11,11 @@ exports.getOriginEvmClient = getOriginEvmClient;
11
11
  exports.printLog = printLog;
12
12
  exports.fireProgressHook = fireProgressHook;
13
13
  const tslib_1 = require("tslib");
14
+ const route_detector_1 = require("../route-detector");
14
15
  const chain_1 = require("../../constants/chain");
15
16
  const evm_client_1 = require("../../vm-client/evm-client");
16
17
  const progress_hook_1 = tslib_1.__importDefault(require("../../progress-hook/progress-hook"));
18
+ const progress_hook_types_1 = require("../../progress-hook/progress-hook.types");
17
19
  /**
18
20
  * Returns (and caches) an EvmClient for the signer's origin chain.
19
21
  * Avoids creating new EvmClient instances in lockFee, confirmation, fetchOriginTx, etc.
@@ -35,10 +37,62 @@ function printLog(ctx, msg) {
35
37
  console.log(`[Orchestrator] ${msg}`);
36
38
  }
37
39
  }
40
+ /**
41
+ * IDs in the Route 1 range (101–199 + the funds/payload sub-IDs). When the
42
+ * orchestrator is executing a non-R1 route, these IDs are suppressed at the
43
+ * fire boundary so emission code in the inner R1 execute pipeline doesn't
44
+ * leak Route 1 events into a Route 2/3/4 progress stream. The route-specific
45
+ * IDs (201/207/299, 301/307/399, etc.) are emitted explicitly by the route
46
+ * handlers and by `wait()` in response-builder.ts.
47
+ *
48
+ * Exceptions kept in the stream regardless of route:
49
+ * - All UEA migration hooks.
50
+ *
51
+ * Separately, the intermediate Push-success markers 199-99-99 (R3) and
52
+ * 299-99 (R2) are suppressed at `fanOut` in response-builder.ts — they're
53
+ * internal transition signals, not consumer-facing spec events.
54
+ */
55
+ const R1_SUPPRESSED_IN_NON_R1 = new Set([
56
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_101,
57
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_102_01,
58
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_102_02,
59
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_01,
60
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_02,
61
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_01,
62
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_02,
63
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_03,
64
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_04,
65
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_105_01,
66
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_105_02,
67
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_01,
68
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_02,
69
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03,
70
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_01,
71
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_03_02,
72
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_04,
73
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_05,
74
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_06,
75
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_107,
76
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_01,
77
+ progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_02,
78
+ ]);
79
+ function isR1Route(route) {
80
+ return route === undefined || route === route_detector_1.TransactionRoute.UOA_TO_PUSH;
81
+ }
38
82
  /**
39
83
  * Fires a progress hook event by ID, forwarding args to the hook factory.
84
+ *
85
+ * Suppresses Route 1 IDs when the active route is not R1 — the inner R1
86
+ * execute pipeline still calls fireProgressHook for events like 101 / 107 /
87
+ * 199_01, but those describe a Push-perspective view that doesn't match the
88
+ * R2/R3/R4 lifecycle the consumer is observing. Route handlers emit the
89
+ * route-specific IDs (201/207/301/307/etc.) explicitly.
40
90
  */
41
91
  function fireProgressHook(ctx, hookId, ...args) {
92
+ if (!isR1Route(ctx.currentRoute) &&
93
+ R1_SUPPRESSED_IN_NON_R1.has(hookId)) {
94
+ return;
95
+ }
42
96
  const hookEntry = progress_hook_1.default[hookId];
43
97
  const hookPayload = hookEntry(...args);
44
98
  printLog(ctx, hookPayload.message);
@@ -37,7 +37,7 @@ function executeFundsOnly(ctx, execute, eventBuffer, getResponseCallbacks) {
37
37
  if (!helpers_1.SUPPORTED_GATEWAY_CHAINS.includes(chain)) {
38
38
  throw new Error(`Funds bridging is not supported on chain ${chain}. Supported chains: ${helpers_1.SUPPORTED_GATEWAY_CHAINS.join(', ')}`);
39
39
  }
40
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_01, chain, ctx.universalSigner.account.address);
40
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_101, chain, ctx.universalSigner.account.address);
41
41
  const { defaultRPC, lockerContract } = chain_1.CHAIN_INFO[chain];
42
42
  const rpcUrls = ctx.rpcUrls[chain] || defaultRPC;
43
43
  // Resolve token: default to native token based on VM
@@ -97,10 +97,10 @@ function executeFundsOnlyEvm(ctx, execute, eventBuffer, transformFn, chain, rpcU
97
97
  const ueaBalanceForGas = yield ctx.pushClient.getBalance(ueaAddress);
98
98
  const nativeAmount = yield (0, gas_calculator_1.calculateNativeAmountForDeposit)(ctx, chain, BigInt(0), ueaBalanceForGas);
99
99
  (0, context_2.printLog)(ctx, `sendFunds — nativeAmount: ${nativeAmount.toString()}, ueaBalanceForGas: ${ueaBalanceForGas.toString()}`);
100
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_01);
101
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_02, ueaAddress, deployed);
100
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_01);
101
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_02, ueaAddress, deployed);
102
102
  (0, context_2.printLog)(ctx, `UEA resolved: ${ueaAddress}, deployed: ${deployed}`);
103
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_01, execute.funds.amount, execute.funds.token.decimals, symbol);
103
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_01, execute.funds.amount, execute.funds.token.decimals, symbol);
104
104
  // Approve gateway to pull tokens if ERC-20
105
105
  if (execute.funds.token.mechanism === 'approve') {
106
106
  yield (0, gas_calculator_1.ensureErc20Allowance)(ctx, evmClient, tokenAddr, gatewayAddress, execute.funds.amount);
@@ -119,21 +119,35 @@ function executeFundsOnlyEvm(ctx, execute, eventBuffer, transformFn, chain, rpcU
119
119
  txHash = yield (0, gateway_client_1.sendGatewayTxWithFallback)(ctx, evmClient, gatewayAddress, req, ctx.universalSigner, isNative ? nativeAmount + bridgeAmount : nativeAmount);
120
120
  }
121
121
  catch (err) {
122
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_04_04);
122
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_04);
123
123
  throw err;
124
124
  }
125
125
  const originTx = yield (0, helpers_2.fetchOriginChainTransactionForProgress)(ctx, chain, txHash, txHash);
126
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_02, txHash, bridgeAmount, execute.funds.token.decimals, symbol, originTx);
126
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_02, txHash, bridgeAmount, execute.funds.token.decimals, symbol, originTx);
127
127
  yield (0, confirmation_1.waitForEvmConfirmationsWithCountdown)(ctx, evmClient, txHash, chain_1.CHAIN_INFO[chain].confirmations, chain_1.CHAIN_INFO[chain].timeout);
128
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_04);
129
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_05);
128
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_04);
129
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_05);
130
130
  (0, context_2.printLog)(ctx, 'sendFunds — querying Push Chain status: ' + JSON.stringify({
131
131
  txHash, evmGatewayMethod: execute.to === ueaAddress ? 'sendFunds' : 'sendTxWithFunds',
132
132
  }));
133
- const pushChainUniversalTx = yield (0, response_builder_1.queryUniversalTxStatusFromGatewayTx)(ctx, evmClient, gatewayAddress, txHash, execute.to === ueaAddress ? 'sendFunds' : 'sendTxWithFunds');
134
- const response = yield (0, push_chain_tx_1.extractPcTxAndTransform)(ctx, pushChainUniversalTx, txHash, eventBuffer, 'sendFunds', transformFn);
135
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_06, bridgeAmount, execute.funds.token.decimals, symbol);
136
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_99_01, [response]);
133
+ let response;
134
+ try {
135
+ const pushChainUniversalTx = yield (0, response_builder_1.queryUniversalTxStatusFromGatewayTx)(ctx, evmClient, gatewayAddress, txHash, execute.to === ueaAddress ? 'sendFunds' : 'sendTxWithFunds');
136
+ // extractPcTxAndTransform fires 199-02 itself on pcTx FAILED; only emit
137
+ // for non-typed failures (RPC lookup error, timeout).
138
+ response = yield (0, push_chain_tx_1.extractPcTxAndTransform)(ctx, pushChainUniversalTx, txHash, eventBuffer, 'sendFunds', transformFn);
139
+ }
140
+ catch (err) {
141
+ if (!(err instanceof push_chain_tx_1.PushChainExecutionError)) {
142
+ const errMsg = err instanceof Error ? err.message : String(err);
143
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_02, errMsg);
144
+ throw new push_chain_tx_1.PushChainExecutionError(errMsg, { gatewayTxHash: txHash });
145
+ }
146
+ throw err;
147
+ }
148
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_06, bridgeAmount, execute.funds.token.decimals, symbol);
149
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_107);
150
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_01, [response]);
137
151
  return response;
138
152
  });
139
153
  }
@@ -154,10 +168,10 @@ function executeFundsOnlySvm(ctx, execute, eventBuffer, transformFn, chain, rpcU
154
168
  throw new Error('Pay-with token is not supported on Solana');
155
169
  }
156
170
  const recipientEvm20 = Array.from(Buffer.from(execute.to.slice(2).padStart(40, '0'), 'hex').subarray(0, 20));
157
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_01);
171
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_01);
158
172
  const ueaAddress = (0, uea_manager_1.computeUEAOffchain)(ctx);
159
173
  const { nonce, deployed } = yield (0, uea_manager_1.getUeaStatusAndNonce)(ctx);
160
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_02, ueaAddress, deployed);
174
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_02, ueaAddress, deployed);
161
175
  let txSignature;
162
176
  if (execute.funds.token.mechanism === 'native') {
163
177
  const [tokenRateLimitPda] = web3_js_1.PublicKey.findProgramAddressSync([(0, viem_1.stringToBytes)('rate_limit'), web3_js_1.PublicKey.default.toBuffer()], programId);
@@ -205,14 +219,26 @@ function executeFundsOnlySvm(ctx, execute, eventBuffer, transformFn, chain, rpcU
205
219
  throw new Error('Unsupported token mechanism on Solana');
206
220
  }
207
221
  const originTx = yield (0, helpers_2.fetchOriginChainTransactionForProgress)(ctx, chain, '0x', txSignature);
208
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_02, txSignature, bridgeAmount, execute.funds.token.decimals, symbol, originTx);
222
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_02, txSignature, bridgeAmount, execute.funds.token.decimals, symbol, originTx);
209
223
  yield (0, confirmation_1.waitForSvmConfirmationsWithCountdown)(ctx, svmClient, txSignature, chain_1.CHAIN_INFO[chain].confirmations, chain_1.CHAIN_INFO[chain].timeout);
210
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_04);
211
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_05);
212
- const pushChainUniversalTx = yield (0, response_builder_1.queryUniversalTxStatusFromGatewayTx)(ctx, undefined, undefined, txSignature, 'sendFunds');
213
- const response = yield (0, push_chain_tx_1.extractPcTxAndTransform)(ctx, pushChainUniversalTx, txSignature, eventBuffer, 'sendFunds (SVM)', transformFn);
214
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_06, bridgeAmount, execute.funds.token.decimals, symbol);
215
- (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_99_01, [response]);
224
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_04);
225
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_05);
226
+ let response;
227
+ try {
228
+ const pushChainUniversalTx = yield (0, response_builder_1.queryUniversalTxStatusFromGatewayTx)(ctx, undefined, undefined, txSignature, 'sendFunds');
229
+ response = yield (0, push_chain_tx_1.extractPcTxAndTransform)(ctx, pushChainUniversalTx, txSignature, eventBuffer, 'sendFunds (SVM)', transformFn);
230
+ }
231
+ catch (err) {
232
+ if (!(err instanceof push_chain_tx_1.PushChainExecutionError)) {
233
+ const errMsg = err instanceof Error ? err.message : String(err);
234
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_02, errMsg);
235
+ throw new push_chain_tx_1.PushChainExecutionError(errMsg, { gatewayTxHash: txSignature });
236
+ }
237
+ throw err;
238
+ }
239
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_06, bridgeAmount, execute.funds.token.decimals, symbol);
240
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_107);
241
+ (0, context_2.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_01, [response]);
216
242
  return response;
217
243
  });
218
244
  }
@@ -24,6 +24,7 @@ const context_1 = require("./context");
24
24
  const gas_calculator_1 = require("./gas-calculator");
25
25
  const gateway_client_1 = require("./gateway-client");
26
26
  const payload_builder_1 = require("./payload-builder");
27
+ const gas_usd_sizer_1 = require("./gas-usd-sizer");
27
28
  const uea_manager_1 = require("./uea-manager");
28
29
  const confirmation_1 = require("./confirmation");
29
30
  const response_builder_1 = require("./response-builder");
@@ -36,7 +37,7 @@ function executeFundsWithPayload(ctx, execute, eventBuffer, getResponseCallbacks
36
37
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
37
38
  const transformFn = (tx, buf = []) => (0, response_builder_1.transformToUniversalTxResponse)(ctx, tx, buf, getResponseCallbacks());
38
39
  const { chain, evmClient, gatewayAddress } = (0, gateway_client_1.getOriginGatewayContext)(ctx);
39
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_01, chain, ctx.universalSigner.account.address);
40
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_101, chain, ctx.universalSigner.account.address);
40
41
  // Default token to native ETH if none provided
41
42
  if (!execute.funds.token) {
42
43
  const available = tokens_1.MOVEABLE_TOKENS[chain] || [];
@@ -64,7 +65,7 @@ function executeFundsWithPayload(ctx, execute, eventBuffer, getResponseCallbacks
64
65
  deployed = status.deployed;
65
66
  }
66
67
  const { payload: universalPayload, req } = yield (0, payload_builder_1.buildGatewayPayloadAndGas)(ctx, execute, nonce, 'sendTxWithFunds', execute.funds.amount);
67
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_02_01);
68
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_102_01);
68
69
  // Compute required gas funding on Push Chain and current UEA balance
69
70
  const gasEstimate = execute.gasLimit || BigInt(1e7);
70
71
  const gasPrice = yield ctx.pushClient.getGasPrice();
@@ -73,17 +74,26 @@ function executeFundsWithPayload(ctx, execute, eventBuffer, getResponseCallbacks
73
74
  const requiredFunds = requiredGasFee + payloadValue;
74
75
  const ueaAddress = (0, uea_manager_1.computeUEAOffchain)(ctx);
75
76
  const ueaBalance = yield ctx.pushClient.getBalance(ueaAddress);
76
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_02, ueaAddress, deployed);
77
- // Determine USD to deposit via gateway (8 decimals) with caps: min=$1, max=$1000
78
- const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
79
- const maxUsd = utils_1.Utils.helpers.parseUnits('1000', 8);
77
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_02, ueaAddress, deployed);
78
+ // SDK 5.2 Case A/B/C sizing on the Push-chain gas portion.
79
+ // Floor pad comes from the sizer ($1 for Case A); upper bound now lives in
80
+ // the origin gateway (MAX_CAP_UNIVERSAL_TX_USD) — the SDK no longer caps.
81
+ const r1Sizing = yield (0, gas_usd_sizer_1.sizeR1PushGas)(ctx, {
82
+ pushGasFeeWei: requiredGasFee,
83
+ originChain: chain,
84
+ });
85
+ const r1SizingHookId = {
86
+ A: progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_07_01,
87
+ B: progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_07_02,
88
+ C: progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_07_03,
89
+ }[r1Sizing.category];
90
+ (0, context_1.fireProgressHook)(ctx, r1SizingHookId, chain, r1Sizing.pushGasUsd, r1Sizing.paddedDepositUsd);
80
91
  const deficit = requiredFunds > ueaBalance ? requiredFunds - ueaBalance : BigInt(0);
81
- let depositUsd = deficit > BigInt(0) ? ctx.pushClient.pushToUSDC(deficit) : oneUsd;
82
- if (depositUsd < oneUsd)
83
- depositUsd = oneUsd;
84
- if (depositUsd > maxUsd)
85
- throw new Error('Deposit value exceeds max $1000 worth of native token');
86
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_02_02, depositUsd);
92
+ let depositUsd = deficit > BigInt(0) ? ctx.pushClient.pushToUSDC(deficit) : BigInt(0);
93
+ // Apply sizer floor: Case A pads to $1, Cases B/C pass-through.
94
+ if (depositUsd < r1Sizing.paddedDepositUsd)
95
+ depositUsd = r1Sizing.paddedDepositUsd;
96
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_102_02, depositUsd);
87
97
  // If SVM, clamp depositUsd to on-chain Config caps
88
98
  if (chain_1.CHAIN_INFO[chain].vm === enums_1.VM.SVM) {
89
99
  const svmClient = new svm_client_1.SvmClient({
@@ -118,7 +128,7 @@ function executeFundsWithPayload(ctx, execute, eventBuffer, getResponseCallbacks
118
128
  nativeAmount = nativeAmount + BigInt(1);
119
129
  const bridgeAmount = execute.funds.amount;
120
130
  const symbol = execute.funds.token.symbol;
121
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_01, bridgeAmount, execute.funds.token.decimals, symbol);
131
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_01, bridgeAmount, execute.funds.token.decimals, symbol);
122
132
  if (chain_1.CHAIN_INFO[ctx.universalSigner.account.chain].vm === enums_1.VM.EVM) {
123
133
  const tokenAddr = execute.funds.token.address;
124
134
  if (mechanism === 'approve') {
@@ -134,11 +144,11 @@ function executeFundsWithPayload(ctx, execute, eventBuffer, getResponseCallbacks
134
144
  try {
135
145
  if (chain_1.CHAIN_INFO[ctx.universalSigner.account.chain].vm === enums_1.VM.EVM) {
136
146
  const tokenAddr = execute.funds.token.address;
137
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_01);
138
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_02, ueaAddress, deployed);
139
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_04_01);
140
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_04_02);
141
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_04_03);
147
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_01);
148
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_103_02, ueaAddress, deployed);
149
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_01);
150
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_02);
151
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_03);
142
152
  const evmClientEvm = evmClient;
143
153
  const gatewayAddressEvm = gatewayAddress;
144
154
  const payloadBytes = (0, signing_1.encodeUniversalPayload)(universalPayload);
@@ -180,11 +190,11 @@ function executeFundsWithPayload(ctx, execute, eventBuffer, getResponseCallbacks
180
190
  }
181
191
  }
182
192
  catch (err) {
183
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_04_04);
193
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_04);
184
194
  throw err;
185
195
  }
186
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_04_03);
187
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_02, txHash, bridgeAmount, execute.funds.token.decimals, symbol);
196
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_104_03);
197
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_02, txHash, bridgeAmount, execute.funds.token.decimals, symbol);
188
198
  // Awaiting confirmations
189
199
  const signerChain = ctx.universalSigner.account.chain;
190
200
  if (chain_1.CHAIN_INFO[signerChain].vm === enums_1.VM.EVM) {
@@ -204,18 +214,30 @@ function executeFundsWithPayload(ctx, execute, eventBuffer, getResponseCallbacks
204
214
  feeLockTxHash = (0, viem_1.bytesToHex)(new Uint8Array(decoded));
205
215
  }
206
216
  }
207
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_04);
208
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_05);
209
- let pushChainUniversalTx;
210
- if (chain_1.CHAIN_INFO[ctx.universalSigner.account.chain].vm === enums_1.VM.EVM) {
211
- pushChainUniversalTx = yield (0, response_builder_1.queryUniversalTxStatusFromGatewayTx)(ctx, evmClient, gatewayAddress, txHash, 'sendTxWithFunds');
217
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_04);
218
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_05);
219
+ let response;
220
+ try {
221
+ let pushChainUniversalTx;
222
+ if (chain_1.CHAIN_INFO[ctx.universalSigner.account.chain].vm === enums_1.VM.EVM) {
223
+ pushChainUniversalTx = yield (0, response_builder_1.queryUniversalTxStatusFromGatewayTx)(ctx, evmClient, gatewayAddress, txHash, 'sendTxWithFunds');
224
+ }
225
+ else {
226
+ pushChainUniversalTx = yield (0, response_builder_1.queryUniversalTxStatusFromGatewayTx)(ctx, undefined, undefined, txHash, 'sendTxWithFunds');
227
+ }
228
+ response = yield (0, push_chain_tx_1.extractPcTxAndTransform)(ctx, pushChainUniversalTx, txHash, eventBuffer, 'sendTxWithFunds', transformFn);
212
229
  }
213
- else {
214
- pushChainUniversalTx = yield (0, response_builder_1.queryUniversalTxStatusFromGatewayTx)(ctx, undefined, undefined, txHash, 'sendTxWithFunds');
230
+ catch (err) {
231
+ if (!(err instanceof push_chain_tx_1.PushChainExecutionError)) {
232
+ const errMsg = err instanceof Error ? err.message : String(err);
233
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_02, errMsg);
234
+ throw new push_chain_tx_1.PushChainExecutionError(errMsg, { gatewayTxHash: txHash });
235
+ }
236
+ throw err;
215
237
  }
216
- const response = yield (0, push_chain_tx_1.extractPcTxAndTransform)(ctx, pushChainUniversalTx, txHash, eventBuffer, 'sendTxWithFunds', transformFn);
217
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_06, bridgeAmount, execute.funds.token.decimals, symbol);
218
- (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_99_01, [response]);
238
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_106_06, bridgeAmount, execute.funds.token.decimals, symbol);
239
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_107);
240
+ (0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_01, [response]);
219
241
  return response;
220
242
  });
221
243
  }