Skip to main content

Introduction

The @turnkey/wallet-stamper package provides a flexible mechanism for using your Solana or EVM wallet to stamp and approve activity requests for Turnkey’s API. This stamping process leverages your wallet’s signature key to authenticate requests securely.

Installing

To get started, install the @turnkey/wallet-stamper client.

Initializing

The WalletStamper class implements the TStamper interface used by the TurnkeyClient in the @turnkey/http package. It encapsulates the logic necessary to sign activity requests using your wallet and generate the appropriate HTTP headers for authentication.

constructor(wallet: WalletInterface): TStamper

Parameters

wallet
WalletInterface
required
An object representing your wallet, either a Solana or EVM wallet.
type
string
required
The type of wallet, either solana or evm.
signMessage
function
required
A function that signs a message using your wallet’s private key.
recoverPublicKey
function
required
A function that recovers the public key from the signed message (required for EVM wallets).

Types

SolanaWalletInterface
EvmWalletInterface
WalletInterface

Methods

stamp: (input: string) => Promise<TStamp>

Signs the payload using the wallet’s private key and returns the stamp to be used in the HTTP headers for authenticating requests to Turnkey’s API.

Parameters

payload
string
required
The payload that to be stamped. This is the stringified JSON request body that you want to send to Turnkey’s API.

Types

TStamp
TStamper

Example

The example below shows how to initialize and use the WalletStamper with the TurnkeyClient to make a request to Turnkey’s /public/v1/query/whoami endpoint:

Conclusion

The WalletStamper class provides a seamless integration with Turnkey’s API, enabling you to leverage your existing wallet for secure, authenticated requests. By following this guide, you can quickly set up and start using WalletStamper in your projects.