@poa-box/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 +201 -0
- package/dist/abis/DirectDemocracyVotingNew.d.ts +749 -0
- package/dist/abis/DirectDemocracyVotingNew.js +961 -0
- package/dist/abis/ERC20.d.ts +90 -0
- package/dist/abis/ERC20.js +125 -0
- package/dist/abis/EducationHubNew.d.ts +590 -0
- package/dist/abis/EducationHubNew.js +762 -0
- package/dist/abis/EligibilityModuleNew.d.ts +1615 -0
- package/dist/abis/EligibilityModuleNew.js +2082 -0
- package/dist/abis/Executor.d.ts +619 -0
- package/dist/abis/Executor.js +796 -0
- package/dist/abis/HybridVotingNew.d.ts +898 -0
- package/dist/abis/HybridVotingNew.js +1149 -0
- package/dist/abis/ImplementationRegistry.d.ts +270 -0
- package/dist/abis/ImplementationRegistry.js +355 -0
- package/dist/abis/OrgDeployerNew.d.ts +1275 -0
- package/dist/abis/OrgDeployerNew.js +1630 -0
- package/dist/abis/OrgRegistry.d.ts +670 -0
- package/dist/abis/OrgRegistry.js +868 -0
- package/dist/abis/ParticipationToken.d.ts +1086 -0
- package/dist/abis/ParticipationToken.js +1415 -0
- package/dist/abis/PasskeyAccount.d.ts +788 -0
- package/dist/abis/PasskeyAccount.js +1019 -0
- package/dist/abis/PasskeyAccountFactory.d.ts +344 -0
- package/dist/abis/PasskeyAccountFactory.js +449 -0
- package/dist/abis/PaymasterHub.d.ts +1603 -0
- package/dist/abis/PaymasterHub.js +2048 -0
- package/dist/abis/PaymentManager.d.ts +520 -0
- package/dist/abis/PaymentManager.js +671 -0
- package/dist/abis/PoaManager.d.ts +344 -0
- package/dist/abis/PoaManager.js +449 -0
- package/dist/abis/QuickJoinNew.d.ts +855 -0
- package/dist/abis/QuickJoinNew.js +1098 -0
- package/dist/abis/TaskManagerNew.d.ts +1236 -0
- package/dist/abis/TaskManagerNew.js +1573 -0
- package/dist/abis/ToggleModule.d.ts +193 -0
- package/dist/abis/ToggleModule.js +255 -0
- package/dist/abis/UniversalAccountRegistry.d.ts +577 -0
- package/dist/abis/UniversalAccountRegistry.js +750 -0
- package/dist/abis/ZkEmailInvites.d.ts +823 -0
- package/dist/abis/ZkEmailInvites.js +1060 -0
- package/dist/abis/external/AaveGovernanceV2.d.ts +128 -0
- package/dist/abis/external/AaveGovernanceV2.js +177 -0
- package/dist/abis/external/AaveGovernanceV3.d.ts +160 -0
- package/dist/abis/external/AaveGovernanceV3.js +220 -0
- package/dist/abis/external/AragonVoting.d.ts +107 -0
- package/dist/abis/external/AragonVoting.js +150 -0
- package/dist/abis/external/CurveGaugeController.d.ts +95 -0
- package/dist/abis/external/CurveGaugeController.js +130 -0
- package/dist/abis/external/CurveVotingEscrow.d.ts +86 -0
- package/dist/abis/external/CurveVotingEscrow.js +116 -0
- package/dist/abis/external/GovernorAlpha.d.ts +172 -0
- package/dist/abis/external/GovernorAlpha.js +228 -0
- package/dist/abis/external/MakerDAOChief.d.ts +92 -0
- package/dist/abis/external/MakerDAOChief.js +129 -0
- package/dist/abis/external/OZGovernor.d.ts +227 -0
- package/dist/abis/external/OZGovernor.js +317 -0
- package/dist/abis/external/SolidlyVotingEscrow.d.ts +196 -0
- package/dist/abis/external/SolidlyVotingEscrow.js +260 -0
- package/dist/abis/index.d.ts +62 -0
- package/dist/abis/index.js +98 -0
- package/dist/chains.d.ts +150 -0
- package/dist/chains.js +320 -0
- package/dist/context.d.ts +48 -0
- package/dist/context.js +38 -0
- package/dist/contracts.d.ts +24 -0
- package/dist/contracts.js +41 -0
- package/dist/encoding.d.ts +58 -0
- package/dist/encoding.js +243 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.js +4 -0
- package/dist/error-catalog.d.ts +41 -0
- package/dist/error-catalog.js +941 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.js +60 -0
- package/dist/execute/ethers.d.ts +93 -0
- package/dist/execute/ethers.js +323 -0
- package/dist/execute/index.d.ts +7 -0
- package/dist/execute/index.js +23 -0
- package/dist/execute/sponsored.d.ts +68 -0
- package/dist/execute/sponsored.js +277 -0
- package/dist/exit-codes.d.ts +18 -0
- package/dist/exit-codes.js +21 -0
- package/dist/format.d.ts +21 -0
- package/dist/format.js +89 -0
- package/dist/graph/client.d.ts +298 -0
- package/dist/graph/client.js +702 -0
- package/dist/graph/documents/activity.d.ts +9 -0
- package/dist/graph/documents/activity.js +164 -0
- package/dist/graph/documents/beacons.d.ts +172 -0
- package/dist/graph/documents/beacons.js +345 -0
- package/dist/graph/documents/index.d.ts +21 -0
- package/dist/graph/documents/index.js +57 -0
- package/dist/graph/documents/infrastructure.d.ts +30 -0
- package/dist/graph/documents/infrastructure.js +34 -0
- package/dist/graph/documents/org.d.ts +15 -0
- package/dist/graph/documents/org.js +249 -0
- package/dist/graph/documents/paymaster.d.ts +95 -0
- package/dist/graph/documents/paymaster.js +101 -0
- package/dist/graph/documents/role.d.ts +6 -0
- package/dist/graph/documents/role.js +41 -0
- package/dist/graph/documents/roles.d.ts +50 -0
- package/dist/graph/documents/roles.js +112 -0
- package/dist/graph/documents/task.d.ts +84 -0
- package/dist/graph/documents/task.js +236 -0
- package/dist/graph/documents/token.d.ts +13 -0
- package/dist/graph/documents/token.js +126 -0
- package/dist/graph/documents/treasury.d.ts +39 -0
- package/dist/graph/documents/treasury.js +136 -0
- package/dist/graph/documents/user.d.ts +120 -0
- package/dist/graph/documents/user.js +302 -0
- package/dist/graph/documents/voting-classes.d.ts +69 -0
- package/dist/graph/documents/voting-classes.js +149 -0
- package/dist/graph/documents/voting.d.ts +28 -0
- package/dist/graph/documents/voting.js +163 -0
- package/dist/graph/documents/vouch.d.ts +79 -0
- package/dist/graph/documents/vouch.js +171 -0
- package/dist/graph/documents/zkemail.d.ts +63 -0
- package/dist/graph/documents/zkemail.js +188 -0
- package/dist/graph/index.d.ts +2 -0
- package/dist/graph/index.js +41 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +92 -0
- package/dist/ipfs.d.ts +39 -0
- package/dist/ipfs.js +214 -0
- package/dist/label-aliases.d.ts +31 -0
- package/dist/label-aliases.js +70 -0
- package/dist/metadata/education.d.ts +30 -0
- package/dist/metadata/education.js +31 -0
- package/dist/metadata/index.d.ts +12 -0
- package/dist/metadata/index.js +48 -0
- package/dist/metadata/org.d.ts +92 -0
- package/dist/metadata/org.js +93 -0
- package/dist/metadata/proposal.d.ts +44 -0
- package/dist/metadata/proposal.js +45 -0
- package/dist/metadata/role.d.ts +38 -0
- package/dist/metadata/role.js +35 -0
- package/dist/metadata/task.d.ts +108 -0
- package/dist/metadata/task.js +81 -0
- package/dist/metadata/token.d.ts +32 -0
- package/dist/metadata/token.js +36 -0
- package/dist/metadata/user.d.ts +63 -0
- package/dist/metadata/user.js +70 -0
- package/dist/multicall.d.ts +32 -0
- package/dist/multicall.js +96 -0
- package/dist/payout.d.ts +59 -0
- package/dist/payout.js +96 -0
- package/dist/perms.d.ts +47 -0
- package/dist/perms.js +120 -0
- package/dist/preflight.d.ts +72 -0
- package/dist/preflight.js +269 -0
- package/dist/reads/education.d.ts +79 -0
- package/dist/reads/education.js +122 -0
- package/dist/reads/eligibility.d.ts +377 -0
- package/dist/reads/eligibility.js +687 -0
- package/dist/reads/index.d.ts +16 -0
- package/dist/reads/index.js +55 -0
- package/dist/reads/org.d.ts +258 -0
- package/dist/reads/org.js +220 -0
- package/dist/reads/paymaster.d.ts +147 -0
- package/dist/reads/paymaster.js +235 -0
- package/dist/reads/project.d.ts +33 -0
- package/dist/reads/project.js +62 -0
- package/dist/reads/resolve.d.ts +34 -0
- package/dist/reads/resolve.js +64 -0
- package/dist/reads/task.d.ts +286 -0
- package/dist/reads/task.js +280 -0
- package/dist/reads/token.d.ts +94 -0
- package/dist/reads/token.js +75 -0
- package/dist/reads/treasury.d.ts +222 -0
- package/dist/reads/treasury.js +241 -0
- package/dist/reads/user.d.ts +229 -0
- package/dist/reads/user.js +155 -0
- package/dist/reads/vote.d.ts +296 -0
- package/dist/reads/vote.js +392 -0
- package/dist/reads/zkemail.d.ts +117 -0
- package/dist/reads/zkemail.js +217 -0
- package/dist/similarity.d.ts +36 -0
- package/dist/similarity.js +67 -0
- package/dist/sponsorship-config.d.ts +47 -0
- package/dist/sponsorship-config.js +41 -0
- package/dist/stats.d.ts +11 -0
- package/dist/stats.js +27 -0
- package/dist/task-lens.d.ts +113 -0
- package/dist/task-lens.js +210 -0
- package/dist/tx/education.d.ts +169 -0
- package/dist/tx/education.js +344 -0
- package/dist/tx/eligibility.d.ts +511 -0
- package/dist/tx/eligibility.js +818 -0
- package/dist/tx/governance.d.ts +85 -0
- package/dist/tx/governance.js +87 -0
- package/dist/tx/index.d.ts +17 -0
- package/dist/tx/index.js +56 -0
- package/dist/tx/intent.d.ts +67 -0
- package/dist/tx/intent.js +48 -0
- package/dist/tx/org.d.ts +321 -0
- package/dist/tx/org.js +544 -0
- package/dist/tx/paymaster.d.ts +140 -0
- package/dist/tx/paymaster.js +251 -0
- package/dist/tx/project.d.ts +146 -0
- package/dist/tx/project.js +217 -0
- package/dist/tx/task.d.ts +480 -0
- package/dist/tx/task.js +1149 -0
- package/dist/tx/token.d.ts +96 -0
- package/dist/tx/token.js +165 -0
- package/dist/tx/treasury.d.ts +474 -0
- package/dist/tx/treasury.js +911 -0
- package/dist/tx/user.d.ts +177 -0
- package/dist/tx/user.js +292 -0
- package/dist/tx/vote.d.ts +332 -0
- package/dist/tx/vote.js +762 -0
- package/dist/tx/zkemail.d.ts +90 -0
- package/dist/tx/zkemail.js +210 -0
- package/dist/validation.d.ts +8 -0
- package/dist/validation.js +39 -0
- package/dist/version.d.ts +142 -0
- package/dist/version.js +257 -0
- package/dist/zkemail.d.ts +161 -0
- package/dist/zkemail.js +299 -0
- package/package.json +130 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed Error Classes
|
|
3
|
+
* User-friendly errors with actionable messages.
|
|
4
|
+
*/
|
|
5
|
+
export declare class CliError extends Error {
|
|
6
|
+
code: number;
|
|
7
|
+
suggestion?: string | undefined;
|
|
8
|
+
constructor(message: string, code?: number, suggestion?: string | undefined);
|
|
9
|
+
}
|
|
10
|
+
export declare class TxRevertError extends CliError {
|
|
11
|
+
constructor(reason: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class NetworkError extends CliError {
|
|
14
|
+
constructor(message: string);
|
|
15
|
+
}
|
|
16
|
+
export declare class SubgraphError extends CliError {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class IpfsError extends CliError {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
export declare class PreconditionError extends CliError {
|
|
23
|
+
constructor(message: string, suggestion?: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class AbortedError extends CliError {
|
|
26
|
+
constructor(message?: string);
|
|
27
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Typed Error Classes
|
|
4
|
+
* User-friendly errors with actionable messages.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AbortedError = exports.PreconditionError = exports.IpfsError = exports.SubgraphError = exports.NetworkError = exports.TxRevertError = exports.CliError = void 0;
|
|
8
|
+
class CliError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
suggestion;
|
|
11
|
+
constructor(message, code = 1, suggestion) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.suggestion = suggestion;
|
|
15
|
+
this.name = 'CliError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.CliError = CliError;
|
|
19
|
+
class TxRevertError extends CliError {
|
|
20
|
+
constructor(reason) {
|
|
21
|
+
super(`Transaction reverted: ${reason}`, 2, 'Check that you have the required permissions and the task/project is in the expected state.');
|
|
22
|
+
this.name = 'TxRevertError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TxRevertError = TxRevertError;
|
|
26
|
+
class NetworkError extends CliError {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(`Network error: ${message}`, 3, 'Check your RPC URL and network connection.');
|
|
29
|
+
this.name = 'NetworkError';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.NetworkError = NetworkError;
|
|
33
|
+
class SubgraphError extends CliError {
|
|
34
|
+
constructor(message) {
|
|
35
|
+
super(`Subgraph error: ${message}`, 3, 'Check your subgraph URL. The subgraph may be syncing or unavailable.');
|
|
36
|
+
this.name = 'SubgraphError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.SubgraphError = SubgraphError;
|
|
40
|
+
class IpfsError extends CliError {
|
|
41
|
+
constructor(message) {
|
|
42
|
+
super(`IPFS error: ${message}`, 3, 'IPFS endpoint may be temporarily unavailable. Try again in a moment.');
|
|
43
|
+
this.name = 'IpfsError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.IpfsError = IpfsError;
|
|
47
|
+
class PreconditionError extends CliError {
|
|
48
|
+
constructor(message, suggestion) {
|
|
49
|
+
super(message, 4, suggestion);
|
|
50
|
+
this.name = 'PreconditionError';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.PreconditionError = PreconditionError;
|
|
54
|
+
class AbortedError extends CliError {
|
|
55
|
+
constructor(message = 'Aborted by user') {
|
|
56
|
+
super(message, 5);
|
|
57
|
+
this.name = 'AbortedError';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.AbortedError = AbortedError;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction Execution
|
|
3
|
+
* Send transactions, wait for confirmation, support dry-run mode.
|
|
4
|
+
* Routes through EIP-7702 gas sponsorship when options.sponsored is provided
|
|
5
|
+
* (core never reads env — the CLI resolves sponsorship config into options).
|
|
6
|
+
*/
|
|
7
|
+
import { ethers } from 'ethers';
|
|
8
|
+
import type { SponsoredConfig, SponsoredSendOptions } from '../sponsorship-config';
|
|
9
|
+
import type { TxIntent } from '../tx/intent';
|
|
10
|
+
export type { SponsoredConfig };
|
|
11
|
+
export type ErrorCode = 'TX_REVERTED' | 'INSUFFICIENT_FUNDS' | 'NETWORK_ERROR' | 'USER_REJECTED' | 'GAS_ESTIMATION_FAILED' | 'CONTRACT_ERROR' | 'UNKNOWN_ERROR';
|
|
12
|
+
export interface TxResult {
|
|
13
|
+
success: boolean;
|
|
14
|
+
txHash?: string;
|
|
15
|
+
blockNumber?: number;
|
|
16
|
+
gasUsed?: string;
|
|
17
|
+
explorerUrl?: string;
|
|
18
|
+
logs?: ethers.utils.LogDescription[];
|
|
19
|
+
error?: string;
|
|
20
|
+
errorCode?: ErrorCode;
|
|
21
|
+
/** Decoded custom-error name (e.g. 'BadStatus') when revert data was decodable */
|
|
22
|
+
errorName?: string;
|
|
23
|
+
/** Decoded custom-error args (empty for parameterless errors) */
|
|
24
|
+
errorArgs?: any[];
|
|
25
|
+
/** Actionable next step from the error catalog */
|
|
26
|
+
suggestion?: string;
|
|
27
|
+
/** Original provider/ethers message when the catalog replaced it */
|
|
28
|
+
rawMessage?: string;
|
|
29
|
+
sponsored?: boolean;
|
|
30
|
+
/** Dry-run fields (set when options.dryRun is true; no tx is sent) */
|
|
31
|
+
dryRun?: boolean;
|
|
32
|
+
gasEstimate?: string;
|
|
33
|
+
calldata?: string;
|
|
34
|
+
to?: string;
|
|
35
|
+
method?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface TxOptions {
|
|
38
|
+
dryRun?: boolean;
|
|
39
|
+
gasLimit?: number;
|
|
40
|
+
value?: ethers.BigNumber;
|
|
41
|
+
/**
|
|
42
|
+
* Sponsorship config, or a thunk resolving it. The thunk is invoked INSIDE
|
|
43
|
+
* the executor's try/catch and only after the dry-run short-circuit — so a
|
|
44
|
+
* host whose config resolution can throw (the CLI parses POP_HAT_ID from
|
|
45
|
+
* env with BigInt()) gets a classified TxResult instead of a rejection, and
|
|
46
|
+
* dry runs never touch sponsorship at all (pre-extraction CLI behavior).
|
|
47
|
+
*/
|
|
48
|
+
sponsored?: SponsoredConfig | (() => SponsoredConfig | undefined);
|
|
49
|
+
/** Emit the legacy `dry-run:0x…` txHash in dry-run results (CLI: POP_LEGACY_DRYRUN_TXHASH=1). */
|
|
50
|
+
legacyDryRunTxHash?: boolean;
|
|
51
|
+
/** Bundler/RPC routing forwarded to sendSponsored (CLI maps POP_BUNDLER_URL / PIMLICO_API_KEY). */
|
|
52
|
+
sponsoredSend?: SponsoredSendOptions;
|
|
53
|
+
}
|
|
54
|
+
export declare function parseEventLogs(receipt: ethers.providers.TransactionReceipt, contractInterface: ethers.utils.Interface): ethers.utils.LogDescription[];
|
|
55
|
+
export interface ClassifiedError {
|
|
56
|
+
message: string;
|
|
57
|
+
code: ErrorCode;
|
|
58
|
+
errorName?: string;
|
|
59
|
+
errorArgs?: any[];
|
|
60
|
+
suggestion?: string;
|
|
61
|
+
rawMessage?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Map a raw ethers/provider error to a stable error code + human message.
|
|
65
|
+
* When an interface is provided, revert data is decoded against it (then
|
|
66
|
+
* against the global ABI error registry) on the TX_REVERTED and
|
|
67
|
+
* GAS_ESTIMATION_FAILED paths.
|
|
68
|
+
*/
|
|
69
|
+
export declare function classifyError(error: any, iface?: ethers.utils.Interface): ClassifiedError;
|
|
70
|
+
/**
|
|
71
|
+
* ERC-4337 critical check: the outer bundler tx ALWAYS has status=1, even
|
|
72
|
+
* when the inner UserOp call reverts. The actual success/failure of the
|
|
73
|
+
* inner call is in the UserOperationEvent log emitted by the EntryPoint.
|
|
74
|
+
* Returns a failure TxResult when the inner call reverted (decoding the
|
|
75
|
+
* UserOperationRevertReason payload for a human message), else null.
|
|
76
|
+
*/
|
|
77
|
+
export declare function detectUserOpFailure(receipt: ethers.providers.TransactionReceipt, txHash: string, chainId: number, iface?: ethers.utils.Interface): TxResult | null;
|
|
78
|
+
/**
|
|
79
|
+
* Execute a contract method.
|
|
80
|
+
* In dry-run mode: estimates gas and encodes calldata without sending.
|
|
81
|
+
* When sponsored config is provided and the EOA is delegated, routes through
|
|
82
|
+
* the PaymasterHub for gas sponsorship. Falls back to direct EOA tx if
|
|
83
|
+
* sponsorship is unavailable or fails.
|
|
84
|
+
* Returns parsed event logs so callers can extract entity IDs.
|
|
85
|
+
*/
|
|
86
|
+
export declare function executeContractTx(contract: ethers.Contract, method: string, args: any[], options?: TxOptions): Promise<TxResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Execute a TxIntent with an ethers signer.
|
|
89
|
+
* Thin adapter over executeContractTx: constructs the contract from the
|
|
90
|
+
* intent's resolved address + ABI, and merges the intent's native value into
|
|
91
|
+
* the tx options (an explicit options.value wins).
|
|
92
|
+
*/
|
|
93
|
+
export declare function executeIntent(signer: ethers.Signer, intent: TxIntent, options?: TxOptions): Promise<TxResult>;
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Transaction Execution
|
|
4
|
+
* Send transactions, wait for confirmation, support dry-run mode.
|
|
5
|
+
* Routes through EIP-7702 gas sponsorship when options.sponsored is provided
|
|
6
|
+
* (core never reads env — the CLI resolves sponsorship config into options).
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.parseEventLogs = parseEventLogs;
|
|
10
|
+
exports.classifyError = classifyError;
|
|
11
|
+
exports.detectUserOpFailure = detectUserOpFailure;
|
|
12
|
+
exports.executeContractTx = executeContractTx;
|
|
13
|
+
exports.executeIntent = executeIntent;
|
|
14
|
+
const ethers_1 = require("ethers");
|
|
15
|
+
const chains_1 = require("../chains");
|
|
16
|
+
const error_catalog_1 = require("../error-catalog");
|
|
17
|
+
function buildExplorerUrl(txHash, chainId) {
|
|
18
|
+
const network = (0, chains_1.getNetworkByChainId)(chainId);
|
|
19
|
+
if (!network?.blockExplorer)
|
|
20
|
+
return undefined;
|
|
21
|
+
return `${network.blockExplorer}/tx/${txHash}`;
|
|
22
|
+
}
|
|
23
|
+
function parseEventLogs(receipt, contractInterface) {
|
|
24
|
+
const parsed = [];
|
|
25
|
+
for (const log of receipt.logs) {
|
|
26
|
+
try {
|
|
27
|
+
parsed.push(contractInterface.parseLog(log));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Log from a different contract — skip
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Enrich a revert classification with a decoded custom error when the revert
|
|
37
|
+
* data is decodable. The catalog human text replaces the message (the original
|
|
38
|
+
* is kept in rawMessage); unknown selectors keep the original message but
|
|
39
|
+
* still expose the selector via errorName.
|
|
40
|
+
*/
|
|
41
|
+
function withDecodedError(error, iface, base) {
|
|
42
|
+
const decoded = (0, error_catalog_1.decodeContractError)(error, iface);
|
|
43
|
+
if (!decoded)
|
|
44
|
+
return base;
|
|
45
|
+
if (decoded.name.startsWith('UnknownCustomError(')) {
|
|
46
|
+
return { ...base, errorName: decoded.name };
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
message: decoded.human,
|
|
50
|
+
code: base.code,
|
|
51
|
+
errorName: decoded.name,
|
|
52
|
+
errorArgs: decoded.args,
|
|
53
|
+
suggestion: decoded.suggestion,
|
|
54
|
+
rawMessage: base.message,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Map a raw ethers/provider error to a stable error code + human message.
|
|
59
|
+
* When an interface is provided, revert data is decoded against it (then
|
|
60
|
+
* against the global ABI error registry) on the TX_REVERTED and
|
|
61
|
+
* GAS_ESTIMATION_FAILED paths.
|
|
62
|
+
*/
|
|
63
|
+
function classifyError(error, iface) {
|
|
64
|
+
const msg = error.message || 'Transaction failed';
|
|
65
|
+
if (error.code === 'INSUFFICIENT_FUNDS' || msg.includes('insufficient funds')) {
|
|
66
|
+
return { message: 'Insufficient funds for gas + value', code: 'INSUFFICIENT_FUNDS' };
|
|
67
|
+
}
|
|
68
|
+
if (error.code === 'ACTION_REJECTED' || msg.includes('user rejected')) {
|
|
69
|
+
return { message: 'Transaction rejected by user', code: 'USER_REJECTED' };
|
|
70
|
+
}
|
|
71
|
+
if (error.code === 'UNPREDICTABLE_GAS_LIMIT' || msg.includes('cannot estimate gas')) {
|
|
72
|
+
const reason = error.reason || error.error?.reason || error.error?.message || msg;
|
|
73
|
+
return withDecodedError(error, iface, {
|
|
74
|
+
message: `Transaction would revert: ${reason}`,
|
|
75
|
+
code: 'GAS_ESTIMATION_FAILED',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (error.code === 'NETWORK_ERROR' || error.code === 'SERVER_ERROR' || msg.includes('ECONNREFUSED')) {
|
|
79
|
+
return { message: `Network error: ${msg}`, code: 'NETWORK_ERROR' };
|
|
80
|
+
}
|
|
81
|
+
if (error.reason) {
|
|
82
|
+
return withDecodedError(error, iface, { message: `Reverted: ${error.reason}`, code: 'TX_REVERTED' });
|
|
83
|
+
}
|
|
84
|
+
if (error.error?.message) {
|
|
85
|
+
return withDecodedError(error, iface, { message: error.error.message, code: 'TX_REVERTED' });
|
|
86
|
+
}
|
|
87
|
+
return { message: msg, code: 'UNKNOWN_ERROR' };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* ERC-4337 EntryPoint events needed to detect inner UserOp failures.
|
|
91
|
+
* Topic 0 of UserOperationEvent:
|
|
92
|
+
* 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f
|
|
93
|
+
*/
|
|
94
|
+
const ENTRY_POINT_EVENTS = new ethers_1.ethers.utils.Interface([
|
|
95
|
+
'event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed)',
|
|
96
|
+
'event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)',
|
|
97
|
+
]);
|
|
98
|
+
/** Error(string) selector — unwrap to the plain revert string */
|
|
99
|
+
const ERROR_STRING_SELECTOR = '0x08c379a0';
|
|
100
|
+
/**
|
|
101
|
+
* Turn raw revert bytes (e.g. UserOperationRevertReason.revertReason) into a
|
|
102
|
+
* human message: unwraps Error(string), otherwise decodes custom errors via
|
|
103
|
+
* the error catalog. Returns null when the bytes are empty/undecodable.
|
|
104
|
+
*/
|
|
105
|
+
function describeRevertData(data, iface) {
|
|
106
|
+
if (typeof data !== 'string' || !data.startsWith('0x') || data.length < 10)
|
|
107
|
+
return null;
|
|
108
|
+
if (data.slice(0, 10).toLowerCase() === ERROR_STRING_SELECTOR) {
|
|
109
|
+
try {
|
|
110
|
+
const [reason] = ethers_1.ethers.utils.defaultAbiCoder.decode(['string'], '0x' + data.slice(10));
|
|
111
|
+
return { message: `Reverted: ${reason}` };
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const decoded = (0, error_catalog_1.decodeContractError)({ data }, iface);
|
|
118
|
+
if (!decoded)
|
|
119
|
+
return null;
|
|
120
|
+
return { message: decoded.human, name: decoded.name, suggestion: decoded.suggestion };
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* ERC-4337 critical check: the outer bundler tx ALWAYS has status=1, even
|
|
124
|
+
* when the inner UserOp call reverts. The actual success/failure of the
|
|
125
|
+
* inner call is in the UserOperationEvent log emitted by the EntryPoint.
|
|
126
|
+
* Returns a failure TxResult when the inner call reverted (decoding the
|
|
127
|
+
* UserOperationRevertReason payload for a human message), else null.
|
|
128
|
+
*/
|
|
129
|
+
function detectUserOpFailure(receipt, txHash, chainId, iface) {
|
|
130
|
+
const userOpTopic = ENTRY_POINT_EVENTS.getEventTopic('UserOperationEvent');
|
|
131
|
+
const userOpLog = receipt.logs.find((log) => log.topics[0] === userOpTopic);
|
|
132
|
+
if (!userOpLog)
|
|
133
|
+
return null;
|
|
134
|
+
let innerSuccess;
|
|
135
|
+
try {
|
|
136
|
+
innerSuccess = ENTRY_POINT_EVENTS.parseLog(userOpLog).args.success;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return null; // Unparseable event — assume success rather than false-alarm
|
|
140
|
+
}
|
|
141
|
+
if (innerSuccess)
|
|
142
|
+
return null;
|
|
143
|
+
// Inner call failed — look for UserOperationRevertReason for detail
|
|
144
|
+
const revertTopic = ENTRY_POINT_EVENTS.getEventTopic('UserOperationRevertReason');
|
|
145
|
+
const revertLog = receipt.logs.find((log) => log.topics[0] === revertTopic);
|
|
146
|
+
let detail = revertLog ? ` Revert data available in tx ${txHash}` : '';
|
|
147
|
+
let errorName;
|
|
148
|
+
let suggestion;
|
|
149
|
+
if (revertLog) {
|
|
150
|
+
try {
|
|
151
|
+
const revertReason = ENTRY_POINT_EVENTS.parseLog(revertLog).args.revertReason;
|
|
152
|
+
const described = describeRevertData(revertReason, iface);
|
|
153
|
+
if (described) {
|
|
154
|
+
detail = ` Reason: ${described.message}`;
|
|
155
|
+
errorName = described.name;
|
|
156
|
+
suggestion = described.suggestion;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// Keep the generic detail
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
success: false,
|
|
165
|
+
txHash,
|
|
166
|
+
explorerUrl: buildExplorerUrl(txHash, chainId),
|
|
167
|
+
error: `Sponsored UserOp inner call reverted (tx succeeded but execution failed).${detail}`,
|
|
168
|
+
errorCode: 'TX_REVERTED',
|
|
169
|
+
errorName,
|
|
170
|
+
suggestion,
|
|
171
|
+
sponsored: true,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Try to send a transaction via EIP-7702 gas sponsorship.
|
|
176
|
+
* Returns null if sponsorship is not available or fails (caller should fall back to direct tx).
|
|
177
|
+
*/
|
|
178
|
+
async function trySponsoredTx(contract, method, args, config, options) {
|
|
179
|
+
try {
|
|
180
|
+
// Loaded lazily so this module never top-level-requires viem/permissionless:
|
|
181
|
+
// they are OPTIONAL peers, and the plain-EOA executor must stay importable
|
|
182
|
+
// without them. The require only runs when sponsorship is actually
|
|
183
|
+
// configured — i.e. when the host has the 4337 stack installed.
|
|
184
|
+
const { isDelegated, sendSponsored } = require('./sponsored');
|
|
185
|
+
const signerAddress = await contract.signer.getAddress();
|
|
186
|
+
// Check if EOA is delegated
|
|
187
|
+
const delegated = await isDelegated(signerAddress, options.sponsoredSend?.rpcUrl);
|
|
188
|
+
if (!delegated) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
// Encode the calldata
|
|
192
|
+
const calldata = contract.interface.encodeFunctionData(method, args);
|
|
193
|
+
const to = contract.address;
|
|
194
|
+
const result = await sendSponsored(config.privateKey, to, calldata, config.orgId, config.hatId, {
|
|
195
|
+
// Bundler/RPC routing comes from options.sponsoredSend; the tx value
|
|
196
|
+
// still comes from options.value (same as the pre-extraction CLI).
|
|
197
|
+
...options.sponsoredSend,
|
|
198
|
+
value: options.value ? BigInt(options.value.toString()) : options.sponsoredSend?.value,
|
|
199
|
+
});
|
|
200
|
+
const chainId = await contract.provider.getNetwork().then(n => n.chainId);
|
|
201
|
+
// Fetch the receipt to get logs and gas used
|
|
202
|
+
const receipt = await contract.provider.getTransactionReceipt(result.txHash);
|
|
203
|
+
const logs = receipt ? parseEventLogs(receipt, contract.interface) : [];
|
|
204
|
+
// Check outer tx status (bundler tx revert — rare but possible)
|
|
205
|
+
if (receipt && receipt.status === 0) {
|
|
206
|
+
return {
|
|
207
|
+
success: false,
|
|
208
|
+
txHash: result.txHash,
|
|
209
|
+
error: 'Sponsored transaction reverted on-chain (bundler tx failed).',
|
|
210
|
+
errorCode: 'TX_REVERTED',
|
|
211
|
+
sponsored: true,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// ERC-4337: outer bundler tx has status=1 even when the inner UserOp
|
|
215
|
+
// reverted — inspect the EntryPoint events to detect silent failures.
|
|
216
|
+
if (receipt) {
|
|
217
|
+
const userOpFailure = detectUserOpFailure(receipt, result.txHash, chainId, contract.interface);
|
|
218
|
+
if (userOpFailure) {
|
|
219
|
+
return userOpFailure;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
success: true,
|
|
224
|
+
txHash: result.txHash,
|
|
225
|
+
blockNumber: receipt?.blockNumber,
|
|
226
|
+
gasUsed: receipt?.gasUsed?.toString(),
|
|
227
|
+
explorerUrl: buildExplorerUrl(result.txHash, chainId),
|
|
228
|
+
logs,
|
|
229
|
+
sponsored: true,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
// Sponsorship failed — fall back to direct tx
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Execute a contract method.
|
|
239
|
+
* In dry-run mode: estimates gas and encodes calldata without sending.
|
|
240
|
+
* When sponsored config is provided and the EOA is delegated, routes through
|
|
241
|
+
* the PaymasterHub for gas sponsorship. Falls back to direct EOA tx if
|
|
242
|
+
* sponsorship is unavailable or fails.
|
|
243
|
+
* Returns parsed event logs so callers can extract entity IDs.
|
|
244
|
+
*/
|
|
245
|
+
async function executeContractTx(contract, method, args, options = {}) {
|
|
246
|
+
try {
|
|
247
|
+
// Estimate gas first (also validates the tx would succeed)
|
|
248
|
+
const gasEstimate = await contract.estimateGas[method](...args, {
|
|
249
|
+
value: options.value,
|
|
250
|
+
});
|
|
251
|
+
if (options.dryRun) {
|
|
252
|
+
const calldata = contract.interface.encodeFunctionData(method, args);
|
|
253
|
+
return {
|
|
254
|
+
success: true,
|
|
255
|
+
dryRun: true,
|
|
256
|
+
gasEstimate: gasEstimate.toString(),
|
|
257
|
+
calldata,
|
|
258
|
+
to: contract.address,
|
|
259
|
+
method,
|
|
260
|
+
txHash: options.legacyDryRunTxHash
|
|
261
|
+
? `dry-run:${calldata.slice(0, 20)}...`
|
|
262
|
+
: undefined,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
// Try sponsored tx when explicit config is provided (core never reads env —
|
|
266
|
+
// the CLI resolves POP_PRIVATE_KEY/POP_ORG_ID/… into options.sponsored).
|
|
267
|
+
// Thunks resolve here, inside the try, after the dry-run return above.
|
|
268
|
+
const sponsoredConfig = typeof options.sponsored === 'function'
|
|
269
|
+
? options.sponsored()
|
|
270
|
+
: options.sponsored;
|
|
271
|
+
if (sponsoredConfig) {
|
|
272
|
+
const sponsoredResult = await trySponsoredTx(contract, method, args, sponsoredConfig, options);
|
|
273
|
+
if (sponsoredResult) {
|
|
274
|
+
return sponsoredResult;
|
|
275
|
+
}
|
|
276
|
+
// Fall through to direct tx
|
|
277
|
+
}
|
|
278
|
+
// Send transaction (direct EOA)
|
|
279
|
+
const tx = await contract[method](...args, {
|
|
280
|
+
gasLimit: options.gasLimit || gasEstimate.mul(120).div(100),
|
|
281
|
+
value: options.value,
|
|
282
|
+
});
|
|
283
|
+
// Wait for confirmation
|
|
284
|
+
const receipt = await tx.wait(1);
|
|
285
|
+
const chainId = await contract.provider.getNetwork().then(n => n.chainId);
|
|
286
|
+
return {
|
|
287
|
+
success: true,
|
|
288
|
+
txHash: receipt.transactionHash,
|
|
289
|
+
blockNumber: receipt.blockNumber,
|
|
290
|
+
gasUsed: receipt.gasUsed.toString(),
|
|
291
|
+
explorerUrl: buildExplorerUrl(receipt.transactionHash, chainId),
|
|
292
|
+
logs: parseEventLogs(receipt, contract.interface),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
// Pass the contract interface so custom-error revert data is decoded into a
|
|
297
|
+
// human message + suggestion, and propagate every classified field so
|
|
298
|
+
// callers (e.g. the CLI's finishWrite) can surface the catalog name/hint
|
|
299
|
+
// (not just the raw message).
|
|
300
|
+
const classified = classifyError(error, contract.interface);
|
|
301
|
+
return {
|
|
302
|
+
success: false,
|
|
303
|
+
error: classified.message,
|
|
304
|
+
errorCode: classified.code,
|
|
305
|
+
errorName: classified.errorName,
|
|
306
|
+
errorArgs: classified.errorArgs,
|
|
307
|
+
suggestion: classified.suggestion,
|
|
308
|
+
rawMessage: classified.rawMessage,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Execute a TxIntent with an ethers signer.
|
|
314
|
+
* Thin adapter over executeContractTx: constructs the contract from the
|
|
315
|
+
* intent's resolved address + ABI, and merges the intent's native value into
|
|
316
|
+
* the tx options (an explicit options.value wins).
|
|
317
|
+
*/
|
|
318
|
+
async function executeIntent(signer, intent, options = {}) {
|
|
319
|
+
const contract = new ethers_1.ethers.Contract(intent.to, intent.abi, signer);
|
|
320
|
+
const value = options.value ??
|
|
321
|
+
(intent.value !== undefined ? ethers_1.ethers.BigNumber.from(intent.value) : undefined);
|
|
322
|
+
return executeContractTx(contract, intent.method, intent.args, { ...options, value });
|
|
323
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution layer — consumer-chosen transaction paths over TxIntent/contracts.
|
|
3
|
+
* - ethers.ts: direct EOA path (gas estimate, send, wait, log parsing, error classification)
|
|
4
|
+
* - sponsored.ts: EIP-7702 / ERC-4337 sponsored path via PaymasterHub + bundler
|
|
5
|
+
*/
|
|
6
|
+
export * from './ethers';
|
|
7
|
+
export * from './sponsored';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Execution layer — consumer-chosen transaction paths over TxIntent/contracts.
|
|
19
|
+
* - ethers.ts: direct EOA path (gas estimate, send, wait, log parsing, error classification)
|
|
20
|
+
* - sponsored.ts: EIP-7702 / ERC-4337 sponsored path via PaymasterHub + bundler
|
|
21
|
+
*/
|
|
22
|
+
__exportStar(require("./ethers"), exports);
|
|
23
|
+
__exportStar(require("./sponsored"), exports);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EIP-7702 Gas Sponsorship
|
|
3
|
+
*
|
|
4
|
+
* Uses the org PaymasterHub to sponsor agent transaction gas.
|
|
5
|
+
* Flow: Agent EOA → EIP-7702 delegation → UserOp via Pimlico bundler → PaymasterHub pays gas.
|
|
6
|
+
*
|
|
7
|
+
* Based on the poa-frontend EOA7702TransactionManager + userOpBuilder implementation.
|
|
8
|
+
*
|
|
9
|
+
* Prerequisites:
|
|
10
|
+
* - Agent registered in UniversalAccountRegistry
|
|
11
|
+
* - Agent wears a hat in the org
|
|
12
|
+
* - `pimlicoApiKey` or `bundlerUrl` provided via SponsoredSendOptions
|
|
13
|
+
* (the CLI passes PIMLICO_API_KEY / POP_BUNDLER_URL from env)
|
|
14
|
+
*/
|
|
15
|
+
import { type Hex, type Address, type Abi } from 'viem';
|
|
16
|
+
export declare const EOA_DELEGATION: Address;
|
|
17
|
+
export declare const PAYMASTER_HUB: Address;
|
|
18
|
+
export declare const ENTRY_POINT: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
19
|
+
/**
|
|
20
|
+
* Options for sendSponsored. Bundler routing is injected here — core never
|
|
21
|
+
* reads env. The CLI maps POP_BUNDLER_URL → bundlerUrl and
|
|
22
|
+
* PIMLICO_API_KEY → pimlicoApiKey.
|
|
23
|
+
*
|
|
24
|
+
* Canonical home is sponsorship-config (kept viem-free so the plain-EOA
|
|
25
|
+
* executor's TxOptions can reference it); re-exported here for back-compat.
|
|
26
|
+
*/
|
|
27
|
+
export type { SponsoredSendOptions } from '../sponsorship-config';
|
|
28
|
+
import type { SponsoredSendOptions } from '../sponsorship-config';
|
|
29
|
+
/**
|
|
30
|
+
* Encode paymaster data for the PaymasterHub.
|
|
31
|
+
* Format: version(1) | orgId(32) | subjectType=0x01(1) | hatId(32) | ruleId(4) | mailboxCommit(8)
|
|
32
|
+
* Total: 78 bytes (must match frontend encoding exactly)
|
|
33
|
+
*/
|
|
34
|
+
export declare function encodePaymasterData(orgId: Hex, hatId: bigint): Hex;
|
|
35
|
+
/**
|
|
36
|
+
* Check if an EOA has already delegated to EOADelegation.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isDelegated(address: Address, rpcUrl?: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Sign EIP-7702 authorization to delegate EOA to EOADelegation contract.
|
|
41
|
+
* This is a one-time setup — after delegation, the EOA can receive UserOps.
|
|
42
|
+
*/
|
|
43
|
+
export declare function delegateEOA(privateKey: Hex, rpcUrl?: string): Promise<Hex>;
|
|
44
|
+
/**
|
|
45
|
+
* Compute the UserOp hash per EIP-4337 v0.7 (PackedUserOperation) spec.
|
|
46
|
+
* Ported from poa-frontend userOpBuilder.js getUserOpHash().
|
|
47
|
+
*/
|
|
48
|
+
export declare function getUserOpHash(userOp: any, entryPoint: Address, chainId: number): Hex;
|
|
49
|
+
/**
|
|
50
|
+
* Send a sponsored transaction via Pimlico bundler.
|
|
51
|
+
* The PaymasterHub pays for gas — agent pays nothing.
|
|
52
|
+
*
|
|
53
|
+
* Follows the same flow as poa-frontend EOA7702TransactionManager:
|
|
54
|
+
* 1. Encode call in EOADelegation.execute() wrapper
|
|
55
|
+
* 2. Build UserOp with paymaster data and dummy signature
|
|
56
|
+
* 3. Estimate gas via bundler
|
|
57
|
+
* 4. Compute UserOp hash (EIP-4337 v0.7 packed format)
|
|
58
|
+
* 5. Sign with wallet (ECDSA via signMessage — EIP-191 prefix)
|
|
59
|
+
* 6. Submit to bundler and wait for receipt
|
|
60
|
+
*/
|
|
61
|
+
export declare function sendSponsored(privateKey: Hex, to: Address, data: Hex, orgId: Hex, hatId: bigint, options?: SponsoredSendOptions): Promise<{
|
|
62
|
+
txHash: Hex;
|
|
63
|
+
userOpHash: Hex;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Helper: encode a contract function call for use with sendSponsored.
|
|
67
|
+
*/
|
|
68
|
+
export declare function encodeCall(abi: Abi, functionName: string, args: any[]): Hex;
|