open-index/open-npm huggingface dataset:
npm package: @polymarket/uma-binary-adapter-sdk
Description: SDK for the UMA Binary Adapter
Latest version: 1.2.4

# Polymarket UMA CTF Adapter SDK


<a href='https://www.npmjs.com/package/@polymarket/uma-binary-adapter-sdk'>
    <img src='https://img.shields.io/npm/v/@polymarket/uma-binary-adapter-sdk.svg' alt='NPM'/>
</a>


This SDK is a lightweight wrapper around the `UmaConditionalTokensBinaryAdapter` contract.

### Usage

```ts
import { UmaBinaryAdapterClient } from "@polymarket/uma-binary-adapter-sdk";
const signer = new Wallet("0x" + process.env.KEY);
const adapter = new UmaBinaryAdapterClient(signer, 137);

// Initialize question
await adapter.initializeQuestion(
    questionID, 
    title, 
    description,
    outcomes, 
    resolutionTime, 
    rewardToken, 
    reward, 
    proposalBond, 
    { gasPrice: ethers.utils.parseUnits("100", 9) }
);

// Request resolution data
await adapter.requestResolutionData(questionID);

// Settle
await adapter.settle(questionID);

// View expected payout vector
await adapter.getExpectedPayouts(questionID);

//Report payouts
await adapter.reportPayouts(questionID);
```
npm package: @polymarket/uma-client-aggregator
Description: Used to abstract multiple uma ctf adapters
Latest version: 0.0.6

# Polymarket CTF Adapter Aggregator

Used to abstract multiple uma ctf adapters


## Usage

```ts
import { ClientAggregator } from "@polymarket/uma-client-aggregator";

const signer = new Wallet("0x" + process.env.KEY);

const agg = new ClientAggregator(signer, 80001);
```
npm package: @polymarket/uma-ctf-adapter-sdk
Description: SDK for the UMA CTF Adapter
Latest version: 0.0.10

# Polymarket UMA CTF Adapter SDK

