Skip to main content
Rhinestone uses its own intent infrastructure for most transactions, but some modules require ERC-4337 UserOperations: Social Recovery and legacy Smart Sessions. This guide covers how to configure and use ERC-4337 with the SDK.

Configuration

Bundler

Pass a bundler config when initialising the SDK:
const rhinestone = new RhinestoneSDK({
  apiKey: rhinestoneApiKey,
  bundler: {
    type: 'pimlico',
    apiKey: pimlicoApiKey,
  },
})

Paymaster

Optionally add a paymaster to sponsor gas on UserOperations:
const rhinestone = new RhinestoneSDK({
  apiKey: rhinestoneApiKey,
  bundler: { type: 'pimlico', apiKey: pimlicoApiKey },
  paymaster: { type: 'pimlico', apiKey: pimlicoApiKey },
})
Need support for another ERC-4337 provider? Open an issue.

Usage

Send a UserOperation

Once configured, sendTransaction automatically routes through ERC-4337 when required:
const result = await rhinestoneAccount.sendTransaction({
  chain: base,
  calls: [
    {
      to: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
      value: 0n,
      data: '0xdeadbeef',
    },
  ],
})

const status = await rhinestoneAccount.waitForExecution(result)

Granular API

Use the lower-level API to separate preparation, signing, and submission:
const transactionData = await rhinestoneAccount.prepareUserOperation({
  chain: base,
  calls: [...],
})

const signedData = await rhinestoneAccount.signUserOperation(transactionData)
const result = await rhinestoneAccount.submitUserOperation(signedData)
const status = await rhinestoneAccount.waitForExecution(result)