### Setup Account Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/customize/bring-your-own-account.mdx Install the intent executor and necessary validators for an existing account to be usable with the SDK. This is a one-time setup per chain, per account. ```typescript await rhinestoneAccount.setup(chain) ``` -------------------------------- ### Clone and Run Example Repository Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/external-wallet-signer.mdx Clone the Rhinestone e2e-examples repository and navigate to the AppKit example to run the full integration. ```bash git clone https://github.com/rhinestonewtf/e2e-examples.git cd e2e-examples/reown npm install && npm run dev ``` -------------------------------- ### Install Dependencies (npm) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/external-wallet-signer.mdx Install the necessary packages for Rhinestone SDK, viem, and AppKit using npm. ```bash npm install @rhinestone/sdk viem @reown/appkit @reown/appkit-adapter-wagmi wagmi ``` -------------------------------- ### Install Dependencies (bun) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/turnkey.mdx Install the necessary dependencies for Turnkey and Rhinestone integration using bun. ```bash bun install @turnkey/http @turnkey/api-key-stamper @turnkey/viem @rhinestone/sdk viem ``` -------------------------------- ### Install Dependencies (bun) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/external-wallet-signer.mdx Install the necessary packages for Rhinestone SDK, viem, and AppKit using bun. ```bash bun install @rhinestone/sdk viem @reown/appkit @reown/appkit-adapter-wagmi wagmi ``` -------------------------------- ### Install Dependencies Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/openfort.mdx Install the necessary packages for Openfort, React Query, Rhinestone SDK, viem, and wagmi using npm, pnpm, or bun. ```bash npm install @openfort/react @tanstack/react-query @rhinestone/sdk viem wagmi ``` ```bash pnpm add @openfort/react @tanstack/react-query @rhinestone/sdk viem wagmi ``` ```bash bun install @openfort/react @tanstack/react-query @rhinestone/sdk viem wagmi ``` -------------------------------- ### Install Rhinestone SDK and Viem Source: https://github.com/rhinestonewtf/docs/blob/main/home/resources/quick-reference.mdx Install the necessary packages for using the Rhinestone SDK and Viem for blockchain interactions. ```bash npm install @rhinestone/sdk viem ``` -------------------------------- ### Get Session Details and Signature for Enabling Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/smart-sessions/multi-session-signature.mdx Obtain the necessary data and signature to prepare a session for installation on a target chain. This signature can be reused for multiple installations. ```typescript const sessionDetails = await rhinestoneAccount.experimental_getSessionDetails(sessions) const enableSignature = await rhinestoneAccount.experimental_signEnableSession(sessionDetails) const sessionIndex = 0 // Which session to enable ``` -------------------------------- ### Install Rhinestone SDK with bun Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/overview.mdx Install the Rhinestone SDK and viem using bun. bun is a fast all-in-one JavaScript runtime. ```bash bun add viem @rhinestone/sdk ``` -------------------------------- ### Deploy Account with Custom Modules Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/custom-modules.mdx Install custom modules during account creation by specifying them in the `modules` field. This makes modules available from the start. ```typescript import { RhinestoneSDK } from '@rhinestone/sdk' const rhinestone = new RhinestoneSDK({ apiKey }) const rhinestoneAccount = await rhinestone.createAccount({ owners: { type: 'ecdsa', accounts: [owner], }, modules: [ { type: 'executor', address: MODULE_ADDRESS, // Optional initData: MODULE_DATA, }, ], }) ``` -------------------------------- ### Install Dependencies (pnpm) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/external-wallet-signer.mdx Install the necessary packages for Rhinestone SDK, viem, and AppKit using pnpm. ```bash pnpm add @rhinestone/sdk viem @reown/appkit @reown/appkit-adapter-wagmi wagmi ``` -------------------------------- ### Install Dependencies (npm) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/turnkey.mdx Install the necessary dependencies for Turnkey and Rhinestone integration using npm. ```bash npm install @turnkey/http @turnkey/api-key-stamper @turnkey/viem @rhinestone/sdk viem ``` -------------------------------- ### Install Mintlify CLI Source: https://github.com/rhinestonewtf/docs/blob/main/README.md Install the Mintlify CLI globally using npm. This is required for local development. ```bash npm i -g mintlify ``` -------------------------------- ### Cloning and Running the Dynamic Example Repository Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/dynamic.mdx Clone the e2e-examples repository and run the dynamic integration to see the full implementation. ```bash git clone https://github.com/rhinestonewtf/e2e-examples.git cd e2e-examples/dynamic npm install && npm run dev ``` -------------------------------- ### Install Dependencies with npm, pnpm, or bun Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/magic.mdx Install the necessary packages for Magic SDK, Rhinestone SDK, and viem. Choose the package manager that suits your project. ```bash npm install magic-sdk @rhinestone/sdk viem ``` ```bash pnpm add magic-sdk @rhinestone/sdk viem ``` ```bash bun install magic-sdk @rhinestone/sdk viem ``` -------------------------------- ### Install Latest SDK Version Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/migration-guide.mdx To use the latest features, install the SDK with the `alpha` tag. This command updates your project to the newest version. ```bash npm i @rhinestone/sdk@alpha ``` -------------------------------- ### Install Dependencies (pnpm) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/turnkey.mdx Install the necessary dependencies for Turnkey and Rhinestone integration using pnpm. ```bash pnpm add @turnkey/http @turnkey/api-key-stamper @turnkey/viem @rhinestone/sdk viem ``` -------------------------------- ### Start Local Development Server Source: https://github.com/rhinestonewtf/docs/blob/main/README.md Run the Mintlify development server from the root of your documentation project. Ensure docs.json is present. ```bash mintlify dev ``` -------------------------------- ### Install Dependencies for Deposit Widget Source: https://github.com/rhinestonewtf/docs/blob/main/deposits/widget/quickstart.mdx Install the necessary packages for the deposit widget, including core components, wallet integration, and chain-specific libraries. Note that Solana libraries are included by default but can be excluded. ```bash npm install @rhinestone/deposit-modal viem wagmi @tanstack/react-query @reown/appkit @reown/appkit-adapter-wagmi @solana/web3.js @solana/spl-token ``` -------------------------------- ### Install Rhinestone SDK with npm Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/overview.mdx Install the Rhinestone SDK and viem using npm. This is the primary package manager for Node.js. ```bash npm install viem @rhinestone/sdk ``` -------------------------------- ### Complete Multi-Chain Session Workflow Example Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/smart-sessions/multi-session-signature.mdx This example shows how to create a Rhinestone account, define sessions for multiple chains, obtain session details, sign the enable data once, and then use that signature to prepare and submit transactions on different chains. It highlights the reusability of the session signature across chains. ```typescript import { RhinestoneSDK } from '@rhinestone/sdk' import { toSession } from '@rhinestone/sdk/smart-sessions' import { zeroAddress } from 'viem' import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts' import { baseSepolia, optimismSepolia } from 'viem/chains' const ownerAccount = privateKeyToAccount('0x…') const sessionOwnerAccount = privateKeyToAccount(generatePrivateKey()) const rhinestone = new RhinestoneSDK({ apiKey: rhinestoneApiKey, }) const rhinestoneAccount = await rhinestone.createAccount({ owners: { type: 'ecdsa', accounts: [ownerAccount], }, }) // Define the sessions, one per chain const sessions = [ toSession({ chain: baseSepolia, owners: { type: 'ecdsa', accounts: [sessionOwnerAccount], }, }), toSession({ chain: optimismSepolia, owners: { type: 'ecdsa', accounts: [sessionOwnerAccount], }, }), ] // Get the session details and sign once const sessionDetails = await rhinestoneAccount.experimental_getSessionDetails(sessions) const enableSignature = await rhinestoneAccount.experimental_signEnableSession(sessionDetails) // Build the per-chain sessions map with enable data // The SDK resolves the right session and enable data automatically per chain const signers = { type: 'experimental_session' as const, sessions: { [baseSepolia.id]: { session: sessions[0], enableData: { userSignature: enableSignature, hashesAndChainIds: sessionDetails.hashesAndChainIds, sessionToEnableIndex: 0, }, }, [optimismSepolia.id]: { session: sessions[1], enableData: { userSignature: enableSignature, hashesAndChainIds: sessionDetails.hashesAndChainIds, sessionToEnableIndex: 1, }, }, }, } // Submit on Base const dataBase = await rhinestoneAccount.prepareTransaction({ chain: baseSepolia, calls: [{ to: zeroAddress, data: '0xdeadbeef' }], tokenRequests: [], signers, }) const signedDataBase = await rhinestoneAccount.signTransaction(dataBase) await rhinestoneAccount.submitTransaction(signedDataBase) // Submit on Optimism (reusing the same signature and signers map) const dataOptimism = await rhinestoneAccount.prepareTransaction({ chain: optimismSepolia, calls: [{ to: zeroAddress, data: '0xdeadbeef' }], tokenRequests: [], signers, }) const signedDataOptimism = await rhinestoneAccount.signTransaction(dataOptimism) await rhinestoneAccount.submitTransaction(signedDataOptimism) ``` -------------------------------- ### Install Dependencies with npm, pnpm, and bun Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/dynamic.mdx Install the necessary packages for Dynamic, Rhinestone, wagmi, and TanStack Query using your preferred package manager. ```bash npm install @dynamic-labs/sdk-react-core @dynamic-labs/ethereum @dynamic-labs/wagmi-connector @tanstack/react-query @rhinestone/sdk viem wagmi ``` ```bash pnpm add @dynamic-labs/sdk-react-core @dynamic-labs/ethereum @dynamic-labs/wagmi-connector @tanstack/react-query @rhinestone/sdk viem wagmi ``` ```bash bun install @dynamic-labs/sdk-react-core @dynamic-labs/ethereum @dynamic-labs/wagmi-connector @tanstack/react-query @rhinestone/sdk viem wagmi ``` -------------------------------- ### Install Rhinestone SDK and Dependencies Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/quickstart.mdx Install the necessary packages for using the Rhinestone SDK and Viem. Choose the command corresponding to your package manager (npm, pnpm, or bun). ```bash npm install viem @rhinestone/sdk@beta ``` ```bash pnpm add viem @rhinestone/sdk@beta ``` ```bash bun install viem @rhinestone/sdk@beta ``` -------------------------------- ### Install Dependencies with npm, pnpm, or bun Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/privy.mdx Install the necessary packages for Privy, wagmi, and Rhinestone integration. Ensure you use Privy's wrappers for wagmi. ```bash npm install @privy-io/react-auth @privy-io/wagmi @tanstack/react-query @rhinestone/sdk viem wagmi ``` ```bash pnpm add @privy-io/react-auth @privy-io/wagmi @tanstack/react-query @rhinestone/sdk viem wagmi ``` ```bash bun install @privy-io/react-auth @privy-io/wagmi @tanstack/react-query @rhinestone/sdk viem wagmi ``` -------------------------------- ### Install Rhinestone SDK with pnpm Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/overview.mdx Install the Rhinestone SDK and viem using pnpm. pnpm is a fast, disk-space-efficient package manager. ```bash pnpm add viem @rhinestone/sdk ``` -------------------------------- ### Create a Basic Session Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/smart-sessions/overview.mdx Use `toSession` to create a new session. This basic example sets up the chain and owners. ```typescript import { toSession } from '@rhinestone/sdk/smart-sessions' const session = toSession({ chain: base, owners: { type: 'ecdsa', accounts: [sessionOwnerAccount], }, }) ``` -------------------------------- ### Install Dependencies for Para and Rhinestone Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/para.mdx Install the necessary packages for integrating Para MPC wallets with Rhinestone using npm, pnpm, or bun. ```bash npm install @getpara/react-sdk @getpara/viem @rhinestone/sdk viem @tanstack/react-query ``` ```bash pnpm add @getpara/react-sdk @getpara/viem @rhinestone/sdk viem @tanstack/react-query ``` ```bash bun install @getpara/react-sdk @getpara/viem @rhinestone/sdk viem @tanstack/react-query ``` -------------------------------- ### Register Account Request Source: https://github.com/rhinestonewtf/docs/blob/main/deposits/api/account-registration.mdx Example of a request to register an account. Ensure all required fields are populated. ```javascript // { isRegistered: true, targetChain: "eip155:42161", sources: [...] } ``` -------------------------------- ### Install Smart Sessions on an Existing Account Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/tutorials/session-keys.mdx If an account already exists, you can install the Smart Sessions module in a separate transaction. This involves preparing and submitting a transaction that calls the `experimental_enable` action. ```typescript import { experimental_enable } from '@rhinestone/sdk/actions/smart-sessions' const transaction = await rhinestoneAccount.prepareTransaction({ chain: base, calls: [experimental_enable()], }) const signed = await rhinestoneAccount.signTransaction(transaction) const result = await rhinestoneAccount.submitTransaction(signed) await rhinestoneAccount.waitForExecution(result) ``` -------------------------------- ### Install Smart Sessions on a New Account Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/tutorials/session-keys.mdx Enable the Smart Sessions module when creating a new account. This is done during the account creation process by setting `experimental_sessions.enabled` to true. ```typescript import { RhinestoneSDK } from '@rhinestone/sdk' const rhinestone = new RhinestoneSDK({ apiKey: process.env.RHINESTONE_API_KEY as string, }) const rhinestoneAccount = await rhinestone.createAccount({ owners: { type: 'ecdsa', accounts: [ownerAccount], }, experimental_sessions: { enabled: true, }, }) ``` -------------------------------- ### MDX Frontmatter Example Source: https://github.com/rhinestonewtf/docs/blob/main/AGENTS.md Standard frontmatter for MDX files, including title and description. ```mdx --- title: "Page Title" description: "Short description or empty string." --- ``` -------------------------------- ### Create a Multisig Passkey Account (2-of-2) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/passkeys.mdx Set up a multisig smart account where a specific number of passkeys are required for authorization. This example demonstrates a 2-of-2 threshold. ```typescript const account = await rhinestone.createAccount({ owners: { type: 'passkey', accounts: [passkeyAccountA, passkeyAccountB], threshold: 2, // 2-of-2: both devices must sign }, }) ``` -------------------------------- ### Shared Constants for Deposit API Source: https://github.com/rhinestonewtf/docs/blob/main/deposits/api/initial-setup.mdx These constants are used across various Deposit API setup examples. Ensure you replace 'YOUR_RHINESTONE_API_KEY' with your actual API key. ```typescript const DEPOSIT_SERVICE_URL = "https://v1.orchestrator.rhinestone.dev/deposit-processor"; const API_KEY = "YOUR_RHINESTONE_API_KEY"; const headers = { "Content-Type": "application/json", "x-api-key": API_KEY, }; ``` -------------------------------- ### Install Intent Executor Module Source: https://github.com/rhinestonewtf/docs/blob/main/intents/guides/installing-intent-executor.mdx Use the `installModule` action from the Rhinestone SDK to install the Intent Executor. Ensure the module is installed on every chain where Rhinestone intents will be used. ```typescript import { installModule } from '@rhinestone/sdk/actions' const transaction = await rhinestoneAccount.prepareTransaction({ targetChain: base, calls: [ installModule({ address: '0x00000000005aD9ce1f5035FD62CA96CEf16AdAAF', type: 'executor', }), ], }) ``` -------------------------------- ### Verify Intent Executor Installation Source: https://github.com/rhinestonewtf/docs/blob/main/intents/guides/installing-intent-executor.mdx Check if the Intent Executor module is installed on a smart account by calling the `isInitialized` function on the Intent Executor contract. This function returns `true` if the module has been installed. ```typescript import { createPublicClient, http } from 'viem' import { base } from 'viem/chains' const publicClient = createPublicClient({ chain: base, transport: http(), }) const isInstalled = await publicClient.readContract({ address: '0x00000000005aD9ce1f5035FD62CA96CEf16AdAAF', abi: [{ name: 'isInitialized', type: 'function', inputs: [{ name: 'smartAccount', type: 'address' }], outputs: [{ name: '', type: 'bool' }], stateMutability: 'view', }], functionName: 'isInitialized', args: [accountAddress], }) ``` -------------------------------- ### Run Local Preview with Custom Port Source: https://github.com/rhinestonewtf/docs/blob/main/CLAUDE.md Run a local preview of the documentation site on a custom port. Ensure Node 22 LTS is active. ```bash bunx mintlify dev --port 3333 ``` -------------------------------- ### Run Local Preview Source: https://github.com/rhinestonewtf/docs/blob/main/CLAUDE.md Run a local preview of the documentation site. Ensure Node 22 LTS is active. ```bash bunx mintlify dev ``` -------------------------------- ### Steps Component for Numbered Tutorials Source: https://github.com/rhinestonewtf/docs/blob/main/AGENTS.md Use the Steps and Step components to structure numbered tutorials. ```mdx Content... Content... ``` -------------------------------- ### Initialize Magic SDK Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/magic.mdx Set up the Magic SDK instance in your React application using your publishable API key. This is required for all subsequent Magic interactions. ```tsx import { Magic } from 'magic-sdk' const magic = new Magic(process.env.NEXT_PUBLIC_MAGIC_API_KEY) ``` -------------------------------- ### Start and Stop Docker Stack Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/chain-abstraction/local-orchestrator-docker.mdx Commands to start the Docker Compose stack in detached mode and to stop and remove the containers, networks, and volumes. ```bash docker compose up -d docker compose down ``` -------------------------------- ### Get a Quote for an Intent Source: https://github.com/rhinestonewtf/docs/blob/main/CLAUDE.md This endpoint allows you to get a quote for a given intent. It helps in understanding the potential costs or requirements before submitting the intent. ```APIDOC ## POST /intents/route ### Description Get a quote for a specified intent. This helps in estimating the resources or costs associated with executing an intent. ### Method POST ### Endpoint `https://v1.orchestrator.rhinestone.dev/intents/route` ### Parameters #### Request Body - **intent** (object) - Required - The intent object for which to get a quote. - **header** (object) - Required - The header of the intent. - **chainId** (number) - Required - The chain ID where the intent will be executed. - **accountAddress** (string) - Required - The address of the smart account. - **validUntil** (number) - Required - The timestamp until which the intent is valid. - **nonce** (string) - Required - A unique nonce for the intent. - **simulation_type** (string) - Optional - The type of simulation to perform (e.g., 'allow_revert'). - **executor** (string) - Optional - The address of the executor to use. - **plugin** (string) - Optional - The address of the plugin to use. - **function_name** (string) - Optional - The name of the function to call. - **function_args** (string) - Optional - The arguments for the function call. ### Request Example ```json { "intent": { "header": { "chainId": 1, "accountAddress": "0x...", "validUntil": 1700000000, "nonce": "0x1" } }, "simulation_type": "allow_revert" } ``` ### Response #### Success Response (200) - **quote** (object) - Description of the quote details. - **total_gas** (string) - The total estimated gas for the intent. - **gas_price_wei** (string) - The gas price in Wei. - **verifying_contract** (string) - The address of the verifying contract. - **call_data** (string) - The call data for the intent. - **signature_encoding** (string) - The signature encoding format. - **valid_until** (number) - The timestamp until which the quote is valid. #### Response Example ```json { "quote": { "total_gas": "100000", "gas_price_wei": "20000000000", "verifying_contract": "0x...", "call_data": "0x...", "signature_encoding": "eip191", "valid_until": 1700000000 } } ``` ``` -------------------------------- ### Update Dependencies for Orchestrator SDK Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/migration-guide.mdx The installation command for the Orchestrator SDK has changed. Remove the old SDK packages and install the new `@rhinestone/sdk` and `viem`. ```bash npm i @rhinestone/module-sdk @rhinestone/orchestrator-sdk permissionless viem ``` ```bash npm i @rhinestone/sdk viem ``` -------------------------------- ### Configure All Deposit Settings via POST /setup Source: https://github.com/rhinestonewtf/docs/blob/main/deposits/api/initial-setup.mdx Use this endpoint to set up webhook notifications, sponsorship rules, and token deposit whitelists simultaneously. Ensure the `DEPOSIT_SERVICE_URL` and `headers` are correctly configured before making the request. ```typescript await fetch(`${DEPOSIT_SERVICE_URL}/setup`, { method: "POST", headers, body: JSON.stringify({ params: { webhookUrl: "https://your-domain.com/notify", webhookSecret: "your-secret-key", sponsorship: { "eip155:8453": { gas: "all", bridging: "all" }, "eip155:10": { gas: "all" }, }, depositWhitelist: { "eip155:8453": [ { token: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", minAmount: "1000000", }, ], "eip165:42161": [ { token: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" }, ], }, maxPriceDeviationBps: 150, }, }), }); ``` -------------------------------- ### Get a Quote Source: https://github.com/rhinestonewtf/docs/blob/main/intents/quickstart.mdx Submit a meta intent to the /quotes endpoint to get a quote for a token swap. Specify destination chain, token, amount, and your account. ```typescript const BASE_URL = "https://v1.orchestrator.rhinestone.dev"; const API_KEY = "YOUR_RHINESTONE_API_KEY"; const EOA_ADDRESS = "0xYourEOAAddress"; const headers = { "Content-Type": "application/json", "x-api-key": API_KEY, "x-api-version": "2026-04.blanc", }; const res = await fetch(`${BASE_URL}/quotes`, { method: "POST", headers, body: JSON.stringify({ account: { address: EOA_ADDRESS, accountType: "EOA", }, destinationChainId: "eip155:8453", // Base tokenRequests: [ { tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base amount: "5000000", // 5 USDC (6 decimals) }, ], }), }); const { routes } = await res.json(); const route = routes[0]; const { intentId, signData, tokenRequirements } = route; ``` -------------------------------- ### Get a Quote for Intent Routing Source: https://github.com/rhinestonewtf/docs/blob/main/AGENTS.md This endpoint allows you to get a quote for routing an intent. It helps in determining the feasibility and potential cost of an intent execution. ```APIDOC ## POST /intents/route ### Description Get a quote for routing an intent. This helps in determining the feasibility and potential cost of an intent execution. ### Method POST ### Endpoint https://v1.orchestrator.rhinestone.dev/intents/route ### Parameters #### Request Body - **intent** (object) - Required - The intent object for which to get a quote. - **executor** (string) - Required - The address of the executor module. - **paymaster** (string) - Optional - The address of the paymaster. - **validUntil** (number) - Required - The timestamp until which the intent is valid. - **nonce** (string) - Required - The nonce for the intent. - **body** (object) - Required - The body of the intent, containing the actual operation details. - **to** (string) - Required - The target address for the operation. - **value** (string) - Optional - The value to send with the operation. - **data** (string) - Required - The calldata for the operation. ### Request Example ```json { "intent": { "executor": "0x...", "paymaster": "0x...", "validUntil": 1678886400, "nonce": "0x123", "body": { "to": "0x...", "value": "0x0", "data": "0x..." } } } ``` ### Response #### Success Response (200) - **quote** (string) - The quote for the intent routing. - **gasEstimate** (string) - The estimated gas for the intent execution. #### Response Example ```json { "quote": "0x...", "gasEstimate": "0x..." } ``` ``` -------------------------------- ### Create Rhinestone Account with API Key (Now) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/migration-guide.mdx This snippet demonstrates the new way to initialize the account, passing the API key directly during creation. ```typescript const account = privateKeyToAccount(generatePrivateKey()); const account = await createRhinestoneAccount({ rhinestoneApiKey: orchestratorApiKey, // … }) ``` -------------------------------- ### Configure Sponsorship Settings Source: https://github.com/rhinestonewtf/docs/blob/main/deposits/api/sponsorship.mdx Set up sponsorship for different fee types on a per-chain basis. This example shows how to sponsor all fees for Ethereum mainnet (via EIP-155 ID), only gas for Optimism, and gas for deployed accounts on Arbitrum. Chains not listed will have no sponsorship by default. ```typescript await fetch(`${DEPOSIT_SERVICE_URL}/setup`, { method: "POST", headers, body: JSON.stringify({ params: { sponsorship: { // Base: fully sponsored "eip155:8453": { gas: "all", bridging: "all", swap: "all" }, // Optimism: only gas "eip155:10": { gas: "all" }, // Arbitrum: gas for deployed accounts only "eip155:42161": { gas: "deployed" }, // Ethereum, Polygon: no sponsorship (not listed) }, }, }), }); ``` -------------------------------- ### Setup Rhinestone API and Viem Wallet Client Source: https://github.com/rhinestonewtf/docs/blob/main/intents/tutorial/end-to-end-intent-flow.mdx Initializes the necessary imports, constants, and clients for interacting with the Rhinestone API and a Viem wallet. Ensure you replace placeholder values with your actual API key and private key. ```typescript import { createWalletClient, http, erc20Abi, maxUint256 } from "viem"; import { base } from "viem/chains"; import { privateKeyToAccount } from "viem/accounts"; const BASE_URL = "https://v1.orchestrator.rhinestone.dev"; const API_KEY = "YOUR_RHINESTONE_API_KEY"; const headers = { "Content-Type": "application/json", "x-api-key": API_KEY, "x-api-version": "2026-04.blanc", }; const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY"); const walletClient = createWalletClient({ account, chain: base, transport: http(), }); const EOA_ADDRESS = account.address; ``` -------------------------------- ### GET /deposits Source: https://github.com/rhinestonewtf/docs/blob/main/deposits/api/status-tracking.mdx Query the GET /deposits endpoint with the txHash parameter to look up a deposit by its source transaction hash. This is useful for polling the status of a specific deposit. ```APIDOC ## GET /deposits ### Description Retrieves deposit information filtered by transaction hash. ### Method GET ### Endpoint /deposits ### Parameters #### Query Parameters - **txHash** (string) - Required - The transaction hash to filter deposits by. ### Response #### Success Response (200) - **deposits** (array) - An array of deposit objects. - **chain** (string) - Source chain (CAIP-2). - **txHash** (string) - Source transaction hash. - **token** (string) - Deposit token address. - **amount** (string) - Deposit amount (raw token units). - **sender** (string) - Sender address. - **account** (string) - Registered account address. - **targetChain** (string) - Destination chain (CAIP-2). - **targetToken** (string) - Destination token address. - **status** (string) - "processing", "completed", or "failed". - **sourceTxHash** (string | null) - Bridge source transaction hash. - **destinationTxHash** (string | null) - Bridge destination transaction hash. - **sourceAmount** (string | null) - Bridge source amount. - **destinationAmount** (string | null) - Bridge destination amount. - **errorCode** (string | null) - Error code if the deposit failed. - **createdAt** (string) - ISO 8601 timestamp of when the deposit was detected. - **completedAt** (string | null) - ISO 8601 timestamp of when the deposit completed. ### Request Example ```ts const DEPOSIT_SERVICE_URL = "https://v1.orchestrator.rhinestone.dev/deposit-processor"; const API_KEY = "YOUR_RHINESTONE_API_KEY"; const txHash = "0xabc123..."; const response = await fetch( `${DEPOSIT_SERVICE_URL}/deposits?txHash=${txHash}`, { headers: { "x-api-key": API_KEY }, }, ); const { deposits } = await response.json(); ``` ### Response Example ```json { "deposits": [ { "chain": "eip155:1", "txHash": "0xabc123...", "token": "0x1f9840a85d5af5bf1d1762f925bdad944705a00c", "amount": "1000000000000000000", "sender": "0x123...", "account": "0x456...", "targetChain": "eip155:137", "targetToken": "0x1f9840a85d5af5bf1d1762f925bdad944705a00c", "status": "processing", "sourceTxHash": null, "destinationTxHash": null, "sourceAmount": null, "destinationAmount": null, "errorCode": null, "createdAt": "2023-01-01T12:00:00Z", "completedAt": null } ] } ``` ``` -------------------------------- ### Get a Quote for a Vault Deposit Source: https://github.com/rhinestonewtf/docs/blob/main/intents/use-cases/vault-deposit.mdx Submit a meta intent to the /quotes endpoint to get a quote for a vault deposit. This includes setting up headers with API key and version. ```typescript const baseUrl = "https://v1.orchestrator.rhinestone.dev"; const apiKey = "YOUR_RHINESTONE_API_KEY"; const headers = { "Content-Type": "application/json", "x-api-key": apiKey, "x-api-version": "2026-04.blanc", }; const res = await fetch(`${baseUrl}/quotes`, { method: "POST", headers, body: JSON.stringify(metaIntent), }); const { routes } = await res.json(); const route = routes[0]; const { intentId, cost, signData, tokenRequirements } = route; ``` -------------------------------- ### Create Viem Account Delegating Signing to Backend Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/magic.mdx Create a viem account on the frontend that uses your backend for signing messages and typed data. This involves fetching the wallet address from your backend and implementing the signMessage and signTypedData methods to proxy requests. ```typescript import { RhinestoneSDK } from "@rhinestone/sdk" import { toAccount } from "viem/accounts" import { hashTypedData, hashMessage } from "viem" import type { SignableMessage, TypedDataDefinition, Hex } from "viem" // 1. Get wallet address from your backend const walletRes = await fetch("/api/wallet", { credentials: "include", }) const { public_address } = await walletRes.json() // 2. Create a viem account that signs via your backend const account = toAccount({ address: public_address as Hex, async signMessage({ message }: { message: SignableMessage }) { const hash = hashMessage(message) const res = await fetch("/api/sign", { method: "POST", headers: { "Content-Type": "application/json" }, credentials: "include", body: JSON.stringify({ hash }), }) if (!res.ok) throw new Error((await res.json()).error) return (await res.json()).signature as Hex }, async signTransaction() { throw new Error("signTransaction not supported") }, async signTypedData(typedData: TypedDataDefinition) { const hash = hashTypedData(typedData) const res = await fetch("/api/sign", { method: "POST", headers: { "Content-Type": "application/json" }, credentials: "include", body: JSON.stringify({ hash }), }) if (!res.ok) throw new Error((await res.json()).error) return (await res.json()).signature as Hex }, }) ``` -------------------------------- ### Set up Omni Account Modules (Before) Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/migration-guide.mdx This snippet details the manual configuration of module configurations for the Omni Account in the previous version. ```typescript const sourceSafeAccount = await toSafeSmartAccount({ // … executors: [ { address: getSameChainModuleAddress(targetChain.id), context: "0x", }, { address: getTargetModuleAddress(targetChain.id), context: "0x", }, { address: getHookAddress(targetChain.id), context: "0x", }, ], hooks: [ { address: getHookAddress(targetChain.id), context: encodeAbiParameters( [ { name: "hookType", type: "uint256" }, { name: "hookId", type: "bytes4" }, { name: "data", type: "bytes" }, ], [ 0n, "0x00000000", encodeAbiParameters([{ name: "value", type: "bool" }], [true]), ], ), }, ], fallbacks: [ { address: getTargetModuleAddress(targetChain.id), context: encodeAbiParameters( [ { name: "selector", type: "bytes4" }, { name: "flags", type: "bytes1" }, { name: "data", type: "bytes" }, ], ["0x3a5be8cb", "0x00", "0x"], ), }, ], }); ``` -------------------------------- ### Install Latest Rhinestone SDK Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/migration-guide.mdx Update your project dependencies to use the latest version of the Rhinestone SDK. ```bash npm i @rhinestone/sdk ``` -------------------------------- ### Set Up AppKit with Wagmi Adapter Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/core/signers/external-wallet-signer.mdx Configure AppKit for multi-wallet integration using the Wagmi adapter. Ensure you replace 'your-project-id' with your actual project ID from reown.com. ```tsx import { createAppKit } from '@reown/appkit' import { WagmiAdapter } from '@reown/appkit-adapter-wagmi' import { mainnet, arbitrum, base } from '@reown/appkit/networks' import { RhinestoneSDK } from '@rhinestone/sdk' import { walletClientToAccount } from '@rhinestone/sdk/utils' import { useAccount, useWalletClient } from 'wagmi' // 1. Get projectId from https://dashboard.reown.com const projectId = 'your-project-id' // 2. Set up the Wagmi adapter const wagmiAdapter = new WagmiAdapter({ networks: [mainnet, arbitrum, base], projectId, }) // 3. Configure the modal createAppKit({ adapters: [wagmiAdapter], networks: [mainnet, arbitrum, base], projectId, metadata: { name: 'Your dApp', description: 'Your dApp description', url: 'https://yourdapp.com', icons: ['https://yourdapp.com/icon.png'] } }) // 4. Use in your React component export function WalletConnector() { const { isConnected } = useAccount() const { data: walletClient } = useWalletClient() const [rhinestoneAccount, setRhinestoneAccount] = useState(null) useEffect(() => { async function setupAccount() { if (!isConnected || !walletClient) return // wrap the wagmi client for the sdk const wrappedWalletClient = walletClientToAccount(walletClient) // Use the connected wallet client const rhinestone = new RhinestoneSDK({ apiKey: process.env.RHINESTONE_API_KEY, }) const account = await rhinestone.createAccount({ owners: { type: "ecdsa", accounts: [wrappedWalletClient], }, }); setRhinestoneAccount(account) } setupAccount() }, [isConnected, walletClient]) return (
{rhinestoneAccount && (

Smart Account: {rhinestoneAccount.getAddress()}

)}
) } ``` -------------------------------- ### Install a Custom Module Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/custom-modules.mdx Use the `installModule` action to add custom validators, executors, or hooks to an existing smart account. Ensure the `type` and `address` are correctly specified. ```typescript import { installModule, uninstallModule } from '@rhinestone/sdk/actions' const transaction = await rhinestoneAccount.prepareTransaction({ targetChain: base, calls: [ installModule({ address: MODULE_ADDRESS, type: 'executor', // Optional initData: MODULE_DATA, }), ], }) ``` -------------------------------- ### Get Intent Status with Old SDK Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/migration-guide.mdx Poll the `getBundleStatus` method to retrieve status updates for a submitted bundle. ```typescript const bundleStatus = await orchestrator.getBundleStatus( bundleResults[0].bundleId, ); ``` -------------------------------- ### Express JWT Handlers Source: https://github.com/rhinestonewtf/docs/blob/main/intents/configuration/jwt-authentication.mdx Use `createExpressRouter` for Express applications to mount `GET /access-token` and `POST /extension-token` endpoints. ```typescript import express from 'express' import { createExpressRouter } from '@rhinestone/sdk/jwt-server' const app = express() app.use(express.json()) app.use('/api/auth', createExpressRouter(config)) ``` -------------------------------- ### Initialize 1inch Client for Swap Calldata Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/chain-abstraction/swaps.mdx Set up the 1inch API client to fetch swap and approval transaction details. Ensure you have a valid 1inch API key and the correct base URL for the network. ```typescript const walletAddress = rhinestoneAccount.getAddress() const wethBase = '0x4200000000000000000000000000000000000006' const wethAmount = parseEther('0.1') const cbbtcBase = '0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf' const oneInchApiKey = 'YOUR_1INCH_API_KEY' const baseUrl = 'https://api.1inch.dev/swap/v6.0/8453' async function call1inchAPI( endpointPath: string, queryParams: Record ): Promise { const url = new URL(baseUrl + endpointPath) url.search = new URLSearchParams(queryParams).toString() const response = await fetch(url.toString(), { headers: { Accept: 'application/json', Authorization: `Bearer ${oneInchApiKey}` }, }) if (!response.ok) throw new Error(`1inch API error ${response.status}`) return response.json() as Promise } ``` -------------------------------- ### Configure Rhinestone SDK with Biconomy Bundler Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/erc4337.mdx Initialize the Rhinestone SDK with a Biconomy bundler. Requires your Rhinestone API key and Biconomy API key. ```typescript const rhinestone = new RhinestoneSDK({ apiKey: rhinestoneApiKey, bundler: { type: 'biconomy', apiKey: biconomyApiKey, }, }) ``` -------------------------------- ### Enable Recovery Module Separately Source: https://github.com/rhinestonewtf/docs/blob/main/smart-wallet/advanced/recovery.mdx Install the social recovery module on an already deployed smart account. Requires the `@rhinestone/sdk/actions/recovery` import. ```typescript import { enable as enableRecovery } from '@rhinestone/sdk/actions/recovery' const setUpTransaction = await rhinestoneAccount.sendUserOperation({ chain, calls: enableRecovery([guardianAccount]), }) await rhinestoneAccount.waitForExecution(setUpTransaction) ```