@pushchain/core 5.1.18 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/constants/abi/cea.evm.d.ts +52 -0
- package/src/lib/constants/abi/cea.evm.js +66 -1
- package/src/lib/constants/abi/prc20.evm.d.ts +117 -11
- package/src/lib/constants/abi/prc20.evm.js +38 -11
- package/src/lib/constants/abi/uea.evm.js +41 -0
- package/src/lib/constants/abi/universalGatewayPC.evm.d.ts +117 -1
- package/src/lib/constants/abi/universalGatewayPC.evm.js +40 -1
- package/src/lib/constants/abi/universalGatewayV0.json +1 -1
- package/src/lib/constants/chain.js +14 -14
- package/src/lib/constants/tokens.js +1 -0
- package/src/lib/formatters.d.ts +6 -0
- package/src/lib/formatters.js +14 -0
- package/src/lib/index.d.ts +2 -0
- package/src/lib/index.js +7 -1
- package/src/lib/orchestrator/internals/cascade.js +139 -81
- package/src/lib/orchestrator/internals/errors.js +1 -1
- package/src/lib/orchestrator/internals/execute-funds-only.js +3 -2
- package/src/lib/orchestrator/internals/execute-funds-payload.js +2 -1
- package/src/lib/orchestrator/internals/execute-standard.js +4 -4
- package/src/lib/orchestrator/internals/gas-calculator.d.ts +1 -0
- package/src/lib/orchestrator/internals/gas-calculator.js +13 -11
- package/src/lib/orchestrator/internals/helpers.js +1 -0
- package/src/lib/orchestrator/internals/inbound-tracker.js +4 -2
- package/src/lib/orchestrator/internals/outbound-sync.js +73 -60
- package/src/lib/orchestrator/internals/pc-usd-oracle.d.ts +1 -1
- package/src/lib/orchestrator/internals/pc-usd-oracle.js +4 -3
- package/src/lib/orchestrator/internals/push-chain-tx.js +5 -1
- package/src/lib/orchestrator/internals/route-handlers.js +155 -185
- package/src/lib/orchestrator/internals/signing.js +7 -2
- package/src/lib/orchestrator/internals/svm-helpers.js +3 -3
- package/src/lib/orchestrator/internals/svm-rent.d.ts +42 -9
- package/src/lib/orchestrator/internals/svm-rent.js +148 -14
- package/src/lib/orchestrator/internals/tx-transformer.js +5 -2
- package/src/lib/orchestrator/max-pc-for-gas.d.ts +60 -0
- package/src/lib/orchestrator/max-pc-for-gas.js +66 -0
- package/src/lib/orchestrator/orchestrator.d.ts +1 -0
- package/src/lib/orchestrator/orchestrator.types.d.ts +31 -9
- package/src/lib/orchestrator/payload-builders.d.ts +7 -6
- package/src/lib/orchestrator/payload-builders.js +18 -6
- package/src/lib/progress-hook/progress-hook.js +26 -18
- package/src/lib/universal-tx-detector/events.d.ts +3 -1
- package/src/lib/universal-tx-detector/events.js +3 -1
- package/src/lib/universal-tx-detector/svm-events.d.ts +1 -1
- package/src/lib/universal-tx-detector/svm-events.js +1 -1
|
@@ -6,6 +6,7 @@ exports.buildCeaMulticallPayload = buildCeaMulticallPayload;
|
|
|
6
6
|
exports.buildInboundUniversalPayload = buildInboundUniversalPayload;
|
|
7
7
|
exports.buildSendUniversalTxToUEA = buildSendUniversalTxToUEA;
|
|
8
8
|
exports.buildOutboundRequest = buildOutboundRequest;
|
|
9
|
+
exports.assertCeaFundsParkingInvariant = assertCeaFundsParkingInvariant;
|
|
9
10
|
exports.buildErc20Transfer = buildErc20Transfer;
|
|
10
11
|
exports.buildErc20WithdrawalMulticall = buildErc20WithdrawalMulticall;
|
|
11
12
|
exports.buildMigrationPayload = buildMigrationPayload;
|
|
@@ -225,27 +226,38 @@ function buildSendUniversalTxToUEA(ceaAddress, token, amount, payload, revertRec
|
|
|
225
226
|
/**
|
|
226
227
|
* Build UniversalOutboundTxRequest for Push Chain outbound
|
|
227
228
|
*
|
|
228
|
-
* @param target -
|
|
229
|
-
*
|
|
230
|
-
* The relay determines the destination from the PRC-20 token's SOURCE_CHAIN_NAMESPACE.
|
|
231
|
-
* Will be removed in future contract upgrades.
|
|
229
|
+
* @param target - Raw recipient bytes for the destination chain. For EVM CEA
|
|
230
|
+
* funds-parking, use the zero recipient when payload is empty.
|
|
232
231
|
* @param prc20Token - PRC20 token address to burn (or address(0) for native)
|
|
233
232
|
* @param amount - Amount to burn
|
|
234
233
|
* @param gasLimit - Gas limit for fee calculation
|
|
235
|
-
* @param payload -
|
|
234
|
+
* @param payload - Destination execution payload
|
|
236
235
|
* @param revertRecipient - Address to receive funds on revert
|
|
236
|
+
* @param maxPCForGas - Max native PC used for gas swap (0 = uncapped)
|
|
237
|
+
* @param gasPrice - Destination-chain gas price override (0 = UniversalCore default)
|
|
237
238
|
* @returns UniversalOutboundTxRequest object
|
|
238
239
|
*/
|
|
239
|
-
function buildOutboundRequest(target, prc20Token, amount, gasLimit, payload, revertRecipient) {
|
|
240
|
+
function buildOutboundRequest(target, prc20Token, amount, gasLimit, payload, revertRecipient, maxPCForGas = BigInt(0), gasPrice = BigInt(0)) {
|
|
240
241
|
return {
|
|
241
242
|
target,
|
|
242
243
|
token: prc20Token,
|
|
243
244
|
amount,
|
|
244
245
|
gasLimit,
|
|
246
|
+
gasPrice,
|
|
247
|
+
maxPCForGas,
|
|
245
248
|
payload,
|
|
246
249
|
revertRecipient,
|
|
247
250
|
};
|
|
248
251
|
}
|
|
252
|
+
function assertCeaFundsParkingInvariant(recipient, payload) {
|
|
253
|
+
if (payload !== '0x')
|
|
254
|
+
return;
|
|
255
|
+
if (recipient === '0x')
|
|
256
|
+
return;
|
|
257
|
+
if (recipient.toLowerCase() === selectors_1.ZERO_ADDRESS.toLowerCase())
|
|
258
|
+
return;
|
|
259
|
+
throw new Error('Empty CEA payloads must use the zero recipient to park funds');
|
|
260
|
+
}
|
|
249
261
|
/**
|
|
250
262
|
* Build ERC20 transfer multicall
|
|
251
263
|
*
|
|
@@ -251,13 +251,16 @@ const RAW_HOOKS_R1 = {
|
|
|
251
251
|
level: 'SUCCESS',
|
|
252
252
|
};
|
|
253
253
|
},
|
|
254
|
-
[progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_02]: (errMessage, decodedError) =>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
254
|
+
[progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_02]: (errMessage, decodedError) => {
|
|
255
|
+
const normalizedErrMessage = (0, formatters_1.normalizePcInsufficientFundsError)(errMessage);
|
|
256
|
+
return {
|
|
257
|
+
id: progress_hook_types_1.PROGRESS_HOOK.SEND_TX_199_02,
|
|
258
|
+
title: 'Push Chain Tx Failed',
|
|
259
|
+
message: normalizedErrMessage,
|
|
260
|
+
response: Object.assign({ error: normalizedErrMessage }, (decodedError ? { decodedError } : {})),
|
|
261
|
+
level: 'ERROR',
|
|
262
|
+
};
|
|
263
|
+
},
|
|
261
264
|
};
|
|
262
265
|
// =============================================================================
|
|
263
266
|
// Route 2 — UEA → UGPC → CEA on target chain (201–299, signature-only)
|
|
@@ -664,17 +667,22 @@ const RAW_HOOKS_R3 = {
|
|
|
664
667
|
// Phase is passed by the emission site so the title matches the leg that
|
|
665
668
|
// actually failed. Default stays 'inbound' for callers that don't specify
|
|
666
669
|
// (backwards-compat with fixtures + response-builder's inbound block).
|
|
667
|
-
[progress_hook_types_1.PROGRESS_HOOK.SEND_TX_399_02]: (errorMessage, phase = 'inbound', chain, decodedError) =>
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
670
|
+
[progress_hook_types_1.PROGRESS_HOOK.SEND_TX_399_02]: (errorMessage, phase = 'inbound', chain, decodedError) => {
|
|
671
|
+
const normalizedErrorMessage = phase === 'push'
|
|
672
|
+
? (0, formatters_1.normalizePcInsufficientFundsError)(errorMessage)
|
|
673
|
+
: errorMessage;
|
|
674
|
+
return {
|
|
675
|
+
id: progress_hook_types_1.PROGRESS_HOOK.SEND_TX_399_02,
|
|
676
|
+
title: phase === 'outbound'
|
|
677
|
+
? `${friendlyChain(chain)} Tx Failed`
|
|
678
|
+
: phase === 'push'
|
|
679
|
+
? 'Push Chain Tx Failed'
|
|
680
|
+
: 'Push Chain Inbound Tx Failed',
|
|
681
|
+
message: normalizedErrorMessage,
|
|
682
|
+
response: Object.assign({ error: normalizedErrorMessage, phase, chain: chain !== null && chain !== void 0 ? chain : null }, (decodedError ? { decodedError } : {})),
|
|
683
|
+
level: 'ERROR',
|
|
684
|
+
};
|
|
685
|
+
},
|
|
678
686
|
[progress_hook_types_1.PROGRESS_HOOK.SEND_TX_399_03]: (sourceChain, elapsedMs, phase = 'inbound') => ({
|
|
679
687
|
id: progress_hook_types_1.PROGRESS_HOOK.SEND_TX_399_03,
|
|
680
688
|
title: phase === 'outbound'
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Event ABI fragments used by the universal-tx detector.
|
|
3
3
|
*
|
|
4
4
|
* Sourced from push-chain-gateway-contracts and push-chain-core-contracts:
|
|
5
|
-
* - UniversalTx,
|
|
5
|
+
* - UniversalTx, RevertUniversalTx, FundsRescued
|
|
6
6
|
* → contracts/evm-gateway/src/interfaces/IUniversalGateway.sol
|
|
7
|
+
* - UniversalTxExecuted
|
|
8
|
+
* → push-chain-core-contracts/src/Interfaces/ICEA.sol
|
|
7
9
|
* - UniversalTxFinalized, UniversalTxReverted, FundsRescued (vault)
|
|
8
10
|
* → contracts/evm-gateway/src/interfaces/IVault.sol
|
|
9
11
|
* - UniversalTxOutbound
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* Event ABI fragments used by the universal-tx detector.
|
|
4
4
|
*
|
|
5
5
|
* Sourced from push-chain-gateway-contracts and push-chain-core-contracts:
|
|
6
|
-
* - UniversalTx,
|
|
6
|
+
* - UniversalTx, RevertUniversalTx, FundsRescued
|
|
7
7
|
* → contracts/evm-gateway/src/interfaces/IUniversalGateway.sol
|
|
8
|
+
* - UniversalTxExecuted
|
|
9
|
+
* → push-chain-core-contracts/src/Interfaces/ICEA.sol
|
|
8
10
|
* - UniversalTxFinalized, UniversalTxReverted, FundsRescued (vault)
|
|
9
11
|
* → contracts/evm-gateway/src/interfaces/IVault.sol
|
|
10
12
|
* - UniversalTxOutbound
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
/**
|
|
11
11
|
* Mapping: 8-byte discriminator (lowercase hex, no 0x) → Anchor event name.
|
|
12
12
|
* Only events with EVM classifier parity are listed; the keeper-agnostic
|
|
13
|
-
* ones (BlockUsdCapUpdated,
|
|
13
|
+
* ones (BlockUsdCapUpdated, inbound-fee events, etc.) are intentionally
|
|
14
14
|
* skipped — they wouldn't classify to any UniversalTxKind anyway.
|
|
15
15
|
*/
|
|
16
16
|
export declare const SVM_EVENT_DISCRIMINATORS: Record<string, string>;
|
|
@@ -15,7 +15,7 @@ const toHex = (bytes) => bytes.map((b) => b.toString(16).padStart(2, '0')).join(
|
|
|
15
15
|
/**
|
|
16
16
|
* Mapping: 8-byte discriminator (lowercase hex, no 0x) → Anchor event name.
|
|
17
17
|
* Only events with EVM classifier parity are listed; the keeper-agnostic
|
|
18
|
-
* ones (BlockUsdCapUpdated,
|
|
18
|
+
* ones (BlockUsdCapUpdated, inbound-fee events, etc.) are intentionally
|
|
19
19
|
* skipped — they wouldn't classify to any UniversalTxKind anyway.
|
|
20
20
|
*/
|
|
21
21
|
exports.SVM_EVENT_DISCRIMINATORS = {
|