Skip to content

Commit d912688

Browse files
committed
chore: initial commit
0 parents  commit d912688

29 files changed

Lines changed: 2907 additions & 0 deletions

.editorconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.{py}]
11+
indent_style = space
12+
indent_size = 4
13+
14+
15+
[*.json]
16+
indent_style = space
17+
indent_size = 2
18+
19+
[*.yaml]
20+
indent_style = space
21+
indent_size = 2
22+
quote_type = single

.github/CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socioeconomic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all project spaces, and it also applies when
49+
an individual is representing the project or its community in public spaces.
50+
Examples of representing a project or community include using an official
51+
project e-mail address, posting via an official social media account, or acting
52+
as an appointed representative at an online or offline event. Representation of
53+
a project may be further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [`liam@polymarket.com`](mailto:liam@polymarket.com). All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

.github/CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## python-order-utils Monorepo Contribution Guide
2+
3+
All contributions to the python-order-utils are welcome and greatly appreciated! This document serves to outline the process for contributions and help you get set up.
4+
5+
### Steps to get started
6+
7+
1. Fork 'Polymarket/python-order-utils'
8+
2. Clone your fork
9+
3. Follow the [installation instructions](./README.md) in the monorepo's top level README.
10+
4. Open pull requests with the `[WIP]` flag against the `main` branch and include a description of the intended change in the PR description.
11+
12+
Before removing the `[WIP]` tag and submitting a PR for review, make sure that:
13+
14+
- it passes our linter checks
15+
- the test suite passes for all packages
16+
- it passes our continuous integration tests
17+
- your fork is up to date with `main`
18+
19+
### Branch structure & naming
20+
21+
Our main branch, `main`, represents the current development state of the codebase. All pull requests should be opened against `main`.
22+
23+
Name your branch with the format `{fix | feat | refactor | chore }/{ description }`
24+
25+
- A `fix` addresses a bug or other issue
26+
- A `feat` adds new functionality/interface surface area
27+
- A `refactor` changes no business logic or interfaces, but improves implementation
28+
- A `chore` addresses minor improvements or configuration changes
29+

.github/ISSUE_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!-- Please use tags to indicate weather this issue is a bug, new feature, or discussion. -->
2+
<!-- Omit and add sections as necessary. -->
3+
4+
## Overview
5+
6+
<!-- One or two sentences. Essentially a expanded title. -->
7+
8+
## Description
9+
10+
<!-- Most information should be here. -->
11+
<!-- Include as much detail as necessary, and add sub-sections if needed. -->
12+
13+
## Notes
14+
15+
<!-- Additional info, links, considerations, etc. -->
16+
17+
## Action items
18+
19+
- [ ] Tag issue (bug, enhancement, feature, etc.)
20+
- [ ] Initial discussion/assign team member
21+
- [ ] Move discussion to PR if necessary and when ready

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!-- Delete any sub-sections not used rather than leaving them empty. -->
2+
3+
## Overview
4+
5+
<!-- Provide a brief (1-3 sentence) summary of the PR and it's purpose. May include plans if a [WIP]. -->
6+
7+
## Description
8+
9+
<!-- Describe in detail what changes you plan to make in this section and sub-sections. -->
10+
11+
## Testing instructions
12+
13+
<!-- If the PR changes how tests should be run, describe here. -->
14+
15+
## Types of changes
16+
17+
<!-- Check one of the boxes below, and add additional information as necessary. -->
18+
19+
- [ ] Refactor/enhancement <!-- Non-breaking (patch bump). -->
20+
- [ ] Bug fix/behavior correction <!-- Non-breaking (patch bump). -->
21+
- [ ] New feature <!-- Non-breaking (minor bump), unless also specified as breaking. -->
22+
- [ ] Breaking change <!-- Feature or bug fix that changes behavior and requires a major version bump. -->
23+
- [ ] Other, additional <!-- Describe below/above. -->
24+
25+
## Notes
26+
27+
<!-- Include any additional comments, links, questions, or discussion items here. -->
28+
29+
## Status
30+
31+
<!-- Check any boxes that are already complete upon creation of the PR, and update whenever necessary. -->
32+
<!-- Make sure to check the "Ready for review" box when you are signing off on your changes for merge! -->
33+
34+
- [ ] Prefix PR title with `[WIP]` if necessary (changes not yet made).
35+
- [ ] Add tests to cover changes as needed.
36+
- [ ] Update documentation/changelog as needed.
37+
- [ ] Verify all tests run correctly in CI and pass.
38+
- [ ] Ready for review/merge.

.github/workflows/workflow.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
build-lint-test:
10+
name: Test
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.9.10
17+
18+
- run: |
19+
python -m pip install --upgrade pip
20+
pip install -r requirements.txt
21+
pip install -e .
22+
23+
- name: Run Tests
24+
run: make test

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# folders
2+
.coverage_artifacts/
3+
.coverage_cache/
4+
.coverage_contracts/
5+
artifacts/
6+
bin/
7+
build/
8+
cache/
9+
coverage/
10+
dist/
11+
node_modules/
12+
__pycache__/
13+
.pytest_cache/
14+
.venv/
15+
env/
16+
develop-eggs/
17+
eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
venv/
24+
25+
# files
26+
.env
27+
*.log
28+
*.tsbuildinfo
29+
coverage.json
30+
npm-debug.log*
31+
yarn-debug.log*
32+
yarn-error.log*
33+
.DS_Store
34+
*.py[cod]
35+
36+
.Python
37+
*.egg-info/
38+
.installed.cfg
39+
*.egg
40+
*.swp
41+
*.swo

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2022 Polymarket
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
init:
2+
pip install -r requirements.txt
3+
4+
test:
5+
pytest -s
6+
7+
fmt:
8+
black ./.

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Polymarket CLOB Python order-utils
2+
3+
<a href='https://pypi.org/project/py-order-utils'>
4+
<img src='https://img.shields.io/pypi/v/py-order-utils.svg' alt='PyPI'/>
5+
</a>
6+
7+
Python utilities used to generate and sign orders from Polymarket's Exchange
8+
9+
### Install
10+
11+
```bash
12+
pip install py-order-utils
13+
```
14+
15+
### Usage
16+
17+
```py
18+
from py_order_utils.builders import OrderBuilder
19+
from py_order_utils.signer import Signer
20+
from pprint import pprint
21+
22+
def main():
23+
exchange_address = "0x...."
24+
chain_id = 80002
25+
signer = Signer("0x....")
26+
builder = OrderBuilder(exchange_address, chain_id, signer)
27+
28+
# Create and sign the order
29+
order = builder.build_signed_order(
30+
OrderData(
31+
...
32+
)
33+
)
34+
35+
# Generate the Order and Signature json to be sent to the CLOB API
36+
pprint(json.dumps(order.dict()))
37+
38+
```

0 commit comments

Comments
 (0)