Skip to content

Commit 880a886

Browse files
committed
removed SingleAddressWallet for a proper Lucid implementation
1 parent 7cdf934 commit 880a886

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1411
-968
lines changed

.vscode/launch.json

+38-30
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
"type": "node",
6-
"request": "launch",
7-
"name": "Debug Tests",
8-
"program": "${workspaceRoot}/node_modules/.bin/jest",
9-
"cwd": "${workspaceRoot}",
10-
"args": ["--i", "--config", "jest.config.js"]
11-
},
12-
{
13-
"name": "Launch Extension (development)",
14-
"type": "extensionHost",
15-
"request": "launch",
16-
"runtimeExecutable": "${execPath}",
17-
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
18-
"outFiles": ["${workspaceFolder}/out/**/*.js"],
19-
"preLaunchTask": "watch"
20-
},
21-
{
22-
"name": "Launch Extension (production)",
23-
"type": "extensionHost",
24-
"request": "launch",
25-
"runtimeExecutable": "${execPath}",
26-
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
27-
"outFiles": ["${workspaceFolder}/out/**/*.js"],
28-
"preLaunchTask": "npm: compile"
29-
}
30-
]
31-
}
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Debug Unit Tests",
8+
"program": "${workspaceRoot}/node_modules/.bin/jest",
9+
"cwd": "${workspaceRoot}",
10+
"args": ["--i", "--config", "jest.unit.config.js"],
11+
},
12+
{
13+
"type": "node",
14+
"request": "launch",
15+
"name": "Debug E2E Tests",
16+
"program": "${workspaceRoot}/node_modules/.bin/jest",
17+
"cwd": "${workspaceRoot}",
18+
"args": ["--i", "--config", "jest.e2e.config.js"],
19+
},
20+
{
21+
"name": "Launch Extension (development)",
22+
"type": "extensionHost",
23+
"request": "launch",
24+
"runtimeExecutable": "${execPath}",
25+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
26+
"outFiles": ["${workspaceFolder}/out/**/*.js"],
27+
"preLaunchTask": "watch"
28+
},
29+
{
30+
"name": "Launch Extension (production)",
31+
"type": "extensionHost",
32+
"request": "launch",
33+
"runtimeExecutable": "${execPath}",
34+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
35+
"outFiles": ["${workspaceFolder}/out/**/*.js"],
36+
"preLaunchTask": "npm: compile"
37+
}
38+
]
39+
}

doc/howToDevelop.md

+118-18
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,153 @@
11
# Development
22

3-
## Build
3+
# Build
44

55
In order to start develop the SDK you need to install the dependencies and build the packages.
66

7-
```
7+
```bash
88
$ npm i
99
$ npm run build
1010
```
1111

1212
If you want to build a single package you can use the `-w` flag or execute the build command from the package folder.
1313

14-
```
14+
```bash
1515
# From the root folder
1616
$ npm run build -w @marlowe.io/language-core-v1
1717
# Or you can enter the package and build
1818
$ cd packages/language/core/v1
1919
$ npm run build
2020
```
2121

22+
# Clean
23+
2224
In order to clean the build artifacts you can use the `clean` command.
2325

