@baliola/smart-account-sdk 0.3.1
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/LICENSE +37 -0
- package/README.md +374 -0
- package/dist/abi-ziHt832n.js +1470 -0
- package/dist/accounts/index.d.ts +20 -0
- package/dist/accounts/index.js +2 -0
- package/dist/accounts-Bw0IrOJ1.js +229 -0
- package/dist/actions/index.d.ts +37 -0
- package/dist/actions/index.js +2 -0
- package/dist/auth/index.d.ts +35 -0
- package/dist/auth/index.js +2 -0
- package/dist/base-v7RyiDFz.js +104 -0
- package/dist/chains/index.d.ts +2 -0
- package/dist/chains/index.js +33 -0
- package/dist/classifyBundlerError-BqFLORNt.js +161 -0
- package/dist/clients/index.d.ts +86 -0
- package/dist/clients/index.js +3 -0
- package/dist/clients-B17dl_fh.js +134 -0
- package/dist/deployments-D4U_osAQ.js +10 -0
- package/dist/errors/index.d.ts +136 -0
- package/dist/errors/index.js +3 -0
- package/dist/index-BVqNo3O0.d.ts +222 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +12 -0
- package/dist/receipt-Ceeclfnv.d.ts +24 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -0
- package/dist/types-BcsdeCby.d.ts +25 -0
- package/dist/types-CD0TvpY4.d.ts +60 -0
- package/dist/validateApiKey-lUfEM5W0.js +68 -0
- package/dist/writeContract-AyQox2dQ.js +371 -0
- package/dist/writeContract-CdcmYmx0.d.ts +184 -0
- package/package.json +85 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { i as IUserOperation, n as ISmartAccount } from "../types-CD0TvpY4.js";
|
|
2
|
+
import { n as MacChainName } from "../index-BVqNo3O0.js";
|
|
3
|
+
import { C as CreateBundlerClientParams, S as BundlerClient, d as watchUserOperations, h as getUserOperationReceipt, p as waitForUserOperationReceipt, t as BoundWriteContract, w as createBundlerClient, y as estimateUserOperationGas } from "../writeContract-CdcmYmx0.js";
|
|
4
|
+
import { t as ApiKeyInfo } from "../types-BcsdeCby.js";
|
|
5
|
+
import { Address, Hex, PublicClient, Transport } from "viem";
|
|
6
|
+
|
|
7
|
+
//#region src/clients/bundlerUrls.d.ts
|
|
8
|
+
declare const DEFAULT_BUNDLER_URLS: Record<MacChainName, string>;
|
|
9
|
+
interface ResolveBundlerTransportParams {
|
|
10
|
+
chainName: MacChainName;
|
|
11
|
+
bundlerTransport?: Transport;
|
|
12
|
+
bundlerUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a bundler `Transport` from optional caller overrides. Precedence:
|
|
16
|
+
* explicit `bundlerTransport` > explicit `bundlerUrl` > default chain URL.
|
|
17
|
+
*/
|
|
18
|
+
declare function resolveBundlerTransport(p: ResolveBundlerTransportParams): Transport;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/clients/createSmartAccountClient.d.ts
|
|
21
|
+
interface CreateSmartAccountClientParams {
|
|
22
|
+
account: ISmartAccount;
|
|
23
|
+
chain: MacChainName;
|
|
24
|
+
/** Customer API key (`baliola_key_…` or `baliola_secret_…`). Required. */
|
|
25
|
+
apiKey: string;
|
|
26
|
+
/** baliola-auth base URL override. Defaults to the registered host for the chain. */
|
|
27
|
+
authUrl?: string;
|
|
28
|
+
/** Chain RPC transport. Defaults to `http()` against the chain's built-in RPC URL. */
|
|
29
|
+
transport?: Transport;
|
|
30
|
+
/** Full viem `Transport` for the bundler. */
|
|
31
|
+
bundlerTransport?: Transport;
|
|
32
|
+
/** Bundler URL override. */
|
|
33
|
+
bundlerUrl?: string;
|
|
34
|
+
/** Paymaster address override. Defaults to the chain's registered Gas Allowance Pool. */
|
|
35
|
+
paymasterAddress?: Address;
|
|
36
|
+
}
|
|
37
|
+
type SdkActions = {
|
|
38
|
+
account: ISmartAccount;
|
|
39
|
+
apiKey: ApiKeyInfo;
|
|
40
|
+
writeContract: BoundWriteContract;
|
|
41
|
+
estimateUserOperationGas: (params: Parameters<typeof estimateUserOperationGas>[1]) => ReturnType<typeof estimateUserOperationGas>;
|
|
42
|
+
getUserOperationReceipt: (params: Parameters<typeof getUserOperationReceipt>[1]) => ReturnType<typeof getUserOperationReceipt>;
|
|
43
|
+
waitForUserOperationReceipt: (params: Parameters<typeof waitForUserOperationReceipt>[1]) => ReturnType<typeof waitForUserOperationReceipt>;
|
|
44
|
+
watchUserOperations: (params: Parameters<typeof watchUserOperations>[1]) => ReturnType<typeof watchUserOperations>;
|
|
45
|
+
};
|
|
46
|
+
type PublicClientBase = Omit<PublicClient, "sendTransaction" | "account">;
|
|
47
|
+
type SmartAccountClient = PublicClientBase & SdkActions;
|
|
48
|
+
/**
|
|
49
|
+
* Compose a Smart Account client from an account, a chain string, and an
|
|
50
|
+
* API key. Eagerly validates the key against baliola-auth before returning —
|
|
51
|
+
* fail-fast on revoked / expired / quota-exhausted keys via
|
|
52
|
+
* `ApiKeyInvalidError`, or `BaliolaAuthUnreachableError` if the auth service
|
|
53
|
+
* itself can't be reached.
|
|
54
|
+
*
|
|
55
|
+
* Zero-config: pass only `account` + `chain` + `apiKey` and the SDK resolves
|
|
56
|
+
* the chain RPC, the bundler URL, the auth URL, and the paymaster automatically.
|
|
57
|
+
*/
|
|
58
|
+
declare function createSmartAccountClient(params: CreateSmartAccountClientParams): Promise<SmartAccountClient>;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/clients/rpcCodec.d.ts
|
|
61
|
+
/**
|
|
62
|
+
* JSON-RPC wire shape for ERC-4337 v0.7 `eth_sendUserOperation`.
|
|
63
|
+
* Bigints are hex-encoded; optional fields are omitted when absent,
|
|
64
|
+
* except the paymaster trio, which must travel together once paymaster is set.
|
|
65
|
+
*/
|
|
66
|
+
interface RpcUserOperation {
|
|
67
|
+
sender: Hex;
|
|
68
|
+
nonce: Hex;
|
|
69
|
+
factory?: Hex;
|
|
70
|
+
factoryData?: Hex;
|
|
71
|
+
callData: Hex;
|
|
72
|
+
callGasLimit: Hex;
|
|
73
|
+
verificationGasLimit: Hex;
|
|
74
|
+
preVerificationGas: Hex;
|
|
75
|
+
maxFeePerGas: Hex;
|
|
76
|
+
maxPriorityFeePerGas: Hex;
|
|
77
|
+
paymaster?: Hex;
|
|
78
|
+
paymasterVerificationGasLimit?: Hex;
|
|
79
|
+
paymasterPostOpGasLimit?: Hex;
|
|
80
|
+
paymasterData?: Hex;
|
|
81
|
+
signature: Hex;
|
|
82
|
+
}
|
|
83
|
+
declare function toRpcUserOp(op: IUserOperation): RpcUserOperation;
|
|
84
|
+
declare function fromRpcUserOp(rpc: RpcUserOperation): IUserOperation;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { BundlerClient, CreateBundlerClientParams, CreateSmartAccountClientParams, DEFAULT_BUNDLER_URLS, ResolveBundlerTransportParams, RpcUserOperation, SmartAccountClient, createBundlerClient, createSmartAccountClient, fromRpcUserOp, resolveBundlerTransport, toRpcUserOp };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { l as fromRpcUserOp, u as toRpcUserOp } from "../writeContract-AyQox2dQ.js";
|
|
2
|
+
import { i as resolveBundlerTransport, n as createBundlerClient, r as DEFAULT_BUNDLER_URLS, t as createSmartAccountClient } from "../clients-B17dl_fh.js";
|
|
3
|
+
export { DEFAULT_BUNDLER_URLS, createBundlerClient, createSmartAccountClient, fromRpcUserOp, resolveBundlerTransport, toRpcUserOp };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { t as deployments } from "./deployments-D4U_osAQ.js";
|
|
2
|
+
import { resolveChain } from "./chains/index.js";
|
|
3
|
+
import { a as getUserOperationReceipt, c as estimateUserOperationGas, i as waitForUserOperationReceipt, r as watchUserOperations, t as bindWriteContract } from "./writeContract-AyQox2dQ.js";
|
|
4
|
+
import { r as PaymasterConfigError } from "./base-v7RyiDFz.js";
|
|
5
|
+
import { r as resolveAuthUrl, t as validateApiKey } from "./validateApiKey-lUfEM5W0.js";
|
|
6
|
+
import { t as classifyBundlerError } from "./classifyBundlerError-BqFLORNt.js";
|
|
7
|
+
import { createPublicClient, http, isAddress } from "viem";
|
|
8
|
+
//#region src/clients/bundlerUrls.ts
|
|
9
|
+
const DEFAULT_BUNDLER_URLS = {
|
|
10
|
+
macTestnet: "https://bundler-testnet.baliola.dev/rpc",
|
|
11
|
+
macMainnet: "https://bundler-mainnet.baliola.io/rpc"
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a bundler `Transport` from optional caller overrides. Precedence:
|
|
15
|
+
* explicit `bundlerTransport` > explicit `bundlerUrl` > default chain URL.
|
|
16
|
+
*/
|
|
17
|
+
function resolveBundlerTransport(p) {
|
|
18
|
+
if (p.bundlerTransport) return p.bundlerTransport;
|
|
19
|
+
return http(p.bundlerUrl ?? DEFAULT_BUNDLER_URLS[p.chainName]);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/clients/createBundlerClient.ts
|
|
23
|
+
/**
|
|
24
|
+
* Thin JSON-RPC wrapper over a viem `Transport`. Speaks the ERC-4337 v0.7
|
|
25
|
+
* bundler methods without pulling in the rest of viem's client surface,
|
|
26
|
+
* because the bundler endpoint is a different service than the chain RPC.
|
|
27
|
+
*
|
|
28
|
+
* Every error thrown out of `request` is first classified into a typed
|
|
29
|
+
* SDK error (`InvalidUserOperationError`, `UserOperationRejectedError`,
|
|
30
|
+
* `BundlerUnreachableError`, or one of the `UserOperationRevertError`
|
|
31
|
+
* subclasses for AA-code reverts). Callers never see a raw viem error.
|
|
32
|
+
*/
|
|
33
|
+
function createBundlerClient({ transport, chain }) {
|
|
34
|
+
const bound = transport({
|
|
35
|
+
chain,
|
|
36
|
+
retryCount: 0
|
|
37
|
+
});
|
|
38
|
+
return { async request(method, params) {
|
|
39
|
+
try {
|
|
40
|
+
return await bound.request({
|
|
41
|
+
method,
|
|
42
|
+
params
|
|
43
|
+
});
|
|
44
|
+
} catch (err) {
|
|
45
|
+
throw classifyBundlerError(err);
|
|
46
|
+
}
|
|
47
|
+
} };
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/paymaster/resolvePaymaster.ts
|
|
51
|
+
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
52
|
+
/**
|
|
53
|
+
* Look up the GAP address for a chain via the `aliases.gasAllowancePool`
|
|
54
|
+
* layer emitted by `shared/scripts/codegen-addresses.ts`. Returns `null`
|
|
55
|
+
* when the chain has no alias.
|
|
56
|
+
*/
|
|
57
|
+
function lookupGasAllowancePool(chainId) {
|
|
58
|
+
const chainDeployments = deployments[chainId];
|
|
59
|
+
if (!chainDeployments) return null;
|
|
60
|
+
return chainDeployments.aliases?.gasAllowancePool ?? null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Build a `PaymasterResolver` from an optional override.
|
|
64
|
+
*
|
|
65
|
+
* - `paymasterAddress` omitted → uses the chain's registered Gas Allowance Pool.
|
|
66
|
+
* - `paymasterAddress` provided → validates checksum + non-zero, uses it verbatim.
|
|
67
|
+
* - Neither override nor a registered GAP → throws `PaymasterConfigError` at construction.
|
|
68
|
+
*
|
|
69
|
+
* SDK always uses a paymaster. Self-funded mode is not supported on the public API.
|
|
70
|
+
*/
|
|
71
|
+
function resolvePaymaster(paymasterAddress, chainId) {
|
|
72
|
+
if (paymasterAddress !== void 0) {
|
|
73
|
+
if (!isAddress(paymasterAddress)) throw new PaymasterConfigError("invalid_address", `paymasterAddress is not a valid address: ${paymasterAddress}`);
|
|
74
|
+
if (paymasterAddress.toLowerCase() === ZERO_ADDRESS) throw new PaymasterConfigError("zero_address", "paymasterAddress cannot be the zero address");
|
|
75
|
+
}
|
|
76
|
+
const address = paymasterAddress ?? lookupGasAllowancePool(chainId);
|
|
77
|
+
if (!address) throw new PaymasterConfigError("no_registered_paymaster", `No paymaster address registered for chain id ${chainId}`);
|
|
78
|
+
return async () => ({
|
|
79
|
+
paymaster: address,
|
|
80
|
+
paymasterData: "0x"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/clients/createSmartAccountClient.ts
|
|
85
|
+
function bindActions(ctx) {
|
|
86
|
+
return {
|
|
87
|
+
writeContract: bindWriteContract(ctx),
|
|
88
|
+
estimateUserOperationGas: (p) => estimateUserOperationGas(ctx, p),
|
|
89
|
+
getUserOperationReceipt: (p) => getUserOperationReceipt(ctx, p),
|
|
90
|
+
waitForUserOperationReceipt: (p) => waitForUserOperationReceipt(ctx, p),
|
|
91
|
+
watchUserOperations: (p) => watchUserOperations(ctx, p)
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Compose a Smart Account client from an account, a chain string, and an
|
|
96
|
+
* API key. Eagerly validates the key against baliola-auth before returning —
|
|
97
|
+
* fail-fast on revoked / expired / quota-exhausted keys via
|
|
98
|
+
* `ApiKeyInvalidError`, or `BaliolaAuthUnreachableError` if the auth service
|
|
99
|
+
* itself can't be reached.
|
|
100
|
+
*
|
|
101
|
+
* Zero-config: pass only `account` + `chain` + `apiKey` and the SDK resolves
|
|
102
|
+
* the chain RPC, the bundler URL, the auth URL, and the paymaster automatically.
|
|
103
|
+
*/
|
|
104
|
+
async function createSmartAccountClient(params) {
|
|
105
|
+
const chain = resolveChain(params.chain);
|
|
106
|
+
const paymaster = resolvePaymaster(params.paymasterAddress, chain.id);
|
|
107
|
+
const apiKey = await validateApiKey({
|
|
108
|
+
authUrl: resolveAuthUrl(params.chain, params.authUrl),
|
|
109
|
+
apiKey: params.apiKey
|
|
110
|
+
});
|
|
111
|
+
const publicClient = createPublicClient({
|
|
112
|
+
chain,
|
|
113
|
+
transport: params.transport ?? http()
|
|
114
|
+
});
|
|
115
|
+
const bundler = createBundlerClient({ transport: resolveBundlerTransport({
|
|
116
|
+
chainName: params.chain,
|
|
117
|
+
bundlerTransport: params.bundlerTransport,
|
|
118
|
+
bundlerUrl: params.bundlerUrl
|
|
119
|
+
}) });
|
|
120
|
+
const ctx = {
|
|
121
|
+
account: params.account,
|
|
122
|
+
publicClient,
|
|
123
|
+
bundler,
|
|
124
|
+
entryPoint: params.account.entryPoint,
|
|
125
|
+
paymaster
|
|
126
|
+
};
|
|
127
|
+
return Object.assign(publicClient, {
|
|
128
|
+
account: params.account,
|
|
129
|
+
apiKey,
|
|
130
|
+
...bindActions(ctx)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { resolveBundlerTransport as i, createBundlerClient as n, DEFAULT_BUNDLER_URLS as r, createSmartAccountClient as t };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region ../shared/src/contracts/deployments.ts
|
|
2
|
+
const deployments = { 20017: {
|
|
3
|
+
"01-EntryPoint": { EntryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032" },
|
|
4
|
+
"02-AccountFactory": { SimpleAccountFactory: "0x76A91436B13Cd7CcE2692B304a880b5DaE5C01D2" },
|
|
5
|
+
"03-Paymaster": { TestPaymasterAcceptAll: "0xC52d9d729377b74cB5baD5df83D26CC9b0Bd10dB" },
|
|
6
|
+
"04-Counter": { TestCounter: "0xF8a4300Bd6400ED8BA1023569BaACD3559A93243" },
|
|
7
|
+
aliases: { gasAllowancePool: "0xC52d9d729377b74cB5baD5df83D26CC9b0Bd10dB" }
|
|
8
|
+
} };
|
|
9
|
+
//#endregion
|
|
10
|
+
export { deployments as t };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { n as ApiKeyInvalidReason } from "../types-BcsdeCby.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/base.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Root class for every error thrown from inside the SDK.
|
|
6
|
+
*
|
|
7
|
+
* **Opinionated message convention**: `err.message` is always written for an
|
|
8
|
+
* end user — short, polite, and safe to surface directly in product UI. The
|
|
9
|
+
* machine-readable discriminators live on:
|
|
10
|
+
* - `err.code` — internal tag or AA-code string
|
|
11
|
+
* - `err.reason` — typed enum on errors that have one
|
|
12
|
+
* - `err.detail` — optional technical sentence for developer logs
|
|
13
|
+
* - `err.cause` — the underlying transport / library error
|
|
14
|
+
*
|
|
15
|
+
* Translate or rebrand `err.message` only when you need a different tone or
|
|
16
|
+
* locale; you can always rebuild your own copy from `err.code` / `err.reason`.
|
|
17
|
+
*/
|
|
18
|
+
declare class SmartAccountSDKError extends Error {
|
|
19
|
+
readonly code: string;
|
|
20
|
+
readonly detail?: string;
|
|
21
|
+
readonly userOp?: unknown;
|
|
22
|
+
readonly cause?: unknown;
|
|
23
|
+
constructor(message: string, options: {
|
|
24
|
+
code: string;
|
|
25
|
+
detail?: string;
|
|
26
|
+
userOp?: unknown;
|
|
27
|
+
cause?: unknown;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
declare class UserOperationReceiptTimeoutError extends SmartAccountSDKError {
|
|
31
|
+
readonly userOpHash: string;
|
|
32
|
+
readonly timeoutMs: number;
|
|
33
|
+
constructor(userOpHash: string, timeoutMs: number);
|
|
34
|
+
}
|
|
35
|
+
type PaymasterConfigReason = "invalid_address" | "zero_address" | "no_registered_paymaster";
|
|
36
|
+
/**
|
|
37
|
+
* Thrown at SDK construction when the paymaster configuration is unusable.
|
|
38
|
+
* The user-facing message is generic; `reason` + `detail` carry the dev info.
|
|
39
|
+
*/
|
|
40
|
+
declare class PaymasterConfigError extends SmartAccountSDKError {
|
|
41
|
+
readonly reason: PaymasterConfigReason;
|
|
42
|
+
constructor(reason: PaymasterConfigReason, detail?: string);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Thrown by `createSmartAccountClient` when baliola-auth rejects the API key.
|
|
46
|
+
* `reason` is the strict enum string; `message` is the matching user copy.
|
|
47
|
+
*/
|
|
48
|
+
declare class ApiKeyInvalidError extends SmartAccountSDKError {
|
|
49
|
+
readonly reason: ApiKeyInvalidReason;
|
|
50
|
+
readonly retryAfterSeconds?: number;
|
|
51
|
+
constructor(reason: ApiKeyInvalidReason, retryAfterSeconds?: number);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Thrown when baliola-auth is unreachable — fetch rejection, 5xx, or
|
|
55
|
+
* unparseable body. Distinct from `ApiKeyInvalidError`, which covers
|
|
56
|
+
* structured rejections.
|
|
57
|
+
*/
|
|
58
|
+
declare class BaliolaAuthUnreachableError extends SmartAccountSDKError {
|
|
59
|
+
readonly url: string;
|
|
60
|
+
constructor(url: string, cause: unknown);
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/errors/aaError.d.ts
|
|
64
|
+
interface RevertErrorOptions {
|
|
65
|
+
code: string;
|
|
66
|
+
detail?: string;
|
|
67
|
+
userOp?: unknown;
|
|
68
|
+
cause?: unknown;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Base class for errors produced when the EntryPoint or one of its
|
|
72
|
+
* validation partners rejects a UserOperation. The `code` is the AA-code
|
|
73
|
+
* string from the bundler (e.g. "AA24"); subclasses narrow by bucket.
|
|
74
|
+
*/
|
|
75
|
+
declare class UserOperationRevertError extends SmartAccountSDKError {
|
|
76
|
+
constructor(message: string, options: RevertErrorOptions);
|
|
77
|
+
}
|
|
78
|
+
/** AA1x — Smart Account factory / `initCode` deployment failures. */
|
|
79
|
+
declare class AccountFactoryError extends UserOperationRevertError {}
|
|
80
|
+
/** AA2x — account's `validateUserOp` rejection (prefund, signature, nonce). */
|
|
81
|
+
declare class AccountValidationError extends UserOperationRevertError {}
|
|
82
|
+
/** AA3x — Gas Allowance Pool's `validatePaymasterUserOp` rejection. */
|
|
83
|
+
declare class PaymasterValidationError extends UserOperationRevertError {}
|
|
84
|
+
/** AA9x — EntryPoint bundle-frame invariants. Rarely reached by app code. */
|
|
85
|
+
declare class BundleFrameError extends UserOperationRevertError {}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/errors/bundlerError.d.ts
|
|
88
|
+
interface BundlerErrorOptions {
|
|
89
|
+
code: string;
|
|
90
|
+
detail?: string;
|
|
91
|
+
userOp?: unknown;
|
|
92
|
+
cause?: unknown;
|
|
93
|
+
}
|
|
94
|
+
/** Base class for every error originating from the bundler's JSON-RPC surface. */
|
|
95
|
+
declare class BundlerRpcError extends SmartAccountSDKError {
|
|
96
|
+
constructor(message: string, options: BundlerErrorOptions);
|
|
97
|
+
}
|
|
98
|
+
/** `-32602` — bundler rejected the params (invalid UserOp shape, fee too low, etc.). */
|
|
99
|
+
declare class InvalidUserOperationError extends BundlerRpcError {}
|
|
100
|
+
/** `-32500` and kin — bundler accepted the shape but dropped the op on submit. */
|
|
101
|
+
declare class UserOperationRejectedError extends BundlerRpcError {}
|
|
102
|
+
/** Network or transport failure reaching the bundler — not an on-chain rejection. */
|
|
103
|
+
declare class BundlerUnreachableError extends BundlerRpcError {}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/errors/classifyBundlerError.d.ts
|
|
106
|
+
/**
|
|
107
|
+
* Classify a raw error from the bundler transport into a typed SDK error.
|
|
108
|
+
*
|
|
109
|
+
* - JSON-RPC `-32602` (invalid params) → `InvalidUserOperationError`
|
|
110
|
+
* - JSON-RPC `-32500` (op rejected) → `UserOperationRejectedError`
|
|
111
|
+
* - AA-code revert messages → corresponding `UserOperationRevertError` subclass
|
|
112
|
+
* - Network failures (fetch error, timeout) → `BundlerUnreachableError`
|
|
113
|
+
* - Anything else → `BundlerRpcError` base
|
|
114
|
+
*
|
|
115
|
+
* Returned errors carry an end-user-displayable `.message`; the original
|
|
116
|
+
* technical message stays on `.cause.message`, and the typed `code` /
|
|
117
|
+
* AA code is on `.code`.
|
|
118
|
+
*/
|
|
119
|
+
declare function classifyBundlerError(err: unknown, userOp?: unknown): Error;
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/errors/mapAaCode.d.ts
|
|
122
|
+
interface AaCodeMatch {
|
|
123
|
+
/** The matched AA code (e.g. "AA24"). */
|
|
124
|
+
code: string;
|
|
125
|
+
/** The error subclass for the code's bucket, or the base for unknown codes. */
|
|
126
|
+
ctor: typeof UserOperationRevertError;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Classify a bundler revert message by its AA code. Returns both the
|
|
130
|
+
* matched code string and the concrete subclass constructor, or `null`
|
|
131
|
+
* when the message has no AA code at all. Callers instantiate `ctor`
|
|
132
|
+
* with their own message/context and set `err.code = code`.
|
|
133
|
+
*/
|
|
134
|
+
declare function mapAaCode(message: string): AaCodeMatch | null;
|
|
135
|
+
//#endregion
|
|
136
|
+
export { AaCodeMatch, AccountFactoryError, AccountValidationError, ApiKeyInvalidError, BaliolaAuthUnreachableError, BundleFrameError, BundlerErrorOptions, BundlerRpcError, BundlerUnreachableError, InvalidUserOperationError, PaymasterConfigError, PaymasterConfigReason, PaymasterValidationError, RevertErrorOptions, SmartAccountSDKError, UserOperationReceiptTimeoutError, UserOperationRejectedError, UserOperationRevertError, classifyBundlerError, mapAaCode };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as UserOperationReceiptTimeoutError, i as SmartAccountSDKError, n as BaliolaAuthUnreachableError, r as PaymasterConfigError, t as ApiKeyInvalidError } from "../base-v7RyiDFz.js";
|
|
2
|
+
import { a as BundleFrameError, c as BundlerRpcError, d as UserOperationRejectedError, i as AccountValidationError, l as BundlerUnreachableError, n as mapAaCode, o as PaymasterValidationError, r as AccountFactoryError, s as UserOperationRevertError, t as classifyBundlerError, u as InvalidUserOperationError } from "../classifyBundlerError-BqFLORNt.js";
|
|
3
|
+
export { AccountFactoryError, AccountValidationError, ApiKeyInvalidError, BaliolaAuthUnreachableError, BundleFrameError, BundlerRpcError, BundlerUnreachableError, InvalidUserOperationError, PaymasterConfigError, PaymasterValidationError, SmartAccountSDKError, UserOperationReceiptTimeoutError, UserOperationRejectedError, UserOperationRevertError, classifyBundlerError, mapAaCode };
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import * as _$viem from "viem";
|
|
2
|
+
import { Chain } from "viem";
|
|
3
|
+
|
|
4
|
+
//#region src/chains/index.d.ts
|
|
5
|
+
declare const macTestnet: {
|
|
6
|
+
blockExplorers?: {
|
|
7
|
+
[key: string]: {
|
|
8
|
+
name: string;
|
|
9
|
+
url: string;
|
|
10
|
+
apiUrl?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
default: {
|
|
13
|
+
name: string;
|
|
14
|
+
url: string;
|
|
15
|
+
apiUrl?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
} | undefined | undefined;
|
|
18
|
+
blockTime?: number | undefined | undefined;
|
|
19
|
+
contracts?: {
|
|
20
|
+
[x: string]: _$viem.ChainContract | {
|
|
21
|
+
[sourceId: number]: _$viem.ChainContract | undefined;
|
|
22
|
+
} | undefined;
|
|
23
|
+
ensRegistry?: _$viem.ChainContract | undefined;
|
|
24
|
+
ensUniversalResolver?: _$viem.ChainContract | undefined;
|
|
25
|
+
multicall3?: _$viem.ChainContract | undefined;
|
|
26
|
+
erc6492Verifier?: _$viem.ChainContract | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
ensTlds?: readonly string[] | undefined;
|
|
29
|
+
id: 20017;
|
|
30
|
+
name: "MAC Testnet";
|
|
31
|
+
nativeCurrency: {
|
|
32
|
+
readonly name: "Kepeng Testnet";
|
|
33
|
+
readonly symbol: "KPGBT";
|
|
34
|
+
readonly decimals: 18;
|
|
35
|
+
};
|
|
36
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
37
|
+
rpcUrls: {
|
|
38
|
+
readonly default: {
|
|
39
|
+
readonly http: readonly ["https://collator1.baliola.dev"];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
sourceId?: number | undefined | undefined;
|
|
43
|
+
testnet: true;
|
|
44
|
+
custom?: Record<string, unknown> | undefined;
|
|
45
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
46
|
+
fees?: _$viem.ChainFees<undefined> | undefined;
|
|
47
|
+
formatters?: undefined;
|
|
48
|
+
prepareTransactionRequest?: ((args: _$viem.PrepareTransactionRequestParameters, options: {
|
|
49
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
50
|
+
}) => Promise<_$viem.PrepareTransactionRequestParameters>) | [fn: ((args: _$viem.PrepareTransactionRequestParameters, options: {
|
|
51
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
52
|
+
}) => Promise<_$viem.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
53
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
54
|
+
}] | undefined;
|
|
55
|
+
serializers?: _$viem.ChainSerializers<undefined, _$viem.TransactionSerializable> | undefined;
|
|
56
|
+
verifyHash?: ((client: _$viem.Client, parameters: _$viem.VerifyHashActionParameters) => Promise<_$viem.VerifyHashActionReturnType>) | undefined;
|
|
57
|
+
};
|
|
58
|
+
declare const macMainnet: {
|
|
59
|
+
blockExplorers?: {
|
|
60
|
+
[key: string]: {
|
|
61
|
+
name: string;
|
|
62
|
+
url: string;
|
|
63
|
+
apiUrl?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
default: {
|
|
66
|
+
name: string;
|
|
67
|
+
url: string;
|
|
68
|
+
apiUrl?: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
} | undefined | undefined;
|
|
71
|
+
blockTime?: number | undefined | undefined;
|
|
72
|
+
contracts?: {
|
|
73
|
+
[x: string]: _$viem.ChainContract | {
|
|
74
|
+
[sourceId: number]: _$viem.ChainContract | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
ensRegistry?: _$viem.ChainContract | undefined;
|
|
77
|
+
ensUniversalResolver?: _$viem.ChainContract | undefined;
|
|
78
|
+
multicall3?: _$viem.ChainContract | undefined;
|
|
79
|
+
erc6492Verifier?: _$viem.ChainContract | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
ensTlds?: readonly string[] | undefined;
|
|
82
|
+
id: 20016;
|
|
83
|
+
name: "MAC";
|
|
84
|
+
nativeCurrency: {
|
|
85
|
+
readonly name: "Kepeng";
|
|
86
|
+
readonly symbol: "KPGB";
|
|
87
|
+
readonly decimals: 18;
|
|
88
|
+
};
|
|
89
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
90
|
+
rpcUrls: {
|
|
91
|
+
readonly default: {
|
|
92
|
+
readonly http: readonly ["https://collator4-mac.baliola.io"];
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
sourceId?: number | undefined | undefined;
|
|
96
|
+
testnet: false;
|
|
97
|
+
custom?: Record<string, unknown> | undefined;
|
|
98
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
99
|
+
fees?: _$viem.ChainFees<undefined> | undefined;
|
|
100
|
+
formatters?: undefined;
|
|
101
|
+
prepareTransactionRequest?: ((args: _$viem.PrepareTransactionRequestParameters, options: {
|
|
102
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
103
|
+
}) => Promise<_$viem.PrepareTransactionRequestParameters>) | [fn: ((args: _$viem.PrepareTransactionRequestParameters, options: {
|
|
104
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
105
|
+
}) => Promise<_$viem.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
106
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
107
|
+
}] | undefined;
|
|
108
|
+
serializers?: _$viem.ChainSerializers<undefined, _$viem.TransactionSerializable> | undefined;
|
|
109
|
+
verifyHash?: ((client: _$viem.Client, parameters: _$viem.VerifyHashActionParameters) => Promise<_$viem.VerifyHashActionReturnType>) | undefined;
|
|
110
|
+
};
|
|
111
|
+
type MacChainName = "macTestnet" | "macMainnet";
|
|
112
|
+
declare const MAC_CHAINS: {
|
|
113
|
+
readonly macTestnet: {
|
|
114
|
+
blockExplorers?: {
|
|
115
|
+
[key: string]: {
|
|
116
|
+
name: string;
|
|
117
|
+
url: string;
|
|
118
|
+
apiUrl?: string | undefined;
|
|
119
|
+
};
|
|
120
|
+
default: {
|
|
121
|
+
name: string;
|
|
122
|
+
url: string;
|
|
123
|
+
apiUrl?: string | undefined;
|
|
124
|
+
};
|
|
125
|
+
} | undefined | undefined;
|
|
126
|
+
blockTime?: number | undefined | undefined;
|
|
127
|
+
contracts?: {
|
|
128
|
+
[x: string]: _$viem.ChainContract | {
|
|
129
|
+
[sourceId: number]: _$viem.ChainContract | undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
ensRegistry?: _$viem.ChainContract | undefined;
|
|
132
|
+
ensUniversalResolver?: _$viem.ChainContract | undefined;
|
|
133
|
+
multicall3?: _$viem.ChainContract | undefined;
|
|
134
|
+
erc6492Verifier?: _$viem.ChainContract | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
ensTlds?: readonly string[] | undefined;
|
|
137
|
+
id: 20017;
|
|
138
|
+
name: "MAC Testnet";
|
|
139
|
+
nativeCurrency: {
|
|
140
|
+
readonly name: "Kepeng Testnet";
|
|
141
|
+
readonly symbol: "KPGBT";
|
|
142
|
+
readonly decimals: 18;
|
|
143
|
+
};
|
|
144
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
145
|
+
rpcUrls: {
|
|
146
|
+
readonly default: {
|
|
147
|
+
readonly http: readonly ["https://collator1.baliola.dev"];
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
sourceId?: number | undefined | undefined;
|
|
151
|
+
testnet: true;
|
|
152
|
+
custom?: Record<string, unknown> | undefined;
|
|
153
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
154
|
+
fees?: _$viem.ChainFees<undefined> | undefined;
|
|
155
|
+
formatters?: undefined;
|
|
156
|
+
prepareTransactionRequest?: ((args: _$viem.PrepareTransactionRequestParameters, options: {
|
|
157
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
158
|
+
}) => Promise<_$viem.PrepareTransactionRequestParameters>) | [fn: ((args: _$viem.PrepareTransactionRequestParameters, options: {
|
|
159
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
160
|
+
}) => Promise<_$viem.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
161
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
162
|
+
}] | undefined;
|
|
163
|
+
serializers?: _$viem.ChainSerializers<undefined, _$viem.TransactionSerializable> | undefined;
|
|
164
|
+
verifyHash?: ((client: _$viem.Client, parameters: _$viem.VerifyHashActionParameters) => Promise<_$viem.VerifyHashActionReturnType>) | undefined;
|
|
165
|
+
};
|
|
166
|
+
readonly macMainnet: {
|
|
167
|
+
blockExplorers?: {
|
|
168
|
+
[key: string]: {
|
|
169
|
+
name: string;
|
|
170
|
+
url: string;
|
|
171
|
+
apiUrl?: string | undefined;
|
|
172
|
+
};
|
|
173
|
+
default: {
|
|
174
|
+
name: string;
|
|
175
|
+
url: string;
|
|
176
|
+
apiUrl?: string | undefined;
|
|
177
|
+
};
|
|
178
|
+
} | undefined | undefined;
|
|
179
|
+
blockTime?: number | undefined | undefined;
|
|
180
|
+
contracts?: {
|
|
181
|
+
[x: string]: _$viem.ChainContract | {
|
|
182
|
+
[sourceId: number]: _$viem.ChainContract | undefined;
|
|
183
|
+
} | undefined;
|
|
184
|
+
ensRegistry?: _$viem.ChainContract | undefined;
|
|
185
|
+
ensUniversalResolver?: _$viem.ChainContract | undefined;
|
|
186
|
+
multicall3?: _$viem.ChainContract | undefined;
|
|
187
|
+
erc6492Verifier?: _$viem.ChainContract | undefined;
|
|
188
|
+
} | undefined;
|
|
189
|
+
ensTlds?: readonly string[] | undefined;
|
|
190
|
+
id: 20016;
|
|
191
|
+
name: "MAC";
|
|
192
|
+
nativeCurrency: {
|
|
193
|
+
readonly name: "Kepeng";
|
|
194
|
+
readonly symbol: "KPGB";
|
|
195
|
+
readonly decimals: 18;
|
|
196
|
+
};
|
|
197
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
198
|
+
rpcUrls: {
|
|
199
|
+
readonly default: {
|
|
200
|
+
readonly http: readonly ["https://collator4-mac.baliola.io"];
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
sourceId?: number | undefined | undefined;
|
|
204
|
+
testnet: false;
|
|
205
|
+
custom?: Record<string, unknown> | undefined;
|
|
206
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
207
|
+
fees?: _$viem.ChainFees<undefined> | undefined;
|
|
208
|
+
formatters?: undefined;
|
|
209
|
+
prepareTransactionRequest?: ((args: _$viem.PrepareTransactionRequestParameters, options: {
|
|
210
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
211
|
+
}) => Promise<_$viem.PrepareTransactionRequestParameters>) | [fn: ((args: _$viem.PrepareTransactionRequestParameters, options: {
|
|
212
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
213
|
+
}) => Promise<_$viem.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
214
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
215
|
+
}] | undefined;
|
|
216
|
+
serializers?: _$viem.ChainSerializers<undefined, _$viem.TransactionSerializable> | undefined;
|
|
217
|
+
verifyHash?: ((client: _$viem.Client, parameters: _$viem.VerifyHashActionParameters) => Promise<_$viem.VerifyHashActionReturnType>) | undefined;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
declare function resolveChain(name: MacChainName): Chain;
|
|
221
|
+
//#endregion
|
|
222
|
+
export { resolveChain as a, macTestnet as i, MacChainName as n, macMainnet as r, MAC_CHAINS as t };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { n as ISmartAccount, r as SigningAccount, t as Call } from "./types-CD0TvpY4.js";
|
|
2
|
+
import { a as resolveChain, i as macTestnet, n as MacChainName, r as macMainnet, t as MAC_CHAINS } from "./index-BVqNo3O0.js";
|
|
3
|
+
import { ToSmartAccountParams, encodeCalls, toSmartAccount } from "./accounts/index.js";
|
|
4
|
+
import { C as CreateBundlerClientParams, S as BundlerClient, _ as EstimateUserOperationGasParams, a as WriteContractOverrides, b as SmartAccountActionContext, c as UnwatchFn, d as watchUserOperations, f as WaitForUserOperationReceiptParams, g as sliceUserOpLogs, h as getUserOperationReceipt, i as WriteContractInput, l as UserOperationEventMatch, m as GetUserOperationReceiptParams, n as RawCall, o as bindWriteContract, p as waitForUserOperationReceipt, r as TypedCall, s as writeContract, t as BoundWriteContract, u as WatchUserOperationsParams, v as estimateUserOpGasRaw, w as createBundlerClient, x as UserOperationGasEstimate, y as estimateUserOperationGas } from "./writeContract-CdcmYmx0.js";
|
|
5
|
+
import { t as UserOperationReceipt } from "./receipt-Ceeclfnv.js";
|
|
6
|
+
import { DRAFT_GAS_ANCHORS, DUMMY_SIGNATURE, buildDraftUserOp } from "./actions/index.js";
|
|
7
|
+
import { n as ApiKeyInvalidReason, r as ApiKeyQuota, t as ApiKeyInfo } from "./types-BcsdeCby.js";
|
|
8
|
+
import { DEFAULT_AUTH_URLS, ValidateApiKeyParams, resolveAuthUrl, validateApiKey } from "./auth/index.js";
|
|
9
|
+
import { CreateSmartAccountClientParams, DEFAULT_BUNDLER_URLS, ResolveBundlerTransportParams, RpcUserOperation, SmartAccountClient, createSmartAccountClient, fromRpcUserOp, resolveBundlerTransport, toRpcUserOp } from "./clients/index.js";
|
|
10
|
+
import { AaCodeMatch, AccountFactoryError, AccountValidationError, ApiKeyInvalidError, BaliolaAuthUnreachableError, BundleFrameError, BundlerErrorOptions, BundlerRpcError, BundlerUnreachableError, InvalidUserOperationError, PaymasterConfigError, PaymasterConfigReason, PaymasterValidationError, RevertErrorOptions, SmartAccountSDKError, UserOperationReceiptTimeoutError, UserOperationRejectedError, UserOperationRevertError, classifyBundlerError, mapAaCode } from "./errors/index.js";
|
|
11
|
+
export { AaCodeMatch, AccountFactoryError, AccountValidationError, ApiKeyInfo, ApiKeyInvalidError, ApiKeyInvalidReason, ApiKeyQuota, BaliolaAuthUnreachableError, BoundWriteContract, BundleFrameError, BundlerClient, BundlerErrorOptions, BundlerRpcError, BundlerUnreachableError, Call, CreateBundlerClientParams, CreateSmartAccountClientParams, DEFAULT_AUTH_URLS, DEFAULT_BUNDLER_URLS, DRAFT_GAS_ANCHORS, DUMMY_SIGNATURE, EstimateUserOperationGasParams, GetUserOperationReceiptParams, ISmartAccount, InvalidUserOperationError, MAC_CHAINS, MacChainName, PaymasterConfigError, PaymasterConfigReason, PaymasterValidationError, RawCall, ResolveBundlerTransportParams, RevertErrorOptions, RpcUserOperation, SigningAccount, SmartAccountActionContext, SmartAccountClient, SmartAccountSDKError, ToSmartAccountParams, TypedCall, UnwatchFn, UserOperationEventMatch, UserOperationGasEstimate, UserOperationReceipt, UserOperationReceiptTimeoutError, UserOperationRejectedError, UserOperationRevertError, ValidateApiKeyParams, WaitForUserOperationReceiptParams, WatchUserOperationsParams, WriteContractInput, WriteContractOverrides, bindWriteContract, buildDraftUserOp, classifyBundlerError, createBundlerClient, createSmartAccountClient, encodeCalls, estimateUserOpGasRaw, estimateUserOperationGas, fromRpcUserOp, getUserOperationReceipt, macMainnet, macTestnet, mapAaCode, resolveAuthUrl, resolveBundlerTransport, resolveChain, sliceUserOpLogs, toRpcUserOp, toSmartAccount, validateApiKey, waitForUserOperationReceipt, watchUserOperations, writeContract };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { n as encodeCalls, t as toSmartAccount } from "./accounts-Bw0IrOJ1.js";
|
|
2
|
+
import { MAC_CHAINS, macMainnet, macTestnet, resolveChain } from "./chains/index.js";
|
|
3
|
+
import { a as getUserOperationReceipt, c as estimateUserOperationGas, d as DRAFT_GAS_ANCHORS, f as DUMMY_SIGNATURE, i as waitForUserOperationReceipt, l as fromRpcUserOp, n as writeContract, o as sliceUserOpLogs, p as buildDraftUserOp, r as watchUserOperations, s as estimateUserOpGasRaw, t as bindWriteContract, u as toRpcUserOp } from "./writeContract-AyQox2dQ.js";
|
|
4
|
+
import { a as UserOperationReceiptTimeoutError, i as SmartAccountSDKError, n as BaliolaAuthUnreachableError, r as PaymasterConfigError, t as ApiKeyInvalidError } from "./base-v7RyiDFz.js";
|
|
5
|
+
import "./actions/index.js";
|
|
6
|
+
import { n as DEFAULT_AUTH_URLS, r as resolveAuthUrl, t as validateApiKey } from "./validateApiKey-lUfEM5W0.js";
|
|
7
|
+
import "./auth/index.js";
|
|
8
|
+
import { i as resolveBundlerTransport, n as createBundlerClient, r as DEFAULT_BUNDLER_URLS, t as createSmartAccountClient } from "./clients-B17dl_fh.js";
|
|
9
|
+
import { a as BundleFrameError, c as BundlerRpcError, d as UserOperationRejectedError, i as AccountValidationError, l as BundlerUnreachableError, n as mapAaCode, o as PaymasterValidationError, r as AccountFactoryError, s as UserOperationRevertError, t as classifyBundlerError, u as InvalidUserOperationError } from "./classifyBundlerError-BqFLORNt.js";
|
|
10
|
+
import "./errors/index.js";
|
|
11
|
+
import "./types/index.js";
|
|
12
|
+
export { AccountFactoryError, AccountValidationError, ApiKeyInvalidError, BaliolaAuthUnreachableError, BundleFrameError, BundlerRpcError, BundlerUnreachableError, DEFAULT_AUTH_URLS, DEFAULT_BUNDLER_URLS, DRAFT_GAS_ANCHORS, DUMMY_SIGNATURE, InvalidUserOperationError, MAC_CHAINS, PaymasterConfigError, PaymasterValidationError, SmartAccountSDKError, UserOperationReceiptTimeoutError, UserOperationRejectedError, UserOperationRevertError, bindWriteContract, buildDraftUserOp, classifyBundlerError, createBundlerClient, createSmartAccountClient, encodeCalls, estimateUserOpGasRaw, estimateUserOperationGas, fromRpcUserOp, getUserOperationReceipt, macMainnet, macTestnet, mapAaCode, resolveAuthUrl, resolveBundlerTransport, resolveChain, sliceUserOpLogs, toRpcUserOp, toSmartAccount, validateApiKey, waitForUserOperationReceipt, watchUserOperations, writeContract };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Address, Hex, Log } from "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/types/receipt.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Result of `waitForUserOperationReceipt` / `getUserOperationReceipt`.
|
|
6
|
+
* Carries both hashes — the ERC-4337 `userOpHash` and the on-chain
|
|
7
|
+
* `handleOps` `txHash` — and logs pre-sliced to this UserOp only.
|
|
8
|
+
*/
|
|
9
|
+
interface UserOperationReceipt {
|
|
10
|
+
userOpHash: Hex;
|
|
11
|
+
sender: Address;
|
|
12
|
+
nonce: bigint;
|
|
13
|
+
paymaster?: Address;
|
|
14
|
+
success: boolean;
|
|
15
|
+
reason?: string;
|
|
16
|
+
actualGasUsed: bigint;
|
|
17
|
+
actualGasCost: bigint;
|
|
18
|
+
txHash: Hex;
|
|
19
|
+
blockNumber: bigint;
|
|
20
|
+
blockHash: Hex;
|
|
21
|
+
logs: Log[];
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { UserOperationReceipt as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|