@algorandfoundation/algokit-client-generator 1.0.1-beta.2 → 1.0.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,76 @@
|
|
|
1
|
-
# algokit-client-generator
|
|
1
|
+
# AlgoKit TypeScript client generator (algokit-client-generator-ts)
|
|
2
|
+
|
|
3
|
+
This project generates a type-safe smart contract client in TypeScript for the Algorand Blockchain that wraps the [application client](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/docs/capabilities/app-client.md) in [AlgoKit Utils](https://github.com/algorandfoundation/algokit-utils-ts). It does this by reading an [ARC-0032](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0032.md) application spec file.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
To be able to consume the generated file you need to include it in a TypeScript project that has (at least) the following package installed:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm install @algorandfoundation/algokit-utils@2.0.0-beta.9
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Use
|
|
16
|
+
|
|
17
|
+
To use the generator:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npx --yes @algorandfoundation/algokit-client-generator generate -a ./application.json -o ./client.generated.ts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
There are a range of [examples](./examples) that you can look at to see a source smart contract (`{contract.py}`), the generated client (`client.ts`) and some tests that demonstrate how you can use the client (`client.spec.ts`).
|
|
26
|
+
|
|
27
|
+
## Contributing
|
|
28
|
+
|
|
29
|
+
If you want to contribute to this project the following information will be helpful.
|
|
30
|
+
|
|
31
|
+
### Initial setup
|
|
32
|
+
|
|
33
|
+
1. Clone this repository locally
|
|
34
|
+
2. Install pre-requisites:
|
|
35
|
+
|
|
36
|
+
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install): Ensure you can execute `algokit --version`.
|
|
37
|
+
- Bootstrap your local environment; run `algokit bootstrap all` within this folder, which will:
|
|
38
|
+
- Install `Poetry` - [Link](https://python-poetry.org/docs/#installation): The minimum required version is `1.2`. Ensure you can execute `poetry -V` and get `1.2`+
|
|
39
|
+
- Run `poetry install` in the root directory, which will set up a `.venv` folder with a Python virtual environment and also install all Python dependencies
|
|
40
|
+
- Run `npm install`
|
|
41
|
+
|
|
42
|
+
3. Open the project and start debugging / developing via:
|
|
43
|
+
- VS Code
|
|
44
|
+
1. Open the repository root in VS Code
|
|
45
|
+
2. Install recommended extensions
|
|
46
|
+
3. Run tests via test explorer
|
|
47
|
+
- IDEA (e.g. PyCharm)
|
|
48
|
+
1. Open the repository root in the IDE
|
|
49
|
+
2. It should automatically detect it's a Poetry project and set up a Python interpreter and virtual environment.
|
|
50
|
+
3. Run tests
|
|
51
|
+
- Other
|
|
52
|
+
1. Open the repository root in your text editor of choice
|
|
53
|
+
2. Run `npm run test`
|
|
54
|
+
|
|
55
|
+
### Subsequently
|
|
56
|
+
|
|
57
|
+
1. If you update to the latest source code and there are new dependencies you will need to run `algokit bootstrap all` again
|
|
58
|
+
2. Follow step 3 above
|
|
59
|
+
|
|
60
|
+
### Building examples
|
|
61
|
+
|
|
62
|
+
In the `examples` folder there is a series of example contracts along with their generated client. These contracts are built using [Beaker](https://beaker.algo.xyz/).
|
|
63
|
+
|
|
64
|
+
If you want to make changes to any of the smart contract examples and re-generate the ARC-0032 application.json files then change the corresponding `examples/{contract}/{contract}.py` file and then run:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
poetry shell
|
|
68
|
+
cd examples
|
|
69
|
+
python -m build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or in Visual Studio Code you can use the default build task (Ctrl+Shift+B).
|
|
73
|
+
|
|
74
|
+
### Continuous Integration / Continuous Deployment (CI/CD)
|
|
75
|
+
|
|
76
|
+
This project uses [GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions) to define CI/CD workflows, which are located in the [`.github/workflows`](./.github/workflows) folder.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"main": "index.js",
|
|
3
3
|
"types": "index.d.ts",
|
|
4
4
|
"name": "@algorandfoundation/algokit-client-generator",
|
|
5
|
-
"version": "1.0.1-beta.
|
|
5
|
+
"version": "1.0.1-beta.4",
|
|
6
6
|
"description": "Generates a TypeScript client for interacting with, and deploying ARC-0032 smart contracts on the Algorand Blockchain.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"bin": {
|