24-
```
26+
```bash
2527
$ npm run clean
2628
```
2729

28-
To run the unit test you can execute the `test` command.
30+
# Tests
2931

32+
N.B : It is recommended to clean and build the packages before you run the tests to be sure you are playing with the most up to date version of the codebase.
33+
34+
```bash
35+
$ npm run clean && npm
3036
```
37+
38+
## Unit Tests
39+
40+
To run the unit tests for all the packages, from the root folder you can execute the `test` command :
41+
42+
```bash
43+
$ npm run test
44+
```
45+
46+
If you want to run tests for a single package you can use the `-w` flag or execute the build command from the package folder.
47+
48+
```bash
49+
# From the root folder
50+
$ npm run clean && npm run build && npm run test -w @marlowe.io/language-core-v1
51+
# Or you can enter the package folder and test. You will have to clean and build properly the local package
52+
# dependencies of this current package if you modify one of them
53+
# e.g : `packages/language/core/v1` depends on `packages/adapter`. Be sure you have build correctly this package before runnning your test that way.
54+
$ cd packages/language/core/v1
3155
$ npm run test
3256
```
3357

34-
## E2E tests
58+
## Integration/E2E Tests
59+
60+
### Setting up the env Configuration File
61+
62+
1. Create a `./env/.env.test` at the root of the project
63+
2. Copy/Paste the following, and provide the necessary parameter
64+
65+
```bash
66+
####################################################
67+
## Provide a Runtime Instance URL (>= v0.0.5) #
68+
####################################################
69+
## to create an instance of a local Marlowe runtime, follow the instructions in
70+
## the Marlowe starter kit : https://github.com/input-output-hk/ marlowe-starter-kit/blob/main/docs/preliminaries.md
71+
MARLOWE_WEB_SERVER_URL="http://<path-to-a-runtime-instance>:<a-port>"
72+
####################################################
73+
74+
#####################################################
75+
## Provide Wallet Dependencies (Necessary for Lucid Library)
76+
#####################################################
77+
## Blockfrost Account : If you haven't done it before, go to https://blockfrost.io/ and create a free-tier account.
78+
## Then, create a project and copy the project ID
79+
BLOCKFROST_PROJECT_ID="<your-blockfrost-project-id>"
80+
BLOCKFROST_URL="<your-blockfrost-id>"
81+
## Network used by Blockfrost : private | preview | preprod | mainnet
82+
NETWORK_NAME=preprod
83+
## Bank Seed Phrase : The bank is a wallet where you provision enough tAda (>= 100 tAda) to run all
84+
## the e2e tests without running out of money. This is your responsability to create this wallet and
85+
## add tAda using a Faucet.
86+
BANK_SEED_PHRASE='[
87+
"deal",
88+
"place",
89+
"depart",
90+
"sound",
91+
"kick",
92+
"daughter",
93+
"diamond",
94+
"rebel",
95+
"update",
96+
"shoe",
97+
"benefit",
98+
"useful",
99+
"travel",
100+
"fringe",
101+
"culture",
102+
"dog",
103+
"lawsuit",
104+
"combine",
105+
"run",
106+
"vanish",
107+
"warm",
108+
"rubber",
109+
"quit",
110+
"system"
111+
]'
112+
#####################################################
113+
114+
#####################################################
115+
## Logging
116+
#####################################################
117+
## set to true or false if you want to log Debug Info
118+
LOG_DEBUG_LEVEL=false
119+
```
120+
#### How to Generate a new Seed Phrase for a Bank Wallet ?
121+
122+
1. At the root of the project :
123+
```bash
124+
npm run -w @marlowe.io/testing-kit genSeedPhrase
125+
```
126+
2. Copy/paste the words within quotes in the env file.
35127

36-
In order to run the E2E tests you need to create a `./env/.env.test` file that points to a working version of the Marlowe runtime and a working Blockfrost instance and a faucet PK.
128+
#### How to add tAda to the Bank Wallet via a faucet ?
37129

38-
If you haven't done it before, go to https://blockfrost.io/ and create a free-tier account. Then, create a project and copy the project ID. Blockfrost is a Lucid dependency, eventually when
39-
we migrate to a different library this wont be necessary.
130+
1. Retrieve your Bank Wallet payment address
131+
2. Go to https://docs.cardano.org/cardano-testnet/tools/faucet ask for test Ada on this address.
132+
3. Wait a moment till the transaction is confirmed and you should be able to run the tests.
40133

41-
To create an instance of a local Marlowe runtime, follow the instructions in the [Marlowe starter kit](https://github.com/input-output-hk/marlowe-starter-kit/blob/main/docs/preliminaries.md)
134+
### Running the E2E Tests
42135

43-
TODO: explain how to get the Faucet PK
136+
To run the e2e tests for all the packages, from the root folder you can execute the `test:e2e` command :
44137

138+
```bash
139+
$ npm run test:e2e
45140
```
46-
MARLOWE_WEB_SERVER_URL="http://<path-to-runtime>:33294/"
47-
BLOCKFROST_PROJECT_ID="<blockfrost-id>"
48-
BLOCKFROST_URL="https://cardano-preprod.blockfrost.io/api/v0"
49-
NETWORK_ID=Preprod
50-
BANK_PK_HEX='<pk>'
141+
142+
If you want to run tests for a single package you can use the `-w` flag or execute the build command from the package folder.
143+
144+
```bash
145+
# From the root folder
146+
$ npm run clean && npm run build && npm run test:e2e -w @marlowe.io/runtime-lifecycle
147+
# Or you can enter the package folder and test. You will have to clean and build properly the local package
148+
# dependencies of this current package if you modify one of them
149+
$ cd packages/runtime/client/rest
150+
$ npm run test:e2e
51151
```
52152

53153
## Documentation
@@ -56,7 +156,7 @@ BANK_PK_HEX='<pk>'
56156
57157
To compile all documentation
58158

59-
```
159+
```bash
60160
$ npm run docs
61161
```
62162

@@ -89,7 +189,7 @@ This project manages its changelog with [scriv](https://github.com/nedbat/scriv)
89189

90190
Create a new changelog entry template with
91191

92-
```
192+
```s
93193
$ scriv create
94194
```
95195

jest.e2e.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
testEnvironment: "node",
3+
projects: [
4+
"<rootDir>/packages/runtime/client/rest/test/jest.e2e.config.mjs",
5+
"<rootDir>/packages/runtime/lifecycle/test/jest.e2e.config.mjs",
6+
],
7+
};

jest.config.js jest.unit.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module.exports = {
33
projects: [
44
"<rootDir>/packages/language/core/v1/test/jest.unit.config.mjs",
55
"<rootDir>/packages/language/examples/test/jest.unit.config.mjs",
6-
"<rootDir>/packages/wallet/test/jest.unit.config.mjs",
6+
"<rootDir>/packages/wallet/test/jest.unit.config.mjs"
77
],
88
};

0 commit comments

Comments
 (0)