@pushchain/core 4.0.8 → 4.0.9
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/package.json +1 -1
- package/src/lib/constants/chain.js +3 -3
- package/src/lib/constants/chain.js.map +1 -1
- package/src/lib/orchestrator/orchestrator.d.ts +12 -1
- package/src/lib/orchestrator/orchestrator.js +225 -43
- package/src/lib/orchestrator/orchestrator.js.map +1 -1
- package/src/lib/orchestrator/orchestrator.types.d.ts +36 -0
- package/src/lib/orchestrator/payload-builders.js +18 -11
- package/src/lib/orchestrator/payload-builders.js.map +1 -1
- package/src/lib/progress-hook/progress-hook.js +39 -0
- package/src/lib/progress-hook/progress-hook.js.map +1 -1
- package/src/lib/progress-hook/progress-hook.types.d.ts +6 -1
- package/src/lib/progress-hook/progress-hook.types.js +6 -0
- package/src/lib/progress-hook/progress-hook.types.js.map +1 -1
- package/src/lib/push-chain/push-chain.d.ts +4 -0
- package/src/lib/push-chain/push-chain.js +3 -0
- package/src/lib/push-chain/push-chain.js.map +1 -1
- package/src/lib/universal/signer/signer.js +17 -3
- package/src/lib/universal/signer/signer.js.map +1 -1
package/package.json
CHANGED
|
@@ -196,7 +196,7 @@ exports.CHAIN_INFO = {
|
|
|
196
196
|
vm: enums_1.VM.SVM,
|
|
197
197
|
lockerContract: 'TBD',
|
|
198
198
|
defaultRPC: [''],
|
|
199
|
-
confirmations:
|
|
199
|
+
confirmations: 1,
|
|
200
200
|
fastConfirmations: 0,
|
|
201
201
|
timeout: 15000,
|
|
202
202
|
},
|
|
@@ -205,7 +205,7 @@ exports.CHAIN_INFO = {
|
|
|
205
205
|
vm: enums_1.VM.SVM,
|
|
206
206
|
lockerContract: '',
|
|
207
207
|
defaultRPC: ['https://api.testnet.solana.com'],
|
|
208
|
-
confirmations:
|
|
208
|
+
confirmations: 1,
|
|
209
209
|
fastConfirmations: 0,
|
|
210
210
|
timeout: 55000,
|
|
211
211
|
},
|
|
@@ -214,7 +214,7 @@ exports.CHAIN_INFO = {
|
|
|
214
214
|
vm: enums_1.VM.SVM,
|
|
215
215
|
lockerContract: 'CFVSincHYbETh2k7w6u1ENEkjbSLtveRCEBupKidw2VS',
|
|
216
216
|
defaultRPC: ['https://api.devnet.solana.com'],
|
|
217
|
-
confirmations:
|
|
217
|
+
confirmations: 1,
|
|
218
218
|
fastConfirmations: 0,
|
|
219
219
|
timeout: 120000,
|
|
220
220
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/constants/chain.ts"],"names":[],"mappings":";;;AAAA,mCAAkD;AAClD,wCAKqB;AAErB;;;;GAIG;AACU,QAAA,YAAY,GAAuB;IAC9C,CAAC,UAAE,CAAC,GAAG,CAAC,EAAE,QAAQ;IAClB,CAAC,UAAE,CAAC,GAAG,CAAC,EAAE,QAAQ;CACnB,CAAC;AAEF;;GAEG;AACU,QAAA,SAAS,GAAwC;IAC5D,CAAC,oBAAY,CAAC,OAAO,CAAC,EAAE,OAAO;IAC/B,CAAC,oBAAY,CAAC,aAAa,CAAC,EAAE,4CAA4C;IAC1E,CAAC,oBAAY,CAAC,OAAO,CAAC,EAAE,4CAA4C;IACpE,CAAC,oBAAY,CAAC,QAAQ,CAAC,EAAE,4CAA4C;CACtE,CAAC;AAEF;;;GAGG;AACU,QAAA,oBAAoB,GAkB7B;IACF,CAAC,oBAAY,CAAC,aAAa,CAAC,EAAE;QAC5B,IAAI,EAAE,4CAA4C;QAClD,QAAQ,EAAE,4CAA4C;QACtD,SAAS,EAAE,4CAA4C;QACvD,QAAQ,EAAE,4CAA4C;QACtD,IAAI,EAAE,4CAA4C;QAClD,QAAQ,EAAE,4CAA4C;QACtD,QAAQ,EAAE,4CAA4C;QACtD,QAAQ,EAAE,4CAA4C;QACtD,QAAQ,EAAE,4CAA4C;QACtD,QAAQ,EAAE,4CAA4C;QACtD,QAAQ,EAAE,4CAA4C;QACtD,QAAQ,EAAE,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E,OAAO,EACvB,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,EAC1B,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,EACzB,mBAAmB,EAAE,MAAM,CAAC,GAAG,CAAC,EAChC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GACpC;IACD,CAAC,aAAK,CAAC,kBAAkB,CAAC,kCACrB,kBAAU,CAAC,aAAK,CAAC,kBAAkB,CAAC,KACvC,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,6BAA6B,EAC5C,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,4CAA4C,EAC5D,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,EAC1B,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,EACzB,mBAAmB,EAAE,MAAM,CAAC,GAAG,CAAC,EAChC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GACpC;IACD,CAAC,aAAK,CAAC,aAAa,CAAC,kCAChB,kBAAU,CAAC,aAAK,CAAC,aAAa,CAAC,KAClC,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,wBAAwB,EACvC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,4CAA4C,EAC5D,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,EAC1B,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,EACzB,mBAAmB,EAAE,MAAM,CAAC,GAAG,CAAC,EAChC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GACpC;CACF,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { CHAIN, PUSH_NETWORK } from '../constants/enums';
|
|
|
2
2
|
import { ConversionQuote, MoveableToken, PayableToken } from '../constants/tokens';
|
|
3
3
|
import { ProgressEvent } from '../progress-hook/progress-hook.types';
|
|
4
4
|
import { UniversalAccount, UniversalSigner } from '../universal/universal.types';
|
|
5
|
-
import { ExecuteParams, UniversalTxResponse } from './orchestrator.types';
|
|
5
|
+
import { ExecuteParams, UniversalTxReceipt, UniversalTxResponse } from './orchestrator.types';
|
|
6
6
|
export declare class Orchestrator {
|
|
7
7
|
private readonly universalSigner;
|
|
8
8
|
private pushNetwork;
|
|
@@ -88,6 +88,17 @@ export declare class Orchestrator {
|
|
|
88
88
|
* v_type: u8 (0 = SignedVerification, 1 = UniversalTxVerification)
|
|
89
89
|
*/
|
|
90
90
|
private encodeUniversalPayloadSvm;
|
|
91
|
+
/**
|
|
92
|
+
* Tracks a transaction by hash on Push Chain
|
|
93
|
+
* @param txHash - Transaction hash to track
|
|
94
|
+
* @param options - Tracking options (chain, progress hooks, polling config)
|
|
95
|
+
* @returns Promise resolving to UniversalTxReceipt when transaction is confirmed
|
|
96
|
+
*/
|
|
97
|
+
trackTransaction(txHash: string, options?: import('./orchestrator.types').TrackTransactionOptions): Promise<UniversalTxReceipt>;
|
|
98
|
+
/**
|
|
99
|
+
* Returns the Push Chain enum value for the current network
|
|
100
|
+
*/
|
|
101
|
+
private getPushChainForNetwork;
|
|
91
102
|
/**
|
|
92
103
|
* Computes UEA for given UniversalAccount
|
|
93
104
|
* @dev - This fn calls a view fn of Factory Contract
|
|
@@ -15,6 +15,7 @@ const price_fetch_1 = require("../price-fetch/price-fetch");
|
|
|
15
15
|
const progress_hook_1 = tslib_1.__importDefault(require("../progress-hook/progress-hook"));
|
|
16
16
|
const progress_hook_types_1 = require("../progress-hook/progress-hook.types");
|
|
17
17
|
const push_chain_1 = require("../push-chain/push-chain");
|
|
18
|
+
const utils_1 = require("../utils");
|
|
18
19
|
const push_client_1 = require("../push-client/push-client");
|
|
19
20
|
const evm_client_1 = require("../vm-client/evm-client");
|
|
20
21
|
const svm_client_1 = require("../vm-client/svm-client");
|
|
@@ -63,7 +64,7 @@ class Orchestrator {
|
|
|
63
64
|
*/
|
|
64
65
|
execute(execute) {
|
|
65
66
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
67
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
67
68
|
try {
|
|
68
69
|
if (execute.funds) {
|
|
69
70
|
if (!execute.data || execute.data === '0x') {
|
|
@@ -163,7 +164,7 @@ class Orchestrator {
|
|
|
163
164
|
functionName: 'sendUniversalTx',
|
|
164
165
|
args: [req],
|
|
165
166
|
signer: this.universalSigner,
|
|
166
|
-
value: isNative ? bridgeAmount :
|
|
167
|
+
value: isNative ? bridgeAmount : nativeAmount,
|
|
167
168
|
});
|
|
168
169
|
}
|
|
169
170
|
else {
|
|
@@ -201,8 +202,22 @@ class Orchestrator {
|
|
|
201
202
|
// Syncing with Push Chain - emit before query
|
|
202
203
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_05);
|
|
203
204
|
const pushChainUniversalTx = yield this.queryUniversalTxStatusFromGatewayTx(evmClient, gatewayAddress, txHash, execute.to === ueaAddress ? 'sendFunds' : 'sendTxWithFunds');
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
if (!((_a = pushChainUniversalTx === null || pushChainUniversalTx === void 0 ? void 0 : pushChainUniversalTx.pcTx) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
206
|
+
throw new Error(`Failed to retrieve Push Chain transaction status for gateway tx: ${txHash}. ` +
|
|
207
|
+
`The transaction may have failed on Push Chain or not been indexed yet.`);
|
|
208
|
+
}
|
|
209
|
+
// Find the first successful pcTx with a valid txHash
|
|
210
|
+
// For sendFunds operations, MintPC (first) succeeds and executePayload (second) may fail
|
|
211
|
+
const successfulPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
212
|
+
if (!(successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash)) {
|
|
213
|
+
// If no successful pcTx found, check for error messages in failed entries
|
|
214
|
+
const failedPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.status === 'FAILED' && pcTx.errorMsg);
|
|
215
|
+
const errorDetails = (failedPcTx === null || failedPcTx === void 0 ? void 0 : failedPcTx.errorMsg)
|
|
216
|
+
? `: ${failedPcTx.errorMsg}`
|
|
217
|
+
: '';
|
|
218
|
+
throw new Error(`No successful transaction found in Push Chain response for gateway tx: ${txHash}${errorDetails}`);
|
|
219
|
+
}
|
|
220
|
+
const tx = yield this.pushClient.getTransaction(successfulPcTx.txHash);
|
|
206
221
|
const response = yield this.transformToUniversalTxResponse(tx);
|
|
207
222
|
// Funds Flow: Funds credited on Push Chain
|
|
208
223
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_06, bridgeAmount, execute.funds.token.decimals, symbol);
|
|
@@ -360,8 +375,20 @@ class Orchestrator {
|
|
|
360
375
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_05);
|
|
361
376
|
// After origin confirmations, query Push Chain for UniversalTx status (SVM)
|
|
362
377
|
const pushChainUniversalTx = yield this.queryUniversalTxStatusFromGatewayTx(undefined, undefined, txSignature, 'sendFunds');
|
|
363
|
-
|
|
364
|
-
|
|
378
|
+
if (!((_b = pushChainUniversalTx === null || pushChainUniversalTx === void 0 ? void 0 : pushChainUniversalTx.pcTx) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
379
|
+
throw new Error(`Failed to retrieve Push Chain transaction status for gateway tx: ${txSignature}. ` +
|
|
380
|
+
`The transaction may have failed on Push Chain or not been indexed yet.`);
|
|
381
|
+
}
|
|
382
|
+
// Find the first successful pcTx with a valid txHash
|
|
383
|
+
const successfulPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
384
|
+
if (!(successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash)) {
|
|
385
|
+
const failedPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.status === 'FAILED' && pcTx.errorMsg);
|
|
386
|
+
const errorDetails = (failedPcTx === null || failedPcTx === void 0 ? void 0 : failedPcTx.errorMsg)
|
|
387
|
+
? `: ${failedPcTx.errorMsg}`
|
|
388
|
+
: '';
|
|
389
|
+
throw new Error(`No successful transaction found in Push Chain response for gateway tx: ${txSignature}${errorDetails}`);
|
|
390
|
+
}
|
|
391
|
+
const tx = yield this.pushClient.getTransaction(successfulPcTx.txHash);
|
|
365
392
|
const response = yield this.transformToUniversalTxResponse(tx);
|
|
366
393
|
// Funds Flow: Funds credited on Push Chain
|
|
367
394
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_06, bridgeAmount, execute.funds.token.decimals, symbol);
|
|
@@ -396,7 +423,7 @@ class Orchestrator {
|
|
|
396
423
|
const gasEstimate = execute.gasLimit || BigInt(1e7);
|
|
397
424
|
const gasPrice = yield this.pushClient.getGasPrice();
|
|
398
425
|
const requiredGasFee = gasEstimate * gasPrice;
|
|
399
|
-
const payloadValue = (
|
|
426
|
+
const payloadValue = (_c = execute.value) !== null && _c !== void 0 ? _c : BigInt(0);
|
|
400
427
|
const requiredFunds = requiredGasFee + payloadValue;
|
|
401
428
|
const ueaAddress = this.computeUEAOffchain();
|
|
402
429
|
const [ueaBalance] = yield Promise.all([
|
|
@@ -405,8 +432,8 @@ class Orchestrator {
|
|
|
405
432
|
// UEA resolved (address, deployment status, balance, nonce)
|
|
406
433
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_02, ueaAddress, deployed);
|
|
407
434
|
// Determine USD to deposit via gateway (8 decimals) with caps: min=$1, max=$10
|
|
408
|
-
const oneUsd =
|
|
409
|
-
const tenUsd =
|
|
435
|
+
const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
|
|
436
|
+
const tenUsd = utils_1.Utils.helpers.parseUnits('10', 8);
|
|
410
437
|
const deficit = requiredFunds > ueaBalance ? requiredFunds - ueaBalance : BigInt(0);
|
|
411
438
|
let depositUsd = deficit > BigInt(0) ? this.pushClient.pushToUSDC(deficit) : oneUsd;
|
|
412
439
|
if (depositUsd < oneUsd)
|
|
@@ -429,8 +456,8 @@ class Orchestrator {
|
|
|
429
456
|
functionName: 'config',
|
|
430
457
|
args: [configPda.toBase58()],
|
|
431
458
|
});
|
|
432
|
-
const minField = (
|
|
433
|
-
const maxField = (
|
|
459
|
+
const minField = (_d = cfg.minCapUniversalTxUsd) !== null && _d !== void 0 ? _d : cfg.min_cap_universal_tx_usd;
|
|
460
|
+
const maxField = (_e = cfg.maxCapUniversalTxUsd) !== null && _e !== void 0 ? _e : cfg.max_cap_universal_tx_usd;
|
|
434
461
|
const minCapUsd = BigInt(minField.toString());
|
|
435
462
|
const maxCapUsd = BigInt(maxField.toString());
|
|
436
463
|
if (depositUsd < minCapUsd)
|
|
@@ -442,14 +469,14 @@ class Orchestrator {
|
|
|
442
469
|
if (depositUsd > maxCapUsd)
|
|
443
470
|
depositUsd = maxCapUsd;
|
|
444
471
|
}
|
|
445
|
-
catch (
|
|
472
|
+
catch (_p) {
|
|
446
473
|
// best-effort; fallback to previous bounds if read fails
|
|
447
474
|
}
|
|
448
475
|
}
|
|
449
476
|
// Convert USD(8) -> native units using pricing path
|
|
450
477
|
const nativeTokenUsdPrice = yield new price_fetch_1.PriceFetch(this.rpcUrls).getPrice(chain); // 8 decimals
|
|
451
478
|
const nativeDecimals = chain_1.CHAIN_INFO[chain].vm === enums_1.VM.SVM ? 9 : 18;
|
|
452
|
-
const oneNativeUnit =
|
|
479
|
+
const oneNativeUnit = utils_1.Utils.helpers.parseUnits('1', nativeDecimals);
|
|
453
480
|
// Ceil division to avoid rounding below min USD on-chain
|
|
454
481
|
let nativeAmount = (depositUsd * oneNativeUnit + (nativeTokenUsdPrice - BigInt(1))) /
|
|
455
482
|
nativeTokenUsdPrice;
|
|
@@ -466,12 +493,16 @@ class Orchestrator {
|
|
|
466
493
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_01, bridgeAmount, execute.funds.token.decimals, symbol);
|
|
467
494
|
if (chain_1.CHAIN_INFO[this.universalSigner.account.chain].vm === enums_1.VM.EVM) {
|
|
468
495
|
const tokenAddr = execute.funds.token.address;
|
|
469
|
-
if (mechanism
|
|
470
|
-
|
|
496
|
+
if (mechanism === 'approve') {
|
|
497
|
+
// ERC-20 tokens: ensure gateway has approval
|
|
498
|
+
const evmClientEvm = evmClient;
|
|
499
|
+
const gatewayAddressEvm = gatewayAddress;
|
|
500
|
+
yield this.ensureErc20Allowance(evmClientEvm, tokenAddr, gatewayAddressEvm, bridgeAmount);
|
|
471
501
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
502
|
+
else if (mechanism === 'permit2') {
|
|
503
|
+
throw new Error('Permit2 is not supported yet');
|
|
504
|
+
}
|
|
505
|
+
// Native tokens (mechanism === 'native') don't need approval - handled via msg.value
|
|
475
506
|
}
|
|
476
507
|
let txHash;
|
|
477
508
|
try {
|
|
@@ -489,7 +520,7 @@ class Orchestrator {
|
|
|
489
520
|
// New behavior: if user provided a gasTokenAddress, pay gas in that token via Uniswap quote
|
|
490
521
|
// Determine pay-with token address, min-out and slippage
|
|
491
522
|
const payWith = execute.payGasWith;
|
|
492
|
-
const gasTokenAddress = (
|
|
523
|
+
const gasTokenAddress = (_f = payWith === null || payWith === void 0 ? void 0 : payWith.token) === null || _f === void 0 ? void 0 : _f.address;
|
|
493
524
|
if (gasTokenAddress) {
|
|
494
525
|
if (chain !== enums_1.CHAIN.ETHEREUM_SEPOLIA) {
|
|
495
526
|
throw new Error(`Only ${push_chain_1.PushChain.utils.chains.getChainName(enums_1.CHAIN.ETHEREUM_SEPOLIA)} is supported for paying gas fees with ERC-20 tokens`);
|
|
@@ -497,7 +528,7 @@ class Orchestrator {
|
|
|
497
528
|
let amountOutMinETH = (payWith === null || payWith === void 0 ? void 0 : payWith.minAmountOut) !== undefined
|
|
498
529
|
? BigInt(payWith.minAmountOut)
|
|
499
530
|
: nativeAmount;
|
|
500
|
-
const slippageBps = (
|
|
531
|
+
const slippageBps = (_g = payWith === null || payWith === void 0 ? void 0 : payWith.slippageBps) !== null && _g !== void 0 ? _g : 100;
|
|
501
532
|
amountOutMinETH = BigInt(push_chain_1.PushChain.utils.conversion.slippageToMinAmount(amountOutMinETH.toString(), { slippageBps }));
|
|
502
533
|
const { gasAmount } = yield this.calculateGasAmountFromAmountOutMinETH(gasTokenAddress, amountOutMinETH);
|
|
503
534
|
const deadline = BigInt(0);
|
|
@@ -509,10 +540,10 @@ class Orchestrator {
|
|
|
509
540
|
ownerAddress,
|
|
510
541
|
});
|
|
511
542
|
if (gasTokenBalance < gasAmount) {
|
|
512
|
-
const sym = (
|
|
513
|
-
const decimals = (
|
|
514
|
-
const needFmt =
|
|
515
|
-
const haveFmt =
|
|
543
|
+
const sym = (_j = (_h = payWith === null || payWith === void 0 ? void 0 : payWith.token) === null || _h === void 0 ? void 0 : _h.symbol) !== null && _j !== void 0 ? _j : 'gas token';
|
|
544
|
+
const decimals = (_l = (_k = payWith === null || payWith === void 0 ? void 0 : payWith.token) === null || _k === void 0 ? void 0 : _k.decimals) !== null && _l !== void 0 ? _l : 18;
|
|
545
|
+
const needFmt = utils_1.Utils.helpers.formatUnits(gasAmount, decimals);
|
|
546
|
+
const haveFmt = utils_1.Utils.helpers.formatUnits(gasTokenBalance, decimals);
|
|
516
547
|
throw new Error(`Insufficient ${sym} balance to cover gas fees: need ${needFmt}, have ${haveFmt}`);
|
|
517
548
|
}
|
|
518
549
|
// Approve gas token to gateway
|
|
@@ -558,13 +589,19 @@ class Orchestrator {
|
|
|
558
589
|
// payload: this.encodeUniversalPayload(universalPayload),
|
|
559
590
|
// });
|
|
560
591
|
// VALUE + PAYLOAD + FUNDS && PAYLOAD + FUNDS
|
|
592
|
+
// For native tokens: msg.value = gas amount + bridge amount
|
|
593
|
+
// For ERC-20 tokens: msg.value = gas amount only (bridge handled via token transfer)
|
|
594
|
+
const isNativeToken = mechanism === 'native';
|
|
595
|
+
const totalValue = isNativeToken
|
|
596
|
+
? nativeAmount + bridgeAmount
|
|
597
|
+
: nativeAmount;
|
|
561
598
|
txHash = yield evmClientEvm.writeContract({
|
|
562
599
|
abi: abi_1.UNIVERSAL_GATEWAY_V0,
|
|
563
600
|
address: gatewayAddressEvm,
|
|
564
601
|
functionName: 'sendUniversalTx',
|
|
565
602
|
args: [req],
|
|
566
603
|
signer: this.universalSigner,
|
|
567
|
-
value:
|
|
604
|
+
value: totalValue,
|
|
568
605
|
});
|
|
569
606
|
}
|
|
570
607
|
}
|
|
@@ -632,8 +669,20 @@ class Orchestrator {
|
|
|
632
669
|
pushChainUniversalTx =
|
|
633
670
|
yield this.queryUniversalTxStatusFromGatewayTx(undefined, undefined, txHash, 'sendTxWithFunds');
|
|
634
671
|
}
|
|
635
|
-
|
|
636
|
-
|
|
672
|
+
if (!((_m = pushChainUniversalTx === null || pushChainUniversalTx === void 0 ? void 0 : pushChainUniversalTx.pcTx) === null || _m === void 0 ? void 0 : _m.length)) {
|
|
673
|
+
throw new Error(`Failed to retrieve Push Chain transaction status for gateway tx: ${txHash}. ` +
|
|
674
|
+
`The transaction may have failed on Push Chain or not been indexed yet.`);
|
|
675
|
+
}
|
|
676
|
+
// Find the first successful pcTx with a valid txHash
|
|
677
|
+
const successfulPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
678
|
+
if (!(successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash)) {
|
|
679
|
+
const failedPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.status === 'FAILED' && pcTx.errorMsg);
|
|
680
|
+
const errorDetails = (failedPcTx === null || failedPcTx === void 0 ? void 0 : failedPcTx.errorMsg)
|
|
681
|
+
? `: ${failedPcTx.errorMsg}`
|
|
682
|
+
: '';
|
|
683
|
+
throw new Error(`No successful transaction found in Push Chain response for gateway tx: ${txHash}${errorDetails}`);
|
|
684
|
+
}
|
|
685
|
+
const tx = yield this.pushClient.getTransaction(successfulPcTx.txHash);
|
|
637
686
|
const response = yield this.transformToUniversalTxResponse(tx);
|
|
638
687
|
// Funds Flow: Funds credited on Push Chain
|
|
639
688
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_06, bridgeAmount, execute.funds.token.decimals, symbol);
|
|
@@ -808,7 +857,7 @@ class Orchestrator {
|
|
|
808
857
|
* Fee Locking - For all chains, EVM and Solana
|
|
809
858
|
*/
|
|
810
859
|
const fundDifference = requiredFunds - funds;
|
|
811
|
-
const fixedPushAmount =
|
|
860
|
+
const fixedPushAmount = utils_1.Utils.helpers.parseUnits('0.001', 18); // Minimum lock 0.001 Push tokens
|
|
812
861
|
const lockAmount = funds < requiredFunds ? fundDifference : fixedPushAmount;
|
|
813
862
|
const lockAmountInUSD = this.pushClient.pushToUSDC(lockAmount);
|
|
814
863
|
const feeLockTxHashBytes = yield this.lockFee(lockAmountInUSD, universalPayload, req);
|
|
@@ -833,8 +882,20 @@ class Orchestrator {
|
|
|
833
882
|
* Note: queryTx may be undefined since validators don't recognize new UniversalTx event yet
|
|
834
883
|
*/
|
|
835
884
|
// Transform to UniversalTxResponse (follow sendFunds pattern)
|
|
836
|
-
|
|
837
|
-
|
|
885
|
+
if (!((_o = pushChainUniversalTx === null || pushChainUniversalTx === void 0 ? void 0 : pushChainUniversalTx.pcTx) === null || _o === void 0 ? void 0 : _o.length)) {
|
|
886
|
+
throw new Error(`Failed to retrieve Push Chain transaction status for gateway tx: ${feeLockTxHash}. ` +
|
|
887
|
+
`The transaction may have failed on Push Chain or not been indexed yet.`);
|
|
888
|
+
}
|
|
889
|
+
// Find the first successful pcTx with a valid txHash
|
|
890
|
+
const successfulPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
891
|
+
if (!(successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash)) {
|
|
892
|
+
const failedPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.status === 'FAILED' && pcTx.errorMsg);
|
|
893
|
+
const errorDetails = (failedPcTx === null || failedPcTx === void 0 ? void 0 : failedPcTx.errorMsg)
|
|
894
|
+
? `: ${failedPcTx.errorMsg}`
|
|
895
|
+
: '';
|
|
896
|
+
throw new Error(`No successful transaction found in Push Chain response for gateway tx: ${feeLockTxHash}${errorDetails}`);
|
|
897
|
+
}
|
|
898
|
+
const tx = yield this.pushClient.getTransaction(successfulPcTx.txHash);
|
|
838
899
|
const response = yield this.transformToUniversalTxResponse(tx);
|
|
839
900
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_99_01, [response]);
|
|
840
901
|
return response;
|
|
@@ -891,8 +952,8 @@ class Orchestrator {
|
|
|
891
952
|
]);
|
|
892
953
|
const nativeDecimals = 18; // ETH, MATIC, etc.
|
|
893
954
|
// Ensure deposit respects gateway USD caps (min $1, max $10) and avoid rounding below min
|
|
894
|
-
const oneUsd =
|
|
895
|
-
const tenUsd =
|
|
955
|
+
const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
|
|
956
|
+
const tenUsd = utils_1.Utils.helpers.parseUnits('10', 8);
|
|
896
957
|
let depositUsd = amount < oneUsd ? oneUsd : amount;
|
|
897
958
|
if (depositUsd > tenUsd)
|
|
898
959
|
depositUsd = tenUsd;
|
|
@@ -927,8 +988,8 @@ class Orchestrator {
|
|
|
927
988
|
]);
|
|
928
989
|
// Ensure deposit respects gateway USD caps (min $1, max $10) and avoid rounding below min
|
|
929
990
|
const nativeDecimals = 9; // SOL lamports
|
|
930
|
-
const oneUsd =
|
|
931
|
-
const tenUsd =
|
|
991
|
+
const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
|
|
992
|
+
const tenUsd = utils_1.Utils.helpers.parseUnits('10', 8);
|
|
932
993
|
let depositUsd = amount < oneUsd ? oneUsd : amount;
|
|
933
994
|
if (depositUsd > tenUsd)
|
|
934
995
|
depositUsd = tenUsd;
|
|
@@ -1389,6 +1450,118 @@ class Orchestrator {
|
|
|
1389
1450
|
vTypeBytes,
|
|
1390
1451
|
]);
|
|
1391
1452
|
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Tracks a transaction by hash on Push Chain
|
|
1455
|
+
* @param txHash - Transaction hash to track
|
|
1456
|
+
* @param options - Tracking options (chain, progress hooks, polling config)
|
|
1457
|
+
* @returns Promise resolving to UniversalTxReceipt when transaction is confirmed
|
|
1458
|
+
*/
|
|
1459
|
+
trackTransaction(txHash, options) {
|
|
1460
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1461
|
+
const { chain = this.getPushChainForNetwork(), progress, waitForCompletion = true, advanced = {}, } = options !== null && options !== void 0 ? options : {};
|
|
1462
|
+
const { pollingIntervalMs = 1000, timeout = 300000, rpcUrls = {}, } = advanced;
|
|
1463
|
+
// Use custom progress hook if provided, otherwise use instance hook
|
|
1464
|
+
const progressHookFn = progress !== null && progress !== void 0 ? progress : this.progressHook;
|
|
1465
|
+
// Emit TRACK_TX_01 - tracking started
|
|
1466
|
+
if (progressHookFn) {
|
|
1467
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_01](txHash, chain);
|
|
1468
|
+
this.printLog(hookPayload.message);
|
|
1469
|
+
progressHookFn(hookPayload);
|
|
1470
|
+
}
|
|
1471
|
+
// Create client for target chain with optional RPC override
|
|
1472
|
+
const chainRPCs = rpcUrls[chain] || this.rpcUrls[chain] || chain_1.CHAIN_INFO[chain].defaultRPC;
|
|
1473
|
+
const client = new push_client_1.PushClient({
|
|
1474
|
+
rpcUrls: chainRPCs,
|
|
1475
|
+
network: this.pushNetwork,
|
|
1476
|
+
});
|
|
1477
|
+
// Try to get transaction immediately
|
|
1478
|
+
try {
|
|
1479
|
+
const tx = yield client.getTransaction(txHash);
|
|
1480
|
+
if (!waitForCompletion) {
|
|
1481
|
+
// Non-blocking mode: return current receipt immediately
|
|
1482
|
+
const receipt = yield tx.wait(0);
|
|
1483
|
+
const universalTxResponse = yield this.transformToUniversalTxResponse(tx);
|
|
1484
|
+
return this.transformToUniversalTxReceipt(receipt, universalTxResponse);
|
|
1485
|
+
}
|
|
1486
|
+
// Blocking mode: wait for confirmation
|
|
1487
|
+
const receipt = yield tx.wait(1);
|
|
1488
|
+
const universalTxResponse = yield this.transformToUniversalTxResponse(tx);
|
|
1489
|
+
// Emit TRACK_TX_99_01 - tracking complete
|
|
1490
|
+
if (progressHookFn) {
|
|
1491
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_99_01](txHash, universalTxResponse);
|
|
1492
|
+
this.printLog(hookPayload.message);
|
|
1493
|
+
progressHookFn(hookPayload);
|
|
1494
|
+
}
|
|
1495
|
+
return this.transformToUniversalTxReceipt(receipt, universalTxResponse);
|
|
1496
|
+
}
|
|
1497
|
+
catch (initialError) {
|
|
1498
|
+
// Transaction not found yet - start polling if waitForCompletion is true
|
|
1499
|
+
if (!waitForCompletion) {
|
|
1500
|
+
// Non-blocking and tx not found - throw error
|
|
1501
|
+
const errorMsg = initialError instanceof Error ? initialError.message : 'Transaction not found';
|
|
1502
|
+
if (progressHookFn) {
|
|
1503
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_99_02](txHash, errorMsg);
|
|
1504
|
+
this.printLog(hookPayload.message);
|
|
1505
|
+
progressHookFn(hookPayload);
|
|
1506
|
+
}
|
|
1507
|
+
throw new Error(`Transaction ${txHash} not found: ${errorMsg}`);
|
|
1508
|
+
}
|
|
1509
|
+
// Blocking mode: poll until found or timeout
|
|
1510
|
+
const start = Date.now();
|
|
1511
|
+
while (true) {
|
|
1512
|
+
// Emit TRACK_TX_02 - querying status
|
|
1513
|
+
if (progressHookFn) {
|
|
1514
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_02](txHash);
|
|
1515
|
+
this.printLog(hookPayload.message);
|
|
1516
|
+
progressHookFn(hookPayload);
|
|
1517
|
+
}
|
|
1518
|
+
try {
|
|
1519
|
+
const tx = yield client.getTransaction(txHash);
|
|
1520
|
+
const receipt = yield tx.wait(1);
|
|
1521
|
+
const universalTxResponse = yield this.transformToUniversalTxResponse(tx);
|
|
1522
|
+
// Success - emit TRACK_TX_99_01
|
|
1523
|
+
if (progressHookFn) {
|
|
1524
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_99_01](txHash, universalTxResponse);
|
|
1525
|
+
this.printLog(hookPayload.message);
|
|
1526
|
+
progressHookFn(hookPayload);
|
|
1527
|
+
}
|
|
1528
|
+
return this.transformToUniversalTxReceipt(receipt, universalTxResponse);
|
|
1529
|
+
}
|
|
1530
|
+
catch (err) {
|
|
1531
|
+
// Transaction not found yet or error - continue polling
|
|
1532
|
+
this.printLog(`Transaction ${txHash} not found yet, continuing to poll...`);
|
|
1533
|
+
}
|
|
1534
|
+
// Check timeout
|
|
1535
|
+
if (Date.now() - start > timeout) {
|
|
1536
|
+
const timeoutMsg = `Timeout: transaction ${txHash} not confirmed within ${timeout}ms`;
|
|
1537
|
+
if (progressHookFn) {
|
|
1538
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_99_02](txHash, 'Timeout');
|
|
1539
|
+
this.printLog(hookPayload.message);
|
|
1540
|
+
progressHookFn(hookPayload);
|
|
1541
|
+
}
|
|
1542
|
+
throw new Error(timeoutMsg);
|
|
1543
|
+
}
|
|
1544
|
+
// Wait before next poll
|
|
1545
|
+
yield new Promise((r) => setTimeout(r, pollingIntervalMs));
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Returns the Push Chain enum value for the current network
|
|
1552
|
+
*/
|
|
1553
|
+
getPushChainForNetwork() {
|
|
1554
|
+
if (this.pushNetwork === enums_1.PUSH_NETWORK.MAINNET) {
|
|
1555
|
+
return enums_1.CHAIN.PUSH_MAINNET;
|
|
1556
|
+
}
|
|
1557
|
+
else if (this.pushNetwork === enums_1.PUSH_NETWORK.TESTNET_DONUT ||
|
|
1558
|
+
this.pushNetwork === enums_1.PUSH_NETWORK.TESTNET) {
|
|
1559
|
+
return enums_1.CHAIN.PUSH_TESTNET_DONUT;
|
|
1560
|
+
}
|
|
1561
|
+
else {
|
|
1562
|
+
return enums_1.CHAIN.PUSH_LOCALNET;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1392
1565
|
/**
|
|
1393
1566
|
* Computes UEA for given UniversalAccount
|
|
1394
1567
|
* @dev - This fn calls a view fn of Factory Contract
|
|
@@ -1813,10 +1986,10 @@ class Orchestrator {
|
|
|
1813
1986
|
throw new Error('No direct Uniswap V3 pool found for the given token pair on common fee tiers');
|
|
1814
1987
|
}
|
|
1815
1988
|
const amountInBig = BigInt(bestAmountIn);
|
|
1816
|
-
const amountInHuman = parseFloat(
|
|
1989
|
+
const amountInHuman = parseFloat(utils_1.Utils.helpers.formatUnits(amountInBig, {
|
|
1817
1990
|
decimals: from.decimals,
|
|
1818
1991
|
}));
|
|
1819
|
-
const amountOutHuman = parseFloat(
|
|
1992
|
+
const amountOutHuman = parseFloat(utils_1.Utils.helpers.formatUnits(amountOut, { decimals: to.decimals }));
|
|
1820
1993
|
const rate = amountInHuman > 0 ? amountOutHuman / amountInHuman : 0;
|
|
1821
1994
|
return {
|
|
1822
1995
|
amountIn: bestAmountIn.toString(),
|
|
@@ -2288,7 +2461,7 @@ class Orchestrator {
|
|
|
2288
2461
|
// Query Push Chain for UniversalTx status given an origin gateway tx (EVM or SVM)
|
|
2289
2462
|
queryUniversalTxStatusFromGatewayTx(evmClient, gatewayAddress, txHash, evmGatewayMethod) {
|
|
2290
2463
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2291
|
-
var _a, _b;
|
|
2464
|
+
var _a, _b, _c, _d;
|
|
2292
2465
|
try {
|
|
2293
2466
|
const chain = this.universalSigner.account.chain;
|
|
2294
2467
|
const { vm } = chain_1.CHAIN_INFO[chain];
|
|
@@ -2303,7 +2476,7 @@ class Orchestrator {
|
|
|
2303
2476
|
hash: txHash,
|
|
2304
2477
|
});
|
|
2305
2478
|
}
|
|
2306
|
-
catch (
|
|
2479
|
+
catch (_e) {
|
|
2307
2480
|
// Receipt might not be indexed yet on this RPC; wait briefly for it
|
|
2308
2481
|
receipt = yield evmClient.publicClient.waitForTransactionReceipt({
|
|
2309
2482
|
hash: txHash,
|
|
@@ -2356,10 +2529,19 @@ class Orchestrator {
|
|
|
2356
2529
|
const MAX_ATTEMPTS = 20;
|
|
2357
2530
|
let universalTxObj;
|
|
2358
2531
|
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
2532
|
+
console.log(`[Sync] Attempt ${attempt + 1}/${MAX_ATTEMPTS} | Query ID: ${idHex}`);
|
|
2359
2533
|
try {
|
|
2360
2534
|
const universalTxResp = yield this.pushClient.getUniversalTxById(idHex);
|
|
2361
2535
|
universalTxObj = universalTxResp === null || universalTxResp === void 0 ? void 0 : universalTxResp.universalTx;
|
|
2362
|
-
|
|
2536
|
+
// Wait until pcTx has at least one successful entry with a valid txHash
|
|
2537
|
+
const successfulPcTx = (_c = universalTxObj === null || universalTxObj === void 0 ? void 0 : universalTxObj.pcTx) === null || _c === void 0 ? void 0 : _c.find((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
2538
|
+
if (universalTxObj && (successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash))
|
|
2539
|
+
break;
|
|
2540
|
+
// Also break if we have a terminal failure state (all pcTx entries have been processed)
|
|
2541
|
+
const hasFailed = (universalTxObj === null || universalTxObj === void 0 ? void 0 : universalTxObj.universalStatus) === 4 && // PC_EXECUTED_FAILED
|
|
2542
|
+
((_d = universalTxObj === null || universalTxObj === void 0 ? void 0 : universalTxObj.pcTx) === null || _d === void 0 ? void 0 : _d.length) > 0 &&
|
|
2543
|
+
universalTxObj.pcTx.some((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
2544
|
+
if (hasFailed)
|
|
2363
2545
|
break;
|
|
2364
2546
|
}
|
|
2365
2547
|
catch (error) {
|
|
@@ -2380,7 +2562,7 @@ class Orchestrator {
|
|
|
2380
2562
|
}
|
|
2381
2563
|
return universalTxObj;
|
|
2382
2564
|
}
|
|
2383
|
-
catch (
|
|
2565
|
+
catch (_f) {
|
|
2384
2566
|
return undefined;
|
|
2385
2567
|
}
|
|
2386
2568
|
});
|
|
@@ -2563,8 +2745,8 @@ class Orchestrator {
|
|
|
2563
2745
|
var _a, _b;
|
|
2564
2746
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_02_01);
|
|
2565
2747
|
// Determine USD to deposit via gateway (8 decimals) with caps: min=$1, max=$10
|
|
2566
|
-
const oneUsd =
|
|
2567
|
-
const tenUsd =
|
|
2748
|
+
const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
|
|
2749
|
+
const tenUsd = utils_1.Utils.helpers.parseUnits('10', 8);
|
|
2568
2750
|
const deficit = requiredFunds > ueaBalance ? requiredFunds - ueaBalance : BigInt(0);
|
|
2569
2751
|
let depositUsd = deficit > BigInt(0) ? this.pushClient.pushToUSDC(deficit) : oneUsd;
|
|
2570
2752
|
if (depositUsd < oneUsd)
|
|
@@ -2606,7 +2788,7 @@ class Orchestrator {
|
|
|
2606
2788
|
// Convert USD(8) -> native units using pricing path
|
|
2607
2789
|
const nativeTokenUsdPrice = yield new price_fetch_1.PriceFetch(this.rpcUrls).getPrice(chain); // 8 decimals
|
|
2608
2790
|
const nativeDecimals = chain_1.CHAIN_INFO[chain].vm === enums_1.VM.SVM ? 9 : 18;
|
|
2609
|
-
const oneNativeUnit =
|
|
2791
|
+
const oneNativeUnit = utils_1.Utils.helpers.parseUnits('1', nativeDecimals);
|
|
2610
2792
|
// Ceil division to avoid rounding below min USD on-chain
|
|
2611
2793
|
let nativeAmount = (depositUsd * oneNativeUnit + (nativeTokenUsdPrice - BigInt(1))) /
|
|
2612
2794
|
nativeTokenUsdPrice;
|