Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frank/new ci #189

Merged
merged 16 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,18 @@ jobs:
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: poetry install
run: poetry install
- name: Install pytest
run: poetry run pip install pytest
- name: Run tests
run: bash scripts/ci.sh
env:
MAINNET_RPC_ENDPOINT: ${{ secrets.MAINNET_RPC_ENDPOINT }}
DEVNET_RPC_ENDPOINT: ${{ secrets.DEVNET_RPC_ENDPOINT }}
run: poetry run bash scripts/ci.sh

bump-version:
runs-on: ubicloud
needs: [black, tests]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
Expand All @@ -75,7 +80,7 @@ jobs:

release:
runs-on: ubicloud
needs: [black, tests, bump-version]
needs: [bump-version]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.4.2
hooks:
- id: black
language_version: python3.10
11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

20 changes: 2 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,6 @@ If you intend to use `AccountSubscriptionConfig("demo)`, you *must* call `get_ma

`bash setup.sh`


## Building the docs

Local Docs: `mkdocs serve`

Updating public docs: `poetry run mkdocs gh-deploy --force`

## Releasing a new version of the package

- `python new_release.py`
- Create a new release at https://github.com/drift-labs/driftpy/releases.
- (The CI process will upload a new version of the package to [PyPI](https://pypi.org/project/driftpy/))

# Development

Ensure correct python version (using pyenv is recommended):
Expand All @@ -85,10 +72,7 @@ poetry install

Run tests:
```
poetry run bash test.sh
poetry run bash test-scripts/integration_test.sh
poetry run bash test-scripts/math_tests.sh
```

Run Acceptance Tests
```
poetry run bash acceptance_test.sh
```
1 change: 0 additions & 1 deletion acceptance_test.sh

This file was deleted.

41 changes: 28 additions & 13 deletions examples/fetch_all_markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,42 @@
from driftpy.drift_client import DriftClient, AccountSubscriptionConfig
import asyncio


async def get_all_market_names():
env = 'mainnet-beta' # 'devnet'
rpc = 'https://api.mainnet-beta.solana.com' # todo replace
kp = Keypair() # random wallet
env = "mainnet-beta" # 'devnet'
rpc = "https://api.mainnet-beta.solana.com" # todo replace
kp = Keypair() # random wallet
wallet = Wallet(kp)
connection = AsyncClient(rpc)
provider = Provider(connection, wallet)
drift_client = DriftClient(provider.connection, provider.wallet, env.split('-')[0], account_subscription=AccountSubscriptionConfig("cached"))

all_perps_markets = await drift_client.program.account['PerpMarket'].all()
sorted_all_perps_markets = sorted(all_perps_markets, key=lambda x: x.account.market_index)
result_perp = [bytes(x.account.name).decode('utf-8').strip() for x in sorted_all_perps_markets]
drift_client = DriftClient(
provider.connection,
provider.wallet,
env.split("-")[0],
account_subscription=AccountSubscriptionConfig("cached"),
)

all_perps_markets = await drift_client.program.account["PerpMarket"].all()
sorted_all_perps_markets = sorted(
all_perps_markets, key=lambda x: x.account.market_index
)
result_perp = [
bytes(x.account.name).decode("utf-8").strip() for x in sorted_all_perps_markets
]

all_spot_markets = await drift_client.program.account['SpotMarket'].all()
sorted_all_spot_markets = sorted(all_spot_markets, key=lambda x: x.account.market_index)
result_spot = [bytes(x.account.name).decode('utf-8').strip() for x in sorted_all_spot_markets]
all_spot_markets = await drift_client.program.account["SpotMarket"].all()
sorted_all_spot_markets = sorted(
all_spot_markets, key=lambda x: x.account.market_index
)
result_spot = [
bytes(x.account.name).decode("utf-8").strip() for x in sorted_all_spot_markets
]

result = result_perp + result_spot[1:] # ignore quote spot market index
result = result_perp + result_spot[1:] # ignore quote spot market index
return result

if __name__ == '__main__':

if __name__ == "__main__":
loop = asyncio.new_event_loop()
answer = loop.run_until_complete(get_all_market_names())
print(answer)
26 changes: 0 additions & 26 deletions new_release.py

This file was deleted.

7 changes: 0 additions & 7 deletions noxfile.py

This file was deleted.

1 change: 0 additions & 1 deletion oracle.sh

This file was deleted.

130 changes: 0 additions & 130 deletions parse_idl.py

This file was deleted.

1 change: 0 additions & 1 deletion prelaunch.sh

This file was deleted.

2 changes: 1 addition & 1 deletion protocol-v2
Submodule protocol-v2 updated 277 files
54 changes: 0 additions & 54 deletions scrape.py

This file was deleted.

Loading
Loading