PolymarketClob.Client (PolymarketClob v0.2.0)

Copy Markdown View Source

Client configuration for Polymarket CLOB calls and signing.

Summary

Functions

Derives the EIP-55 checksum address for a raw private key.

Returns the funder address, falling back to the signer address.

Returns whether all L2 API credential fields are present.

Builds a client from a private key and optional API credentials.

Types

t()

@type t() :: %PolymarketClob.Client{
  address: String.t(),
  api_key: String.t() | nil,
  api_passphrase: String.t() | nil,
  api_secret: String.t() | nil,
  chain_id: PolymarketClob.Config.chain_id(),
  data_api_host: String.t(),
  funder: String.t() | nil,
  host: String.t(),
  private_key: binary(),
  signature_type: 0 | 1 | 2 | 3
}

Functions

derive_address(private_key)

@spec derive_address(binary()) :: String.t()

Derives the EIP-55 checksum address for a raw private key.

funder_address(client)

@spec funder_address(t()) :: String.t()

Returns the funder address, falling back to the signer address.

has_api_credentials?(client)

@spec has_api_credentials?(t()) :: boolean()

Returns whether all L2 API credential fields are present.

new(opts)

@spec new(keyword()) :: t()

Builds a client from a private key and optional API credentials.

If API credentials are present and :signature_type is not explicitly provided, the client defaults to signature type 2 (POLY_GNOSIS_SAFE), matching normal browser-derived Polymarket proxy wallets. Without API credentials it defaults to 0 (EOA).