Lightweight wrapper SDK around the [`UmaCtfAdapter`](https://github.com/Polymarket/uma-ctf-adapter) contracts.

### Usage

```ts
import { ClientV1, ClientV2, ClientV3 } from "@polymarket/uma-ctf-adapter-sdk";
const signer = new Wallet("0x" + process.env.KEY);
const v2 = new ClientV2(signer, 137);
const v3 = new ClientV3(signer, 137);

// Initialize question on v2 client
await v2.initialize(
    title, 
    description,
    outcomes, 
    rewardToken, 
    reward, 
    bond
);

// Initialize question on v3 client
await v3.initialize(
    title,
    desc,
    outcomes,
    rewardToken,
    reward,
    bond,
    liveness
)

// Resolve the question
await v3.resolve(questionID);
```
npm package: @polymarket/uma-ctf-binary-adapter
Description: Contracts to resolve Polymarket prediction markets via UMA's Optimistic Oracle
Latest version: 2.0.0

# Polymarket UMA CTF Adapter

![Github Actions](https://github.com/Polymarket/uma-conditional-tokens-adapter/workflows/Tests/badge.svg)
![Github Actions](https://github.com/Polymarket/uma-conditional-tokens-adapter/workflows/Lint/badge.svg)
[![Coverage](https://coveralls.io/repos/github/Polymarket/uma-conditional-tokens-adapter/badge.svg?branch=main)](https://coveralls.io/github/Polymarket/uma-conditional-tokens-adapter?branch=main)

## Overview

This repository contains contracts used to resolve [Polymarket](https://polymarket.com/) prediction markets via UMA's [optimistic oracle](https://docs.umaproject.org/oracle/optimistic-oracle-interface).

### Architecture
![Contract Architecture](./docs/adapter.png)

The Adapter is an [oracle](https://github.com/gnosis/conditional-tokens-contracts/blob/master/contracts/ConditionalTokens.sol#L65) to [CTF](https://docs.gnosis.io/conditionaltokens/) conditions, which Polymarket prediction markets are based on.

It fetches resolution data from UMA's Optmistic Oracle and resolves the condition based on said resolution data.

When a new market is deployed, it is `initialized`, meaning:
1) The market's parameters(request timestamp, reward, etc) are stored onchain
2) The market is `prepared` on the CTF contract
3) A resolution data request is sent out to the Optimistic Oracle

UMA Proposers will then respond to the request and fetch resolution data offchain. If the resolution data is not disputed, the data will be available to the Adapter after a defined liveness period(currently about 2 hours). If the proposal is disputed, UMA's [DVM](https://docs.umaproject.org/getting-started/oracle#umas-data-verification-mechanism) is the fallback and will return data after a 48 - 72 hour period.

After resolution data is available, anyone can call `resolve` which resolves the market using the resolution data.


### Deployments

See [current deployments](./deploys.md)


### Dependencies

Install dependencies with `yarn install`

### Compile

Compile the contracts with `yarn compile`

### Testing

Test the contracts with `yarn test`

### Coverage

Generate coverage reports with `yarn coverage`
npm package: @polymarket8/clob-client
Description: Typescript client for Polymarket's CLOB
Latest version: 4.22.8

# Polymarket CLOB Client

<a href='https://www.npmjs.com/package/@polymarket/clob-client'>
    <img src='https://img.shields.io/npm/v/@polymarket/clob-client.svg' alt='NPM'/>
</a>

Typescript client for the Polymarket CLOB

### Usage

```ts
//npm install @polymarket/clob-client
//npm install ethers
//Client initialization example and dumping API Keys

import { ApiKeyCreds, ClobClient, OrderType, Side, } from "@polymarket/clob-client";
import { Wallet } from "@ethersproject/wallet";

const host = 'https://clob.polymarket.com';
const funder = '';//This is your Polymarket Profile Address, where you send UDSC to. 
const signer = new Wallet(""); //This is your Private Key. If using email login export from https://reveal.magic.link/polymarket otherwise export from your Web3 Application


//In general don't create a new API key, always derive or createOrDerive
const creds = new ClobClient(host, 137, signer).createOrDeriveApiKey();

//0: Browser Wallet(Metamask, Coinbase Wallet, etc)
//1: Magic/Email Login
const signatureType = 1; 
  (async () => {
    const clobClient = new ClobClient(host, 137, signer, await creds, signatureType, funder);
    const resp2 = await clobClient.createAndPostOrder(
        {
            tokenID: "", //Use https://docs.polymarket.com/developers/gamma-markets-api/get-markets to grab a sample token
            price: 0.01,
            side: Side.BUY,
            size: 5,
        },
        { tickSize: "0.001",negRisk: false }, //You'll need to adjust these based on the market. Get the tickSize and negRisk T/F from the get-markets above
        //{ tickSize: "0.001",negRisk: true },

        OrderType.GTC, 
    );
    console.log(resp2)
  })();
```

See [examples](examples/) for more information
npm package: @polymath-ai/db
Description: A simple database for embeddings
Author: The Polymath Crew
Latest version: 0.0.2

# Lightweight vector store for Poylmath.

To use:

```js
import { VectorStore } from "@polymath-ai/db";

// A directory where the database will reside.
// The store will create the directory and populate it with two files:
// - `database.db` -- the duckdb database that stores useful metadata.
// - `vector.idx` -- the hnswlib index that stores the vector index.
const path = "/path/to/store";
// The number of dimensions in the vector.
const dimensions = 1536;
const store = new VectorStore(path, dimensions);
```

To write bits into it:

```js
const bits = ["array", "of", "bits"];
const writer = await store.createWriter();
await writer.write(bits);
```

To query:

```js
const query = []; // the vector as an array of numbers
const resultCount = 5; // number of results to return
const reader = await store.createReader();
const results = await reader.search(query, resultCount);
```
npm package: @polymath-ai/host
Description: Polymath Host library
Author: The Polymath Crew
Latest version: 0.0.3

# Polymath Host Implementation

This is a library that provides a host implementation for Polymath. It is designed to easily stand up a Polymath host.

There are two concrete implementations of the host:

1. `PolymathPinecone` that relies on [Pinecone](https://www.pinecone.io/) as a backend.

2. `PolymathFile` that serves local JSON files.

Both are sub-classes of `PolymathHost`, which has the following API:

```typescript

async ask(formData: FormData): Promise<PackedLibraryData>

async queryPacked(args: AskOptions): Promise<PackedLibraryData>

async query(args: AskOptions): Promise<LibraryData>

```

The `ask` method is the main entry point for the host. It takes a `FormData` object and returns a `PackedLibraryData` object, which can be served right out
as a JSON in HTTP response.

The `queryPacked` and `query` methods are convenience methods that take an `AskOptions` object and return a `PackedLibraryData` or `LibraryData` object, respectively. They are most useful for situations where you want to consume host directly in your code, without using HTTP.
npm package: @polymath-ai/ingest
Description: An ingest library for Polymath
Author: The Polymath Crew
Latest version: 1.0.1

# Polymath Ingest

This is a libraries that can be used to ingest data from a source and convert it into a format that can be used by the Polymath system.

## Standalone ingestion tool

See: @polymath/cli

## API

### Extend `Ingester` for use in the CLI

You are able to extend the `Ingester` class to create your own importer.

1. Create a new class that extends `Ingester`
2. Implement the `getStringsFromSource` method
   a. getStringsFromSource should return an AsyncGenerator of partially filled out bits that is the *full string* of data from the source.
   b. The `text` property of the bit should be the full string of data from the source. The `info` property of the bit should be an object that contains any additional information about the bit. The `info` property is optional.

```
class MYRSS extends Ingester {

  constructor() {
    super();
  }

  async *getStringsFromSource(source: string): AsyncGenerator<Bit> {
    const feed = await (new RSSParser).parseURL(source);
    console.log(feed.title); // feed will have a `foo` property, type as a string

    for (const item of feed.items) {
      yield {
        text: item.content || "",
        info: {
          url: item.link || "",
          title: item.title || "",
        }
      };
    }
  }

}
```

E.g:
`> polymath ingest rss https://paul.kinlan.me/index.xml`

### Embed the `Ingest` process

It is possible to use the `Ingest` process directly in your own code, for example if you want to run a custom export as the embeddings are generated. The process will load the correct plugin and start processing it.

```
import { Ingest } from "@polymath/ingest";

const ingest = new Ingest({ /* options */ });

for await(const bit of ingest.run({ args, options, command })) {
  console.log(`${bit.url}: Embedding: ${bit.embedding}`);)  
}

```
npm package: @polymath-ai/validation
Description: A library for validating Polymath format
Author: The Polymath Crew
Latest version: 2.0.2

Three kinds of validation:

1. Validation of a Polymath request. This is useful to verify that that the data we're sending to the endpoint is valid.
2. Validation of a Polymath response. This is useful to verify that the data the endpoint returns is valid.
3. Validation of endpoint behavior. This is useful to verify that the endpoint behaves as expected in response to various requests.

The first two we can do with JSON Schema.

The third one is something that can only be accomplished by repeated querying of the endpoint with varying parameters.

The `harness` module is designed to make the behavior validation easy. It mimics a typical test harness.

The `validator` module is where all the behavior validation happens.
npm package: @polymath_labs/eslint-config-node
Description: Polymath Labs Node ESLint configuration
Author: https://github.com/Polymath-Labs
Latest version: 3.0.0-rc2

# Polymath Labs Node ESLint

This library represents the standard ESLint configuration for any Node project. Note that 
considering even React development happens using Node as far as ESLint is concerned, this 
ESLint configuration is appropriate for any .js project. 

> Tip: look for other eslint-config libs from @polymath_labs for more specialized use cases

## Installation

Install the library using:
`npm install -D @polymath_labs/eslint-config-node`

Then do the same thing and make sure you have the peer dependencies installed (look at 
packages.json for a current list).

Finally, configure eslint on your local by creating a file similar to:

```javascript
module.exports = {
    extends: [
        "@polymath_labs/eslint-config-node"
    ],
};
```
npm package: @polymath_labs/eslint-config-react
Description: Polymath Labs ESLint configuration for React projects
Author: https://github.com/Polymath-Labs
Latest version: 3.0.0-rc3

# Polymath Labs React ESLint

This library represents the standard ESLint configuration for any React project. If you 
are developing React using Typescript, then make sure you combine the configuration with
`@polymath_labs/eslint-config-typescript`.

## Installation

Install the library using:
`npm install -D @polymath_labs/eslint-config-react`

Then do the same thing and make sure you have the peer dependencies installed (look at 
packages.json for a current list).

Finally, configure eslint on your local by creating a file similar to:

```javascript
module.exports = {
    extends: [
        "@polymath_labs/eslint-config-react"
    ],
};
```
npm package: @polymath_labs/eslint-config-typescript
Description: Polymath Labs ESLint configuration for TypeScript projects
Author: https://github.com/Polymath-Labs
Latest version: 3.0.0-rc1

# Polymath Labs Typescript ESLint

This library represents the standard ESLint configuration for any React project. If you 
are developing React using Typescript, then make sure you combine the configuration with
`@polymath_labs/eslint-config-typescript`.

## Installation

Install the library using:
`npm install -D @polymath_labs/eslint-config-typescript`

Then do the same thing and make sure you have the peer dependencies installed (look at 
packages.json for a current list).

Finally, configure eslint config file on your local matching:

```javascript
module.exports = {
    extends: [
        "@polymath_labs/eslint-config-typescript"
    ],
    root: true
};
```