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
-- Temporary until latest version is available on Hackage (or CHaP for that matter). Track https://github.com/IntersectMBO/cardano-addresses/issues/294.
-[Structure of repository](#structure-of-repository)
10
+
-[zkFold Smart Wallet API Server](#zkfold-smart-wallet-api-server)
11
+
-[Building locally from source using the Haskell Toolchain](#building-locally-from-source-using-the-haskell-toolchain)
12
+
-[OpenApi documentation](#openapi-documentation)
13
+
14
+
## Structure of repository
15
+
16
+
-[`zkfold-smart-wallet-api`](./zkfold-smart-wallet-api/) provides off-chain code to interact with the wallet.
17
+
-[`zkfold-smart-wallet-server-lib`](./zkfold-smart-wallet-server-lib/) serves endpoints using our off-chain code to easily interact with the wallet.
18
+
19
+
## zkFold Smart Wallet API Server
20
+
21
+
### Building locally from source using the Haskell Toolchain
22
+
23
+
1. Make sure your environment is configured properly, consult ["How to build?"](https://atlas-app.io/getting-started/how-to-build) section of Atlas documentation for it.
24
+
2. Prepare a configuration, which can be stored either in file or in `SERVER_CONFIG` environment variable. Structure of it is as follows:
25
+
26
+
```yaml
27
+
# Blockchain provider used by Atlas, our off-chain transaction building tool.
28
+
# Head over to https://atlas-app.io/getting-started/endpoints#providing-data-provider section to know how to configure `coreProvider` and what all options are available for it.
29
+
coreProvider:
30
+
maestroToken: YOUR_MAESTRO_TOKEN
31
+
turboSubmit: false
32
+
# Network id, only `mainnet` and `preprod` are supported for at the moment.
33
+
networkId: mainnet
34
+
# Logging configuration. It's an array to cater for potentially multiple scribes.
35
+
# See it's description mentioned at https://atlas-app.io/getting-started/endpoints#providing-data-provider for more information.
36
+
logging:
37
+
- type:
38
+
tag: stderr
39
+
# Possible values of `severity` are `Debug`, `Info`, `Warning` and `Error`.
40
+
severity: Debug
41
+
# Possible values of `verbosity` are `V0`, `V1`, `V2`, `V3` and `V4`. Consult https://hackage.haskell.org/package/katip-0.8.8.0/docs/Katip.html#t:Verbosity for more information about it.
42
+
verbosity: V2
43
+
# Port to serve endpoints at.
44
+
port: 8082
45
+
# API key to protect server endpoints with. It's value must be provided under `api-key` header of request.
46
+
serverApiKey: YOUR_SECRET_KEY
47
+
# UTxO to be used as collateral.
48
+
collateral: tx-id#tx-ix
49
+
# Wallet that provides UTxO to be used as collateral.
50
+
collateralWallet:
51
+
tag: mnemonicWallet
52
+
contents:
53
+
mnemonic:
54
+
- health
55
+
- unable
56
+
- dog
57
+
- lend
58
+
- artefact
59
+
- arctic
60
+
- dinner
61
+
- energy
62
+
- silent
63
+
- wealth
64
+
- shock
65
+
- safe
66
+
- glad
67
+
- mail
68
+
- gas
69
+
- flag
70
+
- beauty
71
+
- penalty
72
+
- mixed
73
+
- garbage
74
+
- erupt
75
+
- wonder
76
+
- magnet
77
+
- around
78
+
# Account index.
79
+
accIx: 0
80
+
# Payment address index.
81
+
addrIx: 0
82
+
```
83
+
3. Run the server with command `cabal run zkfold-smart-wallet-server -- serve -c my-config.yaml`.
84
+
85
+
Call: `cabal run zkfold-smart-wallet-server -- -h`for help. 😉
86
+
87
+
4. Test if server is running successfully by calling, say, `/settings` endpoint. Example `curl` request: `curl -H 'api-key: YOUR_SECRET_KEY' -X GET http://localhost:8082/v0/settings | jq`, assuming port was specified as `8082`. On success, it should return something akin to:
88
+
89
+
```json
90
+
{
91
+
"network":"mainnet",
92
+
"version":"0.1.0",
93
+
"collateral":"tx-id#tx-ix",
94
+
"collateral_address":"addr1qx...w60mw"
95
+
}
96
+
```
97
+
98
+
### OpenApi documentation
99
+
100
+
Endpoints made available by server are specified [here](./web/openapi/api.yaml).
0 commit comments