@pepu-chain/sdk 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +565 -2
- package/dist/aa/kernel.cjs +40 -0
- package/dist/aa/kernel.cjs.map +1 -0
- package/dist/aa/kernel.d.cts +88 -0
- package/dist/aa/kernel.d.ts +88 -0
- package/dist/aa/kernel.js +11 -0
- package/dist/aa/kernel.js.map +1 -0
- package/dist/aa/react-direct.cjs +110 -0
- package/dist/aa/react-direct.cjs.map +1 -0
- package/dist/aa/react-direct.d.cts +42 -0
- package/dist/aa/react-direct.d.ts +42 -0
- package/dist/aa/react-direct.js +107 -0
- package/dist/aa/react-direct.js.map +1 -0
- package/dist/aa/react.cjs +151 -0
- package/dist/aa/react.cjs.map +1 -0
- package/dist/aa/react.d.cts +62 -0
- package/dist/aa/react.d.ts +62 -0
- package/dist/aa/react.js +147 -0
- package/dist/aa/react.js.map +1 -0
- package/dist/aa.cjs +84 -0
- package/dist/aa.cjs.map +1 -0
- package/dist/aa.d.cts +85 -0
- package/dist/aa.d.ts +85 -0
- package/dist/aa.js +11 -0
- package/dist/aa.js.map +1 -0
- package/dist/api-Dz4sCHH_.d.cts +654 -0
- package/dist/api-Dz4sCHH_.d.ts +654 -0
- package/dist/calls-BRPjKgjl.d.cts +70 -0
- package/dist/calls-z_EQOtFb.d.ts +70 -0
- package/dist/chains-DK13zGIp.d.cts +235 -0
- package/dist/chains-DK13zGIp.d.ts +235 -0
- package/dist/chunk-3XUGQODR.js +194 -0
- package/dist/chunk-3XUGQODR.js.map +1 -0
- package/dist/chunk-45KSZH26.cjs +145 -0
- package/dist/chunk-45KSZH26.cjs.map +1 -0
- package/dist/chunk-4GINFJO6.cjs +44 -0
- package/dist/chunk-4GINFJO6.cjs.map +1 -0
- package/dist/chunk-62M2LKQW.js +136 -0
- package/dist/chunk-62M2LKQW.js.map +1 -0
- package/dist/chunk-6DSZ4Z2N.js +498 -0
- package/dist/chunk-6DSZ4Z2N.js.map +1 -0
- package/dist/chunk-7MNJF2OB.cjs +72 -0
- package/dist/chunk-7MNJF2OB.cjs.map +1 -0
- package/dist/chunk-A5LP2UCS.cjs +2729 -0
- package/dist/chunk-A5LP2UCS.cjs.map +1 -0
- package/dist/chunk-AJS4UFQX.cjs +121 -0
- package/dist/chunk-AJS4UFQX.cjs.map +1 -0
- package/dist/chunk-C2XW44FI.cjs +200 -0
- package/dist/chunk-C2XW44FI.cjs.map +1 -0
- package/dist/chunk-C7IC36XS.cjs +13 -0
- package/dist/chunk-C7IC36XS.cjs.map +1 -0
- package/dist/chunk-D52PADVY.js +84 -0
- package/dist/chunk-D52PADVY.js.map +1 -0
- package/dist/chunk-DH6BFNVJ.cjs +272 -0
- package/dist/chunk-DH6BFNVJ.cjs.map +1 -0
- package/dist/chunk-DPCZJLB3.cjs +87 -0
- package/dist/chunk-DPCZJLB3.cjs.map +1 -0
- package/dist/chunk-EHBPIYY4.js +262 -0
- package/dist/chunk-EHBPIYY4.js.map +1 -0
- package/dist/chunk-ESMNAXUI.js +86 -0
- package/dist/chunk-ESMNAXUI.js.map +1 -0
- package/dist/chunk-ET3P6TX6.cjs +49 -0
- package/dist/chunk-ET3P6TX6.cjs.map +1 -0
- package/dist/chunk-FCXSP2YF.js +219 -0
- package/dist/chunk-FCXSP2YF.js.map +1 -0
- package/dist/chunk-IB2FSPMJ.js +66 -0
- package/dist/chunk-IB2FSPMJ.js.map +1 -0
- package/dist/chunk-IG7RSL2Y.cjs +178 -0
- package/dist/chunk-IG7RSL2Y.cjs.map +1 -0
- package/dist/chunk-IY3ALPUJ.js +2716 -0
- package/dist/chunk-IY3ALPUJ.js.map +1 -0
- package/dist/chunk-J3O2ZGG3.cjs +93 -0
- package/dist/chunk-J3O2ZGG3.cjs.map +1 -0
- package/dist/chunk-J6UXXHBE.js +37 -0
- package/dist/chunk-J6UXXHBE.js.map +1 -0
- package/dist/chunk-JLZ4LZ4Z.js +22 -0
- package/dist/chunk-JLZ4LZ4Z.js.map +1 -0
- package/dist/chunk-KIIFL4VM.js +274 -0
- package/dist/chunk-KIIFL4VM.js.map +1 -0
- package/dist/chunk-KVG3AYYR.js +99 -0
- package/dist/chunk-KVG3AYYR.js.map +1 -0
- package/dist/chunk-MBA4CLA5.js +45 -0
- package/dist/chunk-MBA4CLA5.js.map +1 -0
- package/dist/chunk-NE3QKDOB.cjs +24 -0
- package/dist/chunk-NE3QKDOB.cjs.map +1 -0
- package/dist/chunk-NVOPDXTA.cjs +95 -0
- package/dist/chunk-NVOPDXTA.cjs.map +1 -0
- package/dist/chunk-OH3QMAIB.js +11 -0
- package/dist/chunk-OH3QMAIB.js.map +1 -0
- package/dist/chunk-PHM3ZORG.cjs +110 -0
- package/dist/chunk-PHM3ZORG.cjs.map +1 -0
- package/dist/chunk-R5PXQNO3.cjs +209 -0
- package/dist/chunk-R5PXQNO3.cjs.map +1 -0
- package/dist/chunk-SLW7FRTL.cjs +285 -0
- package/dist/chunk-SLW7FRTL.cjs.map +1 -0
- package/dist/chunk-SVWRRALU.cjs +17 -0
- package/dist/chunk-SVWRRALU.cjs.map +1 -0
- package/dist/chunk-T43PQXJD.js +202 -0
- package/dist/chunk-T43PQXJD.js.map +1 -0
- package/dist/chunk-TIEAZYHF.cjs +225 -0
- package/dist/chunk-TIEAZYHF.cjs.map +1 -0
- package/dist/chunk-VBH3JLQ5.js +116 -0
- package/dist/chunk-VBH3JLQ5.js.map +1 -0
- package/dist/chunk-VF3D6KLQ.cjs +94 -0
- package/dist/chunk-VF3D6KLQ.cjs.map +1 -0
- package/dist/chunk-VTQIHMF3.js +82 -0
- package/dist/chunk-VTQIHMF3.js.map +1 -0
- package/dist/chunk-W3JN3YIW.js +15 -0
- package/dist/chunk-W3JN3YIW.js.map +1 -0
- package/dist/chunk-WANILJZQ.cjs +87 -0
- package/dist/chunk-WANILJZQ.cjs.map +1 -0
- package/dist/chunk-XC4IBCI2.js +86 -0
- package/dist/chunk-XC4IBCI2.js.map +1 -0
- package/dist/chunk-YKEWWQEJ.js +165 -0
- package/dist/chunk-YKEWWQEJ.js.map +1 -0
- package/dist/chunk-YQL7NISX.cjs +515 -0
- package/dist/chunk-YQL7NISX.cjs.map +1 -0
- package/dist/chunk-ZB6SVBK4.js +89 -0
- package/dist/chunk-ZB6SVBK4.js.map +1 -0
- package/dist/combo/react.cjs +235 -0
- package/dist/combo/react.cjs.map +1 -0
- package/dist/combo/react.d.cts +148 -0
- package/dist/combo/react.d.ts +148 -0
- package/dist/combo/react.js +230 -0
- package/dist/combo/react.js.map +1 -0
- package/dist/combo.cjs +262 -0
- package/dist/combo.cjs.map +1 -0
- package/dist/combo.d.cts +139 -0
- package/dist/combo.d.ts +139 -0
- package/dist/combo.js +249 -0
- package/dist/combo.js.map +1 -0
- package/dist/config-CHjz7ZjZ.d.cts +57 -0
- package/dist/config-COjhIZTh.d.ts +57 -0
- package/dist/doctor.cjs +354 -0
- package/dist/doctor.cjs.map +1 -0
- package/dist/doctor.d.cts +177 -0
- package/dist/doctor.d.ts +177 -0
- package/dist/doctor.js +345 -0
- package/dist/doctor.js.map +1 -0
- package/dist/erc7677-DOW58QBE.d.cts +111 -0
- package/dist/erc7677-DOW58QBE.d.ts +111 -0
- package/dist/errors-CgX1vNj7.d.cts +100 -0
- package/dist/errors-CgX1vNj7.d.ts +100 -0
- package/dist/index.cjs +802 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2398 -0
- package/dist/index.d.ts +2398 -0
- package/dist/index.js +559 -0
- package/dist/index.js.map +1 -0
- package/dist/paymaster/server.cjs +38 -0
- package/dist/paymaster/server.cjs.map +1 -0
- package/dist/paymaster/server.d.cts +57 -0
- package/dist/paymaster/server.d.ts +57 -0
- package/dist/paymaster/server.js +36 -0
- package/dist/paymaster/server.js.map +1 -0
- package/dist/paymaster.cjs +356 -0
- package/dist/paymaster.cjs.map +1 -0
- package/dist/paymaster.d.cts +1851 -0
- package/dist/paymaster.d.ts +1851 -0
- package/dist/paymaster.js +289 -0
- package/dist/paymaster.js.map +1 -0
- package/dist/privy/react.cjs +48 -0
- package/dist/privy/react.cjs.map +1 -0
- package/dist/privy/react.d.cts +194 -0
- package/dist/privy/react.d.ts +194 -0
- package/dist/privy/react.js +7 -0
- package/dist/privy/react.js.map +1 -0
- package/dist/privy/server.cjs +43 -0
- package/dist/privy/server.cjs.map +1 -0
- package/dist/privy/server.d.cts +192 -0
- package/dist/privy/server.d.ts +192 -0
- package/dist/privy/server.js +6 -0
- package/dist/privy/server.js.map +1 -0
- package/dist/privy/wagmi.d.ts +90 -0
- package/dist/privy/wagmi.js +55 -0
- package/dist/privy/wagmi.js.map +1 -0
- package/dist/privy.cjs +34 -0
- package/dist/privy.cjs.map +1 -0
- package/dist/privy.d.cts +4 -0
- package/dist/privy.d.ts +4 -0
- package/dist/privy.js +5 -0
- package/dist/privy.js.map +1 -0
- package/dist/react.cjs +72 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +66 -0
- package/dist/react.d.ts +66 -0
- package/dist/react.js +68 -0
- package/dist/react.js.map +1 -0
- package/dist/requirements-C-QiJkL9.d.cts +134 -0
- package/dist/requirements-C-QiJkL9.d.ts +134 -0
- package/dist/scope-DBRkN7bR.d.cts +94 -0
- package/dist/scope-DBRkN7bR.d.ts +94 -0
- package/dist/server.cjs +59 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +208 -0
- package/dist/server.d.ts +208 -0
- package/dist/server.js +8 -0
- package/dist/server.js.map +1 -0
- package/dist/session/kernel.cjs +82 -0
- package/dist/session/kernel.cjs.map +1 -0
- package/dist/session/kernel.d.cts +131 -0
- package/dist/session/kernel.d.ts +131 -0
- package/dist/session/kernel.js +13 -0
- package/dist/session/kernel.js.map +1 -0
- package/dist/session/react.cjs +37 -0
- package/dist/session/react.cjs.map +1 -0
- package/dist/session/react.d.cts +119 -0
- package/dist/session/react.d.ts +119 -0
- package/dist/session/react.js +8 -0
- package/dist/session/react.js.map +1 -0
- package/dist/session/server.cjs +267 -0
- package/dist/session/server.cjs.map +1 -0
- package/dist/session/server.d.cts +151 -0
- package/dist/session/server.d.ts +151 -0
- package/dist/session/server.js +252 -0
- package/dist/session/server.js.map +1 -0
- package/dist/session.cjs +74 -0
- package/dist/session.cjs.map +1 -0
- package/dist/session.d.cts +3 -0
- package/dist/session.d.ts +3 -0
- package/dist/session.js +5 -0
- package/dist/session.js.map +1 -0
- package/dist/status-CmOsyPmO.d.cts +295 -0
- package/dist/status-DwkkOrGQ.d.ts +295 -0
- package/dist/store-CjmLgp9g.d.cts +64 -0
- package/dist/store-CjmLgp9g.d.ts +64 -0
- package/dist/types-BEEM7WdG.d.cts +25 -0
- package/dist/types-BEEM7WdG.d.ts +25 -0
- package/dist/types-BilBTDqK.d.cts +27 -0
- package/dist/types-BilBTDqK.d.ts +27 -0
- package/package.json +209 -3
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as _zerodev_sdk_types from '@zerodev/sdk/types';
|
|
2
|
+
import { Signer } from '@zerodev/sdk/types';
|
|
3
|
+
import { createKernelAccountClient, createKernelAccount } from '@zerodev/sdk';
|
|
4
|
+
import { LocalAccount, WalletClient, Hex, Address, PublicClient } from 'viem';
|
|
5
|
+
import { P as PaymasterContext } from '../erc7677-DOW58QBE.cjs';
|
|
6
|
+
import { C as Call } from '../types-BilBTDqK.cjs';
|
|
7
|
+
export { e as encodeKernelExecute } from '../calls-BRPjKgjl.cjs';
|
|
8
|
+
|
|
9
|
+
/** Kernel v3.1, the version deployed on PEPU mainnet (factory in the contract registry). */
|
|
10
|
+
declare const KERNEL_VERSION: _zerodev_sdk_types.KERNEL_V3_VERSION_TYPE;
|
|
11
|
+
/** The Kernel account type this module builds. */
|
|
12
|
+
type KernelSmartAccount = Awaited<ReturnType<typeof createKernelAccount>>;
|
|
13
|
+
/** The sponsored client type {@link createPepuSponsoredClient} returns. */
|
|
14
|
+
type KernelAccountClient = ReturnType<typeof createKernelAccountClient>;
|
|
15
|
+
/** Anything that can sign for the Kernel owner. */
|
|
16
|
+
type KernelOwner = LocalAccount | Signer | WalletClient;
|
|
17
|
+
/**
|
|
18
|
+
* Build a Kernel v3.1 smart account owned by `owner` (ECDSA root validator).
|
|
19
|
+
* The address depends only on the owner and `index`, never on a session.
|
|
20
|
+
* Pass `plugins.regular` to add a permission (session-key) validator on top
|
|
21
|
+
* of the root; that is how `@pepu-chain/sdk/session/kernel` builds on this.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const account = await toPepuKernelAccount({ publicClient, owner: privateKeyToAccount(key) });
|
|
25
|
+
*/
|
|
26
|
+
declare function toPepuKernelAccount(p: {
|
|
27
|
+
publicClient: PublicClient;
|
|
28
|
+
owner: KernelOwner;
|
|
29
|
+
index?: bigint;
|
|
30
|
+
/**
|
|
31
|
+
* `regular` is a ZeroDev validator plugin, for example the permission
|
|
32
|
+
* validator from `@zerodev/permissions` (see `@pepu-chain/sdk/session/kernel`).
|
|
33
|
+
* Typed as `object` so this entry does not need `@zerodev/permissions` types.
|
|
34
|
+
*/
|
|
35
|
+
plugins?: {
|
|
36
|
+
regular?: object;
|
|
37
|
+
};
|
|
38
|
+
}): Promise<KernelSmartAccount>;
|
|
39
|
+
/**
|
|
40
|
+
* The counterfactual Kernel address for an owner, with no signature needed.
|
|
41
|
+
* Lifted from `templates/sponsored-session-app/lib/kernel.ts`.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* const smartAccount = await getKernelAddress(publicClient, ownerAddress);
|
|
45
|
+
*/
|
|
46
|
+
declare function getKernelAddress(publicClient: PublicClient, owner: Address): Promise<Address>;
|
|
47
|
+
/**
|
|
48
|
+
* A Kernel client that sends through YOUR bundler and has gas paid by YOUR
|
|
49
|
+
* paymaster (ERC-7677). Fees come from the chain with 20% headroom.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const client = createPepuSponsoredClient({ account, paymasterContext: { privyAccessToken } });
|
|
53
|
+
*/
|
|
54
|
+
declare function createPepuSponsoredClient(p: {
|
|
55
|
+
account: KernelSmartAccount;
|
|
56
|
+
bundlerUrl?: string;
|
|
57
|
+
paymasterUrl?: string;
|
|
58
|
+
/** Project client token; builds the ERC-7677 URL against the paymaster base when no URL is configured. */
|
|
59
|
+
paymasterToken?: string;
|
|
60
|
+
paymasterContext?: PaymasterContext;
|
|
61
|
+
publicClient?: PublicClient;
|
|
62
|
+
}): KernelAccountClient;
|
|
63
|
+
/** Result of {@link sendSponsored}. */
|
|
64
|
+
interface SendSponsoredResult {
|
|
65
|
+
userOpHash: Hex;
|
|
66
|
+
transactionHash: Hex;
|
|
67
|
+
success: boolean;
|
|
68
|
+
paymaster: Address | null;
|
|
69
|
+
actualGasCostWei: bigint;
|
|
70
|
+
explorerUrl: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Encode `calls`, send one UserOperation, wait for its receipt, and report
|
|
74
|
+
* who paid. Failures are mapped through `describeUserOpFailure` (AAxx and
|
|
75
|
+
* paymaster reasons become typed PepuErrors). Flow ported from
|
|
76
|
+
* `sendSessionTap` in the sponsored-session-app template.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* const r = await sendSponsored({ client, calls: [{ to, abi, functionName: "tap" }] });
|
|
80
|
+
* console.log(r.paymaster, r.explorerUrl);
|
|
81
|
+
*/
|
|
82
|
+
declare function sendSponsored(p: {
|
|
83
|
+
client: KernelAccountClient;
|
|
84
|
+
calls: Call[];
|
|
85
|
+
timeoutMs?: number;
|
|
86
|
+
}): Promise<SendSponsoredResult>;
|
|
87
|
+
|
|
88
|
+
export { Call, KERNEL_VERSION, type KernelAccountClient, type KernelOwner, type KernelSmartAccount, type SendSponsoredResult, createPepuSponsoredClient, getKernelAddress, sendSponsored, toPepuKernelAccount };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as _zerodev_sdk_types from '@zerodev/sdk/types';
|
|
2
|
+
import { Signer } from '@zerodev/sdk/types';
|
|
3
|
+
import { createKernelAccountClient, createKernelAccount } from '@zerodev/sdk';
|
|
4
|
+
import { LocalAccount, WalletClient, Hex, Address, PublicClient } from 'viem';
|
|
5
|
+
import { P as PaymasterContext } from '../erc7677-DOW58QBE.js';
|
|
6
|
+
import { C as Call } from '../types-BilBTDqK.js';
|
|
7
|
+
export { e as encodeKernelExecute } from '../calls-z_EQOtFb.js';
|
|
8
|
+
|
|
9
|
+
/** Kernel v3.1, the version deployed on PEPU mainnet (factory in the contract registry). */
|
|
10
|
+
declare const KERNEL_VERSION: _zerodev_sdk_types.KERNEL_V3_VERSION_TYPE;
|
|
11
|
+
/** The Kernel account type this module builds. */
|
|
12
|
+
type KernelSmartAccount = Awaited<ReturnType<typeof createKernelAccount>>;
|
|
13
|
+
/** The sponsored client type {@link createPepuSponsoredClient} returns. */
|
|
14
|
+
type KernelAccountClient = ReturnType<typeof createKernelAccountClient>;
|
|
15
|
+
/** Anything that can sign for the Kernel owner. */
|
|
16
|
+
type KernelOwner = LocalAccount | Signer | WalletClient;
|
|
17
|
+
/**
|
|
18
|
+
* Build a Kernel v3.1 smart account owned by `owner` (ECDSA root validator).
|
|
19
|
+
* The address depends only on the owner and `index`, never on a session.
|
|
20
|
+
* Pass `plugins.regular` to add a permission (session-key) validator on top
|
|
21
|
+
* of the root; that is how `@pepu-chain/sdk/session/kernel` builds on this.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const account = await toPepuKernelAccount({ publicClient, owner: privateKeyToAccount(key) });
|
|
25
|
+
*/
|
|
26
|
+
declare function toPepuKernelAccount(p: {
|
|
27
|
+
publicClient: PublicClient;
|
|
28
|
+
owner: KernelOwner;
|
|
29
|
+
index?: bigint;
|
|
30
|
+
/**
|
|
31
|
+
* `regular` is a ZeroDev validator plugin, for example the permission
|
|
32
|
+
* validator from `@zerodev/permissions` (see `@pepu-chain/sdk/session/kernel`).
|
|
33
|
+
* Typed as `object` so this entry does not need `@zerodev/permissions` types.
|
|
34
|
+
*/
|
|
35
|
+
plugins?: {
|
|
36
|
+
regular?: object;
|
|
37
|
+
};
|
|
38
|
+
}): Promise<KernelSmartAccount>;
|
|
39
|
+
/**
|
|
40
|
+
* The counterfactual Kernel address for an owner, with no signature needed.
|
|
41
|
+
* Lifted from `templates/sponsored-session-app/lib/kernel.ts`.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* const smartAccount = await getKernelAddress(publicClient, ownerAddress);
|
|
45
|
+
*/
|
|
46
|
+
declare function getKernelAddress(publicClient: PublicClient, owner: Address): Promise<Address>;
|
|
47
|
+
/**
|
|
48
|
+
* A Kernel client that sends through YOUR bundler and has gas paid by YOUR
|
|
49
|
+
* paymaster (ERC-7677). Fees come from the chain with 20% headroom.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const client = createPepuSponsoredClient({ account, paymasterContext: { privyAccessToken } });
|
|
53
|
+
*/
|
|
54
|
+
declare function createPepuSponsoredClient(p: {
|
|
55
|
+
account: KernelSmartAccount;
|
|
56
|
+
bundlerUrl?: string;
|
|
57
|
+
paymasterUrl?: string;
|
|
58
|
+
/** Project client token; builds the ERC-7677 URL against the paymaster base when no URL is configured. */
|
|
59
|
+
paymasterToken?: string;
|
|
60
|
+
paymasterContext?: PaymasterContext;
|
|
61
|
+
publicClient?: PublicClient;
|
|
62
|
+
}): KernelAccountClient;
|
|
63
|
+
/** Result of {@link sendSponsored}. */
|
|
64
|
+
interface SendSponsoredResult {
|
|
65
|
+
userOpHash: Hex;
|
|
66
|
+
transactionHash: Hex;
|
|
67
|
+
success: boolean;
|
|
68
|
+
paymaster: Address | null;
|
|
69
|
+
actualGasCostWei: bigint;
|
|
70
|
+
explorerUrl: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Encode `calls`, send one UserOperation, wait for its receipt, and report
|
|
74
|
+
* who paid. Failures are mapped through `describeUserOpFailure` (AAxx and
|
|
75
|
+
* paymaster reasons become typed PepuErrors). Flow ported from
|
|
76
|
+
* `sendSessionTap` in the sponsored-session-app template.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* const r = await sendSponsored({ client, calls: [{ to, abi, functionName: "tap" }] });
|
|
80
|
+
* console.log(r.paymaster, r.explorerUrl);
|
|
81
|
+
*/
|
|
82
|
+
declare function sendSponsored(p: {
|
|
83
|
+
client: KernelAccountClient;
|
|
84
|
+
calls: Call[];
|
|
85
|
+
timeoutMs?: number;
|
|
86
|
+
}): Promise<SendSponsoredResult>;
|
|
87
|
+
|
|
88
|
+
export { Call, KERNEL_VERSION, type KernelAccountClient, type KernelOwner, type KernelSmartAccount, type SendSponsoredResult, createPepuSponsoredClient, getKernelAddress, sendSponsored, toPepuKernelAccount };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { KERNEL_VERSION, createPepuSponsoredClient, getKernelAddress, sendSponsored, toPepuKernelAccount } from '../chunk-ZB6SVBK4.js';
|
|
2
|
+
import '../chunk-IB2FSPMJ.js';
|
|
3
|
+
export { encodeKernelExecute } from '../chunk-VBH3JLQ5.js';
|
|
4
|
+
import '../chunk-IY3ALPUJ.js';
|
|
5
|
+
import '../chunk-D52PADVY.js';
|
|
6
|
+
import '../chunk-J6UXXHBE.js';
|
|
7
|
+
import '../chunk-XC4IBCI2.js';
|
|
8
|
+
import '../chunk-VTQIHMF3.js';
|
|
9
|
+
import '../chunk-6DSZ4Z2N.js';
|
|
10
|
+
//# sourceMappingURL=kernel.js.map
|
|
11
|
+
//# sourceMappingURL=kernel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"kernel.js"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkNVOPDXTA_cjs = require('../chunk-NVOPDXTA.cjs');
|
|
4
|
+
require('../chunk-7MNJF2OB.cjs');
|
|
5
|
+
require('../chunk-AJS4UFQX.cjs');
|
|
6
|
+
require('../chunk-A5LP2UCS.cjs');
|
|
7
|
+
var chunkET3P6TX6_cjs = require('../chunk-ET3P6TX6.cjs');
|
|
8
|
+
var chunkWANILJZQ_cjs = require('../chunk-WANILJZQ.cjs');
|
|
9
|
+
require('../chunk-TIEAZYHF.cjs');
|
|
10
|
+
var chunkC7IC36XS_cjs = require('../chunk-C7IC36XS.cjs');
|
|
11
|
+
require('../chunk-4GINFJO6.cjs');
|
|
12
|
+
require('../chunk-VF3D6KLQ.cjs');
|
|
13
|
+
var chunkDPCZJLB3_cjs = require('../chunk-DPCZJLB3.cjs');
|
|
14
|
+
var chunkYQL7NISX_cjs = require('../chunk-YQL7NISX.cjs');
|
|
15
|
+
var reactAuth = require('@privy-io/react-auth');
|
|
16
|
+
var react = require('react');
|
|
17
|
+
var viem = require('viem');
|
|
18
|
+
|
|
19
|
+
var sharedClient;
|
|
20
|
+
function publicClient() {
|
|
21
|
+
sharedClient ??= chunkC7IC36XS_cjs.getPublicClient(chunkDPCZJLB3_cjs.pepuMainnet);
|
|
22
|
+
return sharedClient;
|
|
23
|
+
}
|
|
24
|
+
function useEmbeddedWallet() {
|
|
25
|
+
const { wallets } = reactAuth.useWallets();
|
|
26
|
+
return wallets.find((w) => w.walletClientType === "privy");
|
|
27
|
+
}
|
|
28
|
+
function useDirectSmartAccount() {
|
|
29
|
+
const embedded = useEmbeddedWallet();
|
|
30
|
+
const owner = embedded?.address;
|
|
31
|
+
const [derived, setDerived] = react.useState();
|
|
32
|
+
react.useEffect(() => {
|
|
33
|
+
if (!owner) return;
|
|
34
|
+
let cancelled = false;
|
|
35
|
+
chunkNVOPDXTA_cjs.getKernelAddress(publicClient(), owner).then((address) => {
|
|
36
|
+
if (!cancelled) setDerived({ owner, address });
|
|
37
|
+
}).catch(() => {
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
cancelled = true;
|
|
41
|
+
};
|
|
42
|
+
}, [owner]);
|
|
43
|
+
const smartAccount = derived && derived.owner === owner ? derived.address : void 0;
|
|
44
|
+
return {
|
|
45
|
+
...owner ? { owner } : {},
|
|
46
|
+
...smartAccount ? { smartAccount } : {},
|
|
47
|
+
ready: owner !== void 0 && smartAccount !== void 0
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function useDirectSponsoredSend(o = {}) {
|
|
51
|
+
const { getAccessToken } = reactAuth.usePrivy();
|
|
52
|
+
const embedded = useEmbeddedWallet();
|
|
53
|
+
const [status, setStatus] = react.useState("idle");
|
|
54
|
+
const [result, setResult] = react.useState();
|
|
55
|
+
const [error, setError] = react.useState();
|
|
56
|
+
const inFlight = react.useRef(false);
|
|
57
|
+
const send = react.useCallback(
|
|
58
|
+
async (calls) => {
|
|
59
|
+
if (inFlight.current) {
|
|
60
|
+
throw new chunkYQL7NISX_cjs.PepuConfigError("UNKNOWN", "A sponsored send is already in progress.", {
|
|
61
|
+
hint: "Wait for the current send to finish."
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
inFlight.current = true;
|
|
65
|
+
setStatus("signing");
|
|
66
|
+
setError(void 0);
|
|
67
|
+
setResult(void 0);
|
|
68
|
+
try {
|
|
69
|
+
if (!embedded) {
|
|
70
|
+
throw new chunkYQL7NISX_cjs.PepuConfigError("WALLET_NOT_PROVISIONED", "No Privy embedded wallet to own the smart account.");
|
|
71
|
+
}
|
|
72
|
+
const pc = publicClient();
|
|
73
|
+
const provider = await embedded.getEthereumProvider();
|
|
74
|
+
const owner = viem.createWalletClient({
|
|
75
|
+
account: embedded.address,
|
|
76
|
+
chain: chunkDPCZJLB3_cjs.pepuMainnet,
|
|
77
|
+
transport: viem.custom(provider)
|
|
78
|
+
});
|
|
79
|
+
const token = await getAccessToken();
|
|
80
|
+
const account = await chunkNVOPDXTA_cjs.toPepuKernelAccount({ publicClient: pc, owner });
|
|
81
|
+
const kernel = chunkNVOPDXTA_cjs.createPepuSponsoredClient({
|
|
82
|
+
account,
|
|
83
|
+
publicClient: pc,
|
|
84
|
+
...o.bundlerUrl !== void 0 ? { bundlerUrl: o.bundlerUrl } : {},
|
|
85
|
+
...o.paymasterUrl !== void 0 ? { paymasterUrl: o.paymasterUrl } : {},
|
|
86
|
+
...token ? { paymasterContext: chunkET3P6TX6_cjs.buildPaymasterContext({ privyAccessToken: token }) } : {}
|
|
87
|
+
});
|
|
88
|
+
setStatus("submitting");
|
|
89
|
+
const out = await chunkNVOPDXTA_cjs.sendSponsored({ client: kernel, calls });
|
|
90
|
+
setResult(out);
|
|
91
|
+
setStatus("confirmed");
|
|
92
|
+
return out;
|
|
93
|
+
} catch (caught) {
|
|
94
|
+
const err = chunkYQL7NISX_cjs.toPepuError(caught) === caught ? caught : chunkWANILJZQ_cjs.describeUserOpFailure(caught);
|
|
95
|
+
setError(err);
|
|
96
|
+
setStatus("error");
|
|
97
|
+
throw err;
|
|
98
|
+
} finally {
|
|
99
|
+
inFlight.current = false;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[embedded, getAccessToken, o.bundlerUrl, o.paymasterUrl]
|
|
103
|
+
);
|
|
104
|
+
return { send, status, ...result ? { result } : {}, ...error ? { error } : {} };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
exports.useDirectSmartAccount = useDirectSmartAccount;
|
|
108
|
+
exports.useDirectSponsoredSend = useDirectSponsoredSend;
|
|
109
|
+
//# sourceMappingURL=react-direct.cjs.map
|
|
110
|
+
//# sourceMappingURL=react-direct.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/aa/react-direct.ts"],"names":["getPublicClient","pepuMainnet","useWallets","useState","useEffect","getKernelAddress","usePrivy","useRef","useCallback","PepuConfigError","createWalletClient","custom","toPepuKernelAccount","createPepuSponsoredClient","buildPaymasterContext","sendSponsored","toPepuError","describeUserOpFailure"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,IAAI,YAAA;AACJ,SAAS,YAAA,GAA6B;AACpC,EAAA,YAAA,KAAiBA,kCAAgBC,6BAAW,CAAA;AAC5C,EAAA,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.cjs","sourcesContent":["/**\n * @pepu-chain/sdk/aa/react-direct: React hooks for sponsored transactions that\n * go through your own bundler and paymaster (no Privy Smart Wallets).\n *\n * Needs `react`, `@privy-io/react-auth` and the optional peers `@zerodev/sdk`\n * and `@zerodev/ecdsa-validator`. It builds a Kernel account for the Privy\n * embedded wallet and passes the Privy access token as paymaster context for\n * the free tier. Apps on Privy Smart Wallets use `@pepu-chain/sdk/aa/react`\n * instead, which never resolves ZeroDev.\n */\nimport { usePrivy, useWallets } from \"@privy-io/react-auth\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { createWalletClient, custom } from \"viem\";\nimport type { Address, PublicClient } from \"viem\";\n\nimport { pepuMainnet } from \"../chains.js\";\nimport { getPublicClient } from \"../client.js\";\nimport { PepuConfigError, toPepuError } from \"../errors.js\";\nimport type { PepuError } from \"../errors.js\";\nimport { buildPaymasterContext } from \"../erc7677.js\";\nimport { describeUserOpFailure } from \"./describe.js\";\nimport { getKernelAddress, createPepuSponsoredClient, sendSponsored, toPepuKernelAccount } from \"./kernel.js\";\nimport type { Call, SponsoredResult } from \"./types.js\";\n\nexport type { Call, SponsoredResult } from \"./types.js\";\n\nlet sharedClient: PublicClient | undefined;\nfunction publicClient(): PublicClient {\n sharedClient ??= getPublicClient(pepuMainnet) as unknown as PublicClient;\n return sharedClient;\n}\n\nfunction useEmbeddedWallet() {\n const { wallets } = useWallets();\n return wallets.find((w) => w.walletClientType === \"privy\");\n}\n\n/**\n * The two-address model for the direct transport: `owner` is the Privy\n * embedded wallet (an EOA that signs), `smartAccount` is the Kernel address\n * derived from it with {@link getKernelAddress} (a read).\n *\n * @example\n * const { owner, smartAccount, ready } = useDirectSmartAccount();\n */\nexport function useDirectSmartAccount(): { owner?: Address; smartAccount?: Address; ready: boolean } {\n const embedded = useEmbeddedWallet();\n const owner = embedded?.address as Address | undefined;\n const [derived, setDerived] = useState<{ owner: Address; address: Address } | undefined>();\n\n useEffect(() => {\n if (!owner) return;\n let cancelled = false;\n getKernelAddress(publicClient(), owner)\n .then((address) => {\n if (!cancelled) setDerived({ owner, address });\n })\n .catch(() => {\n // Derivation is best effort; `ready` stays false.\n });\n return () => {\n cancelled = true;\n };\n }, [owner]);\n\n const smartAccount = derived && derived.owner === owner ? derived.address : undefined;\n return {\n ...(owner ? { owner } : {}),\n ...(smartAccount ? { smartAccount } : {}),\n ready: owner !== undefined && smartAccount !== undefined,\n };\n}\n\n/** Status of a {@link useDirectSponsoredSend} send. */\nexport type DirectSponsoredSendStatus = \"idle\" | \"signing\" | \"submitting\" | \"confirmed\" | \"error\";\n\n/** Options for {@link useDirectSponsoredSend}. */\nexport interface UseDirectSponsoredSendOptions {\n bundlerUrl?: string;\n paymasterUrl?: string;\n}\n\n/**\n * Send calls with gas sponsored through your own bundler and paymaster. Builds\n * a Kernel account for the embedded wallet and passes the Privy access token\n * as paymaster context for the free tier. One send at a time: a second call\n * while one is in flight is ignored.\n *\n * @example\n * const { send, status, result, error } = useDirectSponsoredSend();\n * await send([{ to: tapScore, abi: tapScoreAbi, functionName: \"tap\" }]);\n */\nexport function useDirectSponsoredSend(o: UseDirectSponsoredSendOptions = {}): {\n send: (calls: Call[]) => Promise<SponsoredResult>;\n status: DirectSponsoredSendStatus;\n result?: SponsoredResult;\n error?: PepuError;\n} {\n const { getAccessToken } = usePrivy();\n const embedded = useEmbeddedWallet();\n const [status, setStatus] = useState<DirectSponsoredSendStatus>(\"idle\");\n const [result, setResult] = useState<SponsoredResult | undefined>();\n const [error, setError] = useState<PepuError | undefined>();\n const inFlight = useRef(false);\n\n const send = useCallback(\n async (calls: Call[]): Promise<SponsoredResult> => {\n if (inFlight.current) {\n throw new PepuConfigError(\"UNKNOWN\", \"A sponsored send is already in progress.\", {\n hint: \"Wait for the current send to finish.\",\n });\n }\n inFlight.current = true;\n setStatus(\"signing\");\n setError(undefined);\n setResult(undefined);\n try {\n if (!embedded) {\n throw new PepuConfigError(\"WALLET_NOT_PROVISIONED\", \"No Privy embedded wallet to own the smart account.\");\n }\n const pc = publicClient();\n const provider = await embedded.getEthereumProvider();\n const owner = createWalletClient({\n account: embedded.address as Address,\n chain: pepuMainnet,\n transport: custom(provider),\n });\n const token = await getAccessToken();\n const account = await toPepuKernelAccount({ publicClient: pc, owner });\n const kernel = createPepuSponsoredClient({\n account,\n publicClient: pc,\n ...(o.bundlerUrl !== undefined ? { bundlerUrl: o.bundlerUrl } : {}),\n ...(o.paymasterUrl !== undefined ? { paymasterUrl: o.paymasterUrl } : {}),\n ...(token ? { paymasterContext: buildPaymasterContext({ privyAccessToken: token }) } : {}),\n });\n setStatus(\"submitting\");\n const out = await sendSponsored({ client: kernel, calls });\n setResult(out);\n setStatus(\"confirmed\");\n return out;\n } catch (caught) {\n const err = toPepuError(caught) === caught ? (caught as PepuError) : describeUserOpFailure(caught);\n setError(err);\n setStatus(\"error\");\n throw err;\n } finally {\n inFlight.current = false;\n }\n },\n [embedded, getAccessToken, o.bundlerUrl, o.paymasterUrl],\n );\n\n return { send, status, ...(result ? { result } : {}), ...(error ? { error } : {}) };\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { P as PepuError } from '../errors-CgX1vNj7.cjs';
|
|
3
|
+
import { C as Call, S as SponsoredResult } from '../types-BilBTDqK.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The two-address model for the direct transport: `owner` is the Privy
|
|
7
|
+
* embedded wallet (an EOA that signs), `smartAccount` is the Kernel address
|
|
8
|
+
* derived from it with {@link getKernelAddress} (a read).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const { owner, smartAccount, ready } = useDirectSmartAccount();
|
|
12
|
+
*/
|
|
13
|
+
declare function useDirectSmartAccount(): {
|
|
14
|
+
owner?: Address;
|
|
15
|
+
smartAccount?: Address;
|
|
16
|
+
ready: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** Status of a {@link useDirectSponsoredSend} send. */
|
|
19
|
+
type DirectSponsoredSendStatus = "idle" | "signing" | "submitting" | "confirmed" | "error";
|
|
20
|
+
/** Options for {@link useDirectSponsoredSend}. */
|
|
21
|
+
interface UseDirectSponsoredSendOptions {
|
|
22
|
+
bundlerUrl?: string;
|
|
23
|
+
paymasterUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Send calls with gas sponsored through your own bundler and paymaster. Builds
|
|
27
|
+
* a Kernel account for the embedded wallet and passes the Privy access token
|
|
28
|
+
* as paymaster context for the free tier. One send at a time: a second call
|
|
29
|
+
* while one is in flight is ignored.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const { send, status, result, error } = useDirectSponsoredSend();
|
|
33
|
+
* await send([{ to: tapScore, abi: tapScoreAbi, functionName: "tap" }]);
|
|
34
|
+
*/
|
|
35
|
+
declare function useDirectSponsoredSend(o?: UseDirectSponsoredSendOptions): {
|
|
36
|
+
send: (calls: Call[]) => Promise<SponsoredResult>;
|
|
37
|
+
status: DirectSponsoredSendStatus;
|
|
38
|
+
result?: SponsoredResult;
|
|
39
|
+
error?: PepuError;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { Call, type DirectSponsoredSendStatus, SponsoredResult, type UseDirectSponsoredSendOptions, useDirectSmartAccount, useDirectSponsoredSend };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { P as PepuError } from '../errors-CgX1vNj7.js';
|
|
3
|
+
import { C as Call, S as SponsoredResult } from '../types-BilBTDqK.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The two-address model for the direct transport: `owner` is the Privy
|
|
7
|
+
* embedded wallet (an EOA that signs), `smartAccount` is the Kernel address
|
|
8
|
+
* derived from it with {@link getKernelAddress} (a read).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const { owner, smartAccount, ready } = useDirectSmartAccount();
|
|
12
|
+
*/
|
|
13
|
+
declare function useDirectSmartAccount(): {
|
|
14
|
+
owner?: Address;
|
|
15
|
+
smartAccount?: Address;
|
|
16
|
+
ready: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** Status of a {@link useDirectSponsoredSend} send. */
|
|
19
|
+
type DirectSponsoredSendStatus = "idle" | "signing" | "submitting" | "confirmed" | "error";
|
|
20
|
+
/** Options for {@link useDirectSponsoredSend}. */
|
|
21
|
+
interface UseDirectSponsoredSendOptions {
|
|
22
|
+
bundlerUrl?: string;
|
|
23
|
+
paymasterUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Send calls with gas sponsored through your own bundler and paymaster. Builds
|
|
27
|
+
* a Kernel account for the embedded wallet and passes the Privy access token
|
|
28
|
+
* as paymaster context for the free tier. One send at a time: a second call
|
|
29
|
+
* while one is in flight is ignored.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const { send, status, result, error } = useDirectSponsoredSend();
|
|
33
|
+
* await send([{ to: tapScore, abi: tapScoreAbi, functionName: "tap" }]);
|
|
34
|
+
*/
|
|
35
|
+
declare function useDirectSponsoredSend(o?: UseDirectSponsoredSendOptions): {
|
|
36
|
+
send: (calls: Call[]) => Promise<SponsoredResult>;
|
|
37
|
+
status: DirectSponsoredSendStatus;
|
|
38
|
+
result?: SponsoredResult;
|
|
39
|
+
error?: PepuError;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { Call, type DirectSponsoredSendStatus, SponsoredResult, type UseDirectSponsoredSendOptions, useDirectSmartAccount, useDirectSponsoredSend };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { getKernelAddress, toPepuKernelAccount, createPepuSponsoredClient, sendSponsored } from '../chunk-ZB6SVBK4.js';
|
|
2
|
+
import '../chunk-IB2FSPMJ.js';
|
|
3
|
+
import '../chunk-VBH3JLQ5.js';
|
|
4
|
+
import '../chunk-IY3ALPUJ.js';
|
|
5
|
+
import { buildPaymasterContext } from '../chunk-MBA4CLA5.js';
|
|
6
|
+
import { describeUserOpFailure } from '../chunk-D52PADVY.js';
|
|
7
|
+
import '../chunk-FCXSP2YF.js';
|
|
8
|
+
import { getPublicClient } from '../chunk-OH3QMAIB.js';
|
|
9
|
+
import '../chunk-J6UXXHBE.js';
|
|
10
|
+
import '../chunk-XC4IBCI2.js';
|
|
11
|
+
import { pepuMainnet } from '../chunk-VTQIHMF3.js';
|
|
12
|
+
import { PepuConfigError, toPepuError } from '../chunk-6DSZ4Z2N.js';
|
|
13
|
+
import { usePrivy, useWallets } from '@privy-io/react-auth';
|
|
14
|
+
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
15
|
+
import { createWalletClient, custom } from 'viem';
|
|
16
|
+
|
|
17
|
+
var sharedClient;
|
|
18
|
+
function publicClient() {
|
|
19
|
+
sharedClient ??= getPublicClient(pepuMainnet);
|
|
20
|
+
return sharedClient;
|
|
21
|
+
}
|
|
22
|
+
function useEmbeddedWallet() {
|
|
23
|
+
const { wallets } = useWallets();
|
|
24
|
+
return wallets.find((w) => w.walletClientType === "privy");
|
|
25
|
+
}
|
|
26
|
+
function useDirectSmartAccount() {
|
|
27
|
+
const embedded = useEmbeddedWallet();
|
|
28
|
+
const owner = embedded?.address;
|
|
29
|
+
const [derived, setDerived] = useState();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!owner) return;
|
|
32
|
+
let cancelled = false;
|
|
33
|
+
getKernelAddress(publicClient(), owner).then((address) => {
|
|
34
|
+
if (!cancelled) setDerived({ owner, address });
|
|
35
|
+
}).catch(() => {
|
|
36
|
+
});
|
|
37
|
+
return () => {
|
|
38
|
+
cancelled = true;
|
|
39
|
+
};
|
|
40
|
+
}, [owner]);
|
|
41
|
+
const smartAccount = derived && derived.owner === owner ? derived.address : void 0;
|
|
42
|
+
return {
|
|
43
|
+
...owner ? { owner } : {},
|
|
44
|
+
...smartAccount ? { smartAccount } : {},
|
|
45
|
+
ready: owner !== void 0 && smartAccount !== void 0
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function useDirectSponsoredSend(o = {}) {
|
|
49
|
+
const { getAccessToken } = usePrivy();
|
|
50
|
+
const embedded = useEmbeddedWallet();
|
|
51
|
+
const [status, setStatus] = useState("idle");
|
|
52
|
+
const [result, setResult] = useState();
|
|
53
|
+
const [error, setError] = useState();
|
|
54
|
+
const inFlight = useRef(false);
|
|
55
|
+
const send = useCallback(
|
|
56
|
+
async (calls) => {
|
|
57
|
+
if (inFlight.current) {
|
|
58
|
+
throw new PepuConfigError("UNKNOWN", "A sponsored send is already in progress.", {
|
|
59
|
+
hint: "Wait for the current send to finish."
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
inFlight.current = true;
|
|
63
|
+
setStatus("signing");
|
|
64
|
+
setError(void 0);
|
|
65
|
+
setResult(void 0);
|
|
66
|
+
try {
|
|
67
|
+
if (!embedded) {
|
|
68
|
+
throw new PepuConfigError("WALLET_NOT_PROVISIONED", "No Privy embedded wallet to own the smart account.");
|
|
69
|
+
}
|
|
70
|
+
const pc = publicClient();
|
|
71
|
+
const provider = await embedded.getEthereumProvider();
|
|
72
|
+
const owner = createWalletClient({
|
|
73
|
+
account: embedded.address,
|
|
74
|
+
chain: pepuMainnet,
|
|
75
|
+
transport: custom(provider)
|
|
76
|
+
});
|
|
77
|
+
const token = await getAccessToken();
|
|
78
|
+
const account = await toPepuKernelAccount({ publicClient: pc, owner });
|
|
79
|
+
const kernel = createPepuSponsoredClient({
|
|
80
|
+
account,
|
|
81
|
+
publicClient: pc,
|
|
82
|
+
...o.bundlerUrl !== void 0 ? { bundlerUrl: o.bundlerUrl } : {},
|
|
83
|
+
...o.paymasterUrl !== void 0 ? { paymasterUrl: o.paymasterUrl } : {},
|
|
84
|
+
...token ? { paymasterContext: buildPaymasterContext({ privyAccessToken: token }) } : {}
|
|
85
|
+
});
|
|
86
|
+
setStatus("submitting");
|
|
87
|
+
const out = await sendSponsored({ client: kernel, calls });
|
|
88
|
+
setResult(out);
|
|
89
|
+
setStatus("confirmed");
|
|
90
|
+
return out;
|
|
91
|
+
} catch (caught) {
|
|
92
|
+
const err = toPepuError(caught) === caught ? caught : describeUserOpFailure(caught);
|
|
93
|
+
setError(err);
|
|
94
|
+
setStatus("error");
|
|
95
|
+
throw err;
|
|
96
|
+
} finally {
|
|
97
|
+
inFlight.current = false;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
[embedded, getAccessToken, o.bundlerUrl, o.paymasterUrl]
|
|
101
|
+
);
|
|
102
|
+
return { send, status, ...result ? { result } : {}, ...error ? { error } : {} };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { useDirectSmartAccount, useDirectSponsoredSend };
|
|
106
|
+
//# sourceMappingURL=react-direct.js.map
|
|
107
|
+
//# sourceMappingURL=react-direct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/aa/react-direct.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA0BA,IAAI,YAAA;AACJ,SAAS,YAAA,GAA6B;AACpC,EAAA,YAAA,KAAiB,gBAAgB,WAAW,CAAA;AAC5C,EAAA,OAAO,YAAA;AACT;AAEA,SAAS,iBAAA,GAAoB;AAC3B,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,UAAA,EAAW;AAC/B,EAAA,OAAO,QAAQ,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,qBAAqB,OAAO,CAAA;AAC3D;AAUO,SAAS,qBAAA,GAAqF;AACnG,EAAA,MAAM,WAAW,iBAAA,EAAkB;AACnC,EAAA,MAAM,QAAQ,QAAA,EAAU,OAAA;AACxB,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,QAAA,EAA2D;AAEzF,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,KAAA,EAAO;AACZ,IAAA,IAAI,SAAA,GAAY,KAAA;AAChB,IAAA,gBAAA,CAAiB,cAAa,EAAG,KAAK,CAAA,CACnC,IAAA,CAAK,CAAC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CAAU,GAAG,CAAA;AACb,QAAA,SAAA,CAAU,WAAW,CAAA;AACrB,QAAA,OAAO,GAAA;AAAA,MACT,SAAS,MAAA,EAAQ;AACf,QAAA,MAAM,MAAM,WAAA,CAAY,MAAM,MAAM,MAAA,GAAU,MAAA,GAAuB,sBAAsB,MAAM,CAAA;AACjG,QAAA,QAAA,CAAS,GAAG,CAAA;AACZ,QAAA,SAAA,CAAU,OAAO,CAAA;AACjB,QAAA,MAAM,GAAA;AAAA,MACR,CAAA,SAAE;AACA,QAAA,QAAA,CAAS,OAAA,GAAU,KAAA;AAAA,MACrB;AAAA,IACF,CAAA;AAAA,IACA,CAAC,QAAA,EAAU,cAAA,EAAgB,CAAA,CAAE,UAAA,EAAY,EAAE,YAAY;AAAA,GACzD;AAEA,EAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAI,MAAA,GAAS,EAAE,MAAA,EAAO,GAAI,EAAC,EAAI,GAAI,KAAA,GAAQ,EAAE,KAAA,EAAM,GAAI,EAAC,EAAG;AACpF","file":"react-direct.js","sourcesContent":["/**\n * @pepu-chain/sdk/aa/react-direct: React hooks for sponsored transactions that\n * go through your own bundler and paymaster (no Privy Smart Wallets).\n *\n * Needs `react`, `@privy-io/react-auth` and the optional peers `@zerodev/sdk`\n * and `@zerodev/ecdsa-validator`. It builds a Kernel account for the Privy\n * embedded wallet and passes the Privy access token as paymaster context for\n * the free tier. Apps on Privy Smart Wallets use `@pepu-chain/sdk/aa/react`\n * instead, which never resolves ZeroDev.\n */\nimport { usePrivy, useWallets } from \"@privy-io/react-auth\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { createWalletClient, custom } from \"viem\";\nimport type { Address, PublicClient } from \"viem\";\n\nimport { pepuMainnet } from \"../chains.js\";\nimport { getPublicClient } from \"../client.js\";\nimport { PepuConfigError, toPepuError } from \"../errors.js\";\nimport type { PepuError } from \"../errors.js\";\nimport { buildPaymasterContext } from \"../erc7677.js\";\nimport { describeUserOpFailure } from \"./describe.js\";\nimport { getKernelAddress, createPepuSponsoredClient, sendSponsored, toPepuKernelAccount } from \"./kernel.js\";\nimport type { Call, SponsoredResult } from \"./types.js\";\n\nexport type { Call, SponsoredResult } from \"./types.js\";\n\nlet sharedClient: PublicClient | undefined;\nfunction publicClient(): PublicClient {\n sharedClient ??= getPublicClient(pepuMainnet) as unknown as PublicClient;\n return sharedClient;\n}\n\nfunction useEmbeddedWallet() {\n const { wallets } = useWallets();\n return wallets.find((w) => w.walletClientType === \"privy\");\n}\n\n/**\n * The two-address model for the direct transport: `owner` is the Privy\n * embedded wallet (an EOA that signs), `smartAccount` is the Kernel address\n * derived from it with {@link getKernelAddress} (a read).\n *\n * @example\n * const { owner, smartAccount, ready } = useDirectSmartAccount();\n */\nexport function useDirectSmartAccount(): { owner?: Address; smartAccount?: Address; ready: boolean } {\n const embedded = useEmbeddedWallet();\n const owner = embedded?.address as Address | undefined;\n const [derived, setDerived] = useState<{ owner: Address; address: Address } | undefined>();\n\n useEffect(() => {\n if (!owner) return;\n let cancelled = false;\n getKernelAddress(publicClient(), owner)\n .then((address) => {\n if (!cancelled) setDerived({ owner, address });\n })\n .catch(() => {\n // Derivation is best effort; `ready` stays false.\n });\n return () => {\n cancelled = true;\n };\n }, [owner]);\n\n const smartAccount = derived && derived.owner === owner ? derived.address : undefined;\n return {\n ...(owner ? { owner } : {}),\n ...(smartAccount ? { smartAccount } : {}),\n ready: owner !== undefined && smartAccount !== undefined,\n };\n}\n\n/** Status of a {@link useDirectSponsoredSend} send. */\nexport type DirectSponsoredSendStatus = \"idle\" | \"signing\" | \"submitting\" | \"confirmed\" | \"error\";\n\n/** Options for {@link useDirectSponsoredSend}. */\nexport interface UseDirectSponsoredSendOptions {\n bundlerUrl?: string;\n paymasterUrl?: string;\n}\n\n/**\n * Send calls with gas sponsored through your own bundler and paymaster. Builds\n * a Kernel account for the embedded wallet and passes the Privy access token\n * as paymaster context for the free tier. One send at a time: a second call\n * while one is in flight is ignored.\n *\n * @example\n * const { send, status, result, error } = useDirectSponsoredSend();\n * await send([{ to: tapScore, abi: tapScoreAbi, functionName: \"tap\" }]);\n */\nexport function useDirectSponsoredSend(o: UseDirectSponsoredSendOptions = {}): {\n send: (calls: Call[]) => Promise<SponsoredResult>;\n status: DirectSponsoredSendStatus;\n result?: SponsoredResult;\n error?: PepuError;\n} {\n const { getAccessToken } = usePrivy();\n const embedded = useEmbeddedWallet();\n const [status, setStatus] = useState<DirectSponsoredSendStatus>(\"idle\");\n const [result, setResult] = useState<SponsoredResult | undefined>();\n const [error, setError] = useState<PepuError | undefined>();\n const inFlight = useRef(false);\n\n const send = useCallback(\n async (calls: Call[]): Promise<SponsoredResult> => {\n if (inFlight.current) {\n throw new PepuConfigError(\"UNKNOWN\", \"A sponsored send is already in progress.\", {\n hint: \"Wait for the current send to finish.\",\n });\n }\n inFlight.current = true;\n setStatus(\"signing\");\n setError(undefined);\n setResult(undefined);\n try {\n if (!embedded) {\n throw new PepuConfigError(\"WALLET_NOT_PROVISIONED\", \"No Privy embedded wallet to own the smart account.\");\n }\n const pc = publicClient();\n const provider = await embedded.getEthereumProvider();\n const owner = createWalletClient({\n account: embedded.address as Address,\n chain: pepuMainnet,\n transport: custom(provider),\n });\n const token = await getAccessToken();\n const account = await toPepuKernelAccount({ publicClient: pc, owner });\n const kernel = createPepuSponsoredClient({\n account,\n publicClient: pc,\n ...(o.bundlerUrl !== undefined ? { bundlerUrl: o.bundlerUrl } : {}),\n ...(o.paymasterUrl !== undefined ? { paymasterUrl: o.paymasterUrl } : {}),\n ...(token ? { paymasterContext: buildPaymasterContext({ privyAccessToken: token }) } : {}),\n });\n setStatus(\"submitting\");\n const out = await sendSponsored({ client: kernel, calls });\n setResult(out);\n setStatus(\"confirmed\");\n return out;\n } catch (caught) {\n const err = toPepuError(caught) === caught ? (caught as PepuError) : describeUserOpFailure(caught);\n setError(err);\n setStatus(\"error\");\n throw err;\n } finally {\n inFlight.current = false;\n }\n },\n [embedded, getAccessToken, o.bundlerUrl, o.paymasterUrl],\n );\n\n return { send, status, ...(result ? { result } : {}), ...(error ? { error } : {}) };\n}\n"]}
|