{"id":50888281,"url":"https://github.com/ivanzzeth/probable-go-clob-client","last_synced_at":"2026-06-15T19:02:42.727Z","repository":{"id":361606227,"uuid":"1134086545","full_name":"ivanzzeth/probable-go-clob-client","owner":"ivanzzeth","description":"Go CLOB SDK for probable.markets","archived":false,"fork":false,"pushed_at":"2026-05-14T10:28:04.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T14:05:46.934Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanzzeth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-14T08:23:19.000Z","updated_at":"2026-05-14T10:11:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ivanzzeth/probable-go-clob-client","commit_stats":null,"previous_names":["ivanzzeth/probable-go-clob-client"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ivanzzeth/probable-go-clob-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanzzeth%2Fprobable-go-clob-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanzzeth%2Fprobable-go-clob-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanzzeth%2Fprobable-go-clob-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanzzeth%2Fprobable-go-clob-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanzzeth","download_url":"https://codeload.github.com/ivanzzeth/probable-go-clob-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanzzeth%2Fprobable-go-clob-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34376125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-15T19:02:41.835Z","updated_at":"2026-06-15T19:02:42.718Z","avatar_url":"https://github.com/ivanzzeth.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Probable Markets Go CLOB Client\n\nA Go SDK for interacting with the Probable Markets CLOB (Central Limit Order Book) API.\n\n## Features\n\n- **Dual Authentication Support**:\n  - L1 Authentication: Wallet-based authentication using EIP-712 signatures\n  - L2 Authentication: API Key-based authentication using HMAC-SHA256 signatures (faster, no gas fees)\n\n- **Type Safety**: Strong typing throughout the SDK, no `interface{}` or `any` types\n- **Error Handling**: Comprehensive error definitions in the `errs` package\n- **Examples**: Complete examples for all authentication operations\n\n## Installation\n\n```bash\ngo get github.com/ivanzzeth/probable-go-clob-client\n```\n\n## Quick Start\n\n### 1. Generate API Key (L1 Authentication)\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n\n    \"github.com/ethereum/go-ethereum/crypto\"\n    \"github.com/ivanzzeth/ethsig\"\n    probableclob \"github.com/ivanzzeth/probable-go-clob-client\"\n)\n\nfunc main() {\n    // Parse private key\n    privateKey, err := crypto.HexToECDSA(\"your_private_key_hex\")\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Create signer\n    signer := ethsig.NewEthPrivateKeySigner(privateKey)\n\n    // Create client\n    client, err := probableclob.NewClient(\n        probableclob.WithSigner(signer),\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Generate L2 API key\n    ctx := context.Background()\n    credentials, err := client.GenerateL2APIKey(ctx)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    log.Printf(\"API Key: %s\", credentials.Key)\n    log.Printf(\"Secret: %s\", credentials.Secret)\n    log.Printf(\"Passphrase: %s\", credentials.Passphrase)\n}\n```\n\n### 2. Use L2 Authentication (API Key + HMAC)\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n\n    \"github.com/ethereum/go-ethereum/crypto\"\n    \"github.com/ivanzzeth/ethsig\"\n    probableclob \"github.com/ivanzzeth/probable-go-clob-client\"\n)\n\nfunc main() {\n    // Parse private key (required for prob_address header)\n    privateKey, err := crypto.HexToECDSA(\"your_private_key_hex\")\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    signer := ethsig.NewEthPrivateKeySigner(privateKey)\n\n    // Create client with API credentials\n    client, err := probableclob.NewClient(\n        probableclob.WithAPICredentials(\n            \"your_api_key\",\n            \"your_api_secret\",\n            \"your_api_passphrase\",\n        ),\n        probableclob.WithSigner(signer),\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Verify L2 credentials\n    ctx := context.Background()\n    result, err := client.VerifyL2Credentials(ctx)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    if result.Valid {\n        log.Println(\"L2 credentials verified!\")\n    }\n}\n```\n\n## Authentication Methods\n\n### L1 Authentication (Wallet Signature)\n\n- Uses EIP-712 signature with your private key\n- Required for generating API keys\n- Requires gas fees for on-chain operations\n- More secure but slower\n\n### L2 Authentication (API Key + HMAC)\n\n- Uses HMAC-SHA256 signature with API credentials\n- No gas fees required\n- Faster and more efficient for API calls\n- Requires API credentials generated via L1 authentication\n\n## Examples\n\nSee the [examples](./examples) directory for complete examples:\n\n### Authentication Examples\n- [Generate API Key](./examples/auth/generate-api-key) - Generate API credentials using L1 authentication\n- [Get API Key](./examples/auth/get-api-key) - Retrieve current API key\n- [Delete API Key](./examples/auth/delete-api-key) - Delete current API key\n- [Verify Credentials](./examples/auth/verify-credentials) - Verify API credentials are valid\n\n### Events Examples\n- [List Events](./examples/events/list-events) - List all events with filtering and sorting\n- [Get Event by ID](./examples/events/get-event-by-id) - Get event details by numeric ID\n- [Get Event by Slug](./examples/events/get-event-by-slug) - Get event details by slug\n- [Get Event Tags](./examples/events/get-event-tags) - Get tags for an event\n\n### Markets Examples\n- [List Markets](./examples/markets/list-markets) - List all markets with filtering\n- [Get Market by ID](./examples/markets/get-market-by-id) - Get market details by ID\n- [Get Market by Polymarket ID](./examples/markets/get-market-by-polymarket-id) - Get market by Polymarket ID\n- [Get Market by BSC Question ID](./examples/markets/get-market-by-bsc-question-id) - Get market by BSC question ID\n\n### Orderbook Examples\n- [Get Orderbook](./examples/orderbook/get-orderbook) - Get orderbook for a market\n- [Get Price](./examples/orderbook/get-price) - Get price for a token\n- [Get Prices](./examples/orderbook/get-prices) - Get prices for multiple tokens\n- [Get Midpoint](./examples/orderbook/get-midpoint) - Get midpoint price\n- [Get Price History](./examples/orderbook/get-price-history) - Get price history for a market\n\n### Search Examples\n- [Search](./examples/search/search) - Full-text search across events and markets\n\n### Chain Operation Examples\n- [Enable Trading](./examples/chain/enable-trading) - Enable trading by approving necessary tokens\n- [Split](./examples/chain/split) - Split collateral into outcome tokens\n- [Merge](./examples/chain/merge) - Merge outcome tokens back into collateral\n- [Redeem](./examples/chain/redeem) - Redeem positions for resolved markets\n\nAll examples support loading environment variables from a `.env` file:\n\n```bash\nPRIVATE_KEY=your_private_key_hex\nAPI_KEY=your_api_key\nAPI_SECRET=your_api_secret\nAPI_PASSPHRASE=your_api_passphrase\n```\n\nRun examples:\n\n```bash\n# Generate API key\nPRIVATE_KEY=your_key go run ./examples/auth/generate-api-key\n\n# Get API key (L2 auth)\nAPI_KEY=your_key API_SECRET=your_secret API_PASSPHRASE=your_passphrase PRIVATE_KEY=your_key go run ./examples/auth/get-api-key\n\n# Verify credentials\nAPI_KEY=your_key API_SECRET=your_secret API_PASSPHRASE=your_passphrase PRIVATE_KEY=your_key go run ./examples/auth/verify-credentials\n```\n\n## API Reference\n\n### Client Options\n\n- `WithHost(host string)` - Set the API host URL (default: `https://api.probable.markets/public/api/v1`)\n- `WithAPIKey(apiKey string)` - Set API key for L2 authentication\n- `WithAPICredentials(apiKey, apiSecret, apiPassphrase string)` - Set API credentials for L2 authentication\n- `WithChainID(chainID *big.Int)` - Set chain ID (default: 56 for BNB Chain)\n- `WithRPCURL(rpcURL string)` - Set RPC URL for chain operations\n- `WithSigner(signer Signer)` - Set signer for L1 authentication\n- `WithSafeTradingSigner(safeSigner SafeTradingSigner, safeAddress common.Address)` - Set Safe trading signer and Safe wallet address for chain operations\n- `WithHTTPTimeout(timeout time.Duration)` - Set HTTP client timeout (default: 30s)\n\n### Authentication Methods\n\n- `GenerateL2APIKey(ctx context.Context) (*APIKeyCredential, error)` - Generate L2 API key using L1 authentication\n- `GetAPIKey(ctx context.Context) (*APIKey, error)` - Get current API key (supports L1/L2)\n- `DeleteAPIKey(ctx context.Context) (*DeleteAPIKey, error)` - Delete current API key (supports L1/L2)\n- `VerifyL2Credentials(ctx context.Context) (*VerifyL2Credentials, error)` - Verify L2 authentication headers (HMAC signature)\n\n### Search Methods\n\n- `Search(ctx context.Context, opts SearchOptions) (*SearchResponse, error)` - Full-text search across events and markets with comprehensive filtering, sorting, and caching options\n\n### Chain Operation Methods\n\n- `EnableTrading(ctx context.Context) ([]string, error)` - Enable trading by approving necessary tokens (returns transaction hashes)\n- `Split(ctx context.Context, conditionID common.Hash, amount decimal.Decimal) (string, error)` - Split collateral into outcome tokens\n- `SplitByMarketID(ctx context.Context, marketID int64, amount decimal.Decimal, checkApproval bool) (string, error)` - Split by market ID\n- `Merge(ctx context.Context, conditionID common.Hash, amount decimal.Decimal) (string, error)` - Merge outcome tokens back into collateral\n- `MergeByMarketID(ctx context.Context, marketID int64, amount decimal.Decimal, checkApproval bool) (string, error)` - Merge by market ID\n- `Redeem(ctx context.Context, conditionID common.Hash) (string, error)` - Redeem positions for resolved markets\n- `RedeemByMarketID(ctx context.Context, marketID int64, checkApproval bool) (string, error)` - Redeem by market ID\n- `CheckBalanceAndAllowance(ctx context.Context) (*BalanceAllowanceInfo, error)` - Check balance and allowances\n- `PrintBalanceAndAllowance(ctx context.Context) error` - Print balance and allowance status\n\n## Development\n\nThis SDK follows the development principles outlined in `agent/golang/go_sdk_dev.md`:\n\n- All types are strongly typed (no `interface{}` or `any`)\n- Comprehensive error handling with custom error types\n- All API responses are properly typed\n- Examples for all operations\n- Environment variable support via `.env` files\n\n## License\n\nMIT License - see [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanzzeth%2Fprobable-go-clob-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanzzeth%2Fprobable-go-clob-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanzzeth%2Fprobable-go-clob-client/lists"}