Skip to content

Commit

Permalink
Fixed missing imports, updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joemarct committed Jun 22, 2021
1 parent f15e5f3 commit ec1307e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 32 deletions.
28 changes: 4 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,8 @@
- Running on an elastic infrastructure that scales according to demand
- The goal is to achieve and guarantee 99.99% uptime and reliability

## Subscription
## Docs and Libraries

Watchtower will only "watch" addresses that are subscribed to by the users.

To subscribe an address, send a POST request to `https://watchtower.cash/api/subscription/` with the BCH or SLP address and the URL where the webhook calls will be sent to (optional). A sample request using `curl` is shown below:
```bash
curl -i -X POST
-H "Content-Type: application/json"
-d '{"address":"simpleledger:qr89dn8th7zj4n74vrqyce4vld522spunv3wkdqd5z", "webhook_url": "https://0f27bf32c670.ngrok.io"}'
https://watchtower.cash/api/subscription/
```

If the `web_url` is given, a POST request notification is sent to the URL whenever a new transcation is detected. A sample notification is shown below:
```python
{
'source': 'WatchTower',
'address': 'simpleledger:qr89dn8th7zj4n74vrqyce4vld522spunv3wkdqd5z',
'txid': '2cb0b57c9a8cad95d08f9b408b77802961d473abf71f0ec30669f9c2272f3d82',
'token': '7f8889682d57369ed0e32336f8b7e0ffec625a35cca183f4e81fde4e71a538a1',
'index': 1,
'amount': 321.0
}
```

(More docs to follow...)
- [API Docs and Browser](https://watchtower.cash/api/docs/)
- [Javascript/NodeJS Package](https://github.com/paytaca/watchtower-cash-js)
- [Python Package](https://github.com/paytaca/watchtower-cash-py)
10 changes: 7 additions & 3 deletions main/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,18 @@ class RecipientAdmin(admin.ModelAdmin):
'valid'
]

class SubscriptionAdmin(admin.ModelAdmin):
class SubscriptionAdmin(DynamicRawIDMixin, admin.ModelAdmin):
list_display = [
'address'
'recipient',
'slp',
'bch',
'websocket'
]

dynamic_raw_id_fields = [
'address',
'recipient'
]


class AddressAdmin(DynamicRawIDMixin, admin.ModelAdmin):
list_display = [
Expand Down
2 changes: 0 additions & 2 deletions main/serializers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from main.serializers.serializer_bch import *
from main.serializers.serializer_blockheight import *
from main.serializers.serializer_recipient import *
from main.serializers.serializer_slp import *
from main.serializers.serializer_token import *
from main.serializers.serializer_transaction import *
from main.serializers.serializer_user_auth import *
Expand Down
1 change: 0 additions & 1 deletion main/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
BlockHeight,
Token,
Transaction,
SlpAddress,
Recipient,
Subscription
)
Expand Down
2 changes: 0 additions & 2 deletions main/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from main.views.view_home import *
from main.views.view_slp import *
from main.views.view_token import *
from main.views.view_transaction import *
from main.views.view_user_auth import *
Expand Down

0 comments on commit ec1307e

Please sign in to comment.