nodpay 0.2.39 → 0.2.40
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/scripts/propose.mjs +42 -8
package/package.json
CHANGED
package/scripts/propose.mjs
CHANGED
|
@@ -177,19 +177,53 @@ if (!to) {
|
|
|
177
177
|
process.exit(1);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
// ENS support: if --to is not a raw 0x address, try resolving as ENS name.
|
|
181
|
+
// ENS registry lives on Ethereum mainnet — always resolve against mainnet RPC,
|
|
182
|
+
// regardless of the target --chain.
|
|
183
|
+
let resolvedTo = to;
|
|
180
184
|
if (!ethers.isAddress(to)) {
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
if (!to.includes('.')) {
|
|
186
|
+
console.error(JSON.stringify({ error: `Invalid recipient address: ${to} (not a valid address or ENS name)` }));
|
|
187
|
+
process.exit(1);
|
|
188
|
+
}
|
|
189
|
+
try {
|
|
190
|
+
const ensRpcUrl = NETWORKS.mainnet.ethereum?.rpcUrl;
|
|
191
|
+
if (!ensRpcUrl) {
|
|
192
|
+
console.error(JSON.stringify({ error: `Cannot resolve ENS name "${to}": no Ethereum mainnet RPC available` }));
|
|
193
|
+
process.exit(1);
|
|
194
|
+
}
|
|
195
|
+
const ensProvider = new ethers.JsonRpcProvider(ensRpcUrl);
|
|
196
|
+
const resolved = await ensProvider.resolveName(to);
|
|
197
|
+
if (!resolved) {
|
|
198
|
+
console.error(JSON.stringify({ error: `Cannot resolve ENS name: ${to}` }));
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
resolvedTo = resolved;
|
|
202
|
+
console.error(`[INFO] Resolved ENS ${to} → ${resolved}`);
|
|
203
|
+
} catch (e) {
|
|
204
|
+
console.error(JSON.stringify({ error: `Cannot resolve ENS name "${to}": ${e.message}` }));
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
183
207
|
}
|
|
184
208
|
|
|
185
209
|
const SAFE_ADDRESS = safeOverride || DEFAULT_SAFE;
|
|
186
210
|
|
|
187
211
|
// Read optional wallet JSON for rpId (SafeClaw cross-origin passkey support)
|
|
188
212
|
// In remote_wallet mode, wallets were already fetched — use that data.
|
|
213
|
+
// rpId MUST be present in approveUrl when available, otherwise the web app
|
|
214
|
+
// defaults to rpId=nodpay.ai which causes passkey mismatch errors.
|
|
189
215
|
let walletRpId = null;
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
if (
|
|
216
|
+
if (_remoteWalletUrl && _remoteWalletsCache) {
|
|
217
|
+
// Try exact safe match first
|
|
218
|
+
if (SAFE_ADDRESS) {
|
|
219
|
+
const match = _remoteWalletsCache.find(w => w.safe?.toLowerCase() === SAFE_ADDRESS.toLowerCase());
|
|
220
|
+
if (match?.rpId) walletRpId = match.rpId;
|
|
221
|
+
}
|
|
222
|
+
// Fallback: use rpId from any wallet in cache (remote proxy typically serves one wallet set)
|
|
223
|
+
if (!walletRpId) {
|
|
224
|
+
const withRpId = _remoteWalletsCache.find(w => w.rpId);
|
|
225
|
+
if (withRpId) walletRpId = withRpId.rpId;
|
|
226
|
+
}
|
|
193
227
|
}
|
|
194
228
|
if (!walletRpId && SAFE_ADDRESS) {
|
|
195
229
|
const walletJsonPath = join(HOME, '.nodpay', 'wallets', `${SAFE_ADDRESS}.json`);
|
|
@@ -478,7 +512,7 @@ try {
|
|
|
478
512
|
|
|
479
513
|
// Create the transaction as a SafeOperation (UserOp wrapper)
|
|
480
514
|
const safeOperation = await safe4337Pack.createTransaction({
|
|
481
|
-
transactions: [{ to, value, data: '0x' }],
|
|
515
|
+
transactions: [{ to: resolvedTo, value, data: '0x' }],
|
|
482
516
|
options: txOptions,
|
|
483
517
|
});
|
|
484
518
|
|
|
@@ -533,7 +567,7 @@ try {
|
|
|
533
567
|
userOpHash: entryPointUserOpHash,
|
|
534
568
|
safeOpHash,
|
|
535
569
|
shortId,
|
|
536
|
-
to,
|
|
570
|
+
to: resolvedTo,
|
|
537
571
|
value,
|
|
538
572
|
valueEth,
|
|
539
573
|
safeAddress,
|
|
@@ -553,7 +587,7 @@ try {
|
|
|
553
587
|
const storePayload = {
|
|
554
588
|
safeOperationJson,
|
|
555
589
|
userOpHash: entryPointUserOpHash,
|
|
556
|
-
to,
|
|
590
|
+
to: resolvedTo,
|
|
557
591
|
value,
|
|
558
592
|
valueEth,
|
|
559
593
|
safeAddress,
|