Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tkhq/sdk/llms.txt
Use this file to discover all available pages before exploring further.
@turnkey/ethers provides a TurnkeySigner class that is a drop-in replacement for any ethers.Signer. It integrates with both ethers.js v5 and v6, and works with any ethers-compatible provider.
Installation
Usage
Create a Turnkey HTTP client
Initialize a
TurnkeyClient with your credentials. Use ApiKeyStamper for server-side or automated environments.Initialize TurnkeySigner
Create a The
TurnkeySigner with the Turnkey client, your organization ID, and a signing identifier.signWith field accepts a wallet account address, a private key address, or a private key ID.TurnkeySigner constructor options
A Turnkey client instance used to submit signing requests.
Your Turnkey organization ID (or sub-organization ID).
A wallet account address, private key address, or private key ID to sign with.
Available methods
TurnkeySigner implements the full ethers.Signer interface:
| Method | Description |
|---|---|
getAddress() | Returns the Ethereum address associated with the signer. If signWith is a private key ID, the address is fetched from the Turnkey API. |
signMessage(message) | Signs an arbitrary message. Bytes are treated as binary; strings as UTF-8. |
signTransaction(transaction) | Signs a transaction without broadcasting it. |
sendTransaction(transaction) | Signs and broadcasts a transaction via the connected provider. |
signTypedData(domain, types, value) | Signs EIP-712 typed data. |
connect(provider) | Returns a new TurnkeySigner connected to the given provider. |
Using WebAuthn / passkeys
SwapApiKeyStamper for WebauthnStamper to authenticate users with passkeys instead of API keys:
WebauthnStamper prompts the user for a passkey signature when a request is made. Use it in browser environments where you want user-controlled signing.Examples
| Example | Description |
|---|---|
with-ethers | Create a new Ethereum address, then sign and broadcast a transaction using the Ethers signer with Infura |
with-gnosis | Create new Ethereum addresses, configure a 3/3 Gnosis safe, and create and execute a transaction from it |
with-uniswap | Sign and broadcast a Uniswap v3 trade using the Ethers signer with Infura |
with-nonce-manager | Create a new Ethereum address, then sign and broadcast multiple transactions in a sequential or optimistic manner |
sweeper | Sweep funds from one address to a different address |
deployer | Compile and deploy a smart contract |
For lower-level, fully typed HTTP access to the Turnkey API, see
@turnkey/http.