Skip to main content

Python SDK for ApePay

Project description

ApePay

Ape Framework

A smart contract payment system built for automated service management

About

See the blog post to learn more about ApePay!

Documentation

Coming soon!

Contributing

ApePay is open source and we welcome all contributors! Check out the following to get started.

TODOs:

  • Initial implementation
  • Documentation
  • Live testing on Sepolia
  • Production deployment on Arbitrum
  • Frontend management console, for managing subscriptions

Setup (Python)

First, install Ape.

Second, make sure to install the plugins:

$ ape plugins install . --upgrade

Next, prior to installing the SDK package, you need to compile the project:

$ ape compile
The SDK package relies on a soft link in [`./sdk/py/apepay/manifest.json`](./sdk/py/apepay/manifest.json)

Lastly, install the SDK package via:

$ pip install .

or for interactive installation do:

$ pip install -e .

Then you are ready to contribute!

Setup (JS)

In order to contribute to the JS packages, you need to first follow the Python Setup instructions to compile the smart contract package.

Next, you need install the node packages for development:

$ npm install

In order to work on the React component library, you need to compile the JS SDK:

$ npm run build --workspace=sdk/js

In order to work on the Demo app, you need to compile the JS SDK (like above) as well as compile the React component library:

$ npm run build --workspace=ui/lib

Then you are ready to contribute!

To run the demo app in development mode, do the following:

$ npm run dev --workspace=ui/app

To build the demo app for production, do the following:

$ npm run build --workspace=ui/app

Testing

To run tests, just use Ape:

$ ape test

To see gas usage, add the --gas flag:

$ ape test --gas

Scripts

To deploy a StreamManager (for testing purposes), run:

$ ape run deploy manager [TOKEN_ADDRESS [...]]
# Or if `ape tokens` is installed (with a valid tokenlist)
$ ape run deploy manager [TOKEN_SYMBOL [...]]

To deploy the StreamFactory (for production use), run:

$ ape run deploy factory

To deploy a Token (for testing use only), run:

$ ape run deploy token
This test token has an unauthenticated mint, please do not use in production!

To run the demo ApePay cluster daemon, first run a node like anvil:

$ anvil --block-time 1 --prune-history

Then run the example Silverback app:

$ silverback run bots.example:app

After that, it's suggested to start ape console and create a stream to watch the daemon react.

We also provide a simulation you can run instead using:

$ ape run demo

Publishing

Given the monorepo structure, it's a bit more challenging to distribute all the packages in this repo.

Contracts

TBD

Python SDK

To publish the Python package, there are 4 steps.

# 1. Install everything
$ pip install .[dev]
# 2. Compile the package manifest
$ ape compile -f
# 3. Build the Python SDK with twine
$ twine build
# 4. Publish the package
$ twine publish

JavaScript SDK and React component library

To publish the JS SDK, do the following:

# 1. Install everything
$ npm install --all-workspaces
# 2. Build SDK
$ npm run build --workspace=sdk/js
# 3. Publish SDK
$ npm publish --workspace=sdk/js

NOTE: make sure to revision the package before publishing, or it will fail.

To publish the React Component library, do the same thing as the SDK exepct use the ui/lib workspace.

Demo App and Management Console

If you need to deploy the demo app to prod from scratch, just create a new heroku project and add these buildpacks from the Heroku CLI (or directly in your Heroku dashboard)

$ heroku buildpacks:clear
$ heroku buildpacks:add heroku/python
$ heroku buildpacks:add heroku/nodejs

Then just run:

$ git push heroku main

License

ApePay is licensed Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apepay-0.3.9.tar.gz (353.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apepay-0.3.9-py3-none-any.whl (108.9 kB view details)

Uploaded Python 3

File details

Details for the file apepay-0.3.9.tar.gz.

File metadata

  • Download URL: apepay-0.3.9.tar.gz
  • Upload date:
  • Size: 353.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for apepay-0.3.9.tar.gz
Algorithm Hash digest
SHA256 f46941bac5a3b31aefab2eadf34be2e6bcacaee64eabe7d5b4b68bd22822618a
MD5 6a94efeae9916e5caae1a45dc188c5fa
BLAKE2b-256 e8a31d0dad48daf3e8aa371ef6ff0a61aca981c677bcbc988725d367c78e5c4d

See more details on using hashes here.

File details

Details for the file apepay-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: apepay-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 108.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for apepay-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ee9c8a00a7eb64ab31cf3008eed40d68fa2929f8a7a9d7a339c3d1f2fc8f236d
MD5 ee9e38eae904058d5f16b3d8722349e3
BLAKE2b-256 1cb3bca35e0f6deb8c4b8f7bc23a0151008f742643b4ddb148518949ecbc7a2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page