@getpara/aa-rhinestone 2.16.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.
@@ -0,0 +1,12 @@
1
+ import type { SmartAccount4337 } from '@getpara/viem-v2-integration';
2
+ import type { CreateRhinestoneSmartAccountParams } from './types.js';
3
+ export type { CreateRhinestoneSmartAccountParams } from './types.js';
4
+ /**
5
+ * Creates a Rhinestone smart account using Para for signing (EIP-4337 only).
6
+ *
7
+ * Uses Pimlico-backed bundler and paymaster infrastructure for UserOperation execution.
8
+ *
9
+ * @param params - Configuration parameters
10
+ * @returns Unified SmartAccount interface wrapping Rhinestone account, or null if no EVM wallet exists
11
+ */
12
+ export declare function createRhinestoneSmartAccount(params: CreateRhinestoneSmartAccountParams): Promise<SmartAccount4337 | null>;
package/dist/action.js ADDED
@@ -0,0 +1,63 @@
1
+ import { RhinestoneSDK } from "@rhinestone/sdk";
2
+ import { createParaAccount } from "@getpara/viem-v2-integration";
3
+ import { SmartAccountError, wrapProviderError, resolveWalletIdentifier } from "@getpara/viem-v2-integration";
4
+ import { createPublicClient, http } from "viem";
5
+ async function createRhinestoneSmartAccount(params) {
6
+ const { para, chain, rpcUrl, rhinestoneApiKey, pimlicoApiKey } = params;
7
+ const walletAddress = resolveWalletIdentifier(para, params);
8
+ if (!walletAddress) return null;
9
+ const viemAccount = createParaAccount(para, walletAddress);
10
+ const publicClient = createPublicClient({
11
+ chain,
12
+ transport: http(rpcUrl)
13
+ });
14
+ const pimlicoUrl = pimlicoApiKey ? `https://api.pimlico.io/v2/${chain.id}/rpc?apikey=${pimlicoApiKey}` : void 0;
15
+ const rhinestone = new RhinestoneSDK({
16
+ apiKey: rhinestoneApiKey || "",
17
+ ...pimlicoUrl && {
18
+ bundler: { type: "custom", url: pimlicoUrl },
19
+ paymaster: { type: "pimlico", apiKey: pimlicoApiKey }
20
+ }
21
+ });
22
+ const rhinestoneAccount = await rhinestone.createAccount({
23
+ owners: {
24
+ type: "ecdsa",
25
+ accounts: [viemAccount]
26
+ }
27
+ });
28
+ const accountAddress = rhinestoneAccount.getAddress();
29
+ const sendBatchTransaction = async (calls) => {
30
+ if (!chain) {
31
+ throw new SmartAccountError({
32
+ code: "MISSING_CHAIN",
33
+ message: "Rhinestone requires a chain",
34
+ provider: "RHINESTONE"
35
+ });
36
+ }
37
+ try {
38
+ const userOpResult = await rhinestoneAccount.sendUserOperation({
39
+ chain,
40
+ calls: calls.map((c) => ({ to: c.to, value: c.value || BigInt(0), data: c.data || "0x" }))
41
+ });
42
+ const result = await rhinestoneAccount.waitForExecution(userOpResult);
43
+ const txHash = result.receipt.transactionHash;
44
+ return publicClient.getTransactionReceipt({ hash: txHash });
45
+ } catch (error) {
46
+ throw wrapProviderError(error, "RHINESTONE");
47
+ }
48
+ };
49
+ const sendTransaction = async (tx) => sendBatchTransaction([tx]);
50
+ return {
51
+ smartAccountAddress: accountAddress,
52
+ signer: viemAccount,
53
+ chain,
54
+ mode: "4337",
55
+ provider: "RHINESTONE",
56
+ sendTransaction,
57
+ sendBatchTransaction,
58
+ client: rhinestoneAccount
59
+ };
60
+ }
61
+ export {
62
+ createRhinestoneSmartAccount
63
+ };
@@ -0,0 +1,2 @@
1
+ export { createRhinestoneSmartAccount } from './action.js';
2
+ export type { RhinestoneSmartAccountConfig, CreateRhinestoneSmartAccountParams, UseRhinestoneSmartAccountParams, } from './types.js';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createRhinestoneSmartAccount } from "./action.js";
2
+ export {
3
+ createRhinestoneSmartAccount
4
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,32 @@
1
+ import type { ChainBasedSmartAccountConfig, CreateSmartAccountParams } from '@getpara/viem-v2-integration';
2
+ /**
3
+ * Configuration for Rhinestone smart account.
4
+ *
5
+ * EIP-4337 only. Uses Rhinestone's orchestrator with optional Pimlico
6
+ * bundler and paymaster infrastructure.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const config: RhinestoneSmartAccountConfig = {
11
+ * chain: baseSepolia,
12
+ * rhinestoneApiKey: 'YOUR_RHINESTONE_API_KEY',
13
+ * pimlicoApiKey: 'YOUR_PIMLICO_API_KEY',
14
+ * };
15
+ * ```
16
+ */
17
+ export interface RhinestoneSmartAccountConfig extends ChainBasedSmartAccountConfig {
18
+ /** Rhinestone API key */
19
+ rhinestoneApiKey?: string;
20
+ /** Pimlico API key for bundler and paymaster infrastructure */
21
+ pimlicoApiKey?: string;
22
+ }
23
+ /**
24
+ * Parameters for `createRhinestoneSmartAccount`.
25
+ * Includes all config fields plus `para` (the Para SDK instance).
26
+ */
27
+ export type CreateRhinestoneSmartAccountParams = CreateSmartAccountParams<RhinestoneSmartAccountConfig>;
28
+ /**
29
+ * Parameters for the `useRhinestoneSmartAccount` hook.
30
+ * Same as {@link RhinestoneSmartAccountConfig} — `para` is provided automatically via context.
31
+ */
32
+ export type UseRhinestoneSmartAccountParams = RhinestoneSmartAccountConfig;
package/dist/types.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@getpara/aa-rhinestone",
3
+ "version": "2.16.0",
4
+ "description": "Rhinestone smart account integration for Para",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "files": [
10
+ "dist",
11
+ "package.json"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs",
21
+ "typegen": "tsc --emitDeclarationOnly --outDir dist",
22
+ "test": "vitest run --coverage"
23
+ },
24
+ "dependencies": {
25
+ "@getpara/viem-v2-integration": "2.16.0",
26
+ "@rhinestone/module-sdk": "0.4.0",
27
+ "@rhinestone/sdk": "^1.2.14",
28
+ "permissionless": "^0.2.12"
29
+ },
30
+ "peerDependencies": {
31
+ "viem": ">=2.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "typescript": "^5.8.3"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "gitHead": "fbe96a062b308d04105213378c12c38ee973c798"
40
+ }