polymarket_dart 0.4.0 copy "polymarket_dart: ^0.4.0" to clipboard
polymarket_dart: ^0.4.0 copied to clipboard

A Dart SDK for the Polymarket CLOB, Gamma, and Data APIs — REST, WebSocket, EIP-712 signing, HMAC auth, on-chain approvals, and order management.

example/example.dart

import 'package:polymarket_dart/polymarket_dart.dart';

Future<void> main() async {
  // ── Public CLOB API ───────────────────────────────────────────────────────
  final clob = ClobClient();

  final markets = await clob.getMarkets();
  print('CLOB markets (first page):');
  for (final m in markets.data.take(3)) {
    print('  ${m.question}');
  }

  final time = await clob.getServerTime();
  print('Server time: $time\n');

  clob.close();

  // ── Gamma API — market discovery ─────────────────────────────────────────
  final gamma = GammaClient();

  final top = await gamma.getMarkets(
    active: true,
    order: 'volume24hr',
    ascending: false,
    limit: 3,
  );
  print('Top markets by 24h volume:');
  for (final m in top) {
    print('  ${m.question}  (volume: ${m.volume24hr})');
  }

  final tags = await gamma.getTags();
  print('\nCategories: ${tags.map((t) => t.label).join(', ')}\n');

  gamma.close();

  // ── Data API — user analytics ─────────────────────────────────────────────
  final data = DataClient();

  // Replace with a real address to see live data
  const address = '0x0000000000000000000000000000000000000000';
  final positions = await data.getPositions(address);
  print('Positions for $address: ${positions.length}');

  data.close();
}
0
likes
160
points
19
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Dart SDK for the Polymarket CLOB, Gamma, and Data APIs — REST, WebSocket, EIP-712 signing, HMAC auth, on-chain approvals, and order management.

Repository (GitHub)
View/report issues

Topics

#polymarket #defi #prediction-markets #web3 #cryptocurrency

License

MIT (license)

Dependencies

convert, crypto, http, pointycastle, web_socket_channel

More

Packages that depend on polymarket_dart