@pushchain/core 4.0.8 → 4.0.10
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 +229 -49
- 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);
|
|
@@ -238,11 +253,8 @@ class Orchestrator {
|
|
|
238
253
|
if (execute.funds.token.mechanism === 'native') {
|
|
239
254
|
// Native SOL funds-only
|
|
240
255
|
const [tokenRateLimitPda] = web3_js_1.PublicKey.findProgramAddressSync([(0, viem_1.stringToBytes)('rate_limit'), web3_js_1.PublicKey.default.toBuffer()], programId);
|
|
241
|
-
const recipientNative = execute.to === ueaAddress
|
|
242
|
-
? Array.from(Buffer.alloc(20, 0))
|
|
243
|
-
: recipientEvm20;
|
|
244
256
|
const reqNative = this._buildSvmUniversalTxRequest({
|
|
245
|
-
recipient:
|
|
257
|
+
recipient: recipientEvm20,
|
|
246
258
|
token: web3_js_1.PublicKey.default,
|
|
247
259
|
amount: bridgeAmount,
|
|
248
260
|
payload: '0x',
|
|
@@ -287,9 +299,8 @@ class Orchestrator {
|
|
|
287
299
|
], ASSOCIATED_TOKEN_PROGRAM_ID)[0];
|
|
288
300
|
const [tokenRateLimitPda] = web3_js_1.PublicKey.findProgramAddressSync([(0, viem_1.stringToBytes)('rate_limit'), mintPk.toBuffer()], programId);
|
|
289
301
|
if (execute.to === ueaAddress) {
|
|
290
|
-
const recipientSpl = Array.from(Buffer.alloc(20, 0));
|
|
291
302
|
const reqSpl = this._buildSvmUniversalTxRequest({
|
|
292
|
-
recipient:
|
|
303
|
+
recipient: recipientEvm20,
|
|
293
304
|
token: mintPk,
|
|
294
305
|
amount: bridgeAmount,
|
|
295
306
|
payload: '0x',
|
|
@@ -360,8 +371,20 @@ class Orchestrator {
|
|
|
360
371
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_05);
|
|
361
372
|
// After origin confirmations, query Push Chain for UniversalTx status (SVM)
|
|
362
373
|
const pushChainUniversalTx = yield this.queryUniversalTxStatusFromGatewayTx(undefined, undefined, txSignature, 'sendFunds');
|
|
363
|
-
|
|
364
|
-
|
|
374
|
+
if (!((_b = pushChainUniversalTx === null || pushChainUniversalTx === void 0 ? void 0 : pushChainUniversalTx.pcTx) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
375
|
+
throw new Error(`Failed to retrieve Push Chain transaction status for gateway tx: ${txSignature}. ` +
|
|
376
|
+
`The transaction may have failed on Push Chain or not been indexed yet.`);
|
|
377
|
+
}
|
|
378
|
+
// Find the first successful pcTx with a valid txHash
|
|
379
|
+
const successfulPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
380
|
+
if (!(successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash)) {
|
|
381
|
+
const failedPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.status === 'FAILED' && pcTx.errorMsg);
|
|
382
|
+
const errorDetails = (failedPcTx === null || failedPcTx === void 0 ? void 0 : failedPcTx.errorMsg)
|
|
383
|
+
? `: ${failedPcTx.errorMsg}`
|
|
384
|
+
: '';
|
|
385
|
+
throw new Error(`No successful transaction found in Push Chain response for gateway tx: ${txSignature}${errorDetails}`);
|
|
386
|
+
}
|
|
387
|
+
const tx = yield this.pushClient.getTransaction(successfulPcTx.txHash);
|
|
365
388
|
const response = yield this.transformToUniversalTxResponse(tx);
|
|
366
389
|
// Funds Flow: Funds credited on Push Chain
|
|
367
390
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_06, bridgeAmount, execute.funds.token.decimals, symbol);
|
|
@@ -396,7 +419,7 @@ class Orchestrator {
|
|
|
396
419
|
const gasEstimate = execute.gasLimit || BigInt(1e7);
|
|
397
420
|
const gasPrice = yield this.pushClient.getGasPrice();
|
|
398
421
|
const requiredGasFee = gasEstimate * gasPrice;
|
|
399
|
-
const payloadValue = (
|
|
422
|
+
const payloadValue = (_c = execute.value) !== null && _c !== void 0 ? _c : BigInt(0);
|
|
400
423
|
const requiredFunds = requiredGasFee + payloadValue;
|
|
401
424
|
const ueaAddress = this.computeUEAOffchain();
|
|
402
425
|
const [ueaBalance] = yield Promise.all([
|
|
@@ -405,8 +428,8 @@ class Orchestrator {
|
|
|
405
428
|
// UEA resolved (address, deployment status, balance, nonce)
|
|
406
429
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_02, ueaAddress, deployed);
|
|
407
430
|
// Determine USD to deposit via gateway (8 decimals) with caps: min=$1, max=$10
|
|
408
|
-
const oneUsd =
|
|
409
|
-
const tenUsd =
|
|
431
|
+
const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
|
|
432
|
+
const tenUsd = utils_1.Utils.helpers.parseUnits('10', 8);
|
|
410
433
|
const deficit = requiredFunds > ueaBalance ? requiredFunds - ueaBalance : BigInt(0);
|
|
411
434
|
let depositUsd = deficit > BigInt(0) ? this.pushClient.pushToUSDC(deficit) : oneUsd;
|
|
412
435
|
if (depositUsd < oneUsd)
|
|
@@ -429,8 +452,8 @@ class Orchestrator {
|
|
|
429
452
|
functionName: 'config',
|
|
430
453
|
args: [configPda.toBase58()],
|
|
431
454
|
});
|
|
432
|
-
const minField = (
|
|
433
|
-
const maxField = (
|
|
455
|
+
const minField = (_d = cfg.minCapUniversalTxUsd) !== null && _d !== void 0 ? _d : cfg.min_cap_universal_tx_usd;
|
|
456
|
+
const maxField = (_e = cfg.maxCapUniversalTxUsd) !== null && _e !== void 0 ? _e : cfg.max_cap_universal_tx_usd;
|
|
434
457
|
const minCapUsd = BigInt(minField.toString());
|
|
435
458
|
const maxCapUsd = BigInt(maxField.toString());
|
|
436
459
|
if (depositUsd < minCapUsd)
|
|
@@ -442,14 +465,14 @@ class Orchestrator {
|
|
|
442
465
|
if (depositUsd > maxCapUsd)
|
|
443
466
|
depositUsd = maxCapUsd;
|
|
444
467
|
}
|
|
445
|
-
catch (
|
|
468
|
+
catch (_p) {
|
|
446
469
|
// best-effort; fallback to previous bounds if read fails
|
|
447
470
|
}
|
|
448
471
|
}
|
|
449
472
|
// Convert USD(8) -> native units using pricing path
|
|
450
473
|
const nativeTokenUsdPrice = yield new price_fetch_1.PriceFetch(this.rpcUrls).getPrice(chain); // 8 decimals
|
|
451
474
|
const nativeDecimals = chain_1.CHAIN_INFO[chain].vm === enums_1.VM.SVM ? 9 : 18;
|
|
452
|
-
const oneNativeUnit =
|
|
475
|
+
const oneNativeUnit = utils_1.Utils.helpers.parseUnits('1', nativeDecimals);
|
|
453
476
|
// Ceil division to avoid rounding below min USD on-chain
|
|
454
477
|
let nativeAmount = (depositUsd * oneNativeUnit + (nativeTokenUsdPrice - BigInt(1))) /
|
|
455
478
|
nativeTokenUsdPrice;
|
|
@@ -466,12 +489,16 @@ class Orchestrator {
|
|
|
466
489
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_01, bridgeAmount, execute.funds.token.decimals, symbol);
|
|
467
490
|
if (chain_1.CHAIN_INFO[this.universalSigner.account.chain].vm === enums_1.VM.EVM) {
|
|
468
491
|
const tokenAddr = execute.funds.token.address;
|
|
469
|
-
if (mechanism
|
|
470
|
-
|
|
492
|
+
if (mechanism === 'approve') {
|
|
493
|
+
// ERC-20 tokens: ensure gateway has approval
|
|
494
|
+
const evmClientEvm = evmClient;
|
|
495
|
+
const gatewayAddressEvm = gatewayAddress;
|
|
496
|
+
yield this.ensureErc20Allowance(evmClientEvm, tokenAddr, gatewayAddressEvm, bridgeAmount);
|
|
471
497
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
498
|
+
else if (mechanism === 'permit2') {
|
|
499
|
+
throw new Error('Permit2 is not supported yet');
|
|
500
|
+
}
|
|
501
|
+
// Native tokens (mechanism === 'native') don't need approval - handled via msg.value
|
|
475
502
|
}
|
|
476
503
|
let txHash;
|
|
477
504
|
try {
|
|
@@ -489,7 +516,7 @@ class Orchestrator {
|
|
|
489
516
|
// New behavior: if user provided a gasTokenAddress, pay gas in that token via Uniswap quote
|
|
490
517
|
// Determine pay-with token address, min-out and slippage
|
|
491
518
|
const payWith = execute.payGasWith;
|
|
492
|
-
const gasTokenAddress = (
|
|
519
|
+
const gasTokenAddress = (_f = payWith === null || payWith === void 0 ? void 0 : payWith.token) === null || _f === void 0 ? void 0 : _f.address;
|
|
493
520
|
if (gasTokenAddress) {
|
|
494
521
|
if (chain !== enums_1.CHAIN.ETHEREUM_SEPOLIA) {
|
|
495
522
|
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 +524,7 @@ class Orchestrator {
|
|
|
497
524
|
let amountOutMinETH = (payWith === null || payWith === void 0 ? void 0 : payWith.minAmountOut) !== undefined
|
|
498
525
|
? BigInt(payWith.minAmountOut)
|
|
499
526
|
: nativeAmount;
|
|
500
|
-
const slippageBps = (
|
|
527
|
+
const slippageBps = (_g = payWith === null || payWith === void 0 ? void 0 : payWith.slippageBps) !== null && _g !== void 0 ? _g : 100;
|
|
501
528
|
amountOutMinETH = BigInt(push_chain_1.PushChain.utils.conversion.slippageToMinAmount(amountOutMinETH.toString(), { slippageBps }));
|
|
502
529
|
const { gasAmount } = yield this.calculateGasAmountFromAmountOutMinETH(gasTokenAddress, amountOutMinETH);
|
|
503
530
|
const deadline = BigInt(0);
|
|
@@ -509,10 +536,10 @@ class Orchestrator {
|
|
|
509
536
|
ownerAddress,
|
|
510
537
|
});
|
|
511
538
|
if (gasTokenBalance < gasAmount) {
|
|
512
|
-
const sym = (
|
|
513
|
-
const decimals = (
|
|
514
|
-
const needFmt =
|
|
515
|
-
const haveFmt =
|
|
539
|
+
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';
|
|
540
|
+
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;
|
|
541
|
+
const needFmt = utils_1.Utils.helpers.formatUnits(gasAmount, decimals);
|
|
542
|
+
const haveFmt = utils_1.Utils.helpers.formatUnits(gasTokenBalance, decimals);
|
|
516
543
|
throw new Error(`Insufficient ${sym} balance to cover gas fees: need ${needFmt}, have ${haveFmt}`);
|
|
517
544
|
}
|
|
518
545
|
// Approve gas token to gateway
|
|
@@ -558,13 +585,19 @@ class Orchestrator {
|
|
|
558
585
|
// payload: this.encodeUniversalPayload(universalPayload),
|
|
559
586
|
// });
|
|
560
587
|
// VALUE + PAYLOAD + FUNDS && PAYLOAD + FUNDS
|
|
588
|
+
// For native tokens: msg.value = gas amount + bridge amount
|
|
589
|
+
// For ERC-20 tokens: msg.value = gas amount only (bridge handled via token transfer)
|
|
590
|
+
const isNativeToken = mechanism === 'native';
|
|
591
|
+
const totalValue = isNativeToken
|
|
592
|
+
? nativeAmount + bridgeAmount
|
|
593
|
+
: nativeAmount;
|
|
561
594
|
txHash = yield evmClientEvm.writeContract({
|
|
562
595
|
abi: abi_1.UNIVERSAL_GATEWAY_V0,
|
|
563
596
|
address: gatewayAddressEvm,
|
|
564
597
|
functionName: 'sendUniversalTx',
|
|
565
598
|
args: [req],
|
|
566
599
|
signer: this.universalSigner,
|
|
567
|
-
value:
|
|
600
|
+
value: totalValue,
|
|
568
601
|
});
|
|
569
602
|
}
|
|
570
603
|
}
|
|
@@ -632,8 +665,20 @@ class Orchestrator {
|
|
|
632
665
|
pushChainUniversalTx =
|
|
633
666
|
yield this.queryUniversalTxStatusFromGatewayTx(undefined, undefined, txHash, 'sendTxWithFunds');
|
|
634
667
|
}
|
|
635
|
-
|
|
636
|
-
|
|
668
|
+
if (!((_m = pushChainUniversalTx === null || pushChainUniversalTx === void 0 ? void 0 : pushChainUniversalTx.pcTx) === null || _m === void 0 ? void 0 : _m.length)) {
|
|
669
|
+
throw new Error(`Failed to retrieve Push Chain transaction status for gateway tx: ${txHash}. ` +
|
|
670
|
+
`The transaction may have failed on Push Chain or not been indexed yet.`);
|
|
671
|
+
}
|
|
672
|
+
// Find the first successful pcTx with a valid txHash
|
|
673
|
+
const successfulPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
674
|
+
if (!(successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash)) {
|
|
675
|
+
const failedPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.status === 'FAILED' && pcTx.errorMsg);
|
|
676
|
+
const errorDetails = (failedPcTx === null || failedPcTx === void 0 ? void 0 : failedPcTx.errorMsg)
|
|
677
|
+
? `: ${failedPcTx.errorMsg}`
|
|
678
|
+
: '';
|
|
679
|
+
throw new Error(`No successful transaction found in Push Chain response for gateway tx: ${txHash}${errorDetails}`);
|
|
680
|
+
}
|
|
681
|
+
const tx = yield this.pushClient.getTransaction(successfulPcTx.txHash);
|
|
637
682
|
const response = yield this.transformToUniversalTxResponse(tx);
|
|
638
683
|
// Funds Flow: Funds credited on Push Chain
|
|
639
684
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_06_06, bridgeAmount, execute.funds.token.decimals, symbol);
|
|
@@ -808,7 +853,7 @@ class Orchestrator {
|
|
|
808
853
|
* Fee Locking - For all chains, EVM and Solana
|
|
809
854
|
*/
|
|
810
855
|
const fundDifference = requiredFunds - funds;
|
|
811
|
-
const fixedPushAmount =
|
|
856
|
+
const fixedPushAmount = utils_1.Utils.helpers.parseUnits('0.001', 18); // Minimum lock 0.001 Push tokens
|
|
812
857
|
const lockAmount = funds < requiredFunds ? fundDifference : fixedPushAmount;
|
|
813
858
|
const lockAmountInUSD = this.pushClient.pushToUSDC(lockAmount);
|
|
814
859
|
const feeLockTxHashBytes = yield this.lockFee(lockAmountInUSD, universalPayload, req);
|
|
@@ -833,8 +878,20 @@ class Orchestrator {
|
|
|
833
878
|
* Note: queryTx may be undefined since validators don't recognize new UniversalTx event yet
|
|
834
879
|
*/
|
|
835
880
|
// Transform to UniversalTxResponse (follow sendFunds pattern)
|
|
836
|
-
|
|
837
|
-
|
|
881
|
+
if (!((_o = pushChainUniversalTx === null || pushChainUniversalTx === void 0 ? void 0 : pushChainUniversalTx.pcTx) === null || _o === void 0 ? void 0 : _o.length)) {
|
|
882
|
+
throw new Error(`Failed to retrieve Push Chain transaction status for gateway tx: ${feeLockTxHash}. ` +
|
|
883
|
+
`The transaction may have failed on Push Chain or not been indexed yet.`);
|
|
884
|
+
}
|
|
885
|
+
// Find the first successful pcTx with a valid txHash
|
|
886
|
+
const successfulPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.txHash && pcTx.status === 'SUCCESS');
|
|
887
|
+
if (!(successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash)) {
|
|
888
|
+
const failedPcTx = pushChainUniversalTx.pcTx.find((pcTx) => pcTx.status === 'FAILED' && pcTx.errorMsg);
|
|
889
|
+
const errorDetails = (failedPcTx === null || failedPcTx === void 0 ? void 0 : failedPcTx.errorMsg)
|
|
890
|
+
? `: ${failedPcTx.errorMsg}`
|
|
891
|
+
: '';
|
|
892
|
+
throw new Error(`No successful transaction found in Push Chain response for gateway tx: ${feeLockTxHash}${errorDetails}`);
|
|
893
|
+
}
|
|
894
|
+
const tx = yield this.pushClient.getTransaction(successfulPcTx.txHash);
|
|
838
895
|
const response = yield this.transformToUniversalTxResponse(tx);
|
|
839
896
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_99_01, [response]);
|
|
840
897
|
return response;
|
|
@@ -891,8 +948,8 @@ class Orchestrator {
|
|
|
891
948
|
]);
|
|
892
949
|
const nativeDecimals = 18; // ETH, MATIC, etc.
|
|
893
950
|
// Ensure deposit respects gateway USD caps (min $1, max $10) and avoid rounding below min
|
|
894
|
-
const oneUsd =
|
|
895
|
-
const tenUsd =
|
|
951
|
+
const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
|
|
952
|
+
const tenUsd = utils_1.Utils.helpers.parseUnits('10', 8);
|
|
896
953
|
let depositUsd = amount < oneUsd ? oneUsd : amount;
|
|
897
954
|
if (depositUsd > tenUsd)
|
|
898
955
|
depositUsd = tenUsd;
|
|
@@ -927,8 +984,8 @@ class Orchestrator {
|
|
|
927
984
|
]);
|
|
928
985
|
// Ensure deposit respects gateway USD caps (min $1, max $10) and avoid rounding below min
|
|
929
986
|
const nativeDecimals = 9; // SOL lamports
|
|
930
|
-
const oneUsd =
|
|
931
|
-
const tenUsd =
|
|
987
|
+
const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
|
|
988
|
+
const tenUsd = utils_1.Utils.helpers.parseUnits('10', 8);
|
|
932
989
|
let depositUsd = amount < oneUsd ? oneUsd : amount;
|
|
933
990
|
if (depositUsd > tenUsd)
|
|
934
991
|
depositUsd = tenUsd;
|
|
@@ -1389,6 +1446,118 @@ class Orchestrator {
|
|
|
1389
1446
|
vTypeBytes,
|
|
1390
1447
|
]);
|
|
1391
1448
|
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Tracks a transaction by hash on Push Chain
|
|
1451
|
+
* @param txHash - Transaction hash to track
|
|
1452
|
+
* @param options - Tracking options (chain, progress hooks, polling config)
|
|
1453
|
+
* @returns Promise resolving to UniversalTxReceipt when transaction is confirmed
|
|
1454
|
+
*/
|
|
1455
|
+
trackTransaction(txHash, options) {
|
|
1456
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1457
|
+
const { chain = this.getPushChainForNetwork(), progress, waitForCompletion = true, advanced = {}, } = options !== null && options !== void 0 ? options : {};
|
|
1458
|
+
const { pollingIntervalMs = 1000, timeout = 300000, rpcUrls = {}, } = advanced;
|
|
1459
|
+
// Use custom progress hook if provided, otherwise use instance hook
|
|
1460
|
+
const progressHookFn = progress !== null && progress !== void 0 ? progress : this.progressHook;
|
|
1461
|
+
// Emit TRACK_TX_01 - tracking started
|
|
1462
|
+
if (progressHookFn) {
|
|
1463
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_01](txHash, chain);
|
|
1464
|
+
this.printLog(hookPayload.message);
|
|
1465
|
+
progressHookFn(hookPayload);
|
|
1466
|
+
}
|
|
1467
|
+
// Create client for target chain with optional RPC override
|
|
1468
|
+
const chainRPCs = rpcUrls[chain] || this.rpcUrls[chain] || chain_1.CHAIN_INFO[chain].defaultRPC;
|
|
1469
|
+
const client = new push_client_1.PushClient({
|
|
1470
|
+
rpcUrls: chainRPCs,
|
|
1471
|
+
network: this.pushNetwork,
|
|
1472
|
+
});
|
|
1473
|
+
// Try to get transaction immediately
|
|
1474
|
+
try {
|
|
1475
|
+
const tx = yield client.getTransaction(txHash);
|
|
1476
|
+
if (!waitForCompletion) {
|
|
1477
|
+
// Non-blocking mode: return current receipt immediately
|
|
1478
|
+
const receipt = yield tx.wait(0);
|
|
1479
|
+
const universalTxResponse = yield this.transformToUniversalTxResponse(tx);
|
|
1480
|
+
return this.transformToUniversalTxReceipt(receipt, universalTxResponse);
|
|
1481
|
+
}
|
|
1482
|
+
// Blocking mode: wait for confirmation
|
|
1483
|
+
const receipt = yield tx.wait(1);
|
|
1484
|
+
const universalTxResponse = yield this.transformToUniversalTxResponse(tx);
|
|
1485
|
+
// Emit TRACK_TX_99_01 - tracking complete
|
|
1486
|
+
if (progressHookFn) {
|
|
1487
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_99_01](txHash, universalTxResponse);
|
|
1488
|
+
this.printLog(hookPayload.message);
|
|
1489
|
+
progressHookFn(hookPayload);
|
|
1490
|
+
}
|
|
1491
|
+
return this.transformToUniversalTxReceipt(receipt, universalTxResponse);
|
|
1492
|
+
}
|
|
1493
|
+
catch (initialError) {
|
|
1494
|
+
// Transaction not found yet - start polling if waitForCompletion is true
|
|
1495
|
+
if (!waitForCompletion) {
|
|
1496
|
+
// Non-blocking and tx not found - throw error
|
|
1497
|
+
const errorMsg = initialError instanceof Error ? initialError.message : 'Transaction not found';
|
|
1498
|
+
if (progressHookFn) {
|
|
1499
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_99_02](txHash, errorMsg);
|
|
1500
|
+
this.printLog(hookPayload.message);
|
|
1501
|
+
progressHookFn(hookPayload);
|
|
1502
|
+
}
|
|
1503
|
+
throw new Error(`Transaction ${txHash} not found: ${errorMsg}`);
|
|
1504
|
+
}
|
|
1505
|
+
// Blocking mode: poll until found or timeout
|
|
1506
|
+
const start = Date.now();
|
|
1507
|
+
while (true) {
|
|
1508
|
+
// Emit TRACK_TX_02 - querying status
|
|
1509
|
+
if (progressHookFn) {
|
|
1510
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_02](txHash);
|
|
1511
|
+
this.printLog(hookPayload.message);
|
|
1512
|
+
progressHookFn(hookPayload);
|
|
1513
|
+
}
|
|
1514
|
+
try {
|
|
1515
|
+
const tx = yield client.getTransaction(txHash);
|
|
1516
|
+
const receipt = yield tx.wait(1);
|
|
1517
|
+
const universalTxResponse = yield this.transformToUniversalTxResponse(tx);
|
|
1518
|
+
// Success - emit TRACK_TX_99_01
|
|
1519
|
+
if (progressHookFn) {
|
|
1520
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_99_01](txHash, universalTxResponse);
|
|
1521
|
+
this.printLog(hookPayload.message);
|
|
1522
|
+
progressHookFn(hookPayload);
|
|
1523
|
+
}
|
|
1524
|
+
return this.transformToUniversalTxReceipt(receipt, universalTxResponse);
|
|
1525
|
+
}
|
|
1526
|
+
catch (err) {
|
|
1527
|
+
// Transaction not found yet or error - continue polling
|
|
1528
|
+
this.printLog(`Transaction ${txHash} not found yet, continuing to poll...`);
|
|
1529
|
+
}
|
|
1530
|
+
// Check timeout
|
|
1531
|
+
if (Date.now() - start > timeout) {
|
|
1532
|
+
const timeoutMsg = `Timeout: transaction ${txHash} not confirmed within ${timeout}ms`;
|
|
1533
|
+
if (progressHookFn) {
|
|
1534
|
+
const hookPayload = progress_hook_1.default[progress_hook_types_1.PROGRESS_HOOK.TRACK_TX_99_02](txHash, 'Timeout');
|
|
1535
|
+
this.printLog(hookPayload.message);
|
|
1536
|
+
progressHookFn(hookPayload);
|
|
1537
|
+
}
|
|
1538
|
+
throw new Error(timeoutMsg);
|
|
1539
|
+
}
|
|
1540
|
+
// Wait before next poll
|
|
1541
|
+
yield new Promise((r) => setTimeout(r, pollingIntervalMs));
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Returns the Push Chain enum value for the current network
|
|
1548
|
+
*/
|
|
1549
|
+
getPushChainForNetwork() {
|
|
1550
|
+
if (this.pushNetwork === enums_1.PUSH_NETWORK.MAINNET) {
|
|
1551
|
+
return enums_1.CHAIN.PUSH_MAINNET;
|
|
1552
|
+
}
|
|
1553
|
+
else if (this.pushNetwork === enums_1.PUSH_NETWORK.TESTNET_DONUT ||
|
|
1554
|
+
this.pushNetwork === enums_1.PUSH_NETWORK.TESTNET) {
|
|
1555
|
+
return enums_1.CHAIN.PUSH_TESTNET_DONUT;
|
|
1556
|
+
}
|
|
1557
|
+
else {
|
|
1558
|
+
return enums_1.CHAIN.PUSH_LOCALNET;
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1392
1561
|
/**
|
|
1393
1562
|
* Computes UEA for given UniversalAccount
|
|
1394
1563
|
* @dev - This fn calls a view fn of Factory Contract
|
|
@@ -1813,10 +1982,10 @@ class Orchestrator {
|
|
|
1813
1982
|
throw new Error('No direct Uniswap V3 pool found for the given token pair on common fee tiers');
|
|
1814
1983
|
}
|
|
1815
1984
|
const amountInBig = BigInt(bestAmountIn);
|
|
1816
|
-
const amountInHuman = parseFloat(
|
|
1985
|
+
const amountInHuman = parseFloat(utils_1.Utils.helpers.formatUnits(amountInBig, {
|
|
1817
1986
|
decimals: from.decimals,
|
|
1818
1987
|
}));
|
|
1819
|
-
const amountOutHuman = parseFloat(
|
|
1988
|
+
const amountOutHuman = parseFloat(utils_1.Utils.helpers.formatUnits(amountOut, { decimals: to.decimals }));
|
|
1820
1989
|
const rate = amountInHuman > 0 ? amountOutHuman / amountInHuman : 0;
|
|
1821
1990
|
return {
|
|
1822
1991
|
amountIn: bestAmountIn.toString(),
|
|
@@ -2288,7 +2457,7 @@ class Orchestrator {
|
|
|
2288
2457
|
// Query Push Chain for UniversalTx status given an origin gateway tx (EVM or SVM)
|
|
2289
2458
|
queryUniversalTxStatusFromGatewayTx(evmClient, gatewayAddress, txHash, evmGatewayMethod) {
|
|
2290
2459
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2291
|
-
var _a, _b;
|
|
2460
|
+
var _a, _b, _c, _d;
|
|
2292
2461
|
try {
|
|
2293
2462
|
const chain = this.universalSigner.account.chain;
|
|
2294
2463
|
const { vm } = chain_1.CHAIN_INFO[chain];
|
|
@@ -2303,7 +2472,7 @@ class Orchestrator {
|
|
|
2303
2472
|
hash: txHash,
|
|
2304
2473
|
});
|
|
2305
2474
|
}
|
|
2306
|
-
catch (
|
|
2475
|
+
catch (_e) {
|
|
2307
2476
|
// Receipt might not be indexed yet on this RPC; wait briefly for it
|
|
2308
2477
|
receipt = yield evmClient.publicClient.waitForTransactionReceipt({
|
|
2309
2478
|
hash: txHash,
|
|
@@ -2356,10 +2525,21 @@ class Orchestrator {
|
|
|
2356
2525
|
const MAX_ATTEMPTS = 20;
|
|
2357
2526
|
let universalTxObj;
|
|
2358
2527
|
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
2528
|
+
console.log(`[Sync] Attempt ${attempt + 1}/${MAX_ATTEMPTS} | Query ID: ${idHex}`);
|
|
2359
2529
|
try {
|
|
2360
2530
|
const universalTxResp = yield this.pushClient.getUniversalTxById(idHex);
|
|
2361
2531
|
universalTxObj = universalTxResp === null || universalTxResp === void 0 ? void 0 : universalTxResp.universalTx;
|
|
2362
|
-
|
|
2532
|
+
// Wait until pcTx has at least one successful entry with a valid txHash
|
|
2533
|
+
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');
|
|
2534
|
+
if (universalTxObj && (successfulPcTx === null || successfulPcTx === void 0 ? void 0 : successfulPcTx.txHash))
|
|
2535
|
+
break;
|
|
2536
|
+
// Also break if we have a terminal failure state
|
|
2537
|
+
// universalStatus 4 = PC_EXECUTED_FAILED, 5 = REVERTED
|
|
2538
|
+
const isTerminalFailure = ((_d = universalTxObj === null || universalTxObj === void 0 ? void 0 : universalTxObj.pcTx) === null || _d === void 0 ? void 0 : _d.length) > 0 &&
|
|
2539
|
+
((universalTxObj === null || universalTxObj === void 0 ? void 0 : universalTxObj.universalStatus) === 4 ||
|
|
2540
|
+
(universalTxObj === null || universalTxObj === void 0 ? void 0 : universalTxObj.universalStatus) === 5) &&
|
|
2541
|
+
universalTxObj.pcTx.some((pcTx) => pcTx.status === 'FAILED' || pcTx.status === 'REVERTED');
|
|
2542
|
+
if (isTerminalFailure)
|
|
2363
2543
|
break;
|
|
2364
2544
|
}
|
|
2365
2545
|
catch (error) {
|
|
@@ -2380,7 +2560,7 @@ class Orchestrator {
|
|
|
2380
2560
|
}
|
|
2381
2561
|
return universalTxObj;
|
|
2382
2562
|
}
|
|
2383
|
-
catch (
|
|
2563
|
+
catch (_f) {
|
|
2384
2564
|
return undefined;
|
|
2385
2565
|
}
|
|
2386
2566
|
});
|
|
@@ -2563,8 +2743,8 @@ class Orchestrator {
|
|
|
2563
2743
|
var _a, _b;
|
|
2564
2744
|
this.executeProgressHook(progress_hook_types_1.PROGRESS_HOOK.SEND_TX_02_01);
|
|
2565
2745
|
// Determine USD to deposit via gateway (8 decimals) with caps: min=$1, max=$10
|
|
2566
|
-
const oneUsd =
|
|
2567
|
-
const tenUsd =
|
|
2746
|
+
const oneUsd = utils_1.Utils.helpers.parseUnits('1', 8);
|
|
2747
|
+
const tenUsd = utils_1.Utils.helpers.parseUnits('10', 8);
|
|
2568
2748
|
const deficit = requiredFunds > ueaBalance ? requiredFunds - ueaBalance : BigInt(0);
|
|
2569
2749
|
let depositUsd = deficit > BigInt(0) ? this.pushClient.pushToUSDC(deficit) : oneUsd;
|
|
2570
2750
|
if (depositUsd < oneUsd)
|
|
@@ -2606,7 +2786,7 @@ class Orchestrator {
|
|
|
2606
2786
|
// Convert USD(8) -> native units using pricing path
|
|
2607
2787
|
const nativeTokenUsdPrice = yield new price_fetch_1.PriceFetch(this.rpcUrls).getPrice(chain); // 8 decimals
|
|
2608
2788
|
const nativeDecimals = chain_1.CHAIN_INFO[chain].vm === enums_1.VM.SVM ? 9 : 18;
|
|
2609
|
-
const oneNativeUnit =
|
|
2789
|
+
const oneNativeUnit = utils_1.Utils.helpers.parseUnits('1', nativeDecimals);
|
|
2610
2790
|
// Ceil division to avoid rounding below min USD on-chain
|
|
2611
2791
|
let nativeAmount = (depositUsd * oneNativeUnit + (nativeTokenUsdPrice - BigInt(1))) /
|
|
2612
2792
|
nativeTokenUsdPrice;
|