Skip to content

[Feature]: Openfort wallet provider entrypoint (@polymarket/client/openfort) #121

@joalavedra

Description

@joalavedra

What would you like the SDK to support?

A new @polymarket/client/openfort entrypoint that lets server-side applications sign and trade with Openfort backend wallets, mirroring the existing Privy integration (packages/client/src/privy.ts).

Concretely:

  • packages/client/src/openfort.ts exporting signerFrom(config: OpenfortWalletConfig): Signer, implementing the same Signer contract (getAddress, signTypedData, signMessage, sendTransaction) used by createSecureClient.
  • Same structure and guarantees as the Privy entrypoint: Node-only runtime guards, the same error mapping (SigningError, CancelledSigningError, TimeoutError, TransactionFailedError), and a direct transaction handle that waits for receipts via viem.
  • @openfort/openfort-node added as an optional peer dependency, exactly like @privy-io/node is today.
  • A new ./openfort entry in exports / typesVersions of packages/client/package.json.
  • An integration test tests/integration/openfort.test.ts mirroring privy.test.ts (authenticates a secure client, places and cancels a limit order), gated on OPENFORT_TEST_* env vars and skipping when they are unset — same pattern as the Privy suite.

Why do you need this?

Openfort provides TEE-backed server wallets with a criteria-based policy engine (allowed contracts, value limits, per-operation rules), which is a common setup for trading agents and backend services that operate on Polymarket programmatically.

Today, teams on Openfort who want to use @polymarket/client have to either export raw private keys into a viem account (defeating the purpose of custodied server wallets) or hand-roll the Signer interface themselves. A first-class entrypoint — like the SDK already ships for Privy — removes that friction and keeps key material inside the wallet infrastructure.

Disclosure: I'm a founder at Openfort. We're happy to author the PR, maintain the integration going forward, and provide Polymarket-side test credentials (a funded test backend wallet) for the integration suite if useful.

Example API or additional context

import { createSecureClient } from '@polymarket/client';
import { type OpenfortWalletConfig, signerFrom } from '@polymarket/client/openfort';
import Openfort from '@openfort/openfort-node';

const wallet: OpenfortWalletConfig = {
  openfort: new Openfort(process.env.OPENFORT_SECRET_KEY, {
    walletSecret: process.env.OPENFORT_WALLET_SECRET,
  }),
  accountId: 'acc_...', // Openfort EVM backend wallet
};

const secureClient = await createSecureClient({
  signer: signerFrom(wallet),
});

await secureClient.placeLimitOrder({ /* ... */ });

Signer method mapping (all available in @openfort/openfort-node today):

Signer method Openfort backend wallet API
getAddress accounts.evm.backend.get({ id })
signTypedData EIP-712 typed-data signing on the backend wallet
signMessage Message signing on the backend wallet
sendTransaction Gasless/sponsored or direct transaction submission on Polygon

Per CONTRIBUTING.md we're not starting the PR until this is discussed and agreed — happy to adjust scope, naming, or test strategy to whatever fits the SDK's direction during the beta.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions