Viem Integration

Replace local private keys with Emblem remote signing for viem/wagmi applications.

📖 Related Documentation

Before (Local Private Key)

TY
before.ts
Loading...

After (Emblem Remote Signer)

TY
after.ts
Loading...

React/Next.js Usage

When using @emblemvault/emblem-auth-react, access the authenticated SDK via the useEmblemAuth() hook:

TS
SignMessage.tsx
Loading...

Supported Operations

The account returned by toViemAccount() supports all standard viem account operations:

Message Signing

TY
sign-message.ts
Loading...

Typed Data Signing (EIP-712)

TY
sign-typed-data.ts
Loading...

Transaction Sending

TY
send-transaction.ts
Loading...

Complete Example

TY
complete-example.ts
Loading...

Account Interface

The returned account object implements viem's LocalAccount interface:

address: Hex
type: 'local'
source: 'custom'
signMessage(message): Promise<Hex>
signTypedData(typedData): Promise<Hex>
signTransaction(tx, opts?): Promise<Hex>

Benefits of Emblem Integration

  • • No private key exposure - Keys stay secure in Emblem Vault
  • • Multi-chain support - Use the same vault across EVM chains
  • • Drop-in replacement - Works with existing viem/wagmi code
  • • Compatible with wagmi - Can be used as a custom connector
  • • TypeScript native - Full type safety and IntelliSense