anymal-protocol 1.0.160 → 1.0.161
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/dist/index.d.mts +0 -5
- package/dist/index.d.ts +0 -5
- package/dist/index.js +5 -101
- package/dist/index.mjs +5 -101
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -70,11 +70,6 @@ declare function useSendCoinbaseUserOperation(): {
|
|
|
70
70
|
sendOperationFn: (evmAddress: `0x${string}`, contractAddress: `0x${string}`, abi: any, functionName: string, args: any[]) => Promise<{
|
|
71
71
|
success: boolean;
|
|
72
72
|
message: string;
|
|
73
|
-
details?: undefined;
|
|
74
|
-
} | {
|
|
75
|
-
success: boolean;
|
|
76
|
-
message: string;
|
|
77
|
-
details: any;
|
|
78
73
|
}>;
|
|
79
74
|
data: _coinbase_cdp_api_client.EvmUserOperation | undefined;
|
|
80
75
|
status: _coinbase_cdp_hooks.Status;
|
package/dist/index.d.ts
CHANGED
|
@@ -70,11 +70,6 @@ declare function useSendCoinbaseUserOperation(): {
|
|
|
70
70
|
sendOperationFn: (evmAddress: `0x${string}`, contractAddress: `0x${string}`, abi: any, functionName: string, args: any[]) => Promise<{
|
|
71
71
|
success: boolean;
|
|
72
72
|
message: string;
|
|
73
|
-
details?: undefined;
|
|
74
|
-
} | {
|
|
75
|
-
success: boolean;
|
|
76
|
-
message: string;
|
|
77
|
-
details: any;
|
|
78
73
|
}>;
|
|
79
74
|
data: _coinbase_cdp_api_client.EvmUserOperation | undefined;
|
|
80
75
|
status: _coinbase_cdp_hooks.Status;
|
package/dist/index.js
CHANGED
|
@@ -509,53 +509,21 @@ function useSendCoinbaseUserOperation() {
|
|
|
509
509
|
if (!evmAddress || !contractAddress || !abi || !functionName) {
|
|
510
510
|
return { success: false, message: "Missing required information" };
|
|
511
511
|
}
|
|
512
|
-
console.log("\u{1F50D} Transaction Details:", {
|
|
513
|
-
network: isProduction ? "base" : "base-sepolia",
|
|
514
|
-
evmAddress,
|
|
515
|
-
contractAddress,
|
|
516
|
-
functionName,
|
|
517
|
-
args
|
|
518
|
-
});
|
|
519
512
|
try {
|
|
520
|
-
|
|
521
|
-
const result = await publicClient.simulateContract({
|
|
513
|
+
await publicClient.simulateContract({
|
|
522
514
|
address: contractAddress,
|
|
523
515
|
abi,
|
|
524
516
|
functionName,
|
|
525
517
|
args,
|
|
526
518
|
account: evmAddress
|
|
527
519
|
});
|
|
528
|
-
console.log("\u2705 Simulation successful:", result);
|
|
529
520
|
} catch (simError) {
|
|
530
|
-
console.error("=".repeat(80));
|
|
531
|
-
console.error("\u274C SIMULATION FAILED - DETAILED ERROR");
|
|
532
|
-
console.error("=".repeat(80));
|
|
533
521
|
let errorMessage = "Simulation failed";
|
|
534
|
-
let errorDetails = {};
|
|
535
522
|
if (simError instanceof import_viem.BaseError) {
|
|
536
|
-
console.error("\u{1F4CB} VIEM ERROR:");
|
|
537
|
-
console.error(" Name:", simError.name);
|
|
538
|
-
console.error(" Message:", simError.message);
|
|
539
|
-
console.error(" Short Message:", simError.shortMessage);
|
|
540
|
-
console.error(" Details:", simError.details);
|
|
541
523
|
const revertError = simError.walk(
|
|
542
524
|
(err) => err instanceof import_viem.ContractFunctionRevertedError
|
|
543
525
|
);
|
|
544
526
|
if (revertError instanceof import_viem.ContractFunctionRevertedError) {
|
|
545
|
-
console.error("\n\u{1F534} CONTRACT REVERT DETECTED:");
|
|
546
|
-
console.error(
|
|
547
|
-
" Error Name:",
|
|
548
|
-
revertError.data?.errorName ?? "Unknown"
|
|
549
|
-
);
|
|
550
|
-
console.error(" Error Args:", revertError.data?.args ?? []);
|
|
551
|
-
console.error(" Signature:", revertError.signature);
|
|
552
|
-
console.error(" Reason:", revertError.reason);
|
|
553
|
-
errorDetails = {
|
|
554
|
-
errorName: revertError.data?.errorName,
|
|
555
|
-
errorArgs: revertError.data?.args,
|
|
556
|
-
signature: revertError.signature,
|
|
557
|
-
reason: revertError.reason
|
|
558
|
-
};
|
|
559
527
|
const errorName = revertError.data?.errorName ?? "Unknown";
|
|
560
528
|
const errorArgs = revertError.data?.args ?? [];
|
|
561
529
|
if (errorName !== "Unknown") {
|
|
@@ -567,101 +535,37 @@ function useSendCoinbaseUserOperation() {
|
|
|
567
535
|
errorMessage = simError.shortMessage || simError.message;
|
|
568
536
|
}
|
|
569
537
|
} else {
|
|
570
|
-
console.error("\u26A0\uFE0F NON-VIEM ERROR:", {
|
|
571
|
-
name: simError?.name,
|
|
572
|
-
message: simError?.message,
|
|
573
|
-
cause: simError?.cause
|
|
574
|
-
});
|
|
575
538
|
errorMessage = simError?.message || "Unknown simulation error";
|
|
576
539
|
}
|
|
577
|
-
console.error("\
|
|
578
|
-
|
|
579
|
-
console.error(" Function:", functionName);
|
|
580
|
-
console.error(" Args:", JSON.stringify(args, null, 2));
|
|
581
|
-
console.error(" Sender:", evmAddress);
|
|
582
|
-
console.error(" Network:", isProduction ? "base" : "base-sepolia");
|
|
583
|
-
if (simError?.data) {
|
|
584
|
-
console.error("\n\u{1F4E6} RAW ERROR DATA:", simError.data);
|
|
585
|
-
}
|
|
586
|
-
if (simError?.cause) {
|
|
587
|
-
console.error("\n\u{1F517} ERROR CAUSE CHAIN:");
|
|
588
|
-
let cause = simError.cause;
|
|
589
|
-
let depth = 1;
|
|
590
|
-
while (cause && depth < 5) {
|
|
591
|
-
console.error(` ${depth}. ${cause.message || cause}`);
|
|
592
|
-
cause = cause.cause;
|
|
593
|
-
depth++;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
console.error("=".repeat(80));
|
|
597
|
-
return {
|
|
598
|
-
success: false,
|
|
599
|
-
message: errorMessage,
|
|
600
|
-
details: errorDetails
|
|
601
|
-
};
|
|
540
|
+
console.error("\u274C Simulation failed:", errorMessage);
|
|
541
|
+
return { success: false, message: errorMessage };
|
|
602
542
|
}
|
|
603
543
|
try {
|
|
604
|
-
console.log("\u23F3 Encoding and sending user operation...");
|
|
605
544
|
const callData = (0, import_viem.encodeFunctionData)({
|
|
606
545
|
abi,
|
|
607
546
|
functionName,
|
|
608
547
|
args
|
|
609
548
|
});
|
|
610
|
-
console.log("\u{1F4E4} Sending with paymaster:", {
|
|
611
|
-
evmSmartAccount: evmAddress,
|
|
612
|
-
network: isProduction ? "base" : "base-sepolia",
|
|
613
|
-
useCdpPaymaster: true,
|
|
614
|
-
to: contractAddress,
|
|
615
|
-
callDataLength: callData.length
|
|
616
|
-
});
|
|
617
549
|
await sendUserOperation({
|
|
618
550
|
evmSmartAccount: evmAddress,
|
|
619
551
|
network: isProduction ? "base" : "base-sepolia",
|
|
620
552
|
useCdpPaymaster: true,
|
|
621
553
|
calls: [{ data: callData, to: contractAddress }]
|
|
622
554
|
});
|
|
623
|
-
console.log("\u2705 User operation submitted successfully");
|
|
624
555
|
return { success: true, message: "Operation submitted." };
|
|
625
556
|
} catch (opError) {
|
|
626
|
-
console.error("=".repeat(80));
|
|
627
|
-
console.error("\u274C USER OPERATION FAILED");
|
|
628
|
-
console.error("=".repeat(80));
|
|
629
|
-
console.error("Error:", opError);
|
|
630
557
|
let errorMessage = "Operation failed";
|
|
631
558
|
if (opError?.message?.includes("allowlist")) {
|
|
632
|
-
console.error("\n\u{1F6AB} PAYMASTER ALLOWLIST ERROR");
|
|
633
|
-
console.error(" The contract is not in the paymaster allowlist");
|
|
634
|
-
console.error(
|
|
635
|
-
" Add this contract to CDP Portal \u2192 Paymaster \u2192 Allowlist:"
|
|
636
|
-
);
|
|
637
|
-
console.error(" ", contractAddress);
|
|
638
559
|
errorMessage = `Contract ${contractAddress} not in paymaster allowlist`;
|
|
639
560
|
} else if (opError?.message?.includes("insufficient balance")) {
|
|
640
|
-
console.error("\n\u{1F4B0} INSUFFICIENT BALANCE ERROR");
|
|
641
|
-
console.error(" Paymaster or smart account has insufficient funds");
|
|
642
561
|
errorMessage = "Insufficient balance for gas payment";
|
|
643
562
|
} else if (opError?.code === -32002) {
|
|
644
|
-
console.error("\n\u{1F6AB} PAYMASTER POLICY ERROR");
|
|
645
|
-
console.error(" Code:", opError.code);
|
|
646
|
-
console.error(" Message:", opError.message);
|
|
647
563
|
errorMessage = `Paymaster policy error: ${opError.message}`;
|
|
648
564
|
} else {
|
|
649
565
|
errorMessage = opError?.message || "Unknown operation error";
|
|
650
566
|
}
|
|
651
|
-
console.error("\
|
|
652
|
-
|
|
653
|
-
console.error(" Smart Account:", evmAddress);
|
|
654
|
-
console.error(" Target Contract:", contractAddress);
|
|
655
|
-
console.error(" Function:", functionName);
|
|
656
|
-
console.error("=".repeat(80));
|
|
657
|
-
return {
|
|
658
|
-
success: false,
|
|
659
|
-
message: errorMessage,
|
|
660
|
-
details: {
|
|
661
|
-
code: opError?.code,
|
|
662
|
-
originalError: opError?.message
|
|
663
|
-
}
|
|
664
|
-
};
|
|
567
|
+
console.error("\u274C Operation failed:", errorMessage);
|
|
568
|
+
return { success: false, message: errorMessage };
|
|
665
569
|
}
|
|
666
570
|
},
|
|
667
571
|
[sendUserOperation, publicClient, isProduction]
|
package/dist/index.mjs
CHANGED
|
@@ -432,53 +432,21 @@ function useSendCoinbaseUserOperation() {
|
|
|
432
432
|
if (!evmAddress || !contractAddress || !abi || !functionName) {
|
|
433
433
|
return { success: false, message: "Missing required information" };
|
|
434
434
|
}
|
|
435
|
-
console.log("\u{1F50D} Transaction Details:", {
|
|
436
|
-
network: isProduction ? "base" : "base-sepolia",
|
|
437
|
-
evmAddress,
|
|
438
|
-
contractAddress,
|
|
439
|
-
functionName,
|
|
440
|
-
args
|
|
441
|
-
});
|
|
442
435
|
try {
|
|
443
|
-
|
|
444
|
-
const result = await publicClient.simulateContract({
|
|
436
|
+
await publicClient.simulateContract({
|
|
445
437
|
address: contractAddress,
|
|
446
438
|
abi,
|
|
447
439
|
functionName,
|
|
448
440
|
args,
|
|
449
441
|
account: evmAddress
|
|
450
442
|
});
|
|
451
|
-
console.log("\u2705 Simulation successful:", result);
|
|
452
443
|
} catch (simError) {
|
|
453
|
-
console.error("=".repeat(80));
|
|
454
|
-
console.error("\u274C SIMULATION FAILED - DETAILED ERROR");
|
|
455
|
-
console.error("=".repeat(80));
|
|
456
444
|
let errorMessage = "Simulation failed";
|
|
457
|
-
let errorDetails = {};
|
|
458
445
|
if (simError instanceof BaseError) {
|
|
459
|
-
console.error("\u{1F4CB} VIEM ERROR:");
|
|
460
|
-
console.error(" Name:", simError.name);
|
|
461
|
-
console.error(" Message:", simError.message);
|
|
462
|
-
console.error(" Short Message:", simError.shortMessage);
|
|
463
|
-
console.error(" Details:", simError.details);
|
|
464
446
|
const revertError = simError.walk(
|
|
465
447
|
(err) => err instanceof ContractFunctionRevertedError
|
|
466
448
|
);
|
|
467
449
|
if (revertError instanceof ContractFunctionRevertedError) {
|
|
468
|
-
console.error("\n\u{1F534} CONTRACT REVERT DETECTED:");
|
|
469
|
-
console.error(
|
|
470
|
-
" Error Name:",
|
|
471
|
-
revertError.data?.errorName ?? "Unknown"
|
|
472
|
-
);
|
|
473
|
-
console.error(" Error Args:", revertError.data?.args ?? []);
|
|
474
|
-
console.error(" Signature:", revertError.signature);
|
|
475
|
-
console.error(" Reason:", revertError.reason);
|
|
476
|
-
errorDetails = {
|
|
477
|
-
errorName: revertError.data?.errorName,
|
|
478
|
-
errorArgs: revertError.data?.args,
|
|
479
|
-
signature: revertError.signature,
|
|
480
|
-
reason: revertError.reason
|
|
481
|
-
};
|
|
482
450
|
const errorName = revertError.data?.errorName ?? "Unknown";
|
|
483
451
|
const errorArgs = revertError.data?.args ?? [];
|
|
484
452
|
if (errorName !== "Unknown") {
|
|
@@ -490,101 +458,37 @@ function useSendCoinbaseUserOperation() {
|
|
|
490
458
|
errorMessage = simError.shortMessage || simError.message;
|
|
491
459
|
}
|
|
492
460
|
} else {
|
|
493
|
-
console.error("\u26A0\uFE0F NON-VIEM ERROR:", {
|
|
494
|
-
name: simError?.name,
|
|
495
|
-
message: simError?.message,
|
|
496
|
-
cause: simError?.cause
|
|
497
|
-
});
|
|
498
461
|
errorMessage = simError?.message || "Unknown simulation error";
|
|
499
462
|
}
|
|
500
|
-
console.error("\
|
|
501
|
-
|
|
502
|
-
console.error(" Function:", functionName);
|
|
503
|
-
console.error(" Args:", JSON.stringify(args, null, 2));
|
|
504
|
-
console.error(" Sender:", evmAddress);
|
|
505
|
-
console.error(" Network:", isProduction ? "base" : "base-sepolia");
|
|
506
|
-
if (simError?.data) {
|
|
507
|
-
console.error("\n\u{1F4E6} RAW ERROR DATA:", simError.data);
|
|
508
|
-
}
|
|
509
|
-
if (simError?.cause) {
|
|
510
|
-
console.error("\n\u{1F517} ERROR CAUSE CHAIN:");
|
|
511
|
-
let cause = simError.cause;
|
|
512
|
-
let depth = 1;
|
|
513
|
-
while (cause && depth < 5) {
|
|
514
|
-
console.error(` ${depth}. ${cause.message || cause}`);
|
|
515
|
-
cause = cause.cause;
|
|
516
|
-
depth++;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
console.error("=".repeat(80));
|
|
520
|
-
return {
|
|
521
|
-
success: false,
|
|
522
|
-
message: errorMessage,
|
|
523
|
-
details: errorDetails
|
|
524
|
-
};
|
|
463
|
+
console.error("\u274C Simulation failed:", errorMessage);
|
|
464
|
+
return { success: false, message: errorMessage };
|
|
525
465
|
}
|
|
526
466
|
try {
|
|
527
|
-
console.log("\u23F3 Encoding and sending user operation...");
|
|
528
467
|
const callData = encodeFunctionData({
|
|
529
468
|
abi,
|
|
530
469
|
functionName,
|
|
531
470
|
args
|
|
532
471
|
});
|
|
533
|
-
console.log("\u{1F4E4} Sending with paymaster:", {
|
|
534
|
-
evmSmartAccount: evmAddress,
|
|
535
|
-
network: isProduction ? "base" : "base-sepolia",
|
|
536
|
-
useCdpPaymaster: true,
|
|
537
|
-
to: contractAddress,
|
|
538
|
-
callDataLength: callData.length
|
|
539
|
-
});
|
|
540
472
|
await sendUserOperation({
|
|
541
473
|
evmSmartAccount: evmAddress,
|
|
542
474
|
network: isProduction ? "base" : "base-sepolia",
|
|
543
475
|
useCdpPaymaster: true,
|
|
544
476
|
calls: [{ data: callData, to: contractAddress }]
|
|
545
477
|
});
|
|
546
|
-
console.log("\u2705 User operation submitted successfully");
|
|
547
478
|
return { success: true, message: "Operation submitted." };
|
|
548
479
|
} catch (opError) {
|
|
549
|
-
console.error("=".repeat(80));
|
|
550
|
-
console.error("\u274C USER OPERATION FAILED");
|
|
551
|
-
console.error("=".repeat(80));
|
|
552
|
-
console.error("Error:", opError);
|
|
553
480
|
let errorMessage = "Operation failed";
|
|
554
481
|
if (opError?.message?.includes("allowlist")) {
|
|
555
|
-
console.error("\n\u{1F6AB} PAYMASTER ALLOWLIST ERROR");
|
|
556
|
-
console.error(" The contract is not in the paymaster allowlist");
|
|
557
|
-
console.error(
|
|
558
|
-
" Add this contract to CDP Portal \u2192 Paymaster \u2192 Allowlist:"
|
|
559
|
-
);
|
|
560
|
-
console.error(" ", contractAddress);
|
|
561
482
|
errorMessage = `Contract ${contractAddress} not in paymaster allowlist`;
|
|
562
483
|
} else if (opError?.message?.includes("insufficient balance")) {
|
|
563
|
-
console.error("\n\u{1F4B0} INSUFFICIENT BALANCE ERROR");
|
|
564
|
-
console.error(" Paymaster or smart account has insufficient funds");
|
|
565
484
|
errorMessage = "Insufficient balance for gas payment";
|
|
566
485
|
} else if (opError?.code === -32002) {
|
|
567
|
-
console.error("\n\u{1F6AB} PAYMASTER POLICY ERROR");
|
|
568
|
-
console.error(" Code:", opError.code);
|
|
569
|
-
console.error(" Message:", opError.message);
|
|
570
486
|
errorMessage = `Paymaster policy error: ${opError.message}`;
|
|
571
487
|
} else {
|
|
572
488
|
errorMessage = opError?.message || "Unknown operation error";
|
|
573
489
|
}
|
|
574
|
-
console.error("\
|
|
575
|
-
|
|
576
|
-
console.error(" Smart Account:", evmAddress);
|
|
577
|
-
console.error(" Target Contract:", contractAddress);
|
|
578
|
-
console.error(" Function:", functionName);
|
|
579
|
-
console.error("=".repeat(80));
|
|
580
|
-
return {
|
|
581
|
-
success: false,
|
|
582
|
-
message: errorMessage,
|
|
583
|
-
details: {
|
|
584
|
-
code: opError?.code,
|
|
585
|
-
originalError: opError?.message
|
|
586
|
-
}
|
|
587
|
-
};
|
|
490
|
+
console.error("\u274C Operation failed:", errorMessage);
|
|
491
|
+
return { success: false, message: errorMessage };
|
|
588
492
|
}
|
|
589
493
|
},
|
|
590
494
|
[sendUserOperation, publicClient, isProduction]
|
package/package.json
CHANGED