Ethers v6 Integration

Replace local private keys with Emblem remote signing for ethers v6 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
SendTransaction.tsx
Loading...

Supported Operations

The wallet returned by toEthersWallet() implements the standard ethers v6 Signer interface plus additional helpers:

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...

Sign & Broadcast Helper

Convenience method that signs and optionally waits for receipt

TY
sign-and-broadcast.ts
Loading...

Enhanced Features

Beyond the standard ethers Signer interface, the Emblem wallet includes additional methods:

TY
enhanced-features.ts
Loading...

Complete Example

TY
complete-example.ts
Loading...

Wallet Interface

The returned wallet implements the ethers v6 Signer interface:

getAddress(): Promise<string>
signMessage(message): Promise<string>
signTypedData(domain, types, value): Promise<string>
signTransaction(tx): Promise<string>
sendTransaction(tx): Promise<TransactionResponse>
// Enhanced methods:
getVaultId(): string
setChainId(chainId): void
getChainId(): number
signAndBroadcast(tx, waitForReceipt?): Promise<string>

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 - Compatible with existing ethers v6 code
  • • Enhanced helpers - Additional methods like signAndBroadcast()
  • • Provider integration - Works with any ethers Provider

Ethers Version

This signer is built for ethers v6. Make sure you're using the correct version in your package.json: npm install ethers@^6