@pushchain/core 0.1.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/README.md +241 -0
- package/package.json +30 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -0
- package/src/lib/constants/abi/factoryV1.d.ts +81 -0
- package/src/lib/constants/abi/factoryV1.js +255 -0
- package/src/lib/constants/abi/factoryV1.js.map +1 -0
- package/src/lib/constants/abi/feeLocker.evm.d.ts +39 -0
- package/src/lib/constants/abi/feeLocker.evm.js +319 -0
- package/src/lib/constants/abi/feeLocker.evm.js.map +1 -0
- package/src/lib/constants/abi/feeLocker.json +230 -0
- package/src/lib/constants/abi/index.d.ts +5 -0
- package/src/lib/constants/abi/index.js +15 -0
- package/src/lib/constants/abi/index.js.map +1 -0
- package/src/lib/constants/abi/smartAccount.evm.d.ts +110 -0
- package/src/lib/constants/abi/smartAccount.evm.js +212 -0
- package/src/lib/constants/abi/smartAccount.evm.js.map +1 -0
- package/src/lib/constants/abi/smartAccount.svm.d.ts +106 -0
- package/src/lib/constants/abi/smartAccount.svm.js +209 -0
- package/src/lib/constants/abi/smartAccount.svm.js.map +1 -0
- package/src/lib/constants/chain.d.ts +32 -0
- package/src/lib/constants/chain.js +79 -0
- package/src/lib/constants/chain.js.map +1 -0
- package/src/lib/constants/enums.d.ts +30 -0
- package/src/lib/constants/enums.js +40 -0
- package/src/lib/constants/enums.js.map +1 -0
- package/src/lib/constants/index.d.ts +5 -0
- package/src/lib/constants/index.js +10 -0
- package/src/lib/constants/index.js.map +1 -0
- package/src/lib/generated/v1/tx.d.ts +83 -0
- package/src/lib/generated/v1/tx.js +616 -0
- package/src/lib/generated/v1/tx.js.map +1 -0
- package/src/lib/index.d.ts +3 -0
- package/src/lib/index.js +8 -0
- package/src/lib/index.js.map +1 -0
- package/src/lib/orchestrator/orchestrator.d.ts +63 -0
- package/src/lib/orchestrator/orchestrator.js +475 -0
- package/src/lib/orchestrator/orchestrator.js.map +1 -0
- package/src/lib/orchestrator/orchestrator.types.d.ts +44 -0
- package/src/lib/orchestrator/orchestrator.types.js +3 -0
- package/src/lib/orchestrator/orchestrator.types.js.map +1 -0
- package/src/lib/price-fetch/price-fetch.d.ts +13 -0
- package/src/lib/price-fetch/price-fetch.js +115 -0
- package/src/lib/price-fetch/price-fetch.js.map +1 -0
- package/src/lib/push-client/push-client.d.ts +47 -0
- package/src/lib/push-client/push-client.js +132 -0
- package/src/lib/push-client/push-client.js.map +1 -0
- package/src/lib/push-client/push-client.types.d.ts +5 -0
- package/src/lib/push-client/push-client.types.js +3 -0
- package/src/lib/push-client/push-client.types.js.map +1 -0
- package/src/lib/pushChain.d.ts +50 -0
- package/src/lib/pushChain.js +57 -0
- package/src/lib/pushChain.js.map +1 -0
- package/src/lib/universal/account/account.d.ts +51 -0
- package/src/lib/universal/account/account.js +114 -0
- package/src/lib/universal/account/account.js.map +1 -0
- package/src/lib/universal/account/index.d.ts +1 -0
- package/src/lib/universal/account/index.js +5 -0
- package/src/lib/universal/account/index.js.map +1 -0
- package/src/lib/universal/signer/index.d.ts +1 -0
- package/src/lib/universal/signer/index.js +5 -0
- package/src/lib/universal/signer/index.js.map +1 -0
- package/src/lib/universal/signer/signer.d.ts +40 -0
- package/src/lib/universal/signer/signer.js +138 -0
- package/src/lib/universal/signer/signer.js.map +1 -0
- package/src/lib/universal/universal.types.d.ts +52 -0
- package/src/lib/universal/universal.types.js +3 -0
- package/src/lib/universal/universal.types.js.map +1 -0
- package/src/lib/utils.d.ts +53 -0
- package/src/lib/utils.js +58 -0
- package/src/lib/utils.js.map +1 -0
- package/src/lib/vm-client/evm-client.d.ts +173 -0
- package/src/lib/vm-client/evm-client.js +244 -0
- package/src/lib/vm-client/evm-client.js.map +1 -0
- package/src/lib/vm-client/svm-client.d.ts +42 -0
- package/src/lib/vm-client/svm-client.js +136 -0
- package/src/lib/vm-client/svm-client.js.map +1 -0
- package/src/lib/vm-client/vm-client.types.d.ts +49 -0
- package/src/lib/vm-client/vm-client.types.js +3 -0
- package/src/lib/vm-client/vm-client.types.js.map +1 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CHAIN, NETWORK } from '../constants/enums';
|
|
2
|
+
import { UniversalSigner } from '../universal/universal.types';
|
|
3
|
+
import { ExecuteParams } from './orchestrator.types';
|
|
4
|
+
import { CrossChainPayload } from '../generated/v1/tx';
|
|
5
|
+
export declare class Orchestrator {
|
|
6
|
+
private readonly universalSigner;
|
|
7
|
+
private readonly rpcUrl;
|
|
8
|
+
private readonly printTraces;
|
|
9
|
+
private pushClient;
|
|
10
|
+
constructor(universalSigner: UniversalSigner, pushNetwork: NETWORK, rpcUrl?: Partial<Record<CHAIN, string>>, printTraces?: boolean);
|
|
11
|
+
/**
|
|
12
|
+
* Executes an interaction on Push Chain
|
|
13
|
+
*/
|
|
14
|
+
execute(execute: ExecuteParams): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Locks a fee on the origin chain by interacting with the chain's fee-locker contract.
|
|
17
|
+
*
|
|
18
|
+
* @param amount - Fee amount in USDC (8 Decimals)
|
|
19
|
+
* @param executionHash - Optional execution payload hash (default: zeroHash)
|
|
20
|
+
* @returns Transaction hash of the locking transaction
|
|
21
|
+
*/
|
|
22
|
+
private lockFee;
|
|
23
|
+
private signCrossChainPayload;
|
|
24
|
+
/**
|
|
25
|
+
* Sends a custom Cosmos tx to Push Chain (gasless) to execute user intent.
|
|
26
|
+
*/
|
|
27
|
+
sendCrossChainPushTx(isNMSCDeployed: boolean, feeLockTxHash?: string, crosschainPayload?: CrossChainPayload, signature?: Uint8Array): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if the given chain belongs to the Push Chain ecosystem.
|
|
30
|
+
* Used to differentiate logic for Push-native interactions vs external chains.
|
|
31
|
+
*
|
|
32
|
+
* @param chain - The chain identifier (e.g., PUSH_MAINNET, PUSH_TESTNET)
|
|
33
|
+
* @returns True if the chain is a Push chain, false otherwise.
|
|
34
|
+
*/
|
|
35
|
+
private isPushChain;
|
|
36
|
+
/**
|
|
37
|
+
* Computes the EIP-712 digest hash for the CrossChainPayload structure.
|
|
38
|
+
* This is the message that should be signed by the user's wallet (e.g., Solana signer).
|
|
39
|
+
*
|
|
40
|
+
* The resulting hash is equivalent to:
|
|
41
|
+
* keccak256("\x19\x01" || domainSeparator || structHash)
|
|
42
|
+
*
|
|
43
|
+
* @param chainId - EVM chain ID of the destination chain (Push Chain)
|
|
44
|
+
* @param verifyingContract - Address of the verifying contract (i.e., the user's NMSC smart wallet)
|
|
45
|
+
* @param version - Optional EIP-712 domain version (default: '0.1.0')
|
|
46
|
+
* @param payload - Execution details encoded into the CrossChainPayload struct
|
|
47
|
+
* @returns keccak256 digest to be signed by the user
|
|
48
|
+
*/
|
|
49
|
+
private computeExecutionHash;
|
|
50
|
+
/**
|
|
51
|
+
* Computes the smart wallet (NMSC) on Push Chain.
|
|
52
|
+
*/
|
|
53
|
+
getNMSCAddress(): Promise<{
|
|
54
|
+
address: `0x${string}`;
|
|
55
|
+
deployed: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* @dev - Although as of now nonce var is same in evm & svm so switch conditions does not matter
|
|
59
|
+
* @param address NMSC address
|
|
60
|
+
* @returns NMSC current nonce
|
|
61
|
+
*/
|
|
62
|
+
private getNMSCNonce;
|
|
63
|
+
}
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Orchestrator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const enums_1 = require("../constants/enums");
|
|
7
|
+
const evm_client_1 = require("../vm-client/evm-client");
|
|
8
|
+
const chain_1 = require("../constants/chain");
|
|
9
|
+
const abi_1 = require("../constants/abi");
|
|
10
|
+
const push_client_1 = require("../push-client/push-client");
|
|
11
|
+
const svm_client_1 = require("../vm-client/svm-client");
|
|
12
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
13
|
+
const anchor = tslib_1.__importStar(require("@coral-xyz/anchor"));
|
|
14
|
+
const tx_1 = require("../generated/v1/tx");
|
|
15
|
+
const price_fetch_1 = require("../price-fetch/price-fetch");
|
|
16
|
+
const bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
|
17
|
+
class Orchestrator {
|
|
18
|
+
constructor(universalSigner, pushNetwork, rpcUrl = {}, printTraces = false) {
|
|
19
|
+
this.universalSigner = universalSigner;
|
|
20
|
+
this.rpcUrl = rpcUrl;
|
|
21
|
+
this.printTraces = printTraces;
|
|
22
|
+
const pushChain = pushNetwork === enums_1.NETWORK.MAINNET
|
|
23
|
+
? enums_1.CHAIN.PUSH_MAINNET
|
|
24
|
+
: pushNetwork === enums_1.NETWORK.TESTNET
|
|
25
|
+
? enums_1.CHAIN.PUSH_TESTNET
|
|
26
|
+
: enums_1.CHAIN.PUSH_LOCALNET;
|
|
27
|
+
const pushChainRPC = this.rpcUrl[pushChain] || chain_1.CHAIN_INFO[pushChain].defaultRPC;
|
|
28
|
+
this.pushClient = new push_client_1.PushClient({
|
|
29
|
+
rpcUrl: pushChainRPC,
|
|
30
|
+
network: pushNetwork,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Executes an interaction on Push Chain
|
|
35
|
+
*/
|
|
36
|
+
execute(execute) {
|
|
37
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const chain = this.universalSigner.chain;
|
|
39
|
+
if (this.printTraces) {
|
|
40
|
+
console.log(`[${this.constructor.name}] Starting cross-chain execution from chain: ${chain}`);
|
|
41
|
+
}
|
|
42
|
+
// Add validation that if sepolia, or any origin testnet, you can only interact with Push testnet. Same for mainnet
|
|
43
|
+
const isTestnet = [
|
|
44
|
+
enums_1.CHAIN.ETHEREUM_SEPOLIA,
|
|
45
|
+
enums_1.CHAIN.SOLANA_TESTNET,
|
|
46
|
+
enums_1.CHAIN.SOLANA_DEVNET,
|
|
47
|
+
].includes(chain);
|
|
48
|
+
const isMainnet = [enums_1.CHAIN.ETHEREUM_MAINNET, enums_1.CHAIN.SOLANA_MAINNET].includes(chain);
|
|
49
|
+
if (isTestnet &&
|
|
50
|
+
this.pushClient.pushChainInfo.chainId !==
|
|
51
|
+
chain_1.CHAIN_INFO[enums_1.CHAIN.PUSH_TESTNET].chainId) {
|
|
52
|
+
throw new Error('Testnet chains can only interact with Push Testnet');
|
|
53
|
+
}
|
|
54
|
+
if (isMainnet &&
|
|
55
|
+
this.pushClient.pushChainInfo.chainId !==
|
|
56
|
+
chain_1.CHAIN_INFO[enums_1.CHAIN.PUSH_MAINNET].chainId) {
|
|
57
|
+
throw new Error('Mainnet chains can only interact with Push Mainnet');
|
|
58
|
+
}
|
|
59
|
+
// 1. Execute direct tx if signer is already on Push Chain
|
|
60
|
+
if (this.isPushChain(chain)) {
|
|
61
|
+
return this.pushClient.sendTransaction({
|
|
62
|
+
to: execute.target,
|
|
63
|
+
data: execute.data,
|
|
64
|
+
value: execute.value,
|
|
65
|
+
signer: this.universalSigner,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// 2. Get Push chain NMSC address for this signer
|
|
69
|
+
if (this.printTraces) {
|
|
70
|
+
console.log(`[${this.constructor.name}] Fetching NMSC address for UniversalSigner`);
|
|
71
|
+
}
|
|
72
|
+
const { address: nmscAddress, deployed: isNMSCDeployed } = yield this.getNMSCAddress();
|
|
73
|
+
if (this.printTraces) {
|
|
74
|
+
console.log(`[${this.constructor.name}] NMSC Address: ${nmscAddress}`);
|
|
75
|
+
console.log(`[${this.constructor.name}] Deployed: ${isNMSCDeployed}`);
|
|
76
|
+
}
|
|
77
|
+
// 3. Estimate funds required for the execution
|
|
78
|
+
if (this.printTraces) {
|
|
79
|
+
console.log(`[${this.constructor.name}] Estimating cost of execution`);
|
|
80
|
+
}
|
|
81
|
+
const gasEstimate = yield this.pushClient.estimateGas({
|
|
82
|
+
to: execute.target,
|
|
83
|
+
data: execute.data,
|
|
84
|
+
value: execute.value,
|
|
85
|
+
});
|
|
86
|
+
if (this.printTraces) {
|
|
87
|
+
console.log(`[${this.constructor.name}] GasEstimate: ${gasEstimate}`);
|
|
88
|
+
}
|
|
89
|
+
// Fetch current gas price
|
|
90
|
+
if (this.printTraces) {
|
|
91
|
+
console.log(`[${this.constructor.name}] Fetching Gas Price`);
|
|
92
|
+
}
|
|
93
|
+
const gasPrice = yield this.pushClient.getGasPrice();
|
|
94
|
+
if (this.printTraces) {
|
|
95
|
+
console.log(`[${this.constructor.name}] Gas Price: ${gasPrice}`);
|
|
96
|
+
}
|
|
97
|
+
// Add 10% buffer as integer math
|
|
98
|
+
if (this.printTraces) {
|
|
99
|
+
console.log(`[${this.constructor.name}] Calculating estimated gas fee for execution`);
|
|
100
|
+
}
|
|
101
|
+
const requiredGasFee = (gasEstimate * gasPrice * BigInt(110)) / BigInt(100);
|
|
102
|
+
if (this.printTraces) {
|
|
103
|
+
console.log(`[${this.constructor.name}] Required Gas Fee: ${requiredGasFee}`);
|
|
104
|
+
}
|
|
105
|
+
// Total funds = gas fee + value being sent
|
|
106
|
+
const requiredFunds = requiredGasFee + execute.value;
|
|
107
|
+
// 4. Check NMSC balance on Push Chain ( in nPUSH )
|
|
108
|
+
if (this.printTraces) {
|
|
109
|
+
console.log(`${this.constructor.name}] Checking NMSC balance...`);
|
|
110
|
+
}
|
|
111
|
+
const funds = yield this.pushClient.getBalance(nmscAddress);
|
|
112
|
+
if (this.printTraces) {
|
|
113
|
+
console.log(`[${this.constructor.name}] Current balance: ${funds}`);
|
|
114
|
+
}
|
|
115
|
+
// 5. Get NMSC Nonce
|
|
116
|
+
const nonce = isNMSCDeployed
|
|
117
|
+
? yield this.getNMSCNonce(nmscAddress)
|
|
118
|
+
: BigInt(0);
|
|
119
|
+
// 6. Create execution hash ( execution data to be signed )
|
|
120
|
+
const crosschainPayload = {
|
|
121
|
+
target: execute.target,
|
|
122
|
+
value: execute.value,
|
|
123
|
+
data: execute.data,
|
|
124
|
+
gasLimit: execute.gasLimit || BigInt(21000000),
|
|
125
|
+
maxFeePerGas: execute.maxFeePerGas || BigInt(10000000000000000),
|
|
126
|
+
maxPriorityFeePerGas: execute.maxPriorityFeePerGas || BigInt(2),
|
|
127
|
+
nonce,
|
|
128
|
+
deadline: execute.deadline || BigInt(9999999999),
|
|
129
|
+
};
|
|
130
|
+
const executionHash = this.computeExecutionHash({
|
|
131
|
+
verifyingContract: nmscAddress,
|
|
132
|
+
payload: crosschainPayload,
|
|
133
|
+
});
|
|
134
|
+
if (this.printTraces) {
|
|
135
|
+
console.log(`[${this.constructor.name}] Execution hash: ${executionHash}`);
|
|
136
|
+
}
|
|
137
|
+
// 7. If not enough funds, lock required fee on source chain and send tx to Push chain
|
|
138
|
+
let feeLockTxHash = execute.feeLockTxHash;
|
|
139
|
+
if (funds < requiredFunds && !feeLockTxHash) {
|
|
140
|
+
if (this.printTraces) {
|
|
141
|
+
console.log(`[${this.constructor.name}] Insufficient funds, locking additional fees...`);
|
|
142
|
+
}
|
|
143
|
+
const fundDifference = requiredFunds - funds;
|
|
144
|
+
const fundDifferenceInUSDC = this.pushClient.pushToUSDC(fundDifference); // ( USDC with 8 decimal points )
|
|
145
|
+
feeLockTxHash = yield this.lockFee(fundDifferenceInUSDC, executionHash);
|
|
146
|
+
if (this.printTraces) {
|
|
147
|
+
console.log(`[${this.constructor.name}] Fee lock transaction hash: ${feeLockTxHash}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (this.printTraces) {
|
|
151
|
+
console.log(`[${this.constructor.name}] Signing execution data...`);
|
|
152
|
+
}
|
|
153
|
+
// 8. Sign execution data
|
|
154
|
+
const signature = yield this.signCrossChainPayload(crosschainPayload, nmscAddress);
|
|
155
|
+
if (this.printTraces) {
|
|
156
|
+
console.log(`[${this.constructor.name}] Execution data signed successfully`);
|
|
157
|
+
}
|
|
158
|
+
// 8. Send Tx to Push chain
|
|
159
|
+
if (this.printTraces) {
|
|
160
|
+
console.log(`[${this.constructor.name}] Sending transaction to Push chain...`);
|
|
161
|
+
}
|
|
162
|
+
const txHash = yield this.sendCrossChainPushTx(isNMSCDeployed, feeLockTxHash, Object.assign(Object.assign({}, crosschainPayload), { value: crosschainPayload.value.toString(), gasLimit: crosschainPayload.gasLimit.toString(), maxFeePerGas: crosschainPayload.maxFeePerGas.toString(), maxPriorityFeePerGas: crosschainPayload.maxPriorityFeePerGas.toString(), nonce: crosschainPayload.nonce.toString(), deadline: crosschainPayload.deadline.toString() }), signature);
|
|
163
|
+
if (this.printTraces) {
|
|
164
|
+
console.log(`[${this.constructor.name}] Transaction sent successfully. Hash: ${txHash}`);
|
|
165
|
+
}
|
|
166
|
+
return txHash;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Locks a fee on the origin chain by interacting with the chain's fee-locker contract.
|
|
171
|
+
*
|
|
172
|
+
* @param amount - Fee amount in USDC (8 Decimals)
|
|
173
|
+
* @param executionHash - Optional execution payload hash (default: zeroHash)
|
|
174
|
+
* @returns Transaction hash of the locking transaction
|
|
175
|
+
*/
|
|
176
|
+
lockFee(amount_1) {
|
|
177
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (amount, // USD with 8 decimals
|
|
178
|
+
executionHash = viem_1.zeroHash) {
|
|
179
|
+
const chain = this.universalSigner.chain;
|
|
180
|
+
const { lockerContract, vm, defaultRPC } = chain_1.CHAIN_INFO[chain];
|
|
181
|
+
if (!lockerContract) {
|
|
182
|
+
throw new Error(`Locker contract not configured for chain: ${chain}`);
|
|
183
|
+
}
|
|
184
|
+
const rpcUrl = this.rpcUrl[chain] || defaultRPC;
|
|
185
|
+
const priceFetcher = new price_fetch_1.PriceFetch(this.rpcUrl);
|
|
186
|
+
const nativeTokenUsdPrice = yield priceFetcher.getPrice(chain); // 8 decimals
|
|
187
|
+
let nativeAmount;
|
|
188
|
+
switch (vm) {
|
|
189
|
+
case enums_1.VM.EVM: {
|
|
190
|
+
const nativeDecimals = 18; // ETH, MATIC, etc.
|
|
191
|
+
nativeAmount =
|
|
192
|
+
(amount * BigInt(Math.pow(10, nativeDecimals))) / nativeTokenUsdPrice;
|
|
193
|
+
const evmClient = new evm_client_1.EvmClient({ rpcUrl });
|
|
194
|
+
return yield evmClient.writeContract({
|
|
195
|
+
abi: abi_1.FEE_LOCKER_EVM,
|
|
196
|
+
address: lockerContract,
|
|
197
|
+
functionName: 'addFunds',
|
|
198
|
+
args: [executionHash],
|
|
199
|
+
signer: this.universalSigner,
|
|
200
|
+
value: nativeAmount,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
case enums_1.VM.SVM: {
|
|
204
|
+
const nativeDecimals = 9; // SOL lamports
|
|
205
|
+
nativeAmount =
|
|
206
|
+
(amount * BigInt(Math.pow(10, nativeDecimals))) / nativeTokenUsdPrice;
|
|
207
|
+
const svmClient = new svm_client_1.SvmClient({ rpcUrl });
|
|
208
|
+
const [lockerPda, lockerBump] = anchor.web3.PublicKey.findProgramAddressSync([Buffer.from('locker')], new web3_js_1.PublicKey(lockerContract));
|
|
209
|
+
return yield svmClient.writeContract({
|
|
210
|
+
abi: abi_1.FEE_LOCKER_SVM,
|
|
211
|
+
address: lockerContract,
|
|
212
|
+
functionName: 'addFunds',
|
|
213
|
+
args: [nativeAmount, (0, viem_1.toBytes)(executionHash)],
|
|
214
|
+
signer: this.universalSigner,
|
|
215
|
+
accounts: {
|
|
216
|
+
locker: lockerPda,
|
|
217
|
+
user: new web3_js_1.PublicKey(this.universalSigner.address),
|
|
218
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
default:
|
|
223
|
+
throw new Error(`Unsupported VM type: ${vm}`);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
signCrossChainPayload(crosschainPayload, verifyingContract, version) {
|
|
228
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
const chain = this.universalSigner.chain;
|
|
230
|
+
const { vm } = chain_1.CHAIN_INFO[chain];
|
|
231
|
+
switch (vm) {
|
|
232
|
+
case enums_1.VM.EVM: {
|
|
233
|
+
if (!this.universalSigner.signTypedData) {
|
|
234
|
+
throw new Error('signTypedData is not defined');
|
|
235
|
+
}
|
|
236
|
+
return this.universalSigner.signTypedData({
|
|
237
|
+
domain: {
|
|
238
|
+
version: version || '0.1.0',
|
|
239
|
+
chainId: Number(this.pushClient.pushChainInfo.chainId),
|
|
240
|
+
verifyingContract,
|
|
241
|
+
},
|
|
242
|
+
types: {
|
|
243
|
+
CrossChainPayload: [
|
|
244
|
+
{ name: 'target', type: 'address' },
|
|
245
|
+
{ name: 'value', type: 'uint256' },
|
|
246
|
+
{ name: 'data', type: 'bytes' },
|
|
247
|
+
{ name: 'gasLimit', type: 'uint256' },
|
|
248
|
+
{ name: 'maxFeePerGas', type: 'uint256' },
|
|
249
|
+
{ name: 'maxPriorityFeePerGas', type: 'uint256' },
|
|
250
|
+
{ name: 'nonce', type: 'uint256' },
|
|
251
|
+
{ name: 'deadline', type: 'uint256' },
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
primaryType: 'CrossChainPayload',
|
|
255
|
+
message: crosschainPayload,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
case enums_1.VM.SVM: {
|
|
259
|
+
const digest = this.computeExecutionHash({
|
|
260
|
+
chainId: Number(this.pushClient.pushChainInfo.chainId),
|
|
261
|
+
verifyingContract,
|
|
262
|
+
payload: crosschainPayload,
|
|
263
|
+
version: version || '0.1.0',
|
|
264
|
+
});
|
|
265
|
+
return this.universalSigner.signMessage((0, viem_1.stringToBytes)(digest));
|
|
266
|
+
}
|
|
267
|
+
default: {
|
|
268
|
+
throw new Error(`Unsupported VM type: ${vm}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Sends a custom Cosmos tx to Push Chain (gasless) to execute user intent.
|
|
275
|
+
*/
|
|
276
|
+
sendCrossChainPushTx(isNMSCDeployed, feeLockTxHash, crosschainPayload, signature) {
|
|
277
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
278
|
+
const { chain, address } = this.universalSigner;
|
|
279
|
+
const { vm, chainId } = chain_1.CHAIN_INFO[chain];
|
|
280
|
+
const accountId = {
|
|
281
|
+
namespace: chain_1.VM_NAMESPACE[vm],
|
|
282
|
+
chainId,
|
|
283
|
+
ownerKey: vm === enums_1.VM.EVM
|
|
284
|
+
? address
|
|
285
|
+
: vm === enums_1.VM.SVM
|
|
286
|
+
? (0, viem_1.bytesToHex)(bytes_1.bs58.decode(address))
|
|
287
|
+
: address,
|
|
288
|
+
vmType: tx_1.vmType[vm],
|
|
289
|
+
};
|
|
290
|
+
const { cosmosAddress: signer } = this.pushClient.getSignerAddress();
|
|
291
|
+
const msgs = [];
|
|
292
|
+
if (!isNMSCDeployed) {
|
|
293
|
+
/**
|
|
294
|
+
* @dev - fee should be locked for NMSC deployment to avoid spamming
|
|
295
|
+
*/
|
|
296
|
+
if (!feeLockTxHash) {
|
|
297
|
+
throw new Error('NMSC cannot be deployed without fee locking');
|
|
298
|
+
}
|
|
299
|
+
msgs.push(this.pushClient.createMsgDeployNMSC({
|
|
300
|
+
signer,
|
|
301
|
+
accountId,
|
|
302
|
+
txHash: feeLockTxHash,
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
if (feeLockTxHash) {
|
|
306
|
+
msgs.push(this.pushClient.createMsgMintPush({
|
|
307
|
+
signer,
|
|
308
|
+
accountId,
|
|
309
|
+
txHash: feeLockTxHash,
|
|
310
|
+
}));
|
|
311
|
+
}
|
|
312
|
+
if (crosschainPayload && signature) {
|
|
313
|
+
msgs.push(this.pushClient.createMsgExecutePayload({
|
|
314
|
+
signer,
|
|
315
|
+
accountId,
|
|
316
|
+
crosschainPayload,
|
|
317
|
+
signature: (0, viem_1.bytesToHex)(signature),
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
const txBody = yield this.pushClient.createCosmosTxBody(msgs);
|
|
321
|
+
const txRaw = yield this.pushClient.signCosmosTx(txBody);
|
|
322
|
+
const txresponse = yield this.pushClient.broadcastCosmosTx(txRaw);
|
|
323
|
+
if (txresponse.code === 0) {
|
|
324
|
+
return txresponse.transactionHash;
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
throw new Error(txresponse.rawLog);
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Checks if the given chain belongs to the Push Chain ecosystem.
|
|
333
|
+
* Used to differentiate logic for Push-native interactions vs external chains.
|
|
334
|
+
*
|
|
335
|
+
* @param chain - The chain identifier (e.g., PUSH_MAINNET, PUSH_TESTNET)
|
|
336
|
+
* @returns True if the chain is a Push chain, false otherwise.
|
|
337
|
+
*/
|
|
338
|
+
isPushChain(chain) {
|
|
339
|
+
return (chain === enums_1.CHAIN.PUSH_MAINNET ||
|
|
340
|
+
chain === enums_1.CHAIN.PUSH_TESTNET ||
|
|
341
|
+
chain === enums_1.CHAIN.PUSH_LOCALNET);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Computes the EIP-712 digest hash for the CrossChainPayload structure.
|
|
345
|
+
* This is the message that should be signed by the user's wallet (e.g., Solana signer).
|
|
346
|
+
*
|
|
347
|
+
* The resulting hash is equivalent to:
|
|
348
|
+
* keccak256("\x19\x01" || domainSeparator || structHash)
|
|
349
|
+
*
|
|
350
|
+
* @param chainId - EVM chain ID of the destination chain (Push Chain)
|
|
351
|
+
* @param verifyingContract - Address of the verifying contract (i.e., the user's NMSC smart wallet)
|
|
352
|
+
* @param version - Optional EIP-712 domain version (default: '0.1.0')
|
|
353
|
+
* @param payload - Execution details encoded into the CrossChainPayload struct
|
|
354
|
+
* @returns keccak256 digest to be signed by the user
|
|
355
|
+
*/
|
|
356
|
+
computeExecutionHash({ chainId = Number(this.pushClient.pushChainInfo.chainId), verifyingContract, payload, version = '0.1.0', }) {
|
|
357
|
+
// 1. Hash the type signature
|
|
358
|
+
const typeHash = (0, viem_1.keccak256)((0, viem_1.toBytes)('CrossChainPayload(address target,uint256 value,bytes data,uint256 gasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas,uint256 nonce,uint256 deadline)'));
|
|
359
|
+
// 2. Domain separator
|
|
360
|
+
const domainTypeHash = (0, viem_1.keccak256)((0, viem_1.toBytes)('EIP712Domain(string version,uint256 chainId,address verifyingContract)'));
|
|
361
|
+
const domainSeparator = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([
|
|
362
|
+
{ name: 'typeHash', type: 'bytes32' },
|
|
363
|
+
{ name: 'version', type: 'bytes32' },
|
|
364
|
+
{ name: 'chainId', type: 'uint256' },
|
|
365
|
+
{ name: 'verifyingContract', type: 'address' },
|
|
366
|
+
], [
|
|
367
|
+
domainTypeHash,
|
|
368
|
+
(0, viem_1.keccak256)((0, viem_1.toBytes)(version)),
|
|
369
|
+
BigInt(chainId),
|
|
370
|
+
verifyingContract,
|
|
371
|
+
]));
|
|
372
|
+
// 3. Struct hash
|
|
373
|
+
const structHash = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([
|
|
374
|
+
{ name: 'typeHash', type: 'bytes32' },
|
|
375
|
+
{ name: 'target', type: 'address' },
|
|
376
|
+
{ name: 'value', type: 'uint256' },
|
|
377
|
+
{ name: 'dataHash', type: 'bytes32' },
|
|
378
|
+
{ name: 'gasLimit', type: 'uint256' },
|
|
379
|
+
{ name: 'maxFeePerGas', type: 'uint256' },
|
|
380
|
+
{ name: 'maxPriorityFeePerGas', type: 'uint256' },
|
|
381
|
+
{ name: 'nonce', type: 'uint256' },
|
|
382
|
+
{ name: 'deadline', type: 'uint256' },
|
|
383
|
+
], [
|
|
384
|
+
typeHash,
|
|
385
|
+
payload.target,
|
|
386
|
+
payload.value,
|
|
387
|
+
(0, viem_1.keccak256)(payload.data),
|
|
388
|
+
payload.gasLimit,
|
|
389
|
+
payload.maxFeePerGas,
|
|
390
|
+
payload.maxPriorityFeePerGas,
|
|
391
|
+
payload.nonce,
|
|
392
|
+
payload.deadline,
|
|
393
|
+
]));
|
|
394
|
+
// 4. Final digest: keccak256("\x19\x01" || domainSeparator || structHash)
|
|
395
|
+
const digest = (0, viem_1.keccak256)((0, viem_1.encodePacked)(['string', 'bytes32', 'bytes32'], ['\x19\x01', domainSeparator, structHash]));
|
|
396
|
+
return digest;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Computes the smart wallet (NMSC) on Push Chain.
|
|
400
|
+
*/
|
|
401
|
+
getNMSCAddress() {
|
|
402
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
403
|
+
const { chain, address } = this.universalSigner;
|
|
404
|
+
const { vm, chainId } = chain_1.CHAIN_INFO[chain];
|
|
405
|
+
if (this.isPushChain(chain)) {
|
|
406
|
+
throw new Error('NMSC address cannot be computed for a Push Chain Address');
|
|
407
|
+
}
|
|
408
|
+
const computedAddress = yield this.pushClient.readContract({
|
|
409
|
+
address: this.pushClient.pushChainInfo.factoryAddress,
|
|
410
|
+
abi: abi_1.FACTORY_V1,
|
|
411
|
+
functionName: 'computeSmartAccountAddress',
|
|
412
|
+
args: [
|
|
413
|
+
{
|
|
414
|
+
namespace: chain_1.VM_NAMESPACE[vm],
|
|
415
|
+
chainId,
|
|
416
|
+
/**
|
|
417
|
+
* @dev - OwnerKey should be in bytes
|
|
418
|
+
* for eth - convert hex to bytes
|
|
419
|
+
* for sol - convert base64 to bytes
|
|
420
|
+
* for others - not defined yet
|
|
421
|
+
*/
|
|
422
|
+
ownerKey: vm === enums_1.VM.EVM
|
|
423
|
+
? address
|
|
424
|
+
: vm === enums_1.VM.SVM
|
|
425
|
+
? (0, viem_1.bytesToHex)(bytes_1.bs58.decode(address))
|
|
426
|
+
: address,
|
|
427
|
+
/**
|
|
428
|
+
* @dev
|
|
429
|
+
* 0 -> evm
|
|
430
|
+
* 1 -> svm
|
|
431
|
+
* Rest are not defined
|
|
432
|
+
*/
|
|
433
|
+
vmType: vm === enums_1.VM.EVM ? 0 : vm === enums_1.VM.SVM ? 1 : 2,
|
|
434
|
+
},
|
|
435
|
+
],
|
|
436
|
+
});
|
|
437
|
+
const byteCode = yield this.pushClient.publicClient.getCode({
|
|
438
|
+
address: computedAddress,
|
|
439
|
+
});
|
|
440
|
+
return { address: computedAddress, deployed: byteCode !== undefined };
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* @dev - Although as of now nonce var is same in evm & svm so switch conditions does not matter
|
|
445
|
+
* @param address NMSC address
|
|
446
|
+
* @returns NMSC current nonce
|
|
447
|
+
*/
|
|
448
|
+
getNMSCNonce(address) {
|
|
449
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
450
|
+
const chain = this.universalSigner.chain;
|
|
451
|
+
const { vm } = chain_1.CHAIN_INFO[chain];
|
|
452
|
+
switch (vm) {
|
|
453
|
+
case enums_1.VM.EVM: {
|
|
454
|
+
return this.pushClient.readContract({
|
|
455
|
+
address,
|
|
456
|
+
abi: abi_1.SMART_ACCOUNT_EVM,
|
|
457
|
+
functionName: 'nonce',
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
case enums_1.VM.SVM: {
|
|
461
|
+
return this.pushClient.readContract({
|
|
462
|
+
address,
|
|
463
|
+
abi: abi_1.SMART_ACCOUNT_SVM,
|
|
464
|
+
functionName: 'nonce',
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
default: {
|
|
468
|
+
throw new Error(`Unsupported VM type: ${vm}`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
exports.Orchestrator = Orchestrator;
|
|
475
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/orchestrator/orchestrator.ts"],"names":[],"mappings":";;;;AAAA,+BASc;AACd,8CAAwD;AAGxD,wDAAoD;AACpD,8CAA8D;AAC9D,0CAM0B;AAC1B,4DAAwD;AACxD,wDAAoD;AACpD,6CAA2D;AAC3D,kEAA4C;AAE5C,2CAA0E;AAC1E,4DAAwD;AACxD,kEAA8D;AAE9D,MAAa,YAAY;IAGvB,YACmB,eAAgC,EACjD,WAAoB,EACH,SAAyC,EAAE,EAC3C,cAAc,KAAK;QAHnB,oBAAe,GAAf,eAAe,CAAiB;QAEhC,WAAM,GAAN,MAAM,CAAqC;QAC3C,gBAAW,GAAX,WAAW,CAAQ;QAEpC,MAAM,SAAS,GACb,WAAW,KAAK,eAAO,CAAC,OAAO;YAC7B,CAAC,CAAC,aAAK,CAAC,YAAY;YACpB,CAAC,CAAC,WAAW,KAAK,eAAO,CAAC,OAAO;gBACjC,CAAC,CAAC,aAAK,CAAC,YAAY;gBACpB,CAAC,CAAC,aAAK,CAAC,aAAa,CAAC;QAC1B,MAAM,YAAY,GAChB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,kBAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC;QAC7D,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAU,CAAC;YAC/B,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE,WAAW;SACrB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACG,OAAO,CAAC,OAAsB;;YAClC,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;YAEzC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,OAAO,CAAC,GAAG,CACT,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,gDAAgD,KAAK,EAAE,CACjF,CAAC;YACJ,CAAC;YAED,mHAAmH;YACnH,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nBD,oCA0nBC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type ExecuteParams = {
|
|
2
|
+
/**
|
|
3
|
+
* The target contract or account on Push Chain.
|
|
4
|
+
*/
|
|
5
|
+
target: `0x${string}`;
|
|
6
|
+
/**
|
|
7
|
+
* Amount of native token (in wei) to send alongside the call.
|
|
8
|
+
*/
|
|
9
|
+
value: bigint;
|
|
10
|
+
/**
|
|
11
|
+
* Hex-encoded calldata or transfer payload.
|
|
12
|
+
* @reason Encodes the function selector + arguments (or plain transfer).
|
|
13
|
+
*/
|
|
14
|
+
data: `0x${string}`;
|
|
15
|
+
/**
|
|
16
|
+
* Optional hard cap on gas to use for this transaction.
|
|
17
|
+
* @reason Prevents runaway gas consumption and lets users enforce limits.
|
|
18
|
+
*/
|
|
19
|
+
gasLimit?: bigint;
|
|
20
|
+
/**
|
|
21
|
+
* Optional override for the EIP-1559 max fee per gas (in wei).
|
|
22
|
+
* @reason Gives callers direct control over total gas price to speed up or save cost.
|
|
23
|
+
*/
|
|
24
|
+
maxFeePerGas?: bigint;
|
|
25
|
+
/**
|
|
26
|
+
* Optional override for the EIP-1559 max priority fee per gas (in wei).
|
|
27
|
+
* TODO: This will be removed
|
|
28
|
+
* @reason Allows customizing the miner tip separately from the base fee.
|
|
29
|
+
*/
|
|
30
|
+
maxPriorityFeePerGas?: bigint;
|
|
31
|
+
/**
|
|
32
|
+
* Optional to bypass fee locking in case funds are already locked by user
|
|
33
|
+
*/
|
|
34
|
+
feeLockTxHash?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional explicit nonce for the transaction.
|
|
37
|
+
* @reason Ensures correct ordering and avoids “replacement underpriced” when sending in parallel.
|
|
38
|
+
*/
|
|
39
|
+
nonce?: bigint;
|
|
40
|
+
/**
|
|
41
|
+
* Optional for signature expiry
|
|
42
|
+
*/
|
|
43
|
+
deadline?: bigint;
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.types.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/orchestrator/orchestrator.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CHAIN } from '../constants/enums';
|
|
2
|
+
export declare class PriceFetch {
|
|
3
|
+
private readonly rpcUrl;
|
|
4
|
+
constructor(rpcUrl?: Partial<Record<CHAIN, string>>);
|
|
5
|
+
getPrice(chain: CHAIN): Promise<bigint>;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param address Chainlink oracle feed address
|
|
9
|
+
* @param vmClient EVM client instance
|
|
10
|
+
* @returns price scaled to 8 decimals (10^8)
|
|
11
|
+
*/
|
|
12
|
+
private fetchPrice;
|
|
13
|
+
}
|