You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/community-sdks/python-sdk.md
+19-12Lines changed: 19 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,15 @@
2
2
title: Python SDK
3
3
---
4
4
5
-
[`cashscript-py`](https://pypi.org/project/cashscript-py/) is a community-maintained Python SDK for CashScript development. It is a port of the official [TypeScript SDK](../sdk/typescript-sdk.md) and aims to give Python developers (for example those building server-side tools, bots, or Electron Cash plugins) a familiar API for constructing and interacting with CashScript contracts on BCH without re-implementing low-level details.
5
+
[`cashscript-py`][pypi] is a community-maintained Python SDK for CashScript development. It is a port of the official [TypeScript SDK][typescript-sdk] and aims to give Python developers (for example those building server-side tools, bots, or Electron Cash plugins) a familiar API for constructing and interacting with CashScript contracts on BCH without re-implementing low-level details.
6
6
7
7
:::info
8
8
The Python SDK is maintained independently from the official CashScript project. For the full API reference, guides and runnable examples, see the links under [Documentation](#documentation) below.
9
9
:::
10
10
11
11
## When to use the Python SDK
12
12
13
-
Use the Python SDK when you want to build and send CashScript transactions from a Python codebase. It mirrors the structure of the TypeScript SDK, so the same four core classes are available. See the [TypeScript SDK documentation](../sdk/typescript-sdk.md) for more details.
13
+
Use the Python SDK when you want to build and send CashScript transactions from a Python codebase. It mirrors the structure of the TypeScript SDK, so the same four core classes are available. See the [TypeScript SDK documentation][typescript-sdk] for more details.
14
14
15
15
- the `Contract` class
16
16
- the `TransactionBuilder` class
@@ -27,7 +27,7 @@ Install from PyPI:
27
27
pip install cashscript-py
28
28
```
29
29
30
-
Or, with [`uv`](https://docs.astral.sh/uv/):
30
+
Or, with [`uv`][uv]:
31
31
32
32
```bash
33
33
uv add cashscript-py
@@ -37,7 +37,7 @@ uv add cashscript-py
37
37
38
38
The usage of the 4 classes in your code is as follows: before using the SDK you create one or multiple contract artifacts compiled by `cashc`. Then to start using the SDK, you instantiate a `NetworkProvider`, which you then provide to instantiate a `Contract` from an `Artifact`. Once you have a `Contract` instance, you can use it in the `TransactionBuilder`. During transaction building you might need to generate a signature, in which case you would instantiate a `SignatureTemplate`.
39
39
40
-
For more complete examples of the SDK flow, refer to the [runnable examples](https://gitlab.com/cashscript-py/cashscript-py/-/tree/master/examples) in the Python SDK repository.
40
+
For more complete examples of the SDK flow, refer to the [runnable examples][examples] in the Python SDK repository.
The Python SDK and the TypeScript SDK are developed independently and have independent versioning, so APIs and available functionality may drift between the two. The sections below call out the most notable gaps at the time of writing, but for anything beyond the basic flow you should always consult the [Python SDK documentation](https://cashscript-py.readthedocs.io/) rather than assuming parity with the TypeScript SDK.
67
+
The Python SDK and the TypeScript SDK are developed independently and have independent versioning, so APIs and available functionality may drift between the two. The sections below call out the most notable gaps at the time of writing, but for anything beyond the basic flow you should always consult the [Python SDK documentation][readthedocs] rather than assuming parity with the TypeScript SDK.
68
68
69
69
The Python SDK covers the core `Contract`, `TransactionBuilder`, `NetworkProvider` and `SignatureTemplate` APIs, but a few features from the TypeScript SDK are not (yet) available:
70
70
71
71
-**`debug()`**: the TypeScript SDK can locally evaluate and debug transactions via a `debug()` API. The Python SDK does not currently provide an equivalent.
72
-
-**`get_bitauth_uri()`**: the TypeScript SDK can generate a [BitAuth IDE](https://ide.bitauth.com/) URI via `getBitauthUri()`. The Python SDK does not currently provide this helper.
72
+
-**`get_bitauth_uri()`**: the TypeScript SDK can generate a [BitAuth IDE][bitauth-ide] URI via `getBitauthUri()`. The Python SDK does not currently provide this helper.
73
73
-**`generate_wc_transaction_object()`**: the TypeScript SDK can generate a WalletConnect signing payload. The Python SDK does not currently provide this feature.
74
74
75
-
See the [`transaction-builder.md`guide](https://gitlab.com/cashscript-py/cashscript-py/-/blob/master/docs/guide/transaction-builder.md) in the Python SDK repository for the full details on each of these sections.
75
+
See the [Python SDK Transaction Builder guide][transaction-builder-guide] in the Python SDK repository for the full details on each of these sections.
76
76
77
77
## Documentation
78
78
79
79
The Python SDK has its own documentation site and examples.
0 commit